123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605 |
- /*
- This file is part of Ext JS 6.6.0.258
- Copyright (c) 2011-2018 Sencha Inc
- license: http://www.sencha.com/legal/sencha-software-license-agreement
- Contact: http://www.sencha.com/contact
- Commercial Usage
- Licensees holding valid commercial licenses may use this file in accordance with the Commercial
- Software License Agreement referenced above or, alternatively, in accordance with the
- terms contained in a written agreement between you and Sencha.
- If you are unsure which license is appropriate for your use, please contact the sales department
- at http://www.sencha.com/contact.
- Version: 6.6.0.258 Build date: 2018-06-19 05:16:53 (a26fc5ffb54acf6e1afd5f18c467b14161985898)
- */
- // @tag core
- var Ext = Ext || {};
- Ext.Boot = Ext.Boot || (function(emptyFn) {
- var doc = document,
- _emptyArray = [],
- _config = {
-
- disableCaching: (/[?&](?:cache|disableCacheBuster)\b/i.test(location.search) || !(/http[s]?\:/i.test(location.href)) || /(^|[ ;])ext-cache=1/.test(doc.cookie)) ? false : true,
-
- disableCachingParam: '_dc',
-
- loadDelay: false,
-
- preserveScripts: true,
-
- charset: 'UTF-8'
- },
- _assetConfig = {},
- cssRe = /\.css(?:\?|$)/i,
- resolverEl = doc.createElement('a'),
- isBrowser = typeof window !== 'undefined',
- _environment = {
- browser: isBrowser,
- node: !isBrowser && (typeof require === 'function'),
- phantom: (window && (window._phantom || window.callPhantom)) || /PhantomJS/.test(window.navigator.userAgent)
- },
- _tags = (Ext.platformTags = {}),
-
-
-
-
- _debug = function(message) {},
-
-
- _apply = function(object, config, defaults) {
- if (defaults) {
- _apply(object, defaults);
- }
- if (object && config && typeof config === 'object') {
- for (var i in config) {
- object[i] = config[i];
- }
- }
- return object;
- },
- _merge = function() {
- var lowerCase = false,
- obj = Array.prototype.shift.call(arguments),
- index, i, len, value;
- if (typeof arguments[arguments.length - 1] === 'boolean') {
- lowerCase = Array.prototype.pop.call(arguments);
- }
- len = arguments.length;
- for (index = 0; index < len; index++) {
- value = arguments[index];
- if (typeof value === 'object') {
- for (i in value) {
- obj[lowerCase ? i.toLowerCase() : i] = value[i];
- }
- }
- }
- return obj;
- },
- _getKeys = (typeof Object.keys == 'function') ? function(object) {
- if (!object) {
- return [];
- }
- return Object.keys(object);
- } : function(object) {
- var keys = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- keys.push(property);
- }
- }
- return keys;
- },
-
- Boot = {
- loading: 0,
- loaded: 0,
- apply: _apply,
- env: _environment,
- config: _config,
-
- assetConfig: _assetConfig,
-
-
- scripts: {},
-
-
- currentFile: null,
- suspendedQueue: [],
- currentRequest: null,
-
-
- syncMode: false,
-
-
- debug: _debug,
-
-
- useElements: true,
- listeners: [],
- Request: Request,
- Entry: Entry,
- allowMultipleBrowsers: false,
- browserNames: {
- ie: 'IE',
- firefox: 'Firefox',
- safari: 'Safari',
- chrome: 'Chrome',
- opera: 'Opera',
- dolfin: 'Dolfin',
- edge: 'Edge',
- webosbrowser: 'webOSBrowser',
- chromeMobile: 'ChromeMobile',
- chromeiOS: 'ChromeiOS',
- silk: 'Silk',
- other: 'Other'
- },
- osNames: {
- ios: 'iOS',
- android: 'Android',
- windowsPhone: 'WindowsPhone',
- webos: 'webOS',
- blackberry: 'BlackBerry',
- rimTablet: 'RIMTablet',
- mac: 'MacOS',
- win: 'Windows',
- tizen: 'Tizen',
- linux: 'Linux',
- bada: 'Bada',
- chromeOS: 'ChromeOS',
- other: 'Other'
- },
- browserPrefixes: {
- ie: 'MSIE ',
- edge: 'Edge/',
- firefox: 'Firefox/',
- chrome: 'Chrome/',
- safari: 'Version/',
- opera: 'OPR/',
- dolfin: 'Dolfin/',
- webosbrowser: 'wOSBrowser/',
- chromeMobile: 'CrMo/',
- chromeiOS: 'CriOS/',
- silk: 'Silk/'
- },
-
-
- browserPriority: [
- 'edge',
- 'opera',
- 'dolfin',
- 'webosbrowser',
- 'silk',
- 'chromeiOS',
- 'chromeMobile',
- 'ie',
- 'firefox',
- 'safari',
- 'chrome'
- ],
- osPrefixes: {
- tizen: '(Tizen )',
- ios: 'i(?:Pad|Phone|Pod)(?:.*)CPU(?: iPhone)? OS ',
- android: '(Android |HTC_|Silk/)',
-
-
- windowsPhone: 'Windows Phone ',
- blackberry: '(?:BlackBerry|BB)(?:.*)Version/',
- rimTablet: 'RIM Tablet OS ',
- webos: '(?:webOS|hpwOS)/',
- bada: 'Bada/',
- chromeOS: 'CrOS '
- },
- fallbackOSPrefixes: {
- windows: 'win',
- mac: 'mac',
- linux: 'linux'
- },
- devicePrefixes: {
- iPhone: 'iPhone',
- iPod: 'iPod',
- iPad: 'iPad'
- },
- maxIEVersion: 12,
-
- detectPlatformTags: function() {
- var me = this,
- ua = navigator.userAgent,
- isMobile = /Mobile(\/|\s)/.test(ua),
- element = document.createElement('div'),
- isEventSupported = function(name, tag) {
- if (tag === undefined) {
- tag = window;
- }
- var eventName = 'on' + name.toLowerCase(),
- isSupported = (eventName in element);
- if (!isSupported) {
- if (element.setAttribute && element.removeAttribute) {
- element.setAttribute(eventName, '');
- isSupported = typeof element[eventName] === 'function';
- if (typeof element[eventName] !== 'undefined') {
- element[eventName] = undefined;
- }
- element.removeAttribute(eventName);
- }
- }
- return isSupported;
- },
-
- getBrowsers = function() {
- var browsers = {},
- maxIEVersion, prefix, value, key, index, len, match, version, matched;
-
-
-
- len = me.browserPriority.length;
- for (index = 0; index < len; index++) {
- key = me.browserPriority[index];
- if (!matched) {
- value = me.browserPrefixes[key];
- match = ua.match(new RegExp('(' + value + ')([\\w\\._]+)'));
- version = match && match.length > 1 ? parseInt(match[2]) : 0;
- if (version) {
- matched = true;
- }
- } else {
- version = 0;
- }
- browsers[key] = version;
- }
-
- if (browsers.ie) {
- var mode = document.documentMode;
- if (mode >= 8) {
- browsers.ie = mode;
- }
- }
-
- version = browsers.ie || false;
- maxIEVersion = Math.max(version, me.maxIEVersion);
- for (index = 8; index <= maxIEVersion; ++index) {
- prefix = 'ie' + index;
- browsers[prefix + 'm'] = version ? version <= index : 0;
- browsers[prefix] = version ? version === index : 0;
- browsers[prefix + 'p'] = version ? version >= index : 0;
- }
- return browsers;
- },
-
- getOperatingSystems = function() {
- var systems = {},
- value, key, keys, index, len, match, matched, version, activeCount;
- keys = _getKeys(me.osPrefixes);
- len = keys.length;
- for (index = 0 , activeCount = 0; index < len; index++) {
- key = keys[index];
- value = me.osPrefixes[key];
- match = ua.match(new RegExp('(' + value + ')([^\\s;]+)'));
- matched = match ? match[1] : null;
-
-
- if (matched && (matched === 'HTC_' || matched === 'Silk/')) {
- version = 2.3;
- } else {
- version = match && match.length > 1 ? parseFloat(match[match.length - 1]) : 0;
- }
- if (version) {
- activeCount++;
- }
- systems[key] = version;
- }
- keys = _getKeys(me.fallbackOSPrefixes);
-
-
- len = keys.length;
- for (index = 0; index < len; index++) {
- key = keys[index];
-
- if (activeCount === 0) {
- value = me.fallbackOSPrefixes[key];
- match = ua.toLowerCase().match(new RegExp(value));
- systems[key] = match ? true : 0;
- } else {
- systems[key] = 0;
- }
- }
- return systems;
- },
-
- getDevices = function() {
- var devices = {},
- value, key, keys, index, len, match;
- keys = _getKeys(me.devicePrefixes);
- len = keys.length;
- for (index = 0; index < len; index++) {
- key = keys[index];
- value = me.devicePrefixes[key];
- match = ua.match(new RegExp(value));
- devices[key] = match ? true : 0;
- }
- return devices;
- },
- browsers = getBrowsers(),
- systems = getOperatingSystems(),
- devices = getDevices(),
- platformParams = Boot.loadPlatformsParam();
-
-
- _merge(_tags, browsers, systems, devices, platformParams, true);
- _tags.phone = !!((_tags.iphone || _tags.ipod) || (!_tags.silk && (_tags.android && (_tags.android < 3 || isMobile))) || (_tags.blackberry && isMobile) || (_tags.windowsphone));
- _tags.tablet = !!(!_tags.phone && (_tags.ipad || _tags.android || _tags.silk || _tags.rimtablet || (_tags.ie10 && /; Touch/.test(ua))));
- _tags.touch =
-
- isEventSupported('touchend') ||
-
-
- navigator.maxTouchPoints ||
- navigator.msMaxTouchPoints;
- _tags.desktop = !_tags.phone && !_tags.tablet;
- _tags.cordova = _tags.phonegap = !!(window.PhoneGap || window.Cordova || window.cordova);
- _tags.webview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)(?!.*FBAN)/i.test(ua);
- _tags.androidstock = (_tags.android <= 4.3) && (_tags.safari || _tags.silk);
-
- _merge(_tags, platformParams, true);
- },
-
- loadPlatformsParam: function() {
-
- var paramsString = window.location.search.substr(1),
- paramsArray = paramsString.split("&"),
- params = {},
- i,
- platforms = {},
- tmpArray, tmplen, platform, name, enabled;
- for (i = 0; i < paramsArray.length; i++) {
- tmpArray = paramsArray[i].split("=");
- params[tmpArray[0]] = tmpArray[1];
- }
- if (params.platformTags) {
- tmpArray = params.platformTags.split(",");
- for (tmplen = tmpArray.length , i = 0; i < tmplen; i++) {
- platform = tmpArray[i].split(":");
- name = platform[0];
- enabled = true;
- if (platform.length > 1) {
- enabled = platform[1];
- if (enabled === 'false' || enabled === '0') {
- enabled = false;
- }
- }
- platforms[name] = enabled;
- }
- }
- return platforms;
- },
- filterPlatform: function(platform, excludes) {
- platform = _emptyArray.concat(platform || _emptyArray);
- excludes = _emptyArray.concat(excludes || _emptyArray);
- var plen = platform.length,
- elen = excludes.length,
- include = (!plen && elen),
-
- i, tag;
- for (i = 0; i < plen && !include; i++) {
- tag = platform[i];
- include = !!_tags[tag];
- }
- for (i = 0; i < elen && include; i++) {
- tag = excludes[i];
- include = !_tags[tag];
- }
- return include;
- },
- init: function() {
- var scriptEls = doc.getElementsByTagName('script'),
- script = scriptEls[0],
- len = scriptEls.length,
- re = /\/ext(\-[a-z\-]+)?\.js$/,
- entry, src, state, baseUrl, key, n, origin;
-
- Boot.hasReadyState = ("readyState" in script);
- Boot.hasAsync = ("async" in script);
- Boot.hasDefer = ("defer" in script);
- Boot.hasOnLoad = ("onload" in script);
-
- Boot.isIE8 = Boot.hasReadyState && !Boot.hasAsync && Boot.hasDefer && !Boot.hasOnLoad;
- Boot.isIE9 = Boot.hasReadyState && !Boot.hasAsync && Boot.hasDefer && Boot.hasOnLoad;
- Boot.isIE10p = Boot.hasReadyState && Boot.hasAsync && Boot.hasDefer && Boot.hasOnLoad;
- if (Boot.isIE8) {
- Boot.isIE10 = false;
- Boot.isIE10m = true;
- } else {
- Boot.isIE10 = (new Function('/*@cc_on return @_jscript_version @*/')()) === 10;
- Boot.isIE10m = Boot.isIE10 || Boot.isIE9 || Boot.isIE8;
- }
-
- Boot.isIE11 = Boot.isIE10p && !Boot.isIE10;
-
-
-
- for (n = 0; n < len; n++) {
- src = (script = scriptEls[n]).src;
- if (!src) {
-
- continue;
- }
- state = script.readyState || null;
-
- if (!baseUrl && re.test(src)) {
- baseUrl = src;
- }
- if (!Boot.scripts[key = Boot.canonicalUrl(src)]) {
-
-
-
- entry = new Entry({
- key: key,
- url: src,
- done: state === null ||
- state === 'loaded' || state === 'complete',
-
- el: script,
- prop: 'src'
- });
- }
- }
- if (!baseUrl) {
- script = scriptEls[scriptEls.length - 1];
- baseUrl = script.src;
- }
- Boot.baseUrl = baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1);
- origin = window.location.origin || window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
- Boot.origin = origin;
- Boot.detectPlatformTags();
- Ext.filterPlatform = Boot.filterPlatform;
- },
-
- canonicalUrl: function(url) {
-
-
-
-
-
-
-
-
- resolverEl.href = url;
- var ret = resolverEl.href,
- dc = _config.disableCachingParam,
- pos = dc ? ret.indexOf(dc + '=') : -1,
- c, end;
-
-
- if (pos > 0 && ((c = ret.charAt(pos - 1)) === '?' || c === '&')) {
- end = ret.indexOf('&', pos);
- end = (end < 0) ? '' : ret.substring(end);
- if (end && c === '?') {
- ++pos;
-
- end = end.substring(1);
- }
-
- ret = ret.substring(0, pos - 1) + end;
- }
- return ret;
- },
-
- getConfig: function(name) {
- return name ? Boot.config[name] : Boot.config;
- },
-
- setConfig: function(name, value) {
- if (typeof name === 'string') {
- Boot.config[name] = value;
- } else {
- for (var s in name) {
- Boot.setConfig(s, name[s]);
- }
- }
- return Boot;
- },
- getHead: function() {
- return Boot.docHead || (Boot.docHead = doc.head || doc.getElementsByTagName('head')[0]);
- },
- create: function(url, key, cfg) {
- var config = cfg || {};
- config.url = url;
- config.key = key;
- return Boot.scripts[key] = new Entry(config);
- },
- getEntry: function(url, cfg, canonicalPath) {
- var key, entry;
-
-
- key = canonicalPath ? url : Boot.canonicalUrl(url);
- entry = Boot.scripts[key];
- if (!entry) {
- entry = Boot.create(url, key, cfg);
- if (canonicalPath) {
- entry.canonicalPath = true;
- }
- }
- return entry;
- },
- registerContent: function(url, type, content) {
- var cfg = {
- content: content,
- loaded: true,
- css: type === 'css'
- };
- return Boot.getEntry(url, cfg);
- },
- processRequest: function(request, sync) {
- request.loadEntries(sync);
- },
- load: function(request) {
-
-
-
- var request = new Request(request);
- if (request.sync || Boot.syncMode) {
- return Boot.loadSync(request);
- }
-
-
- if (Boot.currentRequest) {
-
-
-
-
-
-
- request.getEntries();
- Boot.suspendedQueue.push(request);
- } else {
- Boot.currentRequest = request;
- Boot.processRequest(request, false);
- }
- return Boot;
- },
- loadSync: function(request) {
-
-
-
- var request = new Request(request);
- Boot.syncMode++;
- Boot.processRequest(request, true);
- Boot.syncMode--;
- return Boot;
- },
- loadBasePrefix: function(request) {
- request = new Request(request);
- request.prependBaseUrl = true;
- return Boot.load(request);
- },
- loadSyncBasePrefix: function(request) {
- request = new Request(request);
- request.prependBaseUrl = true;
- return Boot.loadSync(request);
- },
- requestComplete: function(request) {
- var next;
- if (Boot.currentRequest === request) {
- Boot.currentRequest = null;
- while (Boot.suspendedQueue.length > 0) {
- next = Boot.suspendedQueue.shift();
- if (!next.done) {
-
-
-
- Boot.load(next);
- break;
- }
- }
- }
- if (!Boot.currentRequest && Boot.suspendedQueue.length == 0) {
- Boot.fireListeners();
- }
- },
- isLoading: function() {
- return !Boot.currentRequest && Boot.suspendedQueue.length == 0;
- },
- fireListeners: function() {
- var listener;
- while (Boot.isLoading() && (listener = Boot.listeners.shift())) {
- listener();
- }
- },
- onBootReady: function(listener) {
- if (!Boot.isLoading()) {
- listener();
- } else {
- Boot.listeners.push(listener);
- }
- },
-
- getPathsFromIndexes: function(indexMap, loadOrder) {
-
- if (!('length' in indexMap)) {
- var indexArray = [],
- index;
- for (index in indexMap) {
- if (!isNaN(+index)) {
- indexArray[+index] = indexMap[index];
- }
- }
- indexMap = indexArray;
- }
- return Request.prototype.getPathsFromIndexes(indexMap, loadOrder);
- },
- createLoadOrderMap: function(loadOrder) {
- return Request.prototype.createLoadOrderMap(loadOrder);
- },
- fetch: function(url, complete, scope, async) {
- async = (async === undefined) ? !!complete : async;
- var xhr = new XMLHttpRequest(),
- result, status, content,
- exception = false,
- readyStateChange = function() {
- if (xhr && xhr.readyState == 4) {
- status = (xhr.status === 1223) ? 204 : (xhr.status === 0 && ((self.location || {}).protocol === 'file:' || (self.location || {}).protocol === 'ionp:')) ? 200 : xhr.status;
- content = xhr.responseText;
- result = {
- content: content,
- status: status,
- exception: exception
- };
- if (complete) {
- complete.call(scope, result);
- }
- xhr.onreadystatechange = emptyFn;
- xhr = null;
- }
- };
- if (async) {
- xhr.onreadystatechange = readyStateChange;
- }
- try {
-
-
-
- xhr.open('GET', url, async);
- xhr.send(null);
- } catch (err) {
- exception = err;
- readyStateChange();
- return result;
- }
- if (!async) {
- readyStateChange();
- }
- return result;
- },
- notifyAll: function(entry) {
- entry.notifyRequests();
- }
- };
- function Request(cfg) {
-
-
-
- if (cfg.$isRequest) {
- return cfg;
- }
- var cfg = cfg.url ? cfg : {
- url: cfg
- },
- url = cfg.url,
- urls = url.charAt ? [
- url
- ] : url,
- charset = cfg.charset || Boot.config.charset;
- _apply(this, cfg);
- delete this.url;
- this.urls = urls;
- this.charset = charset;
- }
-
- Request.prototype = {
- $isRequest: true,
- createLoadOrderMap: function(loadOrder) {
- var len = loadOrder.length,
- loadOrderMap = {},
- i, element;
- for (i = 0; i < len; i++) {
- element = loadOrder[i];
- loadOrderMap[element.path] = element;
- }
- return loadOrderMap;
- },
- getLoadIndexes: function(item, indexMap, loadOrder, includeUses, skipLoaded) {
- var resolved = [],
- queue = [
- item
- ],
- itemIndex = item.idx,
- queue, entry, dependencies, depIndex, i, len;
- if (indexMap[itemIndex]) {
-
- return resolved;
- }
-
-
-
-
-
-
-
- indexMap[itemIndex] = resolved[itemIndex] = true;
- while (item = queue.shift()) {
-
- if (item.canonicalPath) {
- entry = Boot.getEntry(item.path, null, true);
- } else {
- entry = Boot.getEntry(this.prepareUrl(item.path));
- }
- if (!(skipLoaded && entry.done)) {
- if (includeUses && item.uses && item.uses.length) {
- dependencies = item.requires.concat(item.uses);
- } else {
- dependencies = item.requires;
- }
- for (i = 0 , len = dependencies.length; i < len; i++) {
- depIndex = dependencies[i];
- if (!indexMap[depIndex]) {
- indexMap[depIndex] = resolved[depIndex] = true;
- queue.push(loadOrder[depIndex]);
- }
- }
- }
- }
- return resolved;
- },
- getPathsFromIndexes: function(indexes, loadOrder) {
- var paths = [],
- index, len;
-
- for (index = 0 , len = indexes.length; index < len; index++) {
- if (indexes[index]) {
- paths.push(loadOrder[index].path);
- }
- }
- return paths;
- },
- expandUrl: function(url, loadOrder, loadOrderMap, indexMap, includeUses, skipLoaded) {
- var item, resolved;
- if (loadOrder) {
- item = loadOrderMap[url];
- if (item) {
- resolved = this.getLoadIndexes(item, indexMap, loadOrder, includeUses, skipLoaded);
- if (resolved.length) {
- return this.getPathsFromIndexes(resolved, loadOrder);
- }
- }
- }
- return [
- url
- ];
- },
- expandUrls: function(urls, includeUses) {
- var me = this,
- loadOrder = me.loadOrder,
- expanded = [],
- expandMap = {},
- indexMap = [],
- loadOrderMap, tmpExpanded, i, len, t, tlen, tUrl;
- if (typeof urls === "string") {
- urls = [
- urls
- ];
- }
- if (loadOrder) {
- loadOrderMap = me.loadOrderMap;
- if (!loadOrderMap) {
- loadOrderMap = me.loadOrderMap = me.createLoadOrderMap(loadOrder);
- }
- }
- for (i = 0 , len = urls.length; i < len; i++) {
-
-
-
-
- tmpExpanded = this.expandUrl(urls[i], loadOrder, loadOrderMap, indexMap, includeUses, false);
- for (t = 0 , tlen = tmpExpanded.length; t < tlen; t++) {
- tUrl = tmpExpanded[t];
- if (!expandMap[tUrl]) {
- expandMap[tUrl] = true;
- expanded.push(tUrl);
- }
- }
- }
- if (expanded.length === 0) {
- expanded = urls;
- }
- return expanded;
- },
- expandLoadOrder: function() {
- var me = this,
- urls = me.urls,
- expanded;
- if (!me.expanded) {
- expanded = this.expandUrls(urls, true);
- me.expanded = true;
- } else {
- expanded = urls;
- }
- me.urls = expanded;
-
-
- if (urls.length != expanded.length) {
- me.sequential = true;
- }
- return me;
- },
- getUrls: function() {
- this.expandLoadOrder();
- return this.urls;
- },
- prepareUrl: function(url) {
- if (this.prependBaseUrl) {
- return Boot.baseUrl + url;
- }
- return url;
- },
- getEntries: function() {
- var me = this,
- entries = me.entries,
- loadOrderMap, item, i, entry, urls, url;
- if (!entries) {
- entries = [];
- urls = me.getUrls();
-
- if (me.loadOrder) {
- loadOrderMap = me.loadOrderMap;
- }
- for (i = 0; i < urls.length; i++) {
- url = me.prepareUrl(urls[i]);
- if (loadOrderMap) {
- item = loadOrderMap[url];
- }
- entry = Boot.getEntry(url, {
- buster: me.buster,
- charset: me.charset
- }, item && item.canonicalPath);
- entry.requests.push(me);
- entries.push(entry);
- }
- me.entries = entries;
- }
- return entries;
- },
- loadEntries: function(sync) {
- var me = this,
- entries = me.getEntries(),
- len = entries.length,
- start = me.loadStart || 0,
- continueLoad, entries, entry, i;
- if (sync !== undefined) {
- me.sync = sync;
- }
- me.loaded = me.loaded || 0;
- me.loading = me.loading || len;
- for (i = start; i < len; i++) {
- entry = entries[i];
- if (!entry.loaded) {
- continueLoad = entries[i].load(me.sync);
- } else {
- continueLoad = true;
- }
- if (!continueLoad) {
- me.loadStart = i;
- entry.onDone(function() {
- me.loadEntries(sync);
- });
- break;
- }
- }
- me.processLoadedEntries();
- },
- processLoadedEntries: function() {
- var me = this,
- entries = me.getEntries(),
- len = entries.length,
- start = me.startIndex || 0,
- i, entry;
- if (!me.done) {
- for (i = start; i < len; i++) {
- entry = entries[i];
- if (!entry.loaded) {
- me.startIndex = i;
- return;
- }
- if (!entry.evaluated) {
- entry.evaluate();
- }
- if (entry.error) {
- me.error = true;
- }
- }
- me.notify();
- }
- },
- notify: function() {
- var me = this;
- if (!me.done) {
- var error = me.error,
- fn = me[error ? 'failure' : 'success'],
- delay = ('delay' in me) ? me.delay : (error ? 1 : Boot.config.chainDelay),
- scope = me.scope || me;
- me.done = true;
- if (fn) {
- if (delay === 0 || delay > 0) {
-
- setTimeout(function() {
- fn.call(scope, me);
- }, delay);
- } else {
- fn.call(scope, me);
- }
- }
- me.fireListeners();
- Boot.requestComplete(me);
- }
- },
- onDone: function(listener) {
- var me = this,
- listeners = me.listeners || (me.listeners = []);
- if (me.done) {
- listener(me);
- } else {
- listeners.push(listener);
- }
- },
- fireListeners: function() {
- var listeners = this.listeners,
- listener;
- if (listeners) {
-
-
-
- while ((listener = listeners.shift())) {
- listener(this);
- }
- }
- }
- };
- function Entry(cfg) {
-
-
-
- if (cfg.$isEntry) {
- return cfg;
- }
-
-
-
- var charset = cfg.charset || Boot.config.charset,
- manifest = Ext.manifest,
- loader = manifest && manifest.loader,
- cache = (cfg.cache !== undefined) ? cfg.cache : (loader && loader.cache),
- buster, busterParam;
- if (Boot.config.disableCaching) {
- if (cache === undefined) {
- cache = !Boot.config.disableCaching;
- }
- if (cache === false) {
- buster = +new Date();
- } else if (cache !== true) {
- buster = cache;
- }
- if (buster) {
- busterParam = (loader && loader.cacheParam) || Boot.config.disableCachingParam;
- buster = busterParam + "=" + buster;
- }
- }
- _apply(this, cfg);
- this.charset = charset;
- this.buster = buster;
- this.requests = [];
- }
-
- Entry.prototype = {
- $isEntry: true,
- done: false,
- evaluated: false,
- loaded: false,
- isCrossDomain: function() {
- var me = this;
- if (me.crossDomain === undefined) {
-
-
-
- me.crossDomain = (me.getLoadUrl().indexOf(Boot.origin) !== 0);
- }
- return me.crossDomain;
- },
- isCss: function() {
- var me = this;
- if (me.css === undefined) {
- if (me.url) {
- var assetConfig = Boot.assetConfig[me.url];
- me.css = assetConfig ? assetConfig.type === "css" : cssRe.test(me.url);
- } else {
- me.css = false;
- }
- }
- return this.css;
- },
- getElement: function(tag) {
- var me = this,
- el = me.el;
- if (!el) {
-
-
-
- if (me.isCss()) {
- tag = tag || "link";
- el = doc.createElement(tag);
- if (tag == "link") {
- el.rel = 'stylesheet';
- me.prop = 'href';
- } else {
- me.prop = "textContent";
- }
- el.type = "text/css";
- } else {
- tag = tag || "script";
- el = doc.createElement(tag);
- el.type = 'text/javascript';
- me.prop = 'src';
- if (me.charset) {
- el.charset = me.charset;
- }
- if (Boot.hasAsync) {
- el.async = false;
- }
- }
- me.el = el;
- }
- return el;
- },
- getLoadUrl: function() {
- var me = this,
- url;
- url = me.canonicalPath ? me.url : Boot.canonicalUrl(me.url);
- if (!me.loadUrl) {
- me.loadUrl = !!me.buster ? (url + (url.indexOf('?') === -1 ? '?' : '&') + me.buster) : url;
- }
- return me.loadUrl;
- },
- fetch: function(req) {
- var url = this.getLoadUrl(),
- async = !!req.async,
- complete = req.complete;
- Boot.fetch(url, complete, this, async);
- },
- onContentLoaded: function(response) {
- var me = this,
- status = response.status,
- content = response.content,
- exception = response.exception,
- url = this.getLoadUrl();
- me.loaded = true;
- if ((exception || status === 0) && !_environment.phantom) {
- me.error =
- ("Failed loading synchronously via XHR: '" + url + "'. It's likely that the file is either being loaded from a " + "different domain or from the local file system where cross " + "origin requests are not allowed for security reasons. Try " + "asynchronous loading instead.") ||
- true;
- me.evaluated = true;
- } else if ((status >= 200 && status < 300) || status === 304 || _environment.phantom || (status === 0 && content.length > 0)) {
- me.content = content;
- } else {
- me.error =
- ("Failed loading synchronously via XHR: '" + url + "'. Please verify that the file exists. XHR status code: " + status) ||
- true;
- me.evaluated = true;
- }
- },
- createLoadElement: function(callback) {
- var me = this,
- el = me.getElement();
- me.preserve = true;
- el.onerror = function() {
- me.error = true;
- if (callback) {
- callback();
- callback = null;
- }
- };
- if (Boot.isIE10m) {
- el.onreadystatechange = function() {
- if (this.readyState === 'loaded' || this.readyState === 'complete') {
- if (callback) {
- callback();
- callback = this.onreadystatechange = this.onerror = null;
- }
- }
- };
- } else {
- el.onload = function() {
- callback();
- callback = this.onload = this.onerror = null;
- };
- }
-
- el[me.prop] = me.getLoadUrl();
- },
- onLoadElementReady: function() {
- Boot.getHead().appendChild(this.getElement());
- this.evaluated = true;
- },
- inject: function(content, asset) {
-
-
-
- var me = this,
- head = Boot.getHead(),
- url = me.url,
- key = me.key,
- base, el, ieMode, basePath;
- if (me.isCss()) {
- me.preserve = true;
- basePath = key.substring(0, key.lastIndexOf("/") + 1);
- base = doc.createElement('base');
- base.href = basePath;
- if (head.firstChild) {
- head.insertBefore(base, head.firstChild);
- } else {
- head.appendChild(base);
- }
-
- base.href = base.href;
- if (url) {
- content += "\n/*# sourceURL=" + key + " */";
- }
-
- el = me.getElement("style");
- ieMode = ('styleSheet' in el);
- head.appendChild(base);
- if (ieMode) {
- head.appendChild(el);
- el.styleSheet.cssText = content;
- } else {
- el.textContent = content;
- head.appendChild(el);
- }
- head.removeChild(base);
- } else {
-
-
-
- if (url) {
- content += "\n//# sourceURL=" + key;
- }
- Ext.globalEval(content);
- }
- return me;
- },
- loadCrossDomain: function() {
- var me = this,
- complete = function() {
- me.el.onerror = me.el.onload = emptyFn;
- me.el = null;
- me.loaded = me.evaluated = me.done = true;
- me.notifyRequests();
- };
- me.createLoadElement(function() {
- complete();
- });
- me.evaluateLoadElement();
-
-
-
- return false;
- },
- loadElement: function() {
- var me = this,
- complete = function() {
- me.el.onerror = me.el.onload = emptyFn;
- me.el = null;
- me.loaded = me.evaluated = me.done = true;
- me.notifyRequests();
- };
- me.createLoadElement(function() {
- complete();
- });
- me.evaluateLoadElement();
- return true;
- },
- loadSync: function() {
- var me = this;
- me.fetch({
- async: false,
- complete: function(response) {
- me.onContentLoaded(response);
- }
- });
- me.evaluate();
- me.notifyRequests();
- },
- load: function(sync) {
- var me = this;
- if (!me.loaded) {
- if (me.loading) {
-
-
-
-
-
-
-
- return false;
- }
- me.loading = true;
-
- if (!sync) {
-
-
-
-
-
- if (Boot.isIE10 || me.isCrossDomain()) {
- return me.loadCrossDomain();
- }
-
-
-
- else if (!me.isCss() && Boot.hasReadyState) {
- me.createLoadElement(function() {
- me.loaded = true;
- me.notifyRequests();
- });
- } else if (Boot.useElements &&
- !(me.isCss() && _environment.phantom)) {
- return me.loadElement();
- } else
-
- {
- me.fetch({
- async: !sync,
- complete: function(response) {
- me.onContentLoaded(response);
- me.notifyRequests();
- }
- });
- }
- } else
-
-
- {
- me.loadSync();
- }
- }
-
- return true;
- },
- evaluateContent: function() {
- this.inject(this.content);
- this.content = null;
- },
- evaluateLoadElement: function() {
- Boot.getHead().appendChild(this.getElement());
- },
- evaluate: function() {
- var me = this;
- if (!me.evaluated) {
- if (me.evaluating) {
- return;
- }
- me.evaluating = true;
- if (me.content !== undefined) {
- me.evaluateContent();
- } else if (!me.error) {
- me.evaluateLoadElement();
- }
- me.evaluated = me.done = true;
- me.cleanup();
- }
- },
- cleanup: function() {
- var me = this,
- el = me.el,
- prop;
- if (!el) {
- return;
- }
- if (!me.preserve) {
- me.el = null;
- el.parentNode.removeChild(el);
-
- for (prop in el) {
- try {
- if (prop !== me.prop) {
-
-
- el[prop] = null;
- }
- delete el[prop];
- }
- catch (cleanEx) {}
- }
- }
-
-
-
-
- el.onload = el.onerror = el.onreadystatechange = emptyFn;
- },
- notifyRequests: function() {
- var requests = this.requests,
- len = requests.length,
- i, request;
- for (i = 0; i < len; i++) {
- request = requests[i];
- request.processLoadedEntries();
- }
- if (this.done) {
- this.fireListeners();
- }
- },
- onDone: function(listener) {
- var me = this,
- listeners = me.listeners || (me.listeners = []);
- if (me.done) {
- listener(me);
- } else {
- listeners.push(listener);
- }
- },
- fireListeners: function() {
- var listeners = this.listeners,
- listener;
- if (listeners && listeners.length > 0) {
-
-
-
- while ((listener = listeners.shift())) {
- listener(this);
- }
- }
- }
- };
-
- Ext.disableCacheBuster = function(disable, path) {
- var date = new Date();
- date.setTime(date.getTime() + (disable ? 10 * 365 : -1) * 24 * 60 * 60 * 1000);
- date = date.toGMTString();
- doc.cookie = 'ext-cache=1; expires=' + date + '; path=' + (path || '/');
- };
- Boot.init();
- return Boot;
- }(
- function() {}));
- Ext.globalEval = Ext.globalEval || (this.execScript ? function(code) {
- execScript(code);
- } : function($$code) {
- eval.call(window, $$code);
- });
- if (!Function.prototype.bind) {
- (function() {
- var slice = Array.prototype.slice,
-
-
- bind = function(me) {
- var args = slice.call(arguments, 1),
- method = this;
- if (args.length) {
- return function() {
- var t = arguments;
-
- return method.apply(me, t.length ? args.concat(slice.call(t)) : args);
- };
- }
-
- args = null;
- return function() {
- return method.apply(me, arguments);
- };
- };
- Function.prototype.bind = bind;
- bind.$extjs = true;
- }());
- }
- Ext.setResourcePath = function(poolName, path) {
- var manifest = Ext.manifest || (Ext.manifest = {}),
- paths = manifest.resources || (manifest.resources = {});
- if (manifest) {
- if (typeof poolName !== 'string') {
- Ext.apply(paths, poolName);
- } else {
- paths[poolName] = path;
- }
- manifest.resources = paths;
- }
- };
- Ext.getResourcePath = function(path, poolName, packageName) {
- if (typeof path !== 'string') {
- poolName = path.pool;
- packageName = path.packageName;
- path = path.path;
- }
- var manifest = Ext.manifest,
- paths = manifest && manifest.resources,
- poolPath = paths[poolName],
- output = [];
- if (poolPath == null) {
- poolPath = paths.path;
- if (poolPath == null) {
- poolPath = 'resources';
- }
- }
- if (poolPath) {
- output.push(poolPath);
- }
- if (packageName) {
- output.push(packageName);
- }
- output.push(path);
- return output.join('/');
- };
- var Ext = Ext || {};
- (function() {
- var global = this,
- objectPrototype = Object.prototype,
- toString = objectPrototype.toString,
- enumerables = [
-
- 'valueOf',
- 'toLocaleString',
- 'toString',
- 'constructor'
- ],
- emptyFn = Ext.fireIdle = function() {},
-
- privateFn = function() {},
- identityFn = function(o) {
- return o;
- },
-
-
- callOverrideParent = function() {
- var method = callOverrideParent.caller.caller;
-
- return method.$owner.prototype[method.$name].apply(this, arguments);
- },
- manifest = Ext.manifest || {},
- i,
- iterableRe = /\[object\s*(?:Array|Arguments|\w*Collection|\w*List|HTML\s+document\.all\s+class)\]/,
- MSDateRe = /^\\?\/Date\(([-+])?(\d+)(?:[+-]\d{4})?\)\\?\/$/,
- elevateArgs, elevateFn, elevateRet, elevateScope;
- Ext.global = global;
- Ext.$nextIid = 0;
-
- Ext.now = Date.now || (Date.now = function() {
- return +new Date();
- });
-
- Ext.ticks = (global.performance && global.performance.now) ? function() {
- return performance.now();
- } :
- Ext.now;
- Ext._startTime = Ext.ticks();
-
- emptyFn.$nullFn = identityFn.$nullFn = emptyFn.$emptyFn = identityFn.$identityFn = privateFn.$nullFn = true;
- privateFn.$privacy = 'framework';
-
- emptyFn.$noClearOnDestroy = identityFn.$noClearOnDestroy = true;
- privateFn.$noClearOnDestroy = true;
-
-
- Ext['suspendLayouts'] = Ext['resumeLayouts'] = emptyFn;
-
- for (i in {
- toString: 1
- }) {
- enumerables = null;
- }
-
- Ext.enumerables = enumerables;
-
- Ext.apply = function(object, config, defaults) {
- if (object) {
- if (defaults) {
- Ext.apply(object, defaults);
- }
- if (config && typeof config === 'object') {
- var i, j, k;
- for (i in config) {
- object[i] = config[i];
- }
- if (enumerables) {
- for (j = enumerables.length; j--; ) {
- k = enumerables[j];
- if (config.hasOwnProperty(k)) {
- object[k] = config[k];
- }
- }
- }
- }
- }
- return object;
- };
-
- function addInstanceOverrides(target, owner, overrides) {
- var name, value;
- for (name in overrides) {
- if (overrides.hasOwnProperty(name)) {
- value = overrides[name];
- if (typeof value === 'function') {
-
- if (owner.$className) {
- value.name = owner.$className + '#' + name;
- }
-
- value.$name = name;
- value.$owner = owner;
- value.$previous = target.hasOwnProperty(name) ? target[name] :
- callOverrideParent;
- }
-
- target[name] = value;
- }
- }
- }
- Ext.buildSettings = Ext.apply({
- baseCSSPrefix: 'x-'
- }, Ext.buildSettings || {});
- Ext.apply(Ext, {
-
- idSeed: 0,
-
- idPrefix: 'ext-',
-
- isRobot: false,
-
- isSecure: /^https/i.test(window.location.protocol),
-
- enableGarbageCollector: false,
-
- enableListenerCollection: true,
-
- name: Ext.sandboxName || 'Ext',
-
- privateFn: privateFn,
-
- emptyFn: emptyFn,
-
- identityFn: identityFn,
-
- frameStartTime: Ext.now(),
-
- manifest: manifest,
-
-
- debugConfig: Ext.debugConfig || manifest.debug || {
- hooks: {
- '*': true
- }
- },
-
-
- enableAria: true,
- startsWithHashRe: /^#/,
-
- validIdRe: /^[a-z_][a-z0-9\-_]*$/i,
-
- BLANK_IMAGE_URL: 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
-
- makeIdSelector: function(id) {
-
- if (!Ext.validIdRe.test(id)) {
- Ext.raise('Invalid id selector: "' + id + '"');
- }
-
- return '#' + id;
- },
-
- id: function(o, prefix) {
- if (o && o.id) {
- return o.id;
- }
- var id = (prefix || Ext.idPrefix) + (++Ext.idSeed);
- if (o) {
- o.id = id;
- }
- return id;
- },
-
- returnId: function(o) {
- return o.getId();
- },
-
- returnTrue: function() {
- return true;
- },
-
- emptyString: new String(),
-
-
- emptyArray: Object.freeze ? Object.freeze([]) : [],
-
- baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
-
- $eventNameMap: {},
-
-
- $vendorEventRe: /^(DOMMouse|Moz.+|MS.+|webkit.+)/,
-
-
- canonicalEventName: function(name) {
- return Ext.$eventNameMap[name] || (Ext.$eventNameMap[name] = (Ext.$vendorEventRe.test(name) ? name : name.toLowerCase()));
- },
-
- applyIf: function(object, config) {
- if (object && config && typeof config === 'object') {
- for (var property in config) {
- if (object[property] === undefined) {
- object[property] = config[property];
- }
- }
- }
- return object;
- },
-
- destroy: function() {
- var ln = arguments.length,
- i, arg;
- for (i = 0; i < ln; i++) {
- arg = arguments[i];
- if (arg) {
- if (Ext.isArray(arg)) {
- this.destroy.apply(this, arg);
- } else if (Ext.isFunction(arg.destroy) && !arg.destroyed) {
- arg.destroy();
- }
- }
- }
- return null;
- },
-
- destroyMembers: function(object) {
- for (var ref, name,
- i = 1,
- a = arguments,
- len = a.length; i < len; i++) {
- ref = object[name = a[i]];
-
- if (ref != null) {
- object[name] = Ext.destroy(ref);
- }
- }
- },
-
- override: function(target, overrides) {
- if (target.$isClass) {
- target.override(overrides);
- } else if (typeof target === 'function') {
- Ext.apply(target.prototype, overrides);
- } else {
- var owner = target.self,
- privates;
- if (owner && owner.$isClass) {
-
- privates = overrides.privates;
- if (privates) {
- overrides = Ext.apply({}, overrides);
- delete overrides.privates;
- addInstanceOverrides(target, owner, privates);
- }
- addInstanceOverrides(target, owner, overrides);
- } else {
- Ext.apply(target, overrides);
- }
- }
- return target;
- },
-
- valueFrom: function(value, defaultValue, allowBlank) {
- return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
- },
-
- isEmpty: function(value, allowEmptyString) {
- return (value == null) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
- },
-
- isArray: ('isArray' in Array) ? Array.isArray : function(value) {
- return toString.call(value) === '[object Array]';
- },
-
- isDate: function(obj) {
- return toString.call(obj) === '[object Date]';
- },
-
- isMSDate: function(value) {
- if (!Ext.isString(value)) {
- return false;
- }
- return MSDateRe.test(value);
- },
-
- isObject: (toString.call(null) === '[object Object]') ? function(value) {
-
- return value != null && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
- } : function(value) {
- return toString.call(value) === '[object Object]';
- },
-
- isSimpleObject: function(value) {
- return value instanceof Object && value.constructor === Object;
- },
-
- isPrimitive: function(value) {
- var type = typeof value;
- return type === 'string' || type === 'number' || type === 'boolean';
- },
-
- isFunction:
-
- (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
- return !!value && toString.call(value) === '[object Function]';
- } : function(value) {
- return !!value && typeof value === 'function';
- },
-
- isNumber: function(value) {
- return typeof value === 'number' && isFinite(value);
- },
-
- isNumeric: function(value) {
- return !isNaN(parseFloat(value)) && isFinite(value);
- },
-
- isString: function(value) {
- return typeof value === 'string';
- },
-
- isBoolean: function(value) {
- return typeof value === 'boolean';
- },
-
- isElement: function(value) {
- return value ? value.nodeType === 1 : false;
- },
-
- isTextNode: function(value) {
- return value ? value.nodeName === "#text" : false;
- },
-
- isDefined: function(value) {
- return typeof value !== 'undefined';
- },
-
- isIterable: function(value) {
-
- if (!value || typeof value.length !== 'number' || typeof value === 'string' || Ext.isFunction(value)) {
- return false;
- }
-
-
-
- if (!value.propertyIsEnumerable) {
- return !!value.item;
- }
-
-
- if (value.hasOwnProperty('length') && !value.propertyIsEnumerable('length')) {
- return true;
- }
-
- return iterableRe.test(toString.call(value));
- },
-
- isDebugEnabled:
- function(className, defaultEnabled) {
- var debugConfig = Ext.debugConfig.hooks;
- if (debugConfig.hasOwnProperty(className)) {
- return debugConfig[className];
- }
- var enabled = debugConfig['*'],
- prefixLength = 0;
- if (defaultEnabled !== undefined) {
- enabled = defaultEnabled;
- }
- if (!className) {
- return enabled;
- }
- for (var prefix in debugConfig) {
- var value = debugConfig[prefix];
-
- if (className.charAt(prefix.length) === '.') {
- if (className.substring(0, prefix.length) === prefix) {
- if (prefixLength < prefix.length) {
- prefixLength = prefix.length;
- enabled = value;
- }
- }
- }
- }
- return enabled;
- } ||
- emptyFn,
-
- clone: function(item, cloneDom) {
- if (item == null) {
- return item;
- }
-
-
-
- if (cloneDom !== false && item.nodeType && item.cloneNode) {
- return item.cloneNode(true);
- }
- var type = toString.call(item),
- i, j, k, clone, key;
-
- if (type === '[object Date]') {
- return new Date(item.getTime());
- }
-
- if (type === '[object Array]') {
- i = item.length;
- clone = [];
- while (i--) {
- clone[i] = Ext.clone(item[i], cloneDom);
- }
- }
-
- else if (type === '[object Object]' && item.constructor === Object) {
- clone = {};
- for (key in item) {
- clone[key] = Ext.clone(item[key], cloneDom);
- }
- if (enumerables) {
- for (j = enumerables.length; j--; ) {
- k = enumerables[j];
- if (item.hasOwnProperty(k)) {
- clone[k] = item[k];
- }
- }
- }
- }
- return clone || item;
- },
-
- getUniqueGlobalNamespace: function() {
- var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
- i;
- if (uniqueGlobalNamespace === undefined) {
- i = 0;
- do {
- uniqueGlobalNamespace = 'ExtBox' + (++i);
- } while (global[uniqueGlobalNamespace] !== undefined);
- global[uniqueGlobalNamespace] = Ext;
- this.uniqueGlobalNamespace = uniqueGlobalNamespace;
- }
- return uniqueGlobalNamespace;
- },
-
- functionFactoryCache: {},
- cacheableFunctionFactory: function() {
- var me = this,
- args = Array.prototype.slice.call(arguments),
- cache = me.functionFactoryCache,
- idx, fn, ln;
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
- idx = args.join('');
- fn = cache[idx];
- if (!fn) {
- fn = Function.prototype.constructor.apply(Function.prototype, args);
- cache[idx] = fn;
- }
- return fn;
- },
- functionFactory: function() {
- var args = Array.prototype.slice.call(arguments),
- ln;
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
- return Function.prototype.constructor.apply(Function.prototype, args);
- },
-
- Logger: {
-
- log: function(message, priority) {
- if (message && global.console) {
- if (!priority || !(priority in global.console)) {
- priority = 'log';
- }
- message = '[' + priority.toUpperCase() + '] ' + message;
- global.console[priority](message);
- }
- },
- verbose: function(message) {
- this.log(message, 'verbose');
- },
- info: function(message) {
- this.log(message, 'info');
- },
- warn: function(message) {
- this.log(message, 'warn');
- },
- error: function(message) {
- throw new Error(message);
- },
- deprecate: function(message) {
- this.log(message, 'warn');
- }
- } || {
-
- verbose: emptyFn,
- log: emptyFn,
- info: emptyFn,
- warn: emptyFn,
- error: function(message) {
- throw new Error(message);
- },
- deprecate: emptyFn
- },
- ariaWarn: function(target, msg) {
-
-
-
- if (Ext.enableAria && !Ext.slicer) {
- if (!Ext.ariaWarn.first) {
- Ext.ariaWarn.first = true;
- Ext.log.warn("WAI-ARIA compatibility warnings can be suppressed " + "by adding the following to application startup code:");
- Ext.log.warn(" Ext.ariaWarn = Ext.emptyFn;");
- }
- Ext.log.warn({
- msg: msg,
- dump: target
- });
- }
- },
-
- getElementById: function(id) {
- return document.getElementById(id);
- },
-
- splitAndUnescape: (function() {
- var cache = {};
- return function(origin, delimiter) {
- if (!origin) {
- return [];
- } else if (!delimiter) {
- return [
- origin
- ];
- }
- var replaceRe = cache[delimiter] || (cache[delimiter] = new RegExp('\\\\' + delimiter, 'g')),
- result = [],
- parts, part;
- parts = origin.split(delimiter);
- while ((part = parts.shift()) !== undefined) {
-
-
- while (part.charAt(part.length - 1) === '\\' && parts.length > 0) {
- part = part + delimiter + parts.shift();
- }
-
- part = part.replace(replaceRe, delimiter);
- result.push(part);
- }
- return result;
- };
- })(),
-
- doElevate: function() {
- var fn = elevateFn,
- args = elevateArgs,
- scope = elevateScope;
-
-
- elevateFn = elevateArgs = elevateScope = null;
- elevateRet = args ? fn.apply(scope, args) : fn.call(scope);
-
-
- Ext.fireIdle();
- },
-
- elevate: function(fn, scope, args,
- timer)
- {
- var ret;
- if (args && !args.length) {
- args = null;
- }
- Ext._suppressIdle = false;
-
- if (timer) {
- timer.tick();
- }
-
- if (Ext.elevateFunction) {
- elevateFn = fn;
- elevateScope = scope;
- elevateArgs = args;
-
- Ext.elevateFunction(Ext.doElevate);
- ret = elevateRet;
- elevateRet = null;
- } else {
- ret = args ? fn.apply(scope, args) : fn.call(scope);
- Ext.fireIdle();
- }
-
- if (timer) {
- timer.tock();
- }
-
- return ret;
- },
-
- Timer: {
- all: {},
- track: false,
- captureStack: true,
- created: function(kind, id, info) {
- if (!Ext.Timer.track) {
- return null;
- }
- var timer = Ext.apply({
- kind: kind,
- id: id,
- done: false,
- firing: false,
- creator: Ext.Timer.captureStack ? new Error().stack : null,
- tick: Ext.Timer.tick,
- tock: Ext.Timer.tock
- }, info);
- var timers = Ext.Timer.all[kind] || (Ext.Timer.all[kind] = {});
- timers[timer.id] = timer;
- if (Ext.Timer.hook) {
- Ext.Timer.hook(timer);
- }
- return timer;
- },
- get: function(id, kind) {
- kind = kind || 'timeout';
- var timers = Ext.Timer.all[kind];
- return timers && timers[id] || null;
- },
- cancel: function(kind, id) {
- var timers = Ext.Timer.all[kind];
- var timer = timers && timers[id];
- if (timer) {
- timer.cancelled = true;
- delete timers[id];
- }
- },
- tick: function() {
- if (Ext.Timer.firing) {
-
-
-
- Ext.log.error('Previous timer state not cleaned up properly: ' + Ext.Timer.firing.creator);
- }
- if (this.kind !== 'interval') {
- this.done = true;
- delete Ext.Timer.all[this.kind][this.id];
- }
- this.firing = true;
- Ext.Timer.firing = this;
- },
- tock: function() {
- this.firing = false;
- if (Ext.Timer.firing === this) {
- Ext.Timer.firing = null;
- }
- }
- },
-
-
- getExpando: function(target, id) {
- var expandos = target.$expandos;
- return expandos && expandos[id] || null;
- },
-
- setExpando: function(target, id, value) {
- var expandos = target.$expandos;
- if (value !== undefined) {
- (expandos || (target.$expandos = {}))[id] = value;
- } else if (expandos) {
- delete expandos[id];
- }
- }
- });
-
- Ext.returnTrue.$nullFn = Ext.returnId.$nullFn = true;
- }());
- (function() {
-
-
-
- function toString() {
- var me = this,
- cls = me.sourceClass,
- method = me.sourceMethod,
- msg = me.msg;
- if (method) {
- if (msg) {
- method += '(): ';
- method += msg;
- } else {
- method += '()';
- }
- }
- if (cls) {
- method = method ? (cls + '.' + method) : cls;
- }
- return method || msg || '';
- }
- Ext.Error = function(config) {
- if (Ext.isString(config)) {
- config = {
- msg: config
- };
- }
- var error = new Error();
- Ext.apply(error, config);
- error.message = error.message || error.msg;
-
-
- error.toString = toString;
- return error;
- };
- Ext.apply(Ext.Error, {
-
- ignore: false,
-
- raise: function(err) {
- err = err || {};
- if (Ext.isString(err)) {
- err = {
- msg: err
- };
- }
- var me = this,
- method = me.raise.caller,
- msg, name;
- if (method === Ext.raise) {
- method = method.caller;
- }
- if (method) {
- if (!err.sourceMethod && (name = method.$name)) {
- err.sourceMethod = name;
- }
- if (!err.sourceClass && (name = method.$owner) && (name = name.$className)) {
- err.sourceClass = name;
- }
- }
- if (me.handle(err) !== true) {
- msg = toString.call(err);
-
- Ext.log({
- msg: msg,
- level: 'error',
- dump: err,
- stack: true
- });
-
- throw new Ext.Error(err);
- }
- },
-
- handle: function() {
- return this.ignore;
- }
- });
- })();
- Ext.deprecated = function(suggestion) {
-
- if (!suggestion) {
- suggestion = '';
- }
- function fail() {
- Ext.raise('The method "' + fail.$owner.$className + '.' + fail.$name + '" has been removed. ' + suggestion);
- }
- return fail;
-
- return Ext.emptyFn;
- };
- Ext.raise = function() {
- Ext.Error.raise.apply(Ext.Error, arguments);
- };
- (function(skipNotify) {
- if (skipNotify || typeof window === 'undefined') {
- return;
- }
-
- var last = 0,
-
- notify = function() {
- var cnt = Ext.log && Ext.log.counters,
- n = cnt && (cnt.error + cnt.warn + cnt.info + cnt.log),
- msg;
-
- if (n && last !== n) {
- msg = [];
- if (cnt.error) {
- msg.push('Errors: ' + cnt.error);
- }
- if (cnt.warn) {
- msg.push('Warnings: ' + cnt.warn);
- }
- if (cnt.info) {
- msg.push('Info: ' + cnt.info);
- }
- if (cnt.log) {
- msg.push('Log: ' + cnt.log);
- }
- window.status = '*** ' + msg.join(' -- ');
- last = n;
- }
- };
-
- notify.$skipTimerCheck = true;
-
-
-
- setInterval(notify, 1000);
- }(!!window.__UNIT_TESTING__));
- Ext.Array = (function() {
-
-
-
-
- var arrayPrototype = Array.prototype,
- slice = arrayPrototype.slice,
- supportsSplice = (function() {
- var array = [],
- lengthBefore,
- j = 20;
- if (!array.splice) {
- return false;
- }
-
-
- while (j--) {
- array.push("A");
- }
- array.splice(15, 0, "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F");
- lengthBefore = array.length;
-
- array.splice(13, 0, "XXX");
-
- if (lengthBefore + 1 !== array.length) {
- return false;
- }
-
- return true;
- }()),
- supportsIndexOf = 'indexOf' in arrayPrototype,
- supportsSliceOnNodeList = true;
-
-
- function stableSort(array, userComparator) {
- var len = array.length,
- indices = new Array(len),
- i;
-
- for (i = 0; i < len; i++) {
- indices[i] = i;
- }
-
- indices.sort(function(index1, index2) {
- return userComparator(array[index1], array[index2]) || (index1 - index2);
- });
-
- for (i = 0; i < len; i++) {
- indices[i] = array[indices[i]];
- }
-
- for (i = 0; i < len; i++) {
- array[i] = indices[i];
- }
- return array;
- }
- try {
-
- if (typeof document !== 'undefined') {
- slice.call(document.getElementsByTagName('body'));
- }
- } catch (e) {
- supportsSliceOnNodeList = false;
- }
- var fixArrayIndex = function(array, index) {
- return (index < 0) ? Math.max(0, array.length + index) : Math.min(array.length, index);
- },
-
- replaceSim = function(array, index, removeCount, insert) {
- var add = insert ? insert.length : 0,
- length = array.length,
- pos = fixArrayIndex(array, index);
-
- if (pos === length) {
- if (add) {
- array.push.apply(array, insert);
- }
- } else {
- var remove = Math.min(removeCount, length - pos),
- tailOldPos = pos + remove,
- tailNewPos = tailOldPos + add - remove,
- tailCount = length - tailOldPos,
- lengthAfterRemove = length - remove,
- i;
- if (tailNewPos < tailOldPos) {
-
- for (i = 0; i < tailCount; ++i) {
- array[tailNewPos + i] = array[tailOldPos + i];
- }
- } else if (tailNewPos > tailOldPos) {
-
- for (i = tailCount; i--; ) {
- array[tailNewPos + i] = array[tailOldPos + i];
- }
- }
-
- if (add && pos === lengthAfterRemove) {
- array.length = lengthAfterRemove;
-
- array.push.apply(array, insert);
- } else {
- array.length = lengthAfterRemove + add;
-
- for (i = 0; i < add; ++i) {
- array[pos + i] = insert[i];
- }
- }
- }
- return array;
- },
- replaceNative = function(array, index, removeCount, insert) {
- if (insert && insert.length) {
-
- if (index === 0 && !removeCount) {
- array.unshift.apply(array, insert);
- }
-
- else if (index < array.length) {
- array.splice.apply(array, [
- index,
- removeCount
- ].concat(insert));
- } else
- {
- array.push.apply(array, insert);
- }
- } else {
- array.splice(index, removeCount);
- }
- return array;
- },
- eraseSim = function(array, index, removeCount) {
- return replaceSim(array, index, removeCount);
- },
- eraseNative = function(array, index, removeCount) {
- array.splice(index, removeCount);
- return array;
- },
- spliceSim = function(array, index, removeCount) {
- var len = arguments.length,
- pos = fixArrayIndex(array, index),
- removed;
- if (len < 3) {
- removeCount = array.length - pos;
- }
- removed = array.slice(index, fixArrayIndex(array, pos + removeCount));
- if (len < 4) {
- replaceSim(array, pos, removeCount);
- } else {
- replaceSim(array, pos, removeCount, slice.call(arguments, 3));
- }
- return removed;
- },
- spliceNative = function(array) {
- return array.splice.apply(array, slice.call(arguments, 1));
- },
- erase = supportsSplice ? eraseNative : eraseSim,
- replace = supportsSplice ? replaceNative : replaceSim,
- splice = supportsSplice ? spliceNative : spliceSim,
-
- ExtArray = {
-
- binarySearch: function(array, item, begin, end, compareFn) {
- var length = array.length,
- middle, comparison;
- if (begin instanceof Function) {
- compareFn = begin;
- begin = 0;
- end = length;
- } else if (end instanceof Function) {
- compareFn = end;
- end = length;
- } else {
- if (begin === undefined) {
- begin = 0;
- }
- if (end === undefined) {
- end = length;
- }
- compareFn = compareFn || ExtArray.lexicalCompare;
- }
- --end;
- while (begin <= end) {
- middle = (begin + end) >> 1;
- comparison = compareFn(item, array[middle]);
- if (comparison >= 0) {
- begin = middle + 1;
- } else if (comparison < 0) {
- end = middle - 1;
- }
- }
- return begin;
- },
- defaultCompare: function(lhs, rhs) {
- return (lhs < rhs) ? -1 : ((lhs > rhs) ? 1 : 0);
- },
-
-
- lexicalCompare: function(lhs, rhs) {
- lhs = String(lhs);
- rhs = String(rhs);
- return (lhs < rhs) ? -1 : ((lhs > rhs) ? 1 : 0);
- },
-
- each: function(array, fn, scope, reverse) {
- array = ExtArray.from(array);
- var i,
- ln = array.length;
- if (reverse !== true) {
- for (i = 0; i < ln; i++) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- } else {
- for (i = ln - 1; i > -1; i--) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- }
- return true;
- },
-
- findInsertionIndex: function(item, items, comparatorFn, index) {
- var len = items.length,
- beforeCheck, afterCheck;
- comparatorFn = comparatorFn || ExtArray.lexicalCompare;
- if (index < len) {
- beforeCheck = index > 0 ? comparatorFn(items[index - 1], item) : 0;
- afterCheck = index < len - 1 ? comparatorFn(item, items[index]) : 0;
- if (beforeCheck < 1 && afterCheck < 1) {
- return index;
- }
- }
- return ExtArray.binarySearch(items, item, comparatorFn);
- },
-
- forEach: ('forEach' in arrayPrototype) ? function(array, fn, scope) {
- array.forEach(fn, scope);
- } : function(array, fn, scope) {
- for (var i = 0,
- ln = array.length; i < ln; i++) {
- fn.call(scope, array[i], i, array);
- }
- },
-
- indexOf: supportsIndexOf ? function(array, item, from) {
-
- return array ? arrayPrototype.indexOf.call(array, item, from) : -1;
- } : function(array, item, from) {
- var i,
- length = array ? array.length : 0;
- for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
- if (array[i] === item) {
- return i;
- }
- }
- return -1;
- },
-
- contains: supportsIndexOf ? function(array, item) {
- return arrayPrototype.indexOf.call(array, item) !== -1;
- } : function(array, item) {
- var i, ln;
- for (i = 0 , ln = array.length; i < ln; i++) {
- if (array[i] === item) {
- return true;
- }
- }
- return false;
- },
-
- toArray: function(iterable, start, end) {
- if (!iterable || !iterable.length) {
- return [];
- }
- if (typeof iterable === 'string') {
- iterable = iterable.split('');
- }
- if (supportsSliceOnNodeList) {
- return slice.call(iterable, start || 0, end || iterable.length);
- }
- var array = [],
- i;
- start = start || 0;
- end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
- for (i = start; i < end; i++) {
- array.push(iterable[i]);
- }
- return array;
- },
-
- pluck: function(array, propertyName) {
- var ret = [],
- i, ln, item;
- for (i = 0 , ln = array.length; i < ln; i++) {
- item = array[i];
- ret.push(item[propertyName]);
- }
- return ret;
- },
-
- map: ('map' in arrayPrototype) ? function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.map must have a callback function passed as second argument.');
-
- return array.map(fn, scope);
- } : function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.map must have a callback function passed as second argument.');
-
- var len = array.length,
- results = new Array(len),
- i;
- for (i = 0; i < len; i++) {
- results[i] = fn.call(scope, array[i], i, array);
- }
- return results;
- },
-
- every: ('every' in arrayPrototype) ? function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.every must have a callback function passed as second argument.');
-
- return array.every(fn, scope);
- } : function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.every must have a callback function passed as second argument.');
-
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (!fn.call(scope, array[i], i, array)) {
- return false;
- }
- }
- return true;
- },
-
- some: ('some' in arrayPrototype) ? function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.some must have a callback function passed as second argument.');
-
- return array.some(fn, scope);
- } : function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.some must have a callback function passed as second argument.');
-
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (fn.call(scope, array[i], i, array)) {
- return true;
- }
- }
- return false;
- },
-
- equals: function(array1, array2) {
- var len1 = array1.length,
- len2 = array2.length,
- i;
-
- if (array1 === array2) {
- return true;
- }
- if (len1 !== len2) {
- return false;
- }
- for (i = 0; i < len1; ++i) {
- if (array1[i] !== array2[i]) {
- return false;
- }
- }
- return true;
- },
-
- clean: function(array) {
- var results = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (!Ext.isEmpty(item)) {
- results.push(item);
- }
- }
- return results;
- },
-
- unique: function(array) {
- var clone = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (ExtArray.indexOf(clone, item) === -1) {
- clone.push(item);
- }
- }
- return clone;
- },
-
- filter: ('filter' in arrayPrototype) ? function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.filter must have a filter function passed as second argument.');
-
- return array.filter(fn, scope);
- } : function(array, fn, scope) {
-
- Ext.Assert.isFunction(fn, 'Ext.Array.filter must have a filter function passed as second argument.');
-
- var results = [],
- i = 0,
- ln = array.length;
- for (; i < ln; i++) {
- if (fn.call(scope, array[i], i, array)) {
- results.push(array[i]);
- }
- }
- return results;
- },
-
- findBy: function(array, fn, scope) {
- var i = 0,
- len = array.length;
- for (; i < len; i++) {
- if (fn.call(scope || array, array[i], i)) {
- return array[i];
- }
- }
- return null;
- },
-
- from: function(value, newReference) {
- if (value === undefined || value === null) {
- return [];
- }
- if (Ext.isArray(value)) {
- return (newReference) ? slice.call(value) : value;
- }
- var type = typeof value;
-
-
- if (value && value.length !== undefined && type !== 'string' && (type !== 'function' || !value.apply)) {
- return ExtArray.toArray(value);
- }
- return [
- value
- ];
- },
-
- remove: function(array, item) {
- var index = ExtArray.indexOf(array, item);
- if (index !== -1) {
- erase(array, index, 1);
- }
- return array;
- },
-
- removeAt: function(array, index, count) {
- var len = array.length;
- if (index >= 0 && index < len) {
- count = count || 1;
- count = Math.min(count, len - index);
- erase(array, index, count);
- }
- return array;
- },
-
- include: function(array, item) {
- if (!ExtArray.contains(array, item)) {
- array.push(item);
- }
- },
-
- clone: function(array) {
- return slice.call(array);
- },
-
- merge: function() {
- var args = slice.call(arguments),
- array = [],
- i, ln;
- for (i = 0 , ln = args.length; i < ln; i++) {
- array = array.concat(args[i]);
- }
- return ExtArray.unique(array);
- },
-
- intersect: function() {
- var intersection = [],
- arrays = slice.call(arguments),
- arraysLength, array, arrayLength, minArray, minArrayIndex, minArrayCandidate, minArrayLength, element, elementCandidate, elementCount, i, j, k;
- if (!arrays.length) {
- return intersection;
- }
-
- arraysLength = arrays.length;
- for (i = minArrayIndex = 0; i < arraysLength; i++) {
- minArrayCandidate = arrays[i];
- if (!minArray || minArrayCandidate.length < minArray.length) {
- minArray = minArrayCandidate;
- minArrayIndex = i;
- }
- }
- minArray = ExtArray.unique(minArray);
- erase(arrays, minArrayIndex, 1);
-
-
-
- minArrayLength = minArray.length;
- arraysLength = arrays.length;
- for (i = 0; i < minArrayLength; i++) {
- element = minArray[i];
- elementCount = 0;
- for (j = 0; j < arraysLength; j++) {
- array = arrays[j];
- arrayLength = array.length;
- for (k = 0; k < arrayLength; k++) {
- elementCandidate = array[k];
- if (element === elementCandidate) {
- elementCount++;
- break;
- }
- }
- }
- if (elementCount === arraysLength) {
- intersection.push(element);
- }
- }
- return intersection;
- },
-
- difference: function(arrayA, arrayB) {
- var clone = slice.call(arrayA),
- ln = clone.length,
- i, j, lnB;
- for (i = 0 , lnB = arrayB.length; i < lnB; i++) {
- for (j = 0; j < ln; j++) {
- if (clone[j] === arrayB[i]) {
- erase(clone, j, 1);
- j--;
- ln--;
- }
- }
- }
- return clone;
- },
-
- reduce: Array.prototype.reduce ? function(array, reduceFn, initialValue) {
- if (arguments.length === 3) {
- return Array.prototype.reduce.call(array, reduceFn, initialValue);
- }
- return Array.prototype.reduce.call(array, reduceFn);
- } : function(array, reduceFn, initialValue) {
- array = Object(array);
-
- if (!Ext.isFunction(reduceFn)) {
- Ext.raise('Invalid parameter: expected a function.');
- }
-
- var index = 0,
- length = array.length >>> 0,
- reduced = initialValue;
- if (arguments.length < 3) {
- while (true) {
- if (index in array) {
- reduced = array[index++];
- break;
- }
- if (++index >= length) {
- throw new TypeError('Reduce of empty array with no initial value');
- }
- }
- }
- for (; index < length; ++index) {
- if (index in array) {
- reduced = reduceFn(reduced, array[index], index, array);
- }
- }
- return reduced;
- },
-
-
- slice: ([
- 1,
- 2
- ].slice(1, undefined).length ? function(array, begin, end) {
- return slice.call(array, begin, end);
- } : function(array, begin, end) {
-
- if (typeof begin === 'undefined') {
- return slice.call(array);
- }
- if (typeof end === 'undefined') {
- return slice.call(array, begin);
- }
- return slice.call(array, begin, end);
- }),
-
- sort: function(array, sortFn) {
- return stableSort(array, sortFn || ExtArray.lexicalCompare);
- },
-
- flatten: function(array) {
- var worker = [];
- function rFlatten(a) {
- var i, ln, v;
- for (i = 0 , ln = a.length; i < ln; i++) {
- v = a[i];
- if (Ext.isArray(v)) {
- rFlatten(v);
- } else {
- worker.push(v);
- }
- }
- return worker;
- }
- return rFlatten(array);
- },
-
- min: function(array, comparisonFn) {
- var min = array[0],
- i, ln, item;
- for (i = 0 , ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(min, item) === 1) {
- min = item;
- }
- } else {
- if (item < min) {
- min = item;
- }
- }
- }
- return min;
- },
-
- max: function(array, comparisonFn) {
- var max = array[0],
- i, ln, item;
- for (i = 0 , ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(max, item) === -1) {
- max = item;
- }
- } else {
- if (item > max) {
- max = item;
- }
- }
- }
- return max;
- },
-
- mean: function(array) {
- return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
- },
-
- sum: function(array) {
- var sum = 0,
- i, ln, item;
- for (i = 0 , ln = array.length; i < ln; i++) {
- item = array[i];
- sum += item;
- }
- return sum;
- },
-
- toMap: function(strings, getKey, scope) {
- if (!strings) {
- return null;
- }
- var map = {},
- i = strings.length;
- if (typeof strings === 'string') {
- map[strings] = 1;
- } else if (!getKey) {
- while (i--) {
- map[strings[i]] = i + 1;
- }
- } else if (typeof getKey === 'string') {
- while (i--) {
- map[strings[i][getKey]] = i + 1;
- }
- } else {
- while (i--) {
- map[getKey.call(scope, strings[i])] = i + 1;
- }
- }
- return map;
- },
-
- toValueMap: function(array, getKey, scope, arrayify) {
- var map = {},
- i = array.length,
- autoArray, alwaysArray, entry, fn, key, value;
- if (!getKey) {
- while (i--) {
- value = array[i];
- map[value] = value;
- }
- } else {
- if (!(fn = (typeof getKey !== 'string'))) {
- arrayify = scope;
- }
- alwaysArray = arrayify === 1;
- autoArray = arrayify === 2;
- while (i--) {
- value = array[i];
- key = fn ? getKey.call(scope, value) : value[getKey];
- if (alwaysArray) {
- if (key in map) {
- map[key].push(value);
- } else {
- map[key] = [
- value
- ];
- }
- } else if (autoArray && (key in map)) {
- if ((entry = map[key]) instanceof Array) {
- entry.push(value);
- } else {
- map[key] = [
- entry,
- value
- ];
- }
- } else {
- map[key] = value;
- }
- }
- }
- return map;
- },
-
- _replaceSim: replaceSim,
-
- _spliceSim: spliceSim,
-
-
- erase: erase,
-
- insert: function(array, index, items) {
- return replace(array, index, 0, items);
- },
- move: function(array, fromIdx, toIdx) {
- if (toIdx === fromIdx) {
- return;
- }
- var item = array[fromIdx],
- incr = toIdx > fromIdx ? 1 : -1,
- i;
- for (i = fromIdx; i != toIdx; i += incr) {
- array[i] = array[i + incr];
- }
- array[toIdx] = item;
- },
-
- replace: replace,
-
- splice: splice,
-
- push: function(target) {
- var args = arguments,
- len = args.length,
- i, newItem;
- if (target === undefined) {
- target = [];
- } else if (!Ext.isArray(target)) {
- target = [
- target
- ];
- }
- for (i = 1; i < len; i++) {
- newItem = args[i];
- Array.prototype.push[Ext.isIterable(newItem) ? 'apply' : 'call'](target, newItem);
- }
- return target;
- },
-
- numericSortFn: function(a, b) {
- return a - b;
- }
- };
-
- Ext.each = ExtArray.each;
-
- ExtArray.union = ExtArray.merge;
-
- Ext.min = ExtArray.min;
-
- Ext.max = ExtArray.max;
-
- Ext.sum = ExtArray.sum;
-
- Ext.mean = ExtArray.mean;
-
- Ext.flatten = ExtArray.flatten;
-
- Ext.clean = ExtArray.clean;
-
- Ext.unique = ExtArray.unique;
-
- Ext.pluck = ExtArray.pluck;
-
- Ext.toArray = function() {
- return ExtArray.toArray.apply(ExtArray, arguments);
- };
- return ExtArray;
- }());
- Ext.Assert = {
-
- falsey: function(b, msg) {
- if (b) {
- Ext.raise(msg || ('Expected a falsey value but was ' + b));
- }
- },
-
- falseyProp: function(object, property) {
- Ext.Assert.truthy(object);
- var b = object[property];
- if (b) {
- if (object.$className) {
- property = object.$className + '#' + property;
- }
- Ext.raise('Expected a falsey value for ' + property + ' but was ' + b);
- }
- },
-
- truthy: function(b, msg) {
- if (!b) {
- Ext.raise(msg || ('Expected a truthy value but was ' + typeof b));
- }
- },
-
- truthyProp: function(object, property) {
- Ext.Assert.truthy(object);
- var b = object[property];
- if (!b) {
- if (object.$className) {
- property = object.$className + '#' + property;
- }
- Ext.raise('Expected a truthy value for ' + property + ' but was ' + typeof b);
- }
- }
- };
- (function() {
- function makeAssert(name, kind) {
- var testFn = Ext[name],
- def;
- return function(value, msg) {
- if (!testFn(value)) {
- Ext.raise(msg || def || (def = 'Expected value to be ' + kind));
- }
- };
- }
- function makeAssertProp(name, kind) {
- var testFn = Ext[name],
- def;
- return function(object, prop) {
- Ext.Assert.truthy(object);
- if (!testFn(object[prop])) {
- Ext.raise(def || (def = 'Expected ' + (object.$className ? object.$className + '#' : '') + prop + ' to be ' + kind));
- }
- };
- }
- function makeNotAssert(name, kind) {
- var testFn = Ext[name],
- def;
- return function(value, msg) {
- if (testFn(value)) {
- Ext.raise(msg || def || (def = 'Expected value to NOT be ' + kind));
- }
- };
- }
- function makeNotAssertProp(name, kind) {
- var testFn = Ext[name],
- def;
- return function(object, prop) {
- Ext.Assert.truthy(object);
- if (testFn(object[prop])) {
- Ext.raise(def || (def = 'Expected ' + (object.$className ? object.$className + '#' : '') + prop + ' to NOT be ' + kind));
- }
- };
- }
- for (var name in Ext) {
- if (name.substring(0, 2) == "is" && Ext.isFunction(Ext[name])) {
- var kind = name.substring(2);
- Ext.Assert[name] = makeAssert(name, kind);
- Ext.Assert[name + 'Prop'] = makeAssertProp(name, kind);
- Ext.Assert['isNot' + kind] = makeNotAssert(name, kind);
- Ext.Assert['isNot' + kind + 'Prop'] = makeNotAssertProp(name, kind);
- }
- }
- }());
- Ext.String = (function() {
-
-
-
-
- var trimRegex = /^[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+|[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+$/g,
- escapeRe = /('|\\)/g,
- escapeRegexRe = /([-.*+?\^${}()|\[\]\/\\])/g,
- basicTrimRe = /^\s+|\s+$/g,
- whitespaceRe = /\s+/,
- varReplace = /(^[^a-z]*|[^\w])/gi,
- charToEntity, entityToChar, charToEntityRegex, entityToCharRegex,
- htmlEncodeReplaceFn = function(match, capture) {
- return charToEntity[capture];
- },
- htmlDecodeReplaceFn = function(match, capture) {
- return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
- },
- boundsCheck = function(s, other) {
- if (s === null || s === undefined || other === null || other === undefined) {
- return false;
- }
- return other.length <= s.length;
- },
- fromCharCode = String.fromCharCode,
- ExtString;
- return ExtString = {
-
- fromCodePoint: String.fromCodePoint || function() {
- var codePoint,
- result = '',
- codeUnits = [],
- index = -1,
- length = arguments.length;
- while (++index < length) {
- codePoint = Number(arguments[index]);
- if (!isFinite(codePoint) ||
- codePoint < 0 ||
- codePoint > 1114111 ||
- Math.floor(codePoint) !== codePoint)
- {
- Ext.raise('Invalid code point: ' + codePoint);
- }
- if (codePoint <= 65535) {
-
- codeUnits.push(codePoint);
- } else {
-
-
- codePoint -= 65536;
- codeUnits.push((codePoint >> 10) + 55296, (codePoint % 1024) + 56320);
- }
- if (index + 1 === length) {
- result += fromCharCode(codeUnits);
- codeUnits.length = 0;
- }
- }
- return result;
- },
-
- insert: function(s, value, index) {
- if (!s) {
- return value;
- }
- if (!value) {
- return s;
- }
- var len = s.length;
- if (!index && index !== 0) {
- index = len;
- }
- if (index < 0) {
- index *= -1;
- if (index >= len) {
-
- index = 0;
- } else {
- index = len - index;
- }
- }
- if (index === 0) {
- s = value + s;
- } else if (index >= s.length) {
- s += value;
- } else {
- s = s.substr(0, index) + value + s.substr(index);
- }
- return s;
- },
-
- startsWith: function(s, start, ignoreCase) {
- var result = boundsCheck(s, start);
- if (result) {
- if (ignoreCase) {
- s = s.toLowerCase();
- start = start.toLowerCase();
- }
- result = s.lastIndexOf(start, 0) === 0;
- }
- return result;
- },
-
- endsWith: function(s, end, ignoreCase) {
- var result = boundsCheck(s, end);
- if (result) {
- if (ignoreCase) {
- s = s.toLowerCase();
- end = end.toLowerCase();
- }
- result = s.indexOf(end, s.length - end.length) !== -1;
- }
- return result;
- },
-
- createVarName: function(s) {
- return s.replace(varReplace, '');
- },
-
- htmlEncode: function(value) {
- return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
- },
-
- htmlDecode: function(value) {
- return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
- },
-
- hasHtmlCharacters: function(s) {
- return charToEntityRegex.test(s);
- },
-
- addCharacterEntities: function(newEntities) {
- var charKeys = [],
- entityKeys = [],
- key, echar;
- for (key in newEntities) {
- echar = newEntities[key];
- entityToChar[key] = echar;
- charToEntity[echar] = key;
- charKeys.push(echar);
- entityKeys.push(key);
- }
- charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
- entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
- },
-
- resetCharacterEntities: function() {
- charToEntity = {};
- entityToChar = {};
-
- this.addCharacterEntities({
- '&': '&',
- '>': '>',
- '<': '<',
- '"': '"',
- ''': "'"
- });
- },
-
- urlAppend: function(url, string) {
- if (!Ext.isEmpty(string)) {
- return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
- }
- return url;
- },
-
- trim: function(string) {
- if (string) {
- string = string.replace(trimRegex, "");
- }
- return string || '';
- },
-
- capitalize: function(string) {
- if (string) {
- string = string.charAt(0).toUpperCase() + string.substr(1);
- }
- return string || '';
- },
-
- uncapitalize: function(string) {
- if (string) {
- string = string.charAt(0).toLowerCase() + string.substr(1);
- }
- return string || '';
- },
-
- ellipsis: function(value, length, word) {
- if (value && value.length > length) {
- if (word) {
- var vs = value.substr(0, length - 2),
- index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
- if (index !== -1 && index >= (length - 15)) {
- return vs.substr(0, index) + "...";
- }
- }
- return value.substr(0, length - 3) + "...";
- }
- return value;
- },
-
- escapeRegex: function(string) {
- return string.replace(escapeRegexRe, "\\$1");
- },
-
- createRegex: function(value, startsWith, endsWith, ignoreCase) {
- var ret = value;
- if (value != null && !value.exec) {
-
- ret = ExtString.escapeRegex(String(value));
- if (startsWith !== false) {
- ret = '^' + ret;
- }
- if (endsWith !== false) {
- ret += '$';
- }
- ret = new RegExp(ret, (ignoreCase !== false) ? 'i' : '');
- }
- return ret;
- },
-
- escape: function(string) {
- return string.replace(escapeRe, "\\$1");
- },
-
- toggle: function(string, value, other) {
- return string === value ? other : value;
- },
-
- leftPad: function(string, size, character) {
- var result = String(string);
- character = character || " ";
- while (result.length < size) {
- result = character + result;
- }
- return result;
- },
-
- repeat: function(pattern, count, sep) {
- if (count < 1) {
- count = 0;
- }
- for (var buf = [],
- i = count; i--; ) {
- buf.push(pattern);
- }
- return buf.join(sep || '');
- },
-
- splitWords: function(words) {
- if (words && typeof words == 'string') {
- return words.replace(basicTrimRe, '').split(whitespaceRe);
- }
- return words || [];
- }
- };
- }());
- Ext.String.resetCharacterEntities();
- Ext.htmlEncode = Ext.String.htmlEncode;
- Ext.htmlDecode = Ext.String.htmlDecode;
- Ext.urlAppend = Ext.String.urlAppend;
- Ext.Date = (function() {
-
-
-
-
- var utilDate,
- nativeDate = Date,
- stripEscapeRe = /(\\.)/g,
- hourInfoRe = /([gGhHisucUOPZ]|MS)/,
- dateInfoRe = /([djzmnYycU]|MS)/,
- slashRe = /\\/gi,
- numberTokenRe = /\{(\d+)\}/g,
- MSFormatRe = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
- pad = Ext.String.leftPad,
- monthInfo = {
- F: true,
- m: true,
- M: true,
- n: true
- },
- yearInfo = {
- o: true,
- Y: true,
- y: true
- },
-
-
-
-
- code = [
-
- "var me = this, dt, y, m, d, h, i, s, ms, o, O, z, zz, u, v, W, year, jan4, week1monday, daysInMonth, dayMatched,",
- "def = me.defaults,",
- "from = Ext.Number.from,",
- "results = String(input).match(me.parseRegexes[{0}]);",
-
- "if(results){",
- "{1}",
- "if(u != null){",
-
- "v = new Date(u * 1000);",
-
- "}else{",
-
-
-
- "dt = me.clearTime(new Date);",
- "y = from(y, from(def.y, dt.getFullYear()));",
- "m = from(m, from(def.m - 1, dt.getMonth()));",
- "dayMatched = d !== undefined;",
- "d = from(d, from(def.d, dt.getDate()));",
-
-
-
-
-
-
- "if (!dayMatched) {",
- "dt.setDate(1);",
- "dt.setMonth(m);",
- "dt.setFullYear(y);",
- "daysInMonth = me.getDaysInMonth(dt);",
- "if (d > daysInMonth) {",
- "d = daysInMonth;",
- "}",
- "}",
- "h = from(h, from(def.h, dt.getHours()));",
- "i = from(i, from(def.i, dt.getMinutes()));",
- "s = from(s, from(def.s, dt.getSeconds()));",
- "ms = from(ms, from(def.ms, dt.getMilliseconds()));",
- "if(z >= 0 && y >= 0){",
-
-
-
-
- "v = me.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), me.YEAR, y < 100 ? y - 100 : 0);",
-
- "v = !strict? v : (strict === true && (z <= 364 || (me.isLeapYear(v) && z <= 365))? me.add(v, me.DAY, z) : null);",
- "}else if(strict === true && !me.isValid(y, m + 1, d, h, i, s, ms)){",
-
- "v = null;",
-
- "}else{",
- "if (W) {",
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- "year = y || (new Date()).getFullYear();",
- "jan4 = new Date(year, 0, 4, 0, 0, 0);",
- "d = jan4.getDay();",
-
-
- "week1monday = new Date(jan4.getTime() - ((d === 0 ? 6 : d - 1) * 86400000));",
-
-
-
-
- "v = Ext.Date.clearTime(new Date(week1monday.getTime() + ((W - 1) * 604800000 + 43200000)));",
- "} else {",
-
-
- "v = me.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), me.YEAR, y < 100 ? y - 100 : 0);",
- "}",
- "}",
- "}",
- "}",
- "if(v){",
-
- "if(zz != null){",
-
- "v = me.add(v, me.SECOND, -v.getTimezoneOffset() * 60 - zz);",
- "}else if(o){",
-
- "v = me.add(v, me.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
- "}",
- "}",
- "return (v != null) ? v : null;"
- ].join('\n');
-
-
-
- if (!Date.prototype.toISOString) {
- Date.prototype.toISOString = function() {
- var me = this;
- return pad(me.getUTCFullYear(), 4, '0') + '-' + pad(me.getUTCMonth() + 1, 2, '0') + '-' + pad(me.getUTCDate(), 2, '0') + 'T' + pad(me.getUTCHours(), 2, '0') + ':' + pad(me.getUTCMinutes(), 2, '0') + ':' + pad(me.getUTCSeconds(), 2, '0') + '.' + pad(me.getUTCMilliseconds(), 3, '0') + 'Z';
- };
- }
-
- function xf(format) {
- var args = Array.prototype.slice.call(arguments, 1);
- return format.replace(numberTokenRe, function(m, i) {
- return args[i];
- });
- }
- utilDate = {
-
- now: nativeDate.now,
-
-
- toString: function(date) {
- if (!date) {
- date = new nativeDate();
- }
- return date.getFullYear() + "-" + pad(date.getMonth() + 1, 2, '0') + "-" + pad(date.getDate(), 2, '0') + "T" + pad(date.getHours(), 2, '0') + ":" + pad(date.getMinutes(), 2, '0') + ":" + pad(date.getSeconds(), 2, '0');
- },
-
- getElapsed: function(dateA, dateB) {
- return Math.abs(dateA - (dateB || utilDate.now()));
- },
-
- useStrict: false,
-
- formatCodeToRegex: function(character, currentGroup) {
-
- var p = utilDate.parseCodes[character];
- if (p) {
- p = typeof p === 'function' ? p() : p;
- utilDate.parseCodes[character] = p;
- }
-
- return p ? Ext.applyIf({
- c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
- }, p) : {
- g: 0,
- c: null,
- s: Ext.String.escapeRegex(character)
- };
- },
-
-
- parseFunctions: {
- "MS": function(input, strict) {
-
-
- var r = (input || '').match(MSFormatRe);
- return r ? new nativeDate(((r[1] || '') + r[2]) * 1) : null;
- },
- "time": function(input, strict) {
- var num = parseInt(input, 10);
- if (num || num === 0) {
- return new nativeDate(num);
- }
- return null;
- },
- "timestamp": function(input, strict) {
- var num = parseInt(input, 10);
- if (num || num === 0) {
- return new nativeDate(num * 1000);
- }
- return null;
- }
- },
- parseRegexes: [],
-
- formatFunctions: {
- "MS": function() {
-
- return '\\/Date(' + this.getTime() + ')\\/';
- },
- "time": function() {
- return this.getTime().toString();
- },
- "timestamp": function() {
- return utilDate.format(this, 'U');
- }
- },
- y2kYear: 50,
-
- MILLI: "ms",
-
- SECOND: "s",
-
- MINUTE: "mi",
-
- HOUR: "h",
-
- DAY: "d",
-
- MONTH: "mo",
-
- YEAR: "y",
-
- DAYS_IN_WEEK: 7,
-
- MONTHS_IN_YEAR: 12,
-
- MAX_DAYS_IN_MONTH: 31,
- SUNDAY: 0,
- MONDAY: 1,
- TUESDAY: 2,
- WEDNESDAY: 3,
- THURSDAY: 4,
- FRIDAY: 5,
- SATURDAY: 6,
-
- defaults: {},
-
- dayNames: [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ],
-
- monthNames: [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ],
-
- monthNumbers: {
- January: 0,
- Jan: 0,
- February: 1,
- Feb: 1,
- March: 2,
- Mar: 2,
- April: 3,
- Apr: 3,
- May: 4,
- June: 5,
- Jun: 5,
- July: 6,
- Jul: 6,
- August: 7,
- Aug: 7,
- September: 8,
- Sep: 8,
- October: 9,
- Oct: 9,
- November: 10,
- Nov: 10,
- December: 11,
- Dec: 11
- },
-
- defaultFormat: 'm/d/Y',
-
- defaultTimeFormat: 'h:i A',
-
- firstDayOfWeek: 0,
-
- weekendDays: [
- 0,
- 6
- ],
-
- getShortMonthName: function(month) {
- return utilDate.monthNames[month].substring(0, 3);
- },
-
- getShortDayName: function(day) {
- return utilDate.dayNames[day].substring(0, 3);
- },
-
- getMonthNumber: function(name) {
-
- return utilDate.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
- },
-
- formatContainsHourInfo: function(format) {
- return hourInfoRe.test(format.replace(stripEscapeRe, ''));
- },
-
- formatContainsDateInfo: function(format) {
- return dateInfoRe.test(format.replace(stripEscapeRe, ''));
- },
-
- isMonthFormat: function(format) {
- return !!monthInfo[format];
- },
-
- isYearFormat: function(format) {
- return !!yearInfo[format];
- },
-
- unescapeFormat: function(format) {
-
-
-
- return format.replace(slashRe, '');
- },
-
- formatCodes: {
- d: "Ext.String.leftPad(m.getDate(), 2, '0')",
- D: "Ext.Date.getShortDayName(m.getDay())",
-
- j: "m.getDate()",
- l: "Ext.Date.dayNames[m.getDay()]",
- N: "(m.getDay() ? m.getDay() : 7)",
- S: "Ext.Date.getSuffix(m)",
- w: "m.getDay()",
- z: "Ext.Date.getDayOfYear(m)",
- W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(m), 2, '0')",
- F: "Ext.Date.monthNames[m.getMonth()]",
- m: "Ext.String.leftPad(m.getMonth() + 1, 2, '0')",
- M: "Ext.Date.getShortMonthName(m.getMonth())",
-
- n: "(m.getMonth() + 1)",
- t: "Ext.Date.getDaysInMonth(m)",
- L: "(Ext.Date.isLeapYear(m) ? 1 : 0)",
- o: "(m.getFullYear() + (Ext.Date.getWeekOfYear(m) == 1 && m.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(m) >= 52 && m.getMonth() < 11 ? -1 : 0)))",
- Y: "Ext.String.leftPad(m.getFullYear(), 4, '0')",
- y: "('' + m.getFullYear()).substring(2, 4)",
- a: "(m.getHours() < 12 ? 'am' : 'pm')",
- A: "(m.getHours() < 12 ? 'AM' : 'PM')",
- g: "((m.getHours() % 12) ? m.getHours() % 12 : 12)",
- G: "m.getHours()",
- h: "Ext.String.leftPad((m.getHours() % 12) ? m.getHours() % 12 : 12, 2, '0')",
- H: "Ext.String.leftPad(m.getHours(), 2, '0')",
- i: "Ext.String.leftPad(m.getMinutes(), 2, '0')",
- s: "Ext.String.leftPad(m.getSeconds(), 2, '0')",
- u: "Ext.String.leftPad(m.getMilliseconds(), 3, '0')",
- O: "Ext.Date.getGMTOffset(m)",
- P: "Ext.Date.getGMTOffset(m, true)",
- T: "Ext.Date.getTimezone(m)",
- Z: "(m.getTimezoneOffset() * -60)",
- c: function() {
-
- var c = "Y-m-dTH:i:sP",
- code = [],
- i,
- l = c.length,
- e;
- for (i = 0; i < l; ++i) {
- e = c.charAt(i);
- code.push(e === "T" ? "'T'" : utilDate.getFormatCode(e));
- }
-
- return code.join(" + ");
- },
- C: function() {
-
- return 'm.toISOString()';
- },
- U: "Math.round(m.getTime() / 1000)"
- },
-
- isValid: function(year, month, day, hour, minute, second, millisecond) {
-
- hour = hour || 0;
- minute = minute || 0;
- second = second || 0;
- millisecond = millisecond || 0;
-
- var dt = utilDate.add(new nativeDate(year < 100 ? 100 : year, month - 1, day, hour, minute, second, millisecond), utilDate.YEAR, year < 100 ? year - 100 : 0);
- return year === dt.getFullYear() && month === dt.getMonth() + 1 && day === dt.getDate() && hour === dt.getHours() && minute === dt.getMinutes() && second === dt.getSeconds() && millisecond === dt.getMilliseconds();
- },
-
- parse: function(input, format, strict) {
- var p = utilDate.parseFunctions;
- if (p[format] == null) {
- utilDate.createParser(format);
- }
- return p[format].call(utilDate, input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
- },
-
- parseDate: function(input, format, strict) {
- return utilDate.parse(input, format, strict);
- },
-
- getFormatCode: function(character) {
- var f = utilDate.formatCodes[character];
- if (f) {
- f = typeof f === 'function' ? f() : f;
- utilDate.formatCodes[character] = f;
- }
-
-
- return f || ("'" + Ext.String.escape(character) + "'");
- },
-
- createFormat: function(format) {
- var code = [],
- special = false,
- ch = '',
- i;
- for (i = 0; i < format.length; ++i) {
- ch = format.charAt(i);
- if (!special && ch === "\\") {
- special = true;
- } else if (special) {
- special = false;
- code.push("'" + Ext.String.escape(ch) + "'");
- } else {
- if (ch === '\n') {
- code.push("'\\n'");
- } else {
- code.push(utilDate.getFormatCode(ch));
- }
- }
- }
- utilDate.formatFunctions[format] = Ext.functionFactory("var m=this;return " + code.join('+'));
- },
-
- createParser: function(format) {
- var regexNum = utilDate.parseRegexes.length,
- currentGroup = 1,
- calc = [],
- regex = [],
- special = false,
- ch = "",
- i = 0,
- len = format.length,
- atEnd = [],
- obj;
- for (; i < len; ++i) {
- ch = format.charAt(i);
- if (!special && ch === "\\") {
- special = true;
- } else if (special) {
- special = false;
- regex.push(Ext.String.escape(ch));
- } else {
- obj = utilDate.formatCodeToRegex(ch, currentGroup);
- currentGroup += obj.g;
- regex.push(obj.s);
- if (obj.g && obj.c) {
- if (obj.calcAtEnd) {
- atEnd.push(obj.c);
- } else {
- calc.push(obj.c);
- }
- }
- }
- }
- calc = calc.concat(atEnd);
- utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
- utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
- },
-
- parseCodes: {
-
-
-
-
-
-
-
- d: {
- g: 1,
- c: "d = parseInt(results[{0}], 10);\n",
- s: "(3[0-1]|[1-2][0-9]|0[1-9])"
- },
-
- j: {
- g: 1,
- c: "d = parseInt(results[{0}], 10);\n",
- s: "(3[0-1]|[1-2][0-9]|[1-9])"
- },
-
- D: function() {
- for (var a = [],
- i = 0; i < 7; a.push(utilDate.getShortDayName(i)) , ++i){}
-
- return {
- g: 0,
- c: null,
- s: "(?:" + a.join("|") + ")"
- };
- },
- l: function() {
- return {
- g: 0,
- c: null,
- s: "(?:" + utilDate.dayNames.join("|") + ")"
- };
- },
- N: {
- g: 0,
- c: null,
- s: "[1-7]"
- },
-
-
- S: {
- g: 0,
- c: null,
- s: "(?:st|nd|rd|th)"
- },
-
- w: {
- g: 0,
- c: null,
- s: "[0-6]"
- },
-
- z: {
- g: 1,
- c: "z = parseInt(results[{0}], 10);\n",
- s: "(\\d{1,3})"
- },
-
- W: {
- g: 1,
- c: "W = parseInt(results[{0}], 10);\n",
- s: "(\\d{2})"
- },
-
- F: function() {
- return {
- g: 1,
- c: "m = parseInt(me.getMonthNumber(results[{0}]), 10);\n",
-
- s: "(" + utilDate.monthNames.join("|") + ")"
- };
- },
- M: function() {
- for (var a = [],
- i = 0; i < 12; a.push(utilDate.getShortMonthName(i)) , ++i){}
-
- return Ext.applyIf({
- s: "(" + a.join("|") + ")"
- }, utilDate.formatCodeToRegex("F"));
- },
- m: {
- g: 1,
- c: "m = parseInt(results[{0}], 10) - 1;\n",
- s: "(1[0-2]|0[1-9])"
- },
-
- n: {
- g: 1,
- c: "m = parseInt(results[{0}], 10) - 1;\n",
- s: "(1[0-2]|[1-9])"
- },
-
- t: {
- g: 0,
- c: null,
- s: "(?:\\d{2})"
- },
-
- L: {
- g: 0,
- c: null,
- s: "(?:1|0)"
- },
- o: {
- g: 1,
- c: "y = parseInt(results[{0}], 10);\n",
- s: "(\\d{4})"
- },
-
- Y: {
- g: 1,
- c: "y = parseInt(results[{0}], 10);\n",
- s: "(\\d{4})"
- },
-
- y: {
- g: 1,
- c: "var ty = parseInt(results[{0}], 10);\n" + "y = ty > me.y2kYear ? 1900 + ty : 2000 + ty;\n",
-
- s: "(\\d{2})"
- },
-
-
-
-
- a: {
- g: 1,
- c: "if (/(am)/i.test(results[{0}])) {\n" + "if (!h || h == 12) { h = 0; }\n" + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s: "(am|pm|AM|PM)",
- calcAtEnd: true
- },
-
-
- A: {
- g: 1,
- c: "if (/(am)/i.test(results[{0}])) {\n" + "if (!h || h == 12) { h = 0; }\n" + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s: "(AM|PM|am|pm)",
- calcAtEnd: true
- },
-
- g: {
- g: 1,
- c: "h = parseInt(results[{0}], 10);\n",
- s: "(1[0-2]|[1-9])"
- },
-
- G: {
- g: 1,
- c: "h = parseInt(results[{0}], 10);\n",
- s: "(2[0-3]|1[0-9]|[0-9])"
- },
-
- h: {
- g: 1,
- c: "h = parseInt(results[{0}], 10);\n",
- s: "(1[0-2]|0[1-9])"
- },
-
- H: {
- g: 1,
- c: "h = parseInt(results[{0}], 10);\n",
- s: "(2[0-3]|[0-1][0-9])"
- },
-
- i: {
- g: 1,
- c: "i = parseInt(results[{0}], 10);\n",
- s: "([0-5][0-9])"
- },
-
- s: {
- g: 1,
- c: "s = parseInt(results[{0}], 10);\n",
- s: "([0-5][0-9])"
- },
-
- u: {
- g: 1,
- c: "ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
- s: "(\\d+)"
- },
-
- O: {
- g: 1,
- c: [
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
-
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
-
- "mn = o.substring(3,5) % 60;",
-
- "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
- ].
- join("\n"),
- s: "([+-]\\d{4})"
- },
-
- P: {
- g: 1,
- c: [
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
-
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
-
- "mn = o.substring(4,6) % 60;",
-
- "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
- ].
- join("\n"),
- s: "([+-]\\d{2}:\\d{2})"
- },
-
- T: {
- g: 0,
- c: null,
- s: "[A-Z]{1,5}"
- },
-
- Z: {
- g: 1,
- c: "zz = results[{0}] * 1;\n" +
- "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
- s: "([+-]?\\d{1,5})"
- },
-
- c: function() {
- var calc = [],
- arr = [
- utilDate.formatCodeToRegex("Y", 1),
-
- utilDate.formatCodeToRegex("m", 2),
-
- utilDate.formatCodeToRegex("d", 3),
-
- utilDate.formatCodeToRegex("H", 4),
-
- utilDate.formatCodeToRegex("i", 5),
-
- utilDate.formatCodeToRegex("s", 6),
-
- {
- c: "ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"
- },
-
- {
- c: [
-
- "if(results[8]) {",
-
- "if(results[8] == 'Z'){",
- "zz = 0;",
-
- "}else if (results[8].indexOf(':') > -1){",
- utilDate.formatCodeToRegex("P", 8).c,
-
- "}else{",
- utilDate.formatCodeToRegex("O", 8).c,
-
- "}",
- "}"
- ].join('\n')
- }
- ],
- i, l;
- for (i = 0 , l = arr.length; i < l; ++i) {
- calc.push(arr[i].c);
- }
- return {
- g: 1,
- c: calc.join(""),
- s: [
- arr[0].s,
-
- "(?:",
- "-",
- arr[1].s,
-
- "(?:",
- "-",
- arr[2].s,
-
- "(?:",
- "(?:T| )?",
-
- arr[3].s,
- ":",
- arr[4].s,
-
- "(?::",
- arr[5].s,
- ")?",
-
- "(?:(?:\\.|,)(\\d+))?",
-
- "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
-
- ")?",
- ")?",
- ")?"
- ].join("")
- };
- },
- U: {
- g: 1,
- c: "u = parseInt(results[{0}], 10);\n",
- s: "(-?\\d+)"
- }
- },
-
-
-
- dateFormat: function(date, format) {
- return utilDate.format(date, format);
- },
-
- isEqual: function(date1, date2) {
-
- if (date1 && date2) {
- return (date1.getTime() === date2.getTime());
- }
-
- return !(date1 || date2);
- },
-
- format: function(date, format) {
- var formatFunctions = utilDate.formatFunctions;
- if (!Ext.isDate(date)) {
- return '';
- }
- if (formatFunctions[format] == null) {
- utilDate.createFormat(format);
- }
- return formatFunctions[format].call(date) + '';
- },
-
- getTimezone: function(date) {
-
-
-
-
-
-
-
-
-
-
-
-
- return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,5})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
- },
-
- getGMTOffset: function(date, colon) {
- var offset = date.getTimezoneOffset();
- return (offset > 0 ? "-" : "+") + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0") + (colon ? ":" : "") + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
- },
-
- getDayOfYear: function(date) {
- var num = 0,
- d = utilDate.clone(date),
- m = date.getMonth(),
- i;
- for (i = 0 , d.setDate(1) , d.setMonth(0); i < m; d.setMonth(++i)) {
- num += utilDate.getDaysInMonth(d);
- }
- return num + date.getDate() - 1;
- },
-
- getWeekOfYear: (function() {
-
- var ms1d = 86400000,
-
- ms7d = 7 * ms1d;
-
- return function(date) {
-
- var DC3 = nativeDate.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
-
- AWN = Math.floor(DC3 / 7),
-
- Wyr = new nativeDate(AWN * ms7d).getUTCFullYear();
- return AWN - Math.floor(nativeDate.UTC(Wyr, 0, 7) / ms7d) + 1;
- };
- }()),
-
- isLeapYear: function(date) {
- var year = date.getFullYear();
- return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year)));
- },
-
- getFirstDayOfMonth: function(date) {
- var day = (date.getDay() - (date.getDate() - 1)) % 7;
- return (day < 0) ? (day + 7) : day;
- },
-
- getLastDayOfMonth: function(date) {
- return utilDate.getLastDateOfMonth(date).getDay();
- },
-
- getFirstDateOfMonth: function(date) {
- return new nativeDate(date.getFullYear(), date.getMonth(), 1);
- },
-
- getLastDateOfMonth: function(date) {
- return new nativeDate(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
- },
-
- getDaysInMonth: (function() {
- var daysInMonth = [
- 31,
- 28,
- 31,
- 30,
- 31,
- 30,
- 31,
- 31,
- 30,
- 31,
- 30,
- 31
- ];
- return function(date) {
-
- var m = date.getMonth();
- return m === 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
- };
- }()),
-
- getSuffix: function(date) {
- switch (date.getDate()) {
- case 1:
- case 21:
- case 31:
- return "st";
- case 2:
- case 22:
- return "nd";
- case 3:
- case 23:
- return "rd";
- default:
- return "th";
- }
- },
-
- clone: function(date) {
- return new nativeDate(date.getTime());
- },
-
- isDST: function(date) {
-
-
- return new nativeDate(date.getFullYear(), 0, 1).getTimezoneOffset() !== date.getTimezoneOffset();
- },
-
- clearTime: function(date, clone) {
-
- if (isNaN(date.getTime())) {
- return date;
- }
- if (clone) {
- return utilDate.clearTime(utilDate.clone(date));
- }
-
- var d = date.getDate(),
- hr, c;
-
- date.setHours(0);
- date.setMinutes(0);
- date.setSeconds(0);
- date.setMilliseconds(0);
- if (date.getDate() !== d) {
-
-
-
-
- for (hr = 1 , c = utilDate.add(date, utilDate.HOUR, hr); c.getDate() !== d; hr++ , c = utilDate.add(date, utilDate.HOUR, hr)){}
- date.setDate(d);
- date.setHours(c.getHours());
- }
- return date;
- },
-
- add: function(date, interval, value, preventDstAdjust) {
- var d = utilDate.clone(date),
- base = 0,
- day, decimalValue;
- if (!interval || value === 0) {
- return d;
- }
- decimalValue = value - parseInt(value, 10);
- value = parseInt(value, 10);
- if (value) {
- switch (interval.toLowerCase()) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- case utilDate.MILLI:
- if (preventDstAdjust) {
- d.setMilliseconds(d.getMilliseconds() + value);
- } else {
- d.setTime(d.getTime() + value);
- };
- break;
- case utilDate.SECOND:
- if (preventDstAdjust) {
- d.setSeconds(d.getSeconds() + value);
- } else {
- d.setTime(d.getTime() + value * 1000);
- };
- break;
- case utilDate.MINUTE:
- if (preventDstAdjust) {
- d.setMinutes(d.getMinutes() + value);
- } else {
- d.setTime(d.getTime() + value * 60 * 1000);
- };
- break;
- case utilDate.HOUR:
- if (preventDstAdjust) {
- d.setHours(d.getHours() + value);
- } else {
- d.setTime(d.getTime() + value * 60 * 60 * 1000);
- };
- break;
- case utilDate.DAY:
- if (preventDstAdjust) {
- d.setDate(d.getDate() + value);
- } else {
- d.setTime(d.getTime() + value * 24 * 60 * 60 * 1000);
- };
- break;
- case utilDate.MONTH:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, utilDate.getLastDateOfMonth(utilDate.add(utilDate.getFirstDateOfMonth(date), utilDate.MONTH, value)).getDate());
- };
- d.setDate(day);
- d.setMonth(date.getMonth() + value);
- break;
- case utilDate.YEAR:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, utilDate.getLastDateOfMonth(utilDate.add(utilDate.getFirstDateOfMonth(date), utilDate.YEAR, value)).getDate());
- };
- d.setDate(day);
- d.setFullYear(date.getFullYear() + value);
- break;
- }
- }
- if (decimalValue) {
- switch (interval.toLowerCase()) {
- case utilDate.MILLI:
- base = 1;
- break;
- case utilDate.SECOND:
- base = 1000;
- break;
- case utilDate.MINUTE:
- base = 1000 * 60;
- break;
- case utilDate.HOUR:
- base = 1000 * 60 * 60;
- break;
- case utilDate.DAY:
- base = 1000 * 60 * 60 * 24;
- break;
- case utilDate.MONTH:
- day = utilDate.getDaysInMonth(d);
- base = 1000 * 60 * 60 * 24 * day;
- break;
- case utilDate.YEAR:
- day = (utilDate.isLeapYear(d) ? 366 : 365);
- base = 1000 * 60 * 60 * 24 * day;
- break;
- }
- if (base) {
- d.setTime(d.getTime() + base * decimalValue);
- }
- }
- return d;
- },
-
- subtract: function(date, interval, value, preventDstAdjust) {
- return utilDate.add(date, interval, -value, preventDstAdjust);
- },
-
- between: function(date, start, end) {
- var t = date.getTime();
- return start.getTime() <= t && t <= end.getTime();
- },
-
- isWeekend: function(date) {
- return Ext.Array.indexOf(this.weekendDays, date.getDay()) > -1;
- },
-
- utcToLocal: function(d) {
- return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
- },
-
- localToUtc: function(d) {
- return utilDate.utc(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
- },
-
- utc: function(year, month, day, hour, min, s, ms) {
- return new Date(Date.UTC(year, month, day, hour || 0, min || 0, s || 0, ms || 0));
- },
-
- compat: function() {
- var p,
- statics = [
- 'useStrict',
- 'formatCodeToRegex',
- 'parseFunctions',
- 'parseRegexes',
- 'formatFunctions',
- 'y2kYear',
- 'MILLI',
- 'SECOND',
- 'MINUTE',
- 'HOUR',
- 'DAY',
- 'MONTH',
- 'YEAR',
- 'defaults',
- 'dayNames',
- 'monthNames',
- 'monthNumbers',
- 'getShortMonthName',
- 'getShortDayName',
- 'getMonthNumber',
- 'formatCodes',
- 'isValid',
- 'parseDate',
- 'getFormatCode',
- 'createFormat',
- 'createParser',
- 'parseCodes'
- ],
- proto = [
- 'dateFormat',
- 'format',
- 'getTimezone',
- 'getGMTOffset',
- 'getDayOfYear',
- 'getWeekOfYear',
- 'isLeapYear',
- 'getFirstDayOfMonth',
- 'getLastDayOfMonth',
- 'getDaysInMonth',
- 'getSuffix',
- 'clone',
- 'isDST',
- 'clearTime',
- 'add',
- 'between'
- ],
- sLen = statics.length,
- pLen = proto.length,
- stat, prot, s;
-
- for (s = 0; s < sLen; s++) {
- stat = statics[s];
- nativeDate[stat] = utilDate[stat];
- }
-
- for (p = 0; p < pLen; p++) {
- prot = proto[p];
- nativeDate.prototype[prot] = function() {
- var args = Array.prototype.slice.call(arguments);
- args.unshift(this);
- return utilDate[prot].apply(utilDate, args);
- };
- }
- },
-
- diff: function(min, max, unit) {
- var est,
- diff = +max - min;
- switch (unit) {
- case utilDate.MILLI:
- return diff;
- case utilDate.SECOND:
- return Math.floor(diff / 1000);
- case utilDate.MINUTE:
- return Math.floor(diff / 60000);
- case utilDate.HOUR:
- return Math.floor(diff / 3600000);
- case utilDate.DAY:
- return Math.floor(diff / 86400000);
- case 'w':
- return Math.floor(diff / 604800000);
- case utilDate.MONTH:
- est = (max.getFullYear() * 12 + max.getMonth()) - (min.getFullYear() * 12 + min.getMonth());
- if (utilDate.add(min, unit, est) > max) {
- return est - 1;
- };
- return est;
- case utilDate.YEAR:
- est = max.getFullYear() - min.getFullYear();
- if (utilDate.add(min, unit, est) > max) {
- return est - 1;
- } else {
- return est;
- };
- }
- },
-
- align: function(date, unit, step) {
- var num = new nativeDate(+date);
- switch (unit.toLowerCase()) {
- case utilDate.MILLI:
- return num;
- case utilDate.SECOND:
- num.setUTCSeconds(num.getUTCSeconds() - num.getUTCSeconds() % step);
- num.setUTCMilliseconds(0);
- return num;
- case utilDate.MINUTE:
- num.setUTCMinutes(num.getUTCMinutes() - num.getUTCMinutes() % step);
- num.setUTCSeconds(0);
- num.setUTCMilliseconds(0);
- return num;
- case utilDate.HOUR:
- num.setUTCHours(num.getUTCHours() - num.getUTCHours() % step);
- num.setUTCMinutes(0);
- num.setUTCSeconds(0);
- num.setUTCMilliseconds(0);
- return num;
- case utilDate.DAY:
- if (step === 7 || step === 14) {
- num.setUTCDate(num.getUTCDate() - num.getUTCDay() + 1);
- };
- num.setUTCHours(0);
- num.setUTCMinutes(0);
- num.setUTCSeconds(0);
- num.setUTCMilliseconds(0);
- return num;
- case utilDate.MONTH:
- num.setUTCMonth(num.getUTCMonth() - (num.getUTCMonth() - 1) % step, 1);
- num.setUTCHours(0);
- num.setUTCMinutes(0);
- num.setUTCSeconds(0);
- num.setUTCMilliseconds(0);
- return num;
- case utilDate.YEAR:
- num.setUTCFullYear(num.getUTCFullYear() - num.getUTCFullYear() % step, 1, 1);
- num.setUTCHours(0);
- num.setUTCMinutes(0);
- num.setUTCSeconds(0);
- num.setUTCMilliseconds(0);
- return date;
- }
- }
- };
- utilDate.parseCodes.C = utilDate.parseCodes.c;
- return utilDate;
- }());
- Ext.Function = (function() {
-
-
-
-
- var lastTime = 0,
- animFrameId,
- animFrameHandlers = [],
- animFrameNoArgs = [],
- idSource = 0,
- animFrameMap = {},
- slice = Array.prototype.slice,
- win = window,
- global = Ext.global,
-
- hasImmediate = !Ext.disableImmediate && !!(global.setImmediate && global.clearImmediate),
- requestAnimFrame = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.oRequestAnimationFrame || function(callback) {
- var currTime = Ext.now(),
- timeToCall = Math.max(0, 16 - (currTime - lastTime)),
- timerFn = function() {
- callback(currTime + timeToCall);
- },
- id;
-
- timerFn.$origFn = callback.$origFn || callback;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
-
- id = win.setTimeout(timerFn, timeToCall);
- lastTime = currTime + timeToCall;
- return id;
- },
- fireHandlers = function() {
- var len = animFrameHandlers.length,
- id, i, handler;
- animFrameId = null;
-
- var timer;
-
-
- for (i = 0; i < len; i++) {
- handler = animFrameHandlers[i];
- id = handler[3];
-
- if (animFrameMap[id]) {
- delete animFrameMap[id];
-
- timer = Ext.Timer.get(id, 'raf');
- if (timer) {
- timer.tick();
- }
-
- handler[0].apply(handler[1] || global, handler[2] || animFrameNoArgs);
-
- if (timer) {
- timer.tock();
- }
- }
- }
-
-
-
- animFrameHandlers = animFrameHandlers.slice(len);
- },
- fireElevatedHandlers = function() {
- Ext.elevate(fireHandlers);
- },
- ExtFunction = {
-
- flexSetter: function(setter) {
- return function(name, value) {
- var k, i;
- if (name !== null) {
- if (typeof name !== 'string') {
- for (k in name) {
- if (name.hasOwnProperty(k)) {
- setter.call(this, k, name[k]);
- }
- }
- if (Ext.enumerables) {
- for (i = Ext.enumerables.length; i--; ) {
- k = Ext.enumerables[i];
- if (name.hasOwnProperty(k)) {
- setter.call(this, k, name[k]);
- }
- }
- }
- } else {
- setter.call(this, name, value);
- }
- }
- return this;
- };
- },
-
- bind: function(fn, scope, args, appendArgs) {
-
- if (arguments.length <= 2) {
- return fn.bind(scope);
- }
- var method = fn;
- return function() {
- var callArgs = args || arguments;
- if (appendArgs === true) {
- callArgs = slice.call(arguments, 0);
- callArgs = callArgs.concat(args);
- } else if (typeof appendArgs === 'number') {
- callArgs = slice.call(arguments, 0);
-
- Ext.Array.insert(callArgs, appendArgs, args);
- }
- return method.apply(scope || global, callArgs);
- };
- },
-
- bindCallback: function(callback, scope, args, delay, caller) {
- return function() {
- var a = slice.call(arguments);
- return Ext.callback(callback, scope, args ? args.concat(a) : a, delay, caller);
- };
- },
-
- pass: function(fn, args, scope) {
- if (!Ext.isArray(args)) {
- if (Ext.isIterable(args)) {
- args = Ext.Array.clone(args);
- } else {
- args = args !== undefined ? [
- args
- ] : [];
- }
- }
- return function() {
- var fnArgs = args.slice();
- fnArgs.push.apply(fnArgs, arguments);
- return fn.apply(scope || this, fnArgs);
- };
- },
-
- alias: function(object, methodName) {
- return function() {
- return object[methodName].apply(object, arguments);
- };
- },
-
- clone: function(method) {
- var newMethod, prop;
- newMethod = function() {
- return method.apply(this, arguments);
- };
- for (prop in method) {
- if (method.hasOwnProperty(prop)) {
- newMethod[prop] = method[prop];
- }
- }
- return newMethod;
- },
-
- createInterceptor: function(origFn, newFn, scope, returnValue) {
- if (!Ext.isFunction(newFn)) {
- return origFn;
- } else {
- returnValue = Ext.isDefined(returnValue) ? returnValue : null;
- return function() {
- var me = this,
- args = arguments;
- return (newFn.apply(scope || me || global, args) !== false) ? origFn.apply(me || global, args) : returnValue;
- };
- }
- },
-
- createDelayed: function(fn, delay, scope, args, appendArgs) {
- var boundFn = fn;
- if (scope || args) {
- boundFn = Ext.Function.bind(fn, scope, args, appendArgs);
- }
- return function() {
- var me = this,
- args = slice.call(arguments),
- timerFn, timerId;
-
- var timer;
-
- timerFn = function() {
- Ext.elevate(boundFn, me, args,
- timer);
- };
-
- timerId = setTimeout(timerFn, delay);
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('timeout', timerId, {
- type: 'createDelayed',
- fn: fn,
- timerFn: timerFn
- });
- };
- },
-
-
- defer: function(fn, millis, scope, args, appendArgs) {
- var timerId = 0,
- timerFn, boundFn;
-
- var timer;
-
- if (!scope && !args && !appendArgs) {
- boundFn = fn;
- } else {
- boundFn = Ext.Function.bind(fn, scope, args, appendArgs);
- }
- if (millis > 0) {
- timerFn = function() {
- Ext.elevate(boundFn,
- null, null, timer);
- };
-
- timerId = setTimeout(timerFn, millis);
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('timeout', timerId, {
- type: 'defer',
- fn: fn,
- timerFn: timerFn
- });
- } else
- {
- boundFn();
- }
- return timerId;
- },
-
- interval: function(fn, millis, scope, args, appendArgs) {
- var timerFn, timerId, boundFn;
-
- var timer;
-
- boundFn = Ext.Function.bind(fn, scope, args, appendArgs);
- timerFn = function() {
- Ext.elevate(boundFn,
- null, null, timer);
- };
-
- timerId = setInterval(timerFn, millis);
-
- timerFn.$origFn = boundFn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('interval', timerId, {
- type: 'interval',
- fn: fn,
- timerFn: timerFn
- });
-
- return timerId;
- },
-
- createSequence: function(originalFn, newFn, scope) {
- if (!newFn) {
- return originalFn;
- } else {
- return function() {
- var result = originalFn.apply(this, arguments);
- newFn.apply(scope || this, arguments);
- return result;
- };
- }
- },
-
- createBuffered: function(fn, buffer, scope, args) {
- var timerId,
- result = function() {
- var callArgs = args || slice.call(arguments, 0),
- me = scope || this,
- timerFn;
-
- var timer;
-
- if (timerId) {
- Ext.undefer(timerId);
- }
- timerFn = function() {
- Ext.elevate(fn, me, callArgs,
- timer);
- };
-
- result.timer = timerId = setTimeout(timerFn, buffer);
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('timeout', timerId, {
- type: 'createBuffered',
- fn: fn,
- timerFn: timerFn
- });
- };
-
- return result;
- },
-
- createAnimationFrame: function(fn, scope, args, queueStrategy) {
- var boundFn, timerId;
- queueStrategy = queueStrategy || 3;
- boundFn = function() {
- var timerFn,
- callArgs = args || slice.call(arguments, 0);
- scope = scope || this;
- if (queueStrategy === 3 && timerId) {
- ExtFunction.cancelAnimationFrame(timerId);
- }
- if ((queueStrategy & 1) || !timerId) {
- timerFn = function() {
- timerId = boundFn.timerId = null;
- fn.apply(scope, callArgs);
- };
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
-
- timerId = boundFn.timerId = ExtFunction.requestAnimationFrame(timerFn);
- }
- };
- return boundFn;
- },
-
- requestAnimationFrame: function(fn, scope, args) {
- var id = ++idSource,
-
- handler = slice.call(arguments, 0);
- handler[3] = id;
- animFrameMap[id] = 1;
-
-
- Ext.Timer.created('raf', id, {
- type: 'raf',
- fn: fn
- });
-
-
-
- animFrameHandlers.push(handler);
- if (!animFrameId) {
- animFrameId = requestAnimFrame(fireElevatedHandlers);
- }
- return id;
- },
- cancelAnimationFrame: function(id) {
-
-
-
- delete animFrameMap[id];
-
- Ext.Timer.cancel('raf', id);
- },
-
-
- createThrottled: function(fn, interval, scope) {
- var lastCallTime = 0,
- elapsed, lastArgs, timerId,
- execute = function() {
- fn.apply(scope, lastArgs);
- lastCallTime = Ext.now();
- lastArgs = timerId = null;
- };
-
- execute.$origFn = fn.$origFn || fn;
- execute.$skipTimerCheck = execute.$origFn.$skipTimerCheck;
-
- return function() {
-
- if (!scope) {
- scope = this;
- }
- elapsed = Ext.now() - lastCallTime;
- lastArgs = Ext.Array.slice(arguments);
-
-
- if (elapsed >= interval) {
- Ext.undefer(timerId);
- execute();
- }
-
- else if (!timerId) {
- timerId = Ext.defer(execute, interval - elapsed);
- }
- };
- },
-
- createBarrier: function(count, fn, scope) {
- var barrierFn = function() {
- if (!--count) {
- fn.apply(scope, arguments);
- }
- };
-
- barrierFn.$origFn = fn.$origFn || fn;
- barrierFn.$skipTimerCheck = barrierFn.$origFn.$skipTimerCheck;
-
- return barrierFn;
- },
-
- interceptBefore: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- var ret = fn.apply(scope || this, arguments);
- method.apply(this, arguments);
- return ret;
- });
- },
-
- interceptAfter: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- method.apply(this, arguments);
- return fn.apply(scope || this, arguments);
- });
- },
- interceptAfterOnce: function(object, methodName, fn, scope) {
- var origMethod = object[methodName],
- newMethod;
- newMethod = function() {
- var ret;
- if (origMethod) {
- origMethod.apply(this, arguments);
- }
- ret = fn.apply(scope || this, arguments);
- object[methodName] = origMethod;
- object = methodName = fn = scope = origMethod = newMethod = null;
- return ret;
- };
- object[methodName] = newMethod;
- return newMethod;
- },
- makeCallback: function(callback, scope) {
-
- if (!scope[callback]) {
- if (scope.$className) {
- Ext.raise('No method "' + callback + '" on ' + scope.$className);
- }
- Ext.raise('No method "' + callback + '"');
- }
-
- return function() {
- return scope[callback].apply(scope, arguments);
- };
- },
-
- memoize: function(fn, scope, hashFn) {
- var memo = {},
- isFunc = hashFn && Ext.isFunction(hashFn);
- return function(value) {
- var key = isFunc ? hashFn.apply(scope, arguments) : value;
- if (!(key in memo)) {
- memo[key] = fn.apply(scope, arguments);
- }
- return memo[key];
- };
- },
-
- _stripCommentRe: /(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(\/\/.*)/g,
-
- toCode: function(fn) {
- var s = fn ? fn.toString() : '';
-
- s = s.replace(ExtFunction._stripCommentRe, '');
-
- return s;
- },
-
-
-
- fireElevatedHandlers: function() {
- fireElevatedHandlers();
- }
- };
-
-
-
- Ext.asap = hasImmediate ? function(fn, scope, parameters) {
- var boundFn = fn,
- timerFn, timerId;
-
- var timer;
-
- if (scope != null || parameters != null) {
- boundFn = ExtFunction.bind(fn, scope, parameters);
- }
- timerFn = function() {
- Ext.elevate(boundFn,
- null, null, timer);
- };
-
- timerId = setImmediate(timerFn);
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('asap', timerId, {
- type: 'asap',
- fn: fn,
- timerFn: timerFn
- });
-
- return timerId;
- } : function(fn, scope, parameters) {
- var boundFn = fn,
- timerFn, timerId;
-
- var timer;
-
- if (scope != null || parameters != null) {
- boundFn = ExtFunction.bind(fn, scope, parameters);
- }
- timerFn = function() {
- Ext.elevate(boundFn,
- null, null, timer);
- };
-
- timerId = setTimeout(timerFn, 0, true);
-
- timerFn.$origFn = fn.$origFn || fn;
- timerFn.$skipTimerCheck = timerFn.$origFn.$skipTimerCheck;
- timer = Ext.Timer.created('timeout', timerId, {
- type: 'asap',
- fn: fn,
- timerFn: timerFn
- });
-
- return timerId;
- };
-
- Ext.unasap = hasImmediate ? function(id) {
- if (id) {
- clearImmediate(id);
-
- Ext.Timer.cancel('asap', id);
- }
-
- return null;
- } : function(id) {
- return Ext.undefer(id);
- };
-
- Ext.asapCancel = function(id) {
- return Ext.unasap(id);
- };
-
- Ext.defer = ExtFunction.defer;
-
- Ext.undefer = function(id) {
- if (id) {
- clearTimeout(id);
-
- Ext.Timer.cancel('timeout', id);
- }
-
- return null;
- };
-
- Ext.interval = ExtFunction.interval;
-
- Ext.uninterval = function(id) {
- if (id) {
- clearInterval(id);
-
- Ext.Timer.cancel('interval', id);
- }
-
- return null;
- };
-
- Ext.pass = ExtFunction.pass;
-
- Ext.bind = ExtFunction.bind;
- Ext.raf = function() {
- return ExtFunction.requestAnimationFrame.apply(ExtFunction, arguments);
- };
- Ext.unraf = function(id) {
- ExtFunction.cancelAnimationFrame(id);
- };
- return ExtFunction;
- })();
- Ext.Number = (new function() {
-
-
-
-
- var ExtNumber = this,
- isToFixedBroken = (0.9).toFixed() !== '1',
- math = Math,
- ClipDefault = {
- count: false,
- inclusive: false,
- wrap: true
- };
-
- Number.MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -(math.pow(2, 53) - 1);
- Number.MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || math.pow(2, 53) - 1;
- Ext.apply(ExtNumber, {
- MIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,
- MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,
-
- floatRe: /^[-+]?(?:\d+|\d*\.\d*)(?:[Ee][+-]?\d+)?$/,
- intRe: /^[-+]?\d+(?:[Ee]\+?\d+)?$/,
- Clip: {
- DEFAULT: ClipDefault,
- COUNT: Ext.applyIf({
- count: true
- }, ClipDefault),
- INCLUSIVE: Ext.applyIf({
- inclusive: true
- }, ClipDefault),
- NOWRAP: Ext.applyIf({
- wrap: false
- }, ClipDefault)
- },
-
- parseFloat: function(value) {
- if (value === undefined) {
- value = null;
- }
- if (value !== null && typeof value !== 'number') {
- value = String(value);
- value = ExtNumber.floatRe.test(value) ? +value : null;
- if (isNaN(value)) {
- value = null;
- }
- }
- return value;
- },
-
- parseInt: function(value) {
- if (value === undefined) {
- value = null;
- }
- if (typeof value === 'number') {
- value = Math.floor(value);
- } else if (value !== null) {
- value = String(value);
- value = ExtNumber.intRe.test(value) ? +value : null;
- }
- return value;
- },
- binarySearch: function(array, value, begin, end) {
- if (begin === undefined) {
- begin = 0;
- }
- if (end === undefined) {
- end = array.length;
- }
- --end;
- var middle, midVal;
- while (begin <= end) {
- middle = (begin + end) >>> 1;
-
- midVal = array[middle];
- if (value === midVal) {
- return middle;
- }
- if (midVal < value) {
- begin = middle + 1;
- } else {
- end = middle - 1;
- }
- }
- return begin;
- },
- bisectTuples: function(array, value, index, begin, end) {
- if (begin === undefined) {
- begin = 0;
- }
- if (end === undefined) {
- end = array.length;
- }
- --end;
- var middle, midVal;
- while (begin <= end) {
- middle = (begin + end) >>> 1;
-
- midVal = array[middle][index];
- if (value === midVal) {
- return middle;
- }
- if (midVal < value) {
- begin = middle + 1;
- } else {
- end = middle - 1;
- }
- }
- return begin;
- },
-
- clipIndices: function(length, indices, options) {
- options = options || ClipDefault;
- var defaultValue = 0,
-
- wrap = options.wrap,
- begin, end, i;
- indices = indices || [];
- for (i = 0; i < 2; ++i) {
-
-
- begin = end;
-
- end = indices[i];
- if (end == null) {
- end = defaultValue;
- } else if (i && options.count) {
- end += begin;
-
- end = (end > length) ? length : end;
- } else {
- if (wrap) {
- end = (end < 0) ? (length + end) : end;
- }
- if (i && options.inclusive) {
- ++end;
- }
- end = (end < 0) ? 0 : ((end > length) ? length : end);
- }
- defaultValue = length;
- }
-
-
-
-
- indices[0] = begin;
- indices[1] = (end < begin) ? begin : end;
- return indices;
- },
-
- constrain: function(number, min, max) {
- var x = parseFloat(number);
-
-
-
- if (min === null) {
- min = number;
- }
- if (max === null) {
- max = number;
- }
-
-
-
- return (x < min) ? min : ((x > max) ? max : x);
- },
-
- snap: function(value, increment, minValue, maxValue) {
- var m;
-
-
- if (value === undefined || value < minValue) {
- return minValue || 0;
- }
- if (increment) {
- m = value % increment;
- if (m !== 0) {
- value -= m;
- if (m * 2 >= increment) {
- value += increment;
- } else if (m * 2 < -increment) {
- value -= increment;
- }
- }
- }
- return ExtNumber.constrain(value, minValue, maxValue);
- },
-
- snapInRange: function(value, increment, minValue, maxValue) {
- var tween;
-
- minValue = (minValue || 0);
-
- if (value === undefined || value < minValue) {
- return minValue;
- }
-
- if (increment && (tween = ((value - minValue) % increment))) {
- value -= tween;
- tween *= 2;
- if (tween >= increment) {
- value += increment;
- }
- }
-
- if (maxValue !== undefined) {
- if (value > (maxValue = ExtNumber.snapInRange(maxValue, increment, minValue))) {
- value = maxValue;
- }
- }
- return value;
- },
-
- roundToNearest: function(value, interval) {
- interval = interval || 1;
- return interval * math.round(value / interval);
- },
-
- roundToPrecision: function(value, precision) {
- var factor = math.pow(10, precision || 1);
- return math.round(value * factor) / factor;
- },
-
- truncateToPrecision: function(value, precision) {
- var factor = math.pow(10, precision || 1);
- return parseInt(value * factor, 10) / factor;
- },
-
- sign: math.sign || function(x) {
- x = +x;
-
- if (x === 0 || isNaN(x)) {
- return x;
- }
- return (x > 0) ? 1 : -1;
- },
-
- log10: math.log10 || function(x) {
- return math.log(x) * math.LOG10E;
- },
-
- isEqual: function(n1, n2, epsilon) {
-
- if (!(typeof n1 === 'number' && typeof n2 === 'number' && typeof epsilon === 'number')) {
- Ext.raise("All parameters should be valid numbers.");
- }
-
- return math.abs(n1 - n2) < epsilon;
- },
-
- isFinite: Number.isFinite || function(value) {
- return typeof value === 'number' && isFinite(value);
- },
- isInteger: Number.isInteger || function(value) {
-
-
- return ~~(value + 0) === value;
- },
-
- toFixed: isToFixedBroken ? function(value, precision) {
- precision = precision || 0;
- var pow = math.pow(10, precision);
- return (math.round(value * pow) / pow).toFixed(precision);
- } : function(value, precision) {
- return value.toFixed(precision);
- },
-
- from: function(value, defaultValue) {
- if (isFinite(value)) {
- value = parseFloat(value);
- }
- return !isNaN(value) ? value : defaultValue;
- },
-
- randomInt: function(from, to) {
- return math.floor(math.random() * (to - from + 1) + from);
- },
-
- correctFloat: function(n) {
-
-
-
- return parseFloat(n.toPrecision(14));
- }
- });
-
- Ext.num = function() {
- return ExtNumber.from.apply(this, arguments);
- };
- }());
- (function() {
-
- var TemplateClass = function() {},
- queryRe = /^\?/,
- keyRe = /(\[):?([^\]]*)\]/g,
- nameRe = /^([^\[]+)/,
- plusRe = /\+/g,
- ExtObject = Ext.Object = {
-
-
-
-
-
- chain: Object.create || function(object) {
- TemplateClass.prototype = object;
- var result = new TemplateClass();
- TemplateClass.prototype = null;
- return result;
- },
-
- clear: function(object) {
-
- for (var key in object) {
- delete object[key];
- }
- return object;
- },
-
- freeze: Object.freeze ? function(obj, deep) {
- if (obj && typeof obj === 'object' && !Object.isFrozen(obj)) {
- Object.freeze(obj);
- if (deep) {
- for (var name in obj) {
- ExtObject.freeze(obj[name], deep);
- }
- }
- }
- return obj;
- } : Ext.identityFn,
-
- toQueryObjects: function(name, value, recursive) {
- var self = ExtObject.toQueryObjects,
- objects = [],
- i, ln;
- if (Ext.isArray(value)) {
- for (i = 0 , ln = value.length; i < ln; i++) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- } else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- } else if (Ext.isObject(value)) {
- for (i in value) {
- if (value.hasOwnProperty(i)) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- } else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- }
- } else {
- objects.push({
- name: name,
- value: value
- });
- }
- return objects;
- },
-
- toQueryString: function(object, recursive) {
- var paramObjects = [],
- params = [],
- i, j, ln, paramObject, value;
- for (i in object) {
- if (object.hasOwnProperty(i)) {
- paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
- }
- }
- for (j = 0 , ln = paramObjects.length; j < ln; j++) {
- paramObject = paramObjects[j];
- value = paramObject.value;
- if (Ext.isEmpty(value)) {
- value = '';
- } else if (Ext.isDate(value)) {
- value = Ext.Date.toString(value);
- }
- params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
- }
- return params.join('&');
- },
-
- fromQueryString: function(queryString, recursive) {
- var parts = queryString.replace(queryRe, '').split('&'),
- object = {},
- temp, components, name, value, i, ln, part, j, subLn, matchedKeys, matchedName, keys, key, nextKey;
- for (i = 0 , ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (part.length > 0) {
- components = part.split('=');
- name = components[0];
- name = name.replace(plusRe, '%20');
- name = decodeURIComponent(name);
- value = components[1];
- if (value !== undefined) {
- value = value.replace(plusRe, '%20');
- value = decodeURIComponent(value);
- } else {
- value = '';
- }
- if (!recursive) {
- if (object.hasOwnProperty(name)) {
- if (!Ext.isArray(object[name])) {
- object[name] = [
- object[name]
- ];
- }
- object[name].push(value);
- } else {
- object[name] = value;
- }
- } else {
- matchedKeys = name.match(keyRe);
- matchedName = name.match(nameRe);
-
- if (!matchedName) {
- throw new Error('[Ext.Object.fromQueryString] Malformed query string given, failed parsing name from "' + part + '"');
- }
-
- name = matchedName[0];
- keys = [];
- if (matchedKeys === null) {
- object[name] = value;
-
- continue;
- }
- for (j = 0 , subLn = matchedKeys.length; j < subLn; j++) {
- key = matchedKeys[j];
- key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
- keys.push(key);
- }
- keys.unshift(name);
- temp = object;
- for (j = 0 , subLn = keys.length; j < subLn; j++) {
- key = keys[j];
- if (j === subLn - 1) {
- if (Ext.isArray(temp) && key === '') {
- temp.push(value);
- } else {
- temp[key] = value;
- }
- } else {
- if (temp[key] === undefined || typeof temp[key] === 'string') {
- nextKey = keys[j + 1];
- temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
- }
- temp = temp[key];
- }
- }
- }
- }
- }
- return object;
- },
-
- each: function(object, fn, scope) {
- var enumerables = Ext.enumerables,
- i, property;
- if (object) {
- scope = scope || object;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- if (fn.call(scope, property, object[property], object) === false) {
- return;
- }
- }
- }
- if (enumerables) {
- for (i = enumerables.length; i--; ) {
- if (object.hasOwnProperty(property = enumerables[i])) {
- if (fn.call(scope, property, object[property], object) === false) {
- return;
- }
- }
- }
- }
- }
- },
-
- eachValue: function(object, fn, scope) {
- var enumerables = Ext.enumerables,
- i, property;
- scope = scope || object;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- if (fn.call(scope, object[property]) === false) {
- return;
- }
- }
- }
- if (enumerables) {
- for (i = enumerables.length; i--; ) {
- if (object.hasOwnProperty(property = enumerables[i])) {
- if (fn.call(scope, object[property]) === false) {
- return;
- }
- }
- }
- }
- },
-
- merge: function(destination) {
- var i = 1,
- args = arguments,
- ln = args.length,
- mergeFn = ExtObject.merge,
- cloneFn = Ext.clone,
- object, key, value, sourceKey;
- for (; i < ln; i++) {
- object = args[i];
- for (key in object) {
- value = object[key];
- if (value && value.constructor === Object) {
- sourceKey = destination[key];
- if (sourceKey && sourceKey.constructor === Object) {
- mergeFn(sourceKey, value);
- } else {
- destination[key] = cloneFn(value);
- }
- } else {
- destination[key] = value;
- }
- }
- }
- return destination;
- },
-
- mergeIf: function(destination) {
- var i = 1,
- ln = arguments.length,
- cloneFn = Ext.clone,
- object, key, value;
- for (; i < ln; i++) {
- object = arguments[i];
- for (key in object) {
- if (!(key in destination)) {
- value = object[key];
- if (value && value.constructor === Object) {
- destination[key] = cloneFn(value);
- } else {
- destination[key] = value;
- }
- }
- }
- }
- return destination;
- },
-
- getAllKeys: function(object) {
- var keys = [],
- property;
- for (property in object) {
- keys.push(property);
- }
- return keys;
- },
-
- getKey: function(object, value) {
- for (var property in object) {
- if (object.hasOwnProperty(property) && object[property] === value) {
- return property;
- }
- }
- return null;
- },
-
- getValues: function(object) {
- var values = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- values.push(object[property]);
- }
- }
- return values;
- },
-
- getKeys: (typeof Object.keys == 'function') ? function(object) {
- if (!object) {
- return [];
- }
- return Object.keys(object);
- } : function(object) {
- var keys = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- keys.push(property);
- }
- }
- return keys;
- },
-
- getSize: function(object) {
- var size = 0,
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- size++;
- }
- }
- return size;
- },
-
- isEmpty: function(object) {
- for (var key in object) {
- if (object.hasOwnProperty(key)) {
- return false;
- }
- }
- return true;
- },
-
- equals: (function() {
- var check = function(o1, o2) {
- var key;
- for (key in o1) {
- if (o1.hasOwnProperty(key)) {
- if (o1[key] !== o2[key]) {
- return false;
- }
- }
- }
- return true;
- };
- return function(object1, object2) {
-
- if (object1 === object2) {
- return true;
- }
- if (object1 && object2) {
-
-
- return check(object1, object2) && check(object2, object1);
- } else if (!object1 && !object2) {
- return object1 === object2;
- } else {
- return false;
- }
- };
- })(),
-
- fork: function(obj) {
- var ret, key, value;
- if (obj && obj.constructor === Object) {
- ret = ExtObject.chain(obj);
- for (key in obj) {
- value = obj[key];
- if (value) {
- if (value.constructor === Object) {
- ret[key] = ExtObject.fork(value);
- } else if (value instanceof Array) {
- ret[key] = Ext.Array.clone(value);
- }
- }
- }
- } else {
- ret = obj;
- }
- return ret;
- },
- defineProperty: ('defineProperty' in Object) ? Object.defineProperty : function(object, name, descriptor) {
- if (!Object.prototype.__defineGetter__) {
- return;
- }
- if (descriptor.get) {
- object.__defineGetter__(name, descriptor.get);
- }
- if (descriptor.set) {
- object.__defineSetter__(name, descriptor.set);
- }
- },
-
- classify: function(object) {
- var prototype = object,
- objectProperties = [],
- propertyClassesMap = {},
- objectClass = function() {
- var i = 0,
- ln = objectProperties.length,
- property;
- for (; i < ln; i++) {
- property = objectProperties[i];
- this[property] = new propertyClassesMap[property]();
- }
- },
- key, value;
- for (key in object) {
- if (object.hasOwnProperty(key)) {
- value = object[key];
- if (value && value.constructor === Object) {
- objectProperties.push(key);
- propertyClassesMap[key] = ExtObject.classify(value);
- }
- }
- }
- objectClass.prototype = prototype;
- return objectClass;
- }
- };
-
- Ext.merge = Ext.Object.merge;
-
- Ext.mergeIf = Ext.Object.mergeIf;
- }());
- Ext.apply(Ext, {
-
-
-
-
- _namedScopes: {
- 'this': {
- isThis: 1
- },
- controller: {
- isController: 1
- },
- owner: {
- isOwner: 1
- },
-
-
- self: {
- isSelf: 1
- },
- 'self.controller': {
- isSelf: 1,
- isController: 1
- }
- },
- escapeId: (function() {
- var validIdRe = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/i,
- escapeRx = /([\W]{1})/g,
- leadingNumRx = /^(\d)/g,
- escapeFn = function(match, capture) {
- return "\\" + capture;
- },
- numEscapeFn = function(match, capture) {
- return '\\00' + capture.charCodeAt(0).toString(16) + ' ';
- };
- return function(id) {
- return validIdRe.test(id) ? id :
-
- id.replace(escapeRx, escapeFn).replace(leadingNumRx, numEscapeFn);
- };
- }()),
-
- callback: function(callback, scope, args, delay, caller, defaultScope) {
- if (!callback) {
- return;
- }
- var namedScope = (scope in Ext._namedScopes);
- if (callback.charAt) {
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (callback[2] === '.') {
-
-
- if (callback.substr(0, 2) !== 'up') {
- Ext.raise('Invalid callback method name "' + callback + '"');
- }
- if (scope) {
- Ext.raise('Callback "up" syntax is incompatible with scopes');
- }
- if (!caller || !Ext.isFunction(caller.up)) {
- Ext.raise('Callback "up" syntax requires a caller with "up" method');
- }
-
- callback = callback.substr(3);
-
- for (scope = caller.up(); scope && !scope[callback]; scope = scope.up()) {}
-
-
- if (!scope || !Ext.isFunction(scope[callback])) {
- Ext.raise('No such method "' + callback + '" found up() from ' + scope.getId ? scope.getId() : scope.id);
- }
- }
-
- else if ((!scope || namedScope) && caller) {
- scope = caller.resolveListenerScope(namedScope ? scope : defaultScope);
- }
-
- if (!scope || !Ext.isObject(scope)) {
- Ext.raise('Named method "' + callback + '" requires a scope object');
- }
- if (!Ext.isFunction(scope[callback])) {
- Ext.raise('No method named "' + callback + '" on ' + (scope.$className || 'scope object'));
- }
-
- callback = scope[callback];
- } else if (namedScope) {
- scope = defaultScope || caller;
- } else if (!scope) {
- scope = caller;
- }
- var ret;
- if (callback && Ext.isFunction(callback)) {
- scope = scope || Ext.global;
- if (delay) {
- Ext.defer(callback, delay, scope, args);
- } else {
- ret = args ? callback.apply(scope, args) : callback.call(scope);
- }
- }
- return ret;
- },
-
- coerce: function(from, to) {
- var fromType = Ext.typeOf(from),
- toType = Ext.typeOf(to),
- isString = typeof from === 'string';
- if (fromType !== toType) {
- switch (toType) {
- case 'string':
- return String(from);
- case 'number':
- return Number(from);
- case 'boolean':
-
-
- return isString && (!from || from === 'false' || from === '0') ? false : Boolean(from);
- case 'null':
- return isString && (!from || from === 'null') ? null : false;
- case 'undefined':
- return isString && (!from || from === 'undefined') ? undefined : false;
- case 'date':
- return isString && isNaN(from) ? Ext.Date.parse(from, Ext.Date.defaultFormat) : Date(Number(from));
- }
- }
- return from;
- },
-
- copyTo: function(dest, source, names, usePrototypeKeys) {
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (var name,
- i = 0,
- n = names ? names.length : 0; i < n; i++) {
- name = names[i];
- if (usePrototypeKeys || source.hasOwnProperty(name)) {
- dest[name] = source[name];
- }
- }
- return dest;
- },
-
- copy: function(dest, source, names, usePrototypeKeys) {
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (var name,
- i = 0,
- n = names ? names.length : 0; i < n; i++) {
- name = names[i];
-
-
-
- if (source.hasOwnProperty(name) || (usePrototypeKeys && name in source)) {
- dest[name] = source[name];
- }
- }
- return dest;
- },
- propertyNameSplitRe: /[,;\s]+/,
-
- copyToIf: function(destination, source, names) {
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (var name,
- i = 0,
- n = names ? names.length : 0; i < n; i++) {
- name = names[i];
- if (destination[name] === undefined) {
- destination[name] = source[name];
- }
- }
- return destination;
- },
-
- copyIf: function(destination, source, names) {
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (var name,
- i = 0,
- n = names ? names.length : 0; i < n; i++) {
- name = names[i];
-
- if (!(name in destination) && (name in source)) {
- destination[name] = source[name];
- }
- }
- return destination;
- },
-
- extend: (function() {
-
- var objectConstructor = Object.prototype.constructor,
- inlineOverrides = function(o) {
- var m;
- for (m in o) {
- if (!o.hasOwnProperty(m)) {
-
- continue;
- }
- this[m] = o[m];
- }
- };
- return function(subclass, superclass, overrides) {
-
- if (Ext.isObject(superclass)) {
- overrides = superclass;
- superclass = subclass;
- subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
- superclass.apply(this, arguments);
- };
- }
-
- if (!superclass) {
- Ext.raise({
- sourceClass: 'Ext',
- sourceMethod: 'extend',
- msg: 'Attempting to extend from a class which has not been loaded on the page.'
- });
- }
-
-
- var F = function() {},
- subclassProto,
- superclassProto = superclass.prototype;
- F.prototype = superclassProto;
- subclassProto = subclass.prototype = new F();
- subclassProto.constructor = subclass;
- subclass.superclass = superclassProto;
- if (superclassProto.constructor === objectConstructor) {
- superclassProto.constructor = superclass;
- }
- subclass.override = function(overrides) {
- Ext.override(subclass, overrides);
- };
- subclassProto.override = inlineOverrides;
- subclassProto.proto = subclassProto;
- subclass.override(overrides);
- subclass.extend = function(o) {
- return Ext.extend(subclass, o);
- };
- return subclass;
- };
- }()),
-
- isOnline: function() {
- return Ext.global.navigator.onLine;
- },
-
- iterate: function(object, fn, scope) {
- if (Ext.isEmpty(object)) {
- return;
- }
- if (scope === undefined) {
- scope = object;
- }
- if (Ext.isIterable(object)) {
- Ext.Array.each.call(Ext.Array, object, fn, scope);
- } else {
- Ext.Object.each.call(Ext.Object, object, fn, scope);
- }
- },
- _resourcePoolRe: /^[<]([^<>@:]*)(?:[@]([^<>@:]+))?[>](.+)$/,
-
- resolveResource: function(url) {
- var ret = url,
- m;
- if (url && url.charAt(0) === '<') {
- m = Ext._resourcePoolRe.exec(url);
- if (m) {
- ret = Ext.getResourcePath(m[3], m[1], m[2]);
- }
- }
- return ret;
- },
-
- urlEncode: function() {
- var args = Ext.Array.from(arguments),
- prefix = '';
-
- if (Ext.isString(args[1])) {
- prefix = args[1] + '&';
- args[1] = false;
- }
- return prefix + Ext.Object.toQueryString.apply(Ext.Object, args);
- },
-
- urlDecode: function() {
- return Ext.Object.fromQueryString.apply(Ext.Object, arguments);
- },
-
- getScrollbarSize: function(force) {
-
- if (!Ext.isDomReady) {
- Ext.raise("getScrollbarSize called before DomReady");
- }
-
- var scrollbarSize = Ext._scrollbarSize;
- if (force || !scrollbarSize) {
- var db = document.body,
- div = document.createElement('div'),
- h, w;
- div.style.width = div.style.height = '100px';
- div.style.overflow = 'scroll';
- div.style.position = 'absolute';
- db.appendChild(div);
-
-
- Ext._scrollbarSize = scrollbarSize = {
- width: w = div.offsetWidth - div.clientWidth,
- height: h = div.offsetHeight - div.clientHeight
- };
- scrollbarSize.reservedWidth = w ? 'calc(100% - ' + w + 'px)' : '';
- scrollbarSize.reservedHeight = h ? 'calc(100% - ' + h + 'px)' : '';
- db.removeChild(div);
- }
- return scrollbarSize;
- },
-
- typeOf: (function() {
- var nonWhitespaceRe = /\S/,
- toString = Object.prototype.toString,
- typeofTypes = {
- number: 1,
- string: 1,
- 'boolean': 1,
- 'undefined': 1
- },
- toStringTypes = {
- '[object Array]': 'array',
- '[object Date]': 'date',
- '[object Boolean]': 'boolean',
- '[object Number]': 'number',
- '[object RegExp]': 'regexp'
- };
- return function(value) {
- if (value === null) {
- return 'null';
- }
- var type = typeof value,
- ret, typeToString;
- if (typeofTypes[type]) {
- return type;
- }
- ret = toStringTypes[typeToString = toString.call(value)];
- if (ret) {
- return ret;
- }
- if (type === 'function') {
- return 'function';
- }
- if (type === 'object') {
- if (value.nodeType !== undefined) {
- if (value.nodeType === 3) {
- return nonWhitespaceRe.test(value.nodeValue) ? 'textnode' : 'whitespace';
- } else {
- return 'element';
- }
- }
- return 'object';
- }
-
- Ext.raise({
- sourceClass: 'Ext',
- sourceMethod: 'typeOf',
- msg: 'Failed to determine the type of "' + value + '".'
- });
-
- return typeToString;
- };
- }()),
-
- factory: function(config, classReference, instance, aliasNamespace) {
- var manager = Ext.ClassManager,
- newInstance;
-
-
- if (!config || config.isInstance) {
- if (instance && instance !== config) {
- instance.destroy();
- }
- return config;
- }
- if (aliasNamespace) {
-
- if (typeof config === 'string') {
- return manager.instantiateByAlias(aliasNamespace + '.' + config);
- }
-
- else if (Ext.isObject(config) && 'type' in config) {
- return manager.instantiateByAlias(aliasNamespace + '.' + config.type, config);
- }
- }
- if (config === true) {
-
- if (!instance && !classReference) {
- Ext.raise('[Ext.factory] Cannot determine type of class to create');
- }
-
- return instance || Ext.create(classReference);
- }
-
- if (!Ext.isObject(config)) {
- Ext.raise("Invalid config, must be a valid config object");
- }
-
- if ('xtype' in config) {
- newInstance = manager.instantiateByAlias('widget.' + config.xtype, config);
- } else if ('xclass' in config) {
- newInstance = Ext.create(config.xclass, config);
- }
- if (newInstance) {
- if (instance) {
- instance.destroy();
- }
- return newInstance;
- }
- if (instance) {
- return instance.setConfig(config);
- }
- return Ext.create(classReference, config);
- },
-
- convertKeyedItems: function(items, defaultProperty, functionProperty) {
- if (items && !items.isInstance && Ext.isObject(items)) {
- var obj = items,
- item, itemId, value;
- items = [];
-
- if (obj.xtype || obj.xclass || obj.itemId || obj.id) {
- items.push(obj);
- } else {
- for (itemId in obj) {
- item = obj[itemId];
- if (item) {
- if (item === true) {
- item = {};
- } else if (typeof item === 'function') {
-
- if (!functionProperty) {
- Ext.raise('Function not expected here');
- }
-
- value = item;
- item = {};
- item[functionProperty] = value;
- } else if (typeof item === 'string') {
- value = item;
- item = {};
- item[defaultProperty || 'xtype'] = value;
- } else {
- item = Ext.apply({}, item);
- }
- item.itemId = itemId;
- items.push(item);
- }
- }
- }
- }
- return items;
- },
-
- weightSortFn: function(lhs, rhs) {
- return (lhs.weight || 0) - (rhs.weight || 0);
- },
-
- concat: function(a, b) {
- var noB = b == null,
- E = Ext.emptyArray;
- return (a == null) ? (noB ? a : E.concat(b)) : (noB ? E.concat(a) : E.concat(a, b));
- },
-
- log:
- (function() {
-
- var primitiveRe = /string|number|boolean/;
- function dumpObject(object, level, maxLevel, withFunctions) {
- var member, type, value, name, prefix, suffix,
- members = [];
- if (Ext.isArray(object)) {
- prefix = '[';
- suffix = ']';
- } else if (Ext.isObject(object)) {
- prefix = '{';
- suffix = '}';
- }
- if (!maxLevel) {
- maxLevel = 3;
- }
- if (level > maxLevel) {
- return prefix + '...' + suffix;
- }
- level = level || 1;
- var spacer = (new Array(level)).join(' ');
-
- for (name in object) {
- if (object.hasOwnProperty(name)) {
- value = object[name];
- type = typeof value;
- if (type === 'function') {
- if (!withFunctions) {
-
- continue;
- }
- member = type;
- } else if (type === 'undefined') {
- member = type;
- } else if (value === null || primitiveRe.test(type) || Ext.isDate(value)) {
- member = Ext.encode(value);
- } else if (Ext.isArray(value)) {
- member = dumpObject(value, level + 1, maxLevel, withFunctions);
- } else if (Ext.isObject(value)) {
- member = dumpObject(value, level + 1, maxLevel, withFunctions);
- } else {
- member = type;
- }
- members.push(spacer + name + ': ' + member);
- }
- }
-
- if (members.length) {
- return prefix + '\n ' + members.join(',\n ') + '\n' + spacer + suffix;
- }
- return prefix + suffix;
- }
- function log(message) {
- var options, dump,
- con = Ext.global.console,
- level = 'log',
- indent = log.indent || 0,
- prefix, stack, fn, out, max;
- log.indent = indent;
- if (typeof message !== 'string') {
- options = message;
- message = options.msg || '';
- level = options.level || level;
- dump = options.dump;
- stack = options.stack;
- prefix = options.prefix;
- fn = options.fn;
- if (options.indent) {
- ++log.indent;
- } else if (options.outdent) {
- log.indent = indent = Math.max(indent - 1, 0);
- }
- if (dump && !(con && con.dir)) {
- message += dumpObject(dump);
- dump = null;
- }
- }
- if (arguments.length > 1) {
- message += Array.prototype.slice.call(arguments, 1).join('');
- }
- if (prefix) {
- message = prefix + ' - ' + message;
- }
- message = indent ? Ext.String.repeat(' ', log.indentSize * indent) + message : message;
-
- if (level !== 'log') {
- message = '[' + level.charAt(0).toUpperCase() + '] ' + message;
- }
- if (fn) {
- message += '\nCaller: ' + fn.toString();
- }
-
-
-
- if (con) {
-
- if (con[level]) {
- con[level](message);
- } else {
- con.log(message);
- }
- if (dump) {
- con.dir(dump);
- }
- if (stack && con.trace) {
-
- if (!con.firebug || level !== 'error') {
- con.trace();
- }
- }
- } else if (Ext.isOpera) {
- opera.postError(message);
- } else
- {
- out = log.out;
- max = log.max;
- if (out.length >= max) {
-
-
- Ext.Array.erase(out, 0, out.length - 3 * Math.floor(max / 4));
- }
-
- out.push(message);
- }
-
- ++log.count;
- ++log.counters[level];
- }
- function logx(level, args) {
- if (typeof args[0] === 'string') {
- args.unshift({});
- }
- args[0].level = level;
- log.apply(this, args);
- }
- log.error = function() {
- logx('error', Array.prototype.slice.call(arguments));
- };
- log.info = function() {
- logx('info', Array.prototype.slice.call(arguments));
- };
- log.warn = function() {
- logx('warn', Array.prototype.slice.call(arguments));
- };
- log.count = 0;
- log.counters = {
- error: 0,
- warn: 0,
- info: 0,
- log: 0
- };
- log.indentSize = 2;
- log.out = [];
- log.max = 750;
- return log;
- }()) || (
- function() {
- var nullLog = function() {};
- nullLog.info = nullLog.warn = nullLog.error = Ext.emptyFn;
- return nullLog;
- }())
- });
- (function() {
-
-
- var
- checkVerTemp = [
- ''
- ],
- endOfVersionRe = /([^\d\.])/,
- notDigitsRe = /[^\d]/g,
- plusMinusRe = /[\-+]/g,
- stripRe = /\s/g,
- underscoreRe = /_/g,
- toolkitNames = {
- classic: 1,
- modern: 1
- },
- Version;
- Ext.Version = Version = function(version, defaultMode) {
- var me = this,
- padModes = me.padModes,
- ch, i, pad, parts, release, releaseStartIndex, ver;
- if (version.isVersion) {
- version = version.version;
- }
- me.version = ver = String(version).toLowerCase().replace(underscoreRe, '.').replace(plusMinusRe, '');
- ch = ver.charAt(0);
- if (ch in padModes) {
- ver = ver.substring(1);
- pad = padModes[ch];
- } else {
- pad = defaultMode ? padModes[defaultMode] : 0;
- }
-
- me.pad = pad;
- releaseStartIndex = ver.search(endOfVersionRe);
- me.shortVersion = ver;
- if (releaseStartIndex !== -1) {
- me.release = release = ver.substr(releaseStartIndex, version.length);
- me.shortVersion = ver.substr(0, releaseStartIndex);
- release = Version.releaseValueMap[release] || release;
- }
- me.releaseValue = release || pad;
- me.shortVersion = me.shortVersion.replace(notDigitsRe, '');
-
- me.parts = parts = ver.split('.');
- for (i = parts.length; i--; ) {
- parts[i] = parseInt(parts[i], 10);
- }
- if (pad === Infinity) {
-
- parts.push(pad);
- }
-
- me.major = parts[0] || pad;
-
- me.minor = parts[1] || pad;
-
- me.patch = parts[2] || pad;
-
- me.build = parts[3] || pad;
- return me;
- };
- Version.prototype = {
- isVersion: true,
- padModes: {
- '~': NaN,
- '^': Infinity
- },
-
- release: '',
-
- compareTo: function(other) {
-
-
- var me = this,
- lhsPad = me.pad,
- lhsParts = me.parts,
- lhsLength = lhsParts.length,
- rhsVersion = other.isVersion ? other : new Version(other),
- rhsPad = rhsVersion.pad,
- rhsParts = rhsVersion.parts,
- rhsLength = rhsParts.length,
- length = Math.max(lhsLength, rhsLength),
- i, lhs, rhs;
- for (i = 0; i < length; i++) {
- lhs = (i < lhsLength) ? lhsParts[i] : lhsPad;
- rhs = (i < rhsLength) ? rhsParts[i] : rhsPad;
-
-
- if (lhs < rhs) {
- return -1;
- }
- if (lhs > rhs) {
- return 1;
- }
- }
-
- lhs = me.releaseValue;
- rhs = rhsVersion.releaseValue;
- if (lhs < rhs) {
- return -1;
- }
- if (lhs > rhs) {
- return 1;
- }
- return 0;
- },
-
- toString: function() {
- return this.version;
- },
-
- valueOf: function() {
- return this.version;
- },
-
- getMajor: function() {
- return this.major;
- },
-
- getMinor: function() {
- return this.minor;
- },
-
- getPatch: function() {
- return this.patch;
- },
-
- getBuild: function() {
- return this.build;
- },
-
- getRelease: function() {
- return this.release;
- },
-
- getReleaseValue: function() {
- return this.releaseValue;
- },
-
- isGreaterThan: function(target) {
- return this.compareTo(target) > 0;
- },
-
- isGreaterThanOrEqual: function(target) {
- return this.compareTo(target) >= 0;
- },
-
- isLessThan: function(target) {
- return this.compareTo(target) < 0;
- },
-
- isLessThanOrEqual: function(target) {
- return this.compareTo(target) <= 0;
- },
-
- equals: function(target) {
- return this.compareTo(target) === 0;
- },
-
- match: function(target) {
- target = String(target);
- return this.version.substr(0, target.length) === target;
- },
-
- toArray: function() {
- var me = this;
- return [
- me.getMajor(),
- me.getMinor(),
- me.getPatch(),
- me.getBuild(),
- me.getRelease()
- ];
- },
-
- getShortVersion: function() {
- return this.shortVersion;
- },
-
- gt: function(target) {
- return this.compareTo(target) > 0;
- },
-
- lt: function(target) {
- return this.compareTo(target) < 0;
- },
-
- gtEq: function(target) {
- return this.compareTo(target) >= 0;
- },
-
- ltEq: function(target) {
- return this.compareTo(target) <= 0;
- }
- };
- Ext.apply(Version, {
- aliases: {
- from: {
- extjs: 'ext',
- core: 'core',
- touch: 'modern'
- },
- to: {
- ext: [
- 'extjs'
- ],
- 'core': [
- 'core'
- ],
- modern: [
- 'touch'
- ]
- }
- },
-
- releaseValueMap: {
- dev: -6,
- alpha: -5,
- a: -5,
- beta: -4,
- b: -4,
- rc: -3,
- '#': -2,
- p: -1,
- pl: -1
- },
-
- getComponentValue: function(value) {
- return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
- },
-
- compare: function(current, target) {
- var ver = current.isVersion ? current : new Version(current);
- return ver.compareTo(target);
- },
- set: function(collection, packageName, version) {
- var aliases = Version.aliases.to[packageName],
- ver = version.isVersion ? version : new Version(version),
- i;
- collection[packageName] = ver;
- if (aliases) {
- for (i = aliases.length; i-- > 0; ) {
- collection[aliases[i]] = ver;
- }
- }
- return ver;
- }
- });
-
- Ext.apply(Ext, {
-
- compatVersions: {},
-
- versions: {},
-
- lastRegisteredVersion: null,
-
- getCompatVersion: function(packageName) {
- var versions = Ext.compatVersions,
- compat;
- if (!packageName) {
- compat = versions.ext || versions.touch || versions.core;
- } else {
- compat = versions[Version.aliases.from[packageName] || packageName];
- }
- return compat || Ext.getVersion(packageName);
- },
-
- setCompatVersion: function(packageName, version) {
- Version.set(Ext.compatVersions, packageName, version);
- },
-
- setVersion: function(packageName, version) {
- if (packageName in toolkitNames) {
- Ext.toolkit = packageName;
- }
- Ext.lastRegisteredVersion = Version.set(Ext.versions, packageName, version);
- return this;
- },
-
- getVersion: function(packageName) {
- var versions = Ext.versions;
- if (!packageName) {
- return versions.ext || versions.touch || versions.core;
- }
- return versions[Version.aliases.from[packageName] || packageName];
- },
-
- checkVersion: function(specs, matchAll) {
- var isArray = Ext.isArray(specs),
- aliases = Version.aliases.from,
- compat = isArray ? specs : checkVerTemp,
- length = compat.length,
- versions = Ext.versions,
- frameworkVer = versions.ext || versions.touch,
- i, index, matches, minVer, maxVer, packageName, spec, range, ver;
- if (!isArray) {
- checkVerTemp[0] = specs;
- }
- for (i = 0; i < length; ++i) {
- if (!Ext.isString(spec = compat[i])) {
- matches = Ext.checkVersion(spec.and || spec.or, !spec.or);
- if (spec.not) {
- matches = !matches;
- }
- } else {
- if (spec.indexOf(' ') >= 0) {
- spec = spec.replace(stripRe, '');
- }
-
-
- index = spec.indexOf('@');
- if (index < 0) {
- range = spec;
- ver = frameworkVer;
- } else {
- packageName = spec.substring(0, index);
- if (!(ver = versions[aliases[packageName] || packageName])) {
-
-
- if (matchAll) {
- return false;
- }
-
-
-
- continue;
- }
- range = spec.substring(index + 1);
- }
-
- index = range.indexOf('-');
- if (index < 0) {
-
- if (range.charAt(index = range.length - 1) === '+') {
- minVer = range.substring(0, index);
- maxVer = null;
- } else {
- minVer = maxVer = range;
- }
- } else if (index > 0) {
-
- minVer = range.substring(0, index);
- maxVer = range.substring(index + 1);
- } else
- {
-
- minVer = null;
- maxVer = range.substring(index + 1);
- }
- matches = true;
- if (minVer) {
- minVer = new Version(minVer, '~');
-
- matches = minVer.ltEq(ver);
- }
- if (matches && maxVer) {
- maxVer = new Version(maxVer, '~');
-
- matches = maxVer.gtEq(ver);
- }
- }
-
- if (matches) {
-
- if (!matchAll) {
- return true;
- }
- } else if (matchAll) {
-
- return false;
- }
- }
-
-
-
-
- return !!matchAll;
- },
-
- deprecate: function(packageName, since, closure, scope) {
- if (Version.compare(Ext.getVersion(packageName), since) < 1) {
- closure.call(scope);
- }
- }
- });
- }());
- (function(manifest) {
- var packages = (manifest && manifest.packages) || {},
- compat = manifest && manifest.compatibility,
- name, pkg;
- for (name in packages) {
- pkg = packages[name];
- if (pkg && pkg.version) {
- Ext.setVersion(name, pkg.version);
- }
- }
- if (compat) {
- if (Ext.isString(compat)) {
- Ext.setCompatVersion('core', compat);
- } else {
- for (name in compat) {
- Ext.setCompatVersion(name, compat[name]);
- }
- }
- }
- if (!packages.ext && !packages.touch) {
- Ext.setVersion('ext', '6.6.0.258');
- Ext.setVersion('core', '6.6.0.258');
- }
- })(Ext.manifest);
- Ext.Config = function(name) {
-
-
- var me = this,
- capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);
-
- me.name = name;
-
- me.names = {
- internal: '_' + name,
- initializing: 'is' + capitalizedName + 'Initializing',
- apply: 'apply' + capitalizedName,
- update: 'update' + capitalizedName,
- get: 'get' + capitalizedName,
- set: 'set' + capitalizedName,
- initGet: 'initGet' + capitalizedName,
- changeEvent: name.toLowerCase() + 'change'
- };
-
-
- me.root = me;
- };
- Ext.Config.map = {};
- Ext.Config.get = function(name) {
- var map = Ext.Config.map,
- ret = map[name] || (map[name] = new Ext.Config(name));
- return ret;
- };
- Ext.Config.prototype = {
- self: Ext.Config,
- isConfig: true,
-
-
-
-
- getGetter: function() {
- return this.getter || (this.root.getter = this.makeGetter());
- },
- getInitGetter: function() {
- return this.initGetter || (this.root.initGetter = this.makeInitGetter());
- },
- getSetter: function() {
- return this.setter || (this.root.setter = this.makeSetter());
- },
- getEventedSetter: function() {
- return this.eventedSetter || (this.root.eventedSetter = this.makeEventedSetter());
- },
-
- getInternalName: function(target) {
- return target.$configPrefixed ? this.names.internal : this.name;
- },
- mergeNew: function(newValue, oldValue, target, mixinClass) {
- var ret, key;
- if (!oldValue) {
- ret = newValue;
- } else if (!newValue) {
- ret = oldValue;
- } else {
- ret = Ext.Object.chain(oldValue);
- for (key in newValue) {
- if (!mixinClass || !(key in ret)) {
- ret[key] = newValue[key];
- }
- }
- }
- return ret;
- },
-
- mergeSets: function(newValue, oldValue, preserveExisting) {
- var ret = oldValue ? Ext.Object.chain(oldValue) : {},
- i, val;
- if (newValue instanceof Array) {
- for (i = newValue.length; i--; ) {
- val = newValue[i];
- if (!preserveExisting || !(val in ret)) {
- ret[val] = true;
- }
- }
- } else if (newValue) {
- if (newValue.constructor === Object) {
- for (i in newValue) {
- val = newValue[i];
- if (!preserveExisting || !(i in ret)) {
- ret[i] = val;
- }
- }
- } else if (!preserveExisting || !(newValue in ret)) {
- ret[newValue] = true;
- }
- }
- return ret;
- },
-
-
- makeGetter: function() {
- var name = this.name,
- prefixedName = this.names.internal;
- return function() {
- var internalName = this.$configPrefixed ? prefixedName : name;
- return this[internalName];
- };
- },
- makeInitGetter: function() {
- var name = this.name,
- names = this.names,
- setName = names.set,
- getName = names.get,
- initializingName = names.initializing;
- return function() {
- var me = this;
- me[initializingName] = true;
-
- delete me[getName];
- me[setName](me.config[name]);
- delete me[initializingName];
- return me[getName].apply(me, arguments);
- };
- },
- makeSetter: function() {
- var name = this.name,
- names = this.names,
- prefixedName = names.internal,
- getName = names.get,
- applyName = names.apply,
- updateName = names.update,
- setter;
-
-
- setter = function(value) {
- var me = this,
- internalName = me.$configPrefixed ? prefixedName : name,
- oldValue = me[internalName];
-
- delete me[getName];
- if (!me[applyName] || (value = me[applyName](value, oldValue)) !== undefined) {
-
-
- if (value !== (oldValue = me[internalName])) {
- me[internalName] = value;
- if (me[updateName]) {
- me[updateName](value, oldValue);
- }
- }
- }
- return me;
- };
- setter.$isDefault = true;
- return setter;
- },
- makeEventedSetter: function() {
- var name = this.name,
- names = this.names,
- prefixedName = names.internal,
- getName = names.get,
- applyName = names.apply,
- updateName = names.update,
- changeEventName = names.changeEvent,
- updateFn = function(me, value, oldValue, internalName) {
- me[internalName] = value;
- if (me[updateName]) {
- me[updateName](value, oldValue);
- }
- },
- setter;
-
-
- setter = function(value) {
- var me = this,
- internalName = me.$configPrefixed ? prefixedName : name,
- oldValue = me[internalName];
-
- delete me[getName];
- if (!me[applyName] || (value = me[applyName](value, oldValue)) !== undefined) {
-
-
- if (value !== (oldValue = me[internalName])) {
- if (me.isConfiguring) {
- me[internalName] = value;
- if (me[updateName]) {
- me[updateName](value, oldValue);
- }
- } else {
- me.fireEventedAction(changeEventName, [
- me,
- value,
- oldValue
- ], updateFn, me, [
- me,
- value,
- oldValue,
- internalName
- ]);
- }
- }
- }
- return me;
- };
- setter.$isDefault = true;
- return setter;
- }
- };
- (function() {
-
- var ExtConfig = Ext.Config,
- configPropMap = ExtConfig.map,
- ExtObject = Ext.Object;
- Ext.Configurator = function(cls) {
-
-
-
- var me = this,
- prototype = cls.prototype,
- superCfg = cls.superclass ? cls.superclass.self.$config : null;
-
- me.cls = cls;
-
- me.superCfg = superCfg;
- if (superCfg) {
-
- me.configs = ExtObject.chain(superCfg.configs);
-
- me.cachedConfigs = ExtObject.chain(superCfg.cachedConfigs);
-
- me.initMap = ExtObject.chain(superCfg.initMap);
-
- me.values = ExtObject.chain(superCfg.values);
- me.needsFork = superCfg.needsFork;
-
-
-
-
- me.deprecations = ExtObject.chain(superCfg.deprecations);
- } else
- {
- me.configs = {};
- me.cachedConfigs = {};
- me.initMap = {};
- me.values = {};
-
- me.deprecations = {};
- }
-
- prototype.config = prototype.defaultConfig = me.values;
- cls.$config = me;
- };
- Ext.Configurator.prototype = {
- self: Ext.Configurator,
- needsFork: false,
-
- initList: null,
-
- add: function(config, mixinClass) {
- var me = this,
- Cls = me.cls,
- configs = me.configs,
- cachedConfigs = me.cachedConfigs,
- initMap = me.initMap,
- prototype = Cls.prototype,
- mixinConfigs = mixinClass && mixinClass.$config.configs,
- values = me.values,
- isObject, meta, isCached, merge, cfg, currentValue, name, names, s, value;
- for (name in config) {
- value = config[name];
- isObject = value && value.constructor === Object;
- meta = isObject && '$value' in value ? value : null;
- isCached = false;
- if (meta) {
- isCached = !!meta.cached;
- value = meta.$value;
- isObject = value && value.constructor === Object;
- }
- merge = meta && meta.merge;
- cfg = configs[name];
- if (cfg) {
-
- if (mixinClass) {
- merge = cfg.merge;
- if (!merge) {
-
- continue;
- }
-
- meta = null;
- } else {
- merge = merge || cfg.merge;
- }
-
-
-
- if (!mixinClass && isCached && !cachedConfigs[name]) {
- Ext.raise('Redefining config as cached: ' + name + ' in class: ' + Cls.$className);
- }
-
-
-
-
- currentValue = values[name];
- if (merge) {
- value = merge.call(cfg, value, currentValue, Cls, mixinClass);
- } else if (isObject) {
- if (currentValue && currentValue.constructor === Object) {
-
-
-
-
-
- value = ExtObject.merge({}, currentValue, value);
- }
- }
- } else
-
- {
-
-
-
- if (mixinConfigs) {
-
-
-
- cfg = mixinConfigs[name];
- meta = null;
- } else {
- cfg = ExtConfig.get(name);
- }
- configs[name] = cfg;
- if (cfg.cached || isCached) {
- cachedConfigs[name] = true;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- names = cfg.names;
- if (!prototype[s = names.get]) {
- prototype[s] = cfg.getter || cfg.getGetter();
- }
- if (!prototype[s = names.set]) {
- prototype[s] = (meta && meta.evented) ? (cfg.eventedSetter || cfg.getEventedSetter()) : (cfg.setter || cfg.getSetter());
- }
- }
- if (meta) {
- if (cfg.owner !== Cls) {
- configs[name] = cfg = Ext.Object.chain(cfg);
- cfg.owner = Cls;
- }
- Ext.apply(cfg, meta);
- delete cfg.$value;
- }
-
-
- if (!me.needsFork && value && (value.constructor === Object || value instanceof Array)) {
- me.needsFork = true;
- }
-
- if (value !== null) {
- initMap[name] = true;
- } else {
- if (prototype.$configPrefixed) {
- prototype[configs[name].names.internal] = null;
- } else {
- prototype[configs[name].name] = null;
- }
- if (name in initMap) {
-
- initMap[name] = false;
- }
- }
- values[name] = value;
- }
- },
-
- addDeprecations: function(configs) {
- var me = this,
- deprecations = me.deprecations,
- className = (me.cls.$className || '') + '#',
- message, newName, oldName;
- for (oldName in configs) {
- newName = configs[oldName];
-
-
-
-
-
-
-
-
-
- if (!newName) {
- message = 'This config has been removed.';
- } else if (!(message = newName.message)) {
- message = 'This config has been renamed to "' + newName + '"';
- }
- deprecations[oldName] = className + oldName + ': ' + message;
- }
- },
-
-
- configure: function(instance, instanceConfig) {
- var me = this,
- configs = me.configs,
-
- deprecations = me.deprecations,
-
- initMap = me.initMap,
- initListMap = me.initListMap,
- initList = me.initList,
- prototype = me.cls.prototype,
- values = me.values,
- remaining = 0,
- firstInstance = !initList,
- cachedInitList, cfg, getter, i, internalName, ln, names, name, value, isCached, valuesKey, field;
- values = me.needsFork ? ExtObject.fork(values) : ExtObject.chain(values);
-
- instance.isConfiguring = true;
- if (firstInstance) {
-
-
- me.initList = initList = [];
- me.initListMap = initListMap = {};
- instance.isFirstInstance = true;
- for (name in initMap) {
- cfg = configs[name];
- isCached = cfg.cached;
- if (initMap[name]) {
- names = cfg.names;
- value = values[name];
- if (!prototype[names.set].$isDefault || prototype[names.apply] || prototype[names.update] || typeof value === 'object') {
- if (isCached) {
-
-
-
-
-
- (cachedInitList || (cachedInitList = [])).push(cfg);
- } else {
-
-
- initList.push(cfg);
- initListMap[name] = true;
- }
-
-
-
- instance[names.get] = cfg.initGetter || cfg.getInitGetter();
- } else {
-
-
- prototype[cfg.getInternalName(prototype)] = value;
- }
- } else if (isCached) {
- prototype[cfg.getInternalName(prototype)] = undefined;
- }
- }
- }
-
-
-
- ln = cachedInitList && cachedInitList.length;
- if (ln) {
-
-
-
-
- for (i = 0; i < ln; ++i) {
- internalName = cachedInitList[i].getInternalName(prototype);
-
-
-
- instance[internalName] = null;
- }
- for (i = 0; i < ln; ++i) {
- names = (cfg = cachedInitList[i]).names;
- getter = names.get;
- if (instance.hasOwnProperty(getter)) {
- instance[names.set](values[cfg.name]);
- delete instance[getter];
- }
- }
- for (i = 0; i < ln; ++i) {
- internalName = cachedInitList[i].getInternalName(prototype);
- prototype[internalName] = instance[internalName];
- delete instance[internalName];
- }
- }
-
-
-
-
- if (instanceConfig && instanceConfig.platformConfig) {
- instanceConfig = me.resolvePlatformConfig(instance, instanceConfig);
- }
- if (firstInstance) {
-
-
-
- if (instance.afterCachedConfig && !instance.afterCachedConfig.$nullFn) {
- instance.afterCachedConfig(instanceConfig);
- }
- }
-
-
-
-
-
- instance.config = values;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- for (i = 0 , ln = initList.length; i < ln; ++i) {
- cfg = initList[i];
- instance[cfg.names.get] = cfg.initGetter || cfg.getInitGetter();
- }
-
- if (instance.transformInstanceConfig) {
- instanceConfig = instance.transformInstanceConfig(instanceConfig);
- }
-
-
-
-
-
-
-
-
-
-
-
-
- if (instanceConfig) {
- for (name in instanceConfig) {
- value = instanceConfig[name];
- cfg = configs[name];
-
- if (deprecations[name]) {
- Ext.log.warn(deprecations[name]);
- if (!cfg) {
-
-
-
-
-
- continue;
- }
- }
-
- if (!cfg) {
-
- field = instance.self.prototype[name];
- if (instance.$configStrict && (typeof field === 'function') && !field.$nullFn) {
-
- Ext.raise('Cannot override method ' + name + ' on ' + instance.$className + ' instance.');
- }
-
-
-
- instance[name] = value;
- } else {
-
-
- if (!cfg.lazy) {
- ++remaining;
- }
- if (!initListMap[name]) {
- instance[cfg.names.get] = cfg.initGetter || cfg.getInitGetter();
- }
- if (cfg.merge) {
- value = cfg.merge(value, values[name], instance);
- } else if (value && value.constructor === Object) {
- valuesKey = values[name];
- if (valuesKey && valuesKey.constructor === Object) {
- value = ExtObject.merge(values[name], value);
- } else {
- value = Ext.clone(value, false);
- }
- }
- }
- values[name] = value;
- }
- }
-
- if (instance.beforeInitConfig && !instance.beforeInitConfig.$nullFn) {
- if (instance.beforeInitConfig(instanceConfig) === false) {
- return;
- }
- }
- if (instanceConfig) {
- for (name in instanceConfig) {
- if (!remaining) {
-
-
- break;
- }
-
-
-
- cfg = configs[name];
- if (cfg && !cfg.lazy) {
- --remaining;
-
- names = cfg.names;
- getter = names.get;
-
-
-
-
- if (instance.hasOwnProperty(getter)) {
- instance[names.set](values[name]);
-
-
-
- delete instance[names.get];
- }
- }
- }
- }
-
- for (i = 0 , ln = initList.length; i < ln; ++i) {
- cfg = initList[i];
- names = cfg.names;
- getter = names.get;
- if (!cfg.lazy && instance.hasOwnProperty(getter)) {
-
-
-
-
- instance[names.set](values[cfg.name]);
- delete instance[getter];
- }
- }
-
- delete instance.isConfiguring;
- },
- getCurrentConfig: function(instance) {
- var defaultConfig = instance.defaultConfig,
- config = {},
- name;
- for (name in defaultConfig) {
- config[name] = instance[configPropMap[name].names.get]();
- }
- return config;
- },
-
- merge: function(instance, baseConfig, config) {
-
-
- var configs = this.configs,
- name, value, baseValue, cfg;
- for (name in config) {
- value = config[name];
- cfg = configs[name];
- if (cfg) {
- if (cfg.merge) {
- value = cfg.merge(value, baseConfig[name], instance);
- } else if (value && value.constructor === Object) {
- baseValue = baseConfig[name];
- if (baseValue && baseValue.constructor === Object) {
- value = Ext.Object.merge(baseValue, value);
- } else {
- value = Ext.clone(value, false);
- }
- }
- }
- baseConfig[name] = value;
- }
- return baseConfig;
- },
-
- reconfigure: function(instance, instanceConfig, options) {
- var currentConfig = instance.config,
- configList = [],
- strict = instance.$configStrict && !(options && options.strict === false),
- configs = this.configs,
- defaults = options && options.defaults,
- cfg, getter, i, len, name, names, prop;
- for (name in instanceConfig) {
- cfg = configs[name];
- if (defaults && instance.hasOwnProperty(cfg && instance.$configPrefixed ? cfg.names.internal : name)) {
-
- continue;
- }
- currentConfig[name] = instanceConfig[name];
-
- if (this.deprecations[name]) {
-
- Ext.log.warn(this.deprecations[name]);
- if (!cfg) {
-
- continue;
- }
- }
-
- if (cfg) {
-
-
- instance[cfg.names.get] = cfg.initGetter || cfg.getInitGetter();
- } else {
-
-
-
-
-
-
-
- prop = instance.self.prototype[name];
- if (strict) {
- if ((typeof prop === 'function') && !prop.$nullFn) {
-
- Ext.Error.raise("Cannot override method " + name + " on " + instance.$className + " instance.");
-
-
- continue;
- } else
- {
- if (name !== 'type') {
- Ext.log.warn('No such config "' + name + '" for class ' + instance.$className);
- }
- }
- }
- }
-
- configList.push(name);
- }
- for (i = 0 , len = configList.length; i < len; i++) {
- name = configList[i];
- cfg = configs[name];
- if (cfg) {
- names = cfg.names;
- getter = names.get;
- if (instance.hasOwnProperty(getter)) {
-
-
-
-
- instance[names.set](instanceConfig[name]);
- delete instance[getter];
- }
- } else {
- cfg = configPropMap[name] || Ext.Config.get(name);
- names = cfg.names;
- if (instance[names.set]) {
- instance[names.set](instanceConfig[name]);
- } else {
-
- instance[name] = instanceConfig[name];
- }
- }
- }
- },
-
- resolvePlatformConfig: function(instance, instanceConfig) {
- var platformConfig = instanceConfig && instanceConfig.platformConfig,
- ret = instanceConfig,
- i, keys, n;
- if (platformConfig) {
- keys = Ext.getPlatformConfigKeys(platformConfig);
- n = keys.length;
- if (n) {
- ret = Ext.merge({}, ret);
-
- for (i = 0 , n = keys.length; i < n; ++i) {
- this.merge(instance, ret, platformConfig[keys[i]]);
- }
- }
- }
- return ret;
- }
- };
- }());
- Ext.Base = (function(flexSetter) {
-
-
-
-
-
- var noArgs = [],
- baseStaticMember,
- baseStaticMembers = [],
-
- makeDeprecatedMethod = function(oldName, newName, msg) {
- var message = '"' + oldName + '" is deprecated.';
- if (msg) {
- message += ' ' + msg;
- } else if (newName) {
- message += ' Please use "' + newName + '" instead.';
- }
- return function() {
- Ext.raise(message);
- };
- },
- addDeprecatedProperty = function(object, oldName, newName, message) {
- if (!message) {
- message = '"' + oldName + '" is deprecated.';
- }
- if (newName) {
- message += ' Please use "' + newName + '" instead.';
- }
- if (message) {
- Ext.Object.defineProperty(object, oldName, {
- get: function() {
- Ext.raise(message);
- },
- set: function(value) {
- Ext.raise(message);
- },
- configurable: true
- });
- }
- },
-
- makeAliasFn = function(name) {
- return function() {
- return this[name].apply(this, arguments);
- };
- },
- Version = Ext.Version,
- leadingDigitRe = /^\d/,
- oneMember = {},
- aliasOneMember = {},
- Base = function() {},
- BasePrototype = Base.prototype,
- Reaper;
- Ext.Reaper = Reaper = {
- delay: 100,
- queue: [],
- timer: null,
- add: function(obj) {
- if (!Reaper.timer) {
- Reaper.timer = Ext.defer(Reaper.tick, Reaper.delay);
- }
- Reaper.queue.push(obj);
- },
- flush: function() {
- if (Reaper.timer) {
- Ext.undefer(Reaper.timer);
- Reaper.timer = null;
- }
- var queue = Reaper.queue,
- n = queue.length,
- i, obj;
- Reaper.queue = [];
- for (i = 0; i < n; ++i) {
- obj = queue[i];
- if (obj && obj.$reap) {
- obj.$reap();
- }
- }
- },
- tick: function() {
- Reaper.timer = null;
- Reaper.flush();
- }
- };
-
- Ext.apply(Base, {
- $className: 'Ext.Base',
- $isClass: true,
-
- create: function() {
- return Ext.create.apply(Ext, [
- this
- ].concat(Array.prototype.slice.call(arguments, 0)));
- },
-
- addDeprecations: function(deprecations) {
- var me = this,
- all = [],
- compatVersion = Ext.getCompatVersion(deprecations.name),
-
- configurator = me.getConfigurator(),
- displayName = (me.$className || '') + '#',
-
- deprecate, versionSpec, index, message, target, enabled, existing, fn, names, oldName, newName, member, statics, version;
- for (versionSpec in deprecations) {
- if (leadingDigitRe.test(versionSpec)) {
- version = new Ext.Version(versionSpec);
- version.deprecations = deprecations[versionSpec];
- all.push(version);
- }
- }
- all.sort(Version.compare);
- for (index = all.length; index--; ) {
- deprecate = (version = all[index]).deprecations;
- target = me.prototype;
- statics = deprecate.statics;
-
-
-
-
-
-
- enabled = compatVersion && compatVersion.lt(version);
-
- if (!enabled) {}
-
- else if (!enabled) {
-
- break;
- }
- while (deprecate) {
- names = deprecate.methods;
- if (names) {
- for (oldName in names) {
- member = names[oldName];
- fn = null;
- if (!member) {
-
-
-
- Ext.Assert.isNotDefinedProp(target, oldName);
- fn = makeDeprecatedMethod(displayName + oldName);
- }
-
- else if (Ext.isString(member)) {
-
-
-
- Ext.Assert.isNotDefinedProp(target, oldName);
- Ext.Assert.isDefinedProp(target, member);
-
- if (enabled) {
-
-
- fn = makeAliasFn(member);
- } else
- {
- fn = makeDeprecatedMethod(displayName + oldName, member);
- }
- } else
- {
-
- message = '';
- if (member.message || member.fn) {
-
- message = member.message;
-
- member = member.fn;
- }
- existing = target.hasOwnProperty(oldName) && target[oldName];
- if (enabled && member) {
- member.$owner = me;
- member.$name = oldName;
-
- member.name = displayName + oldName;
-
- if (existing) {
- member.$previous = existing;
- }
- fn = member;
- }
-
- else if (!existing) {
- fn = makeDeprecatedMethod(displayName + oldName, null, message);
- }
- }
-
- if (fn) {
- target[oldName] = fn;
- }
- }
- }
-
-
-
-
- names = deprecate.configs;
- if (names) {
-
-
-
-
-
-
-
-
-
-
-
-
-
- configurator.addDeprecations(names);
- }
- names = deprecate.properties;
- if (names && !enabled) {
-
-
-
- for (oldName in names) {
- newName = names[oldName];
- if (Ext.isString(newName)) {
- addDeprecatedProperty(target, displayName + oldName, newName);
- } else if (newName && newName.message) {
- addDeprecatedProperty(target, displayName + oldName, null, newName.message);
- } else {
- addDeprecatedProperty(target, displayName + oldName);
- }
- }
- }
-
-
-
- deprecate = statics;
- statics = null;
- target = me;
- }
- }
- },
-
- extend: function(parentClass) {
- var me = this,
- parentPrototype = parentClass.prototype,
- prototype, name, statics;
- prototype = me.prototype = Ext.Object.chain(parentPrototype);
- prototype.self = me;
- me.superclass = prototype.superclass = parentPrototype;
- if (!parentClass.$isClass) {
- for (name in BasePrototype) {
- if (name in prototype) {
- prototype[name] = BasePrototype[name];
- }
- }
- }
-
-
- statics = parentPrototype.$inheritableStatics;
- if (statics) {
- for (name in statics) {
- if (!me.hasOwnProperty(name)) {
- me[name] = parentClass[name];
- }
- }
- }
-
- if (parentClass.$onExtended) {
- me.$onExtended = parentClass.$onExtended.slice();
- }
-
- me.getConfigurator();
- },
-
-
- $onExtended: [],
-
- triggerExtended: function() {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(this, 'Ext.Base#triggerExtended', arguments);
-
- var callbacks = this.$onExtended,
- ln = callbacks.length,
- i, callback;
- if (ln > 0) {
- for (i = 0; i < ln; i++) {
- callback = callbacks[i];
- callback.fn.apply(callback.scope || this, arguments);
- }
- }
- },
-
- onExtended: function(fn, scope) {
- this.$onExtended.push({
- fn: fn,
- scope: scope
- });
- return this;
- },
-
- addStatics: function(members) {
- this.addMembers(members, true);
- return this;
- },
-
- addInheritableStatics: function(members) {
- var me = this,
- proto = me.prototype,
- inheritableStatics = me.$inheritableStatics,
- name, member, current;
- if (!inheritableStatics) {
- inheritableStatics = Ext.apply({}, proto.$inheritableStatics);
- me.$inheritableStatics = proto.$inheritableStatics = inheritableStatics;
- }
-
- var className = Ext.getClassName(me) + '.';
-
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
- current = me[name];
-
- if (typeof member == 'function') {
- member.name = className + name;
- }
-
- if (typeof current === 'function' && !current.$isClass && !current.$nullFn) {
- member.$previous = current;
- }
- me[name] = member;
- inheritableStatics[name] = true;
- }
- }
- return me;
- },
-
- addMembers: function(members, isStatic, privacy) {
- var me = this,
-
- cloneFunction = Ext.Function.clone,
- target = isStatic ? me : me.prototype,
- defaultConfig = !isStatic && target.defaultConfig,
- enumerables = Ext.enumerables,
- privates = members.privates,
- configs, i, ln, member, name, subPrivacy, privateStatics;
-
- var displayName = (me.$className || '') + '#';
-
- if (privates) {
-
-
- delete members.privates;
- if (!isStatic) {
- privateStatics = privates.statics;
- delete privates.statics;
- }
-
- subPrivacy = privates.privacy || privacy || 'framework';
-
- me.addMembers(privates, isStatic, subPrivacy);
- if (privateStatics) {
- me.addMembers(privateStatics, true, subPrivacy);
- }
- }
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
-
- if (privacy === true) {
- privacy = 'framework';
- }
- if (member && member.$nullFn && privacy !== member.$privacy) {
- Ext.raise('Cannot use stock function for private method ' + (me.$className ? me.$className + '#' : '') + name);
- }
-
- if (typeof member === 'function' && !member.$isClass && !member.$nullFn) {
- if (member.$owner) {
- member = cloneFunction(member);
- }
- if (target.hasOwnProperty(name)) {
- member.$previous = target[name];
- }
-
-
- member.$owner = me;
- member.$name = name;
-
- member.name = displayName + name;
- var existing = target[name];
- if (privacy) {
- member.$privacy = privacy;
-
-
-
-
-
-
- if (existing && existing.$privacy && existing.$privacy !== privacy) {
- Ext.privacyViolation(me, existing, member, isStatic);
- }
- } else if (existing && existing.$privacy) {
- Ext.privacyViolation(me, existing, member, isStatic);
- }
- }
-
-
-
- else if (defaultConfig && (name in defaultConfig) && !target.config.hasOwnProperty(name)) {
-
-
- (configs || (configs = {}))[name] = member;
-
- continue;
- }
- target[name] = member;
- }
- }
- if (configs) {
-
- me.addConfig(configs);
- }
- if (enumerables) {
- for (i = 0 , ln = enumerables.length; i < ln; ++i) {
- if (members.hasOwnProperty(name = enumerables[i])) {
- member = members[name];
-
- if (member && !member.$nullFn) {
- if (member.$owner) {
- member = cloneFunction(member);
- }
- member.$owner = me;
- member.$name = name;
-
- member.name = displayName + name;
-
- if (target.hasOwnProperty(name)) {
- member.$previous = target[name];
- }
- }
- target[name] = member;
- }
- }
- }
- return this;
- },
-
- addMember: function(name, member) {
- oneMember[name] = member;
- this.addMembers(oneMember);
- delete oneMember[name];
- return this;
- },
-
- borrow: function(fromClass, members) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(this, 'Ext.Base#borrow', arguments);
-
- var prototype = fromClass.prototype,
- membersObj = {},
- i, ln, name;
- members = Ext.Array.from(members);
- for (i = 0 , ln = members.length; i < ln; i++) {
- name = members[i];
- membersObj[name] = prototype[name];
- }
- return this.addMembers(membersObj);
- },
-
- override: function(members) {
- var me = this,
- statics = members.statics,
- inheritableStatics = members.inheritableStatics,
- config = members.config,
- mixins = members.mixins,
- cachedConfig = members.cachedConfig;
- if (statics || inheritableStatics || config) {
- members = Ext.apply({}, members);
- }
- if (statics) {
- me.addMembers(statics, true);
- delete members.statics;
- }
- if (inheritableStatics) {
- me.addInheritableStatics(inheritableStatics);
- delete members.inheritableStatics;
- }
- if (members.platformConfig) {
- me.addPlatformConfig(members);
- }
- if (config) {
- me.addConfig(config);
- delete members.config;
- }
- if (cachedConfig) {
- me.addCachedConfig(cachedConfig);
- delete members.cachedConfig;
- }
- delete members.mixins;
- me.addMembers(members);
- if (mixins) {
- me.mixin(mixins);
- }
- return me;
- },
- addPlatformConfig: function(data) {
- var me = this,
- prototype = me.prototype,
- platformConfigs = data.platformConfig,
- added, classConfigs, configs, configurator, keys, name, value, i, ln;
- delete prototype.platformConfig;
-
- if (platformConfigs instanceof Array) {
- throw new Error('platformConfigs must be specified as an object.');
- }
-
- configurator = me.getConfigurator();
- classConfigs = configurator.configs;
-
- keys = Ext.getPlatformConfigKeys(platformConfigs);
-
-
-
-
-
-
-
-
-
-
- for (i = 0 , ln = keys.length; i < ln; ++i) {
- configs = platformConfigs[keys[i]];
- added = null;
- for (name in configs) {
- value = configs[name];
-
- if (name in classConfigs) {
-
- (added || (added = {}))[name] = value;
- } else {
-
- prototype[name] = value;
- }
- }
- if (added) {
- configurator.add(added);
- }
- }
- },
-
- callParent: function(args) {
- var method;
-
- return (method = this.callParent.caller) && (method.$previous || ((method = method.$owner ? method : method.caller) && method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
- var method;
-
- return (method = this.callSuper.caller) && ((method = method.$owner ? method : method.caller) && method.$owner.superclass.self[method.$name]).apply(this, args || noArgs);
- },
-
-
- mixin: function(name, mixinClass) {
- var me = this,
- mixin, prototype, key, statics, i, ln, mixinName, mixinValue, mixins, mixinStatics, staticName;
- if (typeof name !== 'string') {
- mixins = name;
- if (mixins instanceof Array) {
- for (i = 0 , ln = mixins.length; i < ln; i++) {
- mixin = mixins[i];
- me.mixin(mixin.prototype.mixinId || mixin.$className, mixin);
- }
- } else {
-
-
-
-
- for (mixinName in mixins) {
- me.mixin(mixinName, mixins[mixinName]);
- }
- }
- return;
- }
- mixin = mixinClass.prototype;
- prototype = me.prototype;
- if (mixin.onClassMixedIn) {
- mixin.onClassMixedIn.call(mixinClass, me);
- }
- if (!prototype.hasOwnProperty('mixins')) {
- if ('mixins' in prototype) {
- prototype.mixins = Ext.Object.chain(prototype.mixins);
- } else {
- prototype.mixins = {};
- }
- }
- for (key in mixin) {
- mixinValue = mixin[key];
- if (key === 'mixins') {
-
-
-
-
-
-
-
-
-
-
- Ext.applyIf(prototype.mixins, mixinValue);
- } else if (!(key === 'mixinId' || key === 'config' || key === '$inheritableStatics') && (prototype[key] === undefined)) {
- prototype[key] = mixinValue;
- }
- }
-
-
- statics = mixin.$inheritableStatics;
- if (statics) {
- mixinStatics = {};
- for (staticName in statics) {
- if (!me.hasOwnProperty(staticName)) {
- mixinStatics[staticName] = mixinClass[staticName];
- }
- }
- me.addInheritableStatics(mixinStatics);
- }
-
-
- if ('config' in mixin) {
- me.addConfig(mixin.config, mixinClass);
- }
-
- prototype.mixins[name] = mixin;
- if (mixin.afterClassMixedIn) {
- mixin.afterClassMixedIn.call(mixinClass, me);
- }
- return me;
- },
-
-
-
- addConfig: function(config, mixinClass) {
- var cfg = this.$config || this.getConfigurator();
- cfg.add(config, mixinClass);
- },
- addCachedConfig: function(config, isMixin) {
- var cached = {},
- key;
- for (key in config) {
- cached[key] = {
- cached: true,
- $value: config[key]
- };
- }
- this.addConfig(cached, isMixin);
- },
-
- getConfigurator: function() {
-
- return this.$config || new Ext.Configurator(this);
- },
-
-
- getName: function() {
- return Ext.getClassName(this);
- },
-
- createAlias: flexSetter(function(alias, origin) {
- aliasOneMember[alias] = function() {
- return this[origin].apply(this, arguments);
- };
- this.override(aliasOneMember);
- delete aliasOneMember[alias];
- })
- });
-
-
- for (baseStaticMember in Base) {
- if (Base.hasOwnProperty(baseStaticMember)) {
- baseStaticMembers.push(baseStaticMember);
- }
- }
- Base.$staticMembers = baseStaticMembers;
-
- Base.getConfigurator();
-
-
- Base.addMembers({
-
- $className: 'Ext.Base',
-
- isInstance: true,
-
- $configPrefixed: true,
-
- $configStrict: true,
-
- isConfiguring: false,
-
- isFirstInstance: false,
-
- destroyed: false,
-
- clearPropertiesOnDestroy: true,
-
- clearPrototypeOnDestroy: false,
-
- statics: function() {
- var method = this.statics.caller,
- self = this.self;
- if (!method) {
- return self;
- }
- return method.$owner;
- },
-
- callParent: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callParent.caller) && (method.$previous || ((method = method.$owner ? method : method.caller) && method.$owner.superclass[method.$name]));
-
- if (!superMethod) {
- method = this.callParent.caller;
- var parentClass, methodName;
- if (!method.$owner) {
- if (!method.caller) {
- throw new Error("Attempting to call a protected method from the public scope, which is not allowed");
- }
- method = method.caller;
- }
- parentClass = method.$owner.superclass;
- methodName = method.$name;
- if (!(methodName in parentClass)) {
- throw new Error("this.callParent() was called but there's no such method (" + methodName + ") found in the parent class (" + (Ext.getClassName(parentClass) || 'Object') + ")");
- }
- }
-
- return superMethod.apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callSuper.caller) && ((method = method.$owner ? method : method.caller) && method.$owner.superclass[method.$name]);
-
- if (!superMethod) {
- method = this.callSuper.caller;
- var parentClass, methodName;
- if (!method.$owner) {
- if (!method.caller) {
- throw new Error("Attempting to call a protected method from the public scope, which is not allowed");
- }
- method = method.caller;
- }
- parentClass = method.$owner.superclass;
- methodName = method.$name;
- if (!(methodName in parentClass)) {
- throw new Error("this.callSuper() was called but there's no such method (" + methodName + ") found in the parent class (" + (Ext.getClassName(parentClass) || 'Object') + ")");
- }
- }
-
- return superMethod.apply(this, args || noArgs);
- },
-
- self: Base,
-
- constructor: function() {
- return this;
- },
-
-
- initConfig: function(instanceConfig) {
- var me = this,
- cfg = me.self.getConfigurator();
- me.initConfig = Ext.emptyFn;
-
- me.initialConfig = instanceConfig || {};
- cfg.configure(me, instanceConfig);
- return me;
- },
- beforeInitConfig: Ext.emptyFn,
-
- getConfig: function(name, peek, ifInitialized) {
- var me = this,
- ret, cfg, propName;
- if (name) {
- cfg = me.self.$config.configs[name];
- if (cfg) {
- propName = me.$configPrefixed ? cfg.names.internal : name;
-
-
-
-
-
- if (ifInitialized) {
- ret = me.hasOwnProperty(propName) ? me[propName] : null;
- } else if (peek) {
-
-
-
- ret = me.hasOwnProperty(propName) ? me[propName] : me.config[name];
- } else {
- ret = me[cfg.names.get]();
- }
- } else {
- ret = me[name];
- }
- } else {
- ret = me.getCurrentConfig();
- }
- return ret;
- },
-
- destroyMembers: function() {
- var me = this,
- configs = me.self.$config.configs,
- len = arguments.length,
- cfg, name, value, i;
- for (i = 0; i < len; i++) {
- name = arguments[i];
- cfg = configs[name];
- name = cfg && me.$configPrefixed ? cfg.names.internal : name;
- value = me.hasOwnProperty(name) && me[name];
- if (value) {
- Ext.destroy(value);
- me[name] = null;
- }
- }
- },
- freezeConfig: function(name) {
- var me = this,
- config = Ext.Config.get(name),
- names = config.names,
- value = me[names.get]();
- me[names.set] = function(v) {
-
- if (v !== value) {
- Ext.raise('Cannot change frozen config "' + name + '"');
- }
-
- return me;
- };
-
- if (!Ext.isIE8) {
- Object.defineProperty(me, me.$configPrefixed ? names.internal : name, {
- get: function() {
- return value;
- },
- set: function(v) {
- if (v !== value) {
- Ext.raise('Cannot change frozen config "' + name + '"');
- }
- }
- });
- }
- },
-
-
- setConfig: function(name, value, options) {
-
-
-
-
-
- var me = this,
- configurator, config, prop;
- if (name) {
- configurator = me.self.getConfigurator();
- if (typeof name === 'string') {
- config = configurator.configs[name];
- if (!config) {
- if (me.$configStrict) {
- prop = me.self.prototype[name];
- if ((typeof prop === 'function') && !prop.$nullFn) {
-
- Ext.Error.raise("Cannot override method " + name + " on " + me.$className + " instance.");
-
- return me;
- } else
- {
- if (name !== 'type') {
- Ext.log.warn('No such config "' + name + '" for class ' + me.$className);
- }
- }
- }
-
- config = Ext.Config.map[name] || Ext.Config.get(name);
- }
- if (me[config.names.set]) {
- me[config.names.set](value);
- } else {
-
- me[name] = value;
- }
- } else {
-
-
- configurator.reconfigure(me, name, options || value);
- }
- }
- return me;
- },
-
- getCurrentConfig: function() {
- var cfg = this.self.getConfigurator();
- return cfg.getCurrentConfig(this);
- },
-
- hasConfig: function(name) {
- return name in this.defaultConfig;
- },
-
- getInitialConfig: function(name) {
- var config = this.config;
- if (!name) {
- return config;
- }
- return config[name];
- },
-
- $links: null,
-
- link: function(name, value) {
- var me = this,
- links = me.$links || (me.$links = {});
- links[name] = true;
- me[name] = value;
- return value;
- },
-
- unlink: function(names) {
- var me = this,
- i, ln, link, value;
-
- if (!Ext.isArray(names)) {
- Ext.raise('Invalid argument - expected array of strings');
- }
-
- for (i = 0 , ln = names.length; i < ln; i++) {
- link = names[i];
- value = me[link];
- if (value) {
- if (value.isInstance && !value.destroyed) {
- value.destroy();
- } else if (value.parentNode && 'nodeType' in value) {
- value.parentNode.removeChild(value);
- }
- }
- me[link] = null;
- }
- return me;
- },
- $reap: function() {
- var me = this,
- protectedProps = me.$noClearOnDestroy,
- props, prop, value, type, i, len;
-
-
- props = Ext.Object.getKeys(me);
- for (i = 0 , len = props.length; i < len; i++) {
- prop = props[i];
- if (!protectedProps || !protectedProps[prop]) {
- value = me[prop];
- type = typeof value;
-
-
-
-
- if (type === 'object' || (type === 'function' && !value.$noClearOnDestroy)) {
- me[prop] = null;
- }
- }
- }
- me.$nulled = true;
-
-
-
- if (Object.setPrototypeOf) {
- if (me.clearPrototypeOnDestroy && !me.$vetoClearingPrototypeOnDestroy) {
- props = me.$preservePrototypeProperties;
- if (props) {
- for (i = 0 , len = props.length; i < len; i++) {
- prop = props[i];
- if (!me.hasOwnProperty(prop)) {
- me[prop] = me[prop];
- }
- }
- }
- Object.setPrototypeOf(me, null);
- }
- }
- },
-
-
- destroy: function() {
- var me = this,
- links = me.$links,
- clearPropertiesOnDestroy = me.clearPropertiesOnDestroy;
- if (links) {
- me.$links = null;
- me.unlink(Ext.Object.getKeys(links));
- }
- me.destroy = Ext.emptyFn;
-
- me.isDestroyed = me.destroyed = true;
-
-
- if (clearPropertiesOnDestroy === true) {
-
- if (!me.isObservable) {
- me.$reap();
- }
- } else if (clearPropertiesOnDestroy) {
-
- if (clearPropertiesOnDestroy !== 'async') {
- Ext.raise('Invalid value for clearPropertiesOnDestroy');
- }
-
- Reaper.add(me);
- }
- }
- });
-
- BasePrototype.callOverridden = BasePrototype.callParent;
-
- Ext.privacyViolation = function(cls, existing, member, isStatic) {
- var name = member.$name,
- conflictCls = existing.$owner && existing.$owner.$className,
- s = isStatic ? 'static ' : '',
- msg = member.$privacy ? 'Private ' + s + member.$privacy + ' method "' + name + '"' : 'Public ' + s + 'method "' + name + '"';
- if (cls.$className) {
- msg = cls.$className + ': ' + msg;
- }
- if (!existing.$privacy) {
- msg += conflictCls ? ' hides public method inherited from ' + conflictCls : ' hides inherited public method.';
- } else {
- msg += conflictCls ? ' conflicts with private ' + existing.$privacy + ' method declared by ' + conflictCls : ' conflicts with inherited private ' + existing.$privacy + ' method.';
- }
- var compat = Ext.getCompatVersion();
- var ver = Ext.getVersion();
-
- if (ver && compat && compat.lt(ver)) {
- Ext.log.error(msg);
- } else {
- Ext.raise(msg);
- }
- };
- Ext.Reaper.tick.$skipTimerCheck = true;
-
- return Base;
- }(Ext.Function.flexSetter));
- (function(LRU, prototype) {
-
-
-
- (Ext.util || (Ext.util = {})).LRU = LRU = function(config) {
- var me = this,
- head;
- if (config) {
- Ext.apply(me, config);
- }
-
- me.head = head = {
-
- id: (me.seed = 0),
-
- key: null,
- value: null
- };
-
- me.map = {};
- head.next = head.prev = head;
- };
- LRU.prototype = prototype = {
-
- count: 0,
-
- add: function(key, value) {
- var me = this,
- map = me.map,
- entry = map[key];
- if (entry) {
- me.unlink(entry);
- --me.count;
- }
- map[key] = entry = {
-
- id: ++me.seed,
-
- key: key,
- value: value
- };
- me.link(entry);
- ++me.count;
- return entry;
- },
-
- clear: function(fn, scope) {
- var me = this,
- head = me.head,
- entry = head.next;
- head.next = head.prev = head;
- me.count = 0;
- if (fn && !fn.$nullFn) {
- for (; entry !== head; entry = entry.next) {
- fn.call(scope || me, entry.key, entry.value);
- }
- }
- },
-
- each: function(fn, scope) {
- scope = scope || this;
- for (var head = this.head,
- ent = head.next; ent !== head; ent = ent.next) {
- if (fn.call(scope, ent.key, ent.value)) {
- break;
- }
- }
- },
-
- prune: function(fn, scope) {
- var me = this,
- entry = me.head.prev,
- ret;
- if (me.count) {
- ret = entry.value;
- me.unlink(entry);
- --me.count;
- if (fn) {
- fn.call(scope || me, entry.key, ret);
- }
- }
- return ret;
- },
-
- remove: function(key) {
- var me = this,
- map = me.map,
- entry = map[key],
- value;
- if (entry) {
- me.unlink(entry);
- value = entry.value;
- delete map[key];
- --me.count;
- }
- return value;
- },
-
- touch: function(key) {
- var me = this,
- head = me.head,
- entry = me.map[key];
- if (entry && entry.prev !== head) {
-
-
- me.unlink(entry);
- me.link(entry);
- }
- },
-
- trim: function(size, fn, scope) {
- while (this.count > size) {
- this.prune(fn, scope);
- }
- },
-
-
-
- link: function(entry) {
- var head = this.head,
- first = head.next;
- entry.next = first;
- entry.prev = head;
- head.next = entry;
- first.prev = entry;
- },
-
- unlink: function(entry) {
- var next = entry.next,
- prev = entry.prev;
- prev.next = next;
- next.prev = prev;
- }
- };
- prototype.destroy = function() {
- this.clear.apply(this, arguments);
- };
- }());
- (function(LRU, fn, Cache) {
-
-
-
-
- Ext.util.Cache = Cache = function(config) {
- LRU.call(this, config);
- };
- fn.prototype = LRU.prototype;
- Cache.prototype = Ext.apply(new fn(), {
-
- maxSize: 100,
-
-
- clear: function() {
- LRU.prototype.clear.call(this, this.evict);
- },
-
- get: function(key) {
- var me = this,
- entry = me.map[key],
- value;
- if (entry) {
- value = entry.value;
- me.touch(key);
- } else {
- value = me.miss.apply(me, arguments);
- me.add(key, value);
- me.trim(me.maxSize, me.evict);
- }
- return value;
- },
-
-
-
- evict: Ext.emptyFn
- });
- }(Ext.util.LRU, function() {}));
- (function() {
-
-
-
-
-
- var ExtClass,
- Base = Ext.Base,
- baseStaticMembers = Base.$staticMembers,
- ruleKeySortFn = function(a, b) {
-
- return (a.length - b.length) || ((a < b) ? -1 : ((a > b) ? 1 : 0));
- };
-
- function makeCtor(className) {
- function constructor() {
-
-
- return this.constructor.apply(this, arguments) || null;
- }
-
- if (className) {
- constructor.name = className;
- }
-
- return constructor;
- }
-
- Ext.Class = ExtClass = function(Class, data, onCreated) {
- if (typeof Class != 'function') {
- onCreated = data;
- data = Class;
- Class = null;
- }
- if (!data) {
- data = {};
- }
- Class = ExtClass.create(Class, data);
- ExtClass.process(Class, data, onCreated);
- return Class;
- };
- Ext.apply(ExtClass, {
- makeCtor: makeCtor,
-
- onBeforeCreated: function(Class, data, hooks) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, '>> Ext.Class#onBeforeCreated', arguments);
-
- Class.addMembers(data);
- hooks.onCreated.call(Class, Class);
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, '<< Ext.Class#onBeforeCreated', arguments);
- },
-
-
- create: function(Class, data) {
- var i = baseStaticMembers.length,
- name;
- if (!Class) {
- Class = makeCtor(
- data.$className);
- }
-
- while (i--) {
- name = baseStaticMembers[i];
- Class[name] = Base[name];
- }
- return Class;
- },
-
- process: function(Class, data, onCreated) {
- var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
- registeredPreprocessors = this.preprocessors,
- hooks = {
- onBeforeCreated: this.onBeforeCreated
- },
- preprocessors = [],
- preprocessor, preprocessorsProperties, i, ln, j, subLn, preprocessorProperty;
- delete data.preprocessors;
- Class._classHooks = hooks;
- for (i = 0 , ln = preprocessorStack.length; i < ln; i++) {
- preprocessor = preprocessorStack[i];
- if (typeof preprocessor == 'string') {
- preprocessor = registeredPreprocessors[preprocessor];
- preprocessorsProperties = preprocessor.properties;
- if (preprocessorsProperties === true) {
- preprocessors.push(preprocessor.fn);
- } else if (preprocessorsProperties) {
- for (j = 0 , subLn = preprocessorsProperties.length; j < subLn; j++) {
- preprocessorProperty = preprocessorsProperties[j];
- if (data.hasOwnProperty(preprocessorProperty)) {
- preprocessors.push(preprocessor.fn);
- break;
- }
- }
- }
- } else {
- preprocessors.push(preprocessor);
- }
- }
- hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
- hooks.preprocessors = preprocessors;
- this.doProcess(Class, data, hooks);
- },
- doProcess: function(Class, data, hooks) {
- var me = this,
- preprocessors = hooks.preprocessors,
- preprocessor = preprocessors.shift(),
- doProcess = me.doProcess;
- for (; preprocessor; preprocessor = preprocessors.shift()) {
-
- if (preprocessor.call(me, Class, data, hooks, doProcess) === false) {
- return;
- }
- }
- hooks.onBeforeCreated.apply(me, arguments);
- },
-
- preprocessors: {},
-
- registerPreprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [
- name
- ];
- }
- this.preprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPreprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- getPreprocessor: function(name) {
- return this.preprocessors[name];
- },
-
- getPreprocessors: function() {
- return this.preprocessors;
- },
-
- defaultPreprocessors: [],
-
- getDefaultPreprocessors: function() {
- return this.defaultPreprocessors;
- },
-
- setDefaultPreprocessors: function(preprocessors) {
- this.defaultPreprocessors = Ext.Array.from(preprocessors);
- return this;
- },
-
- setDefaultPreprocessorPosition: function(name, offset, relativeName) {
- var defaultPreprocessors = this.defaultPreprocessors,
- index;
- if (typeof offset == 'string') {
- if (offset === 'first') {
- defaultPreprocessors.unshift(name);
- return this;
- } else if (offset === 'last') {
- defaultPreprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- }
- });
-
- ExtClass.registerPreprocessor('extend', function(Class, data, hooks) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#extendPreProcessor', arguments);
-
- var Base = Ext.Base,
- basePrototype = Base.prototype,
- extend = data.extend,
- Parent, parentPrototype, i;
- delete data.extend;
- if (extend && extend !== Object) {
- Parent = extend;
- } else {
- Parent = Base;
- }
- parentPrototype = Parent.prototype;
- if (!Parent.$isClass) {
- for (i in basePrototype) {
- if (!parentPrototype[i]) {
- parentPrototype[i] = basePrototype[i];
- }
- }
- }
- Class.extend(Parent);
- Class.triggerExtended.apply(Class, arguments);
-
- if (data.onClassExtended) {
- Class.onExtended(data.onClassExtended, Class);
- delete data.onClassExtended;
- }
- }, true);
-
-
- ExtClass.registerPreprocessor('privates', function(Class, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#privatePreprocessor', arguments);
-
- var privates = data.privates,
- statics = privates.statics,
- privacy = privates.privacy || true;
- delete data.privates;
- delete privates.statics;
-
-
-
- Class.addMembers(privates, false, privacy);
- if (statics) {
- Class.addMembers(statics, true, privacy);
- }
- });
-
-
- ExtClass.registerPreprocessor('statics', function(Class, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#staticsPreprocessor', arguments);
-
- Class.addStatics(data.statics);
- delete data.statics;
- });
-
-
-
- ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#inheritableStaticsPreprocessor', arguments);
-
- Class.addInheritableStatics(data.inheritableStatics);
- delete data.inheritableStatics;
- });
-
- Ext.createRuleFn = function(code) {
- return new Function('$c', 'with($c) { try { return (' + code + '); } catch(e) { return false;}}');
- };
- Ext.expressionCache = new Ext.util.Cache({
- miss: Ext.createRuleFn
- });
- Ext.ruleKeySortFn = ruleKeySortFn;
- Ext.getPlatformConfigKeys = function(platformConfig) {
- var ret = [],
- platform, rule;
- for (platform in platformConfig) {
- rule = Ext.expressionCache.get(platform);
- if (rule(Ext.platformTags)) {
- ret.push(platform);
- }
- }
- ret.sort(ruleKeySortFn);
- return ret;
- };
-
-
- ExtClass.registerPreprocessor('config', function(Class, data) {
-
- if (data.hasOwnProperty('$configPrefixed')) {
- Class.prototype.$configPrefixed = data.$configPrefixed;
- }
- Class.addConfig(data.config);
-
-
-
- delete data.config;
- });
-
-
-
- ExtClass.registerPreprocessor('cachedConfig', function(Class, data) {
-
- if (data.hasOwnProperty('$configPrefixed')) {
- Class.prototype.$configPrefixed = data.$configPrefixed;
- }
- Class.addCachedConfig(data.cachedConfig);
-
- delete data.cachedConfig;
- });
-
-
-
- ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#mixinsPreprocessor', arguments);
-
- var mixins = data.mixins,
- onCreated = hooks.onCreated;
- delete data.mixins;
- hooks.onCreated = function() {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#mixinsPreprocessor#beforeCreated', arguments);
-
-
-
- hooks.onCreated = onCreated;
- Class.mixin(mixins);
-
-
- return hooks.onCreated.apply(this, arguments);
- };
- });
-
-
-
- Ext.extend = function(Class, Parent, members) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#extend-backwards-compatible', arguments);
-
- if (arguments.length === 2 && Ext.isObject(Parent)) {
- members = Parent;
- Parent = Class;
- Class = null;
- }
- var cls;
- if (!Parent) {
- throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
- }
- members.extend = Parent;
- members.preprocessors = [
- 'extend',
-
- 'statics',
-
-
- 'inheritableStatics',
-
-
- 'mixins',
-
-
- 'config'
- ];
-
- if (Class) {
- cls = new ExtClass(Class, members);
-
- cls.prototype.constructor = Class;
- } else {
- cls = new ExtClass(members);
- }
- cls.prototype.override = function(o) {
- for (var m in o) {
- if (o.hasOwnProperty(m)) {
- this[m] = o[m];
- }
- }
- };
- return cls;
- };
- }());
- Ext.Inventory = function() {
-
-
-
- var me = this;
- me.names = [];
- me.paths = {};
- me.alternateToName = {};
- me.aliasToName = {};
- me.nameToAliases = {};
- me.nameToAlternates = {};
- me.nameToPrefix = {};
- };
- Ext.Inventory.prototype = {
- _array1: [
- 0
- ],
- prefixes: null,
- dotRe: /\./g,
- wildcardRe: /\*/g,
- addAlias: function(className, alias, update) {
- return this.addMapping(className, alias, this.aliasToName, this.nameToAliases, update);
- },
- addAlternate: function(className, alternate) {
- return this.addMapping(className, alternate, this.alternateToName, this.nameToAlternates);
- },
- addMapping: function(className, alternate, toName, nameTo, update) {
- var name = className.$className || className,
- mappings = name,
- array = this._array1,
- a, aliases, cls, i, length, nameMapping;
- if (Ext.isString(name)) {
- mappings = {};
- mappings[name] = alternate;
- }
- for (cls in mappings) {
- aliases = mappings[cls];
- if (Ext.isString(aliases)) {
- array[0] = aliases;
- aliases = array;
- }
- length = aliases.length;
- nameMapping = nameTo[cls] || (nameTo[cls] = []);
- for (i = 0; i < length; ++i) {
- if (!(a = aliases[i])) {
-
- continue;
- }
- if (toName[a] !== cls) {
-
- if (!update && toName[a] && ('Ext.Gadget' !== a)) {
- Ext.log.warn("Overriding existing mapping: '" + a + "' From '" + toName[a] + "' to '" + cls + "'. Is this intentional?");
- }
-
- toName[a] = cls;
- nameMapping.push(a);
- }
- }
- }
- },
-
- getAliasesByName: function(name) {
- return this.nameToAliases[name] || null;
- },
- getAlternatesByName: function(name) {
- return this.nameToAlternates[name] || null;
- },
-
- getNameByAlias: function(alias) {
- return this.aliasToName[alias] || '';
- },
-
- getNameByAlternate: function(alternate) {
- return this.alternateToName[alternate] || '';
- },
-
- getNamesByExpression: function(expression, exclude, accumulate) {
- var me = this,
- aliasToName = me.aliasToName,
- alternateToName = me.alternateToName,
- nameToAliases = me.nameToAliases,
- nameToAlternates = me.nameToAlternates,
- map = accumulate ? exclude : {},
- names = [],
- expressions = Ext.isString(expression) ? [
- expression
- ] : expression,
- length = expressions.length,
- wildcardRe = me.wildcardRe,
- expr, i, list, match, n, name, regex;
- for (i = 0; i < length; ++i) {
- if ((expr = expressions[i]).indexOf('*') < 0) {
-
- if (!(name = aliasToName[expr])) {
- if (!(name = alternateToName[expr])) {
- name = expr;
- }
- }
- if (!(name in map) && !(exclude && (name in exclude))) {
- map[name] = 1;
- names.push(name);
- }
- } else {
- regex = new RegExp('^' + expr.replace(wildcardRe, '(.*?)') + '$');
- for (name in nameToAliases) {
- if (!(name in map) && !(exclude && (name in exclude))) {
- if (!(match = regex.test(name))) {
- n = (list = nameToAliases[name]).length;
- while (!match && n-- > 0) {
- match = regex.test(list[n]);
- }
- list = nameToAlternates[name];
- if (list && !match) {
- n = list.length;
- while (!match && n-- > 0) {
- match = regex.test(list[n]);
- }
- }
- }
- if (match) {
- map[name] = 1;
- names.push(name);
- }
- }
- }
- }
- }
- return names;
- },
- getPath: function(className) {
- var me = this,
- paths = me.paths,
- ret = '',
- prefix;
- if (className in paths) {
- ret = paths[className];
- } else {
- prefix = me.nameToPrefix[className] || (me.nameToPrefix[className] = me.getPrefix(className));
- if (prefix) {
- className = className.substring(prefix.length + 1);
- ret = paths[prefix];
- if (ret) {
- ret += '/';
- }
- }
- ret += className.replace(me.dotRe, '/') + '.js';
- }
- return ret;
- },
- getPrefix: function(className) {
- if (className in this.paths) {
- return className;
- } else if (className in this.nameToPrefix) {
- return this.nameToPrefix[className];
- }
- var prefixes = this.getPrefixes(),
- length = className.length,
- items, currChar, currSubstr, prefix, j, jlen;
-
-
-
- while (length-- > 0) {
- items = prefixes[length];
- if (items) {
- currChar = className.charAt(length);
- if (currChar !== '.') {
-
- continue;
- }
- currSubstr = className.substring(0, length);
- for (j = 0 , jlen = items.length; j < jlen; j++) {
- prefix = items[j];
- if (prefix === className.substring(0, length)) {
- return prefix;
- }
- }
- }
- }
- return '';
- },
- getPrefixes: function() {
- var me = this,
- prefixes = me.prefixes,
- names, name, nameLength, items, i, len;
- if (!prefixes) {
- names = me.names.slice(0);
- me.prefixes = prefixes = [];
- for (i = 0 , len = names.length; i < len; i++) {
- name = names[i];
- nameLength = name.length;
- items = prefixes[nameLength] || (prefixes[nameLength] = []);
- items.push(name);
- }
- }
- return prefixes;
- },
- removeName: function(name) {
- var me = this,
- aliasToName = me.aliasToName,
- alternateToName = me.alternateToName,
- nameToAliases = me.nameToAliases,
- nameToAlternates = me.nameToAlternates,
- aliases = nameToAliases[name],
- alternates = nameToAlternates[name],
- i, a;
- delete nameToAliases[name];
- delete nameToAlternates[name];
- delete me.nameToPrefix[name];
- if (aliases) {
- for (i = aliases.length; i--; ) {
-
-
-
- if (name === aliasToName[a = aliases[i]]) {
- delete aliasToName[a];
- }
- }
- }
- if (alternates) {
- for (i = alternates.length; i--; ) {
-
- if (name === alternateToName[a = alternates[i]]) {
- delete alternateToName[a];
- }
- }
- }
- },
- resolveName: function(name) {
- var me = this,
- trueName;
-
-
- if (!(name in me.nameToAliases)) {
-
- if (!(trueName = me.aliasToName[name])) {
-
-
- trueName = me.alternateToName[name];
- }
- }
- return trueName || name;
- },
-
- select: function(receiver, scope) {
- var me = this,
- excludes = {},
- ret = {
- excludes: excludes,
- exclude: function() {
- me.getNamesByExpression(arguments[0], excludes, true);
- return this;
- }
- },
- name;
- for (name in receiver) {
- ret[name] = me.selectMethod(excludes, receiver[name], scope || receiver);
- }
- return ret;
- },
- selectMethod: function(excludes, fn, scope) {
- var me = this;
- return function(include) {
- var args = Ext.Array.slice(arguments, 1);
- args.unshift(me.getNamesByExpression(include, excludes));
- return fn.apply(scope, args);
- };
- },
-
- setPath: Ext.Function.flexSetter(function(name, path) {
- var me = this;
- me.paths[name] = path;
- me.names.push(name);
- me.prefixes = null;
- me.nameToPrefix = {};
- return me;
- })
- };
- Ext.ClassManager = (function(Class, alias, arraySlice, arrayFrom, global) {
-
-
-
-
-
- var makeCtor = Ext.Class.makeCtor,
- nameLookupStack = [],
- namespaceCache = {
- Ext: {
- name: 'Ext',
- value: Ext
- }
- },
-
-
- Manager = Ext.apply(new Ext.Inventory(), {
-
- classes: {},
-
- classCount: 0,
-
- classState: {},
-
-
- existCache: {},
-
- instantiators: [],
-
- isCreated: function(className) {
-
- if (typeof className !== 'string' || className.length < 1) {
- throw new Error("[Ext.ClassManager] Invalid classname, must be a string and must not be empty");
- }
-
- if (Manager.classes[className] || Manager.existCache[className]) {
- return true;
- }
- if (!Manager.lookupName(className, false)) {
- return false;
- }
- Manager.triggerCreated(className);
- return true;
- },
-
- createdListeners: [],
-
- nameCreatedListeners: {},
-
- existsListeners: [],
-
- nameExistsListeners: {},
-
- overrideMap: {},
-
- triggerCreated: function(className, state) {
- Manager.existCache[className] = state || 1;
- Manager.classState[className] += 40;
- Manager.notify(className, Manager.createdListeners, Manager.nameCreatedListeners);
- },
-
- onCreated: function(fn, scope, className) {
- Manager.addListener(fn, scope, className, Manager.createdListeners, Manager.nameCreatedListeners);
- },
-
- notify: function(className, listeners, nameListeners) {
- var alternateNames = Manager.getAlternatesByName(className),
- names = [
- className
- ],
- i, ln, j, subLn, listener, name;
- for (i = 0 , ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- listener.fn.call(listener.scope, className);
- }
- while (names) {
- for (i = 0 , ln = names.length; i < ln; i++) {
- name = names[i];
- listeners = nameListeners[name];
- if (listeners) {
- for (j = 0 , subLn = listeners.length; j < subLn; j++) {
- listener = listeners[j];
- listener.fn.call(listener.scope, name);
- }
- delete nameListeners[name];
- }
- }
- names = alternateNames;
-
- alternateNames = null;
- }
- },
-
-
- addListener: function(fn, scope, className, listeners, nameListeners) {
- if (Ext.isArray(className)) {
- fn = Ext.Function.createBarrier(className.length, fn, scope);
- for (i = 0; i < className.length; i++) {
- this.addListener(fn, null, className[i], listeners, nameListeners);
- }
- return;
- }
- var i,
- listener = {
- fn: fn,
- scope: scope
- };
- if (className) {
- if (this.isCreated(className)) {
- fn.call(scope, className);
- return;
- }
- if (!nameListeners[className]) {
- nameListeners[className] = [];
- }
- nameListeners[className].push(listener);
- } else {
- listeners.push(listener);
- }
- },
-
- $namespaceCache: namespaceCache,
-
- addRootNamespaces: function(namespaces) {
- for (var name in namespaces) {
- namespaceCache[name] = {
- name: name,
- value: namespaces[name]
- };
- }
- },
-
- clearNamespaceCache: function() {
- nameLookupStack.length = 0;
- for (var name in namespaceCache) {
- if (!namespaceCache[name].value) {
- delete namespaceCache[name];
- }
- }
- },
-
- getNamespaceEntry: function(namespace) {
- if (typeof namespace !== 'string') {
- return namespace;
- }
-
- var entry = namespaceCache[namespace],
- i;
- if (!entry) {
- i = namespace.lastIndexOf('.');
- if (i < 0) {
- entry = {
- name: namespace
- };
- } else {
- entry = {
- name: namespace.substring(i + 1),
- parent: Manager.getNamespaceEntry(namespace.substring(0, i))
- };
- }
- namespaceCache[namespace] = entry;
- }
- return entry;
- },
-
- lookupName: function(namespace, autoCreate) {
- var entry = Manager.getNamespaceEntry(namespace),
- scope = Ext.global,
- i = 0,
- e, parent;
-
- for (e = entry; e; e = e.parent) {
-
-
-
- nameLookupStack[i++] = e;
- }
- while (scope && i-- > 0) {
-
- e = nameLookupStack[i];
- parent = scope;
- scope = e.value || scope[e.name];
- if (!scope && autoCreate) {
- parent[e.name] = scope = {};
- }
- }
- return scope;
- },
-
- setNamespace: function(namespace, value) {
- var entry = Manager.getNamespaceEntry(namespace),
- scope = Ext.global;
- if (entry.parent) {
- scope = Manager.lookupName(entry.parent, true);
- }
- scope[entry.name] = value;
- return value;
- },
-
- setXType: function(cls, xtype) {
- var className = cls.$className,
- C = className ? cls : Manager.get(className = cls),
- proto = C.prototype,
- xtypes = proto.xtypes,
- xtypesChain = proto.xtypesChain,
- xtypesMap = proto.xtypesMap;
- if (!proto.hasOwnProperty('xtypes')) {
- proto.xtypes = xtypes = [];
- proto.xtypesChain = xtypesChain = xtypesChain ? xtypesChain.slice(0) : [];
- proto.xtypesMap = xtypesMap = Ext.apply({}, xtypesMap);
- }
- Manager.addAlias(className, 'widget.' + xtype, true);
- xtypes.push(xtype);
- xtypesChain.push(xtype);
- xtypesMap[xtype] = true;
- },
-
-
- set: function(name, value) {
- var targetName = Manager.getName(value);
- Manager.classes[name] = Manager.setNamespace(name, value);
-
- Manager.classCount++;
-
- if (targetName && targetName !== name) {
- Manager.addAlternate(targetName, name);
- }
- return Manager;
- },
-
- get: function(name) {
- return Manager.classes[name] || Manager.lookupName(name, false);
- },
-
- addNameAliasMappings: function(aliases) {
- Manager.addAlias(aliases);
- },
-
- addNameAlternateMappings: function(alternates) {
- Manager.addAlternate(alternates);
- },
-
- getByAlias: function(alias) {
- return Manager.get(Manager.getNameByAlias(alias));
- },
-
- getByConfig: function(config, aliasPrefix) {
- var xclass = config.xclass,
- name;
- if (xclass) {
- name = xclass;
- } else {
- name = config.xtype;
- if (name) {
- aliasPrefix = 'widget.';
- } else {
- name = config.type;
- }
- name = Manager.getNameByAlias(aliasPrefix + name);
- }
- return Manager.get(name);
- },
-
- getName: function(object) {
- return object && object.$className || '';
- },
-
- getClass: function(object) {
- return object && object.self || null;
- },
-
- create: function(className, data, createdFn) {
-
- if (className != null && typeof className !== 'string') {
- throw new Error("[Ext.define] Invalid class name '" + className + "' specified, must be a non-empty string");
- }
-
- var ctor = makeCtor(className);
- if (typeof data === 'function') {
- data = data(ctor);
- }
-
- if (className) {
- if (Manager.classes[className]) {
- Ext.log.warn("[Ext.define] Duplicate class name '" + className + "' specified, must be a non-empty string");
- }
- ctor.name = className;
- }
-
- data.$className = className;
- return new Class(ctor, data, function() {
- var postprocessorStack = data.postprocessors || Manager.defaultPostprocessors,
- registeredPostprocessors = Manager.postprocessors,
- postprocessors = [],
- postprocessor, i, ln, j, subLn, postprocessorProperties, postprocessorProperty;
- delete data.postprocessors;
- for (i = 0 , ln = postprocessorStack.length; i < ln; i++) {
- postprocessor = postprocessorStack[i];
- if (typeof postprocessor === 'string') {
- postprocessor = registeredPostprocessors[postprocessor];
- postprocessorProperties = postprocessor.properties;
- if (postprocessorProperties === true) {
- postprocessors.push(postprocessor.fn);
- } else if (postprocessorProperties) {
- for (j = 0 , subLn = postprocessorProperties.length; j < subLn; j++) {
- postprocessorProperty = postprocessorProperties[j];
- if (data.hasOwnProperty(postprocessorProperty)) {
- postprocessors.push(postprocessor.fn);
- break;
- }
- }
- }
- } else {
- postprocessors.push(postprocessor);
- }
- }
- data.postprocessors = postprocessors;
- data.createdFn = createdFn;
- Manager.processCreate(className, this, data);
- });
- },
- processCreate: function(className, cls, clsData) {
- var me = this,
- postprocessor = clsData.postprocessors.shift(),
- createdFn = clsData.createdFn;
- if (!postprocessor) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(className, 'Ext.ClassManager#classCreated', arguments);
-
- if (className) {
- me.set(className, cls);
- }
- delete cls._classHooks;
- if (createdFn) {
- createdFn.call(cls, cls);
- }
- if (className) {
- me.triggerCreated(className);
- }
- return;
- }
- if (postprocessor.call(me, className, cls, clsData, me.processCreate) !== false) {
- me.processCreate(className, cls, clsData);
- }
- },
- createOverride: function(className, data, createdFn) {
- var me = this,
- overriddenClassName = data.override,
- requires = data.requires,
- uses = data.uses,
- mixins = data.mixins,
- mixinsIsArray,
- compat = 1,
-
- dependenciesLoaded,
- classReady = function() {
- var cls, dependencies, i, key, temp;
- if (!dependenciesLoaded) {
- dependencies = requires ? requires.slice(0) : [];
- if (mixins) {
- if (!(mixinsIsArray = mixins instanceof Array)) {
- for (key in mixins) {
- if (Ext.isString(cls = mixins[key])) {
- dependencies.push(cls);
- }
- }
- } else {
- for (i = 0 , temp = mixins.length; i < temp; ++i) {
- if (Ext.isString(cls = mixins[i])) {
- dependencies.push(cls);
- }
- }
- }
- }
- dependenciesLoaded = true;
- if (dependencies.length) {
-
-
-
- Ext.require(dependencies, classReady);
- return;
- }
- }
-
-
-
-
- if (mixinsIsArray) {
- for (i = 0 , temp = mixins.length; i < temp; ++i) {
- if (Ext.isString(cls = mixins[i])) {
- mixins[i] = Ext.ClassManager.get(cls);
- }
- }
- } else if (mixins) {
- for (key in mixins) {
- if (Ext.isString(cls = mixins[key])) {
- mixins[key] = Ext.ClassManager.get(cls);
- }
- }
- }
-
-
- cls = overriddenClassName.$isClass ? overriddenClassName : me.get(overriddenClassName);
-
- delete data.override;
- delete data.compatibility;
- delete data.requires;
- delete data.uses;
- Ext.override(cls, data);
-
-
-
- Ext.Loader.history.push(className);
- if (uses) {
-
-
- Ext['Loader'].addUsedClasses(uses);
- }
-
- if (createdFn) {
- createdFn.call(cls, cls);
- }
- };
-
- if (className) {
- Manager.overrideMap[className] = true;
- }
-
-
-
- if ('compatibility' in data) {
- compat = data.compatibility;
- if (!compat) {
-
- compat = false;
- } else if (typeof compat === 'number') {
-
- compat = true;
- } else if (typeof compat !== 'boolean') {
- compat = Ext.checkVersion(compat);
- }
- }
- if (compat) {
-
- if (overriddenClassName.$isClass) {
- classReady();
- } else {
- me.onCreated(classReady, me, overriddenClassName);
- }
- }
- me.triggerCreated(className, 2);
- return me;
- },
-
- instantiateByAlias: function() {
- var alias = arguments[0],
- args = arraySlice.call(arguments),
- className = this.getNameByAlias(alias);
-
- if (!className) {
- throw new Error("[Ext.createByAlias] Unrecognized alias: " + alias);
- }
-
- args[0] = className;
- return Ext.create.apply(Ext, args);
- },
-
- dynInstantiate: function(name, args) {
- args = arrayFrom(args, true);
- args.unshift(name);
- return Ext.create.apply(Ext, args);
- },
-
- getInstantiator: function(length) {
- var instantiators = this.instantiators,
- instantiator, i, args;
- instantiator = instantiators[length];
- if (!instantiator) {
- i = length;
- args = [];
- for (i = 0; i < length; i++) {
- args.push('a[' + i + ']');
- }
- instantiator = instantiators[length] = new Function('c', 'a', 'return new c(' + args.join(',') + ')');
-
- instantiator.name = "Ext.create" + length;
- }
-
- return instantiator;
- },
-
- postprocessors: {},
-
- defaultPostprocessors: [],
-
- registerPostprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [
- name
- ];
- }
- this.postprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPostprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- setDefaultPostprocessors: function(postprocessors) {
- this.defaultPostprocessors = arrayFrom(postprocessors);
- return this;
- },
-
- setDefaultPostprocessorPosition: function(name, offset, relativeName) {
- var defaultPostprocessors = this.defaultPostprocessors,
- index;
- if (typeof offset === 'string') {
- if (offset === 'first') {
- defaultPostprocessors.unshift(name);
- return this;
- } else if (offset === 'last') {
- defaultPostprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- }
- });
-
-
-
-
- Manager.registerPostprocessor('platformConfig', function(name, Class, data) {
- Class.addPlatformConfig(data);
- });
-
-
-
- Manager.registerPostprocessor('alias', function(name, cls, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(name, 'Ext.ClassManager#aliasPostProcessor', arguments);
-
- var aliases = Ext.Array.from(data.alias),
- i, ln;
- for (i = 0 , ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- this.addAlias(cls, alias);
- }
- }, [
- 'xtype',
- 'alias'
- ]);
-
-
-
- Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(name, 'Ext.ClassManager#singletonPostProcessor', arguments);
-
- if (data.singleton) {
- fn.call(this, name, new cls(), data);
- } else {
- return true;
- }
- return false;
- });
-
-
-
- Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(name, 'Ext.ClassManager#alternateClassNamePostprocessor', arguments);
-
- var alternates = data.alternateClassName,
- i, ln, alternate;
- if (!(alternates instanceof Array)) {
- alternates = [
- alternates
- ];
- }
- for (i = 0 , ln = alternates.length; i < ln; i++) {
- alternate = alternates[i];
-
- if (typeof alternate !== 'string') {
- throw new Error("[Ext.define] Invalid alternate of: '" + alternate + "' for class: '" + name + "'; must be a valid string");
- }
-
- this.set(alternate, cls);
- }
- });
-
-
- Manager.registerPostprocessor('debugHooks', function(name, Class, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#debugHooks', arguments);
- if (Ext.isDebugEnabled(Class.$className, data.debugHooks.$enabled)) {
- delete data.debugHooks.$enabled;
- Ext.override(Class, data.debugHooks);
- }
-
-
- var target = Class.isInstance ? Class.self : Class;
- delete target.prototype.debugHooks;
- });
-
- Manager.registerPostprocessor('deprecated', function(name, Class, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(Class, 'Ext.Class#deprecated', arguments);
-
-
- var target = Class.isInstance ? Class.self : Class;
- target.addDeprecations(data.deprecated);
- delete target.prototype.deprecated;
- });
- Ext.apply(Ext, {
-
- create: function() {
- var name = arguments[0],
- nameType = typeof name,
- args = arraySlice.call(arguments, 1),
- cls;
- if (nameType === 'function') {
- cls = name;
- } else {
- if (nameType !== 'string' && args.length === 0) {
- args = [
- name
- ];
- if (!(name = name.xclass)) {
- name = args[0].xtype;
- if (name) {
- name = 'widget.' + name;
- }
- }
- }
-
- if (typeof name !== 'string' || name.length < 1) {
- throw new Error("[Ext.create] Invalid class name or alias '" + name + "' specified, must be a non-empty string");
- }
-
- name = Manager.resolveName(name);
- cls = Manager.get(name);
- }
-
- if (!cls) {
-
- Ext.log.warn("[Ext.Loader] Synchronously loading '" + name + "'; consider adding " + "Ext.require('" + name + "') above Ext.onReady");
-
- Ext.syncRequire(name);
- cls = Manager.get(name);
- }
-
- if (!cls) {
- throw new Error("[Ext.create] Unrecognized class name / alias: " + name);
- }
- if (typeof cls !== 'function') {
- throw new Error("[Ext.create] Singleton '" + name + "' cannot be instantiated.");
- }
-
- return Manager.getInstantiator(args.length)(cls, args);
- },
-
- widget: function(name, config) {
-
-
-
-
-
-
-
- var xtype = name,
- alias, className, T;
- if (typeof xtype !== 'string') {
-
-
- config = name;
-
- xtype = config.xtype;
- className = config.xclass;
- } else {
- config = config || {};
- }
- if (config.isComponent) {
- return config;
- }
- if (!className) {
- alias = 'widget.' + xtype;
- className = Manager.getNameByAlias(alias);
- }
-
- if (className) {
- T = Manager.get(className);
- }
- if (!T) {
- return Ext.create(className || alias, config);
- }
- return new T(config);
- },
-
- createByAlias: alias(Manager, 'instantiateByAlias'),
-
- define: function(className, data, createdFn) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(className, 'ClassManager#define', arguments);
-
- if (data.override) {
- Manager.classState[className] = 20;
- return Manager.createOverride.apply(Manager, arguments);
- }
- Manager.classState[className] = 10;
- return Manager.create.apply(Manager, arguments);
- },
-
- undefine: function(className) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(className, 'Ext.ClassManager#undefine', arguments);
-
- var classes = Manager.classes;
-
- if (classes[className]) {
- Manager.classCount--;
- }
-
- delete classes[className];
- delete Manager.existCache[className];
- delete Manager.classState[className];
- Manager.removeName(className);
-
-
- Ext.Factory.clearCaches();
- var entry = Manager.getNamespaceEntry(className),
- scope = entry.parent ? Manager.lookupName(entry.parent, false) : Ext.global,
- entryName;
- if (scope) {
- entryName = entry.name;
-
- try {
- delete scope[entryName];
- } catch (e) {
- scope[entryName] = undefined;
- }
- }
-
-
- return entryName;
- },
-
-
- getClassName: alias(Manager, 'getName'),
-
- getDisplayName: function(object) {
- if (object) {
- if (object.displayName) {
- return object.displayName;
- }
- if (object.$name && object.$class) {
- return Ext.getClassName(object.$class) + '#' + object.$name;
- }
- if (object.$className) {
- return object.$className;
- }
- }
- return 'Anonymous';
- },
-
- getClass: alias(Manager, 'getClass'),
-
- namespace: function() {
- var root = global,
- i;
- for (i = arguments.length; i-- > 0; ) {
- root = Manager.lookupName(arguments[i], true);
- }
- return root;
- }
- });
-
- Ext.addRootNamespaces = Manager.addRootNamespaces;
-
- Ext.createWidget = Ext.widget;
-
- Ext.ns = Ext.namespace;
- Class.registerPreprocessor('className', function(cls, data) {
- if ('$className' in data) {
- cls.$className = data.$className;
-
- cls.displayName = cls.$className;
- }
-
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(cls, 'Ext.ClassManager#classNamePreprocessor', arguments);
- },
- true, 'first');
- Class.registerPreprocessor('alias', function(cls, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(cls, 'Ext.ClassManager#aliasPreprocessor', arguments);
-
- var prototype = cls.prototype,
- xtypes = arrayFrom(data.xtype),
- aliases = arrayFrom(data.alias),
- widgetPrefix = 'widget.',
- widgetPrefixLength = widgetPrefix.length,
- xtypesChain = Array.prototype.slice.call(prototype.xtypesChain || []),
- xtypesMap = Ext.merge({}, prototype.xtypesMap || {}),
- i, ln, alias, xtype;
- for (i = 0 , ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
-
- if (typeof alias !== 'string' || alias.length < 1) {
- throw new Error("[Ext.define] Invalid alias of: '" + alias + "' for class: '" + name + "'; must be a valid string");
- }
-
- if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
- xtype = alias.substring(widgetPrefixLength);
- Ext.Array.include(xtypes, xtype);
- }
- }
- cls.xtype = data.xtype = xtypes[0];
- data.xtypes = xtypes;
- for (i = 0 , ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- data.xtypesChain = xtypesChain;
- data.xtypesMap = xtypesMap;
-
- Ext.Function.interceptAfterOnce(cls, 'onClassCreated', function() {
- var cls = this,
- prototype = cls.prototype,
- mixins = prototype.mixins,
- key, mixin;
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(cls, 'Ext.ClassManager#aliasPreprocessor#afterClassCreated', arguments);
-
- for (key in mixins) {
- if (mixins.hasOwnProperty(key)) {
- mixin = mixins[key];
- xtypes = mixin.xtypes;
- if (xtypes) {
- for (i = 0 , ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- }
- }
- }
- });
- for (i = 0 , ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
-
- if (typeof xtype !== 'string' || xtype.length < 1) {
- throw new Error("[Ext.define] Invalid xtype of: '" + xtype + "' for class: '" + name + "'; must be a valid non-empty string");
- }
-
- Ext.Array.include(aliases, widgetPrefix + xtype);
- }
- data.alias = aliases;
- }, [
- 'xtype',
- 'alias'
- ]);
-
- if (Ext.manifest) {
- var manifest = Ext.manifest,
- classes = manifest.classes,
- paths = manifest.paths,
- aliases = {},
- alternates = {},
- className, obj, name, path, baseUrl;
- if (paths) {
-
-
-
- if (manifest.bootRelative) {
- baseUrl = Ext.Boot.baseUrl;
- for (path in paths) {
- if (paths.hasOwnProperty(path)) {
- paths[path] = baseUrl + paths[path];
- }
- }
- }
- Manager.setPath(paths);
- }
- if (classes) {
- for (className in classes) {
- alternates[className] = [];
- aliases[className] = [];
- obj = classes[className];
- if (obj.alias) {
- aliases[className] = obj.alias;
- }
- if (obj.alternates) {
- alternates[className] = obj.alternates;
- }
- }
- }
- Manager.addAlias(aliases);
- Manager.addAlternate(alternates);
- }
- return Manager;
- }(Ext.Class, Ext.Function.alias, Array.prototype.slice, Ext.Array.from, Ext.global));
- (Ext.env || (Ext.env = {})).Browser = function(userAgent, publish) {
-
-
-
-
- var me = this,
- browserPrefixes = Ext.Boot.browserPrefixes,
- browserNames = Ext.Boot.browserNames,
- enginePrefixes = me.enginePrefixes,
- engineNames = me.engineNames,
- browserMatch = userAgent.match(new RegExp('((?:' + Ext.Object.getValues(browserPrefixes).join(')|(?:') + '))([\\w\\._]+)')),
- engineMatch = userAgent.match(new RegExp('((?:' + Ext.Object.getValues(enginePrefixes).join(')|(?:') + '))([\\w\\._]+)')),
- browserName = browserNames.other,
- engineName = engineNames.other,
- browserVersion = '',
- engineVersion = '',
- majorVer = '',
- isWebView = false,
- edgeRE = /(Edge\/)([\w.]+)/,
- ripple = '',
- i, prefix, name;
-
- me.userAgent = userAgent;
-
- this.is = function(name) {
-
-
- return !!this.is[name];
- };
-
-
- if (/Edge\//.test(userAgent)) {
- browserMatch = userAgent.match(edgeRE);
- engineMatch = userAgent.match(edgeRE);
- }
- if (browserMatch) {
- browserName = browserNames[Ext.Object.getKey(browserPrefixes, browserMatch[1])];
-
- if (browserName === 'Safari' && /^Opera/.test(userAgent)) {
-
- browserName = 'Opera';
- }
-
- browserVersion = new Ext.Version(browserMatch[2]);
- }
- if (engineMatch) {
- engineName = engineNames[Ext.Object.getKey(enginePrefixes, engineMatch[1])];
- engineVersion = new Ext.Version(engineMatch[2]);
- }
- if (engineName === 'Trident' && browserName !== 'IE') {
- browserName = 'IE';
- var version = userAgent.match(/.*rv:(\d+.\d+)/);
- if (version && version.length) {
- version = version[1];
- browserVersion = new Ext.Version(version);
- }
- }
- if (browserName && browserVersion) {
- Ext.setVersion(browserName, browserVersion);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (userAgent.match(/FB/) && browserName === 'Other') {
- browserName = browserNames.safari;
- engineName = engineNames.webkit;
- }
-
- else if (userAgent.match(/Android.*Chrome/g)) {
- browserName = 'ChromeMobile';
- } else {
- browserMatch = userAgent.match(/OPR\/(\d+.\d+)/);
- if (browserMatch) {
- browserName = 'Opera';
- browserVersion = new Ext.Version(browserMatch[1]);
- }
- }
- Ext.apply(this, {
- engineName: engineName,
- engineVersion: engineVersion,
- name: browserName,
- version: browserVersion
- });
- this.setFlag(browserName, true, publish);
-
- if (browserVersion) {
- majorVer = browserVersion.getMajor() || '';
-
- if (me.is.IE) {
- majorVer = document.documentMode || parseInt(majorVer, 10);
- for (i = 7; i <= 11; ++i) {
- prefix = 'isIE' + i;
- Ext[prefix] = majorVer === i;
- Ext[prefix + 'm'] = majorVer <= i;
- Ext[prefix + 'p'] = majorVer >= i;
- }
- }
- if (me.is.Opera && parseInt(majorVer, 10) <= 12) {
- Ext.isOpera12m = true;
- }
-
- Ext.chromeVersion = Ext.isChrome ? majorVer : 0;
- Ext.firefoxVersion = Ext.isFirefox ? majorVer : 0;
- Ext.ieVersion = Ext.isIE ? majorVer : 0;
- Ext.operaVersion = Ext.isOpera ? majorVer : 0;
- Ext.safariVersion = Ext.isSafari ? majorVer : 0;
- Ext.webKitVersion = Ext.isWebKit ? majorVer : 0;
- this.setFlag(browserName + majorVer, true, publish);
-
- this.setFlag(browserName + browserVersion.getShortVersion());
- }
- for (i in browserNames) {
- if (browserNames.hasOwnProperty(i)) {
- name = browserNames[i];
- this.setFlag(name, browserName === name);
- }
- }
- this.setFlag(name);
- if (engineVersion) {
- this.setFlag(engineName + (engineVersion.getMajor() || ''));
- this.setFlag(engineName + engineVersion.getShortVersion());
- }
- for (i in engineNames) {
- if (engineNames.hasOwnProperty(i)) {
- name = engineNames[i];
- this.setFlag(name, engineName === name, publish);
- }
- }
- this.setFlag('Standalone', !!navigator.standalone);
-
- try {
- ripple = window.top.ripple;
- } catch (e) {}
-
- this.setFlag('Ripple', !!document.getElementById("tinyhippos-injected") && !Ext.isEmpty(ripple));
- this.setFlag('WebWorks', !!window.blackberry);
- if (window.PhoneGap !== undefined || window.Cordova !== undefined || window.cordova !== undefined) {
- isWebView = true;
- this.setFlag('PhoneGap');
- this.setFlag('Cordova');
- }
-
- if (/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)(?!.*FBAN)/i.test(userAgent)) {
- isWebView = true;
- }
-
- this.setFlag('WebView', isWebView);
-
- this.isStrict = Ext.isStrict = document.compatMode === "CSS1Compat";
-
- this.isSecure = Ext.isSecure;
-
- this.identity = browserName + majorVer + (this.isStrict ? 'Strict' : 'Quirks');
- };
- Ext.env.Browser.prototype = {
- constructor: Ext.env.Browser,
- engineNames: {
- edge: 'Edge',
- webkit: 'WebKit',
- gecko: 'Gecko',
- presto: 'Presto',
- trident: 'Trident',
- other: 'Other'
- },
- enginePrefixes: {
- edge: 'Edge/',
- webkit: 'AppleWebKit/',
- gecko: 'Gecko/',
- presto: 'Presto/',
- trident: 'Trident/'
- },
- styleDashPrefixes: {
- WebKit: '-webkit-',
- Gecko: '-moz-',
- Trident: '-ms-',
- Presto: '-o-',
- Other: ''
- },
- stylePrefixes: {
- WebKit: 'Webkit',
- Gecko: 'Moz',
- Trident: 'ms',
- Presto: 'O',
- Other: ''
- },
- propertyPrefixes: {
- WebKit: 'webkit',
- Gecko: 'moz',
- Trident: 'ms',
- Presto: 'o',
- Other: ''
- },
-
-
- name: null,
-
- version: null,
-
- engineName: null,
-
- engineVersion: null,
- setFlag: function(name, value, publish) {
- if (value === undefined) {
- value = true;
- }
- this.is[name] = value;
- this.is[name.toLowerCase()] = value;
- if (publish) {
- Ext['is' + name] = value;
- }
- return this;
- },
- getStyleDashPrefix: function() {
- return this.styleDashPrefixes[this.engineName];
- },
- getStylePrefix: function() {
- return this.stylePrefixes[this.engineName];
- },
- getVendorProperyName: function(name) {
- var prefix = this.propertyPrefixes[this.engineName];
- if (prefix.length > 0) {
- return prefix + Ext.String.capitalize(name);
- }
- return name;
- }
- };
- (function(userAgent) {
- Ext.browser = new Ext.env.Browser(userAgent, true);
- Ext.userAgent = userAgent.toLowerCase();
-
- Ext.SSL_SECURE_URL = Ext.isSecure && Ext.isIE ? 'javascript:\'\'' : 'about:blank';
- }(
- Ext.global.navigator.userAgent));
- Ext.env.OS = function(userAgent, platform, browserScope) {
-
-
-
-
- var me = this,
- names = Ext.Boot.osNames,
- prefixes = Ext.Boot.osPrefixes,
- name,
- version = '',
- is = me.is,
- i, prefix, match, item, match1;
- browserScope = browserScope || Ext.browser;
- for (i in prefixes) {
- if (prefixes.hasOwnProperty(i)) {
- prefix = prefixes[i];
- match = userAgent.match(new RegExp('(?:' + prefix + ')([^\\s;]+)'));
- if (match) {
- name = names[i];
- match1 = match[1];
-
-
- if (match1 && match1 === "HTC_") {
- version = new Ext.Version("2.3");
- } else if (match1 && match1 === "Silk/") {
- version = new Ext.Version("2.3");
- } else {
- version = new Ext.Version(match[match.length - 1]);
- }
- break;
- }
- }
- }
- if (!name) {
- name = names[(userAgent.toLowerCase().match(/mac|win|linux/) || [
- 'other'
- ])[0]];
- version = new Ext.Version('');
- }
- this.name = name;
- this.version = version;
-
-
-
- if (userAgent.match(/ipad/i)) {
- platform = 'iPad';
- }
- if (platform) {
- this.setFlag(platform.replace(/ simulator$/i, ''));
- }
- this.setFlag(name);
- if (version) {
- this.setFlag(name + (version.getMajor() || ''));
- this.setFlag(name + version.getShortVersion());
- }
- for (i in names) {
- if (names.hasOwnProperty(i)) {
- item = names[i];
- if (!is.hasOwnProperty(name)) {
- this.setFlag(item, (name === item));
- }
- }
- }
-
- if (this.name === "iOS" && window.screen.height === 568) {
- this.setFlag('iPhone5');
- }
- if (browserScope.is.Safari || browserScope.is.Silk) {
-
- if (this.is.Android2 || this.is.Android3 || browserScope.version.shortVersion === 501) {
- browserScope.setFlag("AndroidStock");
- }
- if (this.is.Android4) {
- browserScope.setFlag("AndroidStock");
- browserScope.setFlag("AndroidStock4");
- }
- }
- };
- Ext.env.OS.prototype = {
- constructor: Ext.env.OS,
-
- is: function(name) {
- return !!this[name];
- },
-
- name: null,
-
- version: null,
- setFlag: function(name, value) {
- if (value === undefined) {
- value = true;
- }
- if (this.flags) {
- this.flags[name] = value;
- }
- this.is[name] = value;
- this.is[name.toLowerCase()] = value;
- return this;
- }
- };
- (function() {
- var navigation = Ext.global.navigator,
- userAgent = navigation.userAgent,
- OS = Ext.env.OS,
- is = (Ext.is || (Ext.is = {})),
- osEnv, osName, deviceType;
- OS.prototype.flags = is;
-
- Ext.os = osEnv = new OS(userAgent, navigation.platform);
- osName = osEnv.name;
-
- Ext['is' + osName] = true;
-
- Ext.isMac = is.Mac = is.MacOS;
- Ext.isApple = Ext.isMac || Ext.isiOS;
- var search = window.location.search.match(/deviceType=(Tablet|Phone)/),
- nativeDeviceType = window.deviceType;
-
-
- if (search && search[1]) {
- deviceType = search[1];
- } else if (nativeDeviceType === 'iPhone') {
- deviceType = 'Phone';
- } else if (nativeDeviceType === 'iPad') {
- deviceType = 'Tablet';
- } else {
- if (!osEnv.is.Android && !osEnv.is.iOS && !osEnv.is.WindowsPhone && /Windows|Linux|MacOS|ChromeOS/.test(osName)) {
- deviceType = 'Desktop';
-
- Ext.browser.is.WebView = !!Ext.browser.is.Ripple;
- } else if (osEnv.is.iPad || osEnv.is.RIMTablet || osEnv.is.Android3 || Ext.browser.is.Silk || (osEnv.is.Android && userAgent.search(/mobile/i) === -1)) {
- deviceType = 'Tablet';
- } else {
- deviceType = 'Phone';
- }
- }
-
- osEnv.setFlag(deviceType, true);
- osEnv.deviceType = deviceType;
- delete OS.prototype.flags;
- }());
- Ext.feature = {
-
-
-
-
-
-
-
- has: function(name) {
- return !!this.has[name];
- },
- testElements: {},
- getTestElement: function(tag, createNew) {
- if (tag === undefined) {
- tag = 'div';
- } else if (typeof tag !== 'string') {
- return tag;
- }
- if (createNew) {
- return document.createElement(tag);
- }
- if (!this.testElements[tag]) {
- this.testElements[tag] = document.createElement(tag);
- }
- return this.testElements[tag];
- },
- isStyleSupported: function(name, tag) {
- var elementStyle = this.getTestElement(tag).style,
- cName = Ext.String.capitalize(name);
- if (typeof elementStyle[name] !== 'undefined' || typeof elementStyle[Ext.browser.getStylePrefix(name) + cName] !== 'undefined') {
- return true;
- }
- return false;
- },
- isStyleSupportedWithoutPrefix: function(name, tag) {
- var elementStyle = this.getTestElement(tag).style;
- if (typeof elementStyle[name] !== 'undefined') {
- return true;
- }
- return false;
- },
- isEventSupported: function(name, tag) {
- if (tag === undefined) {
- tag = window;
- }
- var element = this.getTestElement(tag),
- eventName = 'on' + name.toLowerCase(),
- isSupported = (eventName in element);
- if (!isSupported) {
- if (element.setAttribute && element.removeAttribute) {
- element.setAttribute(eventName, '');
- isSupported = typeof element[eventName] === 'function';
- if (typeof element[eventName] !== 'undefined') {
- element[eventName] = undefined;
- }
- element.removeAttribute(eventName);
- }
- }
- return isSupported;
- },
-
-
-
- getStyle: function(element, styleName) {
- var view = element.ownerDocument.defaultView,
- style = (view ? view.getComputedStyle(element, null) : element.currentStyle);
- return (style || element.style)[styleName];
- },
- getSupportedPropertyName: function(object, name) {
- var vendorName = Ext.browser.getVendorProperyName(name);
- if (vendorName in object) {
- return vendorName;
- } else if (name in object) {
- return name;
- }
- return null;
- },
-
- detect: function(isReady) {
- var me = this,
- doc = document,
- toRun = me.toRun || me.tests,
- n = toRun.length,
- div = doc.createElement('div'),
- notRun = [],
- supports = Ext.supports,
- has = me.has,
- name, names, test, vector, value;
-
-
-
- div.innerHTML = '<div style="height:30px;width:50px;">' + '<div style="height:20px;width:20px;"></div>' + '</div>' + '<div style="width: 200px; height: 200px; position: relative; padding: 5px;">' + '<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>' + '</div>' + '<div style="position: absolute; left: 10%; top: 10%;"></div>' + '<div style="float:left; background-color:transparent;"></div>';
- if (isReady) {
- doc.body.appendChild(div);
- }
-
- vector = me.preDetected[Ext.browser.identity] || [];
- while (n--) {
- test = toRun[n];
- value = vector[n];
- name = test.name;
- names = test.names;
- if (value === undefined) {
- if (!isReady && test.ready) {
-
- notRun.push(test);
-
- continue;
- }
- value = test.fn.call(me, doc, div);
- }
-
- if (name) {
- supports[name] = has[name] = value;
- } else if (names) {
- while (names.length) {
- name = names.pop();
- supports[name] = has[name] = value;
- }
- }
- }
- if (isReady) {
- doc.body.removeChild(div);
- }
- me.toRun = notRun;
- },
-
- report: function() {
- var values = [],
- len = this.tests.length,
- i;
- for (i = 0; i < len; ++i) {
- values.push(this.has[this.tests[i].name] ? 1 : 0);
- }
- Ext.log(Ext.browser.identity + ': [' + values.join(',') + ']');
- },
-
- preDetected: {},
-
-
- tests: [
- {
-
- name: 'CloneNodeCopiesExpando',
- fn: function() {
- var el = document.createElement('div');
- el.expandoProp = {};
- return el.cloneNode().expandoProp === el.expandoProp;
- }
- },
- {
-
- name: 'CSSPointerEvents',
- fn: function(doc) {
- return 'pointerEvents' in doc.documentElement.style;
- }
- },
- {
-
- name: 'CSS3BoxShadow',
- fn: function(doc) {
- return 'boxShadow' in doc.documentElement.style || 'WebkitBoxShadow' in doc.documentElement.style || 'MozBoxShadow' in doc.documentElement.style;
- }
- },
- {
- name: 'CSS3NegationSelector',
- fn: function(doc) {
- try {
- doc.querySelectorAll("foo:not(bar)");
- } catch (e) {
- return false;
- }
- return true;
- }
- },
- {
-
- name: 'ClassList',
- fn: function(doc) {
- return !!doc.documentElement.classList;
- }
- },
- {
-
- name: 'Canvas',
- fn: function() {
- var element = this.getTestElement('canvas');
- return !!(element && element.getContext && element.getContext('2d'));
- }
- },
- {
-
- name: 'Svg',
- fn: function(doc) {
- return !!(doc.createElementNS && !!doc.createElementNS("http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect);
- }
- },
- {
-
- name: 'Vml',
- fn: function() {
- var element = this.getTestElement(),
- ret = false;
- element.innerHTML = "<!--[if vml]><br><![endif]-->";
- ret = (element.childNodes.length === 1);
- element.innerHTML = "";
- return ret;
- }
- },
- {
-
- name: 'Touch',
- fn: function() {
-
- var maxTouchPoints = navigator.msMaxTouchPoints || navigator.maxTouchPoints;
-
-
-
-
-
-
-
-
-
- if (Ext.browser.is.Chrome && Ext.browser.version.isLessThanOrEqual(39)) {
- return (Ext.supports.TouchEvents && maxTouchPoints !== 1) || maxTouchPoints > 1;
- } else {
- return Ext.supports.TouchEvents || maxTouchPoints > 0;
- }
- }
- },
- {
-
- name: 'PointerEvents',
- fn: function() {
- return !!(window.PointerEvent && !Ext.supports.TouchEvents);
- }
- },
- {
-
- name: 'MSPointerEvents',
- fn: function() {
- return Ext.isIE10;
- }
- },
- {
-
- name: 'TouchEvents',
- fn: function() {
- return this.isEventSupported('touchend');
- }
- },
- {
-
- name: 'TouchAction',
- ready: true,
- fn: function(doc, div) {
- if (!window.getComputedStyle) {
- return 0;
- }
- var values = [
- 'pan-x',
- 'pan-y',
- 'pinch-zoom',
- 'double-tap-zoom'
- ],
- flags = [
- 1,
- 2,
- 4,
- 8
- ],
- ln = values.length,
- flag = 0,
- i, value;
- for (i = 0; i < ln; i++) {
- value = values[i];
- div.style.touchAction = value;
- if (getComputedStyle(div).touchAction === value) {
- flag |= flags[i];
- }
- }
- return flag;
- }
- },
- {
-
- name: 'Orientation',
- fn: function() {
- return ('orientation' in window) && this.isEventSupported('orientationchange');
- }
- },
- {
-
- name: 'OrientationChange',
- fn: function() {
- return this.isEventSupported('orientationchange');
- }
- },
- {
-
- name: 'DeviceMotion',
- fn: function() {
- return this.isEventSupported('devicemotion');
- }
- },
- {
-
-
- names: [
- 'Geolocation',
- 'GeoLocation'
- ],
- fn: function() {
- return 'geolocation' in window.navigator;
- }
- },
- {
- name: 'SqlDatabase',
- fn: function() {
- return 'openDatabase' in window;
- }
- },
- {
- name: 'WebSockets',
- fn: function() {
- return 'WebSocket' in window;
- }
- },
- {
-
- name: 'Range',
- fn: function() {
- return !!document.createRange;
- }
- },
- {
-
- name: 'CreateContextualFragment',
- fn: function() {
- var range = !!document.createRange ? document.createRange() : false;
- return range && !!range.createContextualFragment;
- }
- },
- {
-
- name: 'History',
- fn: function() {
- return ('history' in window && 'pushState' in window.history);
- }
- },
- {
-
- name: 'Css3dTransforms',
- fn: function() {
-
- return this.has('CssTransforms') && this.isStyleSupported('perspective');
- }
- },
-
-
- {
-
- name: 'CssTransforms',
- fn: function() {
- return this.isStyleSupported('transform');
- }
- },
- {
- name: 'CssTransformNoPrefix',
- fn: function() {
- return this.isStyleSupportedWithoutPrefix('transform');
- }
- },
- {
- name: 'CssAnimations',
- fn: function() {
- return this.isStyleSupported('animationName');
- }
- },
- {
-
- names: [
- 'CssTransitions',
- 'Transitions'
- ],
- fn: function() {
- return this.isStyleSupported('transitionProperty');
- }
- },
- {
-
-
- names: [
- 'Audio',
- 'AudioTag'
- ],
- fn: function() {
- return !!this.getTestElement('audio').canPlayType;
- }
- },
- {
-
- name: 'Video',
- fn: function() {
- return !!this.getTestElement('video').canPlayType;
- }
- },
- {
-
- name: 'LocalStorage',
- fn: function() {
- try {
-
-
- if ('localStorage' in window && window['localStorage'] !== null) {
-
-
- localStorage.setItem('sencha-localstorage-test', 'test success');
-
- localStorage.removeItem('sencha-localstorage-test');
- return true;
- }
- } catch (e) {}
-
- return false;
- }
- },
- {
-
- name: 'XmlQuerySelector',
- fn: function() {
- var xmlString = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><root></root>',
- xmlDoc;
-
- if (window.ActiveXObject) {
- xmlDoc = new ActiveXObject("Microsoft.xmlDOM");
- xmlDoc.async = false;
- xmlDoc.loadXML(xmlString);
- } else if (window.DOMParser) {
- var parser = new DOMParser();
- xmlDoc = parser.parseFromString(xmlString, 'text/xml');
- }
- return xmlDoc ? !!xmlDoc.lastChild.querySelector : false;
- }
- },
- {
-
- name: 'XHR2',
- fn: function() {
- return window.ProgressEvent && window.FormData && window.XMLHttpRequest && ('withCredentials' in new XMLHttpRequest());
- }
- },
- {
-
- name: 'XHRUploadProgress',
- fn: function() {
- if (window.XMLHttpRequest && !Ext.browser.is.AndroidStock) {
- var xhr = new XMLHttpRequest();
- return xhr && ('upload' in xhr) && ('onprogress' in xhr.upload);
- }
- return false;
- }
- },
- {
-
- name: 'NumericInputPlaceHolder',
- fn: function() {
- return !(Ext.browser.is.AndroidStock4 && Ext.os.version.getMinor() < 2);
- }
- },
-
- {
- name: 'matchesSelector',
- fn: function() {
- var el = document.documentElement,
- w3 = 'matches',
- wk = 'webkitMatchesSelector',
- ms = 'msMatchesSelector',
- mz = 'mozMatchesSelector';
- return el[w3] ? w3 : el[wk] ? wk : el[ms] ? ms : el[mz] ? mz : null;
- }
- },
-
-
- {
- name: 'RightMargin',
- ready: true,
- fn: function(doc, div) {
- var view = doc.defaultView;
- return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight !== '0px');
- }
- },
-
- {
- name: 'DisplayChangeInputSelectionBug',
- fn: function() {
- var webKitVersion = Ext.webKitVersion;
-
- return 0 < webKitVersion && webKitVersion < 533;
- }
- },
-
- {
- name: 'DisplayChangeTextAreaSelectionBug',
- fn: function() {
- var webKitVersion = Ext.webKitVersion;
-
- return 0 < webKitVersion && webKitVersion < 534.24;
- }
- },
-
- {
- name: 'TransparentColor',
- ready: true,
- fn: function(doc, div, view) {
- view = doc.defaultView;
- return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor !== 'transparent');
- }
- },
-
- {
- name: 'ComputedStyle',
- ready: true,
- fn: function(doc, div, view) {
- view = doc.defaultView;
- return !!(view && view.getComputedStyle);
- }
- },
-
- {
- name: 'Float',
- fn: function(doc) {
- return 'cssFloat' in doc.documentElement.style;
- }
- },
-
- {
- name: 'CSS3BorderRadius',
- ready: true,
- fn: function(doc) {
- var domPrefixes = [
- 'borderRadius',
- 'BorderRadius',
- 'MozBorderRadius',
- 'WebkitBorderRadius',
- 'OBorderRadius',
- 'KhtmlBorderRadius'
- ],
- pass = false,
- i;
- for (i = 0; i < domPrefixes.length; i++) {
- if (doc.documentElement.style[domPrefixes[i]] !== undefined) {
- pass = true;
- }
- }
- return pass && !Ext.isIE9;
- }
- },
-
- {
- name: 'CSS3LinearGradient',
- fn: function(doc, div) {
- var property = 'background-image:',
- webkit = '-webkit-gradient(linear, left top, right bottom, from(black), to(white))',
- w3c = 'linear-gradient(left top, black, white)',
- moz = '-moz-' + w3c,
- ms = '-ms-' + w3c,
- opera = '-o-' + w3c,
- options = [
- property + webkit,
- property + w3c,
- property + moz,
- property + ms,
- property + opera
- ];
- div.style.cssText = options.join(';');
- return (("" + div.style.backgroundImage).indexOf('gradient') !== -1) && !Ext.isIE9;
- }
- },
-
- {
- name: 'MouseEnterLeave',
- fn: function(doc) {
- return ('onmouseenter' in doc.documentElement && 'onmouseleave' in doc.documentElement);
- }
- },
-
- {
- name: 'MouseWheel',
- fn: function(doc) {
- return ('onmousewheel' in doc.documentElement);
- }
- },
-
- {
- name: 'Opacity',
- fn: function(doc, div) {
-
- if (Ext.isIE8) {
- return false;
- }
- div.firstChild.style.cssText = 'opacity:0.73';
- return div.firstChild.style.opacity == '0.73';
- }
- },
-
-
- {
- name: 'Placeholder',
- fn: function(doc) {
- return 'placeholder' in doc.createElement('input');
- }
- },
-
- {
- name: 'Direct2DBug',
- fn: function(doc) {
- return Ext.isString(doc.documentElement.style.msTransformOrigin) && Ext.isIE9m;
- }
- },
-
- {
- name: 'BoundingClientRect',
- fn: function(doc) {
- return 'getBoundingClientRect' in doc.documentElement;
- }
- },
-
- {
- name: 'RotatedBoundingClientRect',
- ready: true,
- fn: function(doc) {
- var body = doc.body,
- supports = false,
- el = doc.createElement('div'),
- style = el.style;
- if (el.getBoundingClientRect) {
-
-
-
- style.position = 'absolute';
- style.top = "0";
- style.WebkitTransform = style.MozTransform = style.msTransform = style.OTransform = style.transform = 'rotate(90deg)';
- style.width = '100px';
- style.height = '30px';
- body.appendChild(el);
- supports = el.getBoundingClientRect().height !== 100;
- body.removeChild(el);
- }
- return supports;
- }
- },
-
- {
- name: 'ChildContentClearedWhenSettingInnerHTML',
- ready: true,
- fn: function() {
- var el = this.getTestElement(),
- child;
- el.innerHTML = '<div>a</div>';
- child = el.firstChild;
- el.innerHTML = '<div>b</div>';
- return child.innerHTML !== 'a';
- }
- },
- {
- name: 'IncludePaddingInWidthCalculation',
- ready: true,
- fn: function(doc, div) {
- return div.childNodes[1].firstChild.offsetWidth === 210;
- }
- },
- {
- name: 'IncludePaddingInHeightCalculation',
- ready: true,
- fn: function(doc, div) {
- return div.childNodes[1].firstChild.offsetHeight === 210;
- }
- },
-
- {
- name: 'TextAreaMaxLength',
- fn: function(doc) {
- return ('maxlength' in doc.createElement('textarea'));
- }
- },
-
-
- {
- name: 'GetPositionPercentage',
- ready: true,
- fn: function(doc, div) {
- return Ext.feature.getStyle(div.childNodes[2], 'left') === '10%';
- }
- },
-
- {
- name: 'PercentageHeightOverflowBug',
- ready: true,
- fn: function(doc) {
- var hasBug = false,
- style, el;
- if (Ext.getScrollbarSize().height) {
-
- el = this.getTestElement('div', true);
- style = el.style;
- style.height = '50px';
- style.width = '50px';
- style.overflow = 'auto';
- style.position = 'absolute';
- el.innerHTML = [
- '<div style="display:table;height:100%;">',
-
-
-
- '<div style="width:51px;"></div>',
- '</div>'
- ].join('');
- doc.body.appendChild(el);
- if (el.firstChild.offsetHeight === 50) {
- hasBug = true;
- }
- doc.body.removeChild(el);
- }
- return hasBug;
- }
- },
-
- {
- name: 'xOriginBug',
- ready: true,
- fn: function(doc, div) {
- div.innerHTML = '<div id="b1" style="height:100px;width:100px;direction:rtl;position:relative;overflow:scroll">' + '<div id="b2" style="position:relative;width:100%;height:20px;"></div>' + '<div id="b3" style="position:absolute;width:20px;height:20px;top:0px;right:0px"></div>' + '</div>';
- var outerBox = document.getElementById('b1').getBoundingClientRect(),
- b2 = document.getElementById('b2').getBoundingClientRect(),
- b3 = document.getElementById('b3').getBoundingClientRect();
- return (b2.left !== outerBox.left && b3.right !== outerBox.right);
- }
- },
-
- {
- name: 'ScrollWidthInlinePaddingBug',
- ready: true,
- fn: function(doc) {
- var hasBug = false,
- style, el;
- el = doc.createElement('div');
- style = el.style;
- style.height = '50px';
- style.width = '50px';
- style.padding = '10px';
- style.overflow = 'hidden';
- style.position = 'absolute';
- el.innerHTML = '<span style="display:inline-block;zoom:1;height:60px;width:60px;"></span>';
- doc.body.appendChild(el);
- if (el.scrollWidth === 70) {
- hasBug = true;
- }
- doc.body.removeChild(el);
- return hasBug;
- }
- },
-
- {
- name: 'rtlVertScrollbarOnRight',
- ready: true,
- fn: function(doc, div) {
- div.innerHTML = '<div style="height:100px;width:100px;direction:rtl;overflow:scroll">' + '<div style="width:20px;height:200px;"></div>' + '</div>';
- var outerBox = div.firstChild,
- innerBox = outerBox.firstChild;
- return (innerBox.offsetLeft + innerBox.offsetWidth !== outerBox.offsetLeft + outerBox.offsetWidth);
- }
- },
-
- {
- name: 'rtlVertScrollbarOverflowBug',
- ready: true,
- fn: function(doc, div) {
- div.innerHTML = '<div style="height:100px;width:100px;direction:rtl;overflow:auto">' + '<div style="width:95px;height:200px;"></div>' + '</div>';
-
-
-
- var outerBox = div.firstChild,
- style = div.style,
- pos = style.position;
-
- style.position = 'absolute';
- outerBox.offsetHeight;
- style.position = pos;
- return outerBox.clientHeight === outerBox.offsetHeight;
- }
- },
- {
- identity: 'defineProperty',
- fn: function() {
- if (Ext.isIE8m) {
- Ext.Object.defineProperty = Ext.emptyFn;
- return false;
- }
- return true;
- }
- },
- {
- identify: 'nativeXhr',
- fn: function() {
- if (typeof XMLHttpRequest !== 'undefined') {
- return true;
- }
-
- XMLHttpRequest = function() {
-
- try {
- return new ActiveXObject('MSXML2.XMLHTTP.3.0');
- }
- catch (ex) {
- return null;
- }
- };
- return false;
- }
- },
-
- {
- name: 'SpecialKeyDownRepeat',
- fn: function() {
- return Ext.isWebKit ? parseInt(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1], 10) >= 525 : !(!(Ext.isGecko || Ext.isIE || Ext.isEdge) || (Ext.isOpera && Ext.operaVersion < 12));
- }
- },
-
- {
- name: 'EmulatedMouseOver',
- fn: function() {
-
- return Ext.os.is.iOS;
- }
- },
-
- {
-
- name: 'Hashchange',
- fn: function() {
-
- var docMode = document.documentMode;
- return 'onhashchange' in window && (docMode === undefined || docMode > 7);
- }
- },
-
- {
- name: 'FixedTableWidthBug',
- ready: true,
- fn: function() {
- if (Ext.isIE8) {
-
- return false;
- }
- var outer = document.createElement('div'),
- inner = document.createElement('div'),
- width;
- outer.setAttribute('style', 'display:table;table-layout:fixed;');
- inner.setAttribute('style', 'display:table-cell;min-width:50px;');
- outer.appendChild(inner);
- document.body.appendChild(outer);
-
- outer.offsetWidth;
-
- outer.style.width = '25px';
- width = outer.offsetWidth;
- document.body.removeChild(outer);
- return width === 50;
- }
- },
-
- {
- name: 'FocusinFocusoutEvents',
- fn: function() {
-
-
-
-
- return !(Ext.isGecko && Ext.firefoxVersion < 52);
- }
- },
-
- {
- name: 'AsyncFocusEvents',
- fn: function() {
-
-
-
- return Ext.asyncFocus = !!Ext.isIE;
- }
- },
-
-
- {
- name: 'accessibility',
- ready: true,
- fn: function(doc) {
- var body = doc.body,
- div, img, style, supports, bgImg;
- function getColor(colorTxt) {
- var values = [],
- colorValue = 0,
- regex, match;
- if (colorTxt.indexOf('rgb(') !== -1) {
- values = colorTxt.replace('rgb(', '').replace(')', '').split(', ');
- } else if (colorTxt.indexOf('#') !== -1) {
- regex = colorTxt.length === 7 ? /^#(\S\S)(\S\S)(\S\S)$/ : /^#(\S)(\S)(\S)$/;
- match = colorTxt.match(regex);
- if (match) {
- values = [
- '0x' + match[1],
- '0x' + match[2],
- '0x' + match[3]
- ];
- }
- }
- for (var i = 0; i < values.length; i++) {
- colorValue += parseInt(values[i]);
- }
- return colorValue;
- }
- div = doc.createElement('div');
- img = doc.createElement('img');
- style = div.style;
- Ext.apply(style, {
- width: '2px',
- position: 'absolute',
- clip: 'rect(1px,1px,1px,1px)',
- borderWidth: '1px',
- borderStyle: 'solid',
- borderTopTolor: '#f00',
- borderRightColor: '#ff0',
- backgroundColor: '#fff',
- backgroundImage: 'url(' + Ext.BLANK_IMAGE_URL + ')'
- });
- img.alt = '';
- img.src = Ext.BLANK_IMAGE_URL;
- div.appendChild(img);
- body.appendChild(div);
-
- style = div.currentStyle || div.style;
- bgImg = style.backgroundImage;
- supports = {
-
-
-
-
- Images: img.offsetWidth === 1 && img.readyState !== 'uninitialized',
- BackgroundImages: !(bgImg !== null && (bgImg === "none" || bgImg === "url(invalid-url:)")),
- BorderColors: style.borderTopColor !== style.borderRightColor,
- LightOnDark: getColor(style.color) - getColor(style.backgroundColor) > 0
- };
- Ext.supports.HighContrastMode = !supports.BackgroundImages;
- body.removeChild(div);
- div = img = null;
- return supports;
- }
- },
- {
-
- name: 'ViewportUnits',
- ready: true,
- fn: function(doc) {
-
-
- if (Ext.isIE8) {
- return false;
- }
-
- var body = doc.body,
- div = document.createElement('div'),
- style = div.currentStyle || div.style,
- width, divWidth;
- body.appendChild(div);
- Ext.apply(style, {
- width: '50vw'
- });
- width = parseInt(window.innerWidth / 2, 10);
- divWidth = parseInt((window.getComputedStyle ? getComputedStyle(div, null) : div.currentStyle).width, 10);
- body.removeChild(div);
- div = null;
- return width === divWidth;
- }
- },
- {
- name: 'CSSVariables',
- ready: false,
- fn: function() {
-
-
- if (!window.getComputedStyle) {
- return false;
- }
-
- return window.CSS && window.CSS.supports && window.CSS.supports('--test-var', 0);
- }
- },
- {
-
- name: 'Selectors2',
- ready: false,
- fn: function(doc) {
- try {
- return !!doc.querySelectorAll(':scope');
- } catch (e) {
- return false;
- }
- }
- },
- {
-
- name: 'CSSScrollSnap',
- ready: false,
- fn: function(doc) {
- var style = doc.documentElement.style;
- return 'scrollSnapType' in style || 'webkitScrollSnapType' in style || 'msScrollSnapType' in style;
- }
- },
-
- {
- name: 'TranslateYCausesHorizontalScroll',
- ready: true,
- fn: function(doc, div) {
- div.innerHTML = '<div style="position: relative; overflow: auto; height: 200px; width: 200px;">' + '<div>' + '<div style="transform: translateY(260px); width: 50px;">a</div>' + '</div>' + '</div>';
- return div.firstChild.scrollWidth > div.firstChild.clientWidth;
- }
- },
- {
-
- name: 'FlexBoxBasisBug',
- ready: true,
- fn: function() {
- if (Ext.isIE11 || (Ext.os.is.iOS && Ext.os.version.major <= 10) || (Ext.isSafari && Ext.browser.version.isLessThan(11)) || (Ext.os.is.Android && Ext.os.version.isLessThan(6))) {
- return true;
- }
- return false;
- }
- },
- {
-
- name: 'PercentageSizeFlexBug',
- ready: true,
- fn: function(doc, div) {
- if (Ext.isIE9m) {
- return false;
- }
- var style = div.style;
- style.display = 'flex';
- style.flexDirection = 'column';
- style.height = style.width = '100px';
- div.innerHTML = '<div style="flex: 1 1;"><div style="height:50%"></div></div>';
- return div.firstChild.firstChild.offsetHeight !== 50;
- }
- },
- {
-
- name: 'CannotScrollExactHeight',
- fn: function() {
- return Ext.isIE10p;
- }
- },
- {
-
- name: 'WebKitInputTableBoxModelBug',
- ready: true,
- fn: function(doc, div) {
- var table = document.createElement('div'),
- cell = document.createElement('div'),
- input = document.createElement('input'),
- tableStyle = table.style,
- cellStyle = cell.style,
- inputStyle = input.style,
- body = doc.body,
- hasBug;
- input.type = 'text';
- tableStyle.display = 'table';
- tableStyle.height = '100px';
- cellStyle.display = 'table-cell';
- inputStyle.border = '0';
- inputStyle.padding = '10px';
- inputStyle.boxSizing = 'border-box';
- inputStyle.height = '100%';
- cell.appendChild(input);
- table.appendChild(cell);
- body.appendChild(table);
- hasBug = input.offsetHeight === 80;
- body.removeChild(table);
- return hasBug;
- }
- },
- {
-
- name: 'PassiveEventListener',
- fn: function(doc, div) {
- var supportsPassive = false,
- options;
- try {
- options = Object.defineProperty({}, 'passive', {
- get: function() {
- supportsPassive = true;
- }
- });
- window.addEventListener('e', null, options);
- window.removeEventListener('e', null, options);
- } catch (e) {}
- return supportsPassive;
- }
- },
- {
-
- name: 'CSSMinContent',
- ready: true,
- fn: function(doc, div) {
-
-
-
- div.innerHTML = '<div style="height:4px;width:4px;min-height:-webkit-min-content;min-height:-moz-min-content;min-height:min-content"><div style="height:8px;width:8px"></div></div>';
- return div.firstChild.offsetHeight === 8;
- }
- },
- {
- name: 'ComputedSizeIncludesPadding',
- ready: true,
- fn: function(doc, div) {
- var ret = false,
- bd = document.body,
- el, w;
- if (window.getComputedStyle) {
- el = document.createElement('div');
- el.style.cssText = 'width:10px;padding:2px;' + '-webkit-box-sizing:border-box;box-sizing:border-box;';
- bd.appendChild(el);
- w = window.getComputedStyle(el, null).width;
- ret = w === '10px';
- bd.removeChild(el);
- }
- return ret;
- }
- },
- 0
- ]
- };
- Ext.feature.tests.pop();
- Ext.supports = {};
- Ext.feature.detect();
- Ext.env.Ready = {
-
-
-
-
-
- blocks: (location.search || '').indexOf('ext-pauseReadyFire') > 0 ? 1 : 0,
-
- bound: 0,
-
- delay: 1,
-
-
- events: [],
-
-
- firing: false,
-
- generation: 0,
-
- listeners: [],
-
- nextId: 0,
-
- sortGeneration: 0,
-
- state: 0,
-
- timer: null,
-
- bind: function() {
- var me = Ext.env.Ready,
- doc = document;
- if (!me.bound) {
-
- if (doc.readyState === 'complete') {
-
- me.onReadyEvent({
- type: doc.readyState || 'body'
- });
- } else {
- me.bound = 1;
- if (Ext.browser.is.PhoneGap && !Ext.os.is.Desktop) {
- me.bound = 2;
- doc.addEventListener('deviceready', me.onReadyEvent, false);
- }
- doc.addEventListener('DOMContentLoaded', me.onReadyEvent, false);
- window.addEventListener('load', me.onReadyEvent, false);
- }
- }
- },
- block: function() {
- ++this.blocks;
- Ext.isReady = false;
- },
-
- fireReady: function() {
- var me = Ext.env.Ready;
- if (!me.state) {
- Ext._readyTime = Ext.ticks();
- Ext.isDomReady = true;
- me.state = 1;
-
- Ext.feature.detect(true);
- if (!me.delay) {
- me.handleReady();
- } else if (navigator.standalone) {
-
-
-
-
- me.timer = Ext.defer(function() {
- me.timer = null;
- me.handleReadySoon();
- }, 1);
- } else {
- me.handleReadySoon();
- }
- }
- },
-
- handleReady: function() {
- var me = this;
- if (me.state === 1) {
- me.state = 2;
- Ext._beforeReadyTime = Ext.ticks();
- me.invokeAll();
- Ext._afterReadyTime = Ext.ticks();
- }
- },
-
- handleReadySoon: function(delay) {
- var me = this;
- if (!me.timer) {
- me.timer = Ext.defer(function() {
- me.timer = null;
- me.handleReady();
- }, delay || me.delay);
- }
- },
-
- invoke: function(listener) {
- var delay = listener.delay;
- if (delay) {
- Ext.defer(listener.fn, delay, listener.scope);
- } else {
- if (Ext.elevateFunction) {
- Ext.elevateFunction(listener.fn, listener.scope);
- } else {
- listener.fn.call(listener.scope);
- }
- }
- },
-
- invokeAll: function() {
- if (Ext.elevateFunction) {
- Ext.elevateFunction(this.doInvokeAll, this);
- } else {
- this.doInvokeAll();
- }
- },
- doInvokeAll: function() {
- var me = this,
- listeners = me.listeners,
- listener;
- if (!me.blocks) {
-
- Ext.isReady = true;
- }
- me.firing = true;
-
-
- while (listeners.length) {
- if (me.sortGeneration !== me.generation) {
- me.sortGeneration = me.generation;
-
-
-
-
- listeners.sort(me.sortFn);
- }
- listener = listeners.pop();
- if (me.blocks && !listener.dom) {
-
-
-
- listeners.push(listener);
- break;
- }
- me.invoke(listener);
- }
- me.firing = false;
- },
-
- makeListener: function(fn, scope, options) {
- var ret = {
- fn: fn,
- id: ++this.nextId,
-
- scope: scope,
- dom: false,
- priority: 0
- };
- if (options) {
- Ext.apply(ret, options);
- }
- ret.phase = ret.dom ? 0 : 1;
-
- return ret;
- },
-
- on: function(fn, scope, options) {
- var me = Ext.env.Ready,
- listener = me.makeListener(fn, scope, options);
- if (me.state === 2 && !me.firing && (listener.dom || !me.blocks)) {
-
-
-
-
-
-
-
- me.invoke(listener);
- } else {
- me.listeners.push(listener);
- ++me.generation;
- if (!me.bound) {
-
-
-
- me.bind();
- }
- }
- },
-
- onReadyEvent: function(ev) {
- var me = Ext.env.Ready;
- if (Ext.elevateFunction) {
- Ext.elevateFunction(me.doReadyEvent, me, arguments);
- } else {
- me.doReadyEvent(ev);
- }
- },
- doReadyEvent: function(ev) {
- var me = this;
-
- if (ev && ev.type) {
- me.events.push(ev);
- }
-
- if (me.bound > 0) {
- me.unbind();
- me.bound = -1;
- }
-
- if (!me.state) {
- me.fireReady();
- }
- },
-
- sortFn: function(a, b) {
- return -((a.phase - b.phase) || (b.priority - a.priority) || (a.id - b.id));
- },
- unblock: function() {
- var me = this;
- if (me.blocks) {
- if (!--me.blocks) {
- if (me.state === 2 && !me.firing) {
-
-
- me.invokeAll();
- }
- }
- }
- },
-
-
-
-
-
-
- unbind: function() {
- var me = this,
- doc = document;
- if (me.bound > 1) {
- doc.removeEventListener('deviceready', me.onReadyEvent, false);
- }
- doc.removeEventListener('DOMContentLoaded', me.onReadyEvent, false);
- window.removeEventListener('load', me.onReadyEvent, false);
- }
- };
- (function() {
- var Ready = Ext.env.Ready;
-
-
- if (Ext.isIE9m) {
-
- Ext.apply(Ready, {
-
- scrollTimer: null,
-
- readyStatesRe: /complete/i,
-
- pollScroll: function() {
- var scrollable = true;
- try {
- document.documentElement.doScroll('left');
- } catch (e) {
- scrollable = false;
- }
-
-
- if (scrollable && document.body) {
- Ready.onReadyEvent({
- type: 'doScroll'
- });
- } else {
-
-
-
- Ready.scrollTimer = Ext.defer(Ready.pollScroll, 20);
- }
- return scrollable;
- },
- bind: function() {
- if (Ready.bound) {
- return;
- }
- var doc = document,
- topContext;
-
- try {
- topContext = window.frameElement === undefined;
- } catch (e) {}
-
-
- if (!topContext || !doc.documentElement.doScroll) {
- Ready.pollScroll = Ext.emptyFn;
- }
-
- else if (Ready.pollScroll()) {
-
- return;
- }
- if (doc.readyState === 'complete') {
-
- Ready.onReadyEvent({
- type: 'already ' + (doc.readyState || 'body')
- });
- } else {
- doc.attachEvent('onreadystatechange', Ready.onReadyStateChange);
- window.attachEvent('onload', Ready.onReadyEvent);
- Ready.bound = 1;
- }
- },
- unbind: function() {
- document.detachEvent('onreadystatechange', Ready.onReadyStateChange);
- window.detachEvent('onload', Ready.onReadyEvent);
- if (Ext.isNumber(Ready.scrollTimer)) {
- Ext.undefer(Ready.scrollTimer);
- Ready.scrollTimer = null;
- }
- },
-
- onReadyStateChange: function() {
- var state = document.readyState;
- if (Ready.readyStatesRe.test(state)) {
- Ready.onReadyEvent({
- type: state
- });
- }
- }
- });
- }
-
-
-
-
- Ext.onDocumentReady = function(fn, scope, options) {
- var opt = {
- dom: true
- };
- if (options) {
- Ext.apply(opt, options);
- }
- Ready.on(fn, scope, opt);
- };
-
- Ext.onReady = function(fn, scope, options) {
- Ready.on(fn, scope, options);
- };
-
- Ext.onInternalReady = function(fn, scope, options) {
- Ready.on(fn, scope, Ext.apply({
- priority: 1000
- }, options));
- };
- Ready.bind();
- }());
- Ext.Loader = (new function() {
-
-
-
-
-
-
-
-
- var Loader = this,
- Manager = Ext.ClassManager,
-
- Boot = Ext.Boot,
- Class = Ext.Class,
- Ready = Ext.env.Ready,
- alias = Ext.Function.alias,
- dependencyProperties = [
- 'extend',
- 'mixins',
- 'requires'
- ],
- isInHistory = {},
- history = [],
- readyListeners = [],
- usedClasses = [],
- _requiresMap = {},
- _config = {
-
- enabled: true,
-
- scriptChainDelay: false,
-
- disableCaching: true,
-
- disableCachingParam: '_dc',
-
- paths: Manager.paths,
-
- preserveScripts: true,
-
- scriptCharset: undefined
- },
-
- delegatedConfigs = {
- disableCaching: true,
- disableCachingParam: true,
- preserveScripts: true,
- scriptChainDelay: 'loadDelay'
- };
- Ext.apply(Loader, {
-
- isInHistory: isInHistory,
-
- isLoading: false,
-
- history: history,
-
- config: _config,
-
- readyListeners: readyListeners,
-
- optionalRequires: usedClasses,
-
- requiresMap: _requiresMap,
-
- hasFileLoadError: false,
-
- scriptsLoading: 0,
-
- classesLoading: {},
- missingCount: 0,
- missingQueue: {},
-
- syncModeEnabled: false,
- init: function() {
-
- var scripts = document.getElementsByTagName('script'),
- src = scripts[scripts.length - 1].src,
- path = src.substring(0, src.lastIndexOf('/') + 1),
- meta = Ext._classPathMetadata,
- microloader = Ext.Microloader,
- manifest = Ext.manifest,
- loadOrder, classes, className, idx, baseUrl, loadlen, l, loadItem;
-
- if (src.indexOf("packages/core/src/") !== -1) {
- path = path + "../../";
- } else if (src.indexOf("/core/src/class/") !== -1) {
- path = path + "../../../";
- }
-
- if (!Manager.getPath("Ext")) {
- Manager.setPath('Ext', path + 'src');
- }
-
- if (meta) {
- Ext._classPathMetadata = null;
- Loader.addClassPathMappings(meta);
- }
- if (manifest) {
- loadOrder = manifest.loadOrder;
-
-
-
- baseUrl = Ext.Boot.baseUrl;
- if (loadOrder && manifest.bootRelative) {
- for (loadlen = loadOrder.length , l = 0; l < loadlen; l++) {
- loadItem = loadOrder[l];
- loadItem.path = baseUrl + loadItem.path;
- loadItem.canonicalPath = true;
- }
- }
- }
- if (microloader) {
- Ready.block();
- microloader.onMicroloaderReady(function() {
- Ready.unblock();
- });
- }
- },
-
- setConfig: Ext.Function.flexSetter(function(name, value) {
- if (name === 'paths') {
- Loader.setPath(value);
- } else {
- _config[name] = value;
- var delegated = delegatedConfigs[name];
- if (delegated) {
- Boot.setConfig((delegated === true) ? name : delegated, value);
- }
- }
- return Loader;
- }),
-
- getConfig: function(name) {
- return name ? _config[name] : _config;
- },
-
- setPath: function() {
-
- Manager.setPath.apply(Manager, arguments);
- return Loader;
- },
-
- addClassPathMappings: function(paths) {
-
- Manager.setPath(paths);
- return Loader;
- },
-
- addBaseUrlClassPathMappings: function(pathConfig) {
- for (var name in pathConfig) {
- pathConfig[name] = Boot.baseUrl + pathConfig[name];
- }
- Ext.Loader.addClassPathMappings(pathConfig);
- },
-
- getPath: function(className) {
-
- return Manager.getPath(className);
- },
- require: function(expressions, fn, scope, excludes) {
- if (excludes) {
- return Loader.exclude(excludes).require(expressions, fn, scope);
- }
- var classNames = Manager.getNamesByExpression(expressions);
- return Loader.load(classNames, fn, scope);
- },
- syncRequire: function() {
- var wasEnabled = Loader.syncModeEnabled;
- Loader.syncModeEnabled = true;
- var ret = Loader.require.apply(Loader, arguments);
- Loader.syncModeEnabled = wasEnabled;
- return ret;
- },
- exclude: function(excludes) {
- var selector = Manager.select({
- require: function(classNames, fn, scope) {
- return Loader.load(classNames, fn, scope);
- },
- syncRequire: function(classNames, fn, scope) {
- var wasEnabled = Loader.syncModeEnabled;
- Loader.syncModeEnabled = true;
- var ret = Loader.load(classNames, fn, scope);
- Loader.syncModeEnabled = wasEnabled;
- return ret;
- }
- });
- selector.exclude(excludes);
- return selector;
- },
- load: function(classNames, callback, scope) {
- if (callback) {
- if (callback.length) {
-
-
- callback = Loader.makeLoadCallback(classNames, callback);
- }
- callback = callback.bind(scope || Ext.global);
- }
- var state = Manager.classState,
- missingClassNames = [],
- urls = [],
- urlByClass = {},
- numClasses = classNames.length,
- url, className, i, numMissing;
- for (i = 0; i < numClasses; ++i) {
- className = Manager.resolveName(classNames[i]);
- if (!Manager.isCreated(className)) {
- missingClassNames.push(className);
- if (!state[className]) {
- urlByClass[className] = Loader.getPath(className);
- urls.push(urlByClass[className]);
- }
- }
- }
-
-
- numMissing = missingClassNames.length;
- if (numMissing) {
- Loader.missingCount += numMissing;
- Manager.onCreated(function() {
- if (callback) {
- Ext.callback(callback, scope, arguments);
- }
- Loader.checkReady();
- }, Loader, missingClassNames);
- if (!_config.enabled) {
- Ext.raise("Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " + "Missing required class" + ((missingClassNames.length > 1) ? "es" : "") + ": " + missingClassNames.join(', '));
- }
- if (urls.length) {
- Loader.loadScripts({
- url: urls,
-
- _classNames: missingClassNames,
- _urlByClass: urlByClass
- });
- } else {
-
-
-
- Loader.checkReady();
- }
- } else {
- if (callback) {
- callback.call(scope);
- }
-
-
-
- Loader.checkReady();
- }
- if (Loader.syncModeEnabled) {
-
- if (numClasses === 1) {
- return Manager.get(classNames[0]);
- }
- }
- return Loader;
- },
- makeLoadCallback: function(classNames, callback) {
- return function() {
- var classes = [],
- i = classNames.length;
- while (i-- > 0) {
- classes[i] = Manager.get(classNames[i]);
- }
- return callback.apply(this, classes);
- };
- },
- onLoadFailure: function(request) {
- var options = this,
- entries = request.entries || [],
- onError = options.onError,
- error, entry, i;
- Loader.hasFileLoadError = true;
- --Loader.scriptsLoading;
- if (onError) {
- for (i = 0; i < entries.length; i++) {
- entry = entries[i];
- if (entry.error) {
- error = new Error('Failed to load: ' + entry.url);
- break;
- }
- }
- error = error || new Error('Failed to load');
- onError.call(options.userScope, options, error, request);
- } else
- {
- Ext.log.error("[Ext.Loader] Some requested files failed to load.");
- }
-
- Loader.checkReady();
- },
- onLoadSuccess: function() {
- var options = this,
- onLoad = options.onLoad,
- classNames = options._classNames,
- urlByClass = options._urlByClass,
- state = Manager.classState,
- missingQueue = Loader.missingQueue,
- className, i, len;
- --Loader.scriptsLoading;
- if (onLoad) {
-
- onLoad.call(options.userScope, options);
- }
-
-
-
-
- for (i = 0 , len = classNames.length; i < len; i++) {
- className = classNames[i];
-
-
-
-
-
-
-
-
- if (!state[className]) {
- missingQueue[className] = urlByClass[className];
- }
- }
- Loader.checkReady();
- },
-
-
-
- reportMissingClasses: function() {
- if (!Loader.syncModeEnabled && !Loader.scriptsLoading && Loader.isLoading && !Loader.hasFileLoadError) {
- var missingQueue = Loader.missingQueue,
- missingClasses = [],
- missingPaths = [];
- for (var missingClassName in missingQueue) {
- missingClasses.push(missingClassName);
- missingPaths.push(missingQueue[missingClassName]);
- }
- if (missingClasses.length) {
- throw new Error("The following classes are not declared even if their files have been " + "loaded: '" + missingClasses.join("', '") + "'. Please check the source code of their " + "corresponding files for possible typos: '" + missingPaths.join("', '"));
- }
- }
- },
-
-
- onReady: function(fn, scope, withDomReady, options) {
- if (withDomReady) {
- Ready.on(fn, scope, options);
- } else {
- var listener = Ready.makeListener(fn, scope, options);
- if (Loader.isLoading) {
- readyListeners.push(listener);
- } else {
- Ready.invoke(listener);
- }
- }
- },
-
- addUsedClasses: function(classes) {
- var cls, i, ln;
- if (classes) {
- classes = (typeof classes === 'string') ? [
- classes
- ] : classes;
- for (i = 0 , ln = classes.length; i < ln; i++) {
- cls = classes[i];
- if (typeof cls === 'string' && !Ext.Array.contains(usedClasses, cls)) {
- usedClasses.push(cls);
- }
- }
- }
- return Loader;
- },
-
- triggerReady: function() {
- var listener,
- refClasses = usedClasses;
- if (Loader.isLoading && refClasses.length) {
-
- usedClasses = [];
-
-
- Loader.require(refClasses);
- } else {
-
-
- Loader.isLoading = false;
-
-
- readyListeners.sort(Ready.sortFn);
-
-
-
- while (readyListeners.length && !Loader.isLoading) {
-
-
- listener = readyListeners.pop();
- Ready.invoke(listener);
- }
-
-
-
-
-
-
-
-
- Ready.unblock();
- }
- },
-
- historyPush: function(className) {
- if (className && !isInHistory[className] && !Manager.overrideMap[className]) {
- isInHistory[className] = true;
- history.push(className);
- }
- return Loader;
- },
-
- loadScripts: function(params) {
- var manifest = Ext.manifest,
- loadOrder = manifest && manifest.loadOrder,
- loadOrderMap = manifest && manifest.loadOrderMap,
- options;
- ++Loader.scriptsLoading;
-
-
- if (loadOrder && !loadOrderMap) {
- manifest.loadOrderMap = loadOrderMap = Boot.createLoadOrderMap(loadOrder);
- }
-
-
- Loader.checkReady();
- options = Ext.apply({
- loadOrder: loadOrder,
- loadOrderMap: loadOrderMap,
- charset: _config.scriptCharset,
- success: Loader.onLoadSuccess,
- failure: Loader.onLoadFailure,
- sync: Loader.syncModeEnabled,
- _classNames: []
- }, params);
- options.userScope = options.scope;
- options.scope = options;
- Boot.load(options);
- },
-
- loadScriptsSync: function(urls) {
- var syncwas = Loader.syncModeEnabled;
- Loader.syncModeEnabled = true;
- Loader.loadScripts({
- url: urls
- });
- Loader.syncModeEnabled = syncwas;
- },
-
- loadScriptsSyncBasePrefix: function(urls) {
- var syncwas = Loader.syncModeEnabled;
- Loader.syncModeEnabled = true;
- Loader.loadScripts({
- url: urls,
- prependBaseUrl: true
- });
- Loader.syncModeEnabled = syncwas;
- },
-
- loadScript: function(options) {
- var isString = typeof options === 'string',
- isArray = options instanceof Array,
- isObject = !isArray && !isString,
- url = isObject ? options.url : options,
- onError = isObject && options.onError,
- onLoad = isObject && options.onLoad,
- scope = isObject && options.scope,
- request = {
- url: url,
- scope: scope,
- onLoad: onLoad,
- onError: onError,
- _classNames: []
- };
- Loader.loadScripts(request);
- },
-
- checkMissingQueue: function() {
- var missingQueue = Loader.missingQueue,
- newQueue = {},
- name,
- missing = 0;
- for (name in missingQueue) {
-
-
-
- if (!(Manager.classState[name] || Manager.isCreated(name))) {
- newQueue[name] = missingQueue[name];
- missing++;
- }
- }
- Loader.missingCount = missing;
- Loader.missingQueue = newQueue;
- },
-
- checkReady: function() {
- var wasLoading = Loader.isLoading,
- isLoading;
- Loader.checkMissingQueue();
- isLoading = Loader.missingCount + Loader.scriptsLoading;
- if (isLoading && !wasLoading) {
- Ready.block();
- Loader.isLoading = !!isLoading;
- } else if (!isLoading && wasLoading) {
- Loader.triggerReady();
- }
-
- if (!Loader.scriptsLoading && Loader.missingCount) {
-
-
- Ext.defer(function() {
- if (!Loader.scriptsLoading && Loader.missingCount) {
- Ext.log.error('[Loader] The following classes failed to load:');
- for (var name in Loader.missingQueue) {
- Ext.log.error('[Loader] ' + name + ' from ' + Loader.missingQueue[name]);
- }
- }
- }, 1000);
- }
- }
- });
-
-
- Ext.require = alias(Loader, 'require');
-
- Ext.syncRequire = alias(Loader, 'syncRequire');
-
- Ext.exclude = alias(Loader, 'exclude');
-
-
- Class.registerPreprocessor('loader', function(cls, data, hooks, continueFn) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(cls, 'Ext.Loader#loaderPreprocessor', arguments);
-
-
- var me = this,
- dependencies = [],
- dependency,
- className = Manager.getName(cls),
- i, j, ln, subLn, value, propertyName, propertyValue, requiredMap;
-
- for (i = 0 , ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue === 'string') {
- dependencies.push(propertyValue);
- } else if (propertyValue instanceof Array) {
- for (j = 0 , subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value === 'string') {
- dependencies.push(value);
- }
- }
- } else if (typeof propertyValue !== 'function') {
- for (j in propertyValue) {
- if (propertyValue.hasOwnProperty(j)) {
- value = propertyValue[j];
- if (typeof value === 'string') {
- dependencies.push(value);
- }
- }
- }
- }
- }
- }
- if (dependencies.length === 0) {
- return;
- }
- if (className) {
- _requiresMap[className] = dependencies;
- }
-
- var manifestClasses = Ext.manifest && Ext.manifest.classes,
- deadlockPath = [],
- detectDeadlock;
-
- if (className && (!manifestClasses || !manifestClasses[className])) {
- requiredMap = Loader.requiredByMap || (Loader.requiredByMap = {});
- for (i = 0 , ln = dependencies.length; i < ln; i++) {
- dependency = dependencies[i];
- (requiredMap[dependency] || (requiredMap[dependency] = [])).push(className);
- }
- detectDeadlock = function(cls) {
- deadlockPath.push(cls);
- var requires = _requiresMap[cls],
- dep, i, ln;
- if (requires) {
- if (Ext.Array.contains(requires, className)) {
- Ext.Error.raise("Circular requirement detected! '" + className + "' and '" + deadlockPath[1] + "' mutually require each other. Path: " + deadlockPath.join(' -> ') + " -> " + deadlockPath[0]);
- }
- for (i = 0 , ln = requires.length; i < ln; i++) {
- dep = requires[i];
- if (!isInHistory[dep]) {
- detectDeadlock(requires[i]);
- }
- }
- }
- };
- detectDeadlock(className);
- }
-
- (className ? Loader.exclude(className) : Loader).require(dependencies, function() {
- for (i = 0 , ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue === 'string') {
- data[propertyName] = Manager.get(propertyValue);
- } else if (propertyValue instanceof Array) {
- for (j = 0 , subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value === 'string') {
- data[propertyName][j] = Manager.get(value);
- }
- }
- } else if (typeof propertyValue !== 'function') {
- for (var k in propertyValue) {
- if (propertyValue.hasOwnProperty(k)) {
- value = propertyValue[k];
- if (typeof value === 'string') {
- data[propertyName][k] = Manager.get(value);
- }
- }
- }
- }
- }
- }
- continueFn.call(me, cls, data, hooks);
- });
- return false;
- }, true, 'after', 'className');
-
- Manager.registerPostprocessor('uses', function(name, cls, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor(cls, 'Ext.Loader#usesPostprocessor', arguments);
-
-
- var uses = data.uses,
- classNames;
- if (uses) {
- classNames = Manager.getNamesByExpression(data.uses);
- Loader.addUsedClasses(classNames);
- }
- });
- Manager.onCreated(Loader.historyPush);
-
- Loader.init();
- }());
- Ext._endTime = Ext.ticks();
- if (Ext._beforereadyhandler) {
- Ext._beforereadyhandler();
- }
- Ext.define('Ext.Mixin', function(Mixin) {
- return {
- statics: {
- addHook: function(hookFn, targetClass, methodName, mixinClassPrototype) {
- var isFunc = Ext.isFunction(hookFn),
- hook = function() {
- var a = arguments,
- fn = isFunc ? hookFn : mixinClassPrototype[hookFn],
- result = this.callParent(a);
- fn.apply(this, a);
- return result;
- },
- existingFn = targetClass.hasOwnProperty(methodName) && targetClass[methodName];
- if (isFunc) {
- hookFn.$previous = Ext.emptyFn;
- }
-
- hook.$name = methodName;
- hook.$owner = targetClass.self;
- if (existingFn) {
- hook.$previous = existingFn.$previous;
- existingFn.$previous = hook;
- } else {
- targetClass[methodName] = hook;
- }
- }
- },
- onClassExtended: function(cls, data) {
- var mixinConfig = data.mixinConfig,
- hooks = data.xhooks,
- superclass = cls.superclass,
- onClassMixedIn = data.onClassMixedIn,
- parentMixinConfig, befores, afters, extended;
- if (hooks) {
-
- delete data.xhooks;
- (mixinConfig || (data.mixinConfig = mixinConfig = {})).on = hooks;
- }
- if (mixinConfig) {
- parentMixinConfig = superclass.mixinConfig;
- if (parentMixinConfig) {
- data.mixinConfig = mixinConfig = Ext.merge({}, parentMixinConfig, mixinConfig);
- }
- data.mixinId = mixinConfig.id;
-
- if (mixinConfig.beforeHooks) {
- Ext.raise('Use of "beforeHooks" is deprecated - use "before" instead');
- }
- if (mixinConfig.hooks) {
- Ext.raise('Use of "hooks" is deprecated - use "after" instead');
- }
- if (mixinConfig.afterHooks) {
- Ext.raise('Use of "afterHooks" is deprecated - use "after" instead');
- }
-
- befores = mixinConfig.before;
- afters = mixinConfig.after;
- hooks = mixinConfig.on;
- extended = mixinConfig.extended;
- }
- if (befores || afters || hooks || extended) {
-
- data.onClassMixedIn = function(targetClass) {
- var mixin = this.prototype,
- targetProto = targetClass.prototype,
- key;
- if (befores) {
- Ext.Object.each(befores, function(key, value) {
- targetClass.addMember(key, function() {
- if (mixin[value].apply(this, arguments) !== false) {
- return this.callParent(arguments);
- }
- });
- });
- }
- if (afters) {
- Ext.Object.each(afters, function(key, value) {
- targetClass.addMember(key, function() {
- var ret = this.callParent(arguments);
- mixin[value].apply(this, arguments);
- return ret;
- });
- });
- }
- if (hooks) {
- for (key in hooks) {
- Mixin.addHook(hooks[key], targetProto, key, mixin);
- }
- }
- if (extended) {
- targetClass.onExtended(function() {
- var args = Ext.Array.slice(arguments, 0);
- args.unshift(targetClass);
- return extended.apply(this, args);
- }, this);
- }
- if (onClassMixedIn) {
- onClassMixedIn.apply(this, arguments);
- }
- };
- }
- }
- };
- });
- Ext.util = Ext.util || {};
- Ext.util.DelayedTask = function(fn, scope, args, cancelOnDelay, fireIdleEvent) {
-
-
- var me = this,
- delay,
- call = function() {
- me.id = null;
- if (!(scope && scope.destroyed)) {
- args ? fn.apply(scope, args) : fn.call(scope);
- }
- if (fireIdleEvent === false) {
- Ext._suppressIdle = true;
- }
- };
-
-
- if (fn) {
- call.$origFn = fn.$origFn || fn;
- call.$skipTimerCheck = call.$origFn.$skipTimerCheck;
- }
-
- cancelOnDelay = typeof cancelOnDelay === 'boolean' ? cancelOnDelay : true;
-
- me.id = null;
-
- me.delay = function(newDelay, newFn, newScope, newArgs) {
- if (cancelOnDelay) {
- me.cancel();
- }
- if (typeof newDelay === 'number') {
- delay = newDelay;
- }
- fn = newFn || fn;
- scope = newScope || scope;
- args = newArgs || args;
- me.delayTime = delay;
-
- if (fn) {
- call.$origFn = fn.$origFn || fn;
- call.$skipTimerCheck = call.$origFn.$skipTimerCheck;
- }
-
- if (!me.id) {
- if (delay === -1) {
- me.id = Ext.raf(call);
- } else {
- me.id = Ext.defer(call, delay || 1);
- }
- }
-
- return me.id;
- };
-
- me.cancel = function() {
- if (me.id) {
- if (me.delayTime === -1) {
- Ext.unraf(me.id);
- } else {
- Ext.undefer(me.id);
- }
- me.id = null;
- }
- };
- me.flush = function() {
- if (me.id) {
- me.cancel();
-
-
- var was = fireIdleEvent;
- fireIdleEvent = true;
- call();
- fireIdleEvent = was;
- }
- };
-
- me.stop = function(stopFn, stopScope) {
-
-
-
- if (stopFn && stopFn === fn && (!stopScope || stopScope === scope)) {
- me.cancel();
- }
- };
- };
- Ext.define('Ext.util.Event', function() {
- var arraySlice = Array.prototype.slice,
- arrayInsert = Ext.Array.insert,
- toArray = Ext.Array.toArray,
- fireArgs = {};
- return {
-
- isEvent: true,
-
- suspended: 0,
- noOptions: {},
- constructor: function(observable, name) {
- this.name = name;
- this.observable = observable;
- this.listeners = [];
- },
- addListener: function(fn, scope, options, caller, manager) {
- var me = this,
- added = false,
- observable = me.observable,
- eventName = me.name,
- listeners, listener, priority, isNegativePriority, highestNegativePriorityIndex, hasNegativePriorityIndex, length, index, i, listenerPriority, managedListeners;
-
- if (scope && !Ext._namedScopes[scope] && (typeof fn === 'string') && (typeof scope[fn] !== 'function')) {
- Ext.raise("No method named '" + fn + "' found on scope object");
- }
-
- if (me.findListener(fn, scope) === -1) {
- listener = me.createListener(fn, scope, options, caller, manager);
- if (me.firing) {
-
- me.listeners = me.listeners.slice(0);
- }
- listeners = me.listeners;
- index = length = listeners.length;
- priority = options && options.priority;
- highestNegativePriorityIndex = me._highestNegativePriorityIndex;
- hasNegativePriorityIndex = highestNegativePriorityIndex !== undefined;
- if (priority) {
-
-
- isNegativePriority = (priority < 0);
- if (!isNegativePriority || hasNegativePriorityIndex) {
-
-
-
-
-
-
- for (i = (isNegativePriority ? highestNegativePriorityIndex : 0); i < length; i++) {
-
- listenerPriority = listeners[i].o ? listeners[i].o.priority || 0 : 0;
- if (listenerPriority < priority) {
- index = i;
- break;
- }
- }
- } else {
-
-
-
- me._highestNegativePriorityIndex = index;
- }
- } else if (hasNegativePriorityIndex) {
-
-
-
-
- index = highestNegativePriorityIndex;
- }
- if (!isNegativePriority && index <= highestNegativePriorityIndex) {
- me._highestNegativePriorityIndex++;
- }
- if (index === length) {
- listeners[length] = listener;
- } else {
- arrayInsert(listeners, index, [
- listener
- ]);
- }
- if (observable.isElement) {
-
-
-
-
-
-
- observable._getPublisher(eventName, options.translate === false).subscribe(observable, eventName, options.delegated !== false, options.capture);
- }
-
- if (manager) {
-
-
- managedListeners = manager.managedListeners || (manager.managedListeners = []);
- managedListeners.push({
- item: me.observable,
- ename: (options && options.managedName) || me.name,
- fn: fn,
- scope: scope,
- options: options
- });
- }
- added = true;
- }
- return added;
- },
- createListener: function(fn, scope, o, caller, manager) {
- var me = this,
- namedScope = Ext._namedScopes[scope],
- listener = {
- fn: fn,
- scope: scope,
- ev: me,
- caller: caller,
- manager: manager,
- namedScope: namedScope,
- defaultScope: namedScope ? (scope || me.observable) : undefined,
- lateBound: typeof fn === 'string'
- },
- handler = fn,
- wrapped = false,
- type;
-
-
- if (o) {
- listener.o = o;
- if (o.single) {
- handler = me.createSingle(handler, listener, o, scope);
- wrapped = true;
- }
- if (o.target) {
- handler = me.createTargeted(handler, listener, o, scope, wrapped);
- wrapped = true;
- }
- if (o.onFrame) {
- handler = me.createAnimFrame(handler, listener, o, scope, wrapped);
- wrapped = true;
- }
- if (o.delay) {
- handler = me.createDelayed(handler, listener, o, scope, wrapped);
- wrapped = true;
- }
- if (o.buffer) {
- handler = me.createBuffered(handler, listener, o, scope, wrapped);
- wrapped = true;
- }
- if (me.observable.isElement) {
-
-
-
- type = o.type;
- if (type) {
- listener.type = type;
- }
- }
- }
- listener.fireFn = handler;
- listener.wrapped = wrapped;
- return listener;
- },
- findListener: function(fn, scope) {
- var listeners = this.listeners,
- i = listeners.length,
- listener;
- while (i--) {
- listener = listeners[i];
- if (listener) {
-
- if (listener.fn === fn && listener.scope == scope) {
- return i;
- }
- }
- }
- return -1;
- },
- removeListener: function(fn, scope, index) {
- var me = this,
- removed = false,
- observable = me.observable,
- eventName = me.name,
- listener, options, manager, managedListeners, managedListener, i;
- index = index != null ? index : me.findListener(fn, scope);
- if (index !== -1) {
- listener = me.listeners[index];
- if (me.firing) {
- me.listeners = me.listeners.slice(0);
- }
-
-
-
- me.listeners.splice(index, 1);
-
-
- if (me._highestNegativePriorityIndex) {
- if (index < me._highestNegativePriorityIndex) {
- me._highestNegativePriorityIndex--;
- } else if (index === me._highestNegativePriorityIndex && index === me.listeners.length) {
- delete me._highestNegativePriorityIndex;
- }
- }
- if (listener) {
- options = listener.o;
-
-
-
- if (listener.task) {
- listener.task.cancel();
- delete listener.task;
- }
-
- i = listener.tasks && listener.tasks.length;
- if (i) {
- while (i--) {
- listener.tasks[i].cancel();
- }
- delete listener.tasks;
- }
-
- listener.fireFn.timerId = Ext.undefer(listener.fireFn.timerId);
- manager = listener.manager;
- if (manager) {
-
-
-
-
-
-
-
-
- managedListeners = manager.managedListeners;
- if (managedListeners) {
- for (i = managedListeners.length; i--; ) {
- managedListener = managedListeners[i];
- if (managedListener.item === me.observable && managedListener.ename === eventName && managedListener.fn === fn && managedListener.scope === scope) {
- managedListeners.splice(i, 1);
- }
- }
- }
- }
- if (observable.isElement) {
- observable._getPublisher(eventName, options.translate === false).unsubscribe(observable, eventName, options.delegated !== false, options.capture);
- }
- }
- removed = true;
- }
- return removed;
- },
-
- clearListeners: function() {
- var listeners = this.listeners,
- i = listeners.length,
- listener;
- while (i--) {
- listener = listeners[i];
- this.removeListener(listener.fn, listener.scope);
- }
- },
- suspend: function() {
- ++this.suspended;
- },
- resume: function() {
- if (this.suspended) {
- --this.suspended;
- }
- },
- isSuspended: function() {
- return this.suspended > 0;
- },
- fireDelegated: function(firingObservable, args) {
- this.firingObservable = firingObservable;
- return this.fire.apply(this, args);
- },
- fire: function() {
- var me = this,
- CQ = Ext.ComponentQuery,
- listeners = me.listeners,
- count = listeners.length,
- observable = me.observable,
- isElement = observable.isElement,
- isComponent = observable.isComponent,
- firingObservable = me.firingObservable,
- options, delegate, fireInfo, i, args, listener, len, delegateEl, currentTarget, type, chained, firingArgs, e, fireFn, fireScope;
- if (!me.suspended && count > 0) {
- me.firing = true;
- args = arguments.length ? arraySlice.call(arguments, 0) : [];
- len = args.length;
- if (isElement) {
- e = args[0];
- }
- for (i = 0; i < count; i++) {
- listener = listeners[i];
-
-
-
- if (!listener) {
-
- continue;
- }
- options = listener.o;
- if (isElement) {
- if (currentTarget) {
-
-
- e.setCurrentTarget(currentTarget);
- }
-
-
-
-
- type = listener.type;
- if (type) {
-
-
-
-
-
-
- chained = e;
- e = args[0] = chained.chain({
- type: type,
- isGesture: false
- });
- }
-
-
- Ext.EventObject = e;
- }
- firingArgs = args;
- if (options) {
- delegate = options.delegate;
- if (delegate) {
- if (isElement) {
-
-
- delegateEl = e.getTarget(typeof delegate === 'function' ? delegate : '#' + e.currentTarget.id + ' ' + delegate);
- if (delegateEl) {
- args[1] = delegateEl;
-
-
- currentTarget = e.currentTarget;
- e.setCurrentTarget(delegateEl);
- } else {
-
- continue;
- }
- } else if (isComponent && !CQ.is(firingObservable, delegate, observable)) {
-
- continue;
- }
- }
- if (isElement) {
- if (options.preventDefault) {
- e.preventDefault();
- }
- if (options.stopPropagation) {
- e.stopPropagation();
- }
- if (options.stopEvent) {
- e.stopEvent();
- }
- }
- args[len] = options;
- if (options.args) {
- firingArgs = options.args.concat(args);
- }
- }
- fireInfo = me.getFireInfo(listener);
- fireFn = fireInfo.fn;
- fireScope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
-
-
-
- if (fireScope && fireScope.destroyed) {
- me.removeListener(fireFn, fireScope, i);
- fireFn = null;
-
-
-
- if (fireScope.$className !== 'Ext.container.Monitor') {
- (Ext.raiseOnDestroyed ? Ext.raise : Ext.log.warn)({
- msg: 'Attempting to fire "' + me.name + '" event on destroyed ' + (fireScope.$className || 'object') + ' instance with id: ' + (fireScope.id || 'unknown'),
- instance: fireScope
- });
- }
- }
-
-
- if (fireFn && fireFn.apply(fireScope, firingArgs) === false) {
- Ext.EventObject = null;
- return (me.firing = false);
- }
-
-
- if (options) {
- args.length--;
- }
- if (chained) {
-
-
-
- e = args[0] = chained;
- chained = null;
- }
-
-
- Ext.EventObject = null;
- }
- }
- me.firing = false;
- return true;
- },
- getFireInfo: function(listener, fromWrapped) {
- var observable = this.observable,
- fireFn = listener.fireFn,
- scope = listener.scope,
- namedScope = listener.namedScope,
- fn;
-
-
- if (!fromWrapped && listener.wrapped) {
- fireArgs.fn = fireFn;
- return fireArgs;
- }
- fn = fromWrapped ? listener.fn : fireFn;
-
- var name = fn;
-
- if (listener.lateBound) {
-
- if (!scope || namedScope) {
-
-
-
-
- scope = (listener.caller || observable).resolveListenerScope(listener.defaultScope);
- }
-
- if (!scope) {
- Ext.raise('Unable to dynamically resolve scope for "' + listener.ev.name + '" listener on ' + this.observable.id);
- }
- if (!Ext.isFunction(scope[fn])) {
- Ext.raise('No method named "' + fn + '" on ' + (scope.$className || 'scope object.'));
- }
-
- fn = scope[fn];
- } else if (namedScope && namedScope.isController) {
-
-
- scope = (listener.caller || observable).resolveListenerScope(listener.defaultScope);
-
- if (!scope) {
- Ext.raise('Unable to dynamically resolve scope for "' + listener.ev.name + '" listener on ' + this.observable.id);
- }
- }
-
- else if (!scope || namedScope) {
-
-
- scope = observable;
- }
-
-
-
- fireArgs.fn = fn;
- fireArgs.scope = scope;
-
- if (!fn) {
- Ext.raise('Unable to dynamically resolve method "' + name + '" on ' + this.observable.$className);
- }
-
- return fireArgs;
- },
- createAnimFrame: function(handler, listener, o, scope, wrapped) {
- var fireInfo;
- if (!wrapped) {
- fireInfo = listener.ev.getFireInfo(listener, true);
- handler = fireInfo.fn;
- scope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
- }
- return Ext.Function.createAnimationFrame(handler, scope, o.args);
- },
- createTargeted: function(handler, listener, o, scope, wrapped) {
- return function() {
- if (o.target === arguments[0]) {
- var fireInfo;
- if (!wrapped) {
- fireInfo = listener.ev.getFireInfo(listener, true);
- handler = fireInfo.fn;
- scope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
- }
- return handler.apply(scope, arguments);
- }
- };
- },
- createBuffered: function(handler, listener, o, scope, wrapped) {
- listener.task = new Ext.util.DelayedTask();
- return function() {
-
-
-
- if (listener.task) {
- var fireInfo;
-
- if (Ext.Timer.track) {
- o.$delayedTask = listener.task;
- }
-
-
- if (!wrapped) {
- fireInfo = listener.ev.getFireInfo(listener, true);
- handler = fireInfo.fn;
- scope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
- }
- listener.task.delay(o.buffer, handler, scope, toArray(arguments));
- }
- };
- },
- createDelayed: function(handler, listener, o, scope, wrapped) {
- return function() {
- var task = new Ext.util.DelayedTask(),
- fireInfo;
- if (!wrapped) {
- fireInfo = listener.ev.getFireInfo(listener, true);
- handler = fireInfo.fn;
- scope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
- }
- if (!listener.tasks) {
- listener.tasks = [];
- }
- listener.tasks.push(task);
-
- if (Ext.Timer.track) {
- o.$delayedTask = task;
- }
-
-
- task.delay(o.delay || 10, handler, scope, toArray(arguments));
- };
- },
- createSingle: function(handler, listener, o, scope, wrapped) {
- return function() {
- var event = listener.ev,
- observable = event.observable,
- fn = listener.fn,
- fireInfo;
-
-
-
-
- if (observable) {
- if (!observable.destroyed) {
- observable.removeListener(event.name, fn, scope);
- }
- } else {
- event.removeListener(fn, scope);
- }
- if (!wrapped) {
- fireInfo = event.getFireInfo(listener, true);
- handler = fireInfo.fn;
- scope = fireInfo.scope;
-
- fireInfo.fn = fireInfo.scope = null;
- }
- return handler.apply(scope, arguments);
- };
- }
- };
- });
- Ext.define('Ext.mixin.Identifiable', {
- statics: {
- uniqueIds: {}
- },
- isIdentifiable: true,
- mixinId: 'identifiable',
- idCleanRegex: /\.|[^\w\-]/g,
- defaultIdPrefix: 'ext-',
- defaultIdSeparator: '-',
- getOptimizedId: function() {
- return this.id;
- },
- getUniqueId: function() {
- var id = this.id,
- prototype, separator, xtype, uniqueIds, prefix;
-
- if (!(id || id === 0)) {
- prototype = this.self.prototype;
- separator = this.defaultIdSeparator;
- uniqueIds = Ext.mixin.Identifiable.uniqueIds;
- if (!prototype.hasOwnProperty('identifiablePrefix')) {
- xtype = this.xtype;
- if (xtype) {
- prefix = this.defaultIdPrefix + xtype.replace(this.idCleanRegex, separator) + separator;
- } else if (!(prefix = prototype.$className)) {
- prefix = this.defaultIdPrefix + 'anonymous' + separator;
- } else {
- prefix = prefix.replace(this.idCleanRegex, separator).toLowerCase() + separator;
- }
- prototype.identifiablePrefix = prefix;
- }
- prefix = this.identifiablePrefix;
- if (!uniqueIds.hasOwnProperty(prefix)) {
- uniqueIds[prefix] = 0;
- }
-
-
-
- id = this.id = this.id = prefix + (++uniqueIds[prefix]);
- }
- this.getUniqueId = this.getOptimizedId;
- return id;
- },
- setId: function(id) {
-
- this.id = this.id = id;
- },
-
- getId: function() {
- var id = this.id;
- if (!id) {
- id = this.getUniqueId();
- }
- this.getId = this.getOptimizedId;
- return id;
- }
- });
- Ext.define('Ext.mixin.Observable', function(Observable) {
- var emptyFn = Ext.emptyFn,
- emptyArray = [],
- arrayProto = Array.prototype,
- arraySlice = arrayProto.slice,
-
- ListenerRemover = function(observable) {
-
- if (observable instanceof ListenerRemover) {
- return observable;
- }
- this.observable = observable;
-
-
- if (arguments[1].isObservable) {
- this.managedListeners = true;
- }
- this.args = arraySlice.call(arguments, 1);
- },
-
-
- protectedProps = [
- 'events',
- 'hasListeners',
- 'managedListeners',
- 'eventedBeforeEventNames'
- ];
- ListenerRemover.prototype.destroy = function() {
- var me = this,
- args = me.args,
- observable = me.observable,
-
-
- elementName = args[0].element || (args[3] && args[3].element);
-
- if (elementName) {
-
- if (Ext.Array.indexOf(observable.referenceList, elementName) === -1) {
- Ext.Logger.error("Destroying event listener with an invalid element reference of '" + elementName + "' for this component. Available values are: '" + observable.referenceList.join("', '") + "'", observable);
- }
-
- observable = observable[elementName];
- }
-
- if (!observable.destroyed) {
- observable[me.managedListeners ? 'mun' : 'un'].apply(observable, me.args);
- }
- me.destroy = Ext.emptyFn;
- };
- return {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'observable',
- after: {
- destroy: 'destroyObservable'
- }
- },
- mixins: [
- Ext.mixin.Identifiable
- ],
- statics: {
-
- releaseCapture: function(o) {
- o.fireEventArgs = this.prototype.fireEventArgs;
- },
-
- capture: function(o, fn, scope) {
-
-
-
-
- var newFn = function(eventName, args) {
- return fn.apply(scope, [
- eventName
- ].concat(args));
- };
- this.captureArgs(o, newFn, scope);
- },
-
- captureArgs: function(o, fn, scope) {
- o.fireEventArgs = Ext.Function.createInterceptor(o.fireEventArgs, fn, scope);
- },
-
- observe: function(cls, listeners) {
- if (cls) {
- if (!cls.isObservable) {
- Ext.applyIf(cls, new this());
- this.captureArgs(cls.prototype, cls.fireEventArgs, cls);
- }
- if (Ext.isObject(listeners)) {
- cls.on(listeners);
- }
- }
- return cls;
- },
-
- prepareClass: function(T, mixin, data) {
-
-
-
-
- var listeners = T.listeners = [],
-
-
-
-
- target = data || T.prototype,
- targetListeners = target.listeners,
- superListeners = mixin ? mixin.listeners : T.superclass.self.listeners,
- name, scope, namedScope, i, len;
-
-
-
-
- if (superListeners) {
- listeners.push(superListeners);
- }
- if (targetListeners) {
-
-
-
-
-
-
-
-
-
- scope = targetListeners.scope;
- if (!scope) {
- targetListeners.scope = 'self';
- } else {
- namedScope = Ext._namedScopes[scope];
- if (namedScope && namedScope.isController) {
- targetListeners.scope = 'self.controller';
- }
- }
- listeners.push(targetListeners);
-
-
-
-
-
- target.listeners = null;
- }
- if (!T.HasListeners) {
-
-
-
- var HasListeners = function() {},
- SuperHL = T.superclass.HasListeners || (mixin && mixin.HasListeners) || Observable.HasListeners;
-
- T.prototype.HasListeners = T.HasListeners = HasListeners;
-
-
- HasListeners.prototype = T.hasListeners = new SuperHL();
- }
-
- scope = T.prototype.$noClearOnDestroy || {};
- for (i = 0 , len = protectedProps.length; i < len; i++) {
- scope[protectedProps[i]] = true;
- }
- T.prototype.$noClearOnDestroy = scope;
- }
- },
-
-
-
- isObservable: true,
-
- $vetoClearingPrototypeOnDestroy: true,
-
- eventsSuspended: 0,
-
- constructor: function(config) {
- var me = this,
- self = me.self,
- declaredListeners, listeners, bubbleEvents, len, i;
-
-
-
-
- if (me.$observableInitialized) {
- return;
- }
- me.$observableInitialized = true;
-
-
-
-
-
-
-
-
- me.hasListeners = me.hasListeners = new me.HasListeners();
- me.eventedBeforeEventNames = {};
- me.events = me.events || {};
- declaredListeners = self.listeners;
- if (declaredListeners && !me._addDeclaredListeners(declaredListeners)) {
-
-
-
- self.listeners = null;
- }
- listeners = (config && config.listeners) || me.listeners;
- if (listeners) {
- if (listeners instanceof Array) {
-
-
-
-
-
-
- for (i = 0 , len = listeners.length; i < len; ++i) {
- me.addListener(listeners[i]);
- }
- } else {
- me.addListener(listeners);
- }
- }
- bubbleEvents = (config && config.bubbleEvents) || me.bubbleEvents;
- if (bubbleEvents) {
- me.enableBubble(bubbleEvents);
- }
- if (me.$applyConfigs) {
-
- if (config) {
- Ext.apply(me, config);
- }
- } else {
-
- me.initConfig(config);
- }
- if (listeners) {
-
-
-
- me.listeners = null;
- }
- },
- onClassExtended: function(T, data) {
- if (!T.HasListeners) {
-
-
- Observable.prepareClass(T, T.prototype.$observableMixedIn ? undefined : data);
- }
- },
-
- $eventOptions: {
- scope: 1,
- delay: 1,
- buffer: 1,
- onFrame: 1,
- single: 1,
- args: 1,
- destroyable: 1,
- priority: 1,
- order: 1
- },
- $orderToPriority: {
- before: 100,
- current: 0,
- after: -100
- },
-
- _addDeclaredListeners: function(listeners) {
- var me = this;
- if (listeners instanceof Array) {
- Ext.each(listeners, me._addDeclaredListeners, me);
- } else {
- me._addedDeclaredListeners = true;
- me.addListener(listeners);
- }
- return me._addedDeclaredListeners;
- },
-
- addManagedListener: function(item, ename, fn, scope, options, noDestroy) {
- var me = this,
- managedListeners = me.managedListeners = me.managedListeners || [],
- config, passedOptions;
- if (typeof ename !== 'string') {
-
-
-
-
- passedOptions = arguments.length > 4 ? options : ename;
- options = ename;
- for (ename in options) {
- if (options.hasOwnProperty(ename)) {
- config = options[ename];
- if (!item.$eventOptions[ename]) {
-
-
- me.addManagedListener(item, ename, config.fn || config, config.scope || options.scope || scope, config.fn ? config : passedOptions, true);
- }
- }
- }
- if (options && options.destroyable) {
- return new ListenerRemover(me, item, options);
- }
- } else {
- if (fn !== emptyFn) {
- item.doAddListener(ename, fn, scope, options, null, me, me);
-
- if (!noDestroy && options && options.destroyable) {
- return new ListenerRemover(me, item, ename, fn, scope);
- }
- }
- }
- },
-
- removeManagedListener: function(item, ename, fn, scope) {
- var me = this,
- options, config, managedListeners, length, i;
- if (item.$observableDestroyed) {
- return;
- }
- if (typeof ename !== 'string') {
- options = ename;
- for (ename in options) {
- if (options.hasOwnProperty(ename)) {
- config = options[ename];
- if (!item.$eventOptions[ename]) {
- me.removeManagedListener(item, ename, config.fn || config, config.scope || options.scope || scope);
- }
- }
- }
- } else {
- managedListeners = me.managedListeners ? me.managedListeners.slice() : [];
- ename = Ext.canonicalEventName(ename);
- for (i = 0 , length = managedListeners.length; i < length; i++) {
- me.removeManagedListenerItem(false, managedListeners[i], item, ename, fn, scope);
- }
- }
- },
-
- fireEvent: function(eventName) {
- return this.fireEventArgs(eventName, arraySlice.call(arguments, 1));
- },
-
- resolveListenerScope: function(defaultScope) {
- var namedScope = Ext._namedScopes[defaultScope];
- if (namedScope) {
-
- if (namedScope.isController) {
- Ext.raise('scope: "controller" can only be specified on classes that derive from Ext.Component or Ext.Widget');
- }
-
- if (namedScope.isSelf || namedScope.isThis) {
- defaultScope = null;
- }
- }
- return defaultScope || this;
- },
-
- fireEventArgs: function(eventName, args) {
- eventName = Ext.canonicalEventName(eventName);
- var me = this,
-
- events = me.events,
- event = events && events[eventName],
- ret = true;
-
-
- if (me.hasListeners[eventName]) {
- ret = me.doFireEvent(eventName, args || emptyArray, event ? event.bubble : false);
- }
- return ret;
- },
-
- fireAction: function(eventName, args, fn, scope, options, order) {
-
- if (typeof fn === 'string' && !scope) {
- fn = this[fn];
- }
-
- options = options ? Ext.Object.chain(options) : {};
- options.single = true;
- options.priority = ((order === 'after') ? -99.5 : 99.5);
- this.doAddListener(eventName, fn, scope, options);
- this.fireEventArgs(eventName, args);
- },
- $eventedController: {
- _paused: 1,
- pause: function() {
- ++this._paused;
- },
- resume: function() {
- var me = this,
- fn = me.fn,
- scope = me.scope,
- fnArgs = me.fnArgs,
- owner = me.owner,
- args, ret;
- if (!--me._paused) {
- if (fn) {
- args = Ext.Array.slice(fnArgs || me.args);
- if (fnArgs === false) {
-
- args.shift();
- }
- me.fn = null;
-
- args.push(me);
- if (Ext.isFunction(fn)) {
- ret = fn.apply(scope, args);
- } else if (scope && Ext.isString(fn) && Ext.isFunction(scope[fn])) {
- ret = scope[fn].apply(scope, args);
- }
- if (ret === false) {
- return false;
- }
- }
- if (!me._paused) {
-
- return me.owner.fireEventArgs(me.eventName, me.args);
- }
- }
- }
- },
-
- fireEventedAction: function(eventName, args, fn, scope, fnArgs) {
- var me = this,
- eventedBeforeEventNames = me.eventedBeforeEventNames,
- beforeEventName = eventedBeforeEventNames[eventName] || (eventedBeforeEventNames[eventName] = 'before' + eventName),
- controller = Ext.apply({
- owner: me,
- eventName: eventName,
- fn: fn,
- scope: scope,
- fnArgs: fnArgs,
- args: args
- }, me.$eventedController),
- value;
- args.push(controller);
- value = me.fireEventArgs(beforeEventName, args);
- args.pop();
- if (value === false) {
- return false;
- }
- return controller.resume();
- },
-
- doFireEvent: function(eventName, args, bubbles) {
- var target = this,
- queue, event,
- ret = true;
- do {
- if (target.eventsSuspended) {
- if ((queue = target.eventQueue)) {
- queue.push([
- eventName,
- args
- ]);
- }
- return ret;
- } else {
- event = target.events && target.events[eventName];
- if (event && event !== true) {
- if ((ret = event.fire.apply(event, args)) === false) {
- break;
- }
- }
- }
- } while (
-
- bubbles && (target = target.getBubbleParent()));
- return ret;
- },
-
- getBubbleParent: function() {
- var me = this,
- parent = me.getBubbleTarget && me.getBubbleTarget();
- if (parent && parent.isObservable) {
- return parent;
- }
- return null;
- },
-
- addListener: function(eventName, fn, scope, options, order, caller) {
- var me = this,
- namedScopes = Ext._namedScopes,
- config, namedScope, isClassListener, innerScope, eventOptions;
-
- if (typeof eventName !== 'string') {
- options = eventName;
- scope = options.scope;
- namedScope = scope && namedScopes[scope];
- isClassListener = namedScope && namedScope.isSelf;
-
-
- eventOptions = ((me.isComponent || me.isWidget) && options.element) ? me.$elementEventOptions : me.$eventOptions;
- for (eventName in options) {
- config = options[eventName];
- if (!eventOptions[eventName]) {
-
- innerScope = config.scope;
-
-
-
-
-
- if (innerScope && isClassListener) {
- namedScope = namedScopes[innerScope];
- if (namedScope && namedScope.isController) {
- innerScope = 'self.controller';
- }
- }
- me.doAddListener(eventName, config.fn || config, innerScope || scope, config.fn ? config : options, order, caller);
- }
- }
- if (options && options.destroyable) {
- return new ListenerRemover(me, options);
- }
- } else {
- me.doAddListener(eventName, fn, scope, options, order, caller);
- if (options && options.destroyable) {
- return new ListenerRemover(me, eventName, fn, scope, options);
- }
- }
- return me;
- },
-
- removeListener: function(eventName, fn, scope, eventOptions) {
- var me = this,
- config, options;
- if (typeof eventName !== 'string') {
- options = eventName;
-
-
- eventOptions = eventOptions || me.$eventOptions;
- for (eventName in options) {
- if (options.hasOwnProperty(eventName)) {
- config = options[eventName];
- if (!me.$eventOptions[eventName]) {
- me.doRemoveListener(eventName, config.fn || config, config.scope || options.scope);
- }
- }
- }
- } else {
- me.doRemoveListener(eventName, fn, scope);
- }
- return me;
- },
-
- onBefore: function(eventName, fn, scope, options) {
- return this.addListener(eventName, fn, scope, options, 'before');
- },
-
- onAfter: function(eventName, fn, scope, options) {
- return this.addListener(eventName, fn, scope, options, 'after');
- },
-
- unBefore: function(eventName, fn, scope, options) {
- return this.removeListener(eventName, fn, scope, options, 'before');
- },
-
- unAfter: function(eventName, fn, scope, options) {
- return this.removeListener(eventName, fn, scope, options, 'after');
- },
-
- addBeforeListener: function() {
- return this.onBefore.apply(this, arguments);
- },
-
- addAfterListener: function() {
- return this.onAfter.apply(this, arguments);
- },
-
- removeBeforeListener: function() {
- return this.unBefore.apply(this, arguments);
- },
-
- removeAfterListener: function() {
- return this.unAfter.apply(this, arguments);
- },
-
- clearListeners: function() {
- var me = this,
- events = me.events,
- hasListeners = me.hasListeners,
- event, key;
- if (events) {
- for (key in events) {
- if (events.hasOwnProperty(key)) {
- event = events[key];
- if (event.isEvent) {
- delete hasListeners[key];
- event.clearListeners();
- }
- }
- }
- me.events = null;
- }
- me.clearManagedListeners();
- },
-
- purgeListeners: function() {
- if (Ext.global.console) {
- Ext.global.console.warn('Observable: purgeListeners has been deprecated. Please use clearListeners.');
- }
- return this.clearListeners.apply(this, arguments);
- },
-
-
- clearManagedListeners: function() {
- var me = this,
- managedListeners = me.managedListeners,
- i, len;
- if (managedListeners) {
-
-
- me.managedListeners = null;
- for (i = 0 , len = managedListeners.length; i < len; i++) {
- me.removeManagedListenerItem(true, managedListeners[i]);
- }
- managedListeners.length = 0;
- }
- me.managedListeners = managedListeners;
- },
-
- removeManagedListenerItem: function(isClear, managedListener, item, ename, fn, scope) {
- if (isClear || (managedListener.item === item && managedListener.ename === ename && (!fn || managedListener.fn === fn) && (!scope || managedListener.scope === scope))) {
-
-
- if (!managedListener.item.destroyed) {
- managedListener.item.doRemoveListener(managedListener.ename, managedListener.fn, managedListener.scope, managedListener.options);
- }
- if (!isClear) {
- Ext.Array.remove(this.managedListeners, managedListener);
- }
- }
- },
-
- purgeManagedListeners: function() {
- if (Ext.global.console) {
- Ext.global.console.warn('Observable: purgeManagedListeners has been deprecated. Please use clearManagedListeners.');
- }
- return this.clearManagedListeners.apply(this, arguments);
- },
-
-
- hasListener: function(eventName) {
- eventName = Ext.canonicalEventName(eventName);
- return !!this.hasListeners[eventName];
- },
-
- isSuspended: function(event) {
- var suspended = this.eventsSuspended > 0,
- events = this.events;
- if (!suspended && event && events) {
- event = events[event];
- if (event && event.isEvent) {
- return event.isSuspended();
- }
- }
- return suspended;
- },
-
- suspendEvents: function(queueSuspended) {
- ++this.eventsSuspended;
- if (queueSuspended && !this.eventQueue) {
- this.eventQueue = [];
- }
- },
-
- suspendEvent: function() {
- var me = this,
- events = me.events,
- len = arguments.length,
- i, event, ename;
- for (i = 0; i < len; i++) {
- ename = arguments[i];
- ename = Ext.canonicalEventName(ename);
- event = events[ename];
-
- if (!event || !event.isEvent) {
- event = me._initEvent(ename);
- }
- event.suspend();
- }
- },
-
- resumeEvent: function() {
- var events = this.events || 0,
- len = events && arguments.length,
- i, event, ename;
- for (i = 0; i < len; i++) {
- ename = Ext.canonicalEventName(arguments[i]);
- event = events[ename];
-
- if (event && event.resume) {
- event.resume();
- }
- }
- },
-
- resumeEvents: function(discardQueue) {
- var me = this,
- queued = me.eventQueue,
- qLen, q;
- if (me.eventsSuspended && !--me.eventsSuspended) {
- delete me.eventQueue;
- if (!discardQueue && queued) {
- qLen = queued.length;
- for (q = 0; q < qLen; q++) {
-
- me.fireEventArgs.apply(me, queued[q]);
- }
- }
- }
- },
-
- relayEvents: function(origin, events, prefix) {
- var me = this,
- len = events.length,
- i = 0,
- oldName, newName,
- relayers = {};
- if (Ext.isObject(events)) {
- for (i in events) {
- newName = events[i];
- relayers[i] = me.createRelayer(newName);
- }
- } else {
- for (; i < len; i++) {
- oldName = events[i];
-
- relayers[oldName] = me.createRelayer(prefix ? prefix + oldName : oldName);
- }
- }
-
-
-
- me.mon(origin, relayers, null, null, undefined);
-
- return new ListenerRemover(me, origin, relayers);
- },
-
- createRelayer: function(newName, beginEnd) {
- var me = this;
- return function() {
- return me.fireEventArgs.call(me, newName, beginEnd ? arraySlice.apply(arguments, beginEnd) : arguments);
- };
- },
-
- enableBubble: function(eventNames) {
- if (eventNames) {
- var me = this,
- names = (typeof eventNames == 'string') ? arguments : eventNames,
-
- events = me.events,
- length = events && names.length,
- ename, event, i;
- for (i = 0; i < length; ++i) {
- ename = names[i];
- ename = Ext.canonicalEventName(ename);
- event = events[ename];
- if (!event || !event.isEvent) {
- event = me._initEvent(ename);
- }
-
-
- me.hasListeners._incr_(ename);
- event.bubble = true;
- }
- }
- },
-
- destroy: function() {
- this.clearListeners();
- this.callParent();
- this.destroyObservable(true);
- },
- destroyObservable: function(skipClearListeners) {
- var me = this,
- clearPropertiesOnDestroy = me.clearPropertiesOnDestroy;
- if (me.$observableDestroyed) {
- return;
- }
- if (!skipClearListeners) {
- me.clearListeners();
- }
-
-
-
-
-
- if (me.destroyed) {
- if (clearPropertiesOnDestroy) {
- if (clearPropertiesOnDestroy === true && !me.$nulled) {
- me.$reap();
- }
-
-
-
-
-
- if (!me.clearPrototypeOnDestroy) {
- me.fireEvent = me.fireEventArgs = me.fireAction = me.fireEventedAction = Ext.emptyFn;
- }
-
-
- me.events = me.managedListeners = me.eventedBeforeEventNames = null;
- me.$observableDestroyed = true;
- }
-
-
-
-
-
- if (me.clearPrototypeOnDestroy && Object.setPrototypeOf && !me.$alreadyNulled) {
- Object.setPrototypeOf(me, null);
- me.$alreadyNulled = true;
- }
- }
- },
-
- privates: {
- doAddListener: function(ename, fn, scope, options, order, caller, manager) {
- var me = this,
- ret = false,
- event, priority;
- order = order || (options && options.order);
- if (order) {
- priority = (options && options.priority);
- if (!priority) {
-
-
- options = options ? Ext.Object.chain(options) : {};
- options.priority = me.$orderToPriority[order];
- }
- }
- ename = Ext.canonicalEventName(ename);
-
- if (!fn) {
- Ext.raise("Cannot add '" + ename + "' listener to " + me.$className + " instance. No function specified.");
- }
-
- event = (me.events || (me.events = {}))[ename];
- if (!event || !event.isEvent) {
- event = me._initEvent(ename);
- }
- if (fn !== emptyFn) {
-
-
-
- if (!manager && (scope && scope.isObservable && (scope !== me))) {
- manager = scope;
- }
- if (event.addListener(fn, scope, options, caller, manager)) {
-
-
- me.hasListeners._incr_(ename);
- ret = true;
- }
- }
- return ret;
- },
- doRemoveListener: function(ename, fn, scope) {
- var me = this,
- ret = false,
- events = me.events,
- event;
- ename = Ext.canonicalEventName(ename);
- event = events && events[ename];
-
- if (!fn) {
- Ext.raise("Cannot remove '" + ename + "' listener to " + me.$className + " instance. No function specified.");
- }
-
- if (event && event.isEvent) {
- if (event.removeListener(fn, scope)) {
- me.hasListeners._decr_(ename);
- ret = true;
- }
- }
- return ret;
- },
- _initEvent: function(eventName) {
- return (this.events[eventName] = new Ext.util.Event(this, eventName));
- }
- },
- deprecated: {
- '5.0': {
- methods: {
- addEvents: null
- }
- }
- }
- };
- }, function() {
- var Observable = this,
- proto = Observable.prototype,
- HasListeners = function() {},
- prepareMixin = function(T) {
- if (!T.HasListeners) {
- var proto = T.prototype;
-
-
- proto.$observableMixedIn = 1;
-
- Observable.prepareClass(T, this);
-
-
- T.onExtended(function(U, data) {
-
- Ext.classSystemMonitor && Ext.classSystemMonitor('extend mixin', arguments);
-
- Observable.prepareClass(U, null, data);
- });
-
-
- if (proto.onClassMixedIn) {
-
- Ext.override(T, {
- onClassMixedIn: function(U) {
- prepareMixin.call(this, U);
- this.callParent(arguments);
- }
- });
- } else {
-
- proto.onClassMixedIn = function(U) {
- prepareMixin.call(this, U);
- };
- }
- }
- superOnClassMixedIn.call(this, T);
- },
-
-
- superOnClassMixedIn = proto.onClassMixedIn;
- HasListeners.prototype = {
-
- _decr_: function(ev, count) {
-
-
-
- if (count == null) {
- count = 1;
- }
- if (!(this[ev] -= count)) {
-
-
-
- delete this[ev];
- }
- },
- _incr_: function(ev) {
- if (this.hasOwnProperty(ev)) {
-
- ++this[ev];
- } else {
-
-
- this[ev] = 1;
- }
- }
- };
- proto.HasListeners = Observable.HasListeners = HasListeners;
- Observable.createAlias({
-
- on: 'addListener',
-
- un: 'removeListener',
-
- mon: 'addManagedListener',
-
- mun: 'removeManagedListener',
-
- setListeners: 'addListener'
- });
-
- Observable.observeClass = Observable.observe;
-
- function getMethodEvent(method) {
- var event = (this.methodEvents = this.methodEvents || {})[method],
- returnValue, v, cancel,
- me = this,
- makeCall;
- if (!event) {
- me.methodEvents[method] = event = {};
- event.originalFn = me[method];
- event.methodName = method;
- event.before = [];
- event.after = [];
- makeCall = function(fn, scope, args) {
- scope = scope || me;
- if (typeof fn === 'string') {
- fn = scope[fn];
- }
- if ((v = fn.apply(scope, args)) !== undefined) {
- if (typeof v == 'object') {
- if (v.returnValue !== undefined) {
- returnValue = v.returnValue;
- } else {
- returnValue = v;
- }
- cancel = !!v.cancel;
- } else if (v === false) {
- cancel = true;
- } else {
- returnValue = v;
- }
- }
- };
- me[method] = function() {
- var args = Array.prototype.slice.call(arguments, 0),
- argsLen = args.length,
- b, i, len;
- returnValue = v = undefined;
- cancel = false;
- for (i = 0 , len = event.before.length; i < len; i++) {
- b = event.before[i];
- if (b.extraArgs) {
- args.push.apply(args, b.extraArgs);
- }
- makeCall(b.fn, b.scope, args);
- args.length = argsLen;
- if (cancel || b.preventDefault) {
- return returnValue;
- }
- }
- if ((v = event.originalFn.apply(me, args)) !== undefined) {
- returnValue = v;
- }
- for (i = 0 , len = event.after.length; i < len; i++) {
- b = event.after[i];
- if (b.extraArgs) {
- args.push.apply(args, b.extraArgs);
- }
- makeCall(b.fn, b.scope, args);
- args.length = argsLen;
- if (cancel || b.preventDefault) {
- return returnValue;
- }
- }
- return returnValue;
- };
- }
- return event;
- }
- Ext.apply(proto, {
- onClassMixedIn: prepareMixin,
-
- beforeMethod: function(method, fn, scope, preventDefault, extraArgs) {
- getMethodEvent.call(this, method).before.push({
- fn: fn,
- scope: scope,
- extraArgs: extraArgs,
- preventDefault: preventDefault
- });
- },
-
- afterMethod: function(method, fn, scope, preventDefault, extraArgs) {
- getMethodEvent.call(this, method).after.push({
- fn: fn,
- scope: scope,
- extraArgs: extraArgs,
- preventDefault: preventDefault
- });
- },
- removeMethodListener: function(method, fn, scope) {
- var e = getMethodEvent.call(this, method),
- i, len;
- for (i = 0 , len = e.before.length; i < len; i++) {
- if (e.before[i].fn == fn && e.before[i].scope == scope) {
- Ext.Array.erase(e.before, i, 1);
- return;
- }
- }
- for (i = 0 , len = e.after.length; i < len; i++) {
- if (e.after[i].fn == fn && e.after[i].scope == scope) {
- Ext.Array.erase(e.after, i, 1);
- return;
- }
- }
- },
- toggleEventLogging: function(toggle) {
- Ext.util.Observable[toggle ? 'capture' : 'releaseCapture'](this, function(en) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.log(en, arguments);
- }
- });
- }
- });
- });
- Ext.define('Ext.util.HashMap', {
- mixins: [
- Ext.mixin.Observable
- ],
-
- generation: 0,
- config: {
-
- keyFn: null
- },
-
-
-
-
-
- constructor: function(config) {
- var me = this,
- fn;
-
- me.mixins.observable.constructor.call(me, config);
- me.clear(true);
- fn = me.getKeyFn();
- if (fn) {
- me.getKey = fn;
- }
- },
-
- getCount: function() {
- return this.length;
- },
-
- getData: function(key, value) {
-
- if (value === undefined) {
- value = key;
- key = this.getKey(value);
- }
- return [
- key,
- value
- ];
- },
-
- getKey: function(o) {
- return o.id;
- },
-
- add: function(key, value) {
- var me = this;
-
-
- if (arguments.length === 1) {
- value = key;
- key = me.getKey(value);
- }
- if (me.containsKey(key)) {
- return me.replace(key, value);
- }
- me.map[key] = value;
- ++me.length;
- me.generation++;
- if (me.hasListeners.add) {
- me.fireEvent('add', me, key, value);
- }
- return value;
- },
-
- replace: function(key, value) {
- var me = this,
- map = me.map,
- old;
-
-
- if (arguments.length === 1) {
- value = key;
- key = me.getKey(value);
- }
- if (!me.containsKey(key)) {
- me.add(key, value);
- }
- old = map[key];
- map[key] = value;
- me.generation++;
- if (me.hasListeners.replace) {
- me.fireEvent('replace', me, key, value, old);
- }
- return value;
- },
-
- remove: function(o) {
- var key = this.findKey(o);
- if (key !== undefined) {
- return this.removeAtKey(key);
- }
- return false;
- },
-
- removeAtKey: function(key) {
- var me = this,
- value;
- if (me.containsKey(key)) {
- value = me.map[key];
- delete me.map[key];
- --me.length;
- me.generation++;
- if (me.hasListeners.remove) {
- me.fireEvent('remove', me, key, value);
- }
- return true;
- }
- return false;
- },
-
- get: function(key) {
- var map = this.map;
- return map.hasOwnProperty(key) ? map[key] : undefined;
- },
-
- clear: function(initial) {
-
- var me = this;
-
- if (initial || me.generation) {
- me.map = {};
- me.length = 0;
- me.generation = initial ? 0 : me.generation + 1;
- }
- if (initial !== true && me.hasListeners.clear) {
- me.fireEvent('clear', me);
- }
- return me;
- },
-
- containsKey: function(key) {
- var map = this.map;
- return map.hasOwnProperty(key) && map[key] !== undefined;
- },
-
- contains: function(value) {
- return this.containsKey(this.findKey(value));
- },
-
- getKeys: function() {
- return this.getArray(true);
- },
-
- getValues: function() {
- return this.getArray(false);
- },
-
- getArray: function(isKey) {
- var arr = [],
- key,
- map = this.map;
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- arr.push(isKey ? key : map[key]);
- }
- }
- return arr;
- },
-
- each: function(fn, scope) {
-
- var items = Ext.apply({}, this.map),
- key,
- length = this.length;
- scope = scope || this;
- for (key in items) {
- if (items.hasOwnProperty(key)) {
- if (fn.call(scope, key, items[key], length) === false) {
- break;
- }
- }
- }
- return this;
- },
-
- clone: function() {
- var hash = new this.self(this.initialConfig),
- map = this.map,
- key;
- hash.suspendEvents();
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- hash.add(key, map[key]);
- }
- }
- hash.resumeEvents();
- return hash;
- },
-
- findKey: function(value) {
- var key,
- map = this.map;
- for (key in map) {
- if (map.hasOwnProperty(key) && map[key] === value) {
- return key;
- }
- }
- return undefined;
- }
- }, function(HashMap) {
- var prototype = HashMap.prototype;
-
- prototype.removeByKey = prototype.removeAtKey;
- });
- Ext.define('Ext.AbstractManager', {
-
- typeName: 'type',
- constructor: function(config) {
- Ext.apply(this, config || {});
-
- this.all = new Ext.util.HashMap();
- this.types = {};
- },
-
- get: function(id) {
- return this.all.get(id);
- },
-
- register: function(item) {
-
- var key = this.all.getKey(item);
- if (key === undefined) {
- Ext.raise('Key is undefined. Please ensure the item has a key before registering the item.');
- }
- if (this.all.containsKey(key)) {
- Ext.raise('Registering duplicate id "' + key + '" with ' + this.$className);
- }
-
- this.all.add(item);
- },
-
- unregister: function(item) {
- this.all.remove(item);
- },
-
- registerType: function(type, cls) {
- this.types[type] = cls;
- cls[this.typeName] = type;
- },
-
- isRegistered: function(type) {
- return this.types[type] !== undefined;
- },
-
- create: function(config, defaultType) {
- var type = config[this.typeName] || config.type || defaultType,
- Constructor = this.types[type];
-
- if (Constructor === undefined) {
- Ext.raise("The '" + type + "' type has not been registered with this manager");
- }
-
- return new Constructor(config);
- },
-
- onAvailable: function(id, fn, scope) {
- var all = this.all,
- item, callback;
- if (all.containsKey(id)) {
- item = all.get(id);
- fn.call(scope || item, item);
- } else {
- callback = function(map, key, item) {
- if (key == id) {
- fn.call(scope || item, item);
- all.un('add', callback);
- }
- };
- all.on('add', callback);
- }
- },
-
- each: function(fn, scope) {
- this.all.each(fn, scope || this);
- },
-
- getCount: function() {
- return this.all.getCount();
- }
- });
- Ext.define('Ext.promise.Consequence', function(Consequence) {
- return {
-
- promise: null,
-
- deferred: null,
-
- onFulfilled: null,
-
- onRejected: null,
-
- onProgress: null,
-
- constructor: function(onFulfilled, onRejected, onProgress) {
- var me = this;
- me.onFulfilled = onFulfilled;
- me.onRejected = onRejected;
- me.onProgress = onProgress;
- me.deferred = new Ext.promise.Deferred();
- me.promise = me.deferred.promise;
- },
-
- trigger: function(action, value) {
- var me = this,
- deferred = me.deferred;
- switch (action) {
- case 'fulfill':
- me.propagate(value, me.onFulfilled, deferred, deferred.resolve);
- break;
- case 'reject':
- me.propagate(value, me.onRejected, deferred, deferred.reject);
- break;
- }
- },
-
- update: function(progress) {
- if (Ext.isFunction(this.onProgress)) {
- progress = this.onProgress(progress);
- }
- this.deferred.update(progress);
- },
-
- propagate: function(value, callback, deferred, deferredMethod) {
- if (Ext.isFunction(callback)) {
- this.schedule(function() {
- try {
- deferred.resolve(callback(value));
- } catch (e) {
- deferred.reject(e);
- }
- });
- } else {
- deferredMethod.call(this.deferred, value);
- }
- },
-
- schedule: function(callback) {
- var n = Consequence.queueSize++;
- Consequence.queue[n] = callback;
- if (!n) {
-
- Ext.asap(Consequence.dispatch);
- }
- },
- statics: {
-
- queue: new Array(10000),
-
- queueSize: 0,
-
- dispatch: function() {
- var queue = Consequence.queue,
- fn, i;
-
- for (i = 0; i < Consequence.queueSize; ++i) {
- fn = queue[i];
- queue[i] = null;
-
- fn();
- }
- Consequence.queueSize = 0;
- }
- }
- };
- },
- function(Consequence) {
- Consequence.dispatch.$skipTimerCheck = true;
- });
- Ext.define('Ext.promise.Deferred', {
-
- promise: null,
-
- consequences: [],
-
- completed: false,
-
- completionAction: null,
-
- completionValue: null,
- constructor: function() {
- var me = this;
- me.promise = new Ext.promise.Promise(me);
- me.consequences = [];
- me.completed = false;
- me.completionAction = null;
- me.completionValue = null;
- },
-
- then: function(onFulfilled, onRejected, onProgress) {
- var me = this,
- consequence = new Ext.promise.Consequence(onFulfilled, onRejected, onProgress);
- if (me.completed) {
- consequence.trigger(me.completionAction, me.completionValue);
- } else {
- me.consequences.push(consequence);
- }
- return consequence.promise;
- },
-
- resolve: function(value) {
- var me = this,
- isHandled, thenFn;
- if (me.completed) {
- return;
- }
- try {
- if (value === me.promise) {
- throw new TypeError('A Promise cannot be resolved with itself.');
- }
- if (value != null && (typeof value === 'object' || Ext.isFunction(value)) && Ext.isFunction(thenFn = value.then)) {
- isHandled = false;
- try {
- thenFn.call(value, function(value) {
- if (!isHandled) {
- isHandled = true;
- me.resolve(value);
- }
- }, function(error) {
- if (!isHandled) {
- isHandled = true;
- me.reject(error);
- }
- });
- } catch (e1) {
- if (!isHandled) {
- me.reject(e1);
- }
- }
- } else {
- me.complete('fulfill', value);
- }
- } catch (e2) {
- me.reject(e2);
- }
- },
-
- reject: function(reason) {
- if (this.completed) {
- return;
- }
- this.complete('reject', reason);
- },
-
- update: function(progress) {
- var consequences = this.consequences,
- consequence, i, len;
- if (this.completed) {
- return;
- }
- for (i = 0 , len = consequences.length; i < len; i++) {
- consequence = consequences[i];
- consequence.update(progress);
- }
- },
-
- complete: function(action, value) {
- var me = this,
- consequences = me.consequences,
- consequence, i, len;
- me.completionAction = action;
- me.completionValue = value;
- me.completed = true;
- for (i = 0 , len = consequences.length; i < len; i++) {
- consequence = consequences[i];
- consequence.trigger(me.completionAction, me.completionValue);
- }
- me.consequences = null;
- }
- });
- Ext.define('Ext.promise.Promise', function(ExtPromise) {
- var Deferred;
- return {
- statics: {
-
- CancellationError: Ext.global.CancellationError || Error,
- _ready: function() {
-
- Deferred = Ext.promise.Deferred;
- },
-
- all: function(promisesOrValues) {
-
- if (!(Ext.isArray(promisesOrValues) || ExtPromise.is(promisesOrValues))) {
- Ext.raise('Invalid parameter: expected an Array or Promise of an Array.');
- }
-
- return ExtPromise.when(promisesOrValues).then(function(promisesOrValues) {
- var deferred = new Deferred(),
- remainingToResolve = promisesOrValues.length,
- results = new Array(remainingToResolve),
- index, promiseOrValue, resolve, i, len;
- if (!remainingToResolve) {
- deferred.resolve(results);
- } else {
- resolve = function(item, index) {
- return ExtPromise.when(item).then(function(value) {
- results[index] = value;
- if (!--remainingToResolve) {
- deferred.resolve(results);
- }
- return value;
- }, function(reason) {
- return deferred.reject(reason);
- });
- };
- for (index = i = 0 , len = promisesOrValues.length; i < len; index = ++i) {
- promiseOrValue = promisesOrValues[index];
- if (index in promisesOrValues) {
- resolve(promiseOrValue, index);
- } else {
- remainingToResolve--;
- }
- }
- }
- return deferred.promise;
- });
- },
-
- is: function(value) {
- return value != null && (typeof value === 'object' || Ext.isFunction(value)) && Ext.isFunction(value.then);
- },
-
- race: function(promises) {
-
- if (!Ext.isArray(promises)) {
- Ext.raise('Invalid parameter: expected an Array.');
- }
-
- var deferred = new Deferred(),
- len = promises.length,
- i;
- for (i = 0; i < len; ++i) {
- deferred.resolve(promises[i]);
- }
- return deferred.promise;
- },
-
- rethrowError: function(error) {
- Ext.asap(function() {
- throw error;
- });
- },
-
- when: function(value) {
- var deferred = new Deferred();
- deferred.resolve(value);
- return deferred.promise;
- }
- },
-
- owner: null,
-
- constructor: function(owner) {
- this.owner = owner;
- },
-
- then: function(onFulfilled, onRejected, onProgress, scope) {
- var ref;
- if (arguments.length === 1 && Ext.isObject(arguments[0])) {
- ref = arguments[0];
- onFulfilled = ref.success;
- onRejected = ref.failure;
- onProgress = ref.progress;
- scope = ref.scope;
- }
- if (scope) {
- if (onFulfilled) {
- onFulfilled = onFulfilled.bind(scope);
- }
- if (onRejected) {
- onRejected = onRejected.bind(scope);
- }
- if (onProgress) {
- onProgress = onProgress.bind(scope);
- }
- }
- return this.owner.then(onFulfilled, onRejected, onProgress);
- },
-
- 'catch': function(onRejected, scope) {
- var ref;
- if (arguments.length === 1 && Ext.isObject(arguments[0])) {
- ref = arguments[0];
- onRejected = ref.fn;
- scope = ref.scope;
- }
- if (scope != null) {
- onRejected = onRejected.bind(scope);
- }
- return this.owner.then(null, onRejected);
- },
-
- otherwise: function(onRejected, scope) {
- return this['catch'].apply(this, arguments);
- },
-
- always: function(onCompleted, scope) {
- var ref;
- if (arguments.length === 1 && Ext.isObject(arguments[0])) {
- ref = arguments[0];
- onCompleted = ref.fn;
- scope = ref.scope;
- }
- if (scope != null) {
- onCompleted = onCompleted.bind(scope);
- }
- return this.owner.then(function(value) {
- try {
- onCompleted();
- } catch (e) {
- ExtPromise.rethrowError(e);
- }
- return value;
- }, function(reason) {
- try {
- onCompleted();
- } catch (e) {
- ExtPromise.rethrowError(e);
- }
- throw reason;
- });
- },
-
- done: function() {
- this.owner.then(null, ExtPromise.rethrowError);
- },
-
- cancel: function(reason) {
- if (reason == null) {
- reason = null;
- }
- this.owner.reject(new this.self.CancellationError(reason));
- },
-
- log: function(identifier) {
- if (identifier == null) {
- identifier = '';
- }
- return this.owner.then(function(value) {
- Ext.log("" + (identifier || 'Promise') + " resolved with value: " + value);
- return value;
- }, function(reason) {
- Ext.log("" + (identifier || 'Promise') + " rejected with reason: " + reason);
- throw reason;
- });
- }
- };
- }, function(ExtPromise) {
- ExtPromise._ready();
- });
- Ext.define('Ext.Promise', function() {
- var Polyfiller;
- return {
- statics: {
- _ready: function() {
-
- Polyfiller = Ext.promise.Promise;
- },
-
- all: function() {
- return Polyfiller.all.apply(Polyfiller, arguments);
- },
-
- race: function() {
- return Polyfiller.race.apply(Polyfiller, arguments);
- },
-
- reject: function(reason) {
- var deferred = new Ext.promise.Deferred();
- deferred.reject(reason);
- return deferred.promise;
- },
-
- resolve: function(value) {
- var deferred = new Ext.promise.Deferred();
- deferred.resolve(value);
- return deferred.promise;
- }
- },
- constructor: function(action) {
- var deferred = new Ext.promise.Deferred();
- action(deferred.resolve.bind(deferred), deferred.reject.bind(deferred));
- return deferred.promise;
- }
- };
- }, function(ExtPromise) {
- var P = Ext.global.Promise;
- if (P && P.resolve && !Ext.useExtPromises) {
- Ext.Promise = P;
- } else {
- ExtPromise._ready();
- }
- });
- Ext.define('Ext.Deferred', function(Deferred) {
- var ExtPromise, rejected, resolved, when;
- return {
- extend: Ext.promise.Deferred,
- statics: {
- _ready: function() {
-
- ExtPromise = Ext.promise.Promise;
- when = Ext.Promise.resolve;
- },
-
- all: function() {
- return ExtPromise.all.apply(ExtPromise, arguments);
- },
-
- any: function(promisesOrValues) {
-
- if (!(Ext.isArray(promisesOrValues) || ExtPromise.is(promisesOrValues))) {
- Ext.raise('Invalid parameter: expected an Array or Promise of an Array.');
- }
-
- return Deferred.some(promisesOrValues, 1).then(function(array) {
- return array[0];
- }, function(error) {
- if (error instanceof Error && error.message === 'Too few Promises were resolved.') {
- Ext.raise('No Promises were resolved.');
- } else {
- throw error;
- }
- });
- },
-
- delay: function(promiseOrValue, milliseconds) {
- var deferred;
- if (arguments.length === 1) {
- milliseconds = promiseOrValue;
- promiseOrValue = undefined;
- }
- milliseconds = Math.max(milliseconds, 1);
- deferred = new Deferred();
- deferred.timeoutId = Ext.defer(function() {
- delete deferred.timeoutId;
- deferred.resolve(promiseOrValue);
- }, milliseconds);
- return deferred.promise;
- },
-
- getCachedRejected: function() {
- if (!rejected) {
-
- rejected = Ext.Promise.reject();
- }
- return rejected;
- },
-
- getCachedResolved: function() {
- if (!resolved) {
-
- resolved = Ext.Promise.resolve();
- }
- return resolved;
- },
-
- map: function(promisesOrValues, mapFn) {
-
- if (!(Ext.isArray(promisesOrValues) || ExtPromise.is(promisesOrValues))) {
- Ext.raise('Invalid parameter: expected an Array or Promise of an Array.');
- }
- if (!Ext.isFunction(mapFn)) {
- Ext.raise('Invalid parameter: expected a function.');
- }
-
- return Deferred.resolved(promisesOrValues).then(function(promisesOrValues) {
- var deferred, index, promiseOrValue, remainingToResolve, resolve, results, i, len;
- remainingToResolve = promisesOrValues.length;
- results = new Array(promisesOrValues.length);
- deferred = new Deferred();
- if (!remainingToResolve) {
- deferred.resolve(results);
- } else {
- resolve = function(item, index) {
- return Deferred.resolved(item).then(function(value) {
- return mapFn(value, index, results);
- }).then(function(value) {
- results[index] = value;
- if (!--remainingToResolve) {
- deferred.resolve(results);
- }
- return value;
- }, function(reason) {
- return deferred.reject(reason);
- });
- };
- for (index = i = 0 , len = promisesOrValues.length; i < len; index = ++i) {
- promiseOrValue = promisesOrValues[index];
- if (index in promisesOrValues) {
- resolve(promiseOrValue, index);
- } else {
- remainingToResolve--;
- }
- }
- }
- return deferred.promise;
- });
- },
-
- memoize: function(fn, scope, hashFn) {
- var memoizedFn = Ext.Function.memoize(fn, scope, hashFn);
- return function() {
- return Deferred.all(Ext.Array.slice(arguments)).then(function(values) {
- return memoizedFn.apply(scope, values);
- });
- };
- },
-
- parallel: function(fns, scope) {
- if (scope == null) {
- scope = null;
- }
- var args = Ext.Array.slice(arguments, 2);
- return Deferred.map(fns, function(fn) {
- if (!Ext.isFunction(fn)) {
- throw new Error('Invalid parameter: expected a function.');
- }
- return fn.apply(scope, args);
- });
- },
-
- pipeline: function(fns, initialValue, scope) {
- if (scope == null) {
- scope = null;
- }
- return Deferred.reduce(fns, function(value, fn) {
- if (!Ext.isFunction(fn)) {
- throw new Error('Invalid parameter: expected a function.');
- }
- return fn.call(scope, value);
- }, initialValue);
- },
-
- race: function() {
- return ExtPromise.race.apply(ExtPromise, arguments);
- },
-
- reduce: function(values, reduceFn, initialValue) {
-
- if (!(Ext.isArray(values) || ExtPromise.is(values))) {
- Ext.raise('Invalid parameter: expected an Array or Promise of an Array.');
- }
- if (!Ext.isFunction(reduceFn)) {
- Ext.raise('Invalid parameter: expected a function.');
- }
-
- var initialValueSpecified = arguments.length === 3;
- return Deferred.resolved(values).then(function(promisesOrValues) {
- var reduceArguments = [
- promisesOrValues,
- function(previousValueOrPromise, currentValueOrPromise, currentIndex) {
- return Deferred.resolved(previousValueOrPromise).then(function(previousValue) {
- return Deferred.resolved(currentValueOrPromise).then(function(currentValue) {
- return reduceFn(previousValue, currentValue, currentIndex, promisesOrValues);
- });
- });
- }
- ];
- if (initialValueSpecified) {
- reduceArguments.push(initialValue);
- }
- return Ext.Array.reduce.apply(Ext.Array, reduceArguments);
- });
- },
-
- rejected: function(reason) {
- var deferred = new Ext.Deferred();
- deferred.reject(reason);
- return deferred.promise;
- },
-
- resolved: function(promiseOrValue) {
- var deferred = new Ext.Deferred();
- deferred.resolve(promiseOrValue);
- return deferred.promise;
- },
-
- sequence: function(fns, scope) {
- if (scope == null) {
- scope = null;
- }
- var args = Ext.Array.slice(arguments, 2);
- return Deferred.reduce(fns, function(results, fn) {
- if (!Ext.isFunction(fn)) {
- throw new Error('Invalid parameter: expected a function.');
- }
- return Deferred.resolved(fn.apply(scope, args)).then(function(result) {
- results.push(result);
- return results;
- });
- }, []);
- },
-
- some: function(promisesOrValues, howMany) {
-
- if (!(Ext.isArray(promisesOrValues) || ExtPromise.is(promisesOrValues))) {
- Ext.raise('Invalid parameter: expected an Array or Promise of an Array.');
- }
- if (!Ext.isNumeric(howMany) || howMany <= 0) {
- Ext.raise('Invalid parameter: expected a positive integer.');
- }
-
- return Deferred.resolved(promisesOrValues).then(function(promisesOrValues) {
- var deferred, index, onReject, onResolve, promiseOrValue, remainingToReject, remainingToResolve, values, i, len;
- values = [];
- remainingToResolve = howMany;
- remainingToReject = (promisesOrValues.length - remainingToResolve) + 1;
- deferred = new Deferred();
- if (promisesOrValues.length < howMany) {
- deferred.reject(new Error('Too few Promises were resolved.'));
- } else {
- onResolve = function(value) {
- if (remainingToResolve > 0) {
- values.push(value);
- }
- remainingToResolve--;
- if (remainingToResolve === 0) {
- deferred.resolve(values);
- }
- return value;
- };
- onReject = function(reason) {
- remainingToReject--;
- if (remainingToReject === 0) {
- deferred.reject(new Error('Too few Promises were resolved.'));
- }
- return reason;
- };
- for (index = i = 0 , len = promisesOrValues.length; i < len; index = ++i) {
- promiseOrValue = promisesOrValues[index];
- if (index in promisesOrValues) {
- Deferred.resolved(promiseOrValue).then(onResolve, onReject);
- }
- }
- }
- return deferred.promise;
- });
- },
-
- timeout: function(promiseOrValue, milliseconds) {
- var deferred = new Deferred(),
- timeoutId;
- timeoutId = Ext.defer(function() {
- if (timeoutId) {
- deferred.reject(new Error('Promise timed out.'));
- }
- }, milliseconds);
- Deferred.resolved(promiseOrValue).then(function(value) {
- Ext.undefer(timeoutId);
- timeoutId = null;
- deferred.resolve(value);
- }, function(reason) {
- Ext.undefer(timeoutId);
- timeoutId = null;
- deferred.reject(reason);
- });
- return deferred.promise;
- }
- }
- };
- }, function(Deferred) {
- Deferred._ready();
- });
- Ext.Factory = function(type) {
- var me = this;
- me.aliasPrefix = type + '.';
- me.cache = {};
- me.name = type.replace(me.fixNameRe, me.fixNameFn);
- me.type = type;
-
- me.creator = 'create' + Ext.String.capitalize(me.name);
- };
- Ext.Factory.prototype = {
-
-
- defaultProperty: 'type',
-
-
- instanceProp: 'isInstance',
-
-
-
- typeProperty: 'type',
-
- create: function(config, defaultType) {
- var me = this,
- Manager = Ext.ClassManager,
- cache = me.cache,
- typeProperty = me.typeProperty,
- alias, className, klass, suffix;
- if (config) {
- if (config[me.instanceProp]) {
- return config;
- }
- if (typeof config === 'string') {
- suffix = config;
- config = {};
- config[me.defaultProperty] = suffix;
- }
- className = config.xclass;
- suffix = config[typeProperty];
- }
- if (defaultType && defaultType.constructor === Object) {
- config = Ext.apply({}, config, defaultType);
- defaultType = defaultType[typeProperty];
- }
- if (className) {
- if (!(klass = Manager.get(className))) {
- return Manager.instantiate(className, config);
- }
- } else {
- if (!(suffix = suffix || defaultType || me.defaultType)) {
- klass = me.defaultClass;
- }
-
- if (!suffix && !klass) {
- Ext.raise('No type specified for ' + me.type + '.create');
- }
-
- if (!klass && !(klass = cache[suffix])) {
- alias = me.aliasPrefix + suffix;
- className = Manager.getNameByAlias(alias);
-
- if (!(klass = className && Manager.get(className))) {
- return Manager.instantiateByAlias(alias, config);
- }
- cache[suffix] = klass;
- }
- }
- return klass.isInstance ? klass : new klass(config);
- },
- fixNameRe: /\.[a-z]/ig,
- fixNameFn: function(match) {
- return match.substring(1).toUpperCase();
- },
- clearCache: function() {
- this.cache = {};
- this.instanceCache = {};
- },
-
- hook: function(fn) {
- var me = this,
- original = me.create;
- me.create = function(config, defaultType) {
- var ret = fn.call(me, original, config, defaultType);
- if (ret === undefined) {
- ret = original.call(me, config, defaultType);
- }
- return ret;
- };
- },
-
- update: function(instance, config, creator, creatorMethod, defaultsConfig) {
- var me = this,
- aliases, defaults, reuse, type;
-
-
- if (!config || config.isInstance) {
-
- if (config && !config[me.instanceProp]) {
- Ext.raise('Config instance failed ' + me.instanceProp + ' requirement');
- }
-
- if (instance && instance !== config) {
- instance.destroy();
- }
- return config;
- }
- if (typeof config === 'string') {
- type = config;
- config = {};
- config[me.defaultProperty] = type;
- }
-
- if (instance) {
- if (config === true) {
- return instance;
- }
- if (!(type = config.xclass)) {
- if (!(type = config.xtype)) {
- type = config[me.typeProperty];
- if (type) {
-
- type = me.aliasPrefix + type;
- aliases = instance.self.prototype;
-
-
-
- if (aliases.hasOwnProperty('alias')) {
- aliases = aliases.alias;
- if (aliases) {
- reuse = aliases === type || aliases.indexOf(type) > -1;
- }
- }
- }
- } else {
-
- reuse = instance.isXType(type,
- true);
- }
- } else {
-
- reuse = instance.$className === type;
- }
- if (reuse) {
- instance.setConfig(config);
- return instance;
- }
- instance.destroy();
- }
- if (config === true) {
- config = {};
- }
- if (creator) {
- if (defaultsConfig) {
- defaults = Ext.Config.map[defaultsConfig];
- defaults = creator[defaults.names.get]();
- if (defaults) {
- config = Ext.merge(Ext.clone(defaults), config);
- }
- }
- creatorMethod = creatorMethod || me.creator;
- if (creator[creatorMethod]) {
- config = creator[creatorMethod](config);
-
- if (!config) {
- Ext.raise('Missing return value from ' + creatorMethod + ' on class ' + creator.$className);
- }
- }
- }
-
- return me.create(config);
- }
- };
- Ext.Factory.define = function(type, config) {
- var Factory = Ext.Factory,
- cacheable = config && config.cacheable,
- defaultClass, factory, fn;
- if (type.constructor === Object) {
- Ext.Object.each(type, Factory.define, Factory);
- } else {
- factory = new Ext.Factory(type);
- if (config) {
- if (config.constructor === Object) {
- Ext.apply(factory, config);
- if (typeof (defaultClass = factory.xclass) === 'string') {
- factory.defaultClass = Ext.ClassManager.get(defaultClass);
- }
- } else {
- factory.defaultType = config;
- }
- }
-
- Factory[factory.name] = fn = function(config, defaultType) {
-
-
- return factory.create(config, defaultType);
- };
- if (cacheable) {
- factory.instanceCache = {};
- factory.hook(function(original, config, defaultType) {
- var cache = this.instanceCache,
- v;
- if (typeof config === 'string' && !(v = cache[config])) {
- v = original.call(this, config, defaultType);
-
-
- if (v.cacheable !== false) {
- cache[config] = v;
-
-
-
- Ext.Object.freeze(v);
- }
- }
-
- return v;
- });
- }
- fn.instance = factory;
-
- fn.update = function(instance, config, creator, creatorMethod, defaultsConfig) {
- return factory.update(instance, config, creator, creatorMethod, defaultsConfig);
- };
- }
- return fn;
- };
- Ext.Factory.clearCaches = function() {
- var Factory = Ext.Factory,
- key, item;
- for (key in Factory) {
- item = Factory[key];
- item = item.instance;
- if (item) {
- item.clearCache();
- }
- }
- };
- Ext.Factory.on = function(name, fn) {
- Ext.Factory[name].instance.hook(fn);
- };
- Ext.define('Ext.mixin.Factoryable', {
- mixinId: 'factoryable',
- onClassMixedIn: function(targetClass) {
- var proto = targetClass.prototype,
- factoryConfig = proto.factoryConfig,
- alias = proto.alias,
- config = {},
- dot, createFn;
- alias = alias && alias.length && alias[0];
- if (alias && (dot = alias.lastIndexOf('.')) > 0) {
- config.type = alias.substring(0, dot);
- config.defaultType = alias.substring(dot + 1);
- }
- if (factoryConfig) {
- delete proto.factoryConfig;
- Ext.apply(config, factoryConfig);
- }
- createFn = Ext.Factory.define(config.type, config);
- if (targetClass.create === Ext.Base.create) {
-
- targetClass.create = createFn;
- }
- }
- });
- Ext.define('Ext.data.request.Base', {
- mixins: [
- Ext.mixin.Factoryable
- ],
-
-
- factoryConfig: {
- type: 'request',
- defaultType: 'ajax'
- },
-
- result: null,
- success: null,
- timer: null,
- constructor: function(config) {
- var me = this;
-
-
-
-
- Ext.apply(me, config.options || {}, config.ownerConfig);
- me.id = ++Ext.data.Connection.requestId;
- me.owner = config.owner;
- me.options = config.options;
- me.requestOptions = config.requestOptions;
- },
-
- start: function() {
- var me = this,
- timeout = me.getTimeout();
- if (timeout && me.async) {
- me.timer = Ext.defer(me.onTimeout, timeout, me);
- }
- },
- abort: function() {
- var me = this;
- me.clearTimer();
- if (!me.timedout) {
- me.aborted = true;
- }
- me.abort = Ext.emptyFn;
- },
- createDeferred: function() {
- var me = this,
- result = me.result,
- d = new Ext.Deferred();
- if (me.completed) {
- if (me.success) {
- d.resolve(result);
- } else {
- d.reject(result);
- }
- }
- me.deferred = d;
- return d;
- },
- getDeferred: function() {
- return this.deferred || this.createDeferred();
- },
- getPromise: function() {
- return this.getDeferred().promise;
- },
-
- then: function() {
- var promise = this.getPromise();
- return promise.then.apply(promise, arguments);
- },
-
- onComplete: function() {
- var me = this,
- deferred = me.deferred,
- result = me.result;
- me.clearTimer();
- if (deferred) {
- if (me.success) {
- deferred.resolve(result);
- } else {
- deferred.reject(result);
- }
- }
- me.completed = true;
- },
- onTimeout: function() {
- var me = this;
- me.timedout = true;
- me.timer = null;
- me.abort(true);
- },
- getTimeout: function() {
- return this.timeout;
- },
- clearTimer: function() {
- this.timer = Ext.undefer(this.timer);
- },
- destroy: function() {
- var me = this;
- me.abort();
- me.owner = me.options = me.requestOptions = me.result = null;
- me.callParent();
- },
- privates: {
-
- createException: function() {
- var me = this,
- result;
- result = {
- request: me,
- requestId: me.id,
- status: me.aborted ? -1 : 0,
- statusText: me.aborted ? 'transaction aborted' : 'communication failure',
- getResponseHeader: me._getHeader,
- getAllResponseHeaders: me._getHeaders
- };
- if (me.aborted) {
- result.aborted = true;
- }
- if (me.timedout) {
- result.timedout = true;
- }
- return result;
- },
- _getHeader: function(name) {
- var headers = this.headers;
- return headers && headers[name.toLowerCase()];
- },
- _getHeaders: function() {
- return this.headers;
- }
- }
- });
- Ext.define('Ext.data.flash.BinaryXhr', {
- statics: {
-
- flashPluginActivated: function() {
- Ext.data.flash.BinaryXhr.flashPluginActive = true;
- Ext.data.flash.BinaryXhr.flashPlugin = document.getElementById("ext-flash-polyfill");
- Ext.GlobalEvents.fireEvent("flashready");
- },
-
-
- flashPluginActive: false,
-
- flashPluginInjected: false,
-
- connectionIndex: 1,
-
- liveConnections: {},
-
- flashPlugin: null,
-
- onFlashStateChange: function(javascriptId, state, data) {
- var connection;
-
- connection = this.liveConnections[Number(javascriptId)];
-
- if (connection) {
- connection.onFlashStateChange(state, data);
- } else
- {
- Ext.warn.log("onFlashStateChange for unknown connection ID: " + javascriptId);
- }
- },
-
-
- registerConnection: function(conn) {
- var i = this.connectionIndex;
- this.conectionIndex = this.connectionIndex + 1;
- this.liveConnections[i] = conn;
- return i;
- },
-
- injectFlashPlugin: function() {
- var me = this,
- flashLoaderPath, flashObjectPath;
-
-
-
-
-
- me.flashPolyfillEl = Ext.getBody().appendChild({
- id: 'ext-flash-polyfill',
- cn: [
- {
- tag: 'p',
- html: 'To view this page ensure that Adobe Flash Player version 11.1.0 or greater is installed.'
- },
- {
- tag: 'a',
- href: 'http://www.adobe.com/go/getflashplayer',
- cn: [
- {
- tag: 'img',
- src: window.location.protocol + '//www.adobe.com/images/shared/download_buttons/get_flash_player.gif',
- alt: 'Get Adobe Flash player'
- }
- ]
- }
- ]
- });
-
- flashLoaderPath = [
- Ext.Loader.getPath('Ext.data.Connection'),
- '../../../plugins/flash/swfobject.js'
- ].join('/');
- flashObjectPath = "/plugins/flash/FlashPlugin.swf";
-
- flashObjectPath = [
- Ext.Loader.getPath('Ext.data.Connection'),
- '../../plugins/flash/FlashPlugin.swf'
- ].join('/');
-
- if (Ext.flashPluginPath) {
- flashObjectPath = Ext.flashPluginPath;
- }
-
- Ext.Loader.loadScript({
- url: flashLoaderPath,
- onLoad: function() {
-
- var swfVersionStr = "11.4.0";
-
- var xiSwfUrlStr = "playerProductInstall.swf";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "#ffffff";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "ext-flash-polyfill";
- attributes.name = "polyfill";
- attributes.align = "middle";
- swfobject.embedSWF(flashObjectPath, "ext-flash-polyfill", "0", "0",
- swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
- },
- onError: function() {
-
- Ext.raise("Could not load flash-loader file swfobject.js from " + flashLoader);
- },
-
- scope: me
- });
- Ext.data.flash.BinaryXhr.flashPluginInjected = true;
- }
- },
-
- readyState: 0,
-
- status: 0,
-
- statusText: "",
-
- responseBytes: null,
-
- javascriptId: null,
-
- constructor: function(config) {
-
- if (!Ext.data.flash.BinaryXhr.flashPluginInjected) {
- Ext.data.flash.BinaryXhr.injectFlashPlugin();
- }
- var me = this;
- Ext.apply(me, config);
- me.requestHeaders = {};
- },
-
- abort: function() {
- var me = this;
-
- if (me.readyState == 4) {
-
- Ext.warn.log("Aborting a connection that's completed its transfer: " + this.url);
-
- return;
- }
-
- me.aborted = true;
-
- if (!Ext.data.flash.BinaryXhr.flashPluginActive) {
- Ext.GlobalEvents.removeListener("flashready", me.onFlashReady, me);
- return;
- }
-
- Ext.data.flash.BinaryXhr.flashPlugin.abortRequest(me.javascriptId);
-
- delete Ext.data.flash.BinaryXhr.liveConnections[me.javascriptId];
- },
-
- getAllResponseHeaders: function() {
- var headers = [];
- Ext.Object.each(this.responseHeaders, function(name, value) {
- headers.push(name + ': ' + value);
- });
- return headers.join('\r\n');
- },
-
- getResponseHeader: function(header) {
- var headers = this.responseHeaders;
- return (headers && headers[header]) || null;
- },
-
- open: function(method, url, async, user, password) {
- var me = this;
- me.method = method;
- me.url = url;
- me.async = async !== false;
- me.user = user;
- me.password = password;
-
- if (!me.async) {
- Ext.raise("Binary posts are only supported in async mode: " + url);
- }
- if (me.method != "POST") {
- Ext.log.warn("Binary data can only be sent as a POST request: " + url);
- }
- },
-
-
- overrideMimeType: function(mimeType) {
- this.mimeType = mimeType;
- },
-
- send: function(body) {
- var me = this;
- me.body = body;
- if (!Ext.data.flash.BinaryXhr.flashPluginActive) {
- Ext.GlobalEvents.addListener("flashready", me.onFlashReady, me);
- } else {
- this.onFlashReady();
- }
- },
-
- onFlashReady: function() {
- var me = this,
- req, status;
- me.javascriptId = Ext.data.flash.BinaryXhr.registerConnection(me);
-
- req = {
- method: me.method,
-
- url: me.url,
- user: me.user,
- password: me.password,
- mimeType: me.mimeType,
- requestHeaders: me.requestHeaders,
- body: me.body,
- javascriptId: me.javascriptId
- };
- status = Ext.data.flash.BinaryXhr.flashPlugin.postBinary(req);
- },
-
- setReadyState: function(state) {
- var me = this;
- if (me.readyState != state) {
- me.readyState = state;
- me.onreadystatechange();
- }
- },
-
- setRequestHeader: function(header, value) {
- this.requestHeaders[header] = value;
- },
-
- onreadystatechange: Ext.emptyFn,
-
- parseData: function(data) {
- var me = this;
-
- this.status = data.status || 0;
-
- me.responseHeaders = {};
- if (me.mimeType) {
- me.responseHeaders["content-type"] = me.mimeType;
- }
- if (data.reason == "complete") {
-
- this.responseBytes = data.data;
- me.responseHeaders["content-length"] = data.data.length;
- } else if (data.reason == "error" || data.reason == "securityError") {
- this.statusText = data.text;
- me.responseHeaders["content-length"] = 0;
- } else
-
- {
- Ext.raise("Unkown reason code in data: " + data.reason);
- }
- },
-
-
- onFlashStateChange: function(state, data) {
- var me = this;
- if (state == 4) {
-
- me.parseData(data);
-
- delete Ext.data.flash.BinaryXhr.liveConnections[me.javascriptId];
- }
- me.setReadyState(state);
- }
- });
- Ext.define('Ext.data.request.Ajax', {
- extend: Ext.data.request.Base,
- alias: 'request.ajax',
- statics: {
-
- parseStatus: function(status, response) {
- var type, len;
- if (response) {
-
- type = response.responseType;
- if (type === 'arraybuffer') {
- len = response.byteLength;
- } else if (type === 'blob') {
- len = response.response.size;
- } else if (type === 'json' || type === 'document') {
- len = 0;
- } else if ((type === 'text' || type === '' || !type) && response.responseText) {
- len = response.responseText.length;
- }
- }
-
- status = status == 1223 ? 204 : status;
-
- var success = (status >= 200 && status < 300) || status == 304 || (status == 0 && Ext.isNumber(len)),
- isException = false;
- if (!success) {
- switch (status) {
- case 12002:
- case 12029:
- case 12030:
- case 12031:
- case 12152:
- case 13030:
- isException = true;
- break;
- }
- }
- return {
- success: success,
- isException: isException
- };
- }
- },
- start: function(data) {
- var me = this,
- options = me.options,
- requestOptions = me.requestOptions,
- isXdr = me.isXdr,
- xhr, headers;
- xhr = me.xhr = me.openRequest(options, requestOptions, me.async, me.username, me.password);
-
- if (!isXdr) {
- headers = me.setupHeaders(xhr, options, requestOptions.data, requestOptions.params);
- }
- if (me.async) {
- if (!isXdr) {
- xhr.onreadystatechange = me.bindStateChange();
- }
- }
- if (isXdr) {
- me.processXdrRequest(me, xhr);
- }
-
- me.callParent([
- data
- ]);
-
- xhr.send(data);
- if (!me.async) {
- return me.onComplete();
- }
- return me;
- },
-
- abort: function(force) {
- var me = this,
- xhr = me.xhr;
- if (force || me.isLoading()) {
-
- try {
- xhr.onreadystatechange = null;
- } catch (e) {
-
-
- xhr.onreadystatechange = Ext.emptyFn;
- }
- xhr.abort();
- me.callParent([
- force
- ]);
- me.onComplete();
- me.cleanup();
- }
- },
-
- cleanup: function() {
- this.xhr = null;
- delete this.xhr;
- },
- isLoading: function() {
- var me = this,
- xhr = me.xhr,
- state = xhr && xhr.readyState,
- C = Ext.data.flash && Ext.data.flash.BinaryXhr;
- if (!xhr || me.aborted || me.timedout) {
- return false;
- }
-
-
- if (C && xhr instanceof C) {
- return state !== 4;
- }
- return state !== 0 && state !== 4;
- },
-
- openRequest: function(options, requestOptions, async, username, password) {
- var me = this,
- xhr = me.newRequest(options);
- if (username) {
- xhr.open(requestOptions.method, requestOptions.url, async, username, password);
- } else {
- if (me.isXdr) {
- xhr.open(requestOptions.method, requestOptions.url);
- } else {
- xhr.open(requestOptions.method, requestOptions.url, async);
- }
- }
- if (options.binary || me.binary) {
- if (window.Uint8Array) {
- xhr.responseType = 'arraybuffer';
- } else if (xhr.overrideMimeType) {
-
-
-
-
- xhr.overrideMimeType('text/plain; charset=x-user-defined');
- }
-
- else if (!Ext.isIE) {
- Ext.log.warn("Your browser does not support loading binary data using Ajax.");
- }
- }
-
- if (options.responseType) {
- xhr.responseType = options.responseType;
- }
- if (options.withCredentials || me.withCredentials) {
- xhr.withCredentials = true;
- }
- return xhr;
- },
-
- newRequest: function(options) {
- var me = this,
- xhr;
- if (options.binaryData) {
-
- if (window.Uint8Array) {
- xhr = me.getXhrInstance();
- } else {
-
- xhr = new Ext.data.flash.BinaryXhr();
- }
- } else if (me.cors && Ext.isIE9m) {
- xhr = me.getXdrInstance();
- me.isXdr = true;
- } else {
- xhr = me.getXhrInstance();
- me.isXdr = false;
- }
- return xhr;
- },
-
- setupHeaders: function(xhr, options, data, params) {
- var me = this,
- headers = Ext.apply({}, options.headers || {}, me.defaultHeaders),
- contentType = me.defaultPostHeader,
- jsonData = options.jsonData,
- xmlData = options.xmlData,
- type = 'Content-Type',
- useHeader = me.useDefaultXhrHeader,
- key, header;
- if (!headers.hasOwnProperty(type) && (data || params)) {
- if (data) {
- if (options.rawData) {
- contentType = 'text/plain';
- } else {
- if (xmlData && Ext.isDefined(xmlData)) {
- contentType = 'text/xml';
- } else if (jsonData && Ext.isDefined(jsonData)) {
- contentType = 'application/json';
- }
- }
- }
- headers[type] = contentType;
- }
- if (useHeader && !headers['X-Requested-With']) {
- headers['X-Requested-With'] = me.defaultXhrHeader;
- }
-
-
- if (headers[type] === undefined || headers[type] === null) {
- delete headers[type];
- }
-
- try {
- for (key in headers) {
- if (headers.hasOwnProperty(key)) {
- header = headers[key];
- xhr.setRequestHeader(key, header);
- }
- }
- } catch (e) {
-
- me.owner.fireEvent('exception', key, header);
- }
- return headers;
- },
-
- getXdrInstance: function() {
- var xdr;
- if (Ext.ieVersion >= 8) {
- xdr = new XDomainRequest();
- } else {
- Ext.raise({
- msg: 'Your browser does not support CORS'
- });
- }
- return xdr;
- },
-
- getXhrInstance: function() {
- return new XMLHttpRequest();
- },
- processXdrRequest: function(request, xhr) {
- var me = this;
-
- delete request.headers;
- request.contentType = request.options.contentType || me.defaultXdrContentType;
- xhr.onload = me.bindStateChange(true);
- xhr.onerror = xhr.ontimeout = me.bindStateChange(false);
- },
- processXdrResponse: function(response, xhr) {
-
- response.getAllResponseHeaders = function() {
- return [];
- };
- response.getResponseHeader = function() {
- return '';
- };
- response.contentType = xhr.contentType || this.defaultXdrContentType;
- },
- bindStateChange: function(xdrResult) {
- var me = this;
- return function() {
- Ext.elevate(function() {
- me.onStateChange(xdrResult);
- });
- };
- },
- onStateChange: function(xdrResult) {
- var me = this,
- xhr = me.xhr;
-
- if ((xhr && xhr.readyState == 4) || me.isXdr) {
- me.clearTimer();
- me.onComplete(xdrResult);
- me.cleanup();
- }
- },
-
- onComplete: function(xdrResult) {
- var me = this,
- owner = me.owner,
- options = me.options,
- xhr = me.xhr,
- failure = {
- success: false,
- isException: false
- },
- result, success, response;
- if (!xhr || me.destroyed) {
- return me.result = failure;
- }
- try {
- result = Ext.data.request.Ajax.parseStatus(xhr.status, xhr);
- if (result.success) {
-
-
-
- result.success = xhr.readyState === 4;
- }
- } catch (e) {
-
-
- result = failure;
- }
- success = me.success = me.isXdr ? xdrResult : result.success;
- if (success) {
- response = me.createResponse(xhr);
- if (owner.hasListeners.requestcomplete) {
- owner.fireEvent('requestcomplete', owner, response, options);
- }
- if (options.success) {
- Ext.callback(options.success, options.scope, [
- response,
- options
- ]);
- }
- } else {
- if (result.isException || me.aborted || me.timedout) {
- response = me.createException(xhr);
- } else {
- response = me.createResponse(xhr);
- }
- if (owner.hasListeners.requestexception) {
- owner.fireEvent('requestexception', owner, response, options);
- }
- if (options.failure) {
- Ext.callback(options.failure, options.scope, [
- response,
- options
- ]);
- }
- }
- me.result = response;
- if (options.callback) {
- Ext.callback(options.callback, options.scope, [
- options,
- success,
- response
- ]);
- }
- owner.onRequestComplete(me);
- me.callParent([
- xdrResult
- ]);
- return response;
- },
-
- createResponse: function(xhr) {
- var me = this,
- isXdr = me.isXdr,
- headers = {},
- lines = isXdr ? [] : xhr.getAllResponseHeaders().replace(/\r\n/g, '\n').split('\n'),
- count = lines.length,
- line, index, key, response, byteArray;
- while (count--) {
- line = lines[count];
- index = line.indexOf(':');
- if (index >= 0) {
- key = line.substr(0, index).toLowerCase();
- if (line.charAt(index + 1) == ' ') {
- ++index;
- }
- headers[key] = line.substr(index + 1);
- }
- }
- response = {
- request: me,
- requestId: me.id,
- status: xhr.status,
- statusText: xhr.statusText,
- getResponseHeader: function(header) {
- return headers[header.toLowerCase()];
- },
- getAllResponseHeaders: function() {
- return headers;
- }
- };
- if (isXdr) {
- me.processXdrResponse(response, xhr);
- }
- if (me.binary) {
- response.responseBytes = me.getByteArray(xhr);
- } else {
- if (xhr.responseType) {
- response.responseType = xhr.responseType;
- }
- if (xhr.responseType === 'blob') {
- response.responseBlob = xhr.response;
- } else if (xhr.responseType === 'json') {
- response.responseJson = xhr.response;
- } else if (xhr.responseType === 'document') {
- response.responseXML = xhr.response;
- } else {
-
-
-
-
- response.responseText = xhr.responseText;
- response.responseXML = xhr.responseXML;
- }
- }
- return response;
- },
- destroy: function() {
- this.xhr = null;
- this.callParent();
- },
- privates: {
-
- getByteArray: function(xhr) {
- var response = xhr.response,
- responseBody = xhr.responseBody,
- Cls = Ext.data.flash && Ext.data.flash.BinaryXhr,
- byteArray, responseText, len, i;
- if (xhr instanceof Cls) {
-
- byteArray = xhr.responseBytes;
- } else if (window.Uint8Array) {
-
-
-
- byteArray = response ? new Uint8Array(response) : [];
- } else if (Ext.isIE9p) {
-
-
-
-
- try {
- byteArray = new VBArray(responseBody).toArray();
- }
- catch (e) {
-
-
-
-
- byteArray = [];
- }
- } else if (Ext.isIE) {
-
-
-
-
-
- if (!this.self.vbScriptInjected) {
- this.injectVBScript();
- }
- getIEByteArray(xhr.responseBody, byteArray = []);
- } else
- {
-
-
- byteArray = [];
- responseText = xhr.responseText;
- len = responseText.length;
- for (i = 0; i < len; i++) {
-
-
-
- byteArray.push(responseText.charCodeAt(i) & 255);
- }
- }
- return byteArray;
- },
-
- injectVBScript: function() {
- var scriptTag = document.createElement('script');
- scriptTag.type = 'text/vbscript';
- scriptTag.text = [
- 'Function getIEByteArray(byteArray, out)',
- 'Dim len, i',
- 'len = LenB(byteArray)',
- 'For i = 1 to len',
- 'out.push(AscB(MidB(byteArray, i, 1)))',
- 'Next',
- 'End Function'
- ].join('\n');
- Ext.getHead().dom.appendChild(scriptTag);
- this.self.vbScriptInjected = true;
- }
- }
- });
- Ext.define('Ext.data.request.Form', {
- extend: Ext.data.request.Base,
- alias: 'request.form',
- start: function(data) {
- var me = this,
- options = me.options,
- requestOptions = me.requestOptions;
-
- me.callParent([
- data
- ]);
- me.form = me.upload(options.form, requestOptions.url, requestOptions.data, options);
- return me;
- },
- abort: function(force) {
- var me = this,
- frame;
- if (me.isLoading()) {
- try {
- frame = me.frame.dom;
- if (frame.stop) {
- frame.stop();
- } else {
- frame.document.execCommand('Stop');
- }
- } catch (e) {}
- }
-
- me.callParent([
- force
- ]);
- me.onComplete();
- me.cleanup();
- },
-
- cleanup: function() {
- var me = this,
- frame = me.frame;
- if (frame) {
-
- frame.un('load', me.onComplete, me);
- Ext.removeNode(frame);
- }
- me.frame = me.form = null;
- },
- isLoading: function() {
- return !!this.frame;
- },
-
- upload: function(form, url, params, options) {
- form = Ext.getDom(form);
- options = options || {};
- var frameDom = document.createElement('iframe'),
- frame = Ext.get(frameDom),
- id = frame.id,
- hiddens = [],
- encoding = 'multipart/form-data',
- buf = {
- target: form.target,
- method: form.method,
- encoding: form.encoding,
- enctype: form.enctype,
- action: form.action
- },
- addField = function(name, value) {
- hiddenItem = document.createElement('input');
- Ext.fly(hiddenItem).set({
- type: 'hidden',
- value: value,
- name: name
- });
- form.appendChild(hiddenItem);
- hiddens.push(hiddenItem);
- },
- hiddenItem, obj, value, name, vLen, v, hLen, h;
-
- frame.set({
- name: id,
- cls: Ext.baseCSSPrefix + 'hidden-display',
- src: Ext.SSL_SECURE_URL,
- tabIndex: -1
- });
- document.body.appendChild(frameDom);
- document.body.appendChild(form);
-
- if (document.frames) {
- document.frames[id].name = id;
- }
- Ext.fly(form).set({
- target: id,
- method: 'POST',
- enctype: encoding,
- encoding: encoding,
- action: url || buf.action
- });
-
- if (params) {
- obj = Ext.Object.fromQueryString(params) || {};
- for (name in obj) {
- if (obj.hasOwnProperty(name)) {
- value = obj[name];
- if (Ext.isArray(value)) {
- vLen = value.length;
- for (v = 0; v < vLen; v++) {
- addField(name, value[v]);
- }
- } else {
- addField(name, value);
- }
- }
- }
- }
- this.frame = frame;
- frame.on({
- load: this.onComplete,
- scope: this,
-
- single: !Ext.isOpera
- });
- form.submit();
- document.body.removeChild(form);
-
- Ext.fly(form).set(buf);
- for (hLen = hiddens.length , h = 0; h < hLen; h++) {
- Ext.removeNode(hiddens[h]);
- }
- return form;
- },
- getDoc: function() {
- var frame = this.frame.dom;
- return (frame && (frame.contentWindow.document || frame.contentDocument)) || (window.frames[frame.id] || {}).document;
- },
- getTimeout: function() {
-
-
-
- return this.options.timeout;
- },
-
- onComplete: function() {
- var me = this,
- frame = me.frame,
- owner = me.owner,
- options = me.options,
- callback, doc, success, contentNode, response;
-
- if (!frame) {
- return;
- }
- if (me.aborted || me.timedout) {
- me.result = response = me.createException();
- response.responseXML = null;
- response.responseText = Ext.encode({
- success: false,
- message: Ext.String.trim(response.statusText)
- });
- response.request = me;
- callback = options.failure;
- success = false;
- } else {
- try {
- doc = me.getDoc();
-
- me.result = response = {
- responseText: '',
- responseXML: null,
- request: me
- };
-
-
- if (doc) {
-
- if (Ext.isOpera && doc.location == Ext.SSL_SECURE_URL) {
- return;
- }
- if (doc.body) {
-
-
-
- if ((contentNode = doc.body.firstChild) && /pre/i.test(contentNode.tagName)) {
- response.responseText = contentNode.textContent || contentNode.innerText;
- }
-
-
-
- else if ((contentNode = doc.getElementsByTagName('textarea')[0])) {
- response.responseText = contentNode.value;
- } else
-
- {
- response.responseText = doc.body.textContent || doc.body.innerText;
- }
- }
-
-
- response.responseXML = doc.XMLDocument || doc;
- callback = options.success;
- success = true;
- response.status = 200;
- } else {
- Ext.raise("Could not acquire a suitable connection for the file upload service.");
- }
- } catch (e) {
- me.result = response = me.createException();
-
- response.status = 400;
- response.statusText = (e.message || e.description) + '';
- response.responseText = Ext.encode({
- success: false,
- message: Ext.String.trim(response.statusText)
- });
- response.responseXML = null;
- callback = options.failure;
- success = false;
- }
- }
- me.frame = null;
- me.success = success;
- owner.fireEvent(success ? 'requestcomplete' : 'requestexception', owner, response, options);
- Ext.callback(callback, options.scope, [
- response,
- options
- ]);
- Ext.callback(options.callback, options.scope, [
- options,
- success,
- response
- ]);
- owner.onRequestComplete(me);
-
- Ext.asap(frame.destroy, frame);
- me.callParent();
- },
- destroy: function() {
- this.cleanup();
- this.callParent();
- }
- });
- Ext.define('Ext.data.Connection', {
- mixins: {
- observable: Ext.mixin.Observable
- },
- statics: {
- requestId: 0
- },
- enctypeRe: /multipart\/form-data/i,
- config: {
-
- url: null,
-
- async: true,
-
- username: '',
-
- password: '',
-
- disableCaching: true,
-
- withCredentials: false,
-
- binary: false,
-
- cors: false,
- isXdr: false,
- defaultXdrContentType: 'text/plain',
-
- disableCachingParam: '_dc',
-
- timeout: 30000,
-
- extraParams: null,
-
- autoAbort: false,
-
- method: null,
-
- defaultHeaders: null,
-
- defaultPostHeader: 'application/x-www-form-urlencoded; charset=UTF-8',
-
- useDefaultXhrHeader: true,
-
- defaultXhrHeader: 'XMLHttpRequest'
- },
-
-
-
- constructor: function(config) {
-
- this.mixins.observable.constructor.call(this, config);
- this.requests = {};
- },
-
- request: function(options) {
- options = options || {};
- var me = this,
- requestOptions, request;
- if (me.fireEvent('beforerequest', me, options) !== false) {
- requestOptions = me.setOptions(options, options.scope || Ext.global);
- request = me.createRequest(options, requestOptions);
- return request.start(requestOptions.data);
- }
-
- request = {
- status: -1,
- statusText: 'Request cancelled in beforerequest event handler'
- };
- Ext.callback(options.callback, options.scope, [
- options,
- false,
- request
- ]);
- return Ext.Deferred.rejected([
- options,
- false,
- request
- ]);
- },
- createRequest: function(options, requestOptions) {
- var me = this,
- type = options.type || requestOptions.type,
- request;
-
- if (!type) {
- type = me.isFormUpload(options) ? 'form' : 'ajax';
- }
-
- if (options.autoAbort || me.getAutoAbort()) {
- me.abort();
- }
-
-
-
-
-
-
-
- request = Ext.Factory.request({
- type: type,
- owner: me,
- options: options,
- requestOptions: requestOptions,
- ownerConfig: me.getConfig()
- });
- me.requests[request.id] = request;
- me.latestId = request.id;
- return request;
- },
-
- isFormUpload: function(options) {
- var form = this.getForm(options);
- if (form) {
- return options.isUpload || this.enctypeRe.test(form.getAttribute('enctype'));
- }
- return false;
- },
-
- getForm: function(options) {
- return Ext.getDom(options.form);
- },
-
- setOptions: function(options, scope) {
- var me = this,
- params = options.params || {},
- extraParams = me.getExtraParams(),
- urlParams = options.urlParams,
- url = options.url || me.getUrl(),
- cors = options.cors,
- jsonData = options.jsonData,
- method, disableCache, data;
- if (cors !== undefined) {
- me.setCors(cors);
- }
-
- if (Ext.isFunction(params)) {
- params = params.call(scope, options);
- }
-
- if (Ext.isFunction(url)) {
- url = url.call(scope, options);
- }
- url = this.setupUrl(options, url);
-
- if (!url) {
- Ext.raise({
- options: options,
- msg: 'No URL specified'
- });
- }
-
-
- data = options.rawData || options.binaryData || options.xmlData || jsonData || null;
- if (jsonData && !Ext.isPrimitive(jsonData)) {
- data = Ext.encode(data);
- }
-
- if (options.binaryData) {
-
- if (!Ext.isArray(options.binaryData)) {
- Ext.log.warn("Binary submission data must be an array of byte values! Instead got " + typeof (options.binaryData));
- }
-
- if (me.nativeBinaryPostSupport()) {
- data = (new Uint8Array(options.binaryData));
- if ((Ext.isChrome && Ext.chromeVersion < 22) || Ext.isSafari || Ext.isGecko) {
- data = data.buffer;
- }
- }
- }
-
-
- if (Ext.isObject(params)) {
- params = Ext.Object.toQueryString(params);
- }
- if (Ext.isObject(extraParams)) {
- extraParams = Ext.Object.toQueryString(extraParams);
- }
- params = params + ((extraParams) ? ((params) ? '&' : '') + extraParams : '');
- urlParams = Ext.isObject(urlParams) ? Ext.Object.toQueryString(urlParams) : urlParams;
- params = this.setupParams(options, params);
-
- method = (options.method || me.getMethod() || ((params || data) ? 'POST' : 'GET')).toUpperCase();
- this.setupMethod(options, method);
- disableCache = options.disableCaching !== false ? (options.disableCaching || me.getDisableCaching()) : false;
-
- if (method === 'GET' && disableCache) {
- url = Ext.urlAppend(url, (options.disableCachingParam || me.getDisableCachingParam()) + '=' + (new Date().getTime()));
- }
-
- if ((method == 'GET' || data) && params) {
- url = Ext.urlAppend(url, params);
- params = null;
- }
-
- if (urlParams) {
- url = Ext.urlAppend(url, urlParams);
- }
- return {
- url: url,
- method: method,
- data: data || params || null
- };
- },
-
- setupUrl: function(options, url) {
- var form = this.getForm(options);
- if (form) {
- url = url || form.action;
- }
- return url;
- },
-
- setupParams: function(options, params) {
- var form = this.getForm(options),
- serializedForm;
- if (form && !this.isFormUpload(options)) {
- serializedForm = Ext.Element.serializeForm(form);
- params = params ? (params + '&' + serializedForm) : serializedForm;
- }
- return params;
- },
-
- setupMethod: function(options, method) {
- if (this.isFormUpload(options)) {
- return 'POST';
- }
- return method;
- },
-
- isLoading: function(request) {
- if (!request) {
- request = this.getLatest();
- }
- return request ? request.isLoading() : false;
- },
-
- abort: function(request) {
- if (!request) {
- request = this.getLatest();
- }
- if (request && request.isLoading()) {
- request.abort();
- }
- },
-
- abortAll: function() {
- var requests = this.requests,
- id;
- for (id in requests) {
- this.abort(requests[id]);
- }
- },
-
- getLatest: function() {
- var id = this.latestId,
- request;
- if (id) {
- request = this.requests[id];
- }
- return request || null;
- },
-
- clearTimeout: function(request) {
- if (!request) {
- request = this.getLatest();
- }
- if (request) {
- request.clearTimer();
- }
- },
- onRequestComplete: function(request) {
- delete this.requests[request.id];
- },
-
- nativeBinaryPostSupport: function() {
- return Ext.isChrome || (Ext.isSafari && Ext.isDefined(window.Uint8Array)) || (Ext.isGecko && Ext.isDefined(window.Uint8Array));
- }
- });
- Ext.define('Ext.Ajax', {
- extend: Ext.data.Connection,
- singleton: true,
-
-
-
-
-
-
-
-
-
-
-
-
-
- autoAbort: false
- });
- Ext.define('Ext.AnimationQueue', {
- singleton: true,
- constructor: function() {
- var me = this;
- me.queue = [];
- me.taskQueue = [];
- me.runningQueue = [];
- me.idleQueue = [];
- me.isRunning = false;
- me.isIdle = true;
- me.run = me.run.bind(me);
-
-
-
-
-
-
- if (Ext.os.is.iOS) {
-
- me.watch.$skipTimerCheck = true;
-
- me.watchdogTimer = Ext.interval(me.watch, 500, me);
- }
- },
-
- start: function(fn, scope, args) {
- var me = this;
- me.queue.push(arguments);
- if (!me.isRunning) {
- if (me.hasOwnProperty('idleTimer')) {
- Ext.undefer(me.idleTimer);
- delete me.idleTimer;
- }
- if (me.hasOwnProperty('idleQueueTimer')) {
- Ext.undefer(me.idleQueueTimer);
- delete me.idleQueueTimer;
- }
- me.isIdle = false;
- me.isRunning = true;
-
- me.startCountTime = Ext.now();
- me.count = 0;
-
- me.doStart();
- }
- },
- clear: function() {
- var me = this;
- Ext.undefer(me.idleTimer);
- Ext.undefer(me.idleQueueTimer);
- Ext.unraf(me.animationFrameId);
- me.idleTimer = me.idleQueueTimer = me.animationFrameId = null;
- me.queue.length = me.taskQueue.length = me.runningQueue.length = me.idleQueue.length = 0;
- me.isRunning = false;
- me.isIdle = true;
-
- me.startCountTime = Ext.now();
- me.count = 0;
- },
-
- watch: function() {
- if (this.isRunning && Ext.now() - this.lastRunTime >= 500) {
- this.run();
- }
- },
- run: function() {
- var me = this,
- item, element;
-
- me.animationFrameId = null;
- if (!me.isRunning) {
- return;
- }
- var queue = me.runningQueue,
- now = Ext.now(),
- i, ln;
- me.lastRunTime = now;
- me.frameStartTime = now;
-
-
-
-
-
- i = me.queue.length;
- while (i--) {
- item = me.queue[i];
- element = item[1] && item[1].getElement && item[1].getElement();
- if (element && element.destroyed) {
- me.queue.splice(i, 1);
- }
- }
- queue.push.apply(queue, me.queue);
-
- for (i = 0 , ln = queue.length; i < ln; i++) {
- me.invoke(queue[i]);
- }
- queue.length = 0;
-
- var elapse = me.frameStartTime - me.startCountTime,
- count = ++me.count;
- if (elapse >= 200) {
- me.onFpsChanged(count * 1000 / elapse, count, elapse);
- me.startCountTime = me.frameStartTime;
- me.count = 0;
- }
-
- if (!me.queue.length) {
- me.stop();
- }
-
- if (me.isRunning) {
- me.doIterate();
- }
- },
-
- onFpsChanged: Ext.emptyFn,
- onStop: Ext.emptyFn,
-
- doStart: function() {
- if (!this.animationFrameId) {
- this.animationFrameId = Ext.raf(this.run);
- }
- this.lastRunTime = Ext.now();
- },
- doIterate: function() {
- if (!this.animationFrameId) {
- this.animationFrameId = Ext.raf(this.run);
- }
- },
- doStop: function() {
- if (this.animationFrameId) {
- Ext.unraf(this.animationFrameId);
- }
- this.animationFrameId = null;
- },
-
- stop: function(fn, scope, args) {
- var me = this;
- if (!me.isRunning) {
- return;
- }
- var queue = me.queue,
- ln = queue.length,
- i, item;
- for (i = 0; i < ln; i++) {
- item = queue[i];
- if (item[0] === fn && item[1] === scope && item[2] === args) {
- queue.splice(i, 1);
- i--;
- ln--;
- }
- }
- if (ln === 0) {
- me.doStop();
-
- me.onStop();
-
- me.isRunning = false;
- if (me.idleQueue.length && !me.idleTimer) {
- me.idleTimer = Ext.defer(me.whenIdle, 100, me);
- }
- }
- },
- onIdle: function(fn, scope, args) {
- var me = this,
- listeners = me.idleQueue,
- i, ln, listener;
- for (i = 0 , ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- if (fn === listener[0] && scope === listener[1] && args === listener[2]) {
- return;
- }
- }
- listeners.push(arguments);
- if (me.isIdle) {
- me.processIdleQueue();
- } else if (!me.idleTimer) {
- me.idleTimer = Ext.defer(me.whenIdle, 100, me);
- }
- },
- unIdle: function(fn, scope, args) {
- var me = this,
- listeners = me.idleQueue,
- i, ln, listener;
- for (i = 0 , ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- if (fn === listener[0] && scope === listener[1] && args === listener[2]) {
- listeners.splice(i, 1);
- return true;
- }
- }
- if (!listeners.length && me.idleTimer) {
- Ext.undefer(me.idleTimer);
- delete me.idleTimer;
- }
- if (!listeners.length && me.idleQueueTimer) {
- Ext.undefer(me.idleQueueTimer);
- delete me.idleQueueTimer;
- }
- return false;
- },
- queueTask: function(fn, scope, args) {
- this.taskQueue.push(arguments);
- this.processTaskQueue();
- },
- dequeueTask: function(fn, scope, args) {
- var listeners = this.taskQueue,
- i, ln, listener;
- for (i = 0 , ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- if (fn === listener[0] && scope === listener[1] && args === listener[2]) {
- listeners.splice(i, 1);
- i--;
- ln--;
- }
- }
- },
- invoke: function(listener) {
- var fn = listener[0],
- scope = listener[1],
- args = listener[2];
- fn = (typeof fn == 'string' ? scope[fn] : fn);
- if (Ext.isArray(args)) {
- fn.apply(scope, args);
- } else {
- fn.call(scope, args);
- }
- },
- whenIdle: function() {
- delete this.idleTimer;
- this.isIdle = true;
- this.processIdleQueue();
- },
- processIdleQueue: function() {
- if (!this.hasOwnProperty('idleQueueTimer')) {
- this.idleQueueTimer = Ext.defer(this.processIdleQueueItem, 1, this);
- }
- },
- processIdleQueueItem: function() {
- delete this.idleQueueTimer;
- if (!this.isIdle) {
- return;
- }
- var listeners = this.idleQueue,
- listener;
- if (listeners.length > 0) {
- listener = listeners.shift();
- this.invoke(listener);
- this.processIdleQueue();
- }
- },
- processTaskQueue: function() {
- if (!this.hasOwnProperty('taskQueueTimer')) {
- this.taskQueueTimer = Ext.defer(this.processTaskQueueItem, 15, this);
- }
- },
- processTaskQueueItem: function() {
- delete this.taskQueueTimer;
- var listeners = this.taskQueue,
- listener;
- if (listeners.length > 0) {
- listener = listeners.shift();
- this.invoke(listener);
- this.processTaskQueue();
- }
- },
-
-
- showFps: function() {
- var styleTpl = {
- color: 'white',
- 'background-color': 'black',
- 'text-align': 'center',
- 'font-family': 'sans-serif',
- 'font-size': '8px',
- 'font-weight': 'normal',
- 'font-style': 'normal',
- 'line-height': '20px',
- '-webkit-font-smoothing': 'antialiased',
- 'zIndex': 100000,
- position: 'absolute'
- };
- Ext.getBody().append([
-
- {
- style: Ext.applyIf({
- bottom: '50px',
- left: 0,
- width: '50px',
- height: '20px'
- }, styleTpl),
- html: 'Average'
- },
- {
- style: Ext.applyIf({
- 'background-color': 'red',
- 'font-size': '18px',
- 'line-height': '50px',
- bottom: 0,
- left: 0,
- width: '50px',
- height: '50px'
- }, styleTpl),
- id: '__averageFps',
- html: '0'
- },
-
- {
- style: Ext.applyIf({
- bottom: '50px',
- left: '50px',
- width: '50px',
- height: '20px'
- }, styleTpl),
- html: 'Min (Last 1k)'
- },
- {
- style: Ext.applyIf({
- 'background-color': 'orange',
- 'font-size': '18px',
- 'line-height': '50px',
- bottom: 0,
- left: '50px',
- width: '50px',
- height: '50px'
- }, styleTpl),
- id: '__minFps',
- html: '0'
- },
-
- {
- style: Ext.applyIf({
- bottom: '50px',
- left: '100px',
- width: '50px',
- height: '20px'
- }, styleTpl),
- html: 'Max (Last 1k)'
- },
- {
- style: Ext.applyIf({
- 'background-color': 'maroon',
- 'font-size': '18px',
- 'line-height': '50px',
- bottom: 0,
- left: '100px',
- width: '50px',
- height: '50px'
- }, styleTpl),
- id: '__maxFps',
- html: '0'
- },
-
- {
- style: Ext.applyIf({
- bottom: '50px',
- left: '150px',
- width: '50px',
- height: '20px'
- }, styleTpl),
- html: 'Current'
- },
- {
- style: Ext.applyIf({
- 'background-color': 'green',
- 'font-size': '18px',
- 'line-height': '50px',
- bottom: 0,
- left: '150px',
- width: '50px',
- height: '50px'
- }, styleTpl),
- id: '__currentFps',
- html: '0'
- }
- ]);
- Ext.AnimationQueue.resetFps();
- },
- resetFps: function() {
- var currentFps = Ext.get('__currentFps'),
- averageFps = Ext.get('__averageFps'),
- minFps = Ext.get('__minFps'),
- maxFps = Ext.get('__maxFps'),
- min = 1000,
- max = 0,
- count = 0,
- sum = 0;
- if (!currentFps) {
- return;
- }
- Ext.AnimationQueue.onFpsChanged = function(fps) {
- count++;
- if (!(count % 10)) {
- min = 1000;
- max = 0;
- }
- sum += fps;
- min = Math.min(min, fps);
- max = Math.max(max, fps);
- currentFps.setHtml(Math.round(fps));
-
- averageFps.setHtml(Math.round(sum / count));
- minFps.setHtml(Math.round(min));
- maxFps.setHtml(Math.round(max));
- };
- }
- }, function() {
-
- var paramsString = window.location.search.substr(1),
- paramsArray = paramsString.split("&");
- if (Ext.Array.contains(paramsArray, "showfps")) {
- Ext.onReady(this.showFps.bind(this));
- }
- });
- Ext.define('Ext.mixin.Bufferable', function(Bufferable) {
- return {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'bufferable',
- before: {
- destroy: 'cancelAllCalls'
- },
- extended: function(baseClass, derivedClass, classBody) {
- var bufferableMethods = classBody.bufferableMethods;
- if (bufferableMethods) {
- delete classBody.bufferableMethods;
- Bufferable.processClass(derivedClass, bufferableMethods);
- }
- }
- },
- afterClassMixedIn: function(targetClass) {
- Bufferable.processClass(targetClass);
- },
- privates: {
-
- cancelAllCalls: function() {
- var bufferables = this.bufferables,
- name;
- if (bufferables) {
- for (name in bufferables) {
- bufferables[name].cancel();
- delete bufferables[name];
- }
- }
- },
-
- cancelBufferedCall: function(name, invoke) {
- var bufferables = this.bufferables,
- timer = bufferables && bufferables[name];
- if (timer) {
- timer[invoke ? 'invoke' : 'cancel']();
- }
- return !!timer;
- },
-
- flushBufferedCall: function(name) {
- return this.cancelBufferedCall(name, true);
- },
-
- initBufferables: function() {
- var me = this,
- methods = me.hasOwnProperty('bufferableMethods') && me.bufferableMethods,
- classMethods;
- if (methods) {
- Bufferable._canonicalize(methods);
- classMethods = me.self.prototype.bufferableMethods;
- me.bufferableMethods = Ext.merge(Ext.clone(classMethods), methods);
- }
- return (me.bufferables = {});
- },
-
- isCallPending: function(name) {
- var bufferables = this.bufferables,
- timer = bufferables && bufferables[name];
- return !!timer;
- },
- statics: {
- SINGLE: {
- single: true
- },
- _canonicalize: function(methods) {
- var t, def, s, name;
- for (name in methods) {
- s = Ext.String.capitalize(name);
- def = methods[name];
- t = typeof def;
- if (t === 'number' || t === 'string') {
-
-
-
-
- methods[name] = def = {
- delay: def
- };
- }
- if (typeof (t = def.delay) === 'string') {
-
-
-
- def[t] = true;
- delete def.delay;
- }
- def.capitalized = s;
- def.name = name;
- if (!def.fn) {
- def.fn = 'do' + s;
- }
- if (!def.flag) {
- def.flag = 'is' + s + 'Pending';
- }
- }
- },
- _canceller: function() {
- var timer = this,
-
- id = timer.id;
- if (id) {
- if (timer.delay) {
- Ext.undefer(id);
- } else if (timer.asap) {
- Ext.unasap(id);
- } else if (timer.idle) {
- Ext.un('idle', id, null, Bufferable.SINGLE);
- } else if (timer.raf) {
- Ext.unraf(id);
- }
- timer.id = null;
- }
- timer.args = null;
- timer.target[timer.flag] = false;
- },
- _invoker: function() {
- var timer = this,
-
- args = timer.args || Ext.emptyArray,
- target = timer.target;
-
- ++timer.invokes;
-
- timer.cancel();
- target[timer.fn].apply(target, args);
- },
- delayCall: function(target, def, args) {
- var bufferables = target.bufferables || target.initBufferables(),
- name = def.name,
- timer = bufferables[name] || (bufferables[name] = Ext.apply({
-
- calls: 0,
- invokes: 0,
-
- args: null,
- cancel: Bufferable._canceller,
- id: null,
- target: target,
- invoke: Bufferable._invoker
- }, def)),
- delay = def.delay,
- exec = function() {
- if (timer.id) {
- timer.id = null;
- timer.invoke();
- }
- };
- if (timer.id) {
- timer.cancel();
- }
- timer.args = args;
-
- ++timer.calls;
-
- target[timer.flag] = true;
- if (delay) {
- timer.id = Ext.defer(exec, delay);
- } else if (def.asap) {
- timer.id = Ext.asap(exec);
- } else if (def.idle) {
- timer.id = exec;
- Ext.on('idle', exec, null, Bufferable.SINGLE);
- } else if (def.raf) {
- timer.id = Ext.raf(exec);
- } else {
-
- timer.invoke();
- }
- },
- processClass: function(cls, bufferableMethods) {
- var proto = cls.prototype,
- inherited = proto.bufferableMethods,
- def, name;
- if (bufferableMethods) {
-
- Bufferable._canonicalize(bufferableMethods);
- if (inherited) {
-
-
-
- inherited = Ext.merge(Ext.clone(inherited), bufferableMethods);
- }
- proto.bufferableMethods = inherited || bufferableMethods;
- } else {
-
-
-
- bufferableMethods = inherited;
- Bufferable._canonicalize(bufferableMethods);
-
- proto.bufferables = null;
- }
- if (bufferableMethods) {
- for (name in bufferableMethods) {
- if (!proto[name]) {
- def = bufferableMethods[name];
- Bufferable.processMethod(proto, def, Array.prototype.slice);
- }
- }
- }
- },
- processMethod: function(proto, def, slice) {
- var name = def.name,
- cap = def.capitalized;
- proto[name] = function() {
- return Bufferable.delayCall(this, def, slice.call(arguments));
- };
- proto['cancel' + cap] = function() {
- return this.cancelBufferedCall(name);
- };
- proto['flush' + cap] = function() {
- return this.flushBufferedCall(name);
- };
- }
- }
- }
- };
- });
- Ext.define('Ext.ComponentManager', {
- alternateClassName: 'Ext.ComponentMgr',
- singleton: true,
- mixins: [
- Ext.mixin.Bufferable
- ],
- count: 0,
- referencesDirty: true,
- referenceRepairs: 0,
- typeName: 'xtype',
- bufferableMethods: {
- handleDocumentMouseDown: 'asap'
- },
-
- constructor: function(config) {
- var me = this;
- Ext.apply(me, config);
- me.all = {};
- me.byInstanceId = {};
- me.holders = {};
- me.names = {};
- me.references = {};
- me.onAvailableCallbacks = {};
- },
-
- create: function(config, defaultType) {
- if (typeof config === 'string') {
- return Ext.widget(config);
- }
- if (config.isComponent) {
- return config;
- }
- if ('xclass' in config) {
- return Ext.create(config.xclass, config);
- }
- return Ext.widget(config.xtype || defaultType, config);
- },
-
- get: function(id) {
- return this.all[id];
- },
- register: function(component) {
- var me = this,
- id = component.getId(),
- onAvailableCallbacks = me.onAvailableCallbacks;
-
- if (id === undefined) {
- Ext.raise('Component id is undefined. Please ensure the component has an id.');
- }
- if (id in me.all) {
- Ext.raise('Duplicate component id "' + id + '"');
- }
- if (component.$iid in me.byInstanceId) {
- Ext.raise('Duplicate component instance id "' + component.$iid + '"');
- }
-
- me.all[id] = component;
- me.byInstanceId[component.$iid] = component;
- if (component.reference) {
- me.references[id] = component;
- }
- if (component.name && component.nameable) {
- me.names[id] = component;
- }
- if (component.nameHolder || component.referenceHolder) {
- me.holders[id] = component;
- }
- ++me.count;
- if (!me.hasFocusListener) {
- me.installFocusListener();
- }
- onAvailableCallbacks = onAvailableCallbacks && onAvailableCallbacks[id];
- if (onAvailableCallbacks && onAvailableCallbacks.length) {
- me.notifyAvailable(component);
- }
- },
- unregister: function(component) {
- var me = this,
- all = me.all,
- byInstanceId = me.byInstanceId,
- holders = me.holders,
- references = me.references,
- names = me.names,
- id = component.getId();
- if (id in holders) {
-
-
-
- holders[id] = null;
- delete holders[id];
- }
- if (id in names) {
- names[id] = null;
- delete names[id];
- }
- if (id in references) {
- references[id] = null;
- delete references[id];
- }
- all[id] = null;
- delete all[id];
- id = component.$iid;
- byInstanceId[id] = null;
- delete byInstanceId[id];
- --me.count;
- },
- markReferencesDirty: function() {
- var me = this,
- holders = me.holders,
- key;
- if (!me.referencesDirty) {
-
- for (key in holders) {
- holders[key].refs = holders[key].nameRefs = null;
- }
- me.referencesDirty = true;
- }
- },
- fixReferences: function() {
- var me = this,
- references = me.references,
- names = me.names,
- key;
- if (me.referencesDirty) {
- ++me.referenceRepairs;
- for (key in references) {
- references[key]._fixReference();
- }
- for (key in names) {
- names[key]._fixName();
- }
- me.referencesDirty = false;
- }
- },
-
- onAvailable: function(id, fn, scope) {
- var me = this,
- callbacks = me.onAvailableCallbacks,
- all = me.all,
- item;
- if (id in all) {
-
- item = all[id];
- fn.call(scope || item, item);
- } else if (id) {
-
- if (!Ext.isArray(callbacks[id])) {
- callbacks[id] = [];
- }
- callbacks[id].push(function(item) {
- fn.call(scope || item, item);
- });
- }
- },
-
- notifyAvailable: function(item) {
- var callbacks = this.onAvailableCallbacks[item && item.getId()] || [];
- while (callbacks.length) {
- (callbacks.shift())(item);
- }
- },
-
- each: function(fn, scope) {
- Ext.Object.each(this.all, fn, scope);
- },
-
- getCount: function() {
- return this.count;
- },
-
- getAll: function() {
- return Ext.Object.getValues(this.all);
- },
-
- getActiveComponent: function() {
- return Ext.Component.from(Ext.dom.Element.getActiveElement());
- },
-
- onGlobalFocus: function(e) {
- var me = this,
- event = e.event,
- toComponent = event.toComponent = e.toComponent = Ext.Component.from(e.toElement),
- fromComponent = event.fromComponent = e.fromComponent = Ext.Component.from(e.fromElement),
- commonAncestor = me.getCommonAncestor(fromComponent, toComponent),
- targetComponent;
-
- if (toComponent !== fromComponent) {
- if (fromComponent && !fromComponent.destroyed && !fromComponent.isDestructing()) {
- if (fromComponent.handleBlurEvent) {
- fromComponent.handleBlurEvent(e);
- }
-
- for (targetComponent = fromComponent; targetComponent && targetComponent !== commonAncestor; targetComponent = targetComponent.getRefOwner()) {
- if (!(targetComponent.destroyed || targetComponent.destroying)) {
- e.type = 'focusleave';
- targetComponent.onFocusLeave(event);
- }
- }
- }
- if (toComponent && !toComponent.destroyed && !toComponent.isDestructing()) {
- if (toComponent.handleFocusEvent) {
- toComponent.handleFocusEvent(e);
- }
-
- for (targetComponent = toComponent; targetComponent && targetComponent !== commonAncestor; targetComponent = targetComponent.getRefOwner()) {
- e.type = 'focusenter';
- targetComponent.onFocusEnter(event);
- }
- }
- }
- for (targetComponent = commonAncestor; targetComponent; targetComponent = targetComponent.getRefOwner()) {
- if (!(targetComponent.destroying || targetComponent.destroyed)) {
- targetComponent.onFocusMove(e);
- }
- }
- },
- getCommonAncestor: function(compA, compB) {
- if (compA === compB) {
- return compA;
- }
- while (compA && !(compA.isAncestor(compB) || compA === compB)) {
- compA = compA.getRefOwner();
- }
- return compA;
- },
- privates: {
-
- doHandleDocumentMouseDown: function(e) {
- var floatedSelector = Ext.Widget.prototype.floatedSelector,
- targetFloated;
-
-
- if (floatedSelector) {
- targetFloated = Ext.Component.from(e.getTarget(floatedSelector, Ext.getBody()));
-
- if (targetFloated) {
- targetFloated.toFront(true);
- }
- }
- },
- installFocusListener: function() {
- var me = this;
- Ext.on('focus', me.onGlobalFocus, me);
- me.hasFocusListener = true;
- },
- clearAll: function() {
- this.all = {};
- this.names = {};
- this.references = {};
- this.onAvailableCallbacks = {};
- },
-
- from: function(el, limit, selector) {
- if (el && el.isEvent) {
- el = el.target;
- }
- var target = Ext.getDom(el),
- cache = this.all,
- depth = 0,
- topmost, cmpId, cmp;
- if (typeof limit !== 'number') {
- topmost = Ext.getDom(limit);
- limit = Number.MAX_VALUE;
- }
- while (target && target.nodeType === 1 && depth < limit && target !== topmost) {
- cmpId = target.getAttribute('data-componentid') || target.id;
- if (cmpId) {
- cmp = cache[cmpId];
- if (cmp && (!selector || Ext.ComponentQuery.is(cmp, selector))) {
- return cmp;
- }
-
- depth++;
- }
- target = target.parentNode;
- }
- return null;
- }
- }
- }, function() {
- var ComponentManager = Ext.ComponentManager;
-
- ComponentManager.fromElement = ComponentManager.from;
-
- Ext.getCmp = function(id) {
- return ComponentManager.get(id);
- };
- Ext.iidToCmp = function(iid) {
- return ComponentManager.byInstanceId[iid] || null;
- };
-
- Ext.doEv = function(node, e) {
- var cmp, method, event;
-
-
- cmp = Ext.Component.from(e.target);
- if (cmp && !cmp.destroying && !cmp.destroyed && cmp.getEventHandlers) {
- method = cmp.getEventHandlers()[e.type];
- if (method && cmp[method]) {
- event = new Ext.event.Event(e);
- return cmp[method](event);
- }
- }
- return true;
- };
- });
- Ext.ns('Ext.util').Operators = {
-
- "=": function(a, v) {
- return a == v;
- },
- "!=": function(a, v) {
- return a != v;
- },
- "^=": function(a, v) {
- return a && a.substr(0, v.length) == v;
- },
- "$=": function(a, v) {
- return a && a.substr(a.length - v.length) == v;
- },
- "*=": function(a, v) {
- return a && a.indexOf(v) !== -1;
- },
- "%=": function(a, v) {
- return (a % v) === 0;
- },
- "|=": function(a, v) {
- return a && (a == v || a.substr(0, v.length + 1) == v + '-');
- },
- "~=": function(a, v) {
- return a && (' ' + a + ' ').indexOf(' ' + v + ' ') != -1;
- }
- };
- Ext.define('Ext.util.LruCache', {
- extend: Ext.util.HashMap,
- config: {
-
- maxSize: null
- },
-
- add: function(key, newValue) {
- var me = this,
- entry, last;
- me.removeAtKey(key);
- last = me.last;
- entry = {
- prev: last,
- next: null,
- key: key,
- value: newValue
- };
- if (last) {
-
- last.next = entry;
- } else {
-
- me.first = entry;
- }
- me.last = entry;
- me.callParent([
- key,
- entry
- ]);
- me.prune();
- return newValue;
- },
-
- insertBefore: function(key, newValue, sibling) {
- var me = this,
- existingKey, entry;
-
-
- if (sibling = this.map[this.findKey(sibling)]) {
- existingKey = me.findKey(newValue);
-
- if (existingKey) {
- me.unlinkEntry(entry = me.map[existingKey]);
- } else
- {
- entry = {
- prev: sibling.prev,
- next: sibling,
- key: key,
- value: newValue
- };
- }
- if (sibling.prev) {
- entry.prev.next = entry;
- } else {
- me.first = entry;
- }
- entry.next = sibling;
- sibling.prev = entry;
- me.prune();
- return newValue;
- } else
- {
- return me.add(key, newValue);
- }
- },
-
- get: function(key) {
- var entry = this.map[key];
- if (entry) {
-
- if (entry.next) {
- this.moveToEnd(entry);
- }
- return entry.value;
- }
- },
-
- removeAtKey: function(key) {
- this.unlinkEntry(this.map[key]);
- return this.callParent(arguments);
- },
-
- clear: function(initial) {
- this.first = this.last = null;
- return this.callParent([
- initial
- ]);
- },
-
- unlinkEntry: function(entry) {
-
- if (entry) {
- if (entry.next) {
- entry.next.prev = entry.prev;
- } else {
- this.last = entry.prev;
- }
- if (entry.prev) {
- entry.prev.next = entry.next;
- } else {
- this.first = entry.next;
- }
- entry.prev = entry.next = null;
- }
- },
-
- moveToEnd: function(entry) {
- this.unlinkEntry(entry);
-
-
- if (entry.prev = this.last) {
- this.last.next = entry;
- } else
- {
- this.first = entry;
- }
- this.last = entry;
- },
-
- getArray: function(isKey) {
- var arr = [],
- entry = this.first;
- while (entry) {
- arr.push(isKey ? entry.key : entry.value);
- entry = entry.next;
- }
- return arr;
- },
-
- each: function(fn, scope, reverse) {
- var me = this,
- entry = reverse ? me.last : me.first,
- length = me.length;
- scope = scope || me;
- while (entry) {
- if (fn.call(scope, entry.key, entry.value, length) === false) {
- break;
- }
- entry = reverse ? entry.prev : entry.next;
- }
- return me;
- },
-
- findKey: function(value) {
- var key,
- map = this.map;
- for (key in map) {
-
-
- if (map.hasOwnProperty(key) && map[key].value === value) {
- return key;
- }
- }
- return undefined;
- },
-
- clone: function() {
- var newCache = new this.self(this.initialConfig),
- map = this.map,
- key;
- newCache.suspendEvents();
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- newCache.add(key, map[key].value);
- }
- }
- newCache.resumeEvents();
- return newCache;
- },
-
- prune: function() {
- var me = this,
- max = me.getMaxSize(),
- purgeCount = max ? (me.length - max) : 0;
- if (purgeCount > 0) {
- for (; me.first && purgeCount; purgeCount--) {
- me.removeAtKey(me.first.key);
- }
- }
- }
- });
- Ext.define('Ext.ComponentQuery', {
- singleton: true
- }, function() {
- var cq = this,
- queryOperators = Ext.util.Operators,
- nthRe = /(\d*)n\+?(\d*)/,
- nthRe2 = /\D/,
- stripLeadingSpaceRe = /^(\s)+/,
- unescapeRe = /\\(.)/g,
- regexCache = new Ext.util.LruCache({
- maxSize: 100
- }),
-
-
- filterFnPattern = [
- 'var r = [],',
- 'i = 0,',
- 'it = items,',
- 'l = it.length,',
- 'c;',
- 'for (; i < l; i++) {',
- 'c = it[i];',
- 'if (c.{0}) {',
- 'r.push(c);',
- '}',
- '}',
- 'return r;'
- ].join(''),
- filterItems = function(items, operation) {
-
-
-
- return operation.method.apply(this, [
- items
- ].concat(operation.args));
- },
- getItems = function(items, mode) {
- var result = [],
- i = 0,
- length = items.length,
- candidate,
- deep = mode !== '>';
- for (; i < length; i++) {
- candidate = items[i];
- if (candidate.getRefItems) {
- result = result.concat(candidate.getRefItems(deep));
- }
- }
- return result;
- },
- getAncestors = function(items) {
- var result = [],
- i = 0,
- length = items.length,
- candidate;
- for (; i < length; i++) {
- candidate = items[i];
- while (!!(candidate = candidate.getRefOwner())) {
- result.push(candidate);
- }
- }
- return result;
- },
-
- filterByXType = function(items, xtype, shallow) {
- if (xtype === '*') {
- return items.slice();
- } else {
- var result = [],
- i = 0,
- length = items.length,
- candidate;
- for (; i < length; i++) {
- candidate = items[i];
- if (!candidate.destroyed && candidate.isXType(xtype, shallow)) {
- result.push(candidate);
- }
- }
- return result;
- }
- },
-
- filterByAttribute = function(items, property, operator, compareTo) {
- var result = [],
- i = 0,
- length = items.length,
- mustBeOwnProperty, presenceOnly, candidate, propValue, j, propLen, config;
-
- if (property.charAt(0) === '@') {
- mustBeOwnProperty = true;
- property = property.substr(1);
- }
- if (property.charAt(0) === '?') {
- mustBeOwnProperty = true;
- presenceOnly = true;
- property = property.substr(1);
- }
- for (; i < length; i++) {
- candidate = items[i];
-
-
-
- config = candidate.self && candidate.self.getConfigurator && candidate.self.$config.configs[property];
- if (config) {
- propValue = candidate[config.names.get]();
- } else if (mustBeOwnProperty && !candidate.hasOwnProperty(property)) {
-
- continue;
- } else {
- propValue = candidate[property];
- }
- if (presenceOnly) {
- result.push(candidate);
- }
-
- else if (operator === '~=') {
- if (propValue) {
-
- if (!Ext.isArray(propValue)) {
- propValue = propValue.split(' ');
- }
- for (j = 0 , propLen = propValue.length; j < propLen; j++) {
- if (queryOperators[operator](Ext.coerce(propValue[j], compareTo), compareTo)) {
- result.push(candidate);
- break;
- }
- }
- }
- } else if (operator === '/=') {
- if (propValue != null && compareTo.test(propValue)) {
- result.push(candidate);
- }
- } else if (!compareTo ? !!propValue : queryOperators[operator](Ext.coerce(propValue, compareTo), compareTo)) {
- result.push(candidate);
- }
- }
- return result;
- },
-
- filterById = function(items, id, idOnly) {
- var result = [],
- i = 0,
- length = items.length,
- candidate, check;
- for (; i < length; i++) {
- candidate = items[i];
- check = idOnly ? candidate.id : candidate.getItemId();
- if (check === id) {
- result.push(candidate);
- }
- }
- return result;
- },
-
- filterByPseudo = function(items, name, value) {
- return cq.pseudos[name](items, value);
- },
-
-
- modeRe = /^(\s?([>\^])\s?|\s|$)/,
-
- tokenRe = /^(#)?((?:\\\.|[\w\-])+|\*)(?:\((true|false)\))?/,
- matchers = [
- {
-
- re: /^\.((?:\\\.|[\w\-])+)(?:\((true|false)\))?/,
- method: filterByXType,
- argTransform: function(args) {
-
- var selector = args[0];
- Ext.log.warn('"' + selector + '" ComponentQuery selector style is deprecated,' + ' use "' + selector.replace(/^\./, '') + '" without the leading dot instead');
-
- if (args[1] !== undefined) {
- args[1] = args[1].replace(unescapeRe, '$1');
- }
- return args.slice(1);
- }
- },
- {
-
-
-
-
-
-
-
-
- re: /^(?:\[((?:[@?$])?[\w\-]*)\s*(?:([\^$*~%!\/]?=)\s*(['"])?((?:\\\]|.)*?)\3)?(?!\\)\])/,
- method: filterByAttribute,
- argTransform: function(args) {
- var selector = args[0],
- property = args[1],
- operator = args[2],
-
- compareTo = args[4],
- compareRe;
-
- if (compareTo !== undefined) {
- compareTo = compareTo.replace(unescapeRe, '$1');
-
- var format = Ext.String.format,
- msg = "ComponentQuery selector '{0}' has an unescaped ({1}) character at the {2} " + "of the attribute value pattern. Usually that indicates an error " + "where the opening quote is not followed by the closing quote. " + "If you need to match a ({1}) character at the {2} of the attribute " + "value, escape the quote character in your pattern: (\\{1})",
- match;
- if (match = /^(['"]).*?[^'"]$/.exec(compareTo)) {
-
- Ext.log.warn(format(msg, selector, match[1], 'beginning'));
- } else if (match = /^[^'"].*?(['"])$/.exec(compareTo)) {
-
- Ext.log.warn(format(msg, selector, match[1], 'end'));
- }
- }
-
- if (operator === '/=') {
- compareRe = regexCache.get(compareTo);
- if (compareRe) {
- compareTo = compareRe;
- } else {
- compareTo = regexCache.add(compareTo, new RegExp(compareTo));
- }
- }
- return [
- property,
- operator,
- compareTo
- ];
- }
- },
- {
-
- re: /^#((?:\\\.|[\w\-])+)/,
- method: filterById
- },
- {
-
- re: /^\:([\w\-]+)(?:\(((?:\{[^\}]+\})|(?:(?!\{)[^\s>\/]*?(?!\})))\))?/,
- method: filterByPseudo,
- argTransform: function(args) {
- if (args[2] !== undefined) {
- args[2] = args[2].replace(unescapeRe, '$1');
- }
- return args.slice(1);
- }
- },
- {
-
- re: /^(?:\{([^\}]+)\})/,
- method: filterFnPattern
- }
- ];
-
- cq.Query = Ext.extend(Object, {
- constructor: function(cfg) {
- cfg = cfg || {};
- Ext.apply(this, cfg);
- },
-
-
-
-
-
-
-
-
- execute: function(root) {
- var operations = this.operations,
- result = [],
- op, i, len;
- for (i = 0 , len = operations.length; i < len; i++) {
- op = operations[i];
- result = result.concat(this._execute(root, op));
- }
- return result;
- },
- _execute: function(root, operations) {
- var i = 0,
- length = operations.length,
- operation, workingItems;
-
- if (!root) {
- workingItems = Ext.ComponentManager.getAll();
- }
-
- else if (Ext.isIterable(root)) {
- workingItems = root;
- }
-
- else if (root.isMixedCollection) {
- workingItems = root.items;
- }
-
-
- for (; i < length; i++) {
- operation = operations[i];
-
-
-
-
-
-
- if (operation.mode === '^') {
- workingItems = getAncestors(workingItems || [
- root
- ]);
- } else if (operation.mode) {
- workingItems = getItems(workingItems || [
- root
- ], operation.mode);
- } else {
- workingItems = filterItems(workingItems || getItems([
- root
- ]), operation);
- }
-
-
- if (i === length - 1) {
- return workingItems;
- }
- }
- return [];
- },
- is: function(component, root) {
- var operations = this.operations,
- result = false,
- len = operations.length,
- op, i;
- if (len === 0) {
- return true;
- }
- for (i = 0; i < len; i++) {
- op = operations[i];
- result = this._is(component, root, op);
- if (result) {
- return result;
- }
- }
- return false;
- },
- _is: function(component, root, operations) {
- var len = operations.length,
- active = [
- component
- ],
- operation, i, j, mode, items, item;
-
- for (i = len - 1; i >= 0; --i) {
- operation = operations[i];
- mode = operation.mode;
-
- if (mode) {
- if (mode === '^') {
- active = getItems(active, ' ');
- } else if (mode === '>') {
- items = [];
- for (j = 0 , len = active.length; j < len; ++j) {
- item = active[j].getRefOwner();
- if (item) {
- items.push(item);
- }
- }
- active = items;
- } else {
- active = getAncestors(active);
- }
- } else {
- active = filterItems(active, operation);
- }
-
- if (active.length === 0) {
- return false;
- }
- }
-
-
- if (root) {
- if (!mode) {
-
-
- active = getAncestors(active);
- }
- if (active.length > 0) {
-
-
- active = filterItems(active, {
- method: filterById,
- args: [
- root.id,
- true
- ]
- });
- }
- if (active.length === 0) {
- return false;
- }
- }
- return true;
- },
- getMatches: function(components, operations) {
- var len = operations.length,
- i;
- for (i = 0; i < len; ++i) {
- components = filterItems(components, operations[i]);
-
-
- if (components.length === 0) {
- break;
- }
- }
- return components;
- },
- isMultiMatch: function() {
- return this.operations.length > 1;
- }
- });
- Ext.apply(cq, {
-
- cache: new Ext.util.LruCache({
- maxSize: 100
- }),
-
- pseudos: {
- not: function(components, selector) {
- var i = 0,
- length = components.length,
- results = [],
- index = -1,
- component;
- for (; i < length; ++i) {
- component = components[i];
- if (!cq.is(component, selector)) {
- results[++index] = component;
- }
- }
- return results;
- },
- first: function(components) {
- var ret = [];
- if (components.length > 0) {
- ret.push(components[0]);
- }
- return ret;
- },
- last: function(components) {
- var len = components.length,
- ret = [];
- if (len > 0) {
- ret.push(components[len - 1]);
- }
- return ret;
- },
-
-
- focusable: function(cmps) {
- var len = cmps.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = cmps[i];
- if (c.isFocusable && c.isFocusable()) {
- results.push(c);
- }
- }
- return results;
- },
-
- canfocus: function(cmps, value) {
- var len = cmps.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = cmps[i];
- if (c.canFocus && c.canFocus(false, value)) {
- results.push(c);
- }
- }
- return results;
- },
- "nth-child": function(c, a) {
- var result = [],
- m = nthRe.exec(a === "even" && "2n" || a === "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
- f = (m[1] || 1) - 0,
- len = m[2] - 0,
- i, n, nodeIndex;
- for (i = 0; n = c[i]; i++) {
-
- nodeIndex = i + 1;
- if (f === 1) {
- if (len === 0 || nodeIndex === len) {
- result.push(n);
- }
- } else if ((nodeIndex + len) % f === 0) {
- result.push(n);
- }
- }
- return result;
- },
- scrollable: function(cmps) {
- var len = cmps.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = cmps[i];
-
- if (c.scrollable || c._scrollable) {
- results.push(c);
- }
- }
- return results;
- },
- visible: function(cmps, deep) {
- deep = deep === 'true';
- var len = cmps.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = cmps[i];
-
- if (c.isVisible(deep)) {
- results.push(c);
- }
- }
- return results;
- }
- },
-
- query: function(selector, root) {
-
- if (!selector) {
- return Ext.ComponentManager.getAll();
- }
- var results = [],
- noDupResults = [],
- dupMatcher = {},
- query = cq.cache.get(selector),
- resultsLn, cmp, i;
- if (!query) {
- query = cq.cache.add(selector, cq.parse(selector));
- }
- results = query.execute(root);
-
-
- if (query.isMultiMatch()) {
- resultsLn = results.length;
- for (i = 0; i < resultsLn; i++) {
- cmp = results[i];
- if (!dupMatcher[cmp.id]) {
- noDupResults.push(cmp);
- dupMatcher[cmp.id] = true;
- }
- }
- results = noDupResults;
- }
- return results;
- },
-
- visitPreOrder: function(selector, root, fn, scope, extraArgs) {
- cq._visit(true, selector, root, fn, scope, extraArgs);
- },
-
- visitPostOrder: function(selector, root, fn, scope, extraArgs) {
- cq._visit(false, selector, root, fn, scope, extraArgs);
- },
-
- _visit: function(preOrder, selector, root, fn, scope, extraArgs) {
- var query = cq.cache.get(selector),
- callArgs = [
- root
- ],
- children,
- len = 0,
- i, rootMatch;
- if (!query) {
- query = cq.cache.add(selector, cq.parse(selector));
- }
- rootMatch = query.is(root);
- if (root.getRefItems) {
- children = root.getRefItems();
- len = children.length;
- }
-
- if (extraArgs) {
- Ext.Array.push(callArgs, extraArgs);
- }
- if (preOrder) {
- if (rootMatch) {
- if (fn.apply(scope || root, callArgs) === false) {
- return false;
- }
- }
- }
- for (i = 0; i < len; i++) {
- if (cq._visit.call(cq, preOrder, selector, children[i], fn, scope, extraArgs) === false) {
- return false;
- }
- }
- if (!preOrder) {
- if (rootMatch) {
- if (fn.apply(scope || root, callArgs) === false) {
- return false;
- }
- }
- }
- },
-
- is: function(component, selector, root) {
- if (!selector) {
- return true;
- }
- if (typeof selector === 'function') {
- return selector(component);
- } else {
- var query = cq.cache.get(selector);
- if (!query) {
- query = cq.cache.add(selector, cq.parse(selector));
- }
- return query.is(component, root);
- }
- },
- parse: function(selector) {
- var operations = [],
- selectors, sel, i, len;
- selectors = Ext.splitAndUnescape(selector, ',');
- for (i = 0 , len = selectors.length; i < len; i++) {
-
- sel = Ext.String.trim(selectors[i]);
-
-
-
-
- if (sel === '') {
- Ext.raise('Invalid ComponentQuery selector: ""');
- }
-
- operations.push(cq._parse(sel));
- }
-
-
- return new cq.Query({
- operations: operations
- });
- },
- _parse: function(selector) {
- var operations = [],
- trim = Ext.String.trim,
- length = matchers.length,
- lastSelector, tokenMatch, token, matchedChar, modeMatch, selectorMatch, transform, i, matcher, method, args;
-
-
-
- while (selector && lastSelector !== selector) {
- lastSelector = selector;
-
- tokenMatch = selector.match(tokenRe);
- if (tokenMatch) {
- matchedChar = tokenMatch[1];
- token = trim(tokenMatch[2]).replace(unescapeRe, '$1');
-
- if (matchedChar === '#') {
- operations.push({
- method: filterById,
- args: [
- token
- ]
- });
- } else
-
- {
- operations.push({
- method: filterByXType,
- args: [
- token,
- Boolean(tokenMatch[3])
- ]
- });
- }
-
- selector = selector.replace(tokenMatch[0], '').replace(stripLeadingSpaceRe, '$1');
- }
-
-
-
- while (!(modeMatch = selector.match(modeRe))) {
-
-
- for (i = 0; selector && i < length; i++) {
- matcher = matchers[i];
- selectorMatch = selector.match(matcher.re);
- method = matcher.method;
- transform = matcher.argTransform;
-
-
-
- if (selectorMatch) {
-
- if (transform) {
- args = transform(selectorMatch);
- } else {
- args = selectorMatch.slice(1);
- }
- operations.push({
- method: Ext.isString(matcher.method) ?
-
-
- Ext.functionFactory('items', Ext.String.format.apply(Ext.String, [
- method
- ].concat(selectorMatch.slice(1)))) : matcher.method,
- args: args
- });
- selector = selector.replace(selectorMatch[0], '').replace(stripLeadingSpaceRe, '$1');
- break;
- }
-
-
- if (i === (length - 1)) {
- Ext.raise('Invalid ComponentQuery selector: "' + arguments[0] + '"');
- }
- }
- }
-
-
-
-
- if (modeMatch[1]) {
-
- operations.push({
- mode: modeMatch[2] || modeMatch[1]
- });
-
- selector = selector.replace(modeMatch[0], '').replace(stripLeadingSpaceRe, '');
- }
- }
- return operations;
- }
- });
-
- Ext.all = function() {
- return cq.query.apply(cq, arguments);
- };
-
- Ext.first = function() {
- var matches = cq.query.apply(cq, arguments);
- return (matches && matches[0]) || null;
- };
- });
- Ext.define('Ext.Evented', {
- alternateClassName: 'Ext.EventedBase',
- mixins: [
- Ext.mixin.Observable
- ],
- initialized: false,
- constructor: function(config) {
-
-
- this.callParent();
-
- this.mixins.observable.constructor.call(this, config);
- this.initialized = true;
- },
- onClassExtended: function(cls, data) {
- if (!data.hasOwnProperty('eventedConfig')) {
- return;
- }
- var config = data.config,
- eventedConfig = data.eventedConfig,
- name, cfg;
- if (config) {
- Ext.applyIf(config, eventedConfig);
- } else {
- cls.addConfig(eventedConfig);
- }
-
-
- for (name in eventedConfig) {
- if (eventedConfig.hasOwnProperty(name)) {
- cfg = Ext.Config.get(name);
- data[cfg.names.set] = cfg.eventedSetter || cfg.getEventedSetter();
- }
- }
- }
- });
- Ext.define('Ext.util.Positionable', {
- mixinId: 'positionable',
- _positionTopLeft: [
- 'position',
- 'top',
- 'left'
- ],
-
-
-
-
-
- clippedCls: Ext.baseCSSPrefix + 'clipped',
- afterSetPosition: Ext.emptyFn,
-
-
-
-
-
- getAnchorToXY: function() {
- Ext.raise("getAnchorToXY is not implemented in " + this.$className);
- },
-
- getBorderPadding: function() {
- Ext.raise("getBorderPadding is not implemented in " + this.$className);
- },
-
- getLocalX: function() {
- Ext.raise("getLocalX is not implemented in " + this.$className);
- },
-
- getLocalXY: function() {
- Ext.raise("getLocalXY is not implemented in " + this.$className);
- },
-
- getLocalY: function() {
- Ext.raise("getLocalY is not implemented in " + this.$className);
- },
-
- getX: function() {
- Ext.raise("getX is not implemented in " + this.$className);
- },
-
- getXY: function() {
- Ext.raise("getXY is not implemented in " + this.$className);
- },
-
- getY: function() {
- Ext.raise("getY is not implemented in " + this.$className);
- },
-
- setLocalX: function() {
- Ext.raise("setLocalX is not implemented in " + this.$className);
- },
-
- setLocalXY: function() {
- Ext.raise("setLocalXY is not implemented in " + this.$className);
- },
-
- setLocalY: function() {
- Ext.raise("setLocalY is not implemented in " + this.$className);
- },
-
- setX: function() {
- Ext.raise("setX is not implemented in " + this.$className);
- },
-
- setXY: function() {
- Ext.raise("setXY is not implemented in " + this.$className);
- },
-
- setY: function() {
- Ext.raise("setY is not implemented in " + this.$className);
- },
-
-
-
-
-
-
- adjustForConstraints: function(xy, parent) {
- var vector = this.getConstrainVector(parent, xy);
- if (vector) {
- xy[0] += vector[0];
- xy[1] += vector[1];
- }
- return xy;
- },
-
- alignTo: function(element, position, offsets, animate) {
- var me = this,
- el = me.el;
- return me.setXY(me.getAlignToXY(element, position, offsets), el.anim && !!animate ? el.anim(animate) : false);
- },
-
- calculateAnchorXY: function(anchor, extraX, extraY, size) {
- var region = this.getRegion();
- region.setPosition(0, 0);
- region.translateBy(extraX || 0, extraY || 0);
- if (size) {
- region.setWidth(size.width);
- region.setHeight(size.height);
- }
- return region.getAnchorPoint(anchor);
- },
-
- convertPositionSpec: function(posSpec) {
- return Ext.util.Region.getAlignInfo(posSpec);
- },
-
- getAlignToXY: function(alignToEl, position, offsets) {
- var newRegion = this.getAlignToRegion(alignToEl, position, offsets);
- return [
- newRegion.x,
- newRegion.y
- ];
- },
- getAlignToRegion: function(alignToEl, posSpec, offset, minHeight) {
- var me = this,
- inside, newRegion, bodyScroll;
- alignToEl = Ext.fly(alignToEl.el || alignToEl);
- if (!alignToEl || !alignToEl.dom) {
-
- Ext.raise({
- sourceClass: 'Ext.util.Positionable',
- sourceMethod: 'getAlignToXY',
- msg: 'Attempted to align an element that doesn\'t exist'
- });
- }
-
- posSpec = me.convertPositionSpec(posSpec);
-
- if (posSpec.constrain) {
-
-
- if (posSpec.constrain === '!') {
- inside = alignToEl;
- } else {
-
-
-
- inside = me.constrainTo || me.container || me.el.parent();
- }
- inside = Ext.fly(inside.el || inside).getConstrainRegion();
- }
- if (alignToEl === Ext.getBody()) {
- bodyScroll = alignToEl.getScroll();
- offset = [
- bodyScroll.left,
- bodyScroll.top
- ];
- }
- newRegion = me.getRegion().alignTo({
- target: alignToEl.getRegion(),
- inside: inside,
- minHeight: minHeight,
- offset: offset,
- align: posSpec,
- axisLock: true
- });
- return newRegion;
- },
-
- getAnchorXY: function(anchor, local, size) {
- var me = this,
- region = me.getRegion(),
- el = me.el,
- isViewport = el.dom.nodeName === 'BODY' || el.dom.nodeType === 9,
- scroll = el.getScroll();
- if (local) {
- region.setPosition(0, 0);
- } else if (isViewport) {
- region.setPosition(scroll.left, scroll.top);
- }
- if (size) {
- region.setWidth(size.width);
- region.setHeight(size.height);
- }
- return region.getAnchorPoint(anchor);
- },
-
- getBox: function(contentBox, local) {
- var me = this,
- xy = local ? me.getLocalXY() : me.getXY(),
- x = xy[0],
- y = xy[1],
- w, h, borderPadding, beforeX, beforeY;
-
- if (me.el.dom.nodeName === 'BODY' || me.el.dom.nodeType === 9) {
- w = Ext.Element.getViewportWidth();
- h = Ext.Element.getViewportHeight();
- } else {
- w = me.getWidth();
- h = me.getHeight();
- }
- if (contentBox) {
- borderPadding = me.getBorderPadding();
- beforeX = borderPadding.beforeX;
- beforeY = borderPadding.beforeY;
- x += beforeX;
- y += beforeY;
- w -= (beforeX + borderPadding.afterX);
- h -= (beforeY + borderPadding.afterY);
- }
- return {
- x: x,
- left: x,
- 0: x,
- y: y,
- top: y,
- 1: y,
- width: w,
- height: h,
- right: x + w,
- bottom: y + h
- };
- },
-
- calculateConstrainedPosition: function(constrainTo, proposedPosition, local, proposedSize) {
- var me = this,
- vector,
- fp = me.floatParent,
- parentNode = fp ? fp.getTargetEl() : null,
- parentOffset, borderPadding, proposedConstrainPosition,
- xy = false;
- if (local && fp) {
- parentOffset = parentNode.getXY();
- borderPadding = parentNode.getBorderPadding();
- parentOffset[0] += borderPadding.beforeX;
- parentOffset[1] += borderPadding.beforeY;
- if (proposedPosition) {
- proposedConstrainPosition = [
- proposedPosition[0] + parentOffset[0],
- proposedPosition[1] + parentOffset[1]
- ];
- }
- } else {
- proposedConstrainPosition = proposedPosition;
- }
-
-
-
- constrainTo = constrainTo || me.constrainTo || parentNode || me.container || me.el.parent();
- if (local && proposedConstrainPosition) {
- proposedConstrainPosition = me.reverseTranslateXY(proposedConstrainPosition);
- }
- vector = ((me.constrainHeader && me.header.rendered) ? me.header : me).getConstrainVector(constrainTo, proposedConstrainPosition, proposedSize);
-
- if (vector) {
- xy = proposedPosition || me.getPosition(local);
- xy[0] += vector[0];
- xy[1] += vector[1];
- }
- return xy;
- },
-
- getConstrainRegion: function() {
- var me = this,
- el = me.el,
- isBody = el.dom.nodeName === 'BODY',
- dom = el.dom,
- borders = el.getBorders(),
- pos = el.getXY(),
- left = pos[0] + borders.beforeX,
- top = pos[1] + borders.beforeY,
- scroll, width, height;
-
- if (isBody) {
- scroll = el.getScroll();
- left = scroll.left;
- top = scroll.top;
- width = Ext.Element.getViewportWidth();
- height = Ext.Element.getViewportHeight();
- } else {
- width = dom.clientWidth;
- height = dom.clientHeight;
- }
- return new Ext.util.Region(top, left + width, top + height, left);
- },
-
- getConstrainVector: function(constrainTo, proposedPosition, proposedSize) {
- var me = this,
- thisRegion = me.getRegion(),
- vector = [
- 0,
- 0
- ],
- shadowSize = (me.shadow && me.constrainShadow && !me.shadowDisabled) ? me.el.shadow.getShadowSize() : undefined,
- overflowed = false,
- constraintInsets = me.constraintInsets;
- if (!(constrainTo instanceof Ext.util.Region)) {
- constrainTo = Ext.get(constrainTo.el || constrainTo);
-
-
- constrainTo = constrainTo.getConstrainRegion();
- }
-
- if (constraintInsets) {
- constraintInsets = Ext.isObject(constraintInsets) ? constraintInsets : Ext.Element.parseBox(constraintInsets);
- constrainTo.adjust(constraintInsets.top, constraintInsets.right, constraintInsets.bottom, constraintInsets.left);
- }
-
- if (proposedPosition) {
- thisRegion.translateBy(proposedPosition[0] - thisRegion.x, proposedPosition[1] - thisRegion.y);
- }
-
- if (proposedSize) {
- thisRegion.right = thisRegion.left + proposedSize[0];
- thisRegion.bottom = thisRegion.top + proposedSize[1];
- }
-
- if (shadowSize) {
- constrainTo.adjust(shadowSize[0], -shadowSize[1], -shadowSize[2], shadowSize[3]);
- }
-
- if (thisRegion.right > constrainTo.right) {
- overflowed = true;
- vector[0] = (constrainTo.right - thisRegion.right);
- }
-
- if (thisRegion.left + vector[0] < constrainTo.left) {
- overflowed = true;
- vector[0] = (constrainTo.left - thisRegion.left);
- }
-
-
- if (thisRegion.bottom > constrainTo.bottom) {
- overflowed = true;
- vector[1] = (constrainTo.bottom - thisRegion.bottom);
- }
-
- if (thisRegion.top + vector[1] < constrainTo.top) {
- overflowed = true;
- vector[1] = (constrainTo.top - thisRegion.top);
- }
-
- return overflowed ? vector : false;
- },
-
- getOffsetsTo: function(offsetsTo) {
- var o = this.getXY(),
- e = offsetsTo.isRegion ? [
- offsetsTo.x,
- offsetsTo.y
- ] : Ext.fly(offsetsTo.el || offsetsTo).getXY();
- return [
- o[0] - e[0],
- o[1] - e[1]
- ];
- },
-
- getRegion: function(contentBox, local) {
- var box = this.getBox(contentBox, local);
- return new Ext.util.Region(box.top, box.right, box.bottom, box.left);
- },
-
- getClientRegion: function() {
- var me = this,
- el = me.el,
- dom = el.dom,
- viewContentBox = me.getBox(true),
- scrollbarHeight = dom.offsetHeight > dom.clientHeight,
- scrollbarWidth = dom.offsetWidth > dom.clientWidth,
- padding, scrollSize, isRTL;
- if (scrollbarHeight || scrollbarWidth) {
- scrollSize = Ext.getScrollbarSize();
-
-
- if (scrollbarWidth) {
- scrollbarWidth = scrollSize.width;
- isRTL = el.getStyle('direction') === 'rtl' && !Ext.supports.rtlVertScrollbarOnRight;
- if (isRTL) {
- padding = el.getPadding('l');
- viewContentBox.left -= padding + Math.max(padding, scrollbarWidth);
- } else {
- padding = el.getPadding('r');
- viewContentBox.right += padding - Math.max(padding, scrollbarWidth);
- }
- }
-
-
- if (scrollbarHeight) {
- scrollbarHeight = scrollSize.height;
- padding = el.getPadding('b');
- viewContentBox.bottom += padding - Math.max(padding, scrollbarHeight);
- }
- }
-
- return new Ext.util.Region(viewContentBox.top, viewContentBox.right, viewContentBox.bottom, viewContentBox.left);
- },
-
- getViewRegion: function() {
- var me = this,
- el = me.el,
- isBody = el.dom.nodeName === 'BODY',
- borderPadding, scroll, pos, top, left, width, height;
-
- if (isBody) {
- scroll = el.getScroll();
- left = scroll.left;
- top = scroll.top;
- width = Ext.Element.getViewportWidth();
- height = Ext.Element.getViewportHeight();
- } else {
- borderPadding = me.getBorderPadding();
- pos = me.getXY();
- left = pos[0] + borderPadding.beforeX;
- top = pos[1] + borderPadding.beforeY;
- width = me.getWidth(true);
- height = me.getHeight(true);
- }
- return new Ext.util.Region(top, left + width, top + height, left);
- },
-
- move: function(direction, distance, animate) {
- var me = this,
- xy = me.getXY(),
- x = xy[0],
- y = xy[1],
- left = [
- x - distance,
- y
- ],
- right = [
- x + distance,
- y
- ],
- top = [
- x,
- y - distance
- ],
- bottom = [
- x,
- y + distance
- ],
- hash = {
- l: left,
- left: left,
- r: right,
- right: right,
- t: top,
- top: top,
- up: top,
- b: bottom,
- bottom: bottom,
- down: bottom
- };
- direction = direction.toLowerCase();
- me.setXY([
- hash[direction][0],
- hash[direction][1]
- ], animate);
- },
-
- setBox: function(box) {
- var me = this,
- x, y;
- if (box.isRegion) {
- box = {
- x: box.left,
- y: box.top,
- width: box.right - box.left,
- height: box.bottom - box.top
- };
- }
- me.constrainBox(box);
- x = box.x;
- y = box.y;
-
-
- me.setXY([
- x,
- y
- ]);
- me.setSize(box.width, box.height);
- me.afterSetPosition(x, y);
- return me;
- },
-
- constrainBox: function(box) {
- var me = this,
- constrainedPos, x, y;
- if (me.constrain || me.constrainHeader) {
- x = ('x' in box) ? box.x : box.left;
- y = ('y' in box) ? box.y : box.top;
- constrainedPos = me.calculateConstrainedPosition(null, [
- x,
- y
- ], false, [
- box.width,
- box.height
- ]);
-
- if (constrainedPos) {
- box.x = constrainedPos[0];
- box.y = constrainedPos[1];
- }
- }
- },
-
- translatePoints: function(x, y) {
- var pos = this.translateXY(x, y);
- return {
- left: pos.x,
- top: pos.y
- };
- },
-
- translateXY: function(x, y) {
- var me = this,
- el = me.el,
- styles = el.getStyle(me._positionTopLeft),
- relative = styles.position === 'relative',
- left = parseFloat(styles.left),
- top = parseFloat(styles.top),
- xy = me.getXY();
- if (Ext.isArray(x)) {
- y = x[1];
- x = x[0];
- }
- if (isNaN(left)) {
- left = relative ? 0 : el.dom.offsetLeft;
- }
- if (isNaN(top)) {
- top = relative ? 0 : el.dom.offsetTop;
- }
- left = (typeof x === 'number') ? x - xy[0] + left : undefined;
- top = (typeof y === 'number') ? y - xy[1] + top : undefined;
- return {
- x: left,
- y: top
- };
- },
-
- reverseTranslateXY: function(xy) {
- var coords = xy,
- el = this.el,
- dom = el.dom,
- offsetParent = dom.offsetParent,
- relative, offsetParentXY, x, y;
- if (offsetParent) {
- relative = el.isStyle('position', 'relative') , offsetParentXY = Ext.fly(offsetParent).getXY() , x = xy[0] + offsetParentXY[0] + offsetParent.clientLeft;
- y = xy[1] + offsetParentXY[1] + offsetParent.clientTop;
- if (relative) {
-
-
- x += el.getPadding('l');
- y += el.getPadding('t');
- }
- coords = [
- x,
- y
- ];
- }
- return coords;
- },
- privates: {
-
- clipTo: function(clippingEl, sides) {
- var clippingRegion,
- el = this.el,
- floaterRegion = el.getRegion(),
- overflow, i,
- clipValues = [],
- clippedCls = this.clippedCls,
- clipStyle, clipped, shadow;
-
- if (clippingEl.isRegion) {
- clippingRegion = clippingEl;
- } else {
- clippingRegion = (clippingEl.isComponent ? clippingEl.el : Ext.fly(clippingEl)).getConstrainRegion();
- }
-
- if (!sides) {
- sides = 15;
- }
-
- if (sides & 1 && (overflow = clippingRegion.top - floaterRegion.top) > 0) {
- clipValues[0] = overflow;
- clipped = true;
- } else {
- clipValues[0] = -10000;
- }
- if (sides & 2 && (overflow = floaterRegion.right - clippingRegion.right) > 0) {
- clipValues[1] = Math.max(0, el.getWidth() - overflow);
- clipped = true;
- } else {
- clipValues[1] = 10000;
- }
- if (sides & 4 && (overflow = floaterRegion.bottom - clippingRegion.bottom) > 0) {
- clipValues[2] = Math.max(0, el.getHeight() - overflow);
- clipped = true;
- } else {
- clipValues[2] = 10000;
- }
- if (sides & 8 && (overflow = clippingRegion.left - floaterRegion.left) > 0) {
- clipValues[3] = overflow;
- clipped = true;
- } else {
- clipValues[3] = -10000;
- }
- clipStyle = 'rect(';
- for (i = 0; i < 4; ++i) {
-
-
- clipStyle += Ext.Element.addUnits(clipValues[i], 'px');
- clipStyle += (i === 3) ? ')' : ',';
- }
- el.dom.style.clip = clipStyle;
-
-
- el.addCls(clippedCls);
-
-
-
-
- if ((shadow = el.shadow) && (el = shadow.el) && el.dom) {
- clipValues[2] -= shadow.offsets.y;
- clipValues[3] -= shadow.offsets.x;
- clipStyle = 'rect(';
- for (i = 0; i < 4; ++i) {
-
-
- clipStyle += Ext.Element.addUnits(clipValues[i], 'px');
- clipStyle += (i === 3) ? ')' : ',';
- }
- el.dom.style.clip = clipStyle;
-
-
- if (clipped && !Ext.supports.CSS3BoxShadow) {
- el.dom.style.display = 'none';
- } else {
- el.dom.style.display = '';
-
-
- el.addCls(clippedCls);
- }
- }
- },
-
- clearClip: function() {
- var el = this.el,
- clippedCls = this.clippedCls;
- el.dom.style.clip = Ext.isIE8 ? 'auto' : '';
-
-
- el.removeCls(clippedCls);
-
- if (el.shadow && el.shadow.el && el.shadow.el.dom) {
- el.shadow.el.dom.style.clip = Ext.isIE8 ? 'auto' : '';
-
-
- if (!Ext.supports.CSS3BoxShadow) {
- el.dom.style.display = '';
-
-
- el.removeCls(clippedCls);
- }
- }
- }
- }
- });
- Ext.define('Ext.dom.UnderlayPool', {
-
- constructor: function(elementConfig) {
- this.elementConfig = elementConfig;
- this.cache = [];
- },
-
- checkOut: function() {
- var el = this.cache.shift();
- if (!el) {
- el = Ext.Element.create(this.elementConfig);
- el.setVisibilityMode(2);
-
-
- el.dom.setAttribute('data-sticky', true);
- }
-
- return el;
- },
-
- checkIn: function(el) {
- this.cache.push(el);
- Ext.getDetachedBody().dom.appendChild(el.dom);
- },
-
- reset: function() {
- var cache = this.cache,
- i = cache.length;
- while (i--) {
- cache[i].destroy();
- }
- this.cache = [];
- }
- });
- Ext.define('Ext.dom.Underlay', {
-
-
- constructor: function(config) {
- Ext.apply(this, config);
- },
-
- beforeShow: Ext.emptyFn,
-
- getInsertionTarget: function() {
- return this.target;
- },
-
- getPool: function() {
- return this.pool || (this.self.prototype.pool = new Ext.dom.UnderlayPool(this.elementConfig));
- },
-
- hide: function() {
- var me = this,
- el = me.el;
- if (el) {
- if (el.dom) {
- el.hide();
- me.getPool().checkIn(el);
- }
- me.el = null;
- }
- me.hidden = true;
- },
-
- realign: function(x, y, width, height) {
- var me = this,
- el = me.el,
- target = me.target,
- offsets = me.offsets,
- max = Math.max;
- if (el) {
- if (x == null) {
- x = target.getX();
- }
- if (y == null) {
- y = target.getY();
- }
- if (width == null) {
- width = target.getWidth();
- }
- if (height == null) {
- height = target.getHeight();
- }
- if (offsets) {
- x = x + offsets.x;
- y = y + offsets.y;
- width = max(width + offsets.w, 0);
- height = max(height + offsets.h, 0);
- }
- el.setXY([
- x,
- y
- ]);
- el.setSize(width, height);
- }
- },
-
- setZIndex: function(zIndex) {
- this.zIndex = zIndex;
- if (this.el) {
- this.el.setStyle("z-index", zIndex);
- }
- },
-
- show: function() {
- var me = this,
- target = me.target,
- zIndex = me.zIndex,
- el = me.el,
- insertionTarget = me.getInsertionTarget().dom,
- dom;
- if (!el) {
- el = me.el = me.getPool().checkOut();
- }
- me.beforeShow();
- if (zIndex == null) {
-
-
-
-
-
-
- zIndex = (parseInt(target.getStyle("z-index"), 10));
- }
- if (zIndex) {
- el.setStyle("z-index", zIndex);
- }
-
- el.setStyle('position', me.fixed ? 'fixed' : '');
- dom = el.dom;
- if (dom.nextSibling !== insertionTarget) {
-
-
-
- target.dom.parentNode.insertBefore(dom, insertionTarget);
- }
- el.show();
- me.realign();
- me.hidden = false;
- }
- });
- Ext.define('Ext.dom.Shadow', {
- extend: Ext.dom.Underlay,
- alternateClassName: 'Ext.Shadow',
-
- mode: 'drop',
-
- offset: 4,
- cls: Ext.baseCSSPrefix + (!Ext.supports.CSS3BoxShadow ? 'ie' : 'css') + '-shadow',
-
- constructor: function(config) {
- var me = this,
- outerOffsets, offsets, offset, rad;
- me.callParent([
- config
- ]);
- me.elementConfig = {
- cls: me.cls,
- role: 'presentation'
- };
- offset = me.offset;
- rad = Math.floor(offset / 2);
- me.opacity = 50;
- switch (me.mode.toLowerCase()) {
- case "drop":
- outerOffsets = {
- x: 0,
- y: 0,
- w: offset,
- h: offset
- };
- if (Ext.supports.CSS3BoxShadow) {
- offsets = {
- x: offset,
- y: offset,
- h: -offset,
- w: -offset
- };
- } else {
- offsets = {
- x: -rad,
- y: -rad,
- h: -rad,
- w: -rad
- };
- };
- break;
- case "sides":
- outerOffsets = {
- x: -offset,
- y: 0,
- w: offset * 2,
- h: offset
- };
- if (Ext.supports.CSS3BoxShadow) {
- offsets = {
- x: 0,
- y: offset,
- h: -offset,
- w: 0
- };
- } else {
- offsets = {
- x: 1 + rad - 2 * offset,
- y: -(1 + rad),
- h: -1,
- w: rad - 1
- };
- };
- break;
- case "frame":
- outerOffsets = {
- x: -offset,
- y: -offset,
- w: offset * 2,
- h: offset * 2
- };
- if (Ext.supports.CSS3BoxShadow) {
- offsets = {
- x: 0,
- y: 0,
- h: 0,
- w: 0
- };
- } else {
- offsets = {
- x: 1 + rad - 2 * offset,
- y: 1 + rad - 2 * offset,
- h: offset - rad - 1,
- w: offset - rad - 1
- };
- };
- break;
- case "bottom":
- outerOffsets = {
- x: -offset,
- y: 0,
- w: offset * 2,
- h: offset
- };
- if (Ext.supports.CSS3BoxShadow) {
- offsets = {
- x: 0,
- y: offset,
- h: -offset,
- w: 0
- };
- } else {
- offsets = {
- x: 0,
- y: offset,
- h: 0,
- w: 0
- };
- };
- break;
- }
-
- me.offsets = offsets;
-
- me.outerOffsets = outerOffsets;
- },
-
- getShadowSize: function() {
- var me = this,
- offset = me.el ? me.offset : 0,
- result = [
- offset,
- offset,
- offset,
- offset
- ],
- mode = me.mode.toLowerCase();
-
- if (me.el && mode !== 'frame') {
- result[0] = 0;
- if (mode == 'drop') {
- result[3] = 0;
- }
- }
- return result;
- },
-
- boxShadowProperty: (function() {
- var property = 'boxShadow',
- style = document.documentElement.style;
- if (!('boxShadow' in style)) {
- if ('WebkitBoxShadow' in style) {
-
- property = 'WebkitBoxShadow';
- } else if ('MozBoxShadow' in style) {
-
- property = 'MozBoxShadow';
- }
- }
- return property;
- }()),
- beforeShow: function() {
- var me = this,
- style = me.el.dom.style,
- shim = me.shim;
- if (Ext.supports.CSS3BoxShadow) {
- style[me.boxShadowProperty] = '0 0 ' + (me.offset + 2) + 'px #888';
- } else {
- style.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=" + me.opacity + ") progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (me.offset) + ")";
- }
-
-
- if (shim) {
- shim.realign();
- }
- },
-
- setOpacity: function(opacity) {
- var el = this.el;
- if (el) {
- if (Ext.isIE && !Ext.supports.CSS3BoxShadow) {
- opacity = Math.floor(opacity * 100 / 2) / 100;
- }
- this.opacity = opacity;
- el.setOpacity(opacity);
- }
- }
- });
- Ext.define('Ext.dom.Shim', {
- extend: Ext.dom.Underlay,
- cls: Ext.baseCSSPrefix + 'shim',
- constructor: function(config) {
- this.callParent([
- config
- ]);
- this.elementConfig = {
- tag: 'iframe',
- cls: this.cls,
- role: 'presentation',
- frameBorder: '0',
- src: Ext.SSL_SECURE_URL,
-
- tabindex: '-1'
- };
- },
- getInsertionTarget: function() {
-
-
- var shadow = this.shadow;
- return (shadow && shadow.el) || this.target;
- }
- });
- Ext.define('Ext.dom.ElementEvent', {
- extend: Ext.util.Event,
- addListener: function(fn, scope, options, caller, manager) {
- var me = this,
- added = false,
- name = me.name,
- isDirectEvent = Ext.event.publisher.Dom.instance.directEvents[name],
- captures, directs, directCaptures;
- options = options || {};
- if (options.delegated === false || isDirectEvent) {
- if (isDirectEvent && options.delegate) {
- options.capture = true;
- }
- if (options.capture) {
- directCaptures = me.directCaptures || (me.directCaptures = new Ext.util.Event(me.observable, name));
- added = directCaptures.addListener(fn, scope, options, caller, manager);
- } else {
- directs = me.directs || (me.directs = new Ext.util.Event(me.observable, name));
- added = directs.addListener(fn, scope, options, caller, manager);
- }
- } else if (options.capture) {
- captures = me.captures || (me.captures = new Ext.util.Event(me.observable, name));
- added = captures.addListener(fn, scope, options, caller, manager);
- } else {
- added = me.callParent([
- fn,
- scope,
- options,
- caller,
- manager
- ]);
- }
- return added;
- },
- removeListener: function(fn, scope) {
- var me = this,
- captures = me.captures,
- directs = me.directs,
- directCaptures = me.directCaptures,
- removed = false,
- index = me.findListener(fn, scope);
- if (index !== -1) {
- removed = me.callParent([
- fn,
- scope,
- index
- ]);
- } else {
- if (directs) {
- index = directs.findListener(fn, scope);
- }
- if (index !== -1) {
- removed = directs.removeListener(fn, scope, index);
- } else {
- if (captures) {
- index = captures.findListener(fn, scope);
- }
- if (index !== -1) {
- removed = captures.removeListener(fn, scope, index);
- } else if (directCaptures) {
- index = directCaptures.findListener(fn, scope);
- if (index !== -1) {
- removed = directCaptures.removeListener(fn, scope, index);
- }
- }
- }
- }
- return removed;
- },
- clearListeners: function() {
- var me = this,
- directCaptures = me.directCaptures,
- directs = me.directs,
- captures = me.captures;
- if (directCaptures) {
- directCaptures.clearListeners();
- }
- if (directs) {
- directs.clearListeners();
- }
- if (captures) {
- captures.clearListeners();
- }
- me.callParent();
- },
- suspend: function() {
- var me = this,
- directCaptures = me.directCaptures,
- directs = me.directs,
- captures = me.captures;
- if (directCaptures) {
- directCaptures.suspend();
- }
- if (directs) {
- directs.suspend();
- }
- if (captures) {
- captures.suspend();
- }
- me.callParent();
- },
- resume: function() {
- var me = this,
- directCaptures = me.directCaptures,
- directs = me.directs,
- captures = me.captures;
- if (directCaptures) {
- directCaptures.resume();
- }
- if (directs) {
- directs.resume();
- }
- if (captures) {
- captures.resume();
- }
- me.callParent();
- }
- });
- Ext.define('Ext.event.publisher.Publisher', {
- isEventPublisher: true,
- $vetoClearingPrototypeOnDestroy: true,
-
- handledEvents: [],
- statics: {
-
- publishers: {},
-
- publishersByEvent: {}
- },
- constructor: function() {
- var me = this,
- type = me.type;
-
- me.handles = {};
-
- if (!type) {
- Ext.raise("Event publisher '" + me.$className + "' defined without a 'type' property.");
- }
- if (me.self.instance) {
- Ext.raise("Cannot create multiple instances of '" + me.$className + "'. " + "Use '" + me.$className + ".instance' to retrieve the singleton instance.");
- }
-
- me.registerEvents();
- Ext.event.publisher.Publisher.publishers[type] = me;
- },
-
- registerEvents: function(events) {
- var me = this,
- publishersByEvent = Ext.event.publisher.Publisher.publishersByEvent,
- handledEvents = events || me.handledEvents,
- ln = handledEvents.length,
- eventName, i;
- for (i = 0; i < ln; i++) {
- eventName = handledEvents[i];
- me.handles[eventName] = 1;
- publishersByEvent[eventName] = me;
- }
- },
-
- subscribe: function() {
- Ext.raise("Ext.event.publisher.Publisher subclass '" + this.$className + '" has no subscribe method.');
- },
- unsubscribe: function() {
- Ext.raise("Ext.event.publisher.Publisher subclass '" + this.$className + '" has no unsubscribe method.');
- },
-
- fire: function(element, eventName, args) {
- var event;
- if (element.hasListeners[eventName]) {
- event = element.events[eventName];
- if (event) {
- event.fire.apply(event, args);
- }
- }
- }
- });
- Ext.define('Ext.util.Offset', {
-
- statics: {
- fromObject: function(obj) {
- if (obj instanceof this) {
- return obj;
- }
- if (typeof obj === 'number') {
- return new this(obj, obj);
- }
- if (obj.length) {
- return new this(obj[0], obj[1]);
- }
- return new this(obj.x, obj.y);
- }
- },
-
- constructor: function(x, y) {
- this.x = (x != null && !isNaN(x)) ? x : 0;
- this.y = (y != null && !isNaN(y)) ? y : 0;
- return this;
- },
- copy: function() {
- return new Ext.util.Offset(this.x, this.y);
- },
- copyFrom: function(p) {
- this.x = p.x;
- this.y = p.y;
- },
- toString: function() {
- return "Offset[" + this.x + "," + this.y + "]";
- },
- equals: function(offset) {
-
- if (!(offset instanceof this.statics())) {
- Ext.raise('Offset must be an instance of Ext.util.Offset');
- }
-
- return (this.x === offset.x && this.y === offset.y);
- },
- add: function(offset) {
-
- if (!(offset instanceof this.statics())) {
- Ext.raise('Offset must be an instance of Ext.util.Offset');
- }
-
- this.x += offset.x;
- this.y += offset.y;
- },
- round: function(to) {
- if (!isNaN(to)) {
- var factor = Math.pow(10, to);
- this.x = Math.round(this.x * factor) / factor;
- this.y = Math.round(this.y * factor) / factor;
- } else {
- this.x = Math.round(this.x);
- this.y = Math.round(this.y);
- }
- },
- isZero: function() {
- return this.x === 0 && this.y === 0;
- }
- });
- Ext.define('Ext.util.Region', function() {
- var ExtUtil = Ext.util,
- constrainRe = /([^\?!]*)(!|\?)?$/,
- alignRe = /^(?:(?:([trbl])(\d+))|(tl|t|tc|tr|l|c|r|bl|b|bc|br))(?:-(?:(?:([trbl])(\d+))|(tl|t|tc|tr|l|c|r|bl|b|bc|br)))?$/i,
-
-
-
-
-
-
- LTROffsetFactors = {
- l: 0,
- r: 100,
- t: 0,
- b: 100,
- c: 50
- },
- RTLOffsetFactors = {
- l: 100,
- r: 0,
- t: 0,
- b: 100,
- c: 50
- },
- relativePositions = {
- b: 0,
- l: 1,
- t: 2,
- r: 3
- },
- alignMap = {
- "tl-tr": "l0-r0",
- "tl-r": "l0-r50",
- "bl-r": "l100-r50",
- "bl-br": "l100-r100",
- "tr-tl": "r0-l0",
- "tr-l": "r0-l50",
- "br-l": "r100-l50",
- "br-bl": "r100-l100"
- },
- rtlAlignMap = {
- "tl-tr": "r0-l0",
- "tl-r": "r0-l50",
- "bl-r": "r100-l50",
- "bl-br": "r100-l100",
- "tr-tl": "l0-r0",
- "tr-l": "l0-r50",
- "br-l": "l100-r50",
- "br-bl": "l100-r100"
- },
- adjustParams = [],
- zeroOffset = new ExtUtil.Offset(0, 0),
- parseRegion = function(box) {
- var Region = ExtUtil.Region,
- type = typeof box,
- top, right, bottom, left;
- if (box == null) {
- return Region.EMPTY;
- }
- if (box.isRegion) {
- return box;
- }
- if (box.isElement || box.nodeType === 1) {
- return this.getRegion(box);
- }
- if (type === 'string') {
- box = box.split(' ');
- switch (box.length) {
- case 1:
- box[1] = box[2] = box[3] = box[0];
- break;
- case 2:
- box[2] = box[0];
- box[3] = box[1];
- break;
- case 3:
- box[3] = box[1];
- }
- top = parseInt(box[0], 10) || 0;
- right = parseInt(box[1], 10) || 0;
- bottom = parseInt(box[2], 10) || 0;
- left = parseInt(box[3], 10) || 0;
- } else if (type === 'number') {
- top = right = bottom = left = box;
- } else if (typeof box.x === 'number') {
- top = box.y;
- left = box.x;
- if (typeof box.right === 'number') {
- right = box.right;
- bottom = box.bottom;
- } else {
- right = left + box.width;
- bottom = top + box.height;
- }
- } else
- {
- Ext.raise('Not convertible to a Region: ' + box);
- }
-
- return new Region(top, right, bottom, left);
- },
- magnitude = [
- -1,
- 1,
- 1,
- -1
- ],
-
-
-
- addAnchorOffset = function(target, anchorSize, relativePosition) {
-
- if (relativePosition != null && anchorSize) {
- adjustParams[0] = adjustParams[1] = adjustParams[2] = adjustParams[3] = 0;
- adjustParams[relativePosition] = anchorSize.y * magnitude[relativePosition];
- target = ExtUtil.Region.from(target);
- target.adjust.apply(target, adjustParams);
- }
- return target;
- },
-
- calculateAnchorPosition = function(target, result, relativePosition, anchorSize, inside) {
- var anchorWidth = Math.ceil(anchorSize.x),
- minOverlap = Math.ceil(anchorWidth / 2) + 3,
- min, max, anchorPos, isBefore, overlapLine, x, y;
-
- if (inside && !inside.intersect(target)) {
- return;
- }
- if (relativePosition != null) {
-
- if (relativePosition & 1) {
-
- if (result.getHeight() < anchorWidth + 4) {
- return;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- min = target.top + minOverlap - result.height;
- max = target.bottom - minOverlap - 1;
- result.setPosition(result.x, Math.min(Math.max(result.y, min), max));
-
-
- min = result.top + 2;
- max = result.bottom - (anchorWidth + 2);
- isBefore = relativePosition === 3;
- x = isBefore ? result.right : result.left;
- overlapLine = new ExtUtil.Region(Math.max(result.top, target.top), x, Math.min(result.bottom, target.bottom), x);
-
- anchorPos = new ExtUtil.Region(0, 0, 0, 0).setWidth(anchorSize.y).setHeight(anchorWidth).alignTo({
- target: overlapLine,
- align: isBefore ? 'l-r' : 'r-l',
- overlap: true
- });
-
- anchorPos.setPosition(anchorPos.x, Math.min(Math.max(anchorPos.y, min), max));
- anchorPos.position = isBefore ? 'right' : 'left';
- } else
- {
-
- if (result.getWidth() < anchorWidth + 4) {
- return;
- }
-
-
- min = target.left + minOverlap - result.width;
- max = target.right - minOverlap - 1;
- result.setPosition(Math.min(Math.max(result.x, min), max), result.y);
-
-
- min = result.left + 2;
- max = result.right - (anchorWidth + 2);
-
- isBefore = relativePosition === 0;
- y = isBefore ? result.bottom : result.top;
- overlapLine = new ExtUtil.Region(y, Math.min(result.right, target.right), y, Math.max(result.left, target.left));
-
- anchorPos = new ExtUtil.Region(0, 0, 0, 0).setWidth(anchorWidth).setHeight(anchorSize.y).alignTo({
- target: overlapLine,
- align: isBefore ? 't-b' : 'b-t',
- overlap: true
- });
-
- anchorPos.setPosition(Math.min(Math.max(anchorPos.x, min), max), anchorPos.y);
- anchorPos.position = isBefore ? 'bottom' : 'top';
- }
-
- if (inside && !inside.contains(anchorPos)) {
- return;
- }
- result.anchor = anchorPos;
- result.anchor.align = relativePosition;
- }
- },
- checkMinHeight = function(minHeight, result, target, inside) {
- var newHeight;
- if (minHeight && inside) {
-
- if (result.top >= target.bottom && result.bottom > inside.bottom) {
- result.setHeight(Math.max(result.getHeight() + inside.bottom - result.bottom, minHeight));
- result.constrainHeight = true;
- }
-
- else if (result.bottom <= target.top && result.top < inside.top) {
- newHeight = Math.max(result.getHeight() + result.top - inside.top, minHeight);
- result.adjust(result.getHeight() - newHeight);
- result.constrainHeight = true;
- }
-
- else if (result.getHeight() > inside.getHeight()) {
- result.setHeight(Math.max(minHeight, inside.getHeight()));
- result.setPosition(result.x, 0);
- result.constrainHeight = true;
- }
- }
- },
- checkMinWidth = function(minWidth, result, target, inside) {
- var newWidth;
- if (minWidth && inside) {
-
- if (result.left >= target.right && result.right > inside.right) {
- result.setWidth(Math.max(result.getWidth() + inside.right - result.right, minWidth));
- result.constrainWidth = true;
- }
-
- else if (result.right <= target.left && result.left < inside.left) {
- newWidth = Math.max(result.getWidth() + result.left - inside.left, minWidth);
- result.adjust(0, 0, 0, result.getWidth() - newWidth);
- result.constrainWidth = true;
- }
-
- else if (result.getWidth() > inside.getWidth()) {
- result.setWidth(Math.max(minWidth, inside.getWidth()));
- result.setPosition(0, result.y);
- result.constrainWidth = true;
- }
- }
- };
- return {
- isRegion: true,
- statics: {
-
- getRegion: function(el) {
- return Ext.fly(el).getRegion();
- },
-
- from: function(o) {
- return new this(o.top, o.right, o.bottom, o.left);
- },
-
- getAlignInfo: function(align, rtl) {
- if (typeof align === 'object') {
- return align;
- }
- align = align ? ((align.indexOf('-') < 0) ? 'tl-' + align : align) : 'tl-bl';
-
- constrain = constrainRe.exec(align);
- align = constrain[1];
-
- align = (rtl ? rtlAlignMap : alignMap)[align] || align;
- var offsetFactors = rtl ? RTLOffsetFactors : LTROffsetFactors,
- constrain,
- parts = alignRe.exec(align),
- result;
-
- if (!parts) {
- Ext.raise({
- sourceClass: 'Ext.util.Region',
- sourceMethod: 'getAlignInfo',
- position: align,
- msg: 'Attempted to align an element with an invalid position: "' + align + '"'
- });
- }
-
- result = {
- myEdge: parts[1],
- myOffset: parts[2],
- otherEdge: parts[4],
- otherOffset: parts[5],
- constrain: constrain[2]
- };
-
-
- if (parts[3]) {
- result.myEdge = parts[3][0];
- result.myOffset = offsetFactors[parts[3][1]];
- if (result.myOffset == null) {
- result.myOffset = 50;
- }
- }
- if (parts[6]) {
- result.otherEdge = parts[6][0];
- result.otherOffset = offsetFactors[parts[6][1]];
- if (result.otherOffset == null) {
- result.otherOffset = 50;
- }
- }
-
- result.position = relativePositions[result.myEdge];
- return result;
- }
- },
-
-
- constructor: function(top, right, bottom, left) {
- var me = this;
- me.y = me.top = me[1] = top;
- me.right = right;
- me.bottom = bottom;
- me.x = me.left = me[0] = left;
- me.height = me.bottom - me.top;
- me.width = me.right - me.left;
- },
-
- setPosition: function(x, y) {
-
- if (arguments.length === 1) {
- y = x[1];
- x = x[0];
- }
- return this.translateBy(x - this.x, y - this.y);
- },
-
- contains: function(region) {
- var me = this;
- return (region.x >= me.x && (region.right || region.x) <= me.right && region.y >= me.y && (region.bottom || region.y) <= me.bottom);
- },
-
- intersect: function(region) {
- var me = this,
- t = Math.max(me.y, region.y),
- r = Math.min(me.right, region.right),
- b = Math.min(me.bottom, region.bottom),
- l = Math.max(me.x, region.x);
- if (b > t && r > l) {
- return new this.self(t, r, b, l);
- } else {
- return false;
- }
- },
-
- union: function(region) {
- var me = this,
- t = Math.min(me.y, region.y),
- r = Math.max(me.right, region.right),
- b = Math.max(me.bottom, region.bottom),
- l = Math.min(me.x, region.x);
- return new this.self(t, r, b, l);
- },
-
- constrainTo: function(targetRegion) {
- var me = this,
- constrain = Ext.Number.constrain;
- me.top = me.y = constrain(me.top, targetRegion.y, targetRegion.bottom);
- me.bottom = constrain(me.bottom, targetRegion.y, targetRegion.bottom);
- me.left = me.x = constrain(me.left, targetRegion.x, targetRegion.right);
- me.right = constrain(me.right, targetRegion.x, targetRegion.right);
- me.height = me.bottom - me.top;
- me.width = me.right - me.left;
- return me;
- },
-
- adjust: function(top, right, bottom, left) {
- var me = this;
- me.top = me.y += top || 0;
- me.left = me.x += left || 0;
- me.right += right || 0;
- me.bottom += bottom || 0;
- me.height = me.bottom - me.top;
- me.width = me.right - me.left;
- return me;
- },
-
- getOutOfBoundOffset: function(axis, p) {
- if (!Ext.isObject(axis)) {
- if (axis === 'x') {
- return this.getOutOfBoundOffsetX(p);
- } else {
- return this.getOutOfBoundOffsetY(p);
- }
- } else {
- p = axis;
- var d = new ExtUtil.Offset();
- d.x = this.getOutOfBoundOffsetX(p.x);
- d.y = this.getOutOfBoundOffsetY(p.y);
- return d;
- }
- },
-
- getOutOfBoundOffsetX: function(p) {
- if (p <= this.x) {
- return this.x - p;
- } else if (p >= this.right) {
- return this.right - p;
- }
- return 0;
- },
-
- getOutOfBoundOffsetY: function(p) {
- if (p <= this.y) {
- return this.y - p;
- } else if (p >= this.bottom) {
- return this.bottom - p;
- }
- return 0;
- },
-
- isOutOfBound: function(axis, p) {
- if (!Ext.isObject(axis)) {
- if (axis === 'x') {
- return this.isOutOfBoundX(p);
- } else {
- return this.isOutOfBoundY(p);
- }
- } else {
- p = axis;
- return (this.isOutOfBoundX(p.x) || this.isOutOfBoundY(p.y));
- }
- },
-
- isOutOfBoundX: function(p) {
- return (p < this.x || p > this.right);
- },
-
- isOutOfBoundY: function(p) {
- return (p < this.y || p > this.bottom);
- },
-
- restrict: function(axis, p, factor) {
- if (Ext.isObject(axis)) {
- var newP;
- factor = p;
- p = axis;
- if (p.copy) {
- newP = p.copy();
- } else {
- newP = {
- x: p.x,
- y: p.y
- };
- }
- newP.x = this.restrictX(p.x, factor);
- newP.y = this.restrictY(p.y, factor);
- return newP;
- } else {
- if (axis === 'x') {
- return this.restrictX(p, factor);
- } else {
- return this.restrictY(p, factor);
- }
- }
- },
-
- restrictX: function(p, factor) {
- if (!factor) {
- factor = 1;
- }
- if (p <= this.x) {
- p -= (p - this.x) * factor;
- } else if (p >= this.right) {
- p -= (p - this.right) * factor;
- }
- return p;
- },
-
- restrictY: function(p, factor) {
- if (!factor) {
- factor = 1;
- }
- if (p <= this.y) {
- p -= (p - this.y) * factor;
- } else if (p >= this.bottom) {
- p -= (p - this.bottom) * factor;
- }
- return p;
- },
-
- alignTo: function(options) {
- var me = this,
- Region = me.self,
- Offset = ExtUtil.Offset,
- Element = Ext.Element,
- target = parseRegion(options.target),
- targetPlusAnchorOffset,
- rtl = options.rtl,
- overlap = options.overlap,
- align = options.align,
- anchorSize = options.anchorSize,
- offset = options.offset,
- inside = options.inside,
- position = options.position,
- allowXTranslate = options.allowXTranslate,
- allowYTranslate = options.allowYTranslate,
- wasConstrained, result, initialPosition, constrainedPosition;
- if (offset) {
- offset = Offset.fromObject(offset);
-
- if (!(offset instanceof Offset)) {
- Ext.raise('offset option must be an Ext.util.Offset');
- }
- }
-
- if (anchorSize) {
- anchorSize = Offset.fromObject(anchorSize);
-
- if (!(anchorSize instanceof Offset)) {
- Ext.raise('anchorSize option must be an Ext.util.Offset');
- }
- }
-
- if (inside && !inside.isRegion) {
- if (Ext.getDom(inside) === document.body) {
- inside = new Region(0, Element.getDocumentWidth(), Element.getDocumentHeight(), 0);
- } else {
- inside = Ext.fly(inside).getRegion();
- }
- }
-
-
-
- if (position) {
- if (position.length === 2) {
- position = new ExtUtil.Point(position[0], position[1]);
- }
-
- result = new Region().copyFrom(me).setPosition(position.x, position.y);
- } else {
-
- align = me.getAlignInfo(align, rtl);
-
-
- if (inside) {
- if (target.x >= inside.right) {
- target.setPosition(inside.right - 1, target.y);
- if (align.position !== 3) {
- align = me.getAlignInfo('r-l', rtl);
- }
- } else if (target.right < inside.x) {
- target.setPosition(inside.x - target.getWidth() + 1, target.y);
- if (align.position !== 1) {
- align = me.getAlignInfo('l-r', rtl);
- }
- }
- if (target.y >= inside.bottom) {
- target.setPosition(target.x, inside.bottom - 1);
- if (align.position !== 0) {
- align = me.getAlignInfo('b-t', rtl);
- }
- } else if (target.bottom < inside.y) {
- target.setPosition(target.x, inside.y - target.getHeight() + 1);
- if (align.position !== 2) {
- align = me.getAlignInfo('t-b', rtl);
- }
- }
- }
-
- targetPlusAnchorOffset = anchorSize ? addAnchorOffset(target, anchorSize, align.position) : target;
-
- result = Region.from(me).translateBy(me.getAlignToVector(targetPlusAnchorOffset, align));
-
- overlap = !!result.intersect(targetPlusAnchorOffset);
- if (offset && (overlap || !anchorSize)) {
- result.translateBy(offset);
- }
-
-
- if (anchorSize) {
- calculateAnchorPosition(target, result, align.position, anchorSize, inside);
- }
- }
-
- if (inside) {
- initialPosition = result.copy();
-
- if (result.left < inside.left) {
- result.translateBy(inside.left - result.left, 0);
- wasConstrained = true;
- }
-
- if (result.right > inside.right && result.left > inside.left) {
- result.translateBy(inside.right - result.right, 0);
- wasConstrained = true;
- }
-
- if (result.top < inside.top) {
- result.translateBy(0, inside.top - result.top);
- wasConstrained = true;
- }
-
- if (result.bottom > inside.bottom && result.top > inside.top) {
- result.translateBy(0, inside.bottom - result.bottom);
- wasConstrained = true;
- }
-
-
- if (wasConstrained && !overlap) {
-
- result.anchor = null;
-
-
-
-
-
-
-
- if (options.axisLock) {
- if (align.position & 1) {
- allowYTranslate = false;
- } else {
- allowXTranslate = false;
- }
- }
-
- if (position) {
- if (result.contains(position)) {
- position.exclude(result, {
- inside: inside,
- centerOnSideChange: false
- });
- }
- } else
- {
- constrainedPosition = result.copy();
- if (result.intersect(targetPlusAnchorOffset)) {
-
-
- align.position = target.exclude(result, {
- initialPosition: initialPosition,
- defaultPosition: align.position,
- inside: inside,
- minHeight: options.minHeight,
- minWidth: options.minWidth,
- allowX: allowXTranslate,
- allowY: allowYTranslate,
- offset: offset,
- anchorHeight: anchorSize ? anchorSize.y : 0,
- centerOnSideChange: !!anchorSize
- });
- } else if (options.minWidth && result.getWidth() > inside.getWidth()) {
- result.setPosition(0, result.y);
- result.setWidth(Math.max(inside.getWidth(), options.minWidth));
- result.constrainWidth = true;
- } else if (options.minHeight && result.getHeight() > inside.getHeight()) {
- result.setPosition(result.x, 0);
- result.setHeight(Math.max(inside.getHeight(), options.minHeight));
- result.constrainHeight = true;
- }
- result.align = align;
- if (inside.contains(result)) {
-
-
- if (anchorSize) {
- calculateAnchorPosition(target, result, align.position, anchorSize, inside);
- }
- } else
-
-
-
- {
- result = constrainedPosition;
- }
- }
- }
- }
- return result;
- },
-
- exclude: function(other, options) {
- options = options || {};
- var me = this,
- initialPosition = options.initialPosition || other,
- inside = options.inside,
- defaultPosition = options.defaultPosition,
- centerOnSideChange = options.centerOnSideChange,
- minHeight = options.minHeight,
- minWidth = options.minWidth,
- allowX = options.allowX !== false,
- allowY = options.allowY !== false,
- anchorHeight = options.anchorHeight,
- offset = options.offset,
- translations = [],
- testRegion, t, i, sizeConstrainedSolution, leastBadSolution, intersection, result;
-
- if (!offset) {
- offset = zeroOffset;
- }
-
-
-
- if (allowY) {
- translations.push([
- 0,
- me.top - other.bottom - anchorHeight + offset.y,
- 'b-t',
- 0,
- Math.abs(me.top - initialPosition.bottom - anchorHeight + offset.y)
- ]);
- translations.push([
- 0,
- me.bottom - other.top + anchorHeight + offset.y,
- 't-b',
- 2,
- Math.abs(me.bottom - initialPosition.top + anchorHeight + offset.y)
- ]);
- } else {
- centerOnSideChange = false;
- }
- if (allowX) {
- translations.push([
- me.left - other.right - anchorHeight + offset.x,
- 0,
- 'r-l',
- 3,
- Math.abs(me.left - initialPosition.right - anchorHeight + offset.x)
- ]);
- translations.push([
- me.right - other.left + anchorHeight + offset.x,
- 0,
- 'l-r',
- 1,
- Math.abs(me.right - initialPosition.left + anchorHeight + offset.x)
- ]);
- } else {
- centerOnSideChange = false;
- }
-
- Ext.Array.sort(translations, function(l, r) {
- var result = l[4] - r[4];
-
- if (!result) {
- if (l[3] === defaultPosition) {
- return -1;
- }
- if (r[3] === defaultPosition) {
- return 1;
- }
- }
- return result;
- });
-
-
- if (inside) {
- for (i = 0; i < translations.length; i++) {
- t = translations[i];
- testRegion = ExtUtil.Region.from(other);
- testRegion.translateBy.apply(testRegion, t);
-
- if (inside.contains(testRegion)) {
- other.copyFrom(testRegion);
- result = {
- align: t[2],
- position: t[3],
- distance: t[4]
- };
- break;
- }
-
-
-
- if (minHeight) {
- checkMinHeight(minHeight, testRegion, me, inside);
- if (inside.contains(testRegion)) {
- if (!sizeConstrainedSolution || testRegion.getArea() > sizeConstrainedSolution.region.getArea()) {
- sizeConstrainedSolution = {
- region: testRegion,
- align: t[2],
- position: t[3],
- distance: t[4]
- };
- }
- }
- }
- if (minWidth) {
- checkMinWidth(minWidth, testRegion, me, inside);
- if (inside.contains(testRegion)) {
- if (!sizeConstrainedSolution || testRegion.getArea() > sizeConstrainedSolution.region.getArea()) {
- sizeConstrainedSolution = {
- region: testRegion,
- align: t[2],
- position: t[3],
- distance: t[4]
- };
- }
- }
- }
-
-
-
- intersection = inside.intersect(testRegion);
- if (intersection) {
- intersection = intersection.getArea();
- if (!leastBadSolution || (intersection && leastBadSolution.area < intersection)) {
- leastBadSolution = {
- region: testRegion,
- align: t[2],
- position: t[3],
- distance: t[4],
- area: intersection
- };
- }
- }
- }
- if (!result) {
-
- if (sizeConstrainedSolution) {
- other.copyFrom(sizeConstrainedSolution.region);
- result = sizeConstrainedSolution;
- other.constrainWidth = sizeConstrainedSolution.region.constrainWidth;
- other.constrainHeight = sizeConstrainedSolution.region.constrainHeight;
- }
-
- else if (leastBadSolution) {
- other.copyFrom(leastBadSolution.region);
- result = leastBadSolution;
- }
- }
- if (result) {
-
-
- if ((result.position & 1) !== (defaultPosition & 1)) {
- if (result.distance && centerOnSideChange) {
- t = other.alignTo({
- align: result.align,
- target: me,
- anchorSize: anchorHeight,
- offset: offset,
- axisLock: true,
- inside: inside,
- minHeight: options.minHeight,
- minWidth: options.minWidth
- });
- if (inside.contains(t)) {
- other.setPosition(t.x, t.y);
- }
- }
- }
- return result.position;
- }
- } else
- {
-
- other.translateBy.apply(other, translations[0]);
- return translations[0][3];
- }
- return defaultPosition;
- },
- getAlignToXY: function(target, align, rtl) {
- var alignVector = this.getAlignToVector(target, align, rtl);
- return [
- this.x + alignVector[0],
- this.y + alignVector[1]
- ];
- },
- getAnchorPoint: function(align, rtl) {
- align = (typeof align === 'string') ? this.getAlignInfo(align + '-tl', rtl) : align;
- return this['getAnchorPoint_' + align.myEdge](align.myOffset);
- },
- getAlignToVector: function(target, align, rtl) {
- align = (typeof align === 'string') ? this.getAlignInfo(align, rtl) : align;
- var myAnchorPoint = this['getAnchorPoint_' + align.myEdge](align.myOffset),
- targetAnchorPoint = target['getAnchorPoint_' + align.otherEdge](align.otherOffset);
- return [
- targetAnchorPoint[0] - myAnchorPoint[0],
- targetAnchorPoint[1] - myAnchorPoint[1]
- ];
- },
- getAnchorPoint_t: function(offset) {
- return [
- this.x + Math.round(this.getWidth() * (offset / 100)),
- this.y
- ];
- },
- getAnchorPoint_b: function(offset) {
- return [
- this.x + Math.round(this.getWidth() * (offset / 100)),
- this.bottom
- ];
- },
- getAnchorPoint_l: function(offset) {
- return [
- this.x,
- this.y + Math.round(this.getHeight() * (offset / 100))
- ];
- },
- getAnchorPoint_r: function(offset) {
- return [
- this.right,
- this.y + Math.round(this.getHeight() * (offset / 100))
- ];
- },
- getAnchorPoint_c: function() {
- return [
- this.x + Math.round(this.getWidth() / 2),
- this.y + Math.round(this.getHeight() / 2)
- ];
- },
- getCenter: function() {
- return [
- this.x + this.width / 2,
- this.y + this.height / 2
- ];
- },
- getHeight: function() {
- return this.bottom - this.y;
- },
- getWidth: function() {
- return this.right - this.x;
- },
- getArea: function() {
- return this.getHeight() * this.getWidth();
- },
- setHeight: function(h) {
- this.height = h;
- this.bottom = this.top + h;
- return this;
- },
- setWidth: function(w) {
- this.width = w;
- this.right = this.left + w;
- return this;
- },
-
- getSize: function() {
- return {
- width: this.right - this.x,
- height: this.bottom - this.y
- };
- },
- setSize: function(w, h) {
- if (h === undefined) {
- h = w;
- }
- this.setWidth(w);
- return this.setHeight(h);
- },
-
- copy: function() {
- return new this.self(this.y, this.right, this.bottom, this.x);
- },
-
- copyFrom: function(p) {
- var me = this;
- me.top = me.y = me[1] = p.y;
- me.right = p.right;
- me.bottom = p.bottom;
- me.left = me.x = me[0] = p.x;
- return me;
- },
-
- toString: function() {
- return "Region[" + this.top + "," + this.right + "," + this.bottom + "," + this.left + "]";
- },
-
- translateBy: function(x, y) {
- if (x.length) {
- y = x[1];
- x = x[0];
- } else if (arguments.length === 1) {
- y = x.y;
- x = x.x;
- }
- var me = this;
- me.top = me.y += y;
- me.right += x;
- me.bottom += y;
- me.left = me.x += x;
- return me;
- },
-
- round: function() {
- var me = this;
- me.top = me.y = Math.round(me.y);
- me.right = Math.round(me.right);
- me.bottom = Math.round(me.bottom);
- me.left = me.x = Math.round(me.x);
- return me;
- },
-
- equals: function(region) {
- return (this.top === region.top && this.right === region.right && this.bottom === region.bottom && this.left === region.left);
- },
-
- getOffsetsTo: function(offsetsTo) {
- return {
- x: this.x - offsetsTo.x,
- y: this.y - offsetsTo.y
- };
- },
-
- highlight: function() {
- var highlightEl = Ext.getBody().createChild({
- style: 'background-color:#52a0db;opacity:0.4;position:absolute;z-index:9999999'
- });
- highlightEl.setBox(this);
- Ext.defer(function() {
- highlightEl.destroy();
- }, 5000);
- return highlightEl;
- }
- };
- },
- function(Region) {
- Region.prototype.getAlignInfo = Region.getAlignInfo;
- Region.EMPTY = new Region(0, 0, 0, 0);
-
- if (Object.freeze) {
- Object.freeze(Region.EMPTY);
- }
- });
- Ext.define('Ext.util.Point', {
- extend: Ext.util.Region,
- isPoint: true,
- radianToDegreeConstant: 180 / Math.PI,
- origin: {
- x: 0,
- y: 0
- },
- statics: {
-
- fromEvent: function(e) {
- var changedTouches = e.changedTouches,
- touch = (changedTouches && changedTouches.length > 0) ? changedTouches[0] : e;
- return this.fromTouch(touch);
- },
-
- fromTouch: function(touch) {
- return new this(touch.pageX, touch.pageY);
- },
-
- from: function(object) {
- if (!object) {
- return new this(0, 0);
- }
- if (!(object instanceof this)) {
- return new this(object.x, object.y);
- }
- return object;
- }
- },
-
- constructor: function(x, y) {
- if (x == null) {
- x = 0;
- }
- if (y == null) {
- y = 0;
- }
- this.callParent([
- y,
- x,
- y,
- x
- ]);
- },
-
- clone: function() {
- return new this.self(this.x, this.y);
- },
-
- copy: function() {
- return this.clone.apply(this, arguments);
- },
-
- copyFrom: function(point) {
- this.x = point.x;
- this.y = point.y;
- return this;
- },
-
- toString: function() {
- return "Point[" + this.x + "," + this.y + "]";
- },
-
- equals: function(point) {
- return (this.x === point.x && this.y === point.y);
- },
-
- isCloseTo: function(point, threshold) {
- if (typeof threshold == 'number') {
- return this.getDistanceTo(point) <= threshold;
- }
- var x = point.x,
- y = point.y,
- thresholdX = threshold.x,
- thresholdY = threshold.y;
- return (this.x <= x + thresholdX && this.x >= x - thresholdX && this.y <= y + thresholdY && this.y >= y - thresholdY);
- },
-
- isWithin: function() {
- return this.isCloseTo.apply(this, arguments);
- },
-
- isContainedBy: function(region) {
- if (!(region instanceof Ext.util.Region)) {
- region = Ext.get(region.el || region).getRegion();
- }
- return region.contains(this);
- },
-
- roundedEquals: function(point) {
- if (!point || typeof point !== 'object') {
- point = this.origin;
- }
- return (Math.round(this.x) === Math.round(point.x) && Math.round(this.y) === Math.round(point.y));
- },
- getDistanceTo: function(point) {
- if (!point || typeof point !== 'object') {
- point = this.origin;
- }
- var deltaX = this.x - point.x,
- deltaY = this.y - point.y;
- return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- },
- getAngleTo: function(point) {
- if (!point || typeof point !== 'object') {
- point = this.origin;
- }
- var deltaX = this.x - point.x,
- deltaY = this.y - point.y;
- return Math.atan2(deltaY, deltaX) * this.radianToDegreeConstant;
- }
- }, function() {
-
- this.prototype.translate = this.prototype.translateBy;
- });
- Ext.define('Ext.event.Event', {
- alternateClassName: 'Ext.EventObjectImpl',
-
-
-
-
-
-
-
-
-
-
-
-
-
- stopped: false,
-
- claimed: false,
-
- defaultPrevented: false,
- isEvent: true,
-
- geckoRelatedTargetEvents: {
- blur: 1,
- dragenter: 1,
- dragleave: 1,
- focus: 1
- },
- statics: {
- resolveTextNode: function(node) {
- return (node && node.nodeType === 3) ? node.parentNode : node;
- },
-
- gestureEvents: {},
-
- pointerEvents: {
- pointerdown: 1,
- pointermove: 1,
- pointerup: 1,
- pointercancel: 1,
- pointerover: 1,
- pointerout: 1,
- pointerenter: 1,
- pointerleave: 1,
- MSPointerDown: 1,
- MSPointerMove: 1,
- MSPointerUp: 1,
- MSPointerOver: 1,
- MSPointerOut: 1,
- MSPointerCancel: 1,
- MSPointerEnter: 1,
- MSPointerLeave: 1
- },
-
- mouseEvents: {
- mousedown: 1,
- mousemove: 1,
- mouseup: 1,
- mouseover: 1,
- mouseout: 1,
- mouseenter: 1,
- mouseleave: 1
- },
-
- clickEvents: {
- click: 1,
- dblclick: 1
- },
-
- touchEvents: {
- touchstart: 1,
- touchmove: 1,
- touchend: 1,
- touchcancel: 1
- },
-
- focusEvents: {
- focus: 1,
- focusin: 1,
- focusenter: 1
- },
-
- blurEvents: {
- blur: 1,
- focusout: 1,
- focusleave: 1
- },
-
-
-
-
- pointerTypeMap: {
- 2: 'touch',
- 3: 'pen',
- 4: 'mouse',
- touch: 'touch',
- pen: 'pen',
- mouse: 'mouse'
- },
- keyEventRe: /^key/,
- keyFlags: {
- CTRL: 'ctrlKey',
- CONTROL: 'ctrlKey',
- ALT: 'altKey',
- SHIFT: 'shiftKey',
- CMD: 'metaKey',
- COMMAND: 'metaKey',
- CMDORCTRL: Ext.isMac ? 'metaKey' : 'ctrlKey',
- COMMANDORCONTROL: Ext.isMac ? 'metaKey' : 'ctrlKey',
- META: 'metaKey'
- },
- modifierGlyphs: {
- ctrlKey: '⌃',
- altKey: '⌥',
- metaKey: Ext.isMac ? '⌘' : '⊞',
- shiftKey: '⇧'
- },
- specialKeyGlyphs: {
- BACKSPACE: '⌫',
- TAB: '⇥',
- ENTER: '⏎',
- RETURN: '⏎',
- SPACE: '␣',
- PAGE_UP: '⇞',
- PAGE_DOWN: '⇟',
- END: '⇲',
- HOME: '⌂',
- LEFT: '←',
- UP: '↑',
- RIGHT: '→',
- DOWN: '↓',
- PRINT_SCREEN: '⎙',
- INSERT: '⎀',
- DELETE: '⌦',
- CONTEXT_MENU: '☰'
- },
- _hyphenRe: /^[a-z]+\-/i,
-
-
- getKeyId: function(keyName) {
-
- if (typeof keyName === 'number') {
- keyName = this.keyCodes[keyName];
- } else {
- keyName = keyName.toUpperCase();
- }
- var me = this,
- delim = me._hyphenRe.test(keyName) ? '-' : '+',
- parts = (keyName === delim) ? [
- delim
- ] : keyName.split(delim),
- numModifiers = parts.length - 1,
- rawKey = parts[numModifiers],
- result = [],
- eventFlag, i;
-
- if (!Ext.event.Event[rawKey]) {
- Ext.raise('Invalid key name: "' + rawKey + '"');
- }
-
- for (i = 0; i < numModifiers; i++) {
- eventFlag = me.keyFlags[parts[i]];
-
- if (!eventFlag) {
- Ext.raise('Invalid key modifier: "' + parts[i] + '"');
- }
-
- result[eventFlag] = true;
- }
- if (result.ctrlKey) {
- result.push(me.modifierGlyphs.ctrlKey);
- }
- if (result.altKey) {
- result.push(me.modifierGlyphs.altKey);
- }
- if (result.shiftKey) {
- result.push(me.modifierGlyphs.shiftKey);
- }
- if (result.metaKey) {
- result.push(me.modifierGlyphs.metaKey);
- }
- result.push(this.specialKeyGlyphs[rawKey] || rawKey);
- return result.join('');
- },
-
- globalTabKeyDown: function(e) {
- if (e.keyCode === 9) {
- Ext.event.Event.forwardTab = !e.shiftKey;
- }
- },
-
- globalTabKeyUp: function(e) {
- if (e.keyCode === 9) {
- delete Ext.event.Event.forwardTab;
- }
- }
- },
- constructor: function(event) {
- var me = this,
- self = me.self,
- resolveTextNode = me.self.resolveTextNode,
- changedTouches = event.changedTouches,
-
-
-
- coordinateOwner = changedTouches ? changedTouches[0] : event,
- type = event.type,
- pointerType, relatedTarget;
-
-
- me.timeStamp = me.time = Ext.now();
- me.pageX = coordinateOwner.pageX;
- me.pageY = coordinateOwner.pageY;
- me.clientX = coordinateOwner.clientX;
- me.clientY = coordinateOwner.clientY;
- me.target = me.delegatedTarget = resolveTextNode(event.target);
- me.currentTarget = resolveTextNode(event.currentTarget);
- relatedTarget = event.relatedTarget;
- if (relatedTarget) {
- if (Ext.isGecko && me.geckoRelatedTargetEvents[type]) {
- try {
- me.relatedTarget = resolveTextNode(relatedTarget);
- } catch (e) {
- me.relatedTarget = null;
- }
- } else {
- me.relatedTarget = resolveTextNode(relatedTarget);
- }
- }
- me.browserEvent = me.event = event;
- me.type = type;
-
-
- me.button = event.button || 0;
- me.shiftKey = event.shiftKey;
-
- me.ctrlKey = event.ctrlKey || event.metaKey || false;
- me.altKey = event.altKey;
- me.charCode = event.charCode;
- me.keyCode = event.keyCode;
- me.buttons = event.buttons;
-
-
-
-
-
- if (me.button === 0 && me.buttons === 0) {
- me.buttons = 1;
- }
- if (self.focusEvents[type] || self.blurEvents[type]) {
- if (self.forwardTab !== undefined) {
- me.forwardTab = self.forwardTab;
- }
- if (self.focusEvents[type]) {
- me.fromElement = event.relatedTarget;
- me.toElement = event.target;
- } else {
- me.fromElement = event.target;
- me.toElement = event.relatedTarget;
- }
- } else if (type !== 'keydown') {
-
-
-
- delete self.forwardTab;
- }
- if (self.mouseEvents[type]) {
- pointerType = 'mouse';
- } else if (self.clickEvents[type]) {
-
-
-
-
- pointerType = self.pointerTypeMap[event.pointerType] || (((Ext.now() - Ext.event.publisher.Dom.lastTouchEndTime) < 1000) ? 'touch' : 'mouse');
- } else if (self.pointerEvents[type]) {
-
-
- pointerType = self.pointerTypeMap[event.pointerType] || 'mouse';
- } else if (self.touchEvents[type]) {
- pointerType = 'touch';
- }
- if (pointerType) {
- me.pointerType = pointerType;
- }
-
-
- me.isMultitouch = event.isPrimary === false || (event.touches && event.touches.length > 1);
- },
-
- chain: function(props) {
- var e = Ext.Object.chain(this);
- e.parentEvent = this;
-
- return Ext.apply(e, props);
- },
-
- correctWheelDelta: function(delta) {
- var scale = this.WHEEL_SCALE,
- ret = Math.round(delta / scale);
- if (!ret && delta) {
- ret = (delta < 0) ? -1 : 1;
- }
-
- return ret;
- },
- getChar: function() {
- var r = this.which();
- return String.fromCharCode(r);
- },
-
- getCharCode: function() {
- return this.charCode || this.keyCode;
- },
-
- getKey: function() {
- return this.keyCode || this.charCode;
- },
-
- getKeyName: function() {
- return this.type === 'keypress' ? String.fromCharCode(this.getCharCode()) : this.keyCodes[this.keyCode];
- },
-
- key: function() {
- return this.browserEvent.key;
- },
- which: function() {
- var me = this,
- e = me.browserEvent,
- r = e.which;
- if (r == null) {
- if (me.self.keyEventRe.test(e.type)) {
- r = e.charCode || e.keyCode;
- } else if ((r = e.button) !== undefined) {
-
- r = (r & 1) ? 1 : ((r & 4) ? 2 : ((r & 2) ? 3 : 0));
- }
- }
- return r;
- },
-
- getClipboardData: function(type) {
- var clipboardData = this.browserEvent.clipboardData,
- clipIE = Ext.global.clipboardData,
-
- result = null,
- typeIE;
- type = type || 'text/plain';
- if (clipboardData && clipboardData.getData) {
- result = clipboardData.getData(type);
- } else if (clipIE && clipIE.getData) {
- typeIE = this.ieMimeType[type];
- if (typeIE) {
- result = clipIE.getData(typeIE);
- }
- }
- return result;
- },
-
- getPoint: function() {
- var me = this,
- point = me.point,
- xy;
- if (!point) {
- xy = me.getXY();
- point = me.point = new Ext.util.Point(xy[0], xy[1]);
- }
- return point;
- },
-
- getRelatedTarget: function(selector, maxDepth, returnEl) {
- var relatedTarget = this.relatedTarget,
- target = null;
-
-
-
- if (relatedTarget && relatedTarget.nodeType) {
- if (selector) {
- target = Ext.fly(relatedTarget).findParent(selector, maxDepth, returnEl);
- } else {
- target = returnEl ? Ext.get(relatedTarget) : relatedTarget;
- }
- }
- return target;
- },
-
- getTarget: function(selector, maxDepth, returnEl) {
- return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
- },
-
- getTime: function() {
- return this.time;
- },
-
- getWheelDelta: function() {
- var deltas = this.getWheelDeltas();
- return deltas.y;
- },
-
- getWheelDeltas: function() {
- var me = this,
- event = me.browserEvent,
- dx = 0,
- dy = 0;
-
- if (Ext.isDefined(event.wheelDeltaX)) {
-
- dx = event.wheelDeltaX;
- dy = event.wheelDeltaY;
- } else if (event.wheelDelta) {
-
- dy = event.wheelDelta;
- } else if ('deltaX' in event) {
-
- dx = event.deltaX;
- dy = -event.deltaY;
- }
-
- else if (event.detail) {
-
- dy = -event.detail;
-
-
-
- if (dy > 100) {
- dy = 3;
- } else if (dy < -100) {
- dy = -3;
- }
-
-
- if (Ext.isDefined(event.axis) && event.axis === event.HORIZONTAL_AXIS) {
- dx = dy;
- dy = 0;
- }
- }
- return {
- x: me.correctWheelDelta(dx),
- y: me.correctWheelDelta(dy)
- };
- },
-
- getX: function() {
- return this.getXY()[0];
- },
-
- getXY: function() {
- var me = this,
- xy = me.xy;
- if (!xy) {
- xy = me.xy = [
- me.pageX,
- me.pageY
- ];
-
- var x = xy[0],
- browserEvent, doc, docEl, body;
-
- if (!x && x !== 0) {
- browserEvent = me.browserEvent;
- doc = document;
- docEl = doc.documentElement;
- body = doc.body;
- xy[0] = browserEvent.clientX + (docEl && docEl.scrollLeft || body && body.scrollLeft || 0) - (docEl && docEl.clientLeft || body && body.clientLeft || 0);
- xy[1] = browserEvent.clientY + (docEl && docEl.scrollTop || body && body.scrollTop || 0) - (docEl && docEl.clientTop || body && body.clientTop || 0);
- }
- }
-
- return xy;
- },
-
- getY: function() {
- return this.getXY()[1];
- },
-
- hasModifier: function() {
- var me = this;
- return !!(me.ctrlKey || me.altKey || me.shiftKey || me.metaKey);
- },
-
- isNavKeyPress: function(scrollableOnly) {
- var me = this,
- k = me.keyCode,
- isKeyPress = me.type === 'keypress';
-
- return ((!isKeyPress || Ext.isGecko) && k >= 33 && k <= 40) || (
- !scrollableOnly && (k === me.RETURN || k === me.TAB || k === me.ESC));
- },
-
- isSpecialKey: function() {
- var me = this,
- k = me.keyCode,
- isGecko = Ext.isGecko,
- isKeyPress = me.type === 'keypress';
-
- return (isGecko && isKeyPress && me.charCode === 0) || (this.isNavKeyPress()) || (k === me.BACKSPACE) || (k === me.ENTER) || (k >= 16 && k <= 20) || (
- (!isKeyPress || isGecko) && k >= 44 && k <= 46);
- },
-
- makeUnpreventable: function() {
- this.browserEvent.preventDefault = Ext.emptyFn;
- },
-
- preventDefault: function() {
- var me = this,
- parentEvent = me.parentEvent;
- me.defaultPrevented = true;
-
-
- if (parentEvent) {
- parentEvent.defaultPrevented = true;
- }
- me.browserEvent.preventDefault();
- return me;
- },
- setCurrentTarget: function(target) {
- this.currentTarget = this.delegatedTarget = target;
- },
-
- stopEvent: function() {
- return this.preventDefault().stopPropagation();
- },
-
- mousedownEvents: {
- mousedown: 1,
- pointerdown: 1,
- touchstart: 1
- },
-
- mouseupEvents: {
- mouseup: 1,
- pointerup: 1,
- touchend: 1
- },
-
- stopPropagation: function() {
- var me = this,
- browserEvent = me.browserEvent,
- parentEvent = me.parentEvent;
-
-
- if (me.mousedownEvents[me.type]) {
- Ext.GlobalEvents.fireMouseDown(me);
- }
-
-
- if (me.mouseupEvents[me.type]) {
- Ext.GlobalEvents.fireMouseUp(me);
- }
-
-
- me.stopped = true;
-
-
-
-
-
-
-
-
-
-
- if (parentEvent && !me.isGesture) {
- parentEvent.stopped = true;
- }
-
- if (!browserEvent.stopPropagation) {
-
- browserEvent.cancelBubble = true;
- return me;
- }
-
-
-
- browserEvent.stopPropagation();
- return me;
- },
-
- claimGesture: function() {
- var me = this,
- parentEvent = me.parentEvent;
- me.claimed = true;
- if (parentEvent && !me.isGesture) {
- parentEvent.claimGesture();
- } else {
-
-
-
-
- me.preventDefault();
- }
- return me;
- },
-
- within: function(el, related, allowEl) {
- var t;
- if (el) {
- t = related ? this.getRelatedTarget() : this.getTarget();
- }
- if (!t || (allowEl === false && t === Ext.getDom(el))) {
- return false;
- }
- return Ext.fly(el).contains(t);
- },
- privates: {
- ieMimeType: {
- "text/plain": 'Text'
- }
- },
- deprecated: {
- '4.0': {
- methods: {
-
- getPageX: 'getX',
-
- getPageY: 'getY'
- }
- }
- }
- }, function(Event) {
- var constants = {
-
- BACKSPACE: 8,
-
- TAB: 9,
-
- NUM_CENTER: 12,
-
- ENTER: 13,
-
- RETURN: 13,
-
- SHIFT: 16,
-
- CTRL: 17,
-
- ALT: 18,
-
- PAUSE: 19,
-
- CAPS_LOCK: 20,
-
- ESC: 27,
-
- SPACE: 32,
-
- PAGE_UP: 33,
-
- PAGE_DOWN: 34,
-
- END: 35,
-
- HOME: 36,
-
- LEFT: 37,
-
- UP: 38,
-
- RIGHT: 39,
-
- DOWN: 40,
-
- PRINT_SCREEN: 44,
-
- INSERT: 45,
-
- DELETE: 46,
-
- ZERO: 48,
-
- ONE: 49,
-
- TWO: 50,
-
- THREE: 51,
-
- FOUR: 52,
-
- FIVE: 53,
-
- SIX: 54,
-
- SEVEN: 55,
-
- EIGHT: 56,
-
- NINE: 57,
-
- A: 65,
-
- B: 66,
-
- C: 67,
-
- D: 68,
-
- E: 69,
-
- F: 70,
-
- G: 71,
-
- H: 72,
-
- I: 73,
-
- J: 74,
-
- K: 75,
-
- L: 76,
-
- M: 77,
-
- N: 78,
-
- O: 79,
-
- P: 80,
-
- Q: 81,
-
- R: 82,
-
- S: 83,
-
- T: 84,
-
- U: 85,
-
- V: 86,
-
- W: 87,
-
- X: 88,
-
- Y: 89,
-
- Z: 90,
-
- META: 91,
-
-
- CONTEXT_MENU: 93,
-
- NUM_ZERO: 96,
-
- NUM_ONE: 97,
-
- NUM_TWO: 98,
-
- NUM_THREE: 99,
-
- NUM_FOUR: 100,
-
- NUM_FIVE: 101,
-
- NUM_SIX: 102,
-
- NUM_SEVEN: 103,
-
- NUM_EIGHT: 104,
-
- NUM_NINE: 105,
-
- NUM_MULTIPLY: 106,
-
- NUM_PLUS: 107,
-
- NUM_MINUS: 109,
-
- NUM_PERIOD: 110,
-
- NUM_DIVISION: 111,
-
- F1: 112,
-
- F2: 113,
-
- F3: 114,
-
- F4: 115,
-
- F5: 116,
-
- F6: 117,
-
- F7: 118,
-
- F8: 119,
-
- F9: 120,
-
- F10: 121,
-
- F11: 122,
-
- F12: 123,
-
- WHEEL_SCALE: 120
- },
-
- keyCodes = {},
- gestureEvents = Event.gestureEvents,
- prototype = Event.prototype,
- i, keyName, keyCode, keys, s, scale;
- if (Ext.isGecko) {
-
- constants.WHEEL_SCALE = 3;
- } else if (Ext.isMac) {
-
-
-
- if (Ext.isSafari && Ext.webKitVersion >= 532) {
-
-
-
-
-
-
- scale = 120;
- } else {
-
-
- scale = 12;
- }
-
-
-
-
- constants.WHEEL_SCALE = 3 * scale;
- }
- Ext.apply(gestureEvents, Event.mouseEvents);
- Ext.apply(gestureEvents, Event.pointerEvents);
- Ext.apply(gestureEvents, Event.touchEvents);
- Ext.apply(Event, constants);
- Ext.apply(prototype, constants);
-
- delete constants.WHEEL_SCALE;
-
-
-
- delete constants.RETURN;
-
- for (keyName in constants) {
- keyCode = constants[keyName];
- keyCodes[keyCode] = keyName;
- }
- Event.keyCodes = prototype.keyCodes = keyCodes;
-
- if (!Ext.isIE9m) {
- document.addEventListener('keydown', Event.globalTabKeyDown, true);
- document.addEventListener('keyup', Event.globalTabKeyUp, true);
- }
-
- prototype.getTrueXY = prototype.getXY;
- if (typeof KeyboardEvent !== 'undefined' && !('key' in KeyboardEvent.prototype)) {
- prototype._keys = keys = {
- 3: 'Cancel',
- 6: 'Help',
- 8: 'Backspace',
- 9: 'Tab',
- 12: 'Clear',
- 13: 'Enter',
- 16: 'Shift',
- 17: 'Control',
- 18: 'Alt',
- 19: 'Pause',
- 20: 'CapsLock',
- 27: 'Escape',
- 28: 'Convert',
- 29: 'NonConvert',
- 30: 'Accept',
- 31: 'ModeChange',
- 32: ' ',
- 33: 'PageUp',
- 34: 'PageDown',
- 35: 'End',
- 36: 'Home',
- 37: 'ArrowLeft',
- 38: 'ArrowUp',
- 39: 'ArrowRight',
- 40: 'ArrowDown',
- 41: 'Select',
- 42: 'Print',
- 43: 'Execute',
- 44: 'PrintScreen',
- 45: 'Insert',
- 46: 'Delete',
- 48: [
- '0',
- ')'
- ],
- 49: [
- '1',
- '!'
- ],
- 50: [
- '2',
- '@'
- ],
- 51: [
- '3',
- '#'
- ],
- 52: [
- '4',
- '$'
- ],
- 53: [
- '5',
- '%'
- ],
- 54: [
- '6',
- '^'
- ],
- 55: [
- '7',
- '&'
- ],
- 56: [
- '8',
- '*'
- ],
- 57: [
- '9',
- '('
- ],
- 91: 'OS',
- 93: 'ContextMenu',
- 144: 'NumLock',
- 145: 'ScrollLock',
- 181: 'VolumeMute',
- 182: 'VolumeDown',
- 183: 'VolumeUp',
- 186: [
- ';',
- ':'
- ],
- 187: [
- '=',
- '+'
- ],
- 188: [
- ',',
- '<'
- ],
- 189: [
- '-',
- '_'
- ],
- 190: [
- '.',
- '>'
- ],
- 191: [
- '/',
- '?'
- ],
- 192: [
- '`',
- '~'
- ],
- 219: [
- '[',
- '{'
- ],
- 220: [
- '\\',
- '|'
- ],
- 221: [
- ']',
- '}'
- ],
- 222: [
- "'",
- '"'
- ],
- 224: 'Meta',
- 225: 'AltGraph',
- 246: 'Attn',
- 247: 'CrSel',
- 248: 'ExSel',
- 249: 'EraseEof',
- 250: 'Play',
- 251: 'ZoomOut'
- };
- for (i = 1; i < 25; ++i) {
- keys[i + 111] = 'F' + i;
- }
-
- for (i = 0; i < 26; ++i) {
-
- keys[i] = [
- String.fromCharCode(i + 97),
- String.fromCharCode(i + 65)
- ];
- }
- prototype.key = function() {
- var k = keys[this.browserEvent.which || this.keyCode];
- if (k && typeof k !== 'string') {
- k = k[+this.shiftKey];
- }
- return k;
- };
- }
- });
- Ext.define('Ext.event.publisher.Dom', {
- extend: Ext.event.publisher.Publisher,
- type: 'dom',
-
- handledDomEvents: [],
- reEnterCount: 0,
-
-
-
- captureEvents: {
- animationstart: 1,
- animationend: 1,
- resize: 1,
- focus: 1,
- blur: 1
- },
-
-
- directEvents: {
- mouseenter: 1,
- mouseleave: 1,
- pointerenter: 1,
- pointerleave: 1,
- MSPointerEnter: 1,
- MSPointerLeave: 1,
- load: 1,
- unload: 1,
- beforeunload: 1,
- error: 1,
- DOMContentLoaded: 1,
- DOMFrameContentLoaded: 1,
- hashchange: 1,
-
-
-
- scroll: 1,
- online: 1,
- offline: 1
- },
-
- blockedPointerEvents: {
- pointerover: 1,
- pointerout: 1,
- pointerenter: 1,
- pointerleave: 1,
- MSPointerOver: 1,
- MSPointerOut: 1,
- MSPointerEnter: 1,
- MSPointerLeave: 1
- },
-
- blockedCompatibilityMouseEvents: {
- mouseenter: 1,
- mouseleave: 1
- },
- constructor: function() {
- var me = this,
- supportsPassive = Ext.supports.PassiveEventListener;
- me.listenerOptions = supportsPassive ? {
- passive: false
- } : false;
- me.captureOptions = supportsPassive ? {
- passive: false,
- capture: true
- } : true;
- me.bubbleSubscribers = {};
- me.captureSubscribers = {};
- me.directSubscribers = {};
- me.directCaptureSubscribers = {};
-
-
-
- me.delegatedListeners = {};
- me.initHandlers();
- Ext.onInternalReady(me.onReady, me);
- me.callParent();
- me.registerDomEvents();
- },
- registerDomEvents: function() {
- var me = this,
- publishersByEvent = Ext.event.publisher.Publisher.publishersByEvent,
- domEvents = me.handledDomEvents,
- ln = domEvents.length,
- i, eventName;
- for (i = 0; i < ln; i++) {
- eventName = domEvents[i];
- me.handles[eventName] = 1;
- publishersByEvent[eventName] = me;
- }
- },
- onReady: function() {
- var me = this,
- domEvents = me.handledDomEvents,
- ln, i;
- if (domEvents) {
-
-
-
-
-
- for (i = 0 , ln = domEvents.length; i < ln; i++) {
- me.addDelegatedListener(domEvents[i]);
- }
- }
-
-
-
- Ext.getWin().on('unload', me.destroy, me, {
- priority: -10000
- });
- },
- initHandlers: function() {
- var me = this;
- me.onDelegatedEvent = Ext.bind(me.onDelegatedEvent, me);
- me.onDirectEvent = Ext.bind(me.onDirectEvent, me);
- me.onDirectCaptureEvent = Ext.bind(me.onDirectCaptureEvent, me);
- },
- addDelegatedListener: function(eventName) {
- var me = this;
- me.delegatedListeners[eventName] = 1;
- me.target.addEventListener(eventName, me.onDelegatedEvent, me.captureEvents[eventName] ? me.captureOptions : me.listenerOptions);
- },
- removeDelegatedListener: function(eventName) {
- var me = this;
- delete me.delegatedListeners[eventName];
- me.target.removeEventListener(eventName, me.onDelegatedEvent, me.captureEvents[eventName] ? me.captureOptions : me.listenerOptions);
- },
- addDirectListener: function(eventName, element, capture) {
- var me = this;
- element.dom.addEventListener(eventName, capture ? me.onDirectCaptureEvent : me.onDirectEvent, capture ? me.captureOptions : me.listenerOptions);
- },
- removeDirectListener: function(eventName, element, capture) {
- var me = this;
- element.dom.removeEventListener(eventName, capture ? me.onDirectCaptureEvent : me.onDirectEvent, capture ? me.captureOptions : me.listenerOptions);
- },
- subscribe: function(element, eventName, delegated, capture) {
- var me = this,
- subscribers, id;
- if (delegated && !me.directEvents[eventName]) {
-
- subscribers = capture ? me.captureSubscribers : me.bubbleSubscribers;
- if (!me.handles[eventName] && !me.delegatedListeners[eventName]) {
-
-
- me.addDelegatedListener(eventName);
- }
- if (subscribers[eventName]) {
- ++subscribers[eventName];
- } else {
- subscribers[eventName] = 1;
- }
- } else {
- subscribers = capture ? me.directCaptureSubscribers : me.directSubscribers;
- id = element.id;
-
-
-
-
- subscribers = subscribers[eventName] || (subscribers[eventName] = {});
- if (subscribers[id]) {
- ++subscribers[id];
- } else {
- subscribers[id] = 1;
- me.addDirectListener(eventName, element, capture);
- }
- }
- },
- unsubscribe: function(element, eventName, delegated, capture) {
- var me = this,
- captureSubscribers, bubbleSubscribers, subscribers, id;
- if (delegated && !me.directEvents[eventName]) {
- captureSubscribers = me.captureSubscribers;
- bubbleSubscribers = me.bubbleSubscribers;
- subscribers = capture ? captureSubscribers : bubbleSubscribers;
- if (subscribers[eventName]) {
- --subscribers[eventName];
- }
- if (!me.handles[eventName] && !bubbleSubscribers[eventName] && !captureSubscribers[eventName]) {
-
-
- this.removeDelegatedListener(eventName);
- }
- } else {
- subscribers = capture ? me.directCaptureSubscribers : me.directSubscribers;
- id = element.id;
- subscribers = subscribers[eventName];
- if (subscribers[id]) {
- --subscribers[id];
- }
- if (!subscribers[id]) {
-
-
- delete subscribers[id];
- me.removeDirectListener(eventName, element, capture);
- }
- }
- },
- getPropagatingTargets: function(target) {
- var currentNode = target,
- targets = [],
- parentNode;
- while (currentNode) {
- targets.push(currentNode);
- parentNode = currentNode.parentNode;
- if (!parentNode) {
-
-
-
-
-
- parentNode = currentNode.defaultView;
- }
- currentNode = parentNode;
- }
- return targets;
- },
-
- publish: function(e, targets, claimed) {
- var me = this,
- hasCaptureSubscribers = false,
- hasBubbleSubscribers = false,
- events, type, target, el, i, ln, j, eLn;
- claimed = claimed || false;
-
-
- if (!targets) {
-
- if (e instanceof Array) {
- Ext.raise("Propagation targets must be supplied when publishing an array of events.");
- }
-
-
- target = e.target;
- if (me.captureEvents[e.type]) {
- el = Ext.cache[target.id];
- targets = el ? [
- el
- ] : [];
- } else {
- targets = me.getPropagatingTargets(target);
- }
- }
-
-
-
- events = Ext.Array.from(e);
- ln = targets.length;
- eLn = events.length;
- for (i = 0; i < eLn; i++) {
- type = events[i].type;
- if (!hasCaptureSubscribers && me.captureSubscribers[type]) {
- hasCaptureSubscribers = true;
- }
- if (!hasBubbleSubscribers && me.bubbleSubscribers[type]) {
- hasBubbleSubscribers = true;
- }
- }
-
-
-
-
-
-
-
-
- if (hasCaptureSubscribers) {
- for (i = ln; i--; ) {
- el = Ext.cache[targets[i].id];
- if (el) {
- for (j = 0; j < eLn; j++) {
- e = events[j];
- me.fire(el, e.type, e, false, true);
- if (!claimed && e.claimed) {
- claimed = true;
- j = me.filterClaimed(events, e);
- eLn = events.length;
- }
-
- if (e.stopped) {
- events.splice(j, 1);
- j--;
- eLn--;
- }
- }
- }
- }
- }
-
-
- if (hasBubbleSubscribers && !e.stopped) {
- for (i = 0; i < ln; i++) {
- el = Ext.cache[targets[i].id];
- if (el) {
- for (j = 0; j < eLn; j++) {
- e = events[j];
- me.fire(el, e.type, e, false, false);
- if (!claimed && e.claimed && me.filterClaimed) {
- claimed = true;
- j = me.filterClaimed(events, e);
- eLn = events.length;
- }
-
- if (e.stopped) {
- events.splice(j, 1);
- j--;
- eLn--;
- }
- }
- }
- }
- }
- },
-
- publishDelegatedDomEvent: function(e) {
- this.publish(e);
- },
- fire: function(element, eventName, e, direct, capture) {
- var event;
- if (element.hasListeners[eventName]) {
- event = element.events[eventName];
- if (event) {
- if (capture && direct) {
- event = event.directCaptures;
- } else if (capture) {
- event = event.captures;
- } else if (direct) {
- event = event.directs;
- }
-
-
- if (event) {
- e.setCurrentTarget(element.dom);
- event.fire(e, e.target);
- }
- }
- }
- },
- onDelegatedEvent: function(e) {
- if (Ext.elevateFunction) {
-
-
- Ext.elevateFunction(this.doDelegatedEvent, this, [
- e
- ]);
- } else {
- this.doDelegatedEvent(e);
- }
- },
- doDelegatedEvent: function(e) {
- var me = this,
- timeStamp;
- e = new Ext.event.Event(e);
- timeStamp = e.time;
- if (!me.isEventBlocked(e)) {
- me.beforeEvent(e);
- Ext.frameStartTime = timeStamp;
- me.reEnterCountAdjusted = false;
- me.reEnterCount++;
- me.publishDelegatedDomEvent(e);
-
- if (!me.reEnterCountAdjusted) {
- me.reEnterCount--;
- }
- me.afterEvent(e);
- }
- },
-
- onDirectEvent: function(e) {
- if (Ext.elevateFunction) {
-
-
- Ext.elevateFunction(this.doDirectEvent, this, [
- e,
- false
- ]);
- } else {
- this.doDirectEvent(e, false);
- }
- },
-
-
- onDirectCaptureEvent: function(e) {
- if (Ext.elevateFunction) {
-
-
- Ext.elevateFunction(this.doDirectEvent, this, [
- e,
- true
- ]);
- } else {
- this.doDirectEvent(e, true);
- }
- },
- doDirectEvent: function(e, capture) {
- var me = this,
- currentTarget = e.currentTarget,
- timeStamp, el;
- e = new Ext.event.Event(e);
- timeStamp = e.time;
- if (me.isEventBlocked(e)) {
- return;
- }
- me.beforeEvent(e);
- Ext.frameStartTime = timeStamp;
- el = Ext.cache[currentTarget.id];
-
-
-
-
- if (el) {
-
-
- me.reEnterCountAdjusted = false;
- me.reEnterCount++;
- me.fire(el, e.type, e, true, capture);
-
- if (!me.reEnterCountAdjusted) {
- me.reEnterCount--;
- }
- }
- me.afterEvent(e);
- },
- beforeEvent: function(e) {
- var browserEvent = e.browserEvent,
-
-
- self = Ext.event.publisher.Dom,
- touches, touch;
- if (browserEvent.type === 'touchstart') {
- touches = browserEvent.touches;
- if (touches.length === 1) {
-
-
- touch = touches[0];
- self.lastTouchStartX = touch.pageX;
- self.lastTouchStartY = touch.pageY;
- }
- }
- },
- afterEvent: function(e) {
- var browserEvent = e.browserEvent,
- type = browserEvent.type,
-
-
- self = Ext.event.publisher.Dom,
- GlobalEvents = Ext.GlobalEvents;
-
-
-
-
-
-
- if (e.self.pointerEvents[type] && e.pointerType !== 'mouse') {
-
-
-
-
-
- self.lastScreenPointerEventTime = Ext.now();
- }
- if (type === 'touchend') {
-
-
-
- self.lastTouchEndTime = Ext.now();
- }
- if (!this.reEnterCount && !GlobalEvents.idleEventMask[type]) {
- Ext.fireIdle();
- }
- },
-
- isEventBlocked: function(e) {
- var me = this,
- type = e.type,
-
-
- self = Ext.event.publisher.Dom,
- now = Ext.now();
-
-
-
-
-
- if (Ext.isGecko && e.type === 'click' && e.button === 2) {
- return true;
- }
-
-
- return (me.blockedPointerEvents[type] && e.pointerType !== 'mouse') ||
-
-
-
-
- (me.blockedCompatibilityMouseEvents[type] && (now - self.lastScreenPointerEventTime < 1000)) || (Ext.supports.TouchEvents && e.self.mouseEvents[e.type] &&
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Math.abs(e.pageX - self.lastTouchStartX) < 15 && Math.abs(e.pageY - self.lastTouchStartY) < 15 &&
-
-
-
-
-
- (Ext.now() - self.lastTouchEndTime) < 1000);
- },
- destroy: function() {
- var GC = Ext.dom['GarbageCollector'],
- eventName;
- for (eventName in this.delegatedListeners) {
- this.removeDelegatedListener(eventName);
- }
-
-
- Ext.Reaper.flush();
- if (GC) {
- GC.collect();
- }
- this.callParent();
- },
-
- reset: function() {
-
-
- var self = Ext.event.publisher.Dom;
- this.reEnterCount = 0;
-
-
-
- self.lastScreenPointerEventTime = self.lastTouchEndTime = self.lastTouchStartX = self.lastTouchStartY = undefined;
- }
- }, function(Dom) {
- var doc = document,
- defaultView = doc.defaultView,
- prototype = Dom.prototype;
- if ((Ext.os.is.iOS && Ext.os.version.getMajor() < 5) || Ext.browser.is.AndroidStock || !(defaultView && defaultView.addEventListener)) {
-
-
-
-
-
-
-
- prototype.target = doc;
- } else {
-
- prototype.target = defaultView;
- }
- Dom.instance = new Dom();
- });
- Ext.define('Ext.event.publisher.Gesture', {
- extend: Ext.event.publisher.Dom,
- type: 'gesture',
- isCancelEvent: {
- touchcancel: 1,
- pointercancel: 1,
- MSPointerCancel: 1
- },
- isEndEvent: {
- mouseup: 1,
- touchend: 1,
- pointerup: 1,
- MSPointerUp: 1
- },
- handledEvents: [],
- handledDomEvents: [],
- constructor: function(config) {
- var me = this,
- handledDomEvents = me.handledDomEvents,
- supports = Ext.supports,
- supportsTouchEvents = supports.TouchEvents,
- onTouchStart = me.onTouchStart,
- onTouchMove = me.onTouchMove,
- onTouchEnd = me.onTouchEnd;
- me.handlers = {
- touchstart: onTouchStart,
- touchmove: onTouchMove,
- touchend: onTouchEnd,
- touchcancel: onTouchEnd,
- pointerdown: onTouchStart,
- pointermove: onTouchMove,
- pointerup: onTouchEnd,
- pointercancel: onTouchEnd,
- MSPointerDown: onTouchStart,
- MSPointerMove: onTouchMove,
- MSPointerUp: onTouchEnd,
- MSPointerCancel: onTouchEnd,
- mousedown: onTouchStart,
- mousemove: onTouchMove,
- mouseup: onTouchEnd
- };
- me.activeTouchesMap = {};
- me.activeTouches = [];
- me.changedTouches = [];
- me.recognizers = [];
- me.eventToRecognizer = {};
- me.cancelEvents = [];
- if (supportsTouchEvents) {
-
- me.onTargetTouchMove = me.onTargetTouchMove.bind(me);
- me.onTargetTouchEnd = me.onTargetTouchEnd.bind(me);
- }
- if (supports.PointerEvents) {
- handledDomEvents.push('pointerdown', 'pointermove', 'pointerup', 'pointercancel');
- me.mousePointerType = 'mouse';
- } else if (supports.MSPointerEvents) {
-
- handledDomEvents.push('MSPointerDown', 'MSPointerMove', 'MSPointerUp', 'MSPointerCancel');
- me.mousePointerType = 4;
- } else if (supportsTouchEvents) {
- handledDomEvents.push('touchstart', 'touchmove', 'touchend', 'touchcancel');
- }
- if (!handledDomEvents.length || (supportsTouchEvents && Ext.os.is.Desktop)) {
-
-
-
-
-
- handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
- }
- me.initConfig(config);
- return me.callParent();
- },
- onReady: function() {
- this.callParent();
- Ext.Array.sort(this.recognizers, function(recognizerA, recognizerB) {
- var a = recognizerA.priority,
- b = recognizerB.priority;
- return (a > b) ? 1 : (a < b) ? -1 : 0;
- });
- },
- registerRecognizer: function(recognizer) {
- var me = this,
- handledEvents = recognizer.handledEvents,
- ln = handledEvents.length,
- eventName, i;
-
-
- recognizer.setOnRecognized(me.onRecognized);
- recognizer.setCallbackScope(me);
-
-
- for (i = 0; i < ln; i++) {
- eventName = handledEvents[i];
- me.handledEvents.push(eventName);
- me.eventToRecognizer[eventName] = recognizer;
- }
- me.registerEvents(handledEvents);
- me.recognizers.push(recognizer);
- },
- onRecognized: function(recognizer, eventName, e, info, isCancel) {
- var me = this,
- touches = e.touches,
- changedTouches = e.changedTouches,
- ln = changedTouches.length,
- events = me.events,
- queueWasEmpty = !events.length,
- cancelEvents = me.cancelEvents,
- targetGroups, targets, i, touch;
- info = info || {};
-
-
-
-
-
-
- info.type = eventName;
-
-
-
-
-
-
-
-
-
-
- info.target = changedTouches[0].target;
-
-
- info.stopped = false;
- info.claimed = false;
- info.isGesture = true;
- e = e.chain(info);
- if (!me.gestureTargets) {
- if (ln > 1) {
- targetGroups = [];
- for (i = 0; i < ln; i++) {
- touch = changedTouches[i];
- targetGroups.push(touch.targets);
- }
- targets = me.getCommonTargets(targetGroups);
- } else {
- targets = changedTouches[0].targets;
- }
-
-
- me.gestureTargets = targets;
- }
- if (isCancel && recognizer.isSingleTouch && (touches.length > 1)) {
-
-
-
-
- e.target = touches[0].target;
- cancelEvents.push(e);
- } else {
- events.push(e);
- }
- if (queueWasEmpty) {
-
-
-
-
-
- me.publishGestures();
- }
- },
- getCommonTargets: function(targetGroups) {
- var firstTargetGroup = targetGroups[0],
- ln = targetGroups.length;
- if (ln === 1) {
- return firstTargetGroup;
- }
- var commonTargets = [],
- i = 1,
- target, targets, j;
- while (true) {
- target = firstTargetGroup[firstTargetGroup.length - i];
- if (!target) {
- return commonTargets;
- }
- for (j = 1; j < ln; j++) {
- targets = targetGroups[j];
- if (targets[targets.length - i] !== target) {
- return commonTargets;
- }
- }
- commonTargets.unshift(target);
- i++;
- }
- return commonTargets;
- },
- invokeRecognizers: function(methodName, e) {
- var recognizers = this.recognizers,
- ln = recognizers.length,
- i, recognizer;
- if (methodName === 'onStart') {
- for (i = 0; i < ln; i++) {
- recognizers[i].isActive = true;
- }
- }
- for (i = 0; i < ln; i++) {
- recognizer = recognizers[i];
- if (recognizer.isActive && recognizer[methodName].call(recognizer, e) === false) {
- recognizer.isActive = false;
- }
- }
- },
-
- filterClaimed: function(events, claimedEvent) {
- var me = this,
- eventToRecognizer = me.eventToRecognizer,
- claimedEventType = claimedEvent.type,
- claimedRecognizer = eventToRecognizer[claimedEventType],
- claimedEventIndex, recognizer, type, i;
- for (i = events.length; i--; ) {
- type = events[i].type;
- if (type === claimedEventType) {
- claimedEventIndex = i;
- } else {
- recognizer = eventToRecognizer[type];
-
-
-
-
- if (!claimedRecognizer || (recognizer && (recognizer !== claimedRecognizer))) {
- events.splice(i, 1);
- if (claimedEventIndex) {
- claimedEventIndex--;
- }
- }
- }
- }
- me.claimRecognizer(claimedRecognizer, events[0]);
- return claimedEventIndex;
- },
-
- claimRecognizer: function(claimedRecognizer, e) {
- var me = this,
- recognizers = me.recognizers,
- i, ln, recognizer;
- for (i = 0 , ln = recognizers.length; i < ln; i++) {
- recognizer = recognizers[i];
-
- if (recognizer !== claimedRecognizer) {
- recognizer.isActive = false;
- recognizer.cancel(e);
- }
- }
- if (me.events.length) {
-
- me.publishGestures(true);
- }
- },
- publishGestures: function(claimed) {
- var me = this,
- cancelEvents = me.cancelEvents,
- events = me.events,
- gestureTargets = me.gestureTargets;
- if (cancelEvents.length) {
- me.cancelEvents = [];
-
-
- me.publish(cancelEvents, me.getPropagatingTargets(cancelEvents[0].target), true);
- }
- if (events.length) {
-
-
-
- me.events = [];
- me.gestureTargets = null;
- me.publish(events, gestureTargets || me.getPropagatingTargets(events[0].target), claimed);
- }
- },
- updateTouches: function(e) {
- var me = this,
- browserEvent = e.browserEvent,
- type = e.type,
-
-
-
-
- touchSources = browserEvent.changedTouches || [
- browserEvent
- ],
- activeTouches = me.activeTouches,
- activeTouchesMap = me.activeTouchesMap,
- changedTouches = [],
- touchSource, identifier, touch, target, i, ln, x, y;
- for (i = 0 , ln = touchSources.length; i < ln; i++) {
- touchSource = touchSources[i];
- if ('identifier' in touchSource) {
-
-
- identifier = touchSource.identifier;
- } else if ('pointerId' in touchSource) {
-
- identifier = touchSource.pointerId;
- } else {
-
-
- identifier = 1;
- }
- touch = activeTouchesMap[identifier];
- if (!touch) {
- target = Ext.event.Event.resolveTextNode(touchSource.target);
- touch = activeTouchesMap[identifier] = {
- identifier: identifier,
- target: target,
-
-
-
-
-
-
-
-
- targets: me.getPropagatingTargets(target)
- };
- activeTouches.push(touch);
- }
- if (me.isEndEvent[type] || me.isCancelEvent[type]) {
- delete activeTouchesMap[identifier];
- Ext.Array.remove(activeTouches, touch);
- }
- x = touchSource.pageX;
- y = touchSource.pageY;
- touch.pageX = x;
- touch.pageY = y;
-
- touch.point = new Ext.util.Point(x, y);
- changedTouches.push(touch);
- }
-
-
-
- e.touches = Ext.Array.clone(activeTouches);
-
- e.changedTouches = changedTouches;
- },
- publishDelegatedDomEvent: function(e) {
- var me = this;
- if (!e.button || e.button < 1) {
-
-
-
-
-
- me.events = [
- e
- ];
-
-
-
-
- e.browserEvent.$extHandled = true;
- me.handlers[e.type].call(me, e);
- } else {
-
- me.callParent([
- e
- ]);
- }
- },
- onTouchStart: function(e) {
- var me = this,
- target = e.target,
- touches = e.browserEvent.touches;
- if (e.browserEvent.type === 'touchstart') {
-
-
-
-
-
-
- target.addEventListener('touchmove', me.onTargetTouchMove);
- target.addEventListener('touchend', me.onTargetTouchEnd);
- target.addEventListener('touchcancel', me.onTargetTouchEnd);
- }
-
-
-
- if (touches && touches.length <= me.activeTouches.length) {
- me.removeGhostTouches(touches);
- }
- me.updateTouches(e);
- if (!me.isStarted) {
-
-
-
- if (Ext.enableGarbageCollector) {
- Ext.dom.GarbageCollector.pause();
- }
-
-
- me.isStarted = true;
- me.invokeRecognizers('onStart', e);
- }
- me.invokeRecognizers('onTouchStart', e);
- me.publishGestures();
- },
- onTouchMove: function(e) {
- var me = this,
- mousePointerType = me.mousePointerType,
- isStarted = me.isStarted;
- if (isStarted || (e.pointerType !== 'mouse')) {
- me.updateTouches(e);
- }
- if (isStarted) {
-
-
-
- if (mousePointerType && e.browserEvent.pointerType === mousePointerType && e.buttons === 0) {
- e.type = Ext.dom.Element.prototype.eventMap.touchend;
- e.button = 0;
- me.onTouchEnd(e);
- return;
- }
- if (e.changedTouches.length > 0) {
- me.invokeRecognizers('onTouchMove', e);
- }
- }
- me.publishGestures();
- },
-
-
-
- onTouchEnd: function(e) {
- var me = this,
- isStarted = me.isStarted,
- touchCount;
- if (isStarted || (e.pointerType !== 'mouse')) {
- me.updateTouches(e);
- }
- if (!isStarted) {
- me.publishGestures();
- return;
- }
- touchCount = me.activeTouches.length;
-
-
-
-
-
- try {
- me.invokeRecognizers(me.isCancelEvent[e.type] ? 'onTouchCancel' : 'onTouchEnd', e);
- } finally {
-
- try {
- if (!touchCount) {
-
- me.isStarted = false;
- me.invokeRecognizers('onEnd', e);
- }
- } finally {
-
- try {
- me.publishGestures();
- } finally {
- if (!touchCount) {
-
-
- if (Ext.enableGarbageCollector) {
- Ext.dom.GarbageCollector.resume();
- }
- }
-
- me.reEnterCountAdjusted = true;
- me.reEnterCount--;
- }
- }
- }
- },
- onTargetTouchMove: function(e) {
- if (Ext.elevateFunction) {
-
-
- Ext.elevateFunction(this.doTargetTouchMove, this, [
- e
- ]);
- } else {
- this.doTargetTouchMove(e);
- }
- },
- doTargetTouchMove: function(e) {
- var me = this;
-
-
- if (!Ext.getBody().contains(e.target)) {
- me.reEnterCountAdjusted = false;
- me.reEnterCount++;
- this.onTouchMove(new Ext.event.Event(e));
- if (!me.reEnterCountAdjusted) {
- me.reEnterCount--;
- }
- }
- },
- onTargetTouchEnd: function(e) {
- if (Ext.elevateFunction) {
-
-
- Ext.elevateFunction(this.doTargetTouchEnd, this, [
- e
- ]);
- } else {
- this.doTargetTouchEnd(e);
- }
- },
- doTargetTouchEnd: function(e) {
- var me = this,
- target = e.target;
- target.removeEventListener('touchmove', me.onTargetTouchMove);
- target.removeEventListener('touchend', me.onTargetTouchEnd);
- target.removeEventListener('touchcancel', me.onTargetTouchEnd);
-
-
-
-
-
-
-
-
-
-
-
-
- if (!Ext.getBody().contains(target)) {
- me.reEnterCountAdjusted = false;
- me.reEnterCount++;
- me.onTouchEnd(new Ext.event.Event(e));
- if (!me.reEnterCountAdjusted) {
- me.reEnterCount--;
- }
- }
- },
-
- reset: function() {
- var me = this,
- recognizers = me.recognizers,
- ln = recognizers.length,
- i, recognizer;
- me.activeTouchesMap = {};
- me.activeTouches = [];
- me.changedTouches = [];
- me.isStarted = false;
- me.gestureTargets = null;
- me.events = [];
- me.cancelEvents = [];
- for (i = 0; i < ln; i++) {
- recognizer = recognizers[i];
- recognizer.reset();
- recognizer.isActive = false;
- }
- this.callParent();
- },
- privates: {
- removeGhostTouches: function(touches) {
- var ids = {},
- len = touches.length,
- activeTouches = this.activeTouches,
- map = this.activeTouchesMap,
- i, id, touch;
-
- for (i = 0; i < len; ++i) {
- ids[touches[i].identifier] = true;
- }
- i = activeTouches.length;
- while (i--) {
- touch = activeTouches[i];
- id = touch.identifier;
- if (!touches[id]) {
- Ext.Array.remove(activeTouches, touch);
- delete map[id];
- }
- }
- }
- }
- }, function(Gesture) {
- var EventProto = Event.prototype,
- stopPropagation = EventProto.stopPropagation;
- if (stopPropagation) {
- EventProto.stopPropagation = function() {
- var me = this,
- publisher = Gesture.instance,
- type = me.type,
- e;
- if (!me.$extHandled && publisher.handles[type]) {
-
-
- e = new Ext.event.Event(me);
- publisher.updateTouches(e);
- publisher.invokeRecognizers('onTouchCancel', e);
- publisher.reset();
- publisher.reEnterCountAdjusted = true;
- }
- stopPropagation.apply(me, arguments);
- };
- }
- Gesture.instance = Ext.$gesturePublisher = new Gesture();
- });
- Ext.define('Ext.mixin.Templatable', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'templatable'
- },
- referenceAttributeName: 'reference',
- referenceSelector: '[reference]',
- getElementConfig: function() {
- return {
- reference: 'element'
- };
- },
- getElementTemplate: function() {
- var elementTemplate = document.createDocumentFragment();
- elementTemplate.appendChild(Ext.Element.create(this.getElementConfig(), true));
- return elementTemplate;
- },
- initElement: function() {
- var prototype = this.self.prototype;
- prototype.elementTemplate = this.getElementTemplate();
- prototype.initElement = prototype.doInitElement;
- this.initElement.apply(this, arguments);
- },
- linkElement: function(reference, node) {
- this.link(reference, node);
- },
- doInitElement: function() {
- var referenceAttributeName = this.referenceAttributeName,
- renderElement, referenceNodes, i, ln, referenceNode, reference;
- renderElement = this.elementTemplate.cloneNode(true);
- referenceNodes = renderElement.querySelectorAll(this.referenceSelector);
- for (i = 0 , ln = referenceNodes.length; i < ln; i++) {
- referenceNode = referenceNodes[i];
- reference = referenceNode.getAttribute(referenceAttributeName);
- referenceNode.removeAttribute(referenceAttributeName);
- this.linkElement(reference, referenceNode);
- }
- }
- });
- Ext.define('Ext.TaskQueue', {
- singleton: true,
- pending: false,
- mode: true,
-
-
- protectedReadQueue: [],
- protectedWriteQueue: [],
-
- readQueue: [],
- writeQueue: [],
- readRequestId: 0,
- writeRequestId: 0,
- timer: null,
- constructor: function() {
- var me = this;
- me.run = me.run.bind(me);
-
-
-
-
-
- me.runProtected = Ext.Function.bind(me.run, me, [
- me.protectedReadQueue,
- me.protectedWriteQueue,
- 'runProtected'
- ]);
- me.runProtected.$skipTimerCheck = true;
-
-
-
-
-
-
-
- if (Ext.os.is.iOS) {
-
- me.watch.$skipTimerCheck = true;
-
- me.watchdogTimer = Ext.interval(this.watch, 500, this);
- }
- },
- requestRead: function(fn, scope, args) {
- var request = {
- id: ++this.readRequestId,
- fn: fn,
- scope: scope,
- args: args
- };
-
- if (arguments[3] === true) {
- this.protectedReadQueue.push(request);
- this.request(true, 'runProtected');
- } else {
-
- this.readQueue.push(request);
- this.request(true);
- }
-
-
- return request.id;
- },
- cancelRead: function(id) {
- this.cancelRequest(this.readQueue, id, true);
- },
- requestWrite: function(fn, scope, args) {
- var me = this,
- request = {
- id: ++me.writeRequestId,
- fn: fn,
- scope: scope,
- args: args
- };
-
- if (arguments[3] === true) {
- me.protectedWriteQueue.push(request);
- me.request(false, 'runProtected');
- } else {
-
- me.writeQueue.push(request);
- me.request(false);
- }
-
-
- return request.id;
- },
- cancelWrite: function(id) {
- this.cancelRequest(this.writeQueue, id, false);
- },
- request: function(mode, method) {
- var me = this;
-
-
- var oldMode = me.mode;
-
- if (!me.pending) {
- me.pendingTime = Date.now();
- me.pending = true;
- me.mode = mode;
- if (mode) {
- me.timer = Ext.defer(me[method] || me.run, 1);
- } else {
- me.timer = Ext.raf(me[method] || me.run);
- }
- }
-
-
- if (me.mode === mode && me.timer) {
- if (oldMode) {
- Ext.undefer(me.timer);
- } else {
- Ext.unraf(me.timer);
- }
- if (mode) {
- me.timer = Ext.defer(me[method] || me.run, 1);
- } else {
- me.timer = Ext.raf(me[method] || me.run);
- }
- }
- },
-
- cancelRequest: function(queue, id, mode) {
- for (var i = 0; i < queue.length; i++) {
- if (queue[i].id === id) {
- queue.splice(i, 1);
- break;
- }
- }
- if (!queue.length && this.mode === mode && this.timer) {
- Ext.undefer(this.timer);
- }
- },
- watch: function() {
- if (this.pending && Date.now() - this.pendingTime >= 500) {
- this.run();
- }
- },
- run: function(readQueue, writeQueue, method) {
- var me = this,
- mode = null,
- queue, tasks, task, fn, scope, args, i, len;
- readQueue = readQueue || me.readQueue;
- writeQueue = writeQueue || me.writeQueue;
- me.pending = false;
- me.pending = me.timer = false;
- if (me.mode) {
- queue = readQueue;
- if (writeQueue.length > 0) {
- mode = false;
- }
- } else {
- queue = writeQueue;
- if (readQueue.length > 0) {
- mode = true;
- }
- }
- tasks = queue.slice();
- queue.length = 0;
- for (i = 0 , len = tasks.length; i < len; i++) {
- task = tasks[i];
- fn = task.fn;
- scope = task.scope;
- args = task.args;
- if (scope && (scope.destroying || scope.destroyed)) {
-
- continue;
- }
- if (typeof fn === 'string') {
- fn = scope[fn];
- }
- if (args) {
- fn.apply(scope, args);
- } else {
- fn.call(scope);
- }
- }
- tasks.length = 0;
- if (mode !== null) {
- me.request(mode, method);
- }
- },
- clear: function() {
- var me = this,
- timer = me.timer;
- if (timer) {
- if (me.mode) {
- Ext.undefer(timer);
- } else {
- Ext.unraf(timer);
- }
- }
- me.readQueue.length = me.writeQueue.length = 0;
- me.pending = me.timer = false;
- me.mode = true;
- },
-
- privates: {
- flush: function() {
- var me = this,
- mode = me.mode;
- while (me.readQueue.length || me.writeQueue.length) {
- if (mode) {
- Ext.undefer(me.timer);
- } else {
- Ext.unraf(me.timer);
- }
- me.run();
- }
- me.mode = true;
- }
- }
- });
- Ext.define('Ext.util.sizemonitor.Abstract', {
- mixins: [
- Ext.mixin.Templatable
- ],
- config: {
- element: null,
- callback: Ext.emptyFn,
- scope: null,
- args: []
- },
- width: null,
- height: null,
- contentWidth: null,
- contentHeight: null,
- constructor: function(config) {
- var me = this;
- me.refresh = me.refresh.bind(me);
- me.info = {
- width: 0,
- height: 0,
- contentWidth: 0,
- contentHeight: 0,
- flag: 0
- };
- me.initElement();
- me.initConfig(config);
- me.bindListeners(true);
- },
- bindListeners: Ext.emptyFn,
- applyElement: function(element) {
- if (element) {
- return Ext.get(element);
- }
- },
- updateElement: function(element) {
- element.append(this.detectorsContainer, true);
- element.addCls(Ext.baseCSSPrefix + 'size-monitored');
- },
- applyArgs: function(args) {
- return args.concat([
- this.info
- ]);
- },
- refreshMonitors: Ext.emptyFn,
- forceRefresh: function() {
- Ext.TaskQueue.requestRead('refresh', this);
- },
- getContentBounds: function() {
- return this.detectorsContainer.getBoundingClientRect();
- },
- getContentWidth: function() {
- return this.detectorsContainer.clientWidth;
- },
- getContentHeight: function() {
- return this.detectorsContainer.clientHeight;
- },
- refreshSize: function() {
- var element = this.getElement();
- if (!element || element.destroyed) {
- return false;
- }
- var me = this,
- size = element.measure(),
- width = size.width,
- height = size.height,
- contentWidth = me.getContentWidth(),
- contentHeight = me.getContentHeight(),
- currentContentWidth = me.contentWidth,
- currentContentHeight = me.contentHeight,
- info = me.info,
- resized = false,
- flag;
- me.width = width;
- me.height = height;
- me.contentWidth = contentWidth;
- me.contentHeight = contentHeight;
- flag = ((currentContentWidth !== contentWidth ? 1 : 0) + (currentContentHeight !== contentHeight ? 2 : 0));
- if (flag > 0) {
- info.width = width;
- info.height = height;
- info.contentWidth = contentWidth;
- info.contentHeight = contentHeight;
- info.flag = flag;
- resized = true;
- me.getCallback().apply(me.getScope(), me.getArgs());
- }
- return resized;
- },
- refresh: function() {
- if (this.destroying || this.destroyed) {
- return;
- }
- this.refreshSize();
-
-
-
-
-
-
-
-
- Ext.TaskQueue.requestWrite('refreshMonitors', this);
- },
- destroy: function() {
- var me = this,
- element = me.getElement();
- me.bindListeners(false);
- if (element && !element.destroyed) {
- element.removeCls(Ext.baseCSSPrefix + 'size-monitored');
- }
- delete me._element;
-
- me.refresh = null;
- me.callParent();
- }
- });
- Ext.define('Ext.util.sizemonitor.Scroll', {
- extend: Ext.util.sizemonitor.Abstract,
- getElementConfig: function() {
- return {
- reference: 'detectorsContainer',
- classList: [
- Ext.baseCSSPrefix + 'size-monitors',
- 'scroll'
- ],
- children: [
- {
- reference: 'expandMonitor',
- className: 'expand'
- },
- {
- reference: 'shrinkMonitor',
- className: 'shrink'
- }
- ]
- };
- },
- constructor: function(config) {
- this.onScroll = this.onScroll.bind(this);
- this.callParent(arguments);
- },
- bindListeners: function(bind) {
- var method = bind ? 'addEventListener' : 'removeEventListener';
- this.expandMonitor[method]('scroll', this.onScroll, true);
- this.shrinkMonitor[method]('scroll', this.onScroll, true);
- },
- onScroll: function() {
- if (!this.destroyed) {
- Ext.TaskQueue.requestRead('refresh', this);
- }
- },
- refreshMonitors: function() {
- var expandMonitor = this.expandMonitor,
- shrinkMonitor = this.shrinkMonitor,
- end = 1000000;
- if (expandMonitor && !expandMonitor.destroyed) {
- expandMonitor.scrollLeft = end;
- expandMonitor.scrollTop = end;
- }
- if (shrinkMonitor && !shrinkMonitor.destroyed) {
- shrinkMonitor.scrollLeft = end;
- shrinkMonitor.scrollTop = end;
- }
- },
- destroy: function() {
-
- this.onScroll = null;
- this.callParent();
- }
- });
- Ext.define('Ext.util.SizeMonitor', {
-
- constructor: function(config) {
- return new Ext.util.sizemonitor.Scroll(config);
- }
- });
- Ext.define('Ext.event.publisher.ElementSize', {
- extend: Ext.event.publisher.Publisher,
- type: 'size',
- handledEvents: [
- 'resize'
- ],
- constructor: function() {
- this.monitors = {};
- this.subscribers = {};
- this.callParent(arguments);
- },
- subscribe: function(element) {
- var id = element.id,
- subscribers = this.subscribers,
- monitors = this.monitors;
- if (subscribers[id]) {
- ++subscribers[id];
- } else {
- subscribers[id] = 1;
- monitors[id] = new Ext.util.SizeMonitor({
- element: element,
- callback: this.onElementResize,
- scope: this,
- args: [
- element
- ]
- });
- }
- element.on('painted', 'forceRefresh', monitors[id]);
- return true;
- },
- unsubscribe: function(element) {
- var id = element.id,
- subscribers = this.subscribers,
- monitors = this.monitors,
- sizeMonitor;
- if (subscribers[id] && !--subscribers[id]) {
- delete subscribers[id];
- sizeMonitor = monitors[id];
- element.un('painted', 'forceRefresh', sizeMonitor);
- sizeMonitor.destroy();
- delete monitors[id];
- }
- if (element.activeRead) {
- Ext.TaskQueue.cancelRead(element.activeRead);
- }
- },
- fireElementResize: function(element, info) {
- delete element.activeRead;
- this.fire(element, 'resize', [
- element,
- info
- ]);
- },
- onElementResize: function(element, info) {
- if (!element.activeRead) {
- element.activeRead = Ext.TaskQueue.requestRead('fireElementResize', this, [
- element,
- info
- ],
- !!element.$skipResourceCheck);
- }
- },
-
-
-
-
- privates: {
- syncRefresh: function(elements) {
- elements = Ext.Array.from(elements);
- var len = elements.length,
- i = 0,
- el, monitor;
- for (i = 0; i < len; ++i) {
- el = elements[i];
- if (typeof el !== 'string') {
- el = el.id;
- }
- monitor = this.monitors[el];
- if (monitor) {
- monitor.forceRefresh();
- }
- }
-
- Ext.TaskQueue.flush();
-
- Ext.Function.fireElevatedHandlers();
- }
- }
- },
- function(ElementSize) {
- ElementSize.instance = new ElementSize();
- });
- Ext.define('Ext.util.paintmonitor.Abstract', {
- config: {
- element: null,
- callback: Ext.emptyFn,
- scope: null,
- args: []
- },
- eventName: '',
- monitorClass: '',
- constructor: function(config) {
- this.onElementPainted = this.onElementPainted.bind(this);
- this.initConfig(config);
- },
- bindListeners: function(bind) {
- this.monitorElement[bind ? 'addEventListener' : 'removeEventListener'](this.eventName, this.onElementPainted, true);
- },
- applyElement: function(element) {
- if (element) {
- return Ext.get(element);
- }
- },
- updateElement: function(element) {
- this.monitorElement = Ext.Element.create({
- classList: [
- Ext.baseCSSPrefix + 'paint-monitor',
- this.monitorClass
- ]
- }, true);
- element.appendChild(this.monitorElement, true);
- element.addCls(Ext.baseCSSPrefix + 'paint-monitored');
- this.bindListeners(true);
- },
- onElementPainted: function() {},
- destroy: function() {
- var me = this,
- monitorElement = me.monitorElement,
- parentNode = monitorElement.parentNode,
- element = me.getElement();
- me.bindListeners(false);
- delete me.monitorElement;
- if (element && !element.destroyed) {
- element.removeCls(Ext.baseCSSPrefix + 'paint-monitored');
- delete me._element;
- }
- if (parentNode) {
- parentNode.removeChild(monitorElement);
- }
- me.callParent();
- }
- });
- Ext.define('Ext.util.paintmonitor.CssAnimation', {
- extend: Ext.util.paintmonitor.Abstract,
- eventName: Ext.browser.is.WebKit ? 'webkitAnimationEnd' : 'animationend',
- monitorClass: 'cssanimation',
- onElementPainted: function(e) {
- if (e.animationName === Ext.baseCSSPrefix + 'paint-monitor-helper') {
- this.getCallback().apply(this.getScope(), this.getArgs());
- }
- }
- });
- Ext.define('Ext.util.PaintMonitor', {
- constructor: function(config) {
- return new Ext.util.paintmonitor.CssAnimation(config);
- }
- });
- Ext.define('Ext.event.publisher.ElementPaint', {
- extend: Ext.event.publisher.Publisher,
- type: 'paint',
- handledEvents: [
- 'painted'
- ],
- constructor: function() {
- this.monitors = {};
- this.subscribers = {};
- this.callParent(arguments);
- },
- subscribe: function(element) {
- var me = this,
- id = element.id,
- subscribers = me.subscribers;
- if (subscribers[id]) {
- ++subscribers[id];
- } else {
- subscribers[id] = 1;
- me.monitors[id] = new Ext.util.PaintMonitor({
- element: element,
- callback: me.onElementPainted,
- scope: me,
- args: [
- element
- ]
- });
- }
- },
- unsubscribe: function(element) {
- var id = element.id,
- subscribers = this.subscribers,
- monitors = this.monitors;
- if (subscribers[id] && !--subscribers[id]) {
- delete subscribers[id];
- monitors[id].destroy();
- delete monitors[id];
- }
- if (element.activeRead) {
- Ext.TaskQueue.cancelRead(element.activeRead);
- }
- },
- fireElementPainted: function(element) {
- delete element.activeRead;
- this.fire(element, 'painted', [
- element
- ]);
- },
- onElementPainted: function(element) {
- if (!element.activeRead) {
- element.activeRead = Ext.TaskQueue.requestRead('fireElementPainted', this, [
- element
- ],
- !!element.$skipResourceCheck);
- }
- }
- },
- function(ElementPaint) {
- ElementPaint.instance = new ElementPaint();
- });
- Ext.define('Ext.dom.Element', function(Element) {
- var WIN = window,
- DOC = document,
- docEl = DOC.documentElement,
- WIN_TOP = WIN.top,
- EMPTY = [],
- elementIdCounter, windowId, documentId,
- WIDTH = 'width',
- HEIGHT = 'height',
- MIN_WIDTH = 'min-width',
- MIN_HEIGHT = 'min-height',
- MAX_WIDTH = 'max-width',
- MAX_HEIGHT = 'max-height',
- TOP = 'top',
- RIGHT = 'right',
- BOTTOM = 'bottom',
- LEFT = 'left',
- VISIBILITY = 'visibility',
- HIDDEN = 'hidden',
- DISPLAY = "display",
- NONE = "none",
- ZINDEX = "z-index",
- POSITION = "position",
- RELATIVE = "relative",
- STATIC = "static",
- wordsRe = /\w/g,
- spacesRe = /\s+/,
- classNameSplitRegex = /[\s]+/,
- transparentRe = /^(?:transparent|(?:rgba[(](?:\s*\d+\s*[,]){3}\s*0\s*[)]))$/i,
- endsQuestionRe = /\?$/,
- topRe = /top/i,
- empty = {},
- borders = {
- t: 'border-top-width',
- r: 'border-right-width',
- b: 'border-bottom-width',
- l: 'border-left-width'
- },
- paddings = {
- t: 'padding-top',
- r: 'padding-right',
- b: 'padding-bottom',
- l: 'padding-left'
- },
- margins = {
- t: 'margin-top',
- r: 'margin-right',
- b: 'margin-bottom',
- l: 'margin-left'
- },
- selectDir = {
- b: 'backward',
- back: 'backward',
- f: 'forward'
- },
- paddingsTLRB = [
- paddings.l,
- paddings.r,
- paddings.t,
- paddings.b
- ],
- bordersTLRB = [
- borders.l,
- borders.r,
- borders.t,
- borders.b
- ],
- numberRe = /\d+$/,
- unitRe = /\d+(px|r?em|%|vh|vw|vmin|vmax|en|ch|ex|pt|in|cm|mm|pc)$/i,
- defaultUnit = 'px',
- msRe = /^-ms-/,
- camelRe = /(-[a-z])/gi,
- cssRe = /([a-z0-9\-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
- pxRe = /^\d+(?:\.\d*)?px$/i,
- relativeUnitRe = /(%|r?em|auto|vh|vw|vmin|vmax|ch|ex)$/i,
- propertyCache = {},
- ORIGINALDISPLAY = 'originalDisplay',
- camelReplaceFn = function(m, a) {
- return a.charAt(1).toUpperCase();
- },
- clearData = function(node, deep) {
- var childNodes, i, len;
-
-
- if (node.nodeType === 1) {
- node._extData = null;
- if (deep) {
- childNodes = node.childNodes;
- for (i = 0 , len = childNodes.length; i < len; ++i) {
- clearData(childNodes[i], deep);
- }
- }
- }
- },
- toFloat = function(v) {
- return parseFloat(v) || 0;
- },
- opacityCls = Ext.baseCSSPrefix + 'hidden-opacity',
- visibilityCls = Ext.baseCSSPrefix + 'hidden-visibility',
- displayCls = Ext.baseCSSPrefix + 'hidden-display',
- offsetsCls = Ext.baseCSSPrefix + 'hidden-offsets',
- clipCls = Ext.baseCSSPrefix + 'hidden-clip',
- lastFocusChange = 0,
- lastKeyboardClose = 0,
- editableHasFocus = false,
- isVirtualKeyboardOpen = false,
- inputTypeSelectionSupported = /text|password|search|tel|url/i,
- visFly, scrollFly, caFly, wrapFly, grannyFly, activeElFly;
-
-
-
-
-
- try {
- elementIdCounter = WIN_TOP.__elementIdCounter__;
- WIN_TOP.__elementIdCounter__ = elementIdCounter;
- } catch (e) {
- WIN_TOP = WIN;
- }
- WIN_TOP.__elementIdCounter__ = elementIdCounter = (WIN_TOP.__elementIdCounter__ || 0) + 1;
- windowId = 'ext-window-' + elementIdCounter;
- documentId = 'ext-document-' + elementIdCounter;
-
- if (Object.freeze) {
- Object.freeze(EMPTY);
- }
-
- return {
- alternateClassName: [
- 'Ext.Element'
- ],
- mixins: [
- Ext.util.Positionable,
- Ext.mixin.Observable
- ],
- observableType: 'element',
- isElement: true,
- skipGarbageCollection: true,
- $applyConfigs: true,
- identifiablePrefix: 'ext-element-',
- _selectDir: selectDir,
- styleHooks: {
- transform: {
- set: function(dom, value, el) {
- var prop,
- result = '';
- if (typeof value !== 'string') {
- for (prop in value) {
- if (result) {
- result += ' ';
- }
- if (prop.indexOf('translate') === 0) {
- result += prop + '(' + Element.addUnits(value[prop], 'px') + ')';
- } else {
- result += prop + '(' + value[prop] + ')';
- }
- }
- value = result;
- }
- dom.style.transform = value;
- }
- }
- },
- validIdRe: Ext.validIdRe,
- blockedEvents: Ext.supports.EmulatedMouseOver ? {
-
-
-
-
-
- mouseover: 1
- } : {},
- longpressEvents: {
- longpress: 1,
- taphold: 1
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor: function(dom) {
- var me = this,
- id;
- if (typeof dom === 'string') {
- dom = DOC.getElementById(dom);
- }
- if (!dom) {
-
- Ext.raise("Invalid domNode reference or an id of an existing domNode: " + dom);
-
- return null;
- }
-
- if (Ext.cache[dom.id]) {
- Ext.raise("Element cache already contains an entry for id '" + dom.id + "'. Use Ext.get() to create or retrieve Element instances.");
- }
-
-
- me.dom = dom;
- id = dom.id;
- if (id) {
- me.id = id;
- } else {
- id = dom.id = me.getUniqueId();
- }
-
-
-
- if (!me.validIdRe.test(me.id)) {
- Ext.raise('Invalid Element "id": "' + me.id + '"');
- }
-
-
-
-
- me.el = me;
- Ext.cache[id] = me;
- me.longpressListenerCount = 0;
- me.mixins.observable.constructor.call(me);
- },
- inheritableStatics: {
-
- cache: Ext.cache = {},
-
- editableSelector: 'input,textarea,[contenteditable="true"]',
-
- VISIBILITY: 1,
-
- DISPLAY: 2,
-
- OFFSETS: 3,
-
- CLIP: 4,
-
- OPACITY: 5,
-
- minKeyboardHeight: 100,
- unitRe: unitRe,
-
- useDelegatedEvents: true,
-
- validNodeTypes: {
- 1: 1,
-
- 9: 1
- },
-
- namespaceURIs: {
- html: 'http://www.w3.org/1999/xhtml',
- svg: 'http://www.w3.org/2000/svg'
- },
- selectableCls: Ext.baseCSSPrefix + 'selectable',
- unselectableCls: Ext.baseCSSPrefix + 'unselectable',
-
- maxRippleDiameter: 75,
-
- addUnits: function(size, units) {
-
- if (typeof size === 'number') {
- return size + (units || defaultUnit);
- }
-
-
-
-
-
- if (size === "" || size === "auto" || size == null) {
- return size || '';
- }
-
-
- if (numberRe.test(size)) {
- return size + (units || defaultUnit);
- }
-
- if (!unitRe.test(size)) {
-
-
- if (!(Ext.isString(size) && size.indexOf('calc') === 0)) {
- Ext.Logger.warn("Warning, size detected (" + size + ") not a valid property value on Element.addUnits.");
- }
-
- return size || '';
- }
- return size;
- },
-
- create: function(attributes, domNode) {
- var me = this,
- classes, element, elementStyle, tag, value, name, i, ln, tmp, ns;
- attributes = attributes || {};
- if (attributes.isElement) {
- return domNode ? attributes.dom : attributes;
- } else if ('nodeType' in attributes) {
- return domNode ? attributes : Ext.get(attributes);
- }
- if (typeof attributes === 'string') {
- return DOC.createTextNode(attributes);
- }
- tag = attributes.tag;
- if (!tag) {
- tag = 'div';
- }
- ns = attributes.namespace;
- if (ns) {
- element = DOC.createElementNS(me.namespaceURIs[ns] || ns, tag);
- } else {
- element = DOC.createElement(tag);
- }
- elementStyle = element.style;
- for (name in attributes) {
- if (name !== 'tag') {
- value = attributes[name];
- switch (name) {
- case 'style':
- if (typeof value === 'string') {
- element.setAttribute(name, value);
- } else {
- for (i in value) {
- elementStyle[i] = value[i];
- }
- };
- break;
- case 'className':
- case 'cls':
- tmp = value.split(spacesRe);
- classes = classes ? classes.concat(tmp) : tmp;
- break;
- case 'classList':
- classes = classes ? classes.concat(value) : value;
- break;
- case 'text':
- element.textContent = value;
- break;
- case 'html':
- element.innerHTML = value;
- break;
- case 'hidden':
- if (classes) {
- classes.push(displayCls);
- } else {
- classes = [
- displayCls
- ];
- };
- break;
- case 'children':
- if (value != null) {
- for (i = 0 , ln = value.length; i < ln; i++) {
- element.appendChild(me.create(value[i], true));
- }
- };
- break;
- default:
- if (value != null) {
-
- element.setAttribute(name, value);
- };
- }
- }
- }
- if (classes) {
- element.className = classes.join(' ');
- }
- if (domNode) {
- return element;
- } else {
- return me.get(element);
- }
- },
-
- fly: function(dom, named) {
- return Ext.fly(dom, named);
- },
-
- fromPoint: (function() {
-
-
-
- var elementFromPointBug;
- if (Ext.isIE || Ext.isEdge) {
- try {
- elementFromPointBug = window.self !== window.top;
- } catch (e) {
- elementFromPointBug = true;
- }
- }
- return function(x, y, asDom) {
- var el = null;
- el = DOC.elementFromPoint(x, y);
- if (!el && elementFromPointBug) {
- el = DOC.elementFromPoint(x, y);
- }
- return asDom ? el : Ext.get(el);
- };
- })(),
-
- fromPagePoint: function(x, y, asDom) {
- var scroll = Ext.getDoc().getScroll();
- return Element.fromPoint(x - scroll.left, y - scroll.top, asDom);
- },
-
- get: function(el) {
- var me = this,
- cache = Ext.cache,
- nodeType, dom, id, entry, isDoc, isWin, isValidNodeType;
- if (!el) {
- return null;
- }
-
- function warnDuplicate(id) {
- Ext.raise("DOM element with id " + id + " in Element cache is not the same as element in the DOM. " + "Make sure to clean up Element instances using destroy()");
- }
-
-
- if (el.isFly) {
- el = el.dom;
- }
- if (typeof el === 'string') {
- id = el;
- if (cache.hasOwnProperty(id)) {
- entry = cache[id];
- if (entry.skipGarbageCollection || !Ext.isGarbage(entry.dom)) {
-
- dom = Ext.getElementById ? Ext.getElementById(id) : DOC.getElementById(id);
- if (dom && (dom !== entry.dom)) {
- warnDuplicate(id);
- }
-
- return entry;
- } else {
- entry.destroy();
- }
- }
- if (id === windowId) {
- return Element.get(WIN);
- } else if (id === documentId) {
- return Element.get(DOC);
- }
-
-
- dom = Ext.getElementById ? Ext.getElementById(id) : DOC.getElementById(id);
- if (dom) {
- return new Element(dom);
- }
- }
- nodeType = el.nodeType;
- if (nodeType) {
- isDoc = (nodeType === 9);
- isValidNodeType = me.validNodeTypes[nodeType];
- } else {
-
-
-
- isWin = (el.window == el);
- }
-
-
-
- if (isValidNodeType || isWin) {
- id = el.id;
- if (cache.hasOwnProperty(id)) {
- entry = cache[id];
- if (entry.skipGarbageCollection || el === entry.dom || !Ext.isGarbage(entry.dom)) {
-
- if (el !== entry.dom) {
- warnDuplicate(id);
- }
-
- return entry;
- } else {
- entry.destroy();
- }
- }
- if (el === DOC) {
- el.id = documentId;
- }
-
- if (el == WIN) {
- el.id = windowId;
- }
- el = new Element(el);
- if (isWin || isDoc) {
-
- el.skipGarbageCollection = true;
- }
- return el;
- }
- if (el.isElement) {
- return el;
- }
- if (el.isComposite) {
- return el;
- }
-
-
- if (Ext.isIterable(el)) {
- return me.select(el);
- }
- return null;
- },
-
- getActiveElement: function(asElement) {
- var active = DOC.activeElement;
-
-
-
-
- if (!active || !active.focus) {
- active = DOC.body;
- }
- return asElement ? Ext.get(active) : active;
- },
-
- getDocumentHeight: function() {
- return Math.max(!Ext.isStrict ? DOC.body.scrollHeight : docEl.scrollHeight, this.getViewportHeight());
- },
-
- getDocumentWidth: function() {
- return Math.max(!Ext.isStrict ? DOC.body.scrollWidth : docEl.scrollWidth, this.getViewportWidth());
- },
-
- getOrientation: function() {
- if (Ext.supports.OrientationChange) {
- return (WIN.orientation == 0) ? 'portrait' : 'landscape';
- }
- return (WIN.innerHeight > WIN.innerWidth) ? 'portrait' : 'landscape';
- },
-
- getViewportHeight: function() {
- var viewportHeight = Element._viewportHeight;
-
- if (Ext.isIE9m) {
- return DOC.documentElement.clientHeight;
- }
-
- return (viewportHeight != null) ? viewportHeight : docEl.clientHeight;
- },
-
- getViewportWidth: function() {
- var viewportWidth = Element._viewportWidth;
-
- if (Ext.isIE9m) {
- return DOC.documentElement.clientWidth;
- }
-
- return (viewportWidth != null) ? viewportWidth : docEl.clientWidth;
- },
-
- getViewportScale: function() {
-
-
-
-
-
-
- var top = WIN_TOP;
- return ((Ext.isiOS || Ext.isAndroid) ? 1 : (top.devicePixelRatio ||
- top.screen.deviceXDPI / top.screen.logicalXDPI)) *
- this.getViewportTouchScale();
- },
-
- getViewportTouchScale: function(forceRead) {
- var scale = 1,
-
- top = WIN_TOP,
- cachedScale;
- if (!forceRead) {
- cachedScale = this._viewportTouchScale;
- if (cachedScale) {
- return cachedScale;
- }
- }
- if (Ext.isIE10p || Ext.isEdge || Ext.isiOS) {
- scale = docEl.offsetWidth / WIN.innerWidth;
- } else if (Ext.isChromeMobile) {
- scale = top.outerWidth / top.innerWidth;
- }
- return scale;
- },
-
- getViewSize: function() {
- return {
- width: Element.getViewportWidth(),
- height: Element.getViewportHeight()
- };
- },
-
- hasUnit: function(size) {
- return !!(size && unitRe.test(size));
- },
-
- isRelativeUnit: function(size) {
- return !size || relativeUnitRe.test(size);
- },
-
- maskIframes: function() {
- var iframes = document.getElementsByTagName('iframe'),
- fly = new Ext.dom.Fly();
- Ext.each(iframes, function(iframe) {
- var myMask;
- myMask = fly.attach(iframe.parentNode).mask();
- myMask.setStyle('background-color', 'transparent');
- });
- },
-
- normalize: function(prop) {
-
- return propertyCache[prop] || (propertyCache[prop] = prop.replace(msRe, 'ms-').replace(camelRe, camelReplaceFn));
- },
-
- _onWindowFocusChange: function(e) {
-
-
-
-
- if (Ext.fly(e.target).is(Element.editableSelector)) {
- lastFocusChange = new Date();
- editableHasFocus = (e.type === 'focusin' || e.type === 'pointerup');
- }
- },
-
- _onWindowResize: function() {
- var documentWidth = docEl.clientWidth,
- documentHeight = docEl.clientHeight,
- now = new Date(),
- threshold = 1000,
- deltaX, deltaY;
- deltaX = documentWidth - Element._documentWidth;
- deltaY = documentHeight - Element._documentHeight;
- Element._documentWidth = documentWidth;
- Element._documentHeight = documentHeight;
-
-
-
- if (((now - lastFocusChange) < threshold) || ((now - lastKeyboardClose) < threshold)) {
-
-
-
-
- if (deltaX === 0 && (editableHasFocus && (deltaY <= -Element.minKeyboardHeight))) {
- isVirtualKeyboardOpen = true;
- return;
- }
- }
- if (isVirtualKeyboardOpen && (deltaX === 0) && (deltaY >= Element.minKeyboardHeight)) {
- isVirtualKeyboardOpen = false;
-
-
-
-
- lastKeyboardClose = new Date();
- }
- if (isVirtualKeyboardOpen) {
- return;
- }
-
-
-
- Element._viewportWidth = documentWidth;
- Element._viewportHeight = documentHeight;
- },
-
- parseBox: function(box) {
- box = box || 0;
- var type = typeof box,
- parts, ln;
- if (type === 'number') {
- return {
- top: box,
- right: box,
- bottom: box,
- left: box
- };
- } else if (type !== 'string') {
-
- return box;
- }
- parts = box.split(' ');
- ln = parts.length;
- if (ln === 1) {
- parts[1] = parts[2] = parts[3] = parts[0];
- } else if (ln === 2) {
- parts[2] = parts[0];
- parts[3] = parts[1];
- } else if (ln === 3) {
- parts[3] = parts[1];
- }
- return {
- top: parseFloat(parts[0]) || 0,
- right: parseFloat(parts[1]) || 0,
- bottom: parseFloat(parts[2]) || 0,
- left: parseFloat(parts[3]) || 0
- };
- },
-
- parseStyles: function(styles) {
- var out = {},
- matches;
- if (styles) {
-
-
-
-
- cssRe.lastIndex = 0;
- while ((matches = cssRe.exec(styles))) {
- out[matches[1]] = matches[2] || '';
- }
- }
- return out;
- },
-
- select: function(selector, composite, root) {
- return Ext.fly(root || DOC).select(selector, composite);
- },
-
- query: function(selector, asDom, root) {
- return Ext.fly(root || DOC).query(selector, asDom);
- },
-
- unitizeBox: function(box, units) {
- var me = this;
- box = me.parseBox(box);
- return me.addUnits(box.top, units) + ' ' + me.addUnits(box.right, units) + ' ' + me.addUnits(box.bottom, units) + ' ' + me.addUnits(box.left, units);
- },
-
- unmaskIframes: function() {
- var iframes = document.getElementsByTagName('iframe'),
- fly = new Ext.dom.Fly();
- Ext.each(iframes, function(iframe) {
- fly.attach(iframe.parentNode).unmask();
- });
- },
-
- serializeForm: function(form) {
- var fElements = form.elements || (DOC.forms[form] || Ext.getDom(form)).elements,
- hasSubmit = false,
- encoder = encodeURIComponent,
- data = '',
- eLen = fElements.length,
- element, name, type, options, hasValue, e, o, oLen, opt;
- for (e = 0; e < eLen; e++) {
- element = fElements[e];
- name = element.name;
- type = element.type;
- options = element.options;
- if (!element.disabled && name) {
- if (/select-(one|multiple)/i.test(type)) {
- oLen = options.length;
- for (o = 0; o < oLen; o++) {
- opt = options[o];
- if (opt.selected) {
- hasValue = opt.hasAttribute('value');
- data += Ext.String.format('{0}={1}&', encoder(name), encoder(hasValue ? opt.value : opt.text));
- }
- }
- } else if (!(/file|undefined|reset|button/i.test(type))) {
- if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
- data += encoder(name) + '=' + encoder(element.value) + '&';
- hasSubmit = /submit/i.test(type);
- }
- }
- }
- }
- return data.substr(0, data.length - 1);
- },
-
- getCommonAncestor: function(nodeA, nodeB, returnDom) {
- caFly = caFly || new Ext.dom.Fly();
- caFly.attach(Ext.getDom(nodeA));
- while (!caFly.isAncestor(nodeB)) {
- if (caFly.dom.parentNode) {
- caFly.attach(caFly.dom.parentNode);
- } else
- {
- caFly.attach(DOC.body);
- break;
- }
- }
- return returnDom ? caFly.dom : Ext.get(caFly);
- }
- },
-
- selectable: function() {
- var me = this;
-
-
- me.dom.unselectable = '';
- me.removeCls(Element.unselectableCls);
- me.addCls(Element.selectableCls);
- return me;
- },
-
- unselectable: function() {
-
-
-
-
-
-
-
- var me = this;
-
-
-
-
-
- if (Ext.isOpera) {
- me.dom.unselectable = 'on';
- }
-
-
-
-
-
-
-
-
-
- me.removeCls(Element.selectableCls);
- me.addCls(Element.unselectableCls);
- return me;
- },
-
- statics: {
-
-
- tabbableSelector: Ext.supports.CSS3NegationSelector ? 'a[href],button,iframe,input,select,textarea,[tabindex]:not([tabindex="-1"]),[contenteditable="true"]' : 'a[href],button,iframe,input,select,textarea,[tabindex],[contenteditable="true"]',
-
-
-
- naturallyFocusableTags: {
- BUTTON: true,
- IFRAME: true,
- EMBED: true,
- INPUT: true,
- OBJECT: true,
- SELECT: true,
- TEXTAREA: true,
- HTML: Ext.isIE ? true : false,
- BODY: Ext.isIE ? false : true
- },
-
- naturallyTabbableTags: {
- BUTTON: true,
- IFRAME: true,
- INPUT: true,
- SELECT: true,
- TEXTAREA: true,
- OBJECT: Ext.isIE8m ? true : false
- },
- inputTags: {
- INPUT: true,
- TEXTAREA: true
- },
- tabbableSavedCounterAttribute: 'data-tabindex-counter',
- tabbableSavedValueAttribute: 'data-tabindex-value',
- splitCls: function(cls) {
- if (typeof cls === 'string') {
- cls = cls.split(spacesRe);
- }
- return cls;
- }
- },
-
- _init: function(E) {
-
-
- E.tabbableSelector += ',[' + E.tabbableSavedCounterAttribute + ']';
- },
-
- addCls: function(names, prefix, suffix) {
- return this.replaceCls(null, names, prefix, suffix);
- },
-
- addClsOnClick: function(className, testFn, scope) {
- var me = this,
- hasTest = Ext.isFunction(testFn);
- me.on("mousedown", function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return false;
- }
- me.addCls(className);
- Ext.getDoc().on({
- mouseup: function() {
-
- if (me.dom) {
- me.removeCls(className);
- }
- },
- single: true
- });
- });
- return me;
- },
-
- addClsOnFocus: function(className, testFn, scope) {
- var me = this,
- hasTest = Ext.isFunction(testFn);
- me.on("focus", function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return false;
- }
- me.addCls(className);
- });
- me.on("blur", function() {
-
- if (me.dom) {
- me.removeCls(className);
- }
- });
- return me;
- },
-
- addClsOnOver: function(className, testFn, scope) {
- var me = this,
- hasTest = Ext.isFunction(testFn);
- me.hover(function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return;
- }
- me.addCls(className);
- }, function() {
- me.removeCls(className);
- });
- return me;
- },
- addStyles: function(sides, styles) {
- var totalSize = 0,
- sidesArr = (sides || '').match(wordsRe),
- i,
- len = sidesArr.length,
- side,
- styleSides = [];
- if (len === 1) {
- totalSize = parseFloat(this.getStyle(styles[sidesArr[0]])) || 0;
- } else if (len) {
- for (i = 0; i < len; i++) {
- side = sidesArr[i];
- styleSides.push(styles[side]);
- }
-
- styleSides = this.getStyle(styleSides);
- for (i = 0; i < len; i++) {
- side = sidesArr[i];
- totalSize += parseFloat(styleSides[styles[side]]) || 0;
- }
- }
- return totalSize;
- },
- addUnits: function(size, units) {
- return Element.addUnits(size, units);
- },
-
-
-
- animate: function(animation) {
- animation = new Ext.fx.Animation(animation);
- animation.setElement(this);
- this._activeAnimation = animation;
- animation.on({
- animationend: this._onAnimationEnd,
- scope: this
- });
- Ext.Animator.run(animation);
- return animation;
- },
- _onAnimationEnd: function() {
- this._activeAnimation = null;
- },
- getActiveAnimation: function() {
- return this._activeAnimation;
- },
- append: function() {
- return this.appendChild.apply(this, arguments);
- },
-
- appendChild: function(el, returnDom) {
- var me = this,
- insertEl, eLen, e;
- if (el.nodeType || el.dom || typeof el === 'string') {
-
- el = Ext.getDom(el);
- me.dom.appendChild(el);
- return !returnDom ? Ext.get(el) : el;
- } else if (el.length) {
-
- insertEl = Ext.fly(DOC.createDocumentFragment());
- eLen = el.length;
- for (e = 0; e < eLen; e++) {
- insertEl.appendChild(el[e], returnDom);
- }
- el = Ext.Array.toArray(insertEl.dom.childNodes);
- me.dom.appendChild(insertEl.dom);
- return returnDom ? el : new Ext.dom.CompositeElementLite(el);
- } else {
-
- return me.createChild(el, null, returnDom);
- }
- },
-
- appendTo: function(el) {
- Ext.getDom(el).appendChild(this.dom);
- return this;
- },
-
- applyStyles: function(styles) {
- if (styles) {
- if (typeof styles === "function") {
- styles = styles.call();
- }
- if (typeof styles === "string") {
- styles = Element.parseStyles(styles);
- }
- if (typeof styles === "object") {
- this.setStyle(styles);
- }
- }
- return this;
- },
-
- blur: function() {
- var me = this,
- dom = me.dom;
-
-
- if (dom !== DOC.body) {
- try {
- dom.blur();
- } catch (e) {}
- return me;
- } else {
- return me.focus(undefined, dom);
- }
- },
-
- cacheScrollValues: function() {
- var me = this,
- scrollValues = [],
- scrolledDescendants = [],
- descendants, descendant, i, len;
- scrollFly = scrollFly || new Ext.dom.Fly();
- descendants = me.query('*');
- for (i = 0 , len = descendants.length; i < len; i++) {
- descendant = descendants[i];
-
-
- if (descendant.scrollTop > 0 || descendant.scrollLeft !== 0) {
- scrolledDescendants.push(descendant);
- scrollValues.push(scrollFly.attach(descendant).getScroll());
- }
- }
- return function() {
- var scroll, i, len;
- for (i = 0 , len = scrolledDescendants.length; i < len; i++) {
- scroll = scrollValues[i];
- scrollFly.attach(scrolledDescendants[i]);
- scrollFly.setScrollLeft(scroll.left);
- scrollFly.setScrollTop(scroll.top);
- }
- };
- },
-
- center: function(centerIn) {
- return this.alignTo(centerIn || DOC, 'c-c');
- },
-
- child: function(selector, returnDom) {
- var me = this,
- id;
-
- if (Ext.supports.Selectors2) {
- return me.selectNode(':scope>' + selector, !!returnDom);
- } else {
-
-
- id = me.id != null ? me.id : Ext.get(me).id;
- return me.selectNode(Ext.makeIdSelector(id) + " > " + selector, !!returnDom);
- }
- },
-
- clone: function(deep, returnDom) {
- var clone = this.dom.cloneNode(deep);
- if (Ext.supports.CloneNodeCopiesExpando) {
- clearData(clone, deep);
- }
- return returnDom ? clone : Ext.get(clone);
- },
- constrainScrollLeft: function(left) {
- var dom = this.dom;
- return Math.max(Math.min(left, dom.scrollWidth - dom.clientWidth), 0);
- },
- constrainScrollTop: function(top) {
- var dom = this.dom;
- return Math.max(Math.min(top, dom.scrollHeight - dom.clientHeight), 0);
- },
-
- createChild: function(config, insertBefore, returnDom) {
- config = config || {
- tag: 'div'
- };
- if (insertBefore) {
- return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
- } else {
- return Ext.DomHelper.append(this.dom, config, returnDom !== true);
- }
- },
-
- contains: function(element) {
- if (!element) {
- return false;
- }
- var me = this,
- dom = Ext.getDom(element);
-
-
- return (dom === me.dom) || me.isAncestor(dom);
- },
-
- destroy: function() {
- var me = this,
- dom = me.dom;
-
- if (me.destroyed) {
- Ext.Logger.warn("Cannot destroy Element \"" + me.id + "\". Already destroyed.");
- return;
- }
- if (me.resumeFocusEventsTimer) {
- Ext.unasap(me.resumeFocusEventsTimer);
- me.resumeFocusEventsTimer = null;
- }
- if (me.repaintTimer) {
- me.repaintTimer = Ext.undefer(me.repaintTimer);
- }
- if (me.deferFocusTimer) {
- me.deferFocusTimer = Ext.undefer(me.deferFocusTimer);
- }
- if (dom) {
- if (dom === DOC.body) {
- Ext.raise("Cannot destroy body element.");
- } else if (dom === DOC) {
- Ext.raise("Cannot destroy document object.");
- } else if (dom === WIN) {
- Ext.raise("Cannot destroy window object");
- }
- }
-
- if (dom && dom.parentNode) {
- dom.parentNode.removeChild(dom);
- }
- if (me.$ripples) {
- me.destroyAllRipples();
- }
- me.collect();
- },
- detach: function() {
- var dom = this.dom,
- component = this.component;
- if (dom && dom.parentNode && dom.tagName !== 'BODY') {
-
- if (component) {
- component.revertFocus();
- }
- dom.parentNode.removeChild(dom);
- }
- return this;
- },
-
- disableShadow: function() {
- var shadow = this.shadow;
- if (shadow) {
- shadow.hide();
- shadow.disabled = true;
- }
- },
-
- disableShim: function() {
- var shim = this.shim;
- if (shim) {
- shim.hide();
- shim.disabled = true;
- }
- },
-
- doReplaceWith: function(element) {
- var dom = this.dom;
- dom.parentNode.replaceChild(Ext.getDom(element), dom);
- },
-
- doScrollIntoView: function(container, hscroll, animate, highlight, getScrollX, scrollTo) {
- scrollFly = scrollFly || new Ext.dom.Fly();
- var me = this,
- dom = me.dom,
- scrollX = scrollFly.attach(container)[getScrollX](),
- scrollY = container.scrollTop,
- position = me.getScrollIntoViewXY(container, scrollX, scrollY),
- newScrollX = position.x,
- newScrollY = position.y;
-
- if (highlight) {
- if (animate) {
- animate = Ext.apply({
- listeners: {
- afteranimate: function() {
- scrollFly.attach(dom).highlight();
- }
- }
- }, animate);
- } else {
- scrollFly.attach(dom).highlight();
- }
- }
- if (newScrollY !== scrollY) {
- scrollFly.attach(container).scrollTo('top', newScrollY, animate);
- }
- if (hscroll !== false && (newScrollX !== scrollX)) {
- scrollFly.attach(container)[scrollTo]('left', newScrollX, animate);
- }
- return me;
- },
-
- down: function(selector, returnDom) {
- return this.selectNode(selector, !!returnDom);
- },
-
- enableShadow: function(options, isVisible) {
- var me = this,
- shadow = me.shadow || (me.shadow = new Ext.dom.Shadow(Ext.apply({
- target: me
- }, options))),
- shim = me.shim;
- if (shim) {
- shim.offsets = shadow.outerOffsets;
- shim.shadow = shadow;
- shadow.shim = shim;
- }
-
-
- if (isVisible === true || (isVisible !== false && me.isVisible())) {
-
-
- shadow.show();
- } else {
- shadow.hide();
- }
- shadow.disabled = false;
- },
-
- enableShim: function(options, isVisible) {
- var me = this,
- shim = me.shim || (me.shim = new Ext.dom.Shim(Ext.apply({
- target: me
- }, options))),
- shadow = me.shadow;
- if (shadow) {
- shim.offsets = shadow.outerOffsets;
- shim.shadow = shadow;
- shadow.shim = shim;
- }
-
-
- if (isVisible === true || (isVisible !== false && me.isVisible())) {
-
-
- shim.show();
- } else {
- shim.hide();
- }
- shim.disabled = false;
- return shim;
- },
-
- findParent: function(simpleSelector, limit, returnEl) {
- var me = this,
- target = me.dom,
- topmost = docEl,
- depth = 0;
- if (limit || limit === 0) {
- if (typeof limit !== 'number') {
- topmost = Ext.getDom(limit);
- limit = Number.MAX_VALUE;
- }
- } else {
-
- limit = 50;
- }
- while (target && target.nodeType === 1 && depth < limit && target !== topmost) {
- if (Ext.fly(target).is(simpleSelector)) {
- return returnEl ? Ext.get(target) : target;
- }
- depth++;
- target = target.parentNode;
- }
- return null;
- },
-
- findParentNode: function(simpleSelector, limit, returnEl) {
- var p = Ext.fly(this.dom.parentNode);
- return p ? p.findParent(simpleSelector, limit, returnEl) : null;
- },
-
- first: function(selector, returnDom) {
- return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
- },
-
- focus: function(defer, dom) {
- var me = this;
- dom = dom || me.dom;
- if (Number(defer)) {
- Ext.defer(me.focus, defer, me, [
- null,
- dom
- ]);
- } else {
- Ext.GlobalEvents.fireEvent('beforefocus', dom);
- dom.focus();
- }
- return me;
- },
-
- collect: function() {
- var me = this,
- dom = me.dom,
- shadow = me.shadow,
- shim = me.shim;
-
-
- if (!me.isFly) {
- me.mixins.observable.destroy.call(me);
- delete Ext.cache[me.id];
- me.el = null;
- }
- if (dom) {
- dom._extData = me.dom = null;
- }
-
-
- if (shadow) {
- shadow.hide();
- me.shadow = null;
- }
- if (shim) {
- shim.hide();
- me.shim = null;
- }
- },
- getAnchorToXY: function(el, anchor, local, mySize) {
- return el.getAnchorXY(anchor, local, mySize);
- },
-
- getAttribute: function(name, namespace) {
- var dom = this.dom;
- return namespace ? (dom.getAttributeNS(namespace, name) || dom.getAttribute(namespace + ":" + name)) : (dom.getAttribute(name) || dom[name] || null);
- },
-
- getAttributes: function() {
- var attributes = this.dom.attributes,
- result = {},
- attr, i, len;
- for (i = 0 , len = attributes.length; i < len; i++) {
- attr = attributes[i];
- result[attr.name] = attr.value;
- }
- return result;
- },
-
- getBottom: function(local) {
- return (local ? this.getLocalY() : this.getY()) + this.getHeight();
- },
-
- getById: function(id, asDom) {
-
-
- var dom = DOC.getElementById(id) || this.dom.querySelector(Ext.makeIdSelector(id));
- return asDom ? dom : (dom ? Ext.get(dom) : null);
- },
- getBorderPadding: function() {
- var paddingWidth = this.getStyle(paddingsTLRB),
- bordersWidth = this.getStyle(bordersTLRB);
- return {
- beforeX: (parseFloat(bordersWidth[borders.l]) || 0) + (parseFloat(paddingWidth[paddings.l]) || 0),
- afterX: (parseFloat(bordersWidth[borders.r]) || 0) + (parseFloat(paddingWidth[paddings.r]) || 0),
- beforeY: (parseFloat(bordersWidth[borders.t]) || 0) + (parseFloat(paddingWidth[paddings.t]) || 0),
- afterY: (parseFloat(bordersWidth[borders.b]) || 0) + (parseFloat(paddingWidth[paddings.b]) || 0)
- };
- },
-
- getBorders: function() {
- var bordersWidth = this.getStyle(bordersTLRB);
- return {
- beforeX: (parseFloat(bordersWidth[borders.l]) || 0),
- afterX: (parseFloat(bordersWidth[borders.r]) || 0),
- beforeY: (parseFloat(bordersWidth[borders.t]) || 0),
- afterY: (parseFloat(bordersWidth[borders.b]) || 0)
- };
- },
-
- getBorderWidth: function(side) {
- return this.addStyles(side, borders);
- },
-
- getClassMap: function(clone) {
- var data = this.getData();
- if (data) {
- data = data.classMap;
- if (clone !== false) {
- data = Ext.apply({}, data);
- }
- }
- return data;
- },
-
- getData: function(sync) {
- var dom = this.dom,
- data;
- if (dom) {
- data = dom._extData || (dom._extData = {});
- if (sync !== false && !data.isSynchronized) {
- this.synchronize();
- }
- }
- return data || null;
- },
- getFirstChild: function() {
- return Ext.get(this.dom.firstElementChild);
- },
- getLastChild: function() {
- return Ext.get(this.dom.lastElementChild);
- },
-
- getHeight: function(contentHeight, preciseHeight) {
- var me = this,
- dom = me.dom,
- hidden = me.isStyle('display', 'none'),
- height, floating;
- if (hidden) {
- return 0;
- }
-
- if (dom.nodeName === 'BODY') {
- height = Element.getViewportHeight();
- } else {
- if (preciseHeight) {
- height = dom.getBoundingClientRect().height;
- } else {
- height = dom.offsetHeight;
-
- if (height == null) {
- height = dom.getBoundingClientRect().height;
- }
- }
- }
-
- if (Ext.supports.Direct2DBug) {
- floating = me.adjustDirect2DDimension(HEIGHT);
- if (preciseHeight) {
- height += floating;
- } else if (floating > 0 && floating < 0.5) {
- height++;
- }
- }
- if (contentHeight) {
- height -= me.getBorderWidth("tb") + me.getPadding("tb");
- }
- return (height < 0) ? 0 : height;
- },
-
- getHtml: function() {
- return this.dom ? this.dom.innerHTML : '';
- },
-
- getLeft: function(local) {
- return local ? this.getLocalX() : this.getX();
- },
- getLocalX: function() {
- var me = this,
- offsetParent,
- x = me.getStyle('left');
- if (!x || x === 'auto') {
- x = 0;
- } else if (pxRe.test(x)) {
- x = parseFloat(x);
- } else {
- x = me.getX();
-
-
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- x -= Ext.fly(offsetParent).getX();
- }
- }
- return x;
- },
- getLocalXY: function() {
- var me = this,
- offsetParent,
- style = me.getStyle([
- 'left',
- 'top'
- ]),
- x = style.left,
- y = style.top;
- if (!x || x === 'auto') {
- x = 0;
- } else if (pxRe.test(x)) {
- x = parseFloat(x);
- } else {
- x = me.getX();
-
-
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- x -= Ext.fly(offsetParent).getX();
- }
- }
- if (!y || y === 'auto') {
- y = 0;
- } else if (pxRe.test(y)) {
- y = parseFloat(y);
- } else {
- y = me.getY();
-
-
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- y -= Ext.fly(offsetParent).getY();
- }
- }
- return [
- x,
- y
- ];
- },
- getLocalY: function() {
- var me = this,
- offsetParent,
- y = me.getStyle('top');
- if (!y || y === 'auto') {
- y = 0;
- } else if (pxRe.test(y)) {
- y = parseFloat(y);
- } else {
- y = me.getY();
-
-
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- y -= Ext.fly(offsetParent).getY();
- }
- }
- return y;
- },
-
- getMargin: (function() {
- var hash = {
- t: "top",
- l: "left",
- r: "right",
- b: "bottom"
- },
- allMargins = [
- 'margin-top',
- 'margin-left',
- 'margin-right',
- 'margin-bottom'
- ];
- return function(side) {
- var me = this,
- style, key, o;
- if (!side) {
- style = me.getStyle(allMargins);
- o = {};
- if (style && typeof style === 'object') {
- o = {};
- for (key in margins) {
- o[key] = o[hash[key]] = parseFloat(style[margins[key]]) || 0;
- }
- }
- } else {
- o = me.addStyles(side, margins);
- }
- return o;
- };
- })(),
-
- getPadding: function(side) {
- return this.addStyles(side, paddings);
- },
- getParent: function() {
- return Ext.get(this.dom.parentNode);
- },
-
- getRight: function(local) {
- return (local ? this.getLocalX() : this.getX()) + this.getWidth();
- },
-
- getScroll: function() {
- var me = this,
- dom = me.dom,
- docElement = docEl,
- left, top,
- body = DOC.body;
- if (dom === DOC || dom === body) {
-
-
-
-
-
-
-
-
- left = docElement.scrollLeft || (body ? body.scrollLeft : 0);
- top = docElement.scrollTop || (body ? body.scrollTop : 0);
- } else {
- left = dom.scrollLeft;
- top = dom.scrollTop;
- }
- return {
- left: left,
- top: top
- };
- },
-
- getScrollIntoViewXY: function(container, scrollX, scrollY, align) {
- align = align || empty;
- var me = this,
- dom = me.dom,
- offsets, clientWidth, clientHeight;
- if (container.isRegion) {
- clientHeight = container.height;
- clientWidth = container.width;
- } else {
- container = Ext.getDom(container);
- clientHeight = container.clientHeight;
- clientWidth = container.clientWidth;
- }
- offsets = me.getOffsetsTo(container);
- return {
- y: me.calcScrollPos(offsets[1] + scrollY, dom.offsetHeight, scrollY, clientHeight, align.y),
- x: me.calcScrollPos(offsets[0] + scrollX, dom.offsetWidth, scrollX, clientWidth, align.x)
- };
- },
- calcScrollPos: function(start, size, viewStart, viewSize, align) {
- var end = start + size,
- viewEnd = viewStart + viewSize,
- force = align && !endsQuestionRe.test(align),
- ret = viewStart;
- if (!force) {
- if (align) {
- align = align.slice(0, -1);
- }
- if (size > viewSize || start < viewStart) {
- align = align || 'start';
- force = true;
- } else if (end > viewEnd) {
- align = align || 'end';
- force = true;
- }
- }
- if (force) {
- if (align === 'start') {
- ret = start;
- } else if (align === 'center') {
- ret = Math.max(0, start - Math.floor((viewSize / 2)));
- } else if (align === 'end') {
- ret = Math.max(0, end - viewSize);
- }
- }
- return ret;
- },
-
- getScrollLeft: function() {
- var dom = this.dom;
- if (dom === DOC || dom === DOC.body) {
- return this.getScroll().left;
- } else {
- return dom.scrollLeft;
- }
- },
-
- getScrollTop: function() {
- var dom = this.dom;
- if (dom === DOC || dom === DOC.body) {
- return this.getScroll().top;
- } else {
- return dom.scrollTop;
- }
- },
-
- getSize: function(contentSize) {
- return {
- width: this.getWidth(contentSize),
- height: this.getHeight(contentSize)
- };
- },
-
- getStyle: function(property, inline) {
- var me = this,
- dom = me.dom,
- multiple = typeof property !== 'string',
- hooks = me.styleHooks,
- prop = property,
- props = prop,
- len = 1,
- domStyle, camel, values, hook, out, style, i;
- if (multiple) {
- values = {};
- prop = props[0];
- i = 0;
- if (!(len = props.length)) {
- return values;
- }
- }
- if (!dom || dom.documentElement) {
- return values || '';
- }
- domStyle = dom.style;
- if (inline) {
- style = domStyle;
- } else {
-
-
-
-
- style = dom.ownerDocument.defaultView.getComputedStyle(dom, null);
-
- if (!style) {
- inline = true;
- style = domStyle;
- }
- }
- do {
- hook = hooks[prop];
- if (!hook) {
- hooks[prop] = hook = {
- name: Element.normalize(prop)
- };
- }
- if (hook.get) {
- out = hook.get(dom, me, inline, style);
- } else {
- camel = hook.name;
- out = style[camel];
- }
- if (!multiple) {
- return out;
- }
- values[prop] = out;
- prop = props[++i];
- } while (i < len);
- return values;
- },
- getStyleValue: function(name) {
- return this.dom.style.getPropertyValue(name);
- },
- getCaretPos: function() {
- var dom = this.dom,
- pos, selection;
- if (inputTypeSelectionSupported.test(dom.type)) {
- pos = dom.selectionStart;
- selection = (typeof pos !== 'number') && this.getTextSelection();
- if (selection) {
- pos = selection[0];
- }
- } else
- {
- Ext.raise('Input type of "' + dom.type + '" does not support selectionStart');
- }
-
- return pos;
- },
- setCaretPos: function(pos) {
- this.selectText(pos, pos);
- },
-
- getTextSelection: function() {
- var dom = this.dom;
- if (inputTypeSelectionSupported.test(dom.type)) {
- return [
- dom.selectionStart,
- dom.selectionEnd,
- dom.selectionDirection
- ];
- } else {
-
- Ext.raise('Input type of "' + this.dom.type + '" does not support selectionStart, selectionEnd and selectionDirection');
-
- return [];
- }
- },
-
-
- selectText: function(start, end, direction) {
- var me = this,
-
- range,
-
- dom = me.dom,
- len;
- if (dom && inputTypeSelectionSupported.test(dom.type)) {
- start = start || 0;
- len = dom.value.length;
- if (end === undefined) {
- end = len;
- }
- direction = selectDir[direction] || direction || 'forward';
- if (dom.setSelectionRange) {
- dom.setSelectionRange(start, end, direction);
- }
-
- else if (dom.createTextRange) {
- if (start > end) {
- start = end;
- }
- range = dom.createTextRange();
- range.moveStart('character', start);
- range.moveEnd('character', -(len - end));
- range.select();
- }
- }
-
-
- else if (!inputTypeSelectionSupported.test(dom.type)) {
- Ext.raise('Input type of "' + dom.type + '" does not support setSelectionRange');
- }
-
- return me;
- },
-
- getTop: function(local) {
- return local ? this.getLocalY() : this.getY();
- },
-
- getTouchAction: function() {
- return Ext.dom.TouchAction.get(this.dom);
- },
-
- getValue: function(asNumber) {
- var value = this.dom.value;
- return asNumber ? parseInt(value, 10) : value;
- },
-
- getViewSize: function() {
- var dom = this.dom;
- if (dom === DOC || dom === DOC.body) {
- return {
- width: Element.getViewportWidth(),
- height: Element.getViewportHeight()
- };
- } else {
- return {
- width: dom.clientWidth,
- height: dom.clientHeight
- };
- }
- },
- getVisibilityMode: function() {
- var me = this,
- data = me.getData(),
- mode = data.visibilityMode;
- if (mode === undefined) {
- data.visibilityMode = mode = Element.DISPLAY;
- }
- return mode;
- },
-
- getWidth: function(contentWidth, preciseWidth) {
- var me = this,
- dom = me.dom,
- hidden = me.isStyle('display', 'none'),
- rect, width, floating;
- if (hidden) {
- return 0;
- }
-
-
-
-
-
-
- if (Ext.supports.BoundingClientRect) {
- rect = dom.getBoundingClientRect();
- width = (me.vertical && !Ext.supports.RotatedBoundingClientRect) ? (rect.bottom - rect.top) : (rect.right - rect.left);
- width = preciseWidth ? width : Math.ceil(width);
- } else {
- width = dom.offsetWidth;
- }
-
-
-
- if (Ext.supports.Direct2DBug && !me.vertical) {
-
- floating = me.adjustDirect2DDimension(WIDTH);
- if (preciseWidth) {
- width += floating;
- }
-
-
-
- else if (floating > 0 && floating < 0.5) {
- width++;
- }
- }
- if (contentWidth) {
- width -= me.getBorderWidth("lr") + me.getPadding("lr");
- }
- return (width < 0) ? 0 : width;
- },
-
- getX: function() {
- return this.getXY()[0];
- },
-
- getXY: function() {
- var round = Math.round,
- dom = this.dom,
- body = DOC.body,
- x = 0,
- y = 0,
- bodyRect, rect;
- if (dom !== DOC && dom !== body) {
-
-
- try {
- bodyRect = body.getBoundingClientRect();
- rect = dom.getBoundingClientRect();
- x = rect.left - bodyRect.left;
- y = rect.top - bodyRect.top;
- } catch (ex) {}
- }
- return [
- round(x),
- round(y)
- ];
- },
-
- getY: function() {
- return this.getXY()[1];
- },
-
- getZIndex: function() {
- return parseInt(this.getStyle('z-index'), 10);
- },
-
- hasCls: function(name) {
- var classMap = this.getClassMap();
- return classMap.hasOwnProperty(name);
- },
-
- hide: function() {
- return this.setVisible(false);
- },
-
- hover: function(overFn, outFn, scope, options) {
- var me = this;
- me.on('mouseenter', overFn, scope || me.dom, options);
- me.on('mouseleave', outFn, scope || me.dom, options);
- return me;
- },
-
- indexOf: function(childEl) {
- var children = this.dom,
- c = childEl && Ext.getDom(childEl);
- children = children && children.childNodes;
- return (c && children) ? Array.prototype.indexOf.call(children, c) : -1;
- },
-
- insertAfter: function(el) {
- el = Ext.getDom(el);
- el.parentNode.insertBefore(this.dom, el.nextSibling);
- return this;
- },
-
- insertBefore: function(el) {
- el = Ext.getDom(el);
- el.parentNode.insertBefore(this.dom, el);
- return this;
- },
-
- insertFirst: function(el, returnDom) {
- el = el || {};
- if (el.nodeType || el.dom || typeof el === 'string') {
-
- el = Ext.getDom(el);
- this.dom.insertBefore(el, this.dom.firstChild);
- return !returnDom ? Ext.get(el) : el;
- } else {
-
- return this.createChild(el, this.dom.firstChild, returnDom);
- }
- },
-
- insertHtml: function(where, html, returnEl) {
- var el = Ext.DomHelper.insertHtml(where, this.dom, html);
- return returnEl ? Ext.get(el) : el;
- },
-
- insertSibling: function(el, where, returnDom) {
- var me = this,
- DomHelper = Ext.DomHelper,
- isAfter = (where || 'before').toLowerCase() === 'after',
- rt, insertEl, eLen, e;
- if (Ext.isIterable(el)) {
- eLen = el.length;
- insertEl = Ext.fly(DOC.createDocumentFragment());
-
- if (Ext.isArray(el)) {
- for (e = 0; e < eLen; e++) {
- rt = insertEl.appendChild(el[e], returnDom);
- }
- } else
- {
- for (e = 0; e < eLen; e++) {
- insertEl.dom.appendChild(rt = el[0]);
- }
- if (returnDom === false) {
- rt = Ext.get(rt);
- }
- }
-
- me.dom.parentNode.insertBefore(insertEl.dom, isAfter ? me.dom.nextSibling : me.dom);
- return rt;
- }
- el = el || {};
- if (el.nodeType || el.dom) {
- rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : me.dom);
- if (!returnDom) {
- rt = Ext.get(rt);
- }
- } else {
- if (isAfter && !me.dom.nextSibling) {
- rt = DomHelper.append(me.dom.parentNode, el, !returnDom);
- } else {
- rt = DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
- }
- }
- return rt;
- },
-
- is: function(selector) {
- var dom = this.dom,
- is;
- if (!selector) {
-
-
-
-
-
-
-
- is = true;
- } else if (!dom.tagName) {
-
- is = false;
- } else if (Ext.isFunction(selector)) {
- is = selector(dom);
- } else {
- is = dom[Ext.supports.matchesSelector](selector);
- }
- return is;
- },
-
- isAncestor: function(el) {
- var ret = false,
- dom = this.dom,
- child = Ext.getDom(el);
- if (dom && child) {
-
- if (!child.nodeType) {
- return false;
- }
- if (dom.contains) {
- return dom.contains(child);
- } else if (dom.compareDocumentPosition) {
- return !!(dom.compareDocumentPosition(child) & 16);
- } else {
- while ((child = child.parentNode)) {
- ret = child === dom || ret;
- }
- }
- }
- return ret;
- },
- isPainted: (function() {
- return !Ext.browser.is.IE ? function() {
- var dom = this.dom;
- return Boolean(dom && dom.offsetParent);
- } : function() {
- var dom = this.dom;
- return Boolean(dom && (dom.offsetHeight !== 0 || dom.offsetWidth !== 0));
- };
- })(),
-
- isScrollable: function() {
- var dom = this.dom;
- return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
- },
-
- isStyle: function(style, val) {
- return this.getStyle(style) === val;
- },
-
- isVisible: function(deep, mode) {
- var dom = this.dom,
- visible = true,
- end;
- if (!dom) {
- return false;
- }
- mode = mode || 3;
- if (!visFly) {
- visFly = new Ext.dom.Fly();
- }
- for (end = dom.ownerDocument.documentElement; dom !== end; dom = dom.parentNode) {
- if (!dom || dom.nodeType === 11) {
-
- visible = false;
- }
- if (visible) {
- visFly.attach(dom);
- if (mode & 1) {
- visible = !visFly.isStyle(DISPLAY, NONE);
- }
- if (visible && (mode & 2)) {
- visible = !visFly.isStyle(VISIBILITY, HIDDEN);
- }
- }
- if (!visible || !deep) {
- break;
- }
- }
- return visible;
- },
-
- last: function(selector, returnDom) {
- return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
- },
-
- matchNode: function(dir, start, selector, returnDom) {
- var dom = this.dom,
- n;
- if (!dom) {
- return null;
- }
- n = dom[start];
- while (n) {
- if (n.nodeType === 1 && (!selector || Ext.fly(n, '_matchNode').is(selector))) {
- return !returnDom ? Ext.get(n) : n;
- }
- n = n[dir];
- }
- return null;
- },
-
- measure: function(dimension) {
-
-
-
-
- var me = this,
- dom = me.dom,
- includeWidth = dimension !== 'h',
- includeHeight = dimension !== 'w',
- width = 0,
- height = 0,
- addPadding = !Ext.supports.ComputedSizeIncludesPadding,
- style, rect, offsetParent;
-
- if (dom.nodeName === 'BODY') {
- height = includeHeight && Element.getViewportHeight();
- width = includeWidth && Element.getViewportWidth();
- } else {
- offsetParent = dom.offsetParent;
- style = dom.ownerDocument.defaultView.getComputedStyle(dom, null);
-
- addPadding |= style.boxSizing === 'content-box';
-
- if (offsetParent !== null || style.position === 'fixed') {
- if (includeHeight) {
- height = toFloat(style.height);
- if (addPadding) {
- height += toFloat(style.paddingTop) + toFloat(style.paddingBottom) + toFloat(style.borderTopWidth) + toFloat(style.borderBottomWidth);
- }
- }
- if (includeWidth) {
- width = toFloat(style.width);
- if (addPadding) {
- width += toFloat(style.paddingLeft) + toFloat(style.paddingRight) + toFloat(style.borderLeftWidth) + toFloat(style.borderRightWidth);
- }
- }
- }
- }
-
- rect = dimension ? null : {
- width: width,
- height: height
- };
-
- return dimension ? (includeWidth ? width : height) : rect;
- },
-
- measureContent: function(dimension) {
- var me = this,
- includeWidth = dimension !== 'h',
- size = me.measure(dimension),
-
- h = dimension ? size : size.height,
- w = dimension ? size : size.width;
- if (dimension !== 'w') {
- h -= me.getBorderWidth('tb') + me.getPadding('tb');
- }
- if (includeWidth) {
- w -= me.getBorderWidth('lr') + me.getPadding('lr');
- }
- return dimension ? (includeWidth ? w : h) : {
- width: w,
- height: h
- };
- },
-
- monitorMouseLeave: function(delay, handler, scope) {
- var me = this,
- timer,
- listeners = {
- mouseleave: function(e) {
- if (Ext.isIE9m) {
- e.enableIEAsync();
- }
- timer = Ext.defer(handler, delay, scope || me, [
- e
- ]);
- },
- mouseenter: function() {
- Ext.undefer(timer);
- },
- destroy: function() {
- Ext.undefer(timer);
- if (!me.destroyed) {
- me.un(listeners);
- }
- }
- };
- me.on(listeners);
- return listeners;
- },
-
- next: function(selector, returnDom) {
- return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
- },
-
- parent: function(selector, returnDom) {
- return this.matchNode('parentNode', 'parentNode', selector, returnDom);
- },
- peekData: function() {
- var dom = this.dom;
- return dom && dom._extData || null;
- },
-
- position: function(pos, zIndex, x, y) {
- var me = this;
- if (me.dom.tagName !== 'BODY') {
- if (!pos && me.isStyle(POSITION, STATIC)) {
- me.setStyle(POSITION, RELATIVE);
- } else if (pos) {
- me.setStyle(POSITION, pos);
- }
- if (zIndex) {
- me.setStyle(ZINDEX, zIndex);
- }
- if (x || y) {
- me.setXY([
- x || false,
- y || false
- ]);
- }
- }
- },
-
- prev: function(selector, returnDom) {
- return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
- },
-
- query: function(selector, asDom, single) {
- var dom = this.dom,
- results, len, nlen, node, nodes, i, j;
- if (!dom) {
- return null;
- }
- asDom = (asDom !== false);
- selector = selector.split(",");
- if (!single) {
-
-
- results = [];
- }
- for (i = 0 , len = selector.length; i < len; i++) {
- if (typeof selector[i] === 'string') {
- if (single) {
-
- node = dom.querySelector(selector[i]);
- return asDom ? node : Ext.get(node);
- }
- nodes = dom.querySelectorAll(selector[i]);
- for (j = 0 , nlen = nodes.length; j < nlen; j++) {
- results.push(asDom ? nodes[j] : Ext.get(nodes[j]));
- }
- }
- }
- return results;
- },
-
- radioCls: function(className) {
- var cn = this.dom.parentNode.childNodes,
- v;
- className = Ext.isArray(className) ? className : [
- className
- ];
- for (var i = 0,
- len = cn.length; i < len; i++) {
- v = cn[i];
- if (v && v.nodeType === 1) {
- Ext.fly(v).removeCls(className);
- }
- }
- return this.addCls(className);
- },
- redraw: function() {
- var dom = this.dom,
- domStyle = dom.style;
- domStyle.display = 'none';
- dom.offsetHeight;
- domStyle.display = '';
- },
-
- remove: function() {
- this.destroy();
- },
- removeChild: function(element) {
- this.dom.removeChild(Ext.getDom(element));
- return this;
- },
-
- removeCls: function(names, prefix, suffix) {
- return this.replaceCls(names, null, prefix, suffix);
- },
-
- repaint: function() {
- var me = this;
- me.addCls(Ext.baseCSSPrefix + 'repaint');
- if (!me.repaintTimer) {
- me.repaintTimer = Ext.defer(function() {
- me.repaintTimer = null;
- if (me.dom) {
-
- me.removeCls(Ext.baseCSSPrefix + 'repaint');
- }
- }, 1);
- }
- return me;
- },
-
- replace: function(el, destroy) {
- el = Ext.getDom(el);
- var parentNode = el.parentNode,
- id = el.id,
- dom = this.dom;
-
- if (!parentNode) {
- Ext.raise('Cannot replace element "' + id + '". It is not attached to a parent node.');
- }
-
- if (destroy !== false && id && Ext.cache[id]) {
- parentNode.insertBefore(dom, el);
- Ext.get(el).destroy();
- } else {
- parentNode.replaceChild(dom, el);
- }
- return this;
- },
-
- replaceCls: function(remove, add, prefix, suffix) {
- var me = this,
- added = 0,
- removed = 0,
- rem = remove,
- data = (add || remove) && me.getData(),
- list, map, i, n, name;
- if (data) {
- list = data.classList;
- map = data.classMap;
- add = add ? ((typeof add === 'string') ? add.split(spacesRe) : add) : EMPTY;
- rem = rem ? ((typeof rem === 'string') ? rem.split(spacesRe) : rem) : EMPTY;
-
- prefix = prefix || '';
- if (prefix && prefix[prefix.length - 1] !== '-') {
- prefix += '-';
- }
- suffix = suffix || '';
- if (suffix && suffix[0] !== '-') {
- suffix = '-' + suffix;
- }
- for (i = 0 , n = rem.length; i < n; i++) {
- if (!(name = rem[i])) {
-
-
- continue;
- }
- name = prefix + name + suffix;
-
- if (spacesRe.test(name)) {
- Ext.raise('Class names in arrays must not contain spaces');
- }
-
- if (map[name]) {
- delete map[name];
- ++removed;
- }
- }
- for (i = 0 , n = add.length; i < n; i++) {
- if (!(name = add[i])) {
-
- continue;
- }
- name = prefix + name + suffix;
-
- if (spacesRe.test(name)) {
- Ext.raise('Class names in arrays must not contain spaces');
- }
-
- if (!map[name]) {
- map[name] = true;
-
- if (!removed) {
- list.push(name);
- ++added;
- }
- }
- }
- if (removed) {
- me.setClassMap(map,
- true);
- } else if (added) {
- me.dom.className = list.join(' ');
- }
- }
- return me;
- },
-
- replaceWith: function(el) {
- var me = this,
- dom = me.dom,
- parent = dom.parentNode,
- cache = Ext.cache,
- newDom;
- me.clearListeners();
- if (el.nodeType || el.dom || typeof el === 'string') {
- el = Ext.get(el);
- newDom = parent.insertBefore(el.dom, dom);
- } else {
-
- newDom = Ext.DomHelper.insertBefore(dom, el);
- }
- parent.removeChild(dom);
- me.dom = newDom;
- if (!me.isFly) {
- delete cache[me.id];
- cache[me.id = Ext.id(newDom)] = me;
- }
- return me;
- },
- resolveListenerScope: function(defaultScope) {
-
- var component = this.component;
- return component ? component.resolveListenerScope(defaultScope) : this;
- },
-
- scroll: function(direction, distance, animate) {
- if (!this.isScrollable()) {
- return false;
- }
-
-
- direction = direction.charAt(0);
- var me = this,
- dom = me.dom,
- side = direction === 'r' || direction === 'l' ? 'left' : 'top',
- scrolled = false,
- currentScroll, constrainedScroll;
- if (direction === 'l' || direction === 't' || direction === 'u') {
- distance = -distance;
- }
- if (side === 'left') {
- currentScroll = dom.scrollLeft;
- constrainedScroll = me.constrainScrollLeft(currentScroll + distance);
- } else {
- currentScroll = dom.scrollTop;
- constrainedScroll = me.constrainScrollTop(currentScroll + distance);
- }
- if (constrainedScroll !== currentScroll) {
- this.scrollTo(side, constrainedScroll, animate);
- scrolled = true;
- }
- return scrolled;
- },
-
- scrollBy: function(deltaX, deltaY, animate) {
- var me = this,
- dom = me.dom;
-
- if (deltaX.length) {
- animate = deltaY;
- deltaY = deltaX[1];
- deltaX = deltaX[0];
- } else if (typeof deltaX != 'number') {
-
- animate = deltaY;
- deltaY = deltaX.y;
- deltaX = deltaX.x;
- }
- if (deltaX) {
- me.scrollTo('left', me.constrainScrollLeft(dom.scrollLeft + deltaX), animate);
- }
- if (deltaY) {
- me.scrollTo('top', me.constrainScrollTop(dom.scrollTop + deltaY), animate);
- }
- return me;
- },
-
- scrollChildIntoView: function(child, hscroll) {
-
- Ext.fly(child).scrollIntoView(this, hscroll);
- },
-
- scrollIntoView: function(container, hscroll, animate, highlight) {
- container = Ext.getDom(container) || Ext.getBody().dom;
- return this.doScrollIntoView(container, hscroll, animate, highlight, 'getScrollLeft', 'scrollTo');
- },
-
- scrollTo: function(side, value, animate) {
-
- var top = topRe.test(side),
- me = this,
- prop = top ? 'scrollTop' : 'scrollLeft',
- dom = me.dom,
- animCfg;
- if (!animate || !me.anim) {
-
- dom[prop] = value;
-
- dom[prop] = value;
- } else {
- animCfg = {
- to: {}
- };
- animCfg.to[prop] = value;
- if (Ext.isObject(animate)) {
- Ext.applyIf(animCfg, animate);
- }
- me.animate(animCfg);
- }
- return me;
- },
-
- select: function(selector, composite) {
- var isElementArray, elements;
- if (typeof selector === "string") {
- elements = this.query(selector, !composite);
- }
-
- else if (selector.length === undefined) {
- Ext.raise("Invalid selector specified: " + selector);
- } else
- {
-
-
- elements = selector;
- isElementArray = true;
- }
-
-
-
-
-
-
- return composite ? new Ext.CompositeElement(elements, !isElementArray) : new Ext.CompositeElementLite(elements, true);
- },
-
- selectNode: function(selector, asDom) {
- return this.query(selector, asDom, true);
- },
-
- set: function(attributes, useSet) {
- var me = this,
- dom = me.dom,
- attribute, value;
- for (attribute in attributes) {
- if (attributes.hasOwnProperty(attribute)) {
- value = attributes[attribute];
- if (attribute === 'style') {
- me.applyStyles(value);
- } else if (attribute === 'cls') {
- dom.className = value;
- } else if (useSet !== false) {
- if (value === undefined) {
- dom.removeAttribute(attribute);
- } else {
- dom.setAttribute(attribute, value);
- }
- } else {
- dom[attribute] = value;
- }
- }
- }
- return me;
- },
-
- setBottom: function(bottom) {
- this.dom.style[BOTTOM] = Element.addUnits(bottom);
- return this;
- },
-
- setClassMap: function(classMap, keep) {
- var data = this.getData(
- false),
- classList;
- if (data) {
- classMap = (keep && classMap) || Ext.apply({}, classMap);
- data.classMap = classMap;
- data.classList = classList = Ext.Object.getKeys(classMap);
- data.isSynchronized = true;
-
- this.dom.className = classList.join(' ');
- }
- },
-
- setCls: function(className) {
- var me = this,
- elementData = me.getData(
- false),
- i, ln, map, classList;
- if (typeof className === 'string') {
- className = className.split(spacesRe);
- }
- elementData.classList = classList = className.slice();
- elementData.classMap = map = {};
- for (i = 0 , ln = classList.length; i < ln; i++) {
- map[classList[i]] = true;
- }
- me.dom.className = classList.join(' ');
- },
-
- setDisplayed: function(value) {
- var me = this;
- if (typeof value === "boolean") {
- value = value ? me._getDisplay() : NONE;
- }
- me.setStyle(DISPLAY, value);
- if (me.shadow || me.shim) {
- me.setUnderlaysVisible(value !== NONE);
- }
- return me;
- },
-
- setHeight: function(height) {
- var me = this;
- me.dom.style[HEIGHT] = Element.addUnits(height);
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
-
- setHtml: function(html) {
- if (this.dom) {
- this.dom.innerHTML = html;
- }
- return this;
- },
- setId: function(id) {
- var me = this,
- currentId = me.id,
- cache = Ext.cache;
- if (currentId) {
- delete cache[currentId];
- }
- me.dom.id = id;
-
- me.id = id;
- cache[id] = me;
- return me;
- },
-
- setLeft: function(left) {
- var me = this;
- me.dom.style[LEFT] = Element.addUnits(left);
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
- setLocalX: function(x) {
- var me = this,
- style = me.dom.style;
-
- style.right = '';
- style.left = (x === null) ? 'auto' : x + 'px';
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
- setLocalXY: function(x, y) {
- var me = this,
- style = me.dom.style;
-
- style.right = '';
- if (x && x.length) {
- y = x[1];
- x = x[0];
- }
- if (x === null) {
- style.left = 'auto';
- } else if (x !== undefined) {
- style.left = x + 'px';
- }
- if (y === null) {
- style.top = 'auto';
- } else if (y !== undefined) {
- style.top = y + 'px';
- }
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
- setLocalY: function(y) {
- var me = this;
- me.dom.style.top = (y === null) ? 'auto' : y + 'px';
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
- setMargin: function(margin) {
- var me = this,
- domStyle = me.dom.style;
- if (margin || margin === 0) {
- margin = me.self.unitizeBox((margin === true) ? 5 : margin);
- domStyle.setProperty('margin', margin, 'important');
- } else {
- domStyle.removeProperty('margin-top');
- domStyle.removeProperty('margin-right');
- domStyle.removeProperty('margin-bottom');
- domStyle.removeProperty('margin-left');
- }
- },
-
- setMaxHeight: function(height) {
- this.dom.style[MAX_HEIGHT] = Element.addUnits(height);
- return this;
- },
-
- setMaxWidth: function(width) {
- this.dom.style[MAX_WIDTH] = Element.addUnits(width);
- return this;
- },
-
- setMinHeight: function(height) {
- this.dom.style[MIN_HEIGHT] = Element.addUnits(height);
- return this;
- },
-
- setMinWidth: function(width) {
- this.dom.style[MIN_WIDTH] = Element.addUnits(width);
- return this;
- },
-
- setOpacity: function(opacity) {
- var me = this;
- if (me.dom) {
- me.setStyle('opacity', opacity);
- }
- return me;
- },
- setPadding: function(padding) {
- var me = this,
- domStyle = me.dom.style;
- if (padding || padding === 0) {
- padding = me.self.unitizeBox((padding === true) ? 5 : padding);
- domStyle.setProperty('padding', padding, 'important');
- } else {
- domStyle.removeProperty('padding-top');
- domStyle.removeProperty('padding-right');
- domStyle.removeProperty('padding-bottom');
- domStyle.removeProperty('padding-left');
- }
- },
-
- setRight: function(right) {
- this.dom.style[RIGHT] = Element.addUnits(right);
- return this;
- },
-
- setScrollLeft: function(left) {
- this.dom.scrollLeft = left;
- return this;
- },
-
- setScrollTop: function(top) {
- this.dom.scrollTop = top;
- return this;
- },
-
- setSize: function(width, height) {
- var me = this,
- style = me.dom.style;
- if (Ext.isObject(width)) {
-
- height = width.height;
- width = width.width;
- }
- if (width !== undefined) {
- style.width = Element.addUnits(width);
- }
- if (height !== undefined) {
- style.height = Element.addUnits(height);
- }
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
-
- setStyle: function(prop, value) {
- var me = this,
- dom = me.dom,
- hooks = me.styleHooks,
- style = dom.style,
- name = prop,
- hook;
-
- if (typeof name === 'string') {
- hook = hooks[name];
- if (!hook) {
- hooks[name] = hook = {
- name: Element.normalize(name)
- };
- }
- value = (value == null) ? '' : value;
-
- if (hook.set) {
- hook.set(dom, value, me);
- } else {
- style[hook.name] = value;
- }
- if (hook.afterSet) {
- hook.afterSet(dom, value, me);
- }
- } else {
- for (name in prop) {
- hook = hooks[name];
- if (!hook) {
- hooks[name] = hook = {
- name: Element.normalize(name)
- };
- }
- value = prop[name];
- value = (value == null) ? '' : value;
-
- if (hook.set) {
- hook.set(dom, value, me);
- } else {
- style[hook.name] = value;
- }
- if (hook.afterSet) {
- hook.afterSet(dom, value, me);
- }
- }
- }
- return me;
- },
- setText: function(text) {
- this.dom.textContent = text;
- },
-
- setTop: function(top) {
- var me = this;
- me.dom.style[TOP] = Element.addUnits(top);
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
-
- setTouchAction: function(touchAction) {
- Ext.dom.TouchAction.set(this.dom, touchAction);
- },
- setUnderlaysVisible: function(visible) {
- var shadow = this.shadow,
- shim = this.shim;
- if (shadow && !shadow.disabled) {
- if (visible) {
- shadow.show();
- } else {
- shadow.hide();
- }
- }
- if (shim && !shim.disabled) {
- if (visible) {
- shim.show();
- } else {
- shim.hide();
- }
- }
- },
-
- setVisibility: function(isVisible) {
- var domStyle = this.dom.style;
- if (isVisible) {
- domStyle.removeProperty('visibility');
- } else {
- domStyle.setProperty('visibility', 'hidden', 'important');
- }
- },
-
- setVisibilityMode: function(mode) {
-
- if (mode !== 1 && mode !== 2 && mode !== 3 && mode !== 4 && mode !== 5) {
- Ext.raise("visibilityMode must be one of the following: " + "Ext.Element.DISPLAY, Ext.Element.VISIBILITY, Ext.Element.OFFSETS, " + "Ext.Element.CLIP, or Element.OPACITY");
- }
-
- this.getData().visibilityMode = mode;
- return this;
- },
-
- setVisible: function(visible) {
- var me = this,
- mode = me.getVisibilityMode(),
- addOrRemove = visible ? 'removeCls' : 'addCls';
- switch (mode) {
- case Element.DISPLAY:
- me.removeCls([
- visibilityCls,
- offsetsCls,
- clipCls,
- opacityCls
- ]);
- me[addOrRemove](displayCls);
- break;
- case Element.VISIBILITY:
- me.removeCls([
- displayCls,
- offsetsCls,
- clipCls,
- opacityCls
- ]);
- me[addOrRemove](visibilityCls);
- break;
- case Element.OFFSETS:
- me.removeCls([
- visibilityCls,
- displayCls,
- clipCls,
- opacityCls
- ]);
- me[addOrRemove](offsetsCls);
- break;
- case Element.CLIP:
- me.removeCls([
- visibilityCls,
- displayCls,
- offsetsCls,
- opacityCls
- ]);
- me[addOrRemove](clipCls);
- break;
- case Element.OPACITY:
- me.removeCls([
- visibilityCls,
- displayCls,
- offsetsCls,
- clipCls
- ]);
- me[addOrRemove](opacityCls);
- break;
- }
- if (me.shadow || me.shim) {
- me.setUnderlaysVisible(visible);
- }
- if (!visible && me.$ripples) {
- me.destroyAllRipples();
- }
- return me;
- },
-
- setWidth: function(width) {
- var me = this;
- me.dom.style[WIDTH] = Element.addUnits(width);
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
-
- setX: function(x) {
- return this.setXY([
- x,
- false
- ]);
- },
-
- setXY: function(xy) {
- var me = this,
- pts = me.translatePoints(xy),
- style = me.dom.style,
- pos;
- me.position();
-
-
- style.right = '';
- for (pos in pts) {
- if (!isNaN(pts[pos])) {
- style[pos] = pts[pos] + 'px';
- }
- }
- if (me.shadow || me.shim) {
- me.syncUnderlays();
- }
- return me;
- },
-
- setY: function(y) {
- return this.setXY([
- false,
- y
- ]);
- },
-
- setZIndex: function(zindex) {
- var me = this;
- if (me.shadow) {
- me.shadow.setZIndex(zindex);
- }
- if (me.shim) {
- me.shim.setZIndex(zindex);
- }
- return me.setStyle('z-index', zindex);
- },
-
- show: function() {
- return this.setVisible(true);
- },
-
- swallowEvent: function(eventName, preventDefault) {
- var me = this,
- e, eLen,
- listeners = {
- destroyable: true
- },
- fn = function(e) {
- e.stopPropagation();
- if (preventDefault) {
- e.preventDefault();
- }
- };
- if (Ext.isArray(eventName)) {
- eLen = eventName.length;
- for (e = 0; e < eLen; e++) {
- listeners[eventName[e]] = fn;
- }
- } else {
- listeners[eventName] = fn;
- }
- return me.on(listeners);
- },
-
- swapCls: function(firstClass, secondClass, flag, prefix) {
- if (flag === undefined) {
- flag = true;
- }
- var me = this,
- addedClass = flag ? firstClass : secondClass,
- removedClass = flag ? secondClass : firstClass;
- if (removedClass) {
- me.removeCls(prefix ? prefix + '-' + removedClass : removedClass);
- }
- if (addedClass) {
- me.addCls(prefix ? prefix + '-' + addedClass : addedClass);
- }
- return me;
- },
-
- synchronize: function() {
- var me = this,
- dom = me.dom,
- hasClassMap = {},
- className = dom.className,
- classList, i, ln, name,
- elementData = me.getData(
- false);
- if (className && className.length > 0) {
- classList = dom.className.split(classNameSplitRegex);
- for (i = 0 , ln = classList.length; i < ln; i++) {
- name = classList[i];
- hasClassMap[name] = true;
- }
- } else {
- classList = [];
- }
- elementData.classList = classList;
- elementData.classMap = hasClassMap;
- elementData.isSynchronized = true;
- return me;
- },
-
- syncUnderlays: function() {
- var me = this,
- shadow = me.shadow,
- shim = me.shim,
- dom = me.dom,
- xy, x, y, w, h;
- if (me.isVisible()) {
- xy = me.getXY();
- x = xy[0];
- y = xy[1];
- w = dom.offsetWidth;
- h = dom.offsetHeight;
- if (shadow && !shadow.hidden) {
- shadow.realign(x, y, w, h);
- }
- if (shim && !shim.hidden) {
- shim.realign(x, y, w, h);
- }
- }
- },
-
- toggleCls: function(className, state) {
- if (state == null) {
- state = !this.hasCls(className);
- }
- return state ? this.addCls(className) : this.removeCls(className);
- },
-
- toggle: function() {
- this.setVisible(!this.isVisible());
- return this;
- },
- translate: function() {
- var transformStyleName = 'webkitTransform' in DOC.createElement('div').style ? 'webkitTransform' : 'transform';
- return function(x, y, z) {
- x = Math.round(x);
- y = Math.round(y);
- z = Math.round(z);
- this.dom.style[transformStyleName] = 'translate3d(' + (x || 0) + 'px, ' + (y || 0) + 'px, ' + (z || 0) + 'px)';
- };
- }(),
-
- unwrap: function() {
- var dom = this.dom,
- parentNode = dom.parentNode,
- activeElement = (activeElFly || (activeElFly = new Ext.dom.Fly())).attach(Ext.Element.getActiveElement()),
- grandparentNode, cached, resumeFocus, tabIndex;
- grannyFly = grannyFly || new Ext.dom.Fly();
- cached = Ext.cache[activeElement.dom.id];
-
-
-
- if (cached) {
- activeElement = cached;
- }
- if (this.contains(activeElement)) {
- if (cached) {
- cached.suspendFocusEvents();
- }
- resumeFocus = true;
- }
- if (parentNode) {
- grandparentNode = parentNode.parentNode;
-
- if (resumeFocus) {
- tabIndex = grandparentNode.getAttribute('tabIndex');
- grannyFly.attach(grandparentNode);
- grannyFly.set({
- tabIndex: -1
- });
- grannyFly.suspendFocusEvents();
- grannyFly.focus();
- }
- grandparentNode.insertBefore(dom, parentNode);
- grandparentNode.removeChild(parentNode);
- } else {
- grandparentNode = DOC.createDocumentFragment();
- grandparentNode.appendChild(dom);
- }
- if (resumeFocus) {
- if (cached) {
- cached.focus();
- cached.resumeFocusEvents();
- } else {
- activeElement.focus();
- }
- if (grannyFly) {
- grannyFly.resumeFocusEvents();
- grannyFly.set({
- tabIndex: tabIndex
- });
- }
- }
- return this;
- },
-
- up: function(simpleSelector, limit, returnDom) {
- return this.findParentNode(simpleSelector, limit, !returnDom);
- },
-
- update: function(html) {
- return this.setHtml(html);
- },
-
- wrap: function(config, returnDom, selector) {
- var me = this,
- dom = me.dom,
- result = Ext.DomHelper.insertBefore(dom, config || {
- tag: "div"
- }, !returnDom),
- newEl = (wrapFly || (wrapFly = new Ext.dom.Fly())).attach(Ext.getDom(result)),
-
- target = newEl,
- activeElement = (activeElFly || (activeElFly = new Ext.dom.Fly())).attach(Ext.Element.getActiveElement()),
- cached, resumeFocus, tabIndex;
- cached = Ext.cache[activeElement.dom.id];
-
-
-
- if (cached) {
- activeElement = cached;
- }
- if (selector) {
- target = newEl.selectNode(selector, returnDom);
- }
- if (me.contains(activeElement)) {
- if (cached) {
- cached.suspendFocusEvents();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tabIndex = Ext.getDom(newEl).getAttribute('tabIndex');
- newEl.set({
- tabIndex: -1
- });
- newEl.suspendFocusEvents();
- newEl.focus();
- resumeFocus = true;
- }
- (target.dom || target).appendChild(dom);
- if (resumeFocus) {
- if (cached) {
- cached.focus();
- cached.resumeFocusEvents();
- } else {
- activeElement.focus();
- }
- newEl.resumeFocusEvents();
-
-
- newEl.set({
- tabIndex: tabIndex
- });
- }
- return result;
- },
-
- isFocusable: function(skipVisibility) {
- var dom = this.dom,
- focusable = false,
- nodeName;
- if (dom && !dom.disabled) {
- nodeName = dom.nodeName;
-
- focusable = !!Ext.Element.naturallyFocusableTags[nodeName] || ((nodeName === 'A' || nodeName === 'LINK') && !!dom.href) || dom.getAttribute('tabIndex') != null || dom.contentEditable === 'true';
-
-
- if (Ext.isIE8 && nodeName === 'INPUT' && dom.type === 'hidden') {
- focusable = false;
- }
-
-
- focusable = focusable && (skipVisibility || this.isVisible(true));
- }
- return focusable;
- },
-
- isInputField: function() {
- var dom = this.dom,
- contentEditable = dom.contentEditable;
-
-
-
-
-
- if ((Ext.Element.inputTags[dom.tagName] && dom.type !== 'button') || (contentEditable === '' || contentEditable === 'true')) {
- return true;
- }
- return false;
- },
-
- isTabbable: function(includeHidden) {
- var dom = this.dom,
- tabbable = false,
- nodeName, hasIndex, tabIndex;
- if (dom && !dom.disabled) {
- nodeName = dom.nodeName;
-
-
-
- tabIndex = dom.getAttribute('tabIndex');
- hasIndex = tabIndex != null;
- tabIndex -= 0;
-
-
- if (nodeName === 'A' || nodeName === 'LINK') {
- if (dom.href) {
-
-
- tabbable = hasIndex && tabIndex < 0 ? false : true;
- } else
-
- {
- if (dom.contentEditable === 'true') {
- tabbable = !hasIndex || (hasIndex && tabIndex >= 0) ? true : false;
- } else {
- tabbable = hasIndex && tabIndex >= 0 ? true : false;
- }
- }
- }
-
-
- else if (dom.contentEditable === 'true' || Ext.Element.naturallyTabbableTags[nodeName]) {
- tabbable = hasIndex && tabIndex < 0 ? false : true;
- } else
-
- {
- if (hasIndex && tabIndex >= 0) {
- tabbable = true;
- }
- }
-
-
- if (Ext.isIE8 && nodeName === 'INPUT' && dom.type === 'hidden') {
- tabbable = false;
- }
-
-
-
-
- tabbable = tabbable && (includeHidden || ((!this.component || this.component.isVisible(true)) && this.isVisible(true)));
- }
- return tabbable;
- },
- ripplingCls: Ext.baseCSSPrefix + 'rippling',
- ripplingTransitionCls: Ext.baseCSSPrefix + 'ripple-transition',
- ripplingUnboundCls: Ext.baseCSSPrefix + 'rippling-unbound',
- rippleBubbleCls: Ext.baseCSSPrefix + 'ripple-bubble',
- rippleContainerCls: Ext.baseCSSPrefix + 'ripple-container',
- rippleWrapperCls: Ext.baseCSSPrefix + 'ripple-wrapper',
-
- noRippleDisplayMap: {
- table: 1,
- 'table-row': 1,
- 'table-row-group': 1
- },
-
- noRippleTagMap: {
- TABLE: 1,
- TR: 1,
- TBODY: 1
- },
-
- ripple: function(event, options) {
- if (options === true || !options) {
- options = {};
- } else if (Ext.isString(options)) {
- options = {
- color: options
- };
- }
- var me = this,
- rippleParent = Ext.isString(options.delegate) ? me.down(options.delegate) : me,
- rippleMeasureEl = Ext.isString(options.measureSelector) ? me.down(options.measureSelector) : null,
- color = window.getComputedStyle(rippleParent.dom).color,
- unbound = options.bound === false,
- position = options.position,
- ripplingCls = me.ripplingCls,
- ripplingTransitionCls = me.ripplingTransitionCls,
- ripplingUnboundCls = me.ripplingUnboundCls,
- rippleBubbleCls = me.rippleBubbleCls,
- rippleContainerCls = me.rippleContainerCls,
- rippleWrapperCls = me.rippleWrapperCls,
- offset, width, height, rippleDiameter, center, measureElWidth, measureElHeight, rippleSize, pos, posX, posY, rippleWrapper, rippleContainer, rippleBubble, rippleDestructor, rippleClearFn, rippleDestructionTimer, rippleBox, unboundEl, unboundElData, timeout;
- if (rippleParent) {
- offset = rippleParent.getXY();
- width = rippleParent.getWidth();
- height = rippleParent.getHeight();
- timeout = rippleParent.$rippleClearTimeout;
- if (timeout) {
- rippleParent.$rippleClearTimeout = Ext.undefer(timeout);
- }
-
-
- if (rippleMeasureEl) {
- measureElWidth = rippleMeasureEl.getWidth();
- measureElHeight = rippleMeasureEl.getHeight();
- rippleDiameter = Math.max(measureElWidth, measureElHeight);
- } else {
- rippleDiameter = width > height ? width : height;
- }
-
- if (options.diameterLimit === undefined || options.diameterLimit === true) {
- rippleDiameter = Math.min(rippleDiameter, Element.maxRippleDiameter);
- } else if (options.diameterLimit && options.diameterLimit !== false && options.diameterLimit !== 0) {
- rippleDiameter = Math.min(rippleDiameter, options.diameterLimit);
- }
-
- center = [
- offset[0] + width / 2,
- offset[1] + height / 2
- ];
- if (unbound) {
- if (options.fit !== false) {
-
-
- rippleSize = rippleDiameter * 2.15;
-
- rippleBox = rippleParent.getRegion();
- rippleBox.setPosition(rippleBox.getCenter()).setSize(rippleSize).translateBy(-rippleSize / 2, -rippleSize / 2);
-
-
-
- unboundEl = me.up(function(candidate) {
- var fly = Ext.fly(candidate, 'ripple');
- return !(candidate.tagName in me.noRippleTagMap) && !(fly.getStyle('display') in me.noRippleDisplayMap) && (fly.getRegion().contains(rippleBox));
- }) || Ext.getBody();
- } else {
- unboundEl = rippleParent;
- }
- }
-
-
- if (Ext.isString(event)) {
- options.color = event;
- event = null;
- } else if (event && !event.isEvent) {
- event = new Ext.event.Event(event);
- }
-
- if (event && event.isEvent) {
-
- if (event.browserEvent.$preventRipple) {
- return;
- }
- position = event.getXY();
- event.browserEvent.$preventRipple = true;
- }
-
-
- pos = (!unbound && !options.centered && position) || center;
- posX = pos[0] - offset[0] - (rippleDiameter / 2);
- posY = pos[1] - offset[1] - (rippleDiameter / 2);
-
-
- rippleParent.addCls(ripplingTransitionCls);
- if (!unbound) {
- rippleParent.addCls(ripplingCls);
-
- rippleContainer = rippleParent.child('.' + rippleContainerCls);
- } else {
-
-
- unboundElData = unboundEl.getData();
- rippleWrapper = unboundElData.rippleWrapper;
- if (!rippleWrapper) {
-
-
- unboundElData.rippleWrapper = rippleWrapper = unboundEl.insertFirst({
- style: 'position: absolute; top: 0; left: 0',
- cls: rippleWrapperCls + ' ' + ripplingCls + ' ' + ripplingUnboundCls
- });
- }
- }
- if (!rippleContainer) {
- if (unbound) {
-
-
- rippleContainer = rippleWrapper.append({
- cls: rippleContainerCls
- });
-
- rippleContainer.setXY(offset);
- } else {
-
-
- rippleContainer = rippleParent.append({
- cls: rippleContainerCls
- });
- }
- }
-
- rippleBubble = rippleContainer.append({
- cls: rippleBubbleCls
- });
- if (options.color !== 'default') {
- rippleBubble.setStyle('backgroundColor', options.color || color);
- }
- rippleBubble.setWidth(rippleDiameter);
- rippleBubble.setHeight(rippleDiameter);
- rippleBubble.setTop(posY);
- rippleBubble.setLeft(posX);
- rippleClearFn = function() {
-
-
-
- if (!rippleParent.destroyed) {
- rippleParent.$rippleClearTimeout = Ext.defer(function() {
- rippleParent.removeCls([
- ripplingCls,
- ripplingTransitionCls
- ]);
- rippleParent.$rippleClearTimeout = null;
- }, 50);
- }
- };
- rippleDestructor = function() {
- var ripple, timeout;
-
- rippleBubble.destroy();
-
- if (me.$ripples) {
- delete me.$ripples[rippleBubble.id];
- }
- timeout = rippleParent.$rippleClearTimeout;
- if (timeout) {
- rippleParent.$rippleClearTimeout = Ext.undefer(timeout);
- }
- if (unbound) {
-
-
- rippleContainer.destroy();
-
- ripple = rippleWrapper.child('.' + rippleContainerCls);
-
- if (!ripple) {
- unboundElData.rippleWrapper = null;
- rippleWrapper.destroy();
- rippleClearFn();
- }
- } else {
-
- ripple = rippleContainer.child('.' + rippleBubbleCls);
-
- if (!ripple) {
- rippleContainer.destroy();
- rippleClearFn();
- }
- }
- };
- rippleDestructionTimer = Ext.defer(rippleDestructor, options.destroyTime || 1000, me);
-
- if (!me.$ripples) {
- me.$ripples = {};
- }
- me.$ripples[rippleBubble.id] = {
- timerId: rippleDestructionTimer,
- destructor: rippleDestructor
- };
- rippleBubble.addCls(Ext.baseCSSPrefix + 'ripple');
- }
- },
- destroyAllRipples: function() {
- var me = this,
- rippleEl, ripple;
- for (rippleEl in me.$ripples) {
- ripple = me.$ripples[rippleEl];
- Ext.undefer(ripple.timerId);
- if (ripple.destructor) {
- ripple.destructor();
- }
- }
- me.$ripples = null;
- },
- privates: {
-
- findTabbableElements: function(options) {
- var skipSelf, skipChildren, excludeRoot, includeSaved, includeHidden,
- dom = this.dom,
- cAttr = Ext.Element.tabbableSavedCounterAttribute,
- selection = [],
- idx = 0,
- nodes, node, fly, i, len, tabIndex;
- if (!dom) {
- return selection;
- }
- if (options) {
- skipSelf = options.skipSelf;
- skipChildren = options.skipChildren;
- excludeRoot = options.excludeRoot;
- includeSaved = options.includeSaved;
- includeHidden = options.includeHidden;
- }
- excludeRoot = excludeRoot && Ext.getDom(excludeRoot);
- if (excludeRoot && excludeRoot.contains(dom)) {
- return selection;
- }
- if (!skipSelf && ((includeSaved && dom.hasAttribute(cAttr)) || this.isTabbable(includeHidden))) {
- selection[idx++] = dom;
- }
- if (skipChildren) {
- return selection;
- }
- nodes = dom.querySelectorAll(Ext.Element.tabbableSelector);
- len = nodes.length;
- if (!len) {
- return selection;
- }
- fly = new Ext.dom.Fly();
-
-
-
- for (i = 0; i < len; i++) {
- node = nodes[i];
-
-
-
-
-
-
- tabIndex = +node.getAttribute('tabIndex');
-
-
-
-
-
-
-
-
-
-
-
- if (((includeSaved && node.hasAttribute(cAttr)) || (!(tabIndex < 0) && fly.attach(node).isTabbable(includeHidden))) && !(excludeRoot && (excludeRoot === node || excludeRoot.contains(node)))) {
- selection[idx++] = node;
- }
- }
- return selection;
- },
-
- saveTabbableState: function(options) {
- var counterAttr = Ext.Element.tabbableSavedCounterAttribute,
- savedAttr = Ext.Element.tabbableSavedValueAttribute,
- counter, nodes, node, i, len;
-
-
-
-
-
-
- if (!options || options.includeSaved == null) {
- options = Ext.Object.chain(options || null);
- options.includeSaved = true;
- }
- nodes = this.findTabbableElements(options);
- for (i = 0 , len = nodes.length; i < len; i++) {
- node = nodes[i];
- counter = +node.getAttribute(counterAttr);
- if (counter > 0) {
- node.setAttribute(counterAttr, ++counter);
- } else {
-
-
- if (node.hasAttribute('tabIndex')) {
- node.setAttribute(savedAttr, node.getAttribute('tabIndex'));
- } else
- {
- node.setAttribute(savedAttr, 'none');
- }
-
-
- node.setAttribute('tabIndex', '-1');
- node.setAttribute(counterAttr, '1');
- }
- }
- return nodes;
- },
-
- restoreTabbableState: function(options) {
- var dom = this.dom,
- counterAttr = Ext.Element.tabbableSavedCounterAttribute,
- savedAttr = Ext.Element.tabbableSavedValueAttribute,
- nodes = [],
- skipSelf = options && options.skipSelf,
- skipChildren = options && options.skipChildren,
- reset = options && options.reset,
- idx, counter, node, i, len;
- if (!dom) {
- return this;
- }
- if (!skipChildren) {
- nodes = Ext.Array.from(dom.querySelectorAll('[' + counterAttr + ']'));
- }
- if (!skipSelf) {
- nodes.unshift(dom);
- }
- for (i = 0 , len = nodes.length; i < len; i++) {
- node = nodes[i];
- if (!node.hasAttribute(counterAttr) || !node.hasAttribute(savedAttr)) {
-
- continue;
- }
- counter = +node.getAttribute(counterAttr);
- if (!reset && counter > 1) {
- node.setAttribute(counterAttr, --counter);
-
- continue;
- }
- idx = node.getAttribute(savedAttr);
-
- if (idx === 'none') {
- node.removeAttribute('tabIndex');
- } else {
- node.setAttribute('tabIndex', idx);
- }
- node.removeAttribute(savedAttr);
- node.removeAttribute(counterAttr);
- }
- return nodes;
- },
-
- setTabIndex: function(tabIndex) {
- var dom = this.dom,
- savedAttr = Ext.Element.tabbableSavedValueAttribute;
- if (dom.hasAttribute(savedAttr)) {
- if (tabIndex == null) {
-
- dom.setAttribute(savedAttr, 'none');
- dom.removeAttribute('tabIndex');
- } else {
- dom.setAttribute(savedAttr, tabIndex);
- }
- } else {
- if (tabIndex == null) {
- dom.removeAttribute('tabIndex');
- } else {
- dom.setAttribute('tabIndex', tabIndex);
- }
- }
- },
- doAddListener: function(eventName, fn, scope, options, order, caller, manager) {
- var me = this,
- originalName = eventName,
- observableDoAddListener, additiveEventName, translatedEventName;
-
-
-
- eventName = Ext.canonicalEventName(eventName);
-
-
- if (!me.blockedEvents[eventName]) {
- observableDoAddListener = me.mixins.observable.doAddListener;
- options = options || {};
- if (Element.useDelegatedEvents === false) {
- options.delegated = options.delegated || false;
- }
- if (options.translate !== false) {
-
-
- additiveEventName = me.additiveEvents[eventName];
- if (additiveEventName) {
-
-
-
-
- options.type = eventName;
- eventName = additiveEventName;
- observableDoAddListener.call(me, eventName, fn, scope, options, order, caller, manager);
- }
- translatedEventName = me.eventMap[eventName];
- if (translatedEventName) {
-
- options.type = options.type || eventName;
- if (manager) {
- options.managedName = originalName;
- }
- eventName = translatedEventName;
- }
- }
- if (observableDoAddListener.call(me, eventName, fn, scope, options, order, caller, manager)) {
- if (me.longpressEvents[eventName] && (++me.longpressListenerCount === 1)) {
- me.on('MSHoldVisual', 'preventMsHoldVisual', me);
- }
- }
- if (manager && translatedEventName) {
- delete options.managedName;
- }
-
-
-
-
- delete options.type;
- }
- },
- doRemoveListener: function(eventName, fn, scope) {
- var me = this,
- observableDoRemoveListener, translatedEventName, additiveEventName, removed;
-
-
-
- eventName = Ext.canonicalEventName(eventName);
-
-
- if (!me.blockedEvents[eventName]) {
- observableDoRemoveListener = me.mixins.observable.doRemoveListener;
-
-
- additiveEventName = me.additiveEvents[eventName];
- if (additiveEventName) {
-
-
-
-
- eventName = additiveEventName;
- observableDoRemoveListener.call(me, eventName, fn, scope);
- }
- translatedEventName = me.eventMap[eventName];
- if (translatedEventName) {
- removed = observableDoRemoveListener.call(me, translatedEventName, fn, scope);
- }
-
-
- removed = observableDoRemoveListener.call(me, eventName, fn, scope) || removed;
- if (removed) {
- if (me.longpressEvents[eventName] && !--me.longpressListenerCount) {
- me.un('MSHoldVisual', 'preventMsHoldVisual', me);
- }
- }
- }
- },
- _initEvent: function(eventName) {
- return (this.events[eventName] = new Ext.dom.ElementEvent(this, eventName));
- },
- _getDisplay: function() {
- var data = this.getData(),
- display = data[ORIGINALDISPLAY];
- if (display === undefined) {
- data[ORIGINALDISPLAY] = display = '';
- }
- return display;
- },
-
- _getPublisher: function(eventName, noTranslate) {
- var Publisher = Ext.event.publisher.Publisher,
- publisher = Publisher.publishersByEvent[eventName],
- isNative = noTranslate && !Ext.event.Event.gestureEvents[eventName];
-
-
-
-
-
-
-
-
-
- if (isNative || !publisher || (this.dom === window && eventName === 'resize')) {
- publisher = Publisher.publishers.dom;
- }
- return publisher;
- },
- isFocusSuspended: function() {
- var data = this.peekData();
- return data && data.suspendFocusEvents;
- },
- preventMsHoldVisual: function(e) {
- e.preventDefault();
- },
- suspendFocusEvents: function() {
- if (!this.isFly) {
- this.suspendEvent('focus', 'blur');
- }
- this.getData().suspendFocusEvents = true;
- },
- resumeFocusEvents: function() {
- function resumeFn() {
- var data;
- if (!this.destroyed) {
- data = this.getData();
- if (data) {
- data.suspendFocusEvents = false;
- }
- if (!this.isFly) {
- this.resumeEvent('focus', 'blur');
- }
- }
- }
- if (!this.destroyed && this.getData().suspendFocusEvents) {
- if (Ext.isIE && !this.isFly) {
- this.resumeFocusEventsTimer = Ext.asap(resumeFn, this);
- } else {
- resumeFn.call(this);
- }
- }
- }
- },
- deprecated: {
- '5.0': {
- methods: {
-
- getHTML: 'getHtml',
-
- getPageBox: function(getRegion) {
- var me = this,
- dom = me.dom,
- isDoc = dom.nodeName === 'BODY',
- w = isDoc ? Element.getViewportWidth() : dom.offsetWidth,
- h = isDoc ? Element.getViewportHeight() : dom.offsetHeight,
- xy = me.getXY(),
- t = xy[1],
- r = xy[0] + w,
- b = xy[1] + h,
- l = xy[0];
- if (getRegion) {
- return new Ext.util.Region(t, r, b, l);
- } else {
- return {
- left: l,
- top: t,
- width: w,
- height: h,
- right: r,
- bottom: b
- };
- }
- },
-
- isTransparent: function(prop) {
- var value = this.getStyle(prop);
- return value ? transparentRe.test(value) : false;
- },
-
- purgeAllListeners: 'clearListeners',
-
- removeAllListeners: 'clearListeners',
-
- setHTML: 'setHtml'
- }
- }
- }
- };
- }, function(Element) {
- var DOC = document,
- docEl = DOC.documentElement,
- prototype = Element.prototype,
- supports = Ext.supports,
- pointerdown = 'pointerdown',
- pointermove = 'pointermove',
- pointerup = 'pointerup',
- pointercancel = 'pointercancel',
- MSPointerDown = 'MSPointerDown',
- MSPointerMove = 'MSPointerMove',
- MSPointerUp = 'MSPointerUp',
- MSPointerCancel = 'MSPointerCancel',
- mousedown = 'mousedown',
- mousemove = 'mousemove',
- mouseup = 'mouseup',
- mouseover = 'mouseover',
- mouseout = 'mouseout',
- mouseenter = 'mouseenter',
- mouseleave = 'mouseleave',
- touchstart = 'touchstart',
- touchmove = 'touchmove',
- touchend = 'touchend',
- touchcancel = 'touchcancel',
- click = 'click',
- dblclick = 'dblclick',
- tap = 'tap',
- doubletap = 'doubletap',
- eventMap = prototype.eventMap = {},
- additiveEvents = prototype.additiveEvents = {},
- oldId = Ext.id,
- eventOptions;
- prototype._init(Element);
- delete prototype._init;
-
- Ext.id = function(obj, prefix) {
- var el = obj && Ext.getDom(obj, true),
- sandboxPrefix, id;
- if (!el) {
- id = oldId(obj, prefix);
- } else if (!(id = el.id)) {
- id = oldId(null, prefix || Element.prototype.identifiablePrefix);
- if (Ext.isSandboxed) {
- sandboxPrefix = Ext.sandboxPrefix || (Ext.sandboxPrefix = Ext.sandboxName.toLowerCase() + '-');
- id = sandboxPrefix + id;
- }
- el.id = id;
- }
- return id;
- };
- if (supports.PointerEvents) {
- eventMap[mousedown] = pointerdown;
- eventMap[mousemove] = pointermove;
- eventMap[mouseup] = pointerup;
- eventMap[touchstart] = pointerdown;
- eventMap[touchmove] = pointermove;
- eventMap[touchend] = pointerup;
- eventMap[touchcancel] = pointercancel;
-
-
-
-
-
-
-
-
-
- eventMap[mouseover] = 'pointerover';
- eventMap[mouseout] = 'pointerout';
- eventMap[mouseenter] = 'pointerenter';
-
-
-
- if (!Ext.isIE11) {
- eventMap[mouseleave] = 'pointerleave';
- }
- } else if (supports.MSPointerEvents) {
-
- eventMap[pointerdown] = MSPointerDown;
- eventMap[pointermove] = MSPointerMove;
- eventMap[pointerup] = MSPointerUp;
- eventMap[pointercancel] = MSPointerCancel;
- eventMap[mousedown] = MSPointerDown;
- eventMap[mousemove] = MSPointerMove;
- eventMap[mouseup] = MSPointerUp;
- eventMap[touchstart] = MSPointerDown;
- eventMap[touchmove] = MSPointerMove;
- eventMap[touchend] = MSPointerUp;
- eventMap[touchcancel] = MSPointerCancel;
-
-
- eventMap[mouseover] = 'MSPointerOver';
- eventMap[mouseout] = 'MSPointerOut';
- } else if (supports.TouchEvents) {
- eventMap[pointerdown] = touchstart;
- eventMap[pointermove] = touchmove;
- eventMap[pointerup] = touchend;
- eventMap[pointercancel] = touchcancel;
- eventMap[mousedown] = touchstart;
- eventMap[mousemove] = touchmove;
- eventMap[mouseup] = touchend;
- eventMap[click] = tap;
- eventMap[dblclick] = doubletap;
- if (Ext.os.is.Desktop) {
-
-
-
-
-
-
-
-
-
-
-
- eventMap[touchstart] = mousedown;
- eventMap[touchmove] = mousemove;
- eventMap[touchend] = mouseup;
- eventMap[touchcancel] = mouseup;
- additiveEvents[mousedown] = mousedown;
- additiveEvents[mousemove] = mousemove;
- additiveEvents[mouseup] = mouseup;
- additiveEvents[touchstart] = touchstart;
- additiveEvents[touchmove] = touchmove;
- additiveEvents[touchend] = touchend;
- additiveEvents[touchcancel] = touchcancel;
- additiveEvents[pointerdown] = mousedown;
- additiveEvents[pointermove] = mousemove;
- additiveEvents[pointerup] = mouseup;
- additiveEvents[pointercancel] = mouseup;
- }
- } else {
-
-
- eventMap[pointerdown] = mousedown;
- eventMap[pointermove] = mousemove;
- eventMap[pointerup] = mouseup;
- eventMap[pointercancel] = mouseup;
- eventMap[touchstart] = mousedown;
- eventMap[touchmove] = mousemove;
- eventMap[touchend] = mouseup;
- eventMap[touchcancel] = mouseup;
- }
- if (Ext.isWebKit) {
-
-
- eventMap.transitionend = Ext.browser.getVendorProperyName('transitionEnd');
- eventMap.animationstart = Ext.browser.getVendorProperyName('animationStart');
- eventMap.animationend = Ext.browser.getVendorProperyName('animationEnd');
- }
- if (!Ext.supports.MouseWheel && !Ext.isOpera) {
- eventMap.mousewheel = 'DOMMouseScroll';
- }
- eventOptions = prototype.$eventOptions = Ext.Object.chain(prototype.$eventOptions);
- eventOptions.translate = eventOptions.capture = eventOptions.delegate = eventOptions.delegated = eventOptions.stopEvent = eventOptions.preventDefault = eventOptions.stopPropagation =
-
-
-
-
- eventOptions.element = 1;
- prototype.styleHooks.opacity = {
- name: 'opacity',
- afterSet: function(dom, value, el) {
- var shadow = el.shadow;
- if (shadow) {
- shadow.setOpacity(value);
- }
- }
- };
-
- prototype.getTrueXY = prototype.getXY;
-
- Ext.getViewportHeight = Element.getViewportHeight;
-
- Ext.getViewportWidth = Element.getViewportWidth;
-
- Ext.select = Element.select;
-
- Ext.query = Element.query;
- Ext.apply(Ext, {
-
- get: function(element) {
- return Element.get(element);
- },
-
- getDom: function(el) {
- if (!el || !DOC) {
- return null;
- }
-
- return typeof el === 'string' ? Ext.getElementById(el) : 'dom' in el ? el.dom : el;
- },
-
- getBody: function() {
- if (!Ext._bodyEl) {
- if (!DOC.body) {
- throw new Error("[Ext.getBody] document.body does not yet exist");
- }
- Ext._bodyEl = Ext.get(DOC.body);
- Ext._bodyEl.skipGarbageCollection = true;
- }
- return Ext._bodyEl;
- },
-
- getHead: function() {
- if (!Ext._headEl) {
- Ext._headEl = Ext.get(DOC.head || DOC.getElementsByTagName('head')[0]);
- Ext._headEl.skipGarbageCollection = true;
- }
- return Ext._headEl;
- },
-
- getDoc: function() {
- if (!Ext._docEl) {
- Ext._docEl = Ext.get(DOC);
- Ext._docEl.skipGarbageCollection = true;
- }
- return Ext._docEl;
- },
-
- getWin: function() {
- if (!Ext._winEl) {
- Ext._winEl = Ext.get(window);
- Ext._winEl.skipGarbageCollection = true;
- }
- return Ext._winEl;
- },
-
- removeNode: function(node) {
- node = node.dom || node;
- var id = node && node.id,
- el = Ext.cache[id],
- parent;
- if (el) {
- el.destroy();
- } else if (node && (node.nodeType === 3 || node.tagName.toUpperCase() !== 'BODY')) {
- parent = node.parentNode;
- if (parent) {
- parent.removeChild(node);
- }
- }
- }
- });
-
-
- Ext.isGarbage = function(dom) {
-
-
- return dom &&
- dom.nodeType === 1 && dom.tagName !== 'BODY' && dom.tagName !== 'HTML' && (
-
- !dom.parentNode || (
-
-
-
-
- dom.offsetParent === null &&
-
-
-
-
-
-
- ((Ext.isIE8 ? DOC.all[dom.id] : DOC.getElementById(dom.id)) !== dom) &&
-
- !(Ext.detachedBodyEl && Ext.detachedBodyEl.isAncestor(dom))));
- };
- Ext.onInternalReady(function() {
- var bodyCls = [],
- theme;
-
-
-
- Ext.getDoc().on('selectstart', function(ev, dom) {
- var selectableCls = Element.selectableCls,
- unselectableCls = Element.unselectableCls,
- tagName = dom && dom.tagName,
- el = new Ext.dom.Fly();
- tagName = tagName && tagName.toLowerCase();
-
-
-
- if (tagName === 'input' || tagName === 'textarea') {
- return;
- }
-
- while (dom && dom.nodeType === 1 && dom !== DOC.documentElement) {
- el.attach(dom);
-
- if (el.hasCls(selectableCls)) {
- return;
- }
-
- if (el.hasCls(unselectableCls)) {
- ev.stopEvent();
- return;
- }
- dom = dom.parentNode;
- }
- });
- if (Ext.os.is.Android || (Ext.os.is.Windows && Ext.supports.Touch)) {
-
-
-
-
-
-
- var win = Ext.getWin();
- Element._documentWidth = Element._viewportWidth = docEl.clientWidth;
- Element._documentHeight = Element._viewportHeight = docEl.clientHeight;
- win.on({
-
-
-
-
- focusin: '_onWindowFocusChange',
- focusout: '_onWindowFocusChange',
-
-
-
-
-
-
-
- pointerup: '_onWindowFocusChange',
- capture: true,
- delegated: false,
- delay: 1,
- scope: Element
- });
- win.on({
-
- resize: '_onWindowResize',
- priority: 2000,
- scope: Element
- });
- }
- if (supports.Touch) {
- bodyCls.push(Ext.baseCSSPrefix + 'touch');
- }
- if (Ext.isIE && Ext.isIE9m) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie', Ext.baseCSSPrefix + 'ie9m');
-
-
-
-
-
-
-
-
-
-
-
- bodyCls.push(Ext.baseCSSPrefix + 'ie8p');
- if (Ext.isIE8) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie8');
- } else {
- bodyCls.push(Ext.baseCSSPrefix + 'ie9', Ext.baseCSSPrefix + 'ie9p');
- }
- if (Ext.isIE8m) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie8m');
- }
- }
- if (Ext.isIE10) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie10');
- }
- if (Ext.isIE10p) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie10p');
- }
- if (Ext.isIE11) {
- bodyCls.push(Ext.baseCSSPrefix + 'ie11');
- }
- if (Ext.isEdge) {
- bodyCls.push(Ext.baseCSSPrefix + 'edge');
- }
- if (Ext.isGecko) {
- bodyCls.push(Ext.baseCSSPrefix + 'gecko');
- }
- if (Ext.isOpera) {
- bodyCls.push(Ext.baseCSSPrefix + 'opera');
- }
- if (Ext.isOpera12m) {
- bodyCls.push(Ext.baseCSSPrefix + 'opera12m');
- }
- if (Ext.isWebKit) {
- bodyCls.push(Ext.baseCSSPrefix + 'webkit');
- }
- if (Ext.isSafari) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari');
- }
- if (Ext.isSafari9) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari9');
- }
- if (Ext.isSafari10) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari10');
- }
- if (Ext.isSafari11) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari11');
- }
- if (Ext.isSafari && Ext.browser.version.isLessThan(9)) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari8m');
- }
- if (Ext.isChrome) {
- bodyCls.push(Ext.baseCSSPrefix + 'chrome');
- }
- if (Ext.isMac) {
- bodyCls.push(Ext.baseCSSPrefix + 'mac');
- }
- if (Ext.isWindows) {
- bodyCls.push(Ext.baseCSSPrefix + 'windows');
- }
- if (Ext.isLinux) {
- bodyCls.push(Ext.baseCSSPrefix + 'linux');
- }
- if (!supports.CSS3BorderRadius) {
- bodyCls.push(Ext.baseCSSPrefix + 'nbr');
- }
- if (!supports.CSS3LinearGradient) {
- bodyCls.push(Ext.baseCSSPrefix + 'nlg');
- }
- if (supports.Touch) {
- bodyCls.push(Ext.baseCSSPrefix + 'touch');
- }
- if (Ext.os.deviceType) {
- bodyCls.push(Ext.baseCSSPrefix + Ext.os.deviceType.toLowerCase());
- }
- if (Ext.os.is.BlackBerry) {
- bodyCls.push(Ext.baseCSSPrefix + 'bb');
- if (Ext.browser.userAgent.match(/Kbd/gi)) {
-
- bodyCls.push(Ext.baseCSSPrefix + 'bb-keyboard');
- }
- }
- if (Ext.os.is.iOS && Ext.isSafari) {
- bodyCls.push(Ext.baseCSSPrefix + 'mobile-safari');
- }
- if (Ext.os.is.iOS && Ext.browser.is.WebView && !Ext.browser.is.Standalone) {
-
- bodyCls.push(Ext.baseCSSPrefix + 'ios-native');
- }
- if (Ext.supports.FlexBoxBasisBug) {
- bodyCls.push(Ext.baseCSSPrefix + 'has-flexbasis-bug');
- }
- Ext.getBody().addCls(bodyCls);
- theme = Ext.theme;
- if (theme && theme.getDocCls) {
-
- Ext.fly(document.documentElement).addCls(theme.getDocCls());
- }
- }, null, {
- priority: 1500
- });
- });
- Ext.define('Ext.GlobalEvents', {
- extend: Ext.mixin.Observable,
- alternateClassName: 'Ext.globalEvents',
- observableType: 'global',
- singleton: true,
-
- resizeBuffer: 100,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- idleEventMask: {
- mousemove: 1,
- touchmove: 1,
- pointermove: 1,
- MSPointerMove: 1,
- unload: 1
- },
-
- windowListeners: {
- resize: {
- fn: 'fireResize'
- }
- },
- constructor: function() {
- var me = this;
- me.callParent();
- Ext.onInternalReady(function() {
-
-
- me.attachListeners();
- });
- },
- setPressedComponent: function(component, e) {
- var me = this,
- pressedComponent = me.pressedComponent;
- if (pressedComponent && pressedComponent.onRelease) {
- pressedComponent.onRelease(e);
- }
- me.pressedComponent = component;
- if (component) {
- me.pressedScrollStart = Ext.on({
- scrollstart: function() {
- me.setPressedComponent(null, e);
- },
- destroyable: true
- });
- } else {
- me.pressedScrollStart = Ext.destroy(me.pressedScrollStart);
- }
- },
- attachListeners: function() {
- var me = this,
- win = Ext.getWin(),
- winListeners = me.windowListeners;
- me.onlineState = Ext.isOnline();
-
- me.curHeight = Ext.Element.getViewportHeight();
- me.curWidth = Ext.Element.getViewportWidth();
- win.on({
- scope: me,
- online: 'handleOnlineChange',
- offline: 'handleOnlineChange'
- });
-
-
-
-
- me.fireResize.$skipTimerCheck = true;
-
-
- if (winListeners) {
- winListeners.scope = me;
-
- if (Ext.isModern) {
- winListeners.resize.onFrame = true;
- } else {
- winListeners.resize.buffer = me.resizeBuffer;
- }
- win.on(winListeners);
- }
- Ext.getDoc().on({
- touchstart: 'fireMouseDown',
- mousedown: 'fireMouseDown',
- mouseup: 'fireMouseUp',
- touchend: 'fireMouseUp',
- drop: 'fireMouseUp',
- dragend: 'fireMouseUp',
- scope: me
- });
- },
- fireMouseDown: function(e) {
- this.fireEvent('mousedown', e);
-
-
-
- Ext.ComponentManager.handleDocumentMouseDown(e);
- },
- fireMouseUp: function(e) {
- this.fireEvent('mouseup', e);
- this.setPressedComponent(null, e);
- },
- fireResize: function() {
- var me = this,
- Element = Ext.Element,
- w = Element.getViewportWidth(),
- h = Element.getViewportHeight();
-
- if (me.curHeight !== h || me.curWidth !== w) {
- me.curHeight = h;
- me.curWidth = w;
- if (me.hasListeners.resize) {
- me.fireEvent('resize', w, h);
- }
- }
- },
- handleOnlineChange: function() {
- var online = Ext.isOnline();
- if (online !== this.onlineState) {
- this.onlineState = online;
- this.fireEvent('onlinechange', online);
- }
- }
- }, function(GlobalEvents) {
-
- Ext.on = function() {
- return GlobalEvents.addListener.apply(GlobalEvents, arguments);
- };
-
- Ext.un = function() {
- return GlobalEvents.removeListener.apply(GlobalEvents, arguments);
- };
-
- Ext.fireEvent = function() {
- return GlobalEvents.fireEvent.apply(GlobalEvents, arguments);
- };
-
- Ext.fireIdle = function() {
- if (GlobalEvents.hasListeners.idle && !Ext._suppressIdle) {
- GlobalEvents.fireEventArgs('idle');
- }
- Ext._suppressIdle = false;
- };
- Ext._suppressIdle = false;
- });
- Ext.define('Ext.Glyph', {
-
- isGlyph: true,
-
-
-
-
- constructor: function(glyph) {
- glyph && this.setGlyph(glyph);
- },
-
- setGlyph: function(glyph) {
- var glyphParts;
- this.glyphConfig = glyph;
- if (typeof glyph === 'string') {
- glyphParts = glyph.split('@');
-
-
-
-
- if (isNaN(glyph = isNaN(glyphParts[0]) ? parseInt('0' + glyphParts[0], 16) : parseInt(glyphParts[0], 10)) || !glyph) {
- glyph = glyphParts[0].charCodeAt(0);
- }
- this.fontFamily = glyphParts[1] || Ext._glyphFontFamily;
- } else {
- this.fontFamily = Ext._glyphFontFamily;
- }
- this.codepoint = glyph;
- this.character = Ext.String.fromCodePoint(this.codepoint);
- return this;
- },
- getStyle: function() {
- return {
- 'font-family': this.fontFamily
- };
- },
- isEqual: function(other) {
- return other && other.isGlyph && other.codepoint === this.codepoint && other.fontFamily === this.fontFamily;
- },
- statics: (function() {
- var instance;
- return {
-
- fly: function(glyph) {
- return glyph.isGlyph ? glyph : (instance || (instance = new Ext.Glyph())).setGlyph(glyph);
- }
- };
- })()
- });
- Ext.USE_NATIVE_JSON = true;
- Ext.JSON = (new (function() {
-
-
-
- var me = this,
- hasNative = window.JSON && JSON.toString() === '[object JSON]',
- useHasOwn = !!{}.hasOwnProperty,
- pad = function(n) {
- return n < 10 ? "0" + n : n;
- },
- doDecode = function(json) {
- return eval("(" + json + ')');
- },
-
- doEncode = function(o, newline) {
-
- if (o === null || o === undefined) {
- return "null";
- } else if (Ext.isDate(o)) {
- return me.encodeDate(o);
- } else if (Ext.isString(o)) {
- if (Ext.isMSDate(o)) {
- return me.encodeMSDate(o);
- } else {
- return me.encodeString(o);
- }
- } else if (typeof o === "number") {
-
- return isFinite(o) ? String(o) : "null";
- } else if (Ext.isBoolean(o)) {
- return String(o);
- }
-
-
- else if (typeof o.toJSON === 'function') {
- return doEncode(o.toJSON());
- } else if (Ext.isArray(o)) {
- return encodeArray(o, newline);
- } else if (Ext.isObject(o)) {
- return encodeObject(o, newline);
- } else if (typeof o === "function") {
- return "null";
- }
- return 'undefined';
- },
- m = {
- "\b": '\\b',
- "\t": '\\t',
- "\n": '\\n',
- "\f": '\\f',
- "\r": '\\r',
- '"': '\\"',
- "\\": '\\\\',
- '\v': '\\u000b'
- },
-
- charToReplace = /[\\\"\x00-\x1f\x7f-\uffff]/g,
- encodeString = function(s) {
- return '"' + s.replace(charToReplace, function(a) {
- var c = m[a];
- return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"';
- },
- encodeMSDate = function(o) {
- return '"' + o + '"';
- },
- encodeArrayPretty = function(o, newline) {
- var len = o.length,
- cnewline = newline + ' ',
- sep = ',' + cnewline,
- a = [
- "[",
- cnewline
- ],
-
- i;
- for (i = 0; i < len; i += 1) {
- a.push(me.encodeValue(o[i], cnewline), sep);
- }
-
- a[a.length - 1] = newline + ']';
- return a.join('');
- },
- encodeObjectPretty = function(o, newline) {
- var cnewline = newline + ' ',
- sep = ',' + cnewline,
- a = [
- "{",
- cnewline
- ],
-
- i, val;
- for (i in o) {
- val = o[i];
- if (!useHasOwn || o.hasOwnProperty(i)) {
-
- if (typeof val === 'function' || val === undefined || val.isInstance) {
-
- continue;
- }
- a.push(me.encodeValue(i) + ': ' + me.encodeValue(val, cnewline), sep);
- }
- }
-
- a[a.length - 1] = newline + '}';
- return a.join('');
- },
- encodeArray = function(o, newline) {
- if (newline) {
- return encodeArrayPretty(o, newline);
- }
- var a = [
- "[",
- ""
- ],
-
- len = o.length,
- i;
- for (i = 0; i < len; i += 1) {
- a.push(me.encodeValue(o[i]), ',');
- }
-
- a[a.length - 1] = ']';
- return a.join("");
- },
- encodeObject = function(o, newline) {
- if (newline) {
- return encodeObjectPretty(o, newline);
- }
- var a = [
- "{",
- ""
- ],
-
- i, val;
- for (i in o) {
- val = o[i];
- if (!useHasOwn || o.hasOwnProperty(i)) {
-
- if (typeof val === 'function' || val === undefined) {
-
- continue;
- }
- a.push(me.encodeValue(i), ":", me.encodeValue(val), ',');
- }
- }
-
- a[a.length - 1] = '}';
- return a.join("");
- };
-
- me.encodeString = encodeString;
-
- me.encodeValue = doEncode;
-
- me.encodeDate = function(o) {
- return '"' + o.getFullYear() + "-" + pad(o.getMonth() + 1) + "-" + pad(o.getDate()) + "T" + pad(o.getHours()) + ":" + pad(o.getMinutes()) + ":" + pad(o.getSeconds()) + '"';
- };
-
- me.encode = function(o) {
-
- if (hasNative && Ext.USE_NATIVE_JSON) {
- return JSON.stringify(o);
- }
- return me.encodeValue(o);
- };
-
- me.decode = function(json, safe) {
- try {
-
- if (hasNative && Ext.USE_NATIVE_JSON) {
- return JSON.parse(json);
- }
- return doDecode(json);
- } catch (e) {
- if (safe) {
- return null;
- }
- Ext.raise({
- sourceClass: "Ext.JSON",
- sourceMethod: "decode",
- msg: "You're trying to decode an invalid JSON String: " + json
- });
- }
- };
- me.encodeMSDate = encodeMSDate;
-
- if (!Ext.util) {
- Ext.util = {};
- }
- Ext.util.JSON = me;
-
- Ext.encode = me.encode;
-
- Ext.decode = me.decode;
- })());
- Ext.define('Ext.mixin.Inheritable', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'inheritable'
- },
-
- getInherited: function(inner) {
- var me = this,
- inheritedState = (inner && me.inheritedStateInner) || me.inheritedState,
- ownerCt = me.getRefOwner(),
- isContainer = me.isContainer,
- parent, inheritedStateInner, getInner, ownerLayout;
- if (!inheritedState || inheritedState.invalid) {
-
-
-
-
- parent = me.getRefOwner();
- ownerLayout = me.ownerLayout;
- if (ownerCt) {
-
-
-
-
-
- getInner = ownerLayout ? ownerLayout === ownerCt.layout : true;
- }
- me.inheritedState = inheritedState =
-
-
-
-
- Ext.Object.chain(parent ? parent.getInherited(getInner) : Ext.rootInheritedState);
- if (isContainer) {
- me.inheritedStateInner = inheritedStateInner = Ext.Object.chain(inheritedState);
- }
- me.initInheritedState(inheritedState, inheritedStateInner);
-
-
- inheritedState = (isContainer && inner) ? me.inheritedStateInner : me.inheritedState;
- }
- return inheritedState;
- },
-
- getInheritedConfig: function(property, skipThis) {
- var state = this.inheritedState,
- old, ret;
-
- if (!state || state.invalid) {
- state = this.getInherited();
- }
- ret = state[property];
- if (skipThis && state.hasOwnProperty(property)) {
- old = ret;
- delete state[property];
- ret = state[property];
- state[property] = old;
- }
- return ret;
- },
-
- resolveListenerScope: function(defaultScope, skipThis) {
- var me = this,
- hasSkipThis = (typeof skipThis === 'boolean'),
- namedScope = Ext._namedScopes[defaultScope],
- ret;
- if (!namedScope) {
-
-
-
-
- ret = me.getInheritedConfig('defaultListenerScope', hasSkipThis ? skipThis : true) || defaultScope || me;
- } else if (namedScope.isController) {
-
-
-
-
- ret = me.getInheritedConfig('controller', hasSkipThis ? skipThis : !namedScope.isSelf);
- } else if (namedScope.isOwner) {
- ret = me.getRefOwner();
- } else if (namedScope.isSelf) {
-
-
- ret = me.getInheritedConfig('defaultListenerScope', hasSkipThis && skipThis) || me;
- } else if (namedScope.isThis) {
-
-
- ret = me;
- }
- return ret || null;
- },
-
- resolveSatelliteListenerScope: function(satellite, defaultScope) {
- var me = this,
- namedScope = Ext._namedScopes[defaultScope],
- ret;
-
-
-
-
-
-
-
- if (!namedScope) {
- ret = me.getInheritedConfig('defaultListenerScope') || defaultScope || me;
- } else if (namedScope.isController) {
- ret = me.getInheritedConfig('controller');
- } else if (namedScope.isSelf) {
- ret = me.getInheritedConfig('defaultListenerScope') || satellite;
- } else if (namedScope.isThis) {
- ret = satellite;
- }
- return ret || null;
- },
-
- lookupNameHolder: function(skipThis) {
- return this.getInheritedConfig('nameHolder', skipThis !== false) || null;
- },
-
- lookupReferenceHolder: function(skipThis) {
- return this.getInheritedConfig('referenceHolder', skipThis !== false) || null;
- },
-
- getRefOwner: function() {
- var me = this;
-
-
-
-
-
- return me.ownerCmp || me.ownerCt || me.parent || me.$initParent || me.floatParent;
- },
-
- bubble: function(fn, scope, args) {
- for (var target = this; target; target = target.getRefOwner()) {
- if (fn.apply(scope || target, args || [
- target
- ]) === false) {
- break;
- }
- }
- },
-
- isDescendantOf: function(ancestor) {
- return ancestor ? ancestor.isAncestor(this) : false;
- },
-
- isAncestor: function(possibleDescendant) {
- while (possibleDescendant) {
- if (possibleDescendant.getRefOwner() === this) {
- return true;
- }
- possibleDescendant = possibleDescendant.getRefOwner();
- }
- return false;
- },
-
-
- invalidateInheritedState: function() {
- var inheritedState = this.inheritedState;
- if (inheritedState) {
-
-
-
- inheritedState.invalid = true;
-
-
-
-
-
- delete this.inheritedState;
- }
- },
- privates: {
- _fixName: function() {
- var me = this,
- owner;
- if (me.name) {
- owner = me.lookupNameHolder();
- if (owner && !owner.destroyed) {
- owner.attachNameRef(me);
- }
- }
- },
-
- _fixReference: function() {
- var me = this,
- refHolder;
- if (me.reference) {
- refHolder = me.lookupReferenceHolder();
- if (refHolder) {
- refHolder.attachReference(me);
- }
- }
- },
-
- onInheritedAdd: function(parent, instanced) {
- var me = this;
-
-
-
- if (me.inheritedState && instanced) {
- me.invalidateInheritedState();
- }
- if (me.name || me.reference) {
- Ext.ComponentManager.markReferencesDirty();
- }
- },
-
- onInheritedRemove: function(destroying) {
- var me = this;
- if (me.name || me.reference) {
- Ext.ComponentManager.markReferencesDirty();
- }
- if (me.inheritedState && !destroying) {
- me.invalidateInheritedState();
- }
- }
- }
- }, function() {
-
- Ext.rootInheritedState = {};
- });
- Ext.define('Ext.mixin.Bindable', {
- mixinId: 'bindable',
- config: {
-
- bind: {
- $value: null,
- lazy: true
- },
-
-
- controller: null,
-
-
- defaultListenerScope: false,
-
- publishes: {
- $value: null,
- lazy: true,
- merge: function(newValue, oldValue) {
- return this.mergeSets(newValue, oldValue);
- }
- },
-
-
- session: {
- $value: null,
- lazy: true
- },
-
- twoWayBindable: {
- $value: null,
- lazy: true,
- merge: function(newValue, oldValue) {
- return this.mergeSets(newValue, oldValue);
- }
- },
-
-
- viewModel: {
- $value: null,
- lazy: true
- }
- },
-
- defaultBindProperty: null,
-
- nameable: false,
-
- shareableName: false,
-
- reference: null,
-
- validRefRe: /^[a-z_][a-z0-9_]*$/i,
- getReference: function() {
-
- return this.reference;
- },
-
- initInheritedState: function(inheritedState) {
- var me = this,
- reference = me.reference,
- controller = me.getController(),
-
-
- viewModel = me.getConfig('viewModel', true),
- session = me.getConfig('session', true),
- defaultListenerScope = me.getDefaultListenerScope();
- if (controller) {
- inheritedState.controller = controller;
- }
- if (defaultListenerScope) {
- inheritedState.defaultListenerScope = me;
- } else if (controller) {
- inheritedState.defaultListenerScope = controller;
- }
- if (viewModel) {
-
-
-
-
- if (!viewModel.isViewModel) {
- viewModel = me;
- }
- inheritedState.viewModel = viewModel;
- }
-
- if (session) {
- if (!session.isSession) {
- session = me;
- }
- inheritedState.session = session;
- }
- if (reference) {
- me.referenceKey = (inheritedState.referencePath || '') + reference;
- me.viewModelKey = (inheritedState.viewModelPath || '') + reference;
- }
- },
-
- isBound: function(name) {
- var bind = this.getBind();
- return !!(bind && (bind[name || this.defaultBindProperty]));
- },
-
- lookupController: function(skipThis) {
- return this.getInheritedConfig('controller', skipThis) || null;
- },
-
- lookupSession: function(skipThis) {
-
- var ret = skipThis ? null : this.getSession();
-
- if (!ret) {
- ret = this.getInheritedConfig('session', skipThis);
- if (ret && !ret.isSession) {
- ret = ret.getInherited().session = ret.getSession();
- }
- }
- return ret || null;
- },
-
- lookupViewModel: function(skipThis) {
- var ret = skipThis ? null : this.getViewModel();
-
- if (!ret) {
- ret = this.getInheritedConfig('viewModel', skipThis);
-
-
-
- if (ret && !ret.isViewModel) {
- ret = ret.getInherited().viewModel = ret.getViewModel();
- }
- }
- return ret || null;
- },
-
- publishState: function(property, value) {
- var me = this,
- state = me.publishedState,
- binds = me.getBind(),
- binding = binds && property && binds[property],
- count = 0,
- name, publishes, vm, path;
-
- if (!(arguments.length === 0 || arguments.length === 2)) {
- Ext.raise('publishState must either be called with no args, or with both name AND value passed');
- }
-
- if (binding && !binding.syncing && !binding.isReadOnly()) {
-
-
-
-
-
-
- if (binding.calls || !(value == null || value === me.getInitialConfig()[property])) {
- binding.setValue(value);
- }
- }
- if (!(publishes = me.getPublishes())) {
- return;
- }
- if (!(vm = me.lookupViewModel())) {
- return;
- }
-
-
- if (!(path = me.viewModelKey)) {
- return;
- }
- state = state || (me.publishedState = {});
- if (property) {
- if (!publishes[property]) {
- return;
- }
-
-
- if (!(value && value.constructor === Object) && !(value instanceof Array)) {
- if (state[property] === value) {
- return;
- }
- }
- path += '.';
- path += property;
- } else {
- for (name in publishes) {
- ++count;
- state[name] = me.getConfig(name);
- }
- if (!count) {
-
- return;
- }
- value = state;
- }
- vm.set(path, value);
- },
-
- privates: {
-
- addBindableUpdater: function(property) {
- var me = this,
- configs = me.self.$config.configs,
- cfg = configs[property],
- updateName;
-
-
- if (cfg && !me.hasOwnProperty(updateName = cfg.names.update)) {
- me[updateName] = cfg.bindableUpdater || (cfg.root.bindableUpdater = me.makeBindableUpdater(cfg));
- }
- },
-
- applyBind: function(binds, currentBindings) {
- if (!binds) {
- return binds;
- }
- var me = this,
- viewModel = me.lookupViewModel(),
- twoWayable = me.getTwoWayBindable(),
- getBindTemplateScope = me._getBindTemplateScope,
- b, property, descriptor, destroy;
- me.$hasBinds = true;
- if (!currentBindings || typeof currentBindings === 'string') {
- currentBindings = {};
- }
-
- if (!viewModel) {
- Ext.raise('Cannot use bind config without a viewModel');
- }
-
- if (Ext.isString(binds)) {
-
- if (!me.defaultBindProperty) {
- Ext.raise(me.$className + ' has no defaultBindProperty - ' + 'Please specify a bind object');
- }
-
- b = binds;
- binds = {};
- binds[me.defaultBindProperty] = b;
- }
- for (property in binds) {
- descriptor = binds[property];
- b = currentBindings[property];
- if (b && b.isBinding) {
- b.destroy();
- b = null;
- destroy = true;
- }
- if (descriptor) {
- b = viewModel.bind(descriptor, me.onBindNotify, me);
- b._config = Ext.Config.get(property);
- b.getTemplateScope = getBindTemplateScope;
-
- if (!me[b._config.names.set]) {
- Ext.raise('Cannot bind ' + property + ' on ' + me.$className + ' - missing a ' + b._config.names.set + ' method.');
- }
- }
-
- if (destroy) {
- delete currentBindings[property];
- } else {
- currentBindings[property] = b;
- }
- if (twoWayable && twoWayable[property]) {
- if (destroy) {
- me.clearBindableUpdater(property);
- } else if (!b.isReadOnly()) {
- me.addBindableUpdater(property);
- }
- }
- }
- return currentBindings;
- },
- applyController: function(controller) {
- if (controller) {
- controller = Ext.Factory.controller(controller);
- controller.setView(this);
- }
-
-
- this.controller = controller;
- return controller;
- },
- updatePublishes: function(all) {
- var me = this;
- if (me.lookupViewModel()) {
- for (var property in all) {
- me.addBindableUpdater(property);
- }
- }
- return all;
- },
-
- applySession: function(session) {
- if (!session) {
- return null;
- }
- if (!session.isSession) {
- var parentSession = this.lookupSession(true),
-
- config = (session === true) ? {} : session;
- if (parentSession) {
- session = parentSession.spawn(config);
- } else {
-
-
- session = new Ext.data['Session'](config);
- }
- }
- return session;
- },
-
- applyViewModel: function(viewModel) {
- var me = this,
- config, session;
- if (!viewModel) {
- return null;
- }
- if (!viewModel.isViewModel) {
- config = {
- parent: me.lookupViewModel(true),
-
-
-
- view: me
- };
- config.session = me.getSession();
- if (!session && !config.parent) {
- config.session = me.lookupSession();
- }
- if (viewModel) {
- if (viewModel.constructor === Object) {
- Ext.apply(config, viewModel);
- } else if (typeof viewModel === 'string') {
- config.type = viewModel;
- }
- }
- viewModel = Ext.Factory.viewModel(config);
- }
- return viewModel;
- },
- _getBindTemplateScope: function() {
-
-
- return this.scope.resolveListenerScope();
- },
- clearBindableUpdater: function(property) {
- var me = this,
- configs = me.self.$config.configs,
- cfg = configs[property],
- updateName;
- if (cfg && me.hasOwnProperty(updateName = cfg.names.update)) {
- if (me[updateName].$bindableUpdater) {
- delete me[updateName];
- }
- }
- },
- destroyBindable: function() {
- var me = this,
- viewModel = me.getConfig('viewModel', true),
- session = me.getConfig('session', true),
- controller = me.getController();
- if (viewModel && viewModel.isViewModel) {
- viewModel.destroy();
- me.setViewModel(null);
- }
- if (session && session.isSession) {
- if (session.getAutoDestroy()) {
- session.destroy();
- }
- me.setSession(null);
- }
- if (controller) {
- me.setController(null);
- controller.destroy();
- }
- },
-
- initBindable: function() {
- var me = this,
- controller = me.controller;
- me.initBindable = Ext.emptyFn;
- me.getBind();
- me.getPublishes();
-
-
-
-
-
- if (!me.viewModel) {
-
- me.getViewModel();
- }
- if (controller) {
- controller.initBindings();
- }
- if (me.reference) {
-
-
- me.publishState();
- }
- },
-
- isSyncing: function(name) {
- var bindings = this.getBind(),
- ret = false,
- binding;
- if (bindings) {
- binding = bindings[name];
- if (binding) {
- ret = binding.syncing > 0;
- }
- }
- return ret;
- },
-
- makeBindableUpdater: function(cfg) {
- var updateName = cfg.names.update,
- fn = function(newValue, oldValue) {
- var me = this,
- updater = me.self.prototype[updateName];
- if (updater) {
- updater.call(me, newValue, oldValue);
- }
-
- me.publishState(cfg.name, me[cfg.getInternalName(me)]);
- };
- fn.$bindableUpdater = true;
- return fn;
- },
- notifyIf: function(skipThis) {
- var vm = this.lookupViewModel(skipThis);
- if (vm) {
- vm.notify();
- }
- },
- onBindNotify: function(value, oldValue, binding) {
- binding.syncing = (binding.syncing + 1) || 1;
- this[binding._config.names.set](value);
- --binding.syncing;
- },
- removeBindings: function() {
- var me = this,
- bindings, key, binding;
- if (me.$hasBinds) {
- bindings = me.getBind();
- if (bindings && typeof bindings !== 'string') {
- for (key in bindings) {
- binding = bindings[key];
- binding.destroy();
- binding._config = binding.getTemplateScope = null;
- }
- }
- }
- me.setBind(null);
- },
-
- updateSession: function(session) {
- var state = this.getInherited();
- if (session) {
- state.session = session;
- } else {
- delete state.session;
- }
- },
-
- updateViewModel: function(viewModel, oldViewModel) {
- var me = this,
- state = me.getInherited(),
- controller = me.getController();
- if (viewModel) {
- me.hasVM = true;
- state.viewModel = viewModel;
- viewModel.setView(me);
- if (controller) {
- controller.initViewModel(viewModel);
- }
- } else {
- delete state.viewModel;
- }
-
-
- me.viewModel = viewModel;
- }
- }
- });
- Ext.define('Ext.mixin.ComponentDelegation', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'componentDelegation'
- },
- privates: {
-
- addDelegatedListener: function(eventName, fn, scope, options, order, caller, manager) {
- var me = this,
- delegatedEvents, event, priority;
- eventName = Ext.canonicalEventName(eventName);
-
-
-
-
- order = order || options.order;
- if (order) {
- priority = (options && options.priority);
- if (!priority) {
-
-
- options = options ? Ext.Object.chain(options) : {};
- options.priority = me.$orderToPriority[order];
- }
- }
-
- if (options.target) {
- Ext.raise("Cannot add '" + eventName + "' listener to component: '" + me.id + "' - 'delegate' and 'target' event options are incompatible.");
- }
-
-
-
-
- delegatedEvents = me.$delegatedEvents || (me.$delegatedEvents = {});
- event = delegatedEvents[eventName] || (delegatedEvents[eventName] = new Ext.util.Event(me, eventName));
- if (event.addListener(fn, scope, options, caller, manager)) {
- me.$hasDelegatedListeners._incr_(eventName);
- }
- },
-
- clearDelegatedListeners: function() {
- var me = this,
- delegatedEvents = me.$delegatedEvents,
- eventName, event, listenerCount;
- if (delegatedEvents) {
- for (eventName in delegatedEvents) {
- event = delegatedEvents[eventName];
- listenerCount = event.listeners.length;
- event.clearListeners();
- me.$hasDelegatedListeners._decr_(eventName, listenerCount);
- delete delegatedEvents[eventName];
- }
- }
- },
-
- doFireDelegatedEvent: function(eventName, args) {
- var me = this,
- ret = true,
- owner, delegatedEvents, event;
-
-
-
-
-
-
- if (me.$hasDelegatedListeners[eventName]) {
- owner = me.getRefOwner();
- while (owner) {
- delegatedEvents = owner.$delegatedEvents;
- if (delegatedEvents) {
- event = delegatedEvents[eventName];
- if (event) {
- ret = event.fireDelegated(me, args);
- if (ret === false) {
- break;
- }
- }
- }
- owner = owner.getRefOwner();
- }
- }
- return ret;
- },
-
- removeDelegatedListener: function(eventName, fn, scope) {
- var me = this,
- delegatedEvents = me.$delegatedEvents,
- event;
- if (delegatedEvents) {
- event = delegatedEvents[eventName];
- if (event && event.removeListener(fn, scope)) {
- me.$hasDelegatedListeners._decr_(eventName);
- if (event.listeners.length === 0) {
- delete delegatedEvents[eventName];
- }
- }
- }
- },
- destroyComponentDelegation: function() {
- if (this.clearPropertiesOnDestroy) {
- this.$delegatedEvents = null;
- }
- }
- },
- onClassMixedIn: function(T) {
-
-
-
-
-
-
-
-
- function HasListeners() {}
- T.prototype.HasListeners = T.HasListeners = HasListeners;
- HasListeners.prototype = T.hasListeners = new Ext.mixin.ComponentDelegation.HasDelegatedListeners();
- }
- }, function(ComponentDelegation) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function HasDelegatedListeners() {}
- ComponentDelegation.HasDelegatedListeners = HasDelegatedListeners;
- HasDelegatedListeners.prototype = ComponentDelegation.prototype.$hasDelegatedListeners = new Ext.mixin.Observable.HasListeners();
- });
- Ext.define('Ext.plugin.Abstract', {
- alternateClassName: 'Ext.AbstractPlugin',
-
- isPlugin: true,
-
- constructor: function(config) {
- if (config) {
- this.pluginConfig = config;
- this.initConfig(config);
- }
- },
-
- clonePlugin: function(overrideCfg) {
- return new this.self(Ext.apply({}, overrideCfg, this.pluginConfig));
- },
-
-
- getCmp: function() {
- return this.cmp;
- },
-
- setCmp: function(host) {
- this.cmp = host;
- },
-
-
-
- init: Ext.emptyFn,
-
- destroy: function() {
- this.cmp = this.pluginConfig = null;
- this.callParent();
- },
- onClassExtended: function(cls, data, hooks) {
- var alias = data.alias,
- prototype = cls.prototype;
-
- if (alias && !data.ptype) {
- if (Ext.isArray(alias)) {
- alias = alias[0];
- }
- prototype.ptype = alias.split('plugin.')[1];
- }
- },
- resolveListenerScope: function(defaultScope) {
- var me = this,
- cmp = me.getCmp(),
- scope;
- if (cmp) {
- scope = cmp.resolveSatelliteListenerScope(me, defaultScope);
- }
-
-
-
-
- return scope || me.mixins.observable.resolveListenerScope.call(me, defaultScope);
- },
- statics: {
- decode: function(plugins, typeProp, include) {
- if (plugins) {
- var type = Ext.typeOf(plugins),
-
- entry, key, obj, value;
- if (type === 'string') {
- obj = {};
-
-
- obj[typeProp] = plugins;
- plugins = [
- obj
- ];
- } else if (plugins.isInstance) {
- plugins = [
- plugins
- ];
- } else if (type === 'object') {
- if (plugins[typeProp]) {
- plugins = [
- plugins
- ];
- } else {
- obj = include ? Ext.merge(Ext.clone(include), plugins) : plugins;
- plugins = [];
- for (key in obj) {
- if (!(value = obj[key])) {
-
- continue;
- }
- entry = {
- id: key
- };
- entry[typeProp] = key;
- if (key === 'responsive') {
- entry.weight = -1000;
- }
- Ext.apply(entry, value);
- plugins.push(entry);
- }
- plugins.sort(Ext.weightSortFn);
- }
- }
-
- else if (type !== 'array') {
- Ext.raise('Invalid value for "plugins" config ("' + type + '"');
- } else
- {
- plugins = plugins.slice();
- }
- }
-
- return plugins;
- }
- }
- });
- Ext.define('Ext.mixin.Pluggable', function(Pluggable) {
- return {
- config: {
-
- plugins: null
- },
-
- addPlugin: function(plugin) {
- var me = this,
- plugins = me.getPlugins();
- if (plugins) {
- plugin = me.createPlugin(plugin);
- plugin.init(me);
- plugins.push(plugin);
- } else {
- me.setPlugins(plugin);
- plugin = me.getPlugins()[0];
- }
- return plugin;
- },
-
- destroyPlugin: function(plugin) {
- return this.removePlugin(plugin, true);
- },
-
- findPlugin: function(type) {
- var plugins = this.getPlugins(),
- n = plugins && plugins.length,
- i, plugin, ret;
- for (i = 0; i < n && !ret; i++) {
- plugin = plugins[i];
-
-
- if (plugin.type === type || plugin.ptype === type) {
- ret = plugin;
- }
- }
- return ret || null;
- },
-
- getPlugin: function(id) {
- var plugins = this.getPlugins(),
- n = plugins && plugins.length,
- i, plugin, ret;
- for (i = 0; i < n && !ret; i++) {
- plugin = plugins[i];
-
- if (plugin.id === id || plugin.pluginId === id) {
- ret = plugin;
- }
- }
- return ret || null;
- },
-
- removePlugin: function(plugin, destroy) {
- var plugins = this.getPlugins(),
- i = plugins && plugins.length || 0,
- p;
- while (i-- > 0) {
- p = plugins[i];
- if (p === plugin || p.id === plugin) {
- plugins.splice(i, 1);
- if (destroy) {
- if (p.destroy) {
- p.destroy();
- }
- } else if (p.detachCmp) {
- p.detachCmp();
- if (p.setCmp) {
- p.setCmp(null);
- }
- }
- break;
- }
- p = null;
- }
- return p;
- },
- privates: {
- statics: {
- idSeed: 0
- },
-
- activatePlugin: function(type) {
- var me = this,
- config = me.initialConfig,
- plugins = config && config.plugins,
- ret = null,
- i, include, p;
- if (plugins) {
- include = me.config.plugins;
- include = (include && typeof include === 'object') ? include : null;
- plugins = Ext.plugin.Abstract.decode(plugins, 'type', include);
- for (i = plugins.length; i-- > 0; ) {
- p = plugins[i];
- if (p === type || p.type === type) {
- me.initialConfig = config = Ext.apply({}, config);
- config.plugins = plugins;
-
-
-
- plugins[i] = ret = me.createPlugin(p);
- break;
- }
- }
- }
- return ret;
- },
-
- applyPlugins: function(plugins, oldPlugins) {
- var me = this,
- oldCount = oldPlugins && oldPlugins.length || 0,
- count, i, plugin;
-
-
- if (plugins) {
- plugins = Ext.plugin.Abstract.decode(plugins, 'type');
- }
-
-
-
- for (i = 0; i < oldCount; ++i) {
- oldPlugins[i].$dead = true;
- }
-
-
-
-
-
- count = plugins && plugins.length || 0;
- for (i = 0; i < count; ++i) {
- plugins[i] = me.createPlugin(plugins[i]);
- }
-
-
-
-
- for (i = 0; i < count; ++i) {
- plugin = plugins[i];
- if (plugin.$dead) {
-
- delete plugin.$dead;
- } else
- {
- plugin.init(me);
- }
- }
-
-
-
- for (i = 0; i < oldCount; ++i) {
- if ((plugin = oldPlugins[i]).$dead) {
- delete plugin.$dead;
- Ext.destroy(plugin);
- }
- }
- return plugins;
- },
-
- createPlugin: function(config) {
- if (typeof config === 'string') {
- config = {
- type: config
- };
- }
- var ret = config;
- if (!config.isInstance) {
-
- config.cmp = this;
- ret = Ext.factory(config, null, null, 'plugin');
-
- delete config.cmp;
- }
- if (!ret.id) {
- ret.id = ++Pluggable.idSeed;
- }
- if (ret.setCmp) {
- ret.setCmp(this);
- }
- return ret;
- }
- }
- };
- });
- Ext.define('Ext.mixin.Keyboard', function(Keyboard) {
- return {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'keyboard'
- },
- config: {
-
- keyMap: {
- $value: null,
- cached: true,
- merge: function(value, baseValue, cls, mixin) {
-
- if (value === null) {
- return value;
- }
-
-
-
-
-
- var ret = (baseValue && !cls.isInstance) ? Ext.Object.chain(baseValue) : {},
- key, ucKey, v, vs;
- for (key in value) {
- if (key !== 'scope') {
- ucKey = key.toUpperCase();
- if (!mixin || ret[ucKey] === undefined) {
-
- v = value[key];
- if (v) {
- if (typeof v === 'string' || typeof v === 'function') {
- v = {
- handler: v
- };
- } else {
- v = Ext.apply({
- handler: v.fn
- },
- v);
- }
- vs = v.scope || value.scope || 'self';
- v.scope = (vs === 'controller') ? 'self.controller' : vs;
- }
- ret[ucKey] = v;
- }
- }
- }
- return ret;
- }
- },
-
- keyMapEnabled: null
- },
-
- keyMapTarget: 'el',
- applyKeyMap: function(keyMap, existingKeyMap) {
- var me = this,
-
-
- own = me.hasOwnProperty('config');
- if (own && existingKeyMap && existingKeyMap.$owner !== me) {
-
-
- existingKeyMap = Ext.apply({}, existingKeyMap);
- }
- keyMap = keyMap ? Keyboard.combineKeyMaps(existingKeyMap, keyMap, own && me) : null;
- if (me._keyMapReady) {
- me.setKeyMapListener(keyMap && me.getKeyMapEnabled());
- }
- return keyMap;
- },
-
- initKeyMap: function() {
- var me = this,
- enabled = me.getKeyMapEnabled();
- me._keyMapReady = true;
- if (enabled === null) {
- me.setKeyMapEnabled(true);
- } else {
- me.setKeyMapListener(enabled && me.getKeyMap());
- }
- },
- disableKeyMapGroup: function(group) {
- this.setKeyMapGroupEnabled(group, false);
- },
- enableKeyMapGroup: function(group) {
- this.setKeyMapGroupEnabled(group, true);
- },
- setKeyMapGroupEnabled: function(group, state) {
- var me = this,
- disabledGroups = me.disabledKeyMapGroups || (me.disabledKeyMapGroups = {});
- disabledGroups[group] = !state;
- },
- updateKeyMapEnabled: function(enabled) {
- this.setKeyMapListener(enabled && this._keyMapReady && this.getKeyMap());
- },
- privates: {
-
- _keyMapListenCount: 0,
-
- _keyMapReady: false,
-
- comparePriorities: function(lhs, rhs) {
- return (rhs.priority || 0) - (lhs.priority || 0);
- },
- findKeyMapEntries: function(e) {
- var me = this,
- disabledGroups = me.disabledKeyMapGroups,
- keyMap = me.getKeyMap(),
- entries = keyMap && Keyboard.getKeyName(e),
- entry, len, i,
- result = [];
- entries = entries && keyMap[entries];
- if (entries) {
-
- if (!entries.sorted) {
- Ext.Array.sort(entries, me.comparePriorities);
- entries.sorted = true;
- }
- len = entries.length;
- for (i = 0; i < len; i++) {
- entry = entries[i];
-
-
- if (!disabledGroups || !disabledGroups[entry.group]) {
- if (Keyboard.matchEntry(entry, e)) {
- result.push(entry);
- }
- }
- }
- }
- return result;
- },
- onKeyMapEvent: function(e) {
- var me = this,
- entries = me.getKeyMapEnabled() ? me.findKeyMapEntries(e) : null,
- len = entries && entries.length,
- i, entry, result;
- for (i = 0; i < len && result !== false; i++) {
- entry = entries[i];
- result = Ext.callback(entry.handler, entry.scope, [
- e,
- this
- ], 0, this);
- }
- return result;
- },
- setKeyMapListener: function(enabled) {
- var me = this,
- listener = me._keyMapListener,
- eventSource;
- if (listener) {
-
-
- listener.destroy();
- listener = null;
- }
- if (enabled) {
-
- ++me._keyMapListenCount;
-
- if (enabled) {
- eventSource = me[me.keyMapTarget];
- if (typeof eventSource === 'function') {
- eventSource = eventSource.call(me);
- }
-
- listener = eventSource.on({
- destroyable: true,
- scope: me,
- keydown: 'onKeyMapEvent',
- keypress: 'onKeyMapEvent'
- });
- }
- }
- me._keyMapListener = listener || null;
- },
- statics: {
- _charCodeRe: /^#([\d]+)$/,
- _keySpecRe: /^(?:(?:(\*)[\+\-])|(?:([a-z\+\-]*)[\+\-]))?(?:([a-z0-9_]+|[\+\-]|(?:#?\d+))(?:\:([a-z]+))?)$/i,
- _delimiterRe: /\-|\+/,
- _keyMapEvents: {
- charCode: 'keypress',
- keyCode: 'keydown'
- },
- combineKeyMaps: function(existingKeyMap, keyMap, owner) {
- var defaultScope = keyMap.scope || 'controller',
- entry, key, mapping, existingMapping;
- for (key in keyMap) {
- if (key === 'scope') {
-
- continue;
- }
- if (!(mapping = keyMap[key])) {
-
- if (mapping === undefined) {
- Ext.raise('keyMap entry "' + key + '" is undefined');
- }
-
-
-
- if (!existingKeyMap) {
-
- continue;
- }
- } else {
- if (typeof mapping === 'string' || typeof mapping === 'function') {
-
-
- mapping = {
- handler: mapping,
- scope: defaultScope
- };
- } else if (mapping) {
- mapping = Ext.apply({
- handler: mapping.fn,
-
- scope: defaultScope
- },
-
- mapping);
- }
- existingKeyMap = existingKeyMap || {};
- }
-
- if (Keyboard.parseEntry(key, entry = mapping || {})) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- existingMapping = existingKeyMap[entry.name];
- if (existingMapping) {
- if (owner && existingMapping.$owner !== owner) {
- existingKeyMap[entry.name] = existingMapping = existingMapping.slice();
- existingMapping.$owner = owner;
- }
- existingMapping.push(mapping);
- existingMapping.sorted = false;
- } else {
- existingMapping = existingKeyMap[entry.name] = [
- mapping
- ];
- existingMapping.$owner = owner;
- existingMapping.sorted = true;
- }
- } else
- {
- Ext.raise('Invalid keyMap key specification "' + key + '"');
- }
- }
-
- if (existingKeyMap && owner) {
- existingKeyMap.$owner = owner;
- }
- return existingKeyMap || null;
- },
- getKeyName: function(event) {
- var keyCode;
- if (event.isEvent) {
- keyCode = event.keyCode || event.charCode;
- event = event.browserEvent;
-
-
- if (keyCode === 229 && 'code' in event) {
- if (Ext.String.startsWith(event.code, 'Key')) {
- return event.key.substr(3);
- }
- if (Ext.String.startsWith(event.code, 'Digit')) {
- return event.key.substr(5);
- }
- }
- } else {
- keyCode = event;
- }
-
- return Ext.event.Event.keyCodes[keyCode] || String.fromCharCode(keyCode);
- },
- matchEntry: function(entry, e) {
- var ev = e.browserEvent,
- code;
- if (e.type !== entry.event) {
- return false;
- }
- if (!(code = entry.charCode)) {
- if (entry.keyCode !== e.keyCode || (!entry.ignoreModifiers && !entry.shiftKey !== !ev.shiftKey)) {
-
- return false;
- }
- } else if (e.getCharCode() !== code) {
- return false;
- }
-
-
-
- return entry.ignoreModifiers || (!entry.ctrlKey === !ev.ctrlKey && !entry.altKey === !ev.altKey && !entry.metaKey === !ev.metaKey && !entry.shiftKey === !ev.shiftKey);
- },
- parseEntry: function(key, entry) {
- key = key.toUpperCase();
- var me = this,
- Event = Ext.event.Event,
- keyFlags = Event.keyFlags,
- parts = me._keySpecRe.exec(key),
- type = 'keyCode',
- name, code, i, match, n;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (parts) {
- name = parts[3];
- if (parts[4]) {
- entry.group = parts[4];
- }
-
-
- if (!(entry.ignoreModifiers = !!parts[1]) && parts[2]) {
-
- parts = parts[2].split(me._delimiterRe);
- n = parts.length;
- for (i = 0; i < n; i++) {
-
- if (!keyFlags[parts[i]]) {
- return false;
- }
-
- entry[keyFlags[parts[i]]] = true;
- }
- }
-
-
- entry.name = name;
-
- if (isNaN(code = Event[name])) {
-
- if (!(match = me._charCodeRe.exec(name))) {
- if (name.length === 1) {
- code = name.charCodeAt(0);
- }
- } else {
- code = +match[1];
- }
-
- if (code) {
- type = 'charCode';
- } else {
-
- code = +name;
- }
- entry.name = Keyboard.getKeyName(code);
- }
- entry.event = entry.event || me._keyMapEvents[type];
- return !isNaN(code) && (entry[type] = code);
- }
- }
- }
- }
- };
- });
- Ext.define('Ext.mixin.Focusable', {
- mixinId: 'focusable',
- $isFocusableEntity: true,
-
-
- focusable: false,
-
- hasFocus: false,
-
- containsFocus: false,
-
- focusCls: Ext.baseCSSPrefix + 'focused',
-
- focusEl: 'el',
-
-
-
-
-
-
- getFocusEl: function()
- {
- var focusEl = this.focusEl;
- return focusEl && focusEl.dom ? focusEl : null;
- },
-
- getFocusClsEl: function() {
- return this.getFocusEl();
- },
-
- initFocusable: Ext.emptyFn,
-
- initFocusableEvents: function(force) {
-
-
- this.initFocusableElement(force);
- },
- enableFocusable: Ext.emptyFn,
- disableFocusable: function() {
- var me = this;
-
-
-
- if (me.hasFocus) {
- me.revertFocus();
- }
- me.removeFocusCls();
- },
- destroyFocusable: function() {
- var me = this;
- Ext.destroy(me.focusListeners);
- me.focusListeners = me.focusEnterEvent = me.focusTask = null;
- me.focusEl = me.ariaEl = null;
- },
-
- isFocusable: function(deep) {
- var me = this,
- focusEl;
- if (!me.focusable && (!me.isContainer || !deep)) {
- return false;
- }
- focusEl = me.getFocusEl();
- if (focusEl && me.canFocus()) {
-
-
-
- return focusEl && !focusEl.destroyed && focusEl.isFocusable(deep);
- }
- return false;
- },
-
- isDestructing: function() {
- for (var c = this; c; c = c.getRefOwner()) {
- if (c.destroying || c.destroyed) {
- return true;
- }
- }
- return false;
- },
- canFocus: function(skipVisibility, includeFocusTarget) {
- var me = this,
- ownerFC = me.ownerFocusableContainer,
- focusableIfDisabled = ownerFC && ownerFC.allowFocusingDisabledChildren,
- canFocus;
-
-
-
-
- canFocus = !me.destroyed && me.rendered && !me.isDestructing() && (me.isContainer || me.focusable) && (!me.isDisabled() || focusableIfDisabled) && (skipVisibility || me.isVisible(true));
- return canFocus || (includeFocusTarget && !!me.findFocusTarget());
- },
-
- focus: function(selectText) {
- var me = this,
- focusTarget, focusElDom;
- if ((!me.focusable && !me.isContainer) || me.destroyed || me.destroying) {
- return false;
- }
-
-
- if (me.canFocus() && (focusTarget = me.getFocusEl())) {
-
-
- if (focusTarget.$isFocusableEntity) {
- return focusTarget.focus.apply(focusTarget, arguments);
- }
- focusElDom = focusTarget.dom;
-
- if (focusElDom) {
-
- focusTarget.focus();
- if (selectText && (me.selectText || focusElDom.select)) {
- if (me.selectText) {
- if (Ext.isArray(selectText)) {
- me.selectText.apply(me, selectText);
- } else {
- me.selectText();
- }
- } else {
- focusElDom.select();
- }
- }
- }
-
- else if (focusTarget.focus) {
- focusTarget.focus();
- } else {
- return false;
- }
- } else {
-
-
-
-
- focusTarget = me.findFocusTarget();
- if (focusTarget && focusTarget != me) {
- return focusTarget.focus.apply(focusTarget, arguments);
- } else {
- return false;
- }
- }
- return true;
- },
-
- onBlur: function(e) {
- var me = this,
- container = me.ownerFocusableContainer;
- me.hasFocus = false;
- if (me.beforeBlur && !me.beforeBlur.$emptyFn) {
- me.beforeBlur(e);
- }
- if (container) {
- container.beforeFocusableChildBlur(me, e);
- }
- me.removeFocusCls(e);
- if (me.hasListeners.blur) {
- me.fireEvent('blur', me, e);
- }
- if (me.postBlur && !me.postBlur.$emptyFn) {
- me.postBlur(e);
- }
- if (container) {
- container.afterFocusableChildBlur(me, e);
- }
- },
-
- onFocus: function(e) {
- var me = this,
- container = me.ownerFocusableContainer;
- if (me.canFocus()) {
- if (me.beforeFocus && !me.beforeFocus.$emptyFn) {
- me.beforeFocus(e);
- }
- if (container) {
- container.beforeFocusableChildFocus(me, e);
- }
- me.addFocusCls(e);
- if (!me.hasFocus) {
- me.hasFocus = true;
- me.fireEvent('focus', me, e);
- }
- if (me.postFocus && !me.postFocus.$emptyFn) {
- me.postFocus(e);
- }
- if (container) {
- container.afterFocusableChildFocus(me, e);
- }
- }
- },
-
- getTabIndex: function() {
- var me = this,
- el, index;
- if (!me.focusable) {
- return;
- }
- el = me.getFocusEl();
- if (el) {
-
- if (el.$isFocusableEntity) {
- index = el.getTabIndex();
- } else if (el.isElement && el.dom) {
-
-
-
- index = el.dom.getAttribute('tabIndex');
-
-
-
-
- if (index !== null) {
- index -= 0;
- }
- } else
-
-
-
- {
- return;
- }
- }
- if (typeof index !== 'number') {
- index = me.tabIndex;
- }
- return index;
- },
-
- setTabIndex: function(newTabIndex, focusEl) {
- var me = this,
- ownerFC = me.ownerFocusableContainer,
- focusableIfDisabled = ownerFC && ownerFC.allowFocusingDisabledChildren,
- el;
-
- if (!me.focusable && !me.forceTabIndex) {
- return;
- }
- me.tabIndex = newTabIndex;
-
-
- if (me.destroying || me.destroyed || (me.isDisabled() && !focusableIfDisabled)) {
- return;
- }
- el = focusEl || me.getFocusEl();
- if (el) {
-
- if (el.$isFocusableEntity) {
- el.setTabIndex(newTabIndex);
- }
-
-
-
- else if (el.isElement && el.dom) {
-
- el.setTabIndex(newTabIndex);
- }
- }
- },
-
- onFocusEnter: function(e) {
- var me = this;
-
-
-
-
- if (me.destroying || me.destroyed) {
- return;
- }
-
-
- me.focusEnterEvent = e;
- me.containsFocus = true;
- if (me.hasListeners.focusenter) {
- me.fireEvent('focusenter', me, e);
- }
- },
-
- onFocusLeave: function(e) {
- var me = this;
-
- if (me.destroying || me.destroyed) {
- return;
- }
- me.focusEnterEvent = null;
- me.containsFocus = false;
- if (me.hasListeners.focusleave) {
- me.fireEvent('focusleave', me, e);
- }
- },
-
- onFocusMove: Ext.emptyFn,
- privates: {
-
-
-
-
-
-
-
-
-
- forceTabIndex: false,
-
- revertFocus: function() {
- var me = this,
- focusEvent = me.focusEnterEvent,
- activeElement = Ext.Element.getActiveElement(),
- focusTarget, fromComponent, reverted;
-
-
-
-
- if (focusEvent && !me.preventRefocus && me.el.contains(activeElement)) {
- fromComponent = focusEvent.fromComponent;
-
- if (fromComponent && (fromComponent.destroyed || fromComponent.isDestructing())) {
- focusTarget = document.body;
- } else
-
-
-
-
- {
- focusTarget = focusEvent.relatedTarget;
- }
-
- if (focusTarget === document.body) {
- fromComponent = me.findFocusTarget();
- if (fromComponent) {
- focusTarget = fromComponent.getFocusEl();
- }
- }
- if (focusTarget && focusTarget.$isFocusableEntity) {
- if (!focusTarget.destroyed && focusTarget.isFocusable()) {
- focusTarget.focus();
- }
- }
-
- else if (Ext.getDoc().contains(focusTarget) && Ext.fly(focusTarget).isFocusable()) {
- fromComponent = Ext.Component.from(focusTarget);
-
- if (fromComponent) {
- fromComponent.revertFocusTo(focusTarget);
- } else {
- focusTarget.focus();
- }
- }
-
-
- else if (focusEvent.fromComponent && focusEvent.fromComponent.focus) {
- reverted = focusEvent.fromComponent.focus();
-
-
-
-
- if (!reverted) {
- activeElement.blur();
- }
- }
- }
- },
-
- revertFocusTo: function(target) {
- target.focus();
- },
-
- findFocusTarget: function() {
- var me = this,
- parentAxis, candidate, len, i, focusTargets, focusIndex;
- if (me.preventRefocus) {
- return null;
- }
-
-
-
-
- for (parentAxis = [] , candidate = me.getRefOwner(); candidate; candidate = candidate.getRefOwner()) {
- if (!candidate.isDisabled()) {
- parentAxis.unshift(candidate);
- }
- }
-
-
-
- for (i = 0 , len = parentAxis.length; i < len; i++) {
- candidate = parentAxis[i];
- if (candidate.destroying || !candidate.isVisible()) {
- parentAxis.length = i;
- break;
- }
- }
-
- for (i = parentAxis.length - 1; i >= 0; i--) {
- candidate = parentAxis[i];
-
-
-
-
-
-
- focusTargets = Ext.ComponentQuery.query(':canfocus()', candidate);
- if (focusTargets.length) {
- focusIndex = Ext.Array.indexOf(focusTargets, Ext.ComponentManager.getActiveComponent());
-
- return focusTargets[focusIndex + 1] || focusTargets[focusIndex - 1] || focusTargets[0];
- }
-
-
- if (candidate.isFocusable && candidate.isFocusable()) {
- return candidate;
- }
- }
- },
-
- initFocusableElement: function(force) {
- var me = this,
- tabIndex = me.getTabIndex(),
- focusEl = me.getFocusEl();
- if (focusEl && !focusEl.$isFocusableEntity) {
-
-
-
-
-
- if (tabIndex != null && (force || me.canFocus(true))) {
- me.setTabIndex(tabIndex, focusEl);
- }
-
-
-
-
- if (!focusEl.dom.hasAttribute('data-componentid')) {
- focusEl.dom.setAttribute('data-componentid', me.id);
- }
- }
- },
- addFocusCls: function(e) {
- var focusCls = this.focusCls,
- el;
- el = this.getFocusClsEl();
- if (focusCls) {
- el = this.getFocusClsEl(e);
- if (el) {
- el.addCls(focusCls);
- }
- }
- },
- removeFocusCls: function(e) {
- var focusCls = this.focusCls,
- el;
- if (focusCls) {
- el = this.getFocusClsEl(e);
- if (el) {
- el.removeCls(focusCls);
- }
- }
- },
-
- handleFocusEvent: function(e) {
- var me = this,
- event;
- if (!me.focusable || me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
-
-
- if (me.isFocusing(e)) {
- event = new Ext.event.Event(e.event);
- event.type = 'focus';
- event.relatedTarget = e.fromElement;
- event.target = e.toElement;
- me.onFocus(event);
- }
- },
-
- handleBlurEvent: function(e) {
- var me = this,
- event;
- if (!me.focusable || me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
- if (e.toElement === document.body || me.isBlurring(e)) {
- event = new Ext.event.Event(e.event);
- event.type = 'blur';
- event.target = e.fromElement;
- event.relatedTarget = e.toElement;
- me.onBlur(event);
- }
- },
-
- isFocusing: function(e) {
- var focusEl = this.getFocusEl();
- if (focusEl) {
- if (focusEl.isFocusing) {
- return focusEl.isFocusing(e);
- } else {
-
-
-
- return focusEl.dom === document.activeElement && e.toElement === focusEl.dom && e.fromElement !== e.toElement;
- }
- }
- return false;
- },
-
- isBlurring: function(e) {
- var focusEl = this.getFocusEl();
- if (focusEl) {
- if (focusEl.isFocusing) {
- return focusEl.isBlurring(e);
- } else {
-
-
-
- return focusEl.dom !== document.activeElement && e.fromElement === focusEl.dom && e.fromElement !== e.toElement;
- }
- }
- return false;
- },
-
- blur: function() {
- var me = this,
- focusEl;
- if (!me.focusable || !me.canFocus()) {
- return;
- }
- focusEl = me.getFocusEl();
- if (focusEl) {
- me.blurring = true;
- focusEl.blur();
- delete me.blurring;
- }
- },
- isTabbable: function() {
- var me = this,
- focusEl;
- if (me.focusable) {
- focusEl = me.getFocusEl();
- if (focusEl && focusEl.isTabbable()) {
- return focusEl.isTabbable();
- }
- }
- return false;
- },
- disableTabbing: function() {
- var me = this,
- el = me.el,
- focusEl;
-
-
- if (me.destroying || me.destroyed) {
- return;
- }
-
-
- if (el) {
- el.saveTabbableState();
- }
- focusEl = me.getFocusEl();
- if (focusEl) {
-
- if (focusEl.$isFocusableEntity) {
- focusEl.disableTabbing();
- }
-
-
-
- else if (focusEl.isElement && el && !el.contains(focusEl)) {
- focusEl.saveTabbableState();
- }
- }
- },
- enableTabbing: function(reset) {
- var me = this,
- el = me.el,
- focusEl;
-
-
- if (me.destroying || me.destroyed) {
- return;
- }
- focusEl = me.getFocusEl();
- if (focusEl) {
- if (focusEl.$isFocusableEntity) {
- focusEl.enableTabbing();
- } else if (focusEl.isElement && el && !el.contains(focusEl)) {
- focusEl.restoreTabbableState();
- }
- }
- if (el) {
- el.restoreTabbableState({
- reset: reset
- });
- }
- }
- }
- }, function() {
- var keyboardModeCls = Ext.baseCSSPrefix + 'keyboard-mode',
- keyboardMode = false;
-
- Ext.enableKeyboardMode = Ext.isModern || !Ext.os.is.Desktop;
-
-
- Ext.setKeyboardMode = Ext.setKeyboardMode || function(keyboardMode) {
- Ext.keyboardMode = keyboardMode;
- Ext.getBody().toggleCls(keyboardModeCls, keyboardMode);
- };
- Ext.isTouchMode = function() {
- return (Ext.now() - Ext.lastTouchTime) < 500;
- };
-
- Ext.syncKeyboardMode = function(e) {
- if (!Ext.enableKeyboardMode) {
- return;
- }
- var type = e.type;
- if (type === 'pointermove') {
-
-
-
-
- keyboardMode = false;
- } else {
- keyboardMode = (type === 'keydown');
- Ext.lastTouchTime = e.pointerType === 'touch' && Ext.now();
- Ext.setKeyboardMode(keyboardMode);
- }
- };
- function keyboardModeFocusHandler() {
-
- if (keyboardMode !== Ext.getBody().hasCls(keyboardModeCls)) {
- Ext.setKeyboardMode(keyboardMode);
- }
- }
- Ext.getEnableKeyboardMode = function() {
- return Ext.enableKeyboardMode;
- };
- Ext.setEnableKeyboardMode = function(enable) {
- var listeners = {
- pointerdown: Ext.syncKeyboardMode,
- pointermove: Ext.syncKeyboardMode,
- keydown: Ext.syncKeyboardMode,
- capture: true,
- delegated: false
- };
- Ext.enableKeyboardMode = !!enable;
- if (Ext.enableKeyboardMode) {
- Ext.getWin().on(listeners);
- Ext.on('focus', keyboardModeFocusHandler);
- } else {
- Ext.getWin().un(listeners);
- Ext.un('focus', keyboardModeFocusHandler);
- }
- };
- Ext.onReady(function() {
-
- if (!Ext.enableKeyboardMode) {
- Ext.getBody().addCls(keyboardModeCls);
- }
- Ext.setEnableKeyboardMode(Ext.enableKeyboardMode);
- });
- });
- Ext.define('Ext.mixin.Accessible', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'accessible'
- },
-
-
-
- config: {
-
- ariaAttributes: {
- $value: null,
- lazy: true
- }
- },
-
-
-
- ariaEl: 'el',
- privates: {
-
- getAriaLabelEl: function(reference) {
- var ids = [],
- refHolder, i, len, cmp, result;
- if (reference) {
- if (Ext.isFunction(reference)) {
- return reference.call(this);
- } else {
- if (!Ext.isArray(reference)) {
- reference = [
- reference
- ];
- }
- refHolder = this.lookupReferenceHolder();
- if (refHolder) {
- for (i = 0 , len = reference.length; i < len; i++) {
- cmp = refHolder.lookupReference(reference[i]);
- if (cmp) {
- ids.push(cmp.ariaEl.id);
- }
- }
- }
- }
- }
- return ids.length ? ids.join(' ') : null;
- }
- }
- });
- Ext.define('Ext.Widget', {
- extend: Ext.Evented,
- xtype: 'widget',
- alternateClassName: 'Ext.Gadget',
- mixins: [
- Ext.mixin.Inheritable,
- Ext.mixin.Bindable,
- Ext.mixin.ComponentDelegation,
- Ext.mixin.Pluggable,
- Ext.mixin.Keyboard,
- Ext.mixin.Factoryable,
- Ext.mixin.Focusable,
- Ext.mixin.Accessible
- ],
- isWidget: true,
- factoryConfig: {
- creator: null,
- defaultProperty: 'xtype',
- defaultType: 'component',
- typeProperty: 'xtype'
- },
-
- element: {
- reference: 'element'
- },
- observableType: 'component',
- cachedConfig: {
-
- cls: null,
-
- style: null,
-
- border: null,
-
- touchAction: null,
-
- eventHandlers: {
- focus: 'handleFocusEvent',
- blur: 'handleBlurEvent'
- }
- },
-
- name: null,
- config: {
-
- renderTo: null,
-
- ui: null,
-
- userCls: null,
-
- ripple: null,
-
- hideMode: null,
-
- instanceCls: null
- },
- eventedConfig: {
-
- width: null,
-
- height: null,
-
- hidden: null,
-
- disabled: null
- },
-
- template: [],
-
- baseCls: null,
-
- classCls: null,
-
- classClsRoot: true,
-
- classClsList: [],
- clearPropertiesOnDestroy: 'async',
- focusEl: 'element',
- ariaEl: 'element',
- spaceRe: /\s+/,
-
- noBorderCls: Ext.baseCSSPrefix + 'noborder-trbl',
- borderedCls: Ext.baseCSSPrefix + 'bordered',
- disabledCls: Ext.baseCSSPrefix + 'disabled',
- heightedCls: Ext.baseCSSPrefix + 'heighted',
- widthedCls: Ext.baseCSSPrefix + 'widthed',
- constructor: function(config) {
- var me = this,
- baseCls = me.baseCls,
- renderTo = config && config.renderTo,
- controller;
- me.$iid = ++Ext.$nextIid;
- if (baseCls == null || baseCls === true) {
- me.baseCls = me.classCls || Ext.baseCSSPrefix + me.xtype;
- }
-
- if (config && ('baseCls' in config)) {
- Ext.raise('baseCls cannot be used as an instance config. It must be specified at class definition time.');
- }
-
-
-
-
- if ((config && config.controller) || me.config.controller) {
- me.referenceHolder = true;
- }
- me.initId(config);
- me.initElement();
- if (renderTo) {
- config = Ext.apply({}, config);
- delete config.renderTo;
- }
- me.mixins.observable.constructor.call(me, config);
-
- if (me.focusable) {
- me.initFocusableEvents(true);
- }
- if (renderTo) {
- me.setRenderTo(renderTo);
- }
- me.syncUiCls();
- Ext.ComponentManager.register(me);
- controller = me.getController();
- if (controller) {
- controller.init(me);
- }
- },
- afterCachedConfig: function() {
-
-
-
-
-
-
-
- var me = this,
- prototype = me.self.prototype,
- referenceList = me.referenceList,
- renderElement = me.renderElement,
- renderTemplate, element, i, ln, reference, elements;
-
-
- prototype.renderTemplate = renderTemplate = document.createDocumentFragment();
- renderTemplate.appendChild(renderElement.clone(true, true));
- elements = renderTemplate.querySelectorAll('[id]');
- for (i = 0 , ln = elements.length; i < ln; i++) {
- element = elements[i];
- element.removeAttribute('id');
- }
-
-
-
-
- for (i = 0 , ln = referenceList.length; i < ln; i++) {
- reference = referenceList[i];
- me[reference].dom.removeAttribute('reference');
- }
- },
- applyHidden: function(hidden) {
- return !!hidden;
- },
- applyDisabled: function(disabled) {
- return !!disabled;
- },
- updateDisabled: function(disabled) {
- var me = this,
- container = me.ownerFocusableContainer;
- if (container) {
- if (disabled) {
- if (!container.beforeFocusableChildDisable.$nullFn) {
- container.beforeFocusableChildDisable(me);
- }
- } else {
- if (!container.beforeFocusableChildEnable.$nullFn) {
- container.beforeFocusableChildEnable(me);
- }
- }
- }
- me.element.toggleCls(me.disabledCls, disabled);
- if (me.focusable) {
- if (disabled) {
- me.disableFocusable();
- } else {
- me.enableFocusable();
- }
- }
- if (container) {
- if (disabled) {
- if (!container.onFocusableChildDisable.$nullFn) {
- container.onFocusableChildDisable(me);
- }
- } else {
- if (!container.onFocusableChildEnable.$nullFn) {
- container.onFocusableChildEnable(me);
- }
- }
- }
- },
-
- disable: function() {
- this.setDisabled(true);
- },
-
- enable: function() {
- this.setDisabled(false);
- },
-
- isDisabled: function() {
- return this.getDisabled();
- },
-
- isEnabled: function() {
- return !this.getDisabled();
- },
- applyTouchAction: function(touchAction, oldTouchAction) {
- if (oldTouchAction != null) {
- touchAction = Ext.merge({}, oldTouchAction, touchAction);
- }
- return touchAction;
- },
- applyWidth: function(width) {
- return this.filterLengthValue(width);
- },
- applyHeight: function(height) {
- return this.filterLengthValue(height);
- },
- updateBorder: function(border) {
- var me = this;
-
- border = border || border === null;
- me.toggleCls(me.noBorderCls, !border);
- me.toggleCls(me.borderedCls, !!border);
- },
- clearListeners: function() {
- var me = this;
- me.mixins.observable.clearListeners.call(me);
- me.mixins.componentDelegation.clearDelegatedListeners.call(me);
- },
-
- destroy: function() {
- var me = this;
-
- me.isDestroying = me.destroying = true;
- me.doDestroy();
-
-
- me.clearListeners();
- me.isDestroying = me.destroying = false;
-
-
- me.mixins.componentDelegation.destroyComponentDelegation.call(me);
- me.callParent();
- },
-
- doDestroy: function() {
- var me = this,
- referenceList = me.referenceList,
- container = me.ownerFocusableContainer,
- i, ln, reference;
-
- me.ownerCmp = null;
- if (container && !container.onFocusableChildDestroy.$nullFn) {
- container.onFocusableChildDestroy(me);
- }
-
- for (i = 0 , ln = referenceList.length; i < ln; i++) {
- reference = referenceList[i];
- if (me.hasOwnProperty(reference)) {
- me[reference].destroy();
- me[reference] = null;
- }
- }
- me.destroyBindable();
- Ext.ComponentManager.unregister(me);
- },
- doFireEvent: function(eventName, args, bubbles) {
- var me = this,
- ret;
- ret = me.mixins.observable.doFireEvent.call(me, eventName, args, bubbles);
-
- if (ret !== false && !me.destroyed) {
- ret = me.mixins.componentDelegation.doFireDelegatedEvent.call(me, eventName, args);
- }
- return ret;
- },
- getBubbleTarget: function() {
- return this.getRefOwner();
- },
-
- getElementConfig: function() {
- var me = this,
- el = me.element;
- if (!('children' in el)) {
- el = Ext.apply({
- children: me.getTemplate()
- }, el);
- }
- return el;
- },
-
- getSize: function() {
- return this.el.getSize();
- },
- getTemplate: function() {
- return Ext.clone(this.template);
- },
-
- getClassCls: function() {
- var proto = this.self.prototype,
- prototype = proto,
- classes, classCls, i, ln;
- while (prototype) {
- classCls = prototype.hasOwnProperty('classCls') ? prototype.classCls : null;
- if (classCls) {
- if (classCls instanceof Array) {
- for (i = 0 , ln = classCls.length; i < ln; i++) {
- (classes || (classes = [])).push(classCls[i]);
- }
- } else {
- (classes || (classes = [])).push(classCls);
- }
- }
- if (prototype.classClsRoot && prototype.hasOwnProperty('classClsRoot')) {
- break;
- }
- prototype = prototype.superclass;
- }
- if (classes) {
- proto.classClsList = classes;
- }
- return classes;
- },
- hide: function() {
- this.setHidden(true);
- },
-
- initElement: function() {
- var me = this,
- prototype = me.self.prototype,
- id = me.getId(),
-
-
-
- referenceList = me.referenceList = me.referenceList = [],
- isFirstInstance = !prototype.hasOwnProperty('renderTemplate'),
-
- uiReferences = prototype.hasOwnProperty('uiReferences') ? prototype.uiReferences : (prototype.uiReferences = {
- element: ''
- }),
- renderTemplate, renderElement, renderConfig, element, referenceNodes, i, ln, referenceNode, reference, classCls, uiCls, baseCls, referenceElement;
- if (isFirstInstance) {
-
-
- renderTemplate = document.createDocumentFragment();
- renderConfig = me.processElementConfig.call(prototype);
- renderElement = Ext.Element.create(renderConfig, true);
- renderTemplate.appendChild(renderElement);
-
-
-
- referenceNodes = renderTemplate.querySelectorAll('[uiCls]');
- for (i = 0 , ln = referenceNodes.length; i < ln; i++) {
- referenceNode = referenceNodes[i];
- reference = referenceNode.getAttribute('reference');
- uiCls = referenceNode.getAttribute('uiCls');
-
- if (!reference) {
- Ext.raise('Cannot render element with uiCls="' + uiCls + '". uiCls is only allowed on elements that have a reference name.');
- }
-
- uiReferences[reference] = uiCls;
-
-
- referenceNode.removeAttribute('uiCls');
- }
- } else {
-
-
-
-
- renderTemplate = me.renderTemplate.cloneNode(true);
- renderElement = renderTemplate.firstChild;
- }
- referenceNodes = renderTemplate.querySelectorAll('[reference]');
- for (i = 0 , ln = referenceNodes.length; i < ln; i++) {
- referenceNode = referenceNodes[i];
- reference = referenceNode.getAttribute('reference');
- if (!isFirstInstance) {
-
-
-
-
-
-
-
- referenceNode.removeAttribute('reference');
- }
- if (reference === 'element') {
-
- if (element) {
-
- Ext.raise("Duplicate 'element' reference detected in '" + me.$className + "' template.");
- }
-
- referenceNode.id = id;
-
-
- element = me.el = me.addElementReference(reference, referenceNode);
-
- element.dom.setAttribute('data-componentid', id);
- if (isFirstInstance) {
- classCls = me.getClassCls();
- if (classCls) {
- element.addCls(classCls);
- }
- baseCls = me.baseCls;
- if (baseCls && (baseCls !== me.classCls)) {
- element.addCls(baseCls);
- }
- }
- } else {
- uiCls = uiReferences[reference];
- if (uiCls && isFirstInstance) {
-
-
-
-
-
-
-
-
- referenceElement = me.addElementReference(reference, referenceNode);
- me.initUiReference(reference, uiCls, false);
- } else {
- me.addElementReferenceOnDemand(reference, referenceNode);
- }
- }
-
- if (reference === me.focusEl) {
- me.addElementReference('focusEl', referenceNode);
- }
- if (reference === me.ariaEl) {
- me.addElementReferenceOnDemand('ariaEl', referenceNode);
- }
- referenceList.push(reference);
- }
-
- if (!element) {
- Ext.raise("No 'element' reference found in '" + me.$className + "' template.");
- }
-
- if (renderElement === element.dom) {
- me.renderElement = element;
- } else {
- me.addElementReferenceOnDemand('renderElement', renderElement);
- }
- renderElement.setAttribute(me.dataXid, me.$iid);
- },
- dataXid: 'data-' + Ext.baseCSSPrefix.substr(0, Ext.baseCSSPrefix.length - 1) + 'id',
-
- is: function(selector) {
- return Ext.ComponentQuery.is(this, selector);
- },
-
- isHidden: function(deep) {
- var hidden = !!this.getHidden(),
- owner;
- if (!hidden && deep) {
- owner = this.getRefOwner();
- while (owner && owner !== deep && !hidden) {
- hidden = !!owner.getHidden();
- owner = owner.getRefOwner();
- }
- }
- return hidden;
- },
-
- isVisible: function(deep) {
- return this.rendered && !this.destroyed && !this.isHidden(deep);
- },
-
- isXType: function(xtype, shallow) {
- return shallow ? (Ext.Array.indexOf(this.xtypes, xtype) !== -1) : !!this.xtypesMap[xtype];
- },
-
- lookupTpl: function(name) {
- return Ext.XTemplate.getTpl(this, name);
- },
- owns: function(element) {
- var result = false,
- cmp;
- if (element.isEvent) {
- element = element.target;
- } else if (element.isElement) {
- element = element.dom;
- }
- cmp = Ext.Component.from(element);
- if (cmp) {
- result = (cmp === this) || (!!cmp.up(this));
- }
- return result;
- },
- render: function(container, insertBeforeElement) {
- if (container && container.isWidget) {
- container = container.el;
- }
- var dom = this.renderElement.dom,
- containerDom = Ext.getDom(container),
- insertBeforeChildDom;
- if (Ext.isNumber(insertBeforeChildDom)) {
- insertBeforeElement = containerDom.childNodes[insertBeforeElement];
- }
- insertBeforeChildDom = Ext.getDom(insertBeforeElement);
- if (containerDom) {
- if (insertBeforeChildDom) {
- containerDom.insertBefore(dom, insertBeforeChildDom);
- } else {
- containerDom.appendChild(dom);
- }
-
-
-
- this.setRendered(Ext.getBody().contains(dom), true);
- }
- },
-
- toggleCls: function(className, state) {
- this.element.toggleCls(className, state);
- return this;
- },
- resolveListenerScope: function(defaultScope, skipThis) {
-
- return this.mixins.inheritable.resolveListenerScope.call(this, defaultScope, skipThis);
- },
-
- setSize: function(width, height) {
-
- if (width && typeof width === 'object') {
- return this.setSize(width.width, width.height);
- }
- if (width !== undefined) {
- this.setWidth(width);
- }
- if (height !== undefined) {
- this.setHeight(height);
- }
- },
- show: function() {
- this.setHidden(false);
- },
-
- addCls: function(cls, prefix, suffix) {
- if (!this.destroyed) {
- this.el.replaceCls(null, cls, prefix, suffix);
- }
- },
- applyCls: function(cls) {
- return cls && Ext.dom.Element.splitCls(cls);
- },
- applyUi: function(ui) {
- return this.parseUi(ui, true);
- },
-
- removeCls: function(cls, prefix, suffix) {
- if (!this.destroyed) {
- this.el.replaceCls(cls, null, prefix, suffix);
- }
- },
-
- replaceCls: function(oldCls, newCls, prefix, suffix) {
- if (!this.destroyed) {
- this.el.replaceCls(oldCls, newCls, prefix, suffix);
- }
- },
-
- hasCls: function(className) {
- return this.el.hasCls(className);
- },
-
- updateCls: function(newCls, oldCls) {
- this.element.replaceCls(oldCls, newCls);
- },
- updateHidden: function(hidden) {
- var me = this,
- element = me.renderElement,
- container = me.ownerFocusableContainer;
-
-
- if (container) {
- if (hidden) {
- if (!container.beforeFocusableChildHide.$nullFn) {
- container.beforeFocusableChildHide(me);
- }
- } else {
- if (!container.beforeFocusableChildShow.$nullFn) {
- container.beforeFocusableChildShow(me);
- }
- }
- }
-
- else if (hidden) {
-
-
- me.revertFocus();
- }
- if (element && !element.destroyed) {
- if (hidden) {
- element.hide();
- } else {
- element.show();
- }
- }
- if (me.focusableContainer && me.activateFocusableContainer) {
- me.activateFocusableContainer(!hidden);
- }
- if (container) {
- if (hidden) {
- if (!container.onFocusableChildHide.$nullFn) {
- container.onFocusableChildHide(me);
- }
- } else {
- if (!container.onFocusableChildShow.$nullFn) {
- container.onFocusableChildShow(me);
- }
- }
- }
- },
- updateRipple: function(ripple) {
- var me = this,
- el = me.el;
- if (el) {
- el.un('touchstart', 'onRippleStart', me);
- el.un('touchend', 'onRippleStart', me);
- el.destroyAllRipples();
- if (ripple.release) {
- el.on('touchend', 'onRippleStart', me);
- } else {
- el.on('touchstart', 'onRippleStart', me);
- }
- }
- },
- shouldRipple: function(e) {
- var me = this,
- disabled = me.getDisabled && me.getDisabled(),
- el = me.el,
- ripple = !disabled && me.getRipple(),
- target;
- if (ripple && e) {
- target = e.getTarget(me.noRippleSelector);
- if (target) {
- if ((el.dom === target) || el.contains(target)) {
- ripple = null;
- }
- }
- }
- return ripple;
- },
- onRippleStart: function(e) {
- var ripple = this.shouldRipple(e);
- if (e.button === 0 && ripple) {
- this.el.ripple(e, ripple);
- }
- },
-
- applyStyle: function(style, oldStyle) {
-
-
-
-
-
-
- if (oldStyle && style === oldStyle && Ext.isObject(oldStyle)) {
- style = Ext.apply({}, style);
- }
- this.element.applyStyles(style);
- return null;
- },
-
- getStyle: function() {
- Ext.Error.raise("'style' is a write-only config. To query element styles use the Ext.dom.Element API.");
- },
-
- updateRenderTo: function(newContainer) {
- this.render(newContainer);
- },
- updateTouchAction: function(touchAction) {
- var name, childEl, value, hasRootActions;
- for (name in touchAction) {
- childEl = this[name];
- value = touchAction[name];
- if (childEl && childEl.isElement) {
- childEl.setTouchAction(value);
- } else {
- hasRootActions = true;
- }
- }
- if (hasRootActions) {
- this.el.setTouchAction(touchAction);
- }
- },
- updateUi: function() {
- if (!this.isConfiguring) {
- this.syncUiCls();
- }
- },
-
- updateWidth: function(width) {
- var el = this.el;
- el.setWidth(width);
- el.toggleCls(this.widthedCls, width != null && width !== 'auto');
- },
-
- updateHeight: function(height) {
- var el = this.el;
- el.setHeight(height);
- el.toggleCls(this.heightedCls, height != null && height !== 'auto');
- },
-
- isWidthed: function() {
- var width = this.getWidth();
- return width != null && width !== 'auto';
- },
-
- isHeighted: function() {
- var height = this.getHeight();
- return height != null && height !== 'auto';
- },
-
- up: function(selector, limit) {
- var result = this.getRefOwner(),
- limitSelector = typeof limit === 'string',
- limitCount = typeof limit === 'number',
- limitComponent = limit && limit.isComponent,
- steps = 0;
- if (selector) {
- for (; result; result = result.getRefOwner()) {
- if (result.destroyed) {
- return null;
- }
- steps++;
- if (selector.isComponent || selector.isWidget) {
- if (result === selector) {
- return result;
- }
- } else {
- if (Ext.ComponentQuery.is(result, selector)) {
- return result;
- }
- }
-
- if (limitSelector && result.is(limit)) {
- return;
- }
- if (limitCount && steps === limit) {
- return;
- }
- if (limitComponent && result === limit) {
- return;
- }
- }
- }
- return result;
- },
- updateLayout: Ext.emptyFn,
-
- updateInstanceCls: function(instanceCls, oldInstanceCls) {
- var me = this,
- el = me.el,
- classClsList = me.classClsList,
- Array = Ext.Array,
- uiReferences = me.uiReferences,
- referenceName, referenceElement, i, ln, cls, uiCls;
- if (oldInstanceCls) {
- el.removeCls(oldInstanceCls);
- oldInstanceCls = Array.from(oldInstanceCls);
- for (i = 0 , ln = oldInstanceCls.length; i < ln; i++) {
- cls = oldInstanceCls[i];
- Array.remove(classClsList, cls);
- for (referenceName in uiReferences) {
- referenceElement = me[referenceName];
- uiCls = uiReferences[referenceName];
- referenceElement.removeCls(cls + '-' + uiCls);
- }
- }
- }
- if (instanceCls) {
- el.addCls(instanceCls);
- instanceCls = Array.from(instanceCls);
-
- me.classClsList = classClsList.concat(instanceCls);
- for (i = 0 , ln = instanceCls.length; i < ln; i++) {
- cls = instanceCls[i];
- for (referenceName in uiReferences) {
- referenceElement = me[referenceName];
- uiCls = uiReferences[referenceName];
- referenceElement.addCls(cls + '-' + uiCls);
- }
- }
- }
- if (!me.isConfiguring) {
- me.syncUiCls();
- }
- },
-
- getBaseCls: function() {
- return this.baseCls;
- },
-
- setBaseCls: function() {
- Ext.raise('baseCls cannot be reconfigured. It must be specified at class definition time.');
- },
- onClassExtended: function(Class, members) {
- if (members.config && members.config.baseCls) {
- Ext.raise('baseCls must be declared directly on the class body. Please move it outside of the config block.');
- }
- },
-
-
- privates: {
- _hideModes: {
- clip: 'CLIP',
- display: 'DISPLAY',
- offsets: 'OFFSETS',
- opacity: 'OPACITY',
- visibility: 'VISIBILITY'
- },
- noRippleSelector: '.' + Ext.baseCSSPrefix + 'no-ripple',
-
- addElementReferenceOnDemand: function(name, domNode) {
- if (this._elementListeners[name]) {
-
-
-
- this.addElementReference(name, domNode);
- } else {
-
-
- Ext.Object.defineProperty(this, name, {
- get: function() {
- if (this.destroyed) {
- return;
- }
-
-
-
- delete this[name];
- return this.addElementReference(name, domNode);
- },
- configurable: true
- });
- }
- },
-
- addElementReference: function(name, domNode) {
- var me = this,
- referenceEl = me[name] = Ext.get(domNode),
- listeners = me._elementListeners[name],
- eventName, listener;
- referenceEl.skipGarbageCollection = true;
- referenceEl.component = me;
- if (listeners) {
-
-
-
-
-
-
-
-
-
- listeners = Ext.clone(listeners);
-
-
-
-
-
-
-
-
-
-
- for (eventName in listeners) {
- listener = listeners[eventName];
- if (typeof listener === 'object') {
- listener.scope = me;
- }
- }
-
-
-
-
-
-
-
-
- listeners.scope = me;
-
-
-
-
-
- referenceEl.on(listeners);
- }
- return referenceEl;
- },
- detachFromBody: function() {
-
- Ext.getDetachedBody().appendChild(this.element, true);
- this.isDetached = true;
- },
- reattachToBody: function() {
- var detachedBody;
- if (this.isDetached) {
- detachedBody = Ext.getDetachedBody();
- if (detachedBody.contains(this.element)) {
- Ext.getBody().appendChild(this.element, true);
- }
- }
-
- this.isDetached = false;
- },
-
- doAddListener: function(name, fn, scope, options, order, caller, manager) {
- var me = this,
- elementName = options && options.element,
- delegate = options && options.delegate,
- listeners, eventOptions, option;
- if (elementName) {
-
- if (Ext.Array.indexOf(me.referenceList, elementName) === -1) {
- Ext.Logger.error("Adding event listener with an invalid element reference of '" + elementName + "' for this component. Available values are: '" + me.referenceList.join("', '") + "'", me);
- }
-
- listeners = {};
- listeners[name] = fn;
- if (scope) {
- listeners.scope = scope;
- }
- eventOptions = Ext.Element.prototype.$eventOptions;
- for (option in options) {
- if (eventOptions[option]) {
- listeners[option] = options[option];
- }
- }
- me.mon(me[elementName], listeners);
- return;
- } else if (delegate) {
- me.mixins.componentDelegation.addDelegatedListener.call(me, name, fn, scope, options, order, caller, manager);
- return;
- }
- me.callParent([
- name,
- fn,
- scope,
- options,
- order,
- caller,
- manager
- ]);
- },
- doRemoveListener: function(eventName, fn, scope) {
- var me = this;
- me.mixins.observable.doRemoveListener.call(me, eventName, fn, scope);
- me.mixins.componentDelegation.removeDelegatedListener.call(me, eventName, fn, scope);
- },
- filterLengthValue: function(value) {
- if (!value && value !== 0) {
- return null;
- }
- return value;
- },
-
- initElementListeners: function(elementConfig) {
- var prototype = this,
- superPrototype = prototype.self.superclass,
- superElementListeners = superPrototype._elementListeners,
- reference = elementConfig.reference,
- children = elementConfig.children,
- elementListeners, listeners, superListeners, ln, i;
- if (prototype.hasOwnProperty('_elementListeners')) {
- elementListeners = prototype._elementListeners;
- } else {
- elementListeners = prototype._elementListeners = (superElementListeners ? Ext.Object.chain(superElementListeners) : {});
- }
- if (reference) {
- listeners = elementConfig.listeners;
- if (listeners) {
- if (superElementListeners) {
- superListeners = superElementListeners[reference];
- if (superListeners) {
- listeners = Ext.Object.chain(superListeners);
- Ext.apply(listeners, elementConfig.listeners);
- }
- }
- elementListeners[reference] = listeners;
-
-
-
- elementConfig.listeners = null;
- }
- }
- if (children) {
- for (i = 0 , ln = children.length; i < ln; i++) {
- prototype.initElementListeners(children[i]);
- }
- }
- },
- initId: function(config) {
- var me = this,
- defaultConfig = me.config,
- id = (config && config.id) || (defaultConfig && defaultConfig.id);
- if (id) {
-
-
- me.setId(id);
- me.id = id;
- } else {
-
- me.getId();
- }
- },
- measure: function(dimension) {
- return this.element.measure(dimension);
- },
-
- processElementConfig: function() {
- var prototype = this,
- superPrototype = prototype.self.superclass,
- elementConfig;
- if (prototype.hasOwnProperty('_elementConfig')) {
- elementConfig = prototype._elementConfig;
- } else {
-
-
- elementConfig = prototype._elementConfig = prototype.getElementConfig();
- if (superPrototype.isWidget) {
-
-
- prototype.processElementConfig.call(superPrototype);
- }
-
-
-
-
- prototype.initElementListeners(elementConfig);
- }
- return elementConfig;
- },
- parseUi: function(ui, asString) {
- ui = Ext.String.splitWords(ui);
- if (asString) {
- ui = ui.join(' ');
- }
- return ui;
- },
- addUi: function(ui) {
- this.setUi(this.doAddUi(ui, this.getUi()));
- },
- doAddUi: function(ui, oldUi) {
- var me = this,
- newUi = null,
- i, u, len;
- if (ui) {
- ui = me.parseUi(ui);
- len = ui.length;
- oldUi = me.parseUi(oldUi);
- for (i = 0; i < len; i++) {
- u = ui[i];
- if (Ext.Array.indexOf(oldUi, u) === -1) {
- oldUi.push(u);
- }
- }
- newUi = oldUi.join(' ');
- }
- return newUi;
- },
- removeUi: function(ui) {
- this.setUi(this.doRemoveUi(ui, this.getUi()));
- },
- doRemoveUi: function(ui, oldUi) {
- var me = this,
- newUi = null,
- i, u, index, len;
- if (ui) {
- ui = me.parseUi(ui);
- len = ui.length;
- oldUi = me.parseUi(oldUi);
- for (i = 0; i < len; i++) {
- u = ui[i];
- index = Ext.Array.indexOf(oldUi, u);
- if (index !== -1) {
- oldUi.splice(index, 1);
- }
- }
- newUi = oldUi.join(' ');
- }
- return newUi;
- },
-
- initUiReference: function(referenceName, uiCls, isInstance) {
- var me = this,
- referenceElement = me[referenceName],
- baseCls = me.baseCls,
- classClsList = me.classClsList,
- cls = [],
- i, n;
- isInstance = (isInstance !== false);
- if (isInstance) {
-
- if (!me.hasOwnProperty('uiReferences')) {
- me.uiReferences = Ext.clone(me.uiReferences);
- }
- me.uiReferences[referenceName] = uiCls;
- }
- uiCls = '-' + uiCls;
- if (baseCls && (baseCls !== me.classCls)) {
- cls.push(baseCls + uiCls);
- }
- if (classClsList) {
- for (i = 0 , n = classClsList.length; i < n; i++) {
- cls.push(classClsList[i] + uiCls);
- }
- }
- referenceElement.addCls(cls);
- if (isInstance && !me.isConfiguring) {
- me.syncUiCls();
- }
- },
- syncUiCls: function(refs) {
- var me = this,
- ui = me.getUi(),
- currentUiCls = me.currentUiCls || (me.currentUiCls = {}),
- baseCls = me.baseCls,
- uiReferences = refs || me.uiReferences,
- classClsList = me.classClsList,
- classClsListLen = classClsList ? classClsList.length : 0,
- uiCls, uiLen, refName, refEl, cls, suffix, uiSuffix, i, j;
- if (ui) {
- ui = me.parseUi(ui);
- uiLen = ui.length;
- }
- for (refName in uiReferences) {
- refEl = me[refName];
- uiCls = [];
- if (refEl) {
- cls = currentUiCls[refName];
- if (cls) {
- refEl.removeCls(cls);
- }
- if (ui) {
- suffix = uiReferences[refName];
- suffix = suffix ? ('-' + suffix) : '';
- for (i = 0; i < uiLen; i++) {
- uiSuffix = '-' + ui[i] + suffix;
- if (baseCls && (baseCls !== me.classCls)) {
- uiCls.push(baseCls + uiSuffix);
- }
- if (classClsList) {
- for (j = 0; j < classClsListLen; j++) {
- uiCls.push(classClsList[j] + uiSuffix);
- }
- }
- }
- refEl.addCls(uiCls);
- currentUiCls[refName] = uiCls;
- }
- }
- }
- },
- applyHideMode: function(mode) {
- return mode || 'display';
- },
- updateHideMode: function(mode) {
- var me = this,
- el = me.el,
- shouldToggle = me.getHidden();
-
- if (!me._hideModes[mode]) {
- Ext.raise('Invalid hideMode: "' + mode + '" (must be one of: "' + Object.keys(me._hideModes).join('", "') + '")');
- }
-
- if (shouldToggle) {
- el.show();
- }
- me.renderElement.setVisibilityMode(Ext.Element[me._hideModes[mode]]);
- if (shouldToggle) {
- el.hide();
- }
- },
- updateUserCls: function(newCls, oldCls) {
- this.element.replaceCls(oldCls, newCls);
- }
- }
- }, function(Widget) {
- var prototype = Widget.prototype;
-
-
- (prototype.$elementEventOptions = Ext.Object.chain(Ext.Element.prototype.$eventOptions)).element = 1;
- (prototype.$eventOptions = Ext.Object.chain(prototype.$eventOptions)).delegate = 1;
-
- Ext.updateWidget = Ext.Factory.widget.update;
- });
- Ext.define('Ext.mixin.Traversable', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'traversable'
- },
- setParent: function(parent) {
- this.parent = parent;
- return this;
- },
-
- hasParent: function() {
- return Boolean(this.getParent());
- },
-
- is: function() {
- return true;
- },
-
- getParent: function() {
- return this.parent || this.$initParent;
- },
- getAncestors: function() {
- var ancestors = [],
- parent = this.getParent();
- while (parent) {
- ancestors.push(parent);
- parent = parent.getParent();
- }
- return ancestors;
- },
- getAncestorIds: function() {
- var ancestorIds = [],
- parent = this.getParent();
- while (parent) {
- ancestorIds.push(parent.getId());
- parent = parent.getParent();
- }
- return ancestorIds;
- },
-
- previousNode: function(selector, includeSelf) {
- var node = this,
- parent = node.getRefOwner(),
- result, it, i, sibling;
-
- if (includeSelf && node.is(selector)) {
- return node;
- }
- if (parent) {
- for (it = parent.items.items , i = Ext.Array.indexOf(it, node) - 1; i > -1; i--) {
- sibling = it[i];
- if (sibling.query) {
- result = sibling.query(selector);
- result = result[result.length - 1];
- if (result) {
- return result;
- }
- }
- if (!selector || sibling.is(selector)) {
- return sibling;
- }
- }
- return parent.previousNode(selector, true);
- }
- return null;
- },
-
- previousSibling: function(selector) {
- var parent = this.getRefOwner(),
- it, idx, sibling;
- if (parent) {
- it = parent.items;
- idx = it.indexOf(this);
- if (idx !== -1) {
- if (selector) {
- for (--idx; idx >= 0; idx--) {
- if ((sibling = it.getAt(idx)).is(selector)) {
- return sibling;
- }
- }
- } else {
- if (idx) {
- return it.getAt(--idx);
- }
- }
- }
- }
- return null;
- },
-
- nextNode: function(selector, includeSelf) {
- var node = this,
- parent = node.getRefOwner(),
- result, it, len, i, sibling;
-
- if (includeSelf && node.is(selector)) {
- return node;
- }
- if (parent) {
- for (it = parent.items.items , i = Ext.Array.indexOf(it, node) + 1 , len = it.length; i < len; i++) {
- sibling = it[i];
- if (!selector || sibling.is(selector)) {
- return sibling;
- }
- if (sibling.down) {
- result = sibling.down(selector);
- if (result) {
- return result;
- }
- }
- }
- return parent.nextNode(selector);
- }
- return null;
- },
-
- nextSibling: function(selector) {
- var parent = this.getRefOwner(),
- it, last, idx, sibling;
- if (parent) {
- it = parent.items;
- idx = it.indexOf(this) + 1;
- if (idx) {
- if (selector) {
- for (last = it.getCount(); idx < last; idx++) {
- if ((sibling = it.getAt(idx)).is(selector)) {
- return sibling;
- }
- }
- } else {
- if (idx < it.getCount()) {
- return it.getAt(idx);
- }
- }
- }
- }
- return null;
- }
- });
- Ext.define('Ext.fx.easing.Abstract', {
- config: {
- startTime: 0,
- startValue: 0
- },
- isEasing: true,
- isEnded: false,
- constructor: function(config) {
- this.initConfig(config);
- return this;
- },
- applyStartTime: function(startTime) {
- if (!startTime) {
- startTime = Ext.Date.now();
- }
- return startTime;
- },
- updateStartTime: function(startTime) {
- this.reset();
- },
- reset: function() {
- this.isEnded = false;
- },
- getValue: Ext.emptyFn
- });
- Ext.define('Ext.fx.easing.Linear', {
- extend: Ext.fx.easing.Abstract,
- alias: 'easing.linear',
- config: {
- duration: 0,
- endValue: 0
- },
- updateStartValue: function(startValue) {
- this.distance = this.getEndValue() - startValue;
- },
- updateEndValue: function(endValue) {
- this.distance = endValue - this.getStartValue();
- },
- getValue: function() {
- var deltaTime = Ext.Date.now() - this.getStartTime(),
- duration = this.getDuration();
- if (deltaTime > duration) {
- this.isEnded = true;
- return this.getEndValue();
- } else {
- return this.getStartValue() + ((deltaTime / duration) * this.distance);
- }
- }
- });
- Ext.define('Ext.util.translatable.Abstract', {
- extend: Ext.Evented,
- mixins: [
- Ext.mixin.Factoryable
- ],
- factoryConfig: {
- type: 'translatable',
- defaultType: 'csstransform'
- },
- config: {
- easing: null,
- easingX: {
- duration: 300
- },
- easingY: {
- duration: 300
- }
- },
-
-
-
-
- x: 0,
-
- y: 0,
- activeEasingX: null,
- activeEasingY: null,
- isAnimating: false,
- isTranslatable: true,
- constructor: function(config) {
- this.callParent([
- config
- ]);
-
-
-
- this.position = {
- x: 0,
- y: 0
- };
- },
- factoryEasing: function(easing) {
- return Ext.factory(easing, Ext.fx.easing.Linear, null, 'easing');
- },
- applyEasing: function(easing) {
- if (!this.getEasingX()) {
- this.setEasingX(this.factoryEasing(easing));
- }
- if (!this.getEasingY()) {
- this.setEasingY(this.factoryEasing(easing));
- }
- },
- applyEasingX: function(easing) {
- return this.factoryEasing(easing);
- },
- applyEasingY: function(easing) {
- return this.factoryEasing(easing);
- },
- doTranslate: function(x, y) {
- if (this.hasListeners.translate) {
- this.fireEvent('translate', this, x, y);
- }
- },
- translate: function(x, y, animation) {
- if (animation) {
- return this.translateAnimated(x, y, animation);
- }
- if (this.isAnimating) {
- this.stopAnimation();
- }
- if (!isNaN(x) && typeof x === 'number') {
- this.x = x;
- }
- if (!isNaN(y) && typeof y === 'number') {
- this.y = y;
- }
- this.doTranslate(x, y);
- },
- translateAxis: function(axis, value, animation) {
- var x, y;
- if (axis === 'x') {
- x = value;
- } else {
- y = value;
- }
- return this.translate(x, y, animation);
- },
-
- getPosition: function() {
- var me = this,
- position = me.position;
- position.x = -me.x;
- position.y = -me.y;
- return position;
- },
- animate: function(easingX, easingY) {
- var me = this;
- me.activeEasingX = easingX;
- me.activeEasingY = easingY;
- me.isAnimating = true;
- if (me.ownerCmp) {
- me.ownerCmp.isTranslating = true;
- }
- me.lastX = null;
- me.lastY = null;
- Ext.AnimationQueue.start(me.doAnimationFrame, me);
- me.fireEvent('animationstart', me, me.x, me.y);
- return me;
- },
- translateAnimated: function(x, y, animation) {
- var me = this,
- now, easing, easingX, easingY;
- if (!Ext.isObject(animation)) {
- animation = {};
- }
- if (me.isAnimating) {
- me.stopAnimation();
- }
-
- me.callback = animation.callback;
- me.callbackScope = animation.scope;
- now = Ext.Date.now();
- easing = animation.easing;
- easingX = (typeof x === 'number') ? (animation.easingX || easing || me.getEasingX() || true) : null;
- easingY = (typeof y === 'number') ? (animation.easingY || easing || me.getEasingY() || true) : null;
- if (easingX) {
- easingX = me.factoryEasing(easingX);
- easingX.setStartTime(now);
- easingX.setStartValue(me.x);
- easingX.setEndValue(x);
- if ('duration' in animation) {
- easingX.setDuration(animation.duration);
- }
- }
- if (easingY) {
- easingY = me.factoryEasing(easingY);
- easingY.setStartTime(now);
- easingY.setStartValue(me.y);
- easingY.setEndValue(y);
- if ('duration' in animation) {
- easingY.setDuration(animation.duration);
- }
- }
- return me.animate(easingX, easingY);
- },
- doAnimationFrame: function() {
- var me = this,
- easingX = me.activeEasingX,
- easingY = me.activeEasingY,
- now = Date.now(),
- x, y;
- if (!me.isAnimating) {
- return;
- }
- me.lastRun = now;
- if (easingX === null && easingY === null) {
- me.stopAnimation();
- return;
- }
- if (easingX !== null) {
- me.x = x = Math.round(easingX.getValue());
- if (easingX.isEnded) {
- me.activeEasingX = null;
- me.fireEvent('axisanimationend', me, 'x', x);
- }
- } else {
- x = me.x;
- }
- if (easingY !== null) {
- me.y = y = Math.round(easingY.getValue());
- if (easingY.isEnded) {
- me.activeEasingY = null;
- me.fireEvent('axisanimationend', me, 'y', y);
- }
- } else {
- y = me.y;
- }
- if (me.lastX !== x || me.lastY !== y) {
- me.doTranslate(x, y);
- me.lastX = x;
- me.lastY = y;
- }
- me.fireEvent('animationframe', me, x, y);
- },
- stopAnimation: function() {
- var me = this;
- if (!me.isAnimating) {
- return;
- }
- me.activeEasingX = null;
- me.activeEasingY = null;
- me.isAnimating = false;
- if (me.ownerCmp) {
- me.ownerCmp.isTranslating = false;
- }
- Ext.AnimationQueue.stop(me.doAnimationFrame, me);
- me.fireEvent('animationend', me, me.x, me.y);
- if (me.callback) {
- me.callback.call(me.callbackScope);
- me.callback = null;
- }
- },
- refresh: function() {
- this.translate(this.x, this.y);
- },
- resolveListenerScope: function() {
- var ownerCmp = this.ownerCmp,
- a = arguments;
- if (ownerCmp) {
- return ownerCmp.resolveListenerScope.apply(ownerCmp, a);
- }
- return this.callParent(a);
- },
- destroy: function() {
- var me = this;
- me.destroying = true;
- if (me.isAnimating) {
- me.stopAnimation();
- }
- me.callParent();
- me.destroying = false;
- me.destroyed = true;
- }
- });
- Ext.define('Ext.util.Format', function() {
- var me;
-
- return {
- singleton: true,
-
- defaultDateFormat: 'm/d/Y',
-
- thousandSeparator: ',',
-
- decimalSeparator: '.',
-
- currencyPrecision: 2,
-
- currencySign: '$',
-
- currencySpacer: '',
-
- percentSign: '%',
-
- currencyAtEnd: false,
- stripTagsRe: /<\/?[^>]+>/gi,
- stripScriptsRe: /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
- nl2brRe: /\r?\n/g,
- hashRe: /#+$/,
- allHashes: /^#+$/,
-
- formatPattern: /[\d,\.#]+/,
-
- formatCleanRe: /[^\d\.#]/g,
-
-
- I18NFormatCleanRe: null,
-
- formatFns: {},
- constructor: function() {
- me = this;
- },
-
-
- nbsp: function(value, strict) {
- strict = strict !== false;
- if (strict ? value === '' || value == null : !value) {
- value = '\xa0';
- }
- return value;
- },
-
- undef: function(value) {
- return value !== undefined ? value : "";
- },
-
- defaultValue: function(value, defaultValue) {
- return value !== undefined && value !== '' ? value : defaultValue;
- },
-
- substr: 'ab'.substr(-1) != 'b' ? function(value, start, length) {
- var str = String(value);
- return (start < 0) ? str.substr(Math.max(str.length + start, 0), length) : str.substr(start, length);
- } : function(value, start, length) {
- return String(value).substr(start, length);
- },
-
- lowercase: function(value) {
- return String(value).toLowerCase();
- },
-
- uppercase: function(value) {
- return String(value).toUpperCase();
- },
-
- usMoney: function(value) {
- return me.currency(value, '$', 2);
- },
-
- currency: function(value, currencySign, decimals, end, currencySpacer) {
- var negativeSign = '',
- format = ",0",
- i = 0;
- value = value - 0;
- if (value < 0) {
- value = -value;
- negativeSign = '-';
- }
- decimals = Ext.isDefined(decimals) ? decimals : me.currencyPrecision;
- format += (decimals > 0 ? '.' : '');
- for (; i < decimals; i++) {
- format += '0';
- }
- value = me.number(value, format);
- if (currencySpacer == null) {
- currencySpacer = me.currencySpacer;
- }
- if ((end || me.currencyAtEnd) === true) {
- return Ext.String.format("{0}{1}{2}{3}", negativeSign, value, currencySpacer, currencySign || me.currencySign);
- } else {
- return Ext.String.format("{0}{1}{2}{3}", negativeSign, currencySign || me.currencySign, currencySpacer, value);
- }
- },
-
- date: function(value, format) {
- if (!value) {
- return "";
- }
- if (!Ext.isDate(value)) {
- value = new Date(Date.parse(value));
- }
- return Ext.Date.dateFormat(value, format || Ext.Date.defaultFormat);
- },
-
- dateRenderer: function(format) {
- return function(v) {
- return me.date(v, format);
- };
- },
-
- hex: function(value, digits) {
- var s = parseInt(value || 0, 10).toString(16);
- if (digits) {
- if (digits < 0) {
- digits = -digits;
- if (s.length > digits) {
- s = s.substring(s.length - digits);
- }
- }
- while (s.length < digits) {
- s = '0' + s;
- }
- }
- return s;
- },
-
- or: function(value, orValue) {
- return value || orValue;
- },
-
- pick: function(value, firstValue, secondValue) {
- if (Ext.isNumber(value)) {
- var ret = arguments[value + 1];
- if (ret) {
- return ret;
- }
- }
- return value ? secondValue : firstValue;
- },
-
- lessThanElse: function(value, threshold, below, above, equal) {
- var v = Ext.Number.from(value, 0),
- t = Ext.Number.from(threshold, 0),
- missing = !Ext.isDefined(equal);
- return v < t ? below : (v > t ? above : (missing ? above : equal));
- },
-
- sign: function(value, negative, positive, zero) {
- if (zero === undefined) {
- zero = positive;
- }
- return me.lessThanElse(value, 0, negative, positive, zero);
- },
-
- stripTags: function(value) {
- return !value ? value : String(value).replace(me.stripTagsRe, "");
- },
-
- stripScripts: function(value) {
- return !value ? value : String(value).replace(me.stripScriptsRe, "");
- },
-
- fileSize: (function() {
- var byteLimit = 1024,
- kbLimit = 1048576,
- mbLimit = 1073741824;
- return function(size) {
- var out;
- if (size < byteLimit) {
- if (size === 1) {
- out = '1 byte';
- } else {
- out = size + ' bytes';
- }
- } else if (size < kbLimit) {
- out = (Math.round(((size * 10) / byteLimit)) / 10) + ' KB';
- } else if (size < mbLimit) {
- out = (Math.round(((size * 10) / kbLimit)) / 10) + ' MB';
- } else {
- out = (Math.round(((size * 10) / mbLimit)) / 10) + ' GB';
- }
- return out;
- };
- })(),
-
- math: (function() {
- var fns = {};
- return function(v, a) {
- if (!fns[a]) {
- fns[a] = Ext.functionFactory('v', 'return v ' + a + ';');
- }
- return fns[a](v);
- };
- }()),
-
- round: function(value, precision) {
- var result = Number(value);
- if (typeof precision === 'number') {
- precision = Math.pow(10, precision);
- result = Math.round(value * precision) / precision;
- } else if (precision === undefined) {
- result = Math.round(result);
- }
- return result;
- },
-
- number: function(v, formatString) {
- if (!formatString) {
- return v;
- }
- if (isNaN(v)) {
- return '';
- }
- var formatFn = me.formatFns[formatString];
-
-
- if (!formatFn) {
- var originalFormatString = formatString,
- comma = me.thousandSeparator,
- decimalSeparator = me.decimalSeparator,
- precision = 0,
- trimPart = '',
- hasComma, splitFormat, extraChars, trimTrailingZeroes, code, len;
-
-
-
-
- if (formatString.substr(formatString.length - 2) === '/i') {
-
-
- if (!me.I18NFormatCleanRe || me.lastDecimalSeparator !== decimalSeparator) {
- me.I18NFormatCleanRe = new RegExp('[^\\d\\' + decimalSeparator + '#]', 'g');
- me.lastDecimalSeparator = decimalSeparator;
- }
- formatString = formatString.substr(0, formatString.length - 2);
- hasComma = formatString.indexOf(comma) !== -1;
- splitFormat = formatString.replace(me.I18NFormatCleanRe, '').split(decimalSeparator);
- } else {
- hasComma = formatString.indexOf(',') !== -1;
- splitFormat = formatString.replace(me.formatCleanRe, '').split('.');
- }
- extraChars = formatString.replace(me.formatPattern, '');
- if (splitFormat.length > 2) {
-
- Ext.raise({
- sourceClass: "Ext.util.Format",
- sourceMethod: "number",
- value: v,
- formatString: formatString,
- msg: "Invalid number format, should have no more than 1 decimal"
- });
- }
-
- else if (splitFormat.length === 2) {
- precision = splitFormat[1].length;
-
- trimTrailingZeroes = splitFormat[1].match(me.hashRe);
- if (trimTrailingZeroes) {
- len = trimTrailingZeroes[0].length;
-
- trimPart = 'trailingZeroes=new RegExp(Ext.String.escapeRegex(utilFormat.decimalSeparator) + "*0{0,' + len + '}$")';
- }
- }
-
- code = [
- 'var utilFormat=Ext.util.Format,extNumber=Ext.Number,neg,absVal,fnum,parts' + (hasComma ? ',thousandSeparator,thousands=[],j,n,i' : '') + (extraChars ? ',formatString="' + formatString + '",formatPattern=/[\\d,\\.#]+/' : '') + ',trailingZeroes;' + 'return function(v){' + 'if(typeof v!=="number"&&isNaN(v=extNumber.from(v,NaN)))return"";' + 'neg=v<0;',
- 'absVal=Math.abs(v);',
- 'fnum=Ext.Number.toFixed(absVal, ' + precision + ');',
- trimPart,
- ';'
- ];
- if (hasComma) {
-
-
- if (precision) {
- code[code.length] = 'parts=fnum.split(".");';
- code[code.length] = 'fnum=parts[0];';
- }
- code[code.length] = 'if(absVal>=1000) {';
- code[code.length] = 'thousandSeparator=utilFormat.thousandSeparator;' + 'thousands.length=0;' + 'j=fnum.length;' + 'n=fnum.length%3||3;' + 'for(i=0;i<j;i+=n){' + 'if(i!==0){' + 'n=3;' + '}' + 'thousands[thousands.length]=fnum.substr(i,n);' + '}' + 'fnum=thousands.join(thousandSeparator);' + '}';
- if (precision) {
- code[code.length] = 'fnum += utilFormat.decimalSeparator+parts[1];';
- }
- } else if (precision) {
-
- code[code.length] = 'if(utilFormat.decimalSeparator!=="."){' + 'parts=fnum.split(".");' + 'fnum=parts[0]+utilFormat.decimalSeparator+parts[1];' + '}';
- }
-
- code[code.length] = 'if(neg&&fnum!=="' + (precision ? '0.' + Ext.String.repeat('0', precision) : '0') + '") { fnum="-"+fnum; }';
- if (trimTrailingZeroes) {
- code[code.length] = 'fnum=fnum.replace(trailingZeroes,"");';
- }
- code[code.length] = 'return ';
-
- if (extraChars) {
- code[code.length] = 'formatString.replace(formatPattern, fnum);';
- } else {
- code[code.length] = 'fnum;';
- }
- code[code.length] = '};';
- formatFn = me.formatFns[originalFormatString] = Ext.functionFactory('Ext', code.join(''))(Ext);
- }
- return formatFn(v);
- },
-
- numberRenderer: function(format) {
- return function(v) {
- return me.number(v, format);
- };
- },
-
- percent: function(value, formatString) {
- return me.number(value * 100, formatString || '0') + me.percentSign;
- },
- repeat: function(value, text, sep) {
- return Ext.String.repeat(text, value, sep);
- },
-
- attributes: function(attributes) {
- if (typeof attributes === 'object') {
- var result = [],
- name;
- for (name in attributes) {
- if (attributes.hasOwnProperty(name)) {
- result.push(name, '="', name === 'style' ? Ext.DomHelper.generateStyles(attributes[name], null, true) : Ext.htmlEncode(attributes[name]), '" ');
- }
- }
- attributes = result.join('');
- }
- return attributes || '';
- },
-
- plural: function(value, singular, plural) {
- return value + ' ' + (value === 1 ? singular : (plural ? plural : singular + 's'));
- },
-
- nl2br: function(v) {
- return Ext.isEmpty(v) ? '' : v.replace(me.nl2brRe, '<br/>');
- },
-
- capitalize: Ext.String.capitalize,
-
- uncapitalize: Ext.String.uncapitalize,
-
- ellipsis: Ext.String.ellipsis,
-
- escape: Ext.String.escape,
-
- escapeRegex: Ext.String.escapeRegex,
-
- htmlDecode: Ext.String.htmlDecode,
-
- htmlEncode: Ext.String.htmlEncode,
-
- leftPad: Ext.String.leftPad,
-
- toggle: Ext.String.toggle,
-
- trim: Ext.String.trim,
-
- parseBox: function(box) {
- box = box || 0;
- if (typeof box === 'number') {
- return {
- top: box,
- right: box,
- bottom: box,
- left: box
- };
- }
- var parts = box.split(' '),
- ln = parts.length;
- if (ln === 1) {
- parts[1] = parts[2] = parts[3] = parts[0];
- } else if (ln === 2) {
- parts[2] = parts[0];
- parts[3] = parts[1];
- } else if (ln === 3) {
- parts[3] = parts[1];
- }
- return {
- top: parseInt(parts[0], 10) || 0,
- right: parseInt(parts[1], 10) || 0,
- bottom: parseInt(parts[2], 10) || 0,
- left: parseInt(parts[3], 10) || 0
- };
- },
-
- resource: function(url, prefix) {
- prefix = prefix || '';
- return Ext.resolveResource(prefix + url);
- },
-
- uri: function(value) {
- return encodeURI(value);
- },
-
- uriCmp: function(value) {
- return encodeURIComponent(value);
- },
- wordBreakRe: /[\W\s]+/,
-
- word: function(value, index, sep) {
- var re = sep ? (typeof sep === 'string' ? new RegExp(sep) : sep) : me.wordBreakRe,
- parts = (value || '').split(re);
- return parts[index || 0] || '';
- }
- };
- });
- Ext.define('Ext.Template', {
- inheritableStatics: {
-
- from: function(el, config) {
- el = Ext.getDom(el);
- return new this(el.value || el.innerHTML, config || '');
- }
- },
-
-
-
- useEval: Ext.isGecko,
-
-
- constructor: function(html) {
- var me = this,
- args = arguments,
- buffer = [],
- length = args.length,
- i, value;
- me.initialConfig = {};
-
-
-
- if (length === 1 && Ext.isArray(html)) {
- args = html;
- length = args.length;
- }
- if (length > 1) {
- for (i = 0; i < length; i++) {
- value = args[i];
- if (typeof value === 'object') {
- Ext.apply(me.initialConfig, value);
- Ext.apply(me, value);
- } else {
- buffer.push(value);
- }
- }
- } else {
- buffer.push(html);
- }
- me.html = buffer.join('');
- },
-
- isTemplate: true,
-
-
- disableFormats: false,
-
- tokenRe: /\{(?:(?:(\d+)|([a-z_$][\w\-$]*))(?::([a-z_\.]+)(?:\(([^\)]*?)?\))?)?)\}/gi,
-
- apply: function(values) {
- var me = this;
- if (me.compiled) {
- if (!me.fn) {
- me.compile();
- }
- return me.fn(values).join('');
- }
- return me.evaluate(values);
- },
-
- evaluate: function(values) {
- var me = this,
- useFormat = !me.disableFormats,
- fm = Ext.util.Format,
- tpl = me;
- function fn(match, index, name, formatFn, args) {
-
-
- if (name == null || name === '') {
- name = index;
- }
- if (formatFn && useFormat) {
- if (args) {
- args = [
- values[name]
- ].concat(Ext.functionFactory('return [' + args + '];')());
- } else {
- args = [
- values[name]
- ];
- }
-
- if (formatFn.substr(0, 5) === "this.") {
- return tpl[formatFn.substr(5)].apply(tpl, args);
- }
-
- else if (fm[formatFn]) {
- return fm[formatFn].apply(fm, args);
- } else
- {
- return match;
- }
- } else {
- return values[name] !== undefined ? values[name] : "";
- }
- }
- return me.html.replace(me.tokenRe, fn);
- },
-
- applyOut: function(values, out) {
- var me = this;
- if (me.compiled) {
- if (!me.fn) {
- me.compile();
- }
- out.push.apply(out, me.fn(values));
- } else {
- out.push(me.apply(values));
- }
- return out;
- },
-
- applyTemplate: function() {
- return this.apply.apply(this, arguments);
- },
-
- set: function(html, compile) {
- var me = this;
- me.html = html;
- me.compiled = !!compile;
- me.fn = null;
- return me;
- },
- compileARe: /\\/g,
- compileBRe: /(\r\n|\n)/g,
- compileCRe: /'/g,
-
- compile: function() {
- var me = this,
- code;
- code = me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.tokenRe, me.regexReplaceFn.bind(me));
- code = (this.disableFormats !== true ? 'var fm=Ext.util.Format;' : '') + (me.useEval ? '$=' : 'return') + " function(v){return ['" + code + "'];};";
- me.fn = me.useEval ? me.evalCompiled(code) : (new Function('Ext', code))(Ext);
-
- me.compiled = true;
- return me;
- },
-
- evalCompiled: function($) {
-
-
-
-
- eval($);
-
- return $;
- },
- regexReplaceFn: function(match, index, name, formatFn, args) {
-
-
-
- if (index == null || index === '') {
- index = '"' + name + '"';
- }
-
-
- else if (this.stringFormat) {
- index = parseInt(index) + 1;
- }
- if (formatFn && this.disableFormats !== true) {
- args = args ? ',' + args : "";
-
- if (formatFn.substr(0, 5) === "this.") {
- formatFn = formatFn + '(';
- }
-
- else if (Ext.util.Format[formatFn]) {
- formatFn = "fm." + formatFn + '(';
- } else
- {
- return match;
- }
- return "'," + formatFn + "v[" + index + "]" + args + "),'";
- } else {
- return "',v[" + index + "] == undefined ? '' : v[" + index + "],'";
- }
- },
-
- insertFirst: function(el, values, returnElement) {
- return this.doInsert('afterBegin', el, values, returnElement);
- },
-
- insertBefore: function(el, values, returnElement) {
- return this.doInsert('beforeBegin', el, values, returnElement);
- },
-
- insertAfter: function(el, values, returnElement) {
- return this.doInsert('afterEnd', el, values, returnElement);
- },
-
- append: function(el, values, returnElement) {
- return this.doInsert('beforeEnd', el, values, returnElement);
- },
- doInsert: function(where, el, values, returnElement) {
- var newNode = Ext.DomHelper.insertHtml(where, Ext.getDom(el), this.apply(values));
- return returnElement ? Ext.get(newNode) : newNode;
- },
-
- overwrite: function(el, values, returnElement) {
- var newNode = Ext.DomHelper.overwrite(Ext.getDom(el), this.apply(values));
- return returnElement ? Ext.get(newNode) : newNode;
- }
- }, function(Template) {
- var formatRe = /\{\d+\}/,
- generateFormatFn = function(format) {
-
- if (formatRe.test(format)) {
- format = new Template(format, formatTplConfig);
- return function() {
- return format.apply(arguments);
- };
- } else
- {
- return function() {
- return format;
- };
- }
- },
-
-
-
- formatTplConfig = {
- useFormat: false,
- compiled: true,
- stringFormat: true
- },
- formatFns = {};
-
-
- Ext.String.format = Ext.util.Format.format = function(format) {
- var formatFn = formatFns[format] || (formatFns[format] = generateFormatFn(format));
- return formatFn.apply(this, arguments);
- };
- Ext.String.formatEncode = function() {
- return Ext.String.htmlEncode(Ext.String.format.apply(this, arguments));
- };
- });
- Ext.define('Ext.util.XTemplateParser', {
- constructor: function(config) {
- Ext.apply(this, config);
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- doTpl: Ext.emptyFn,
- parse: function(str) {
- var me = this,
- len = str.length,
- aliases = {
- elseif: 'elif'
- },
- topRe = me.topRe,
- actionsRe = me.actionsRe,
- index, stack, s, m, t, prev, frame, subMatch, begin, end, actions, prop, expectTplNext;
- me.level = 0;
- me.stack = stack = [];
- for (index = 0; index < len; index = end) {
- topRe.lastIndex = index;
- m = topRe.exec(str);
- if (!m) {
- me.doText(str.substring(index, len));
- break;
- }
- begin = m.index;
- end = topRe.lastIndex;
- if (index < begin) {
-
-
-
- s = str.substring(index, begin);
- if (!(expectTplNext && Ext.String.trim(s) === '')) {
- me.doText(s);
- }
- }
- expectTplNext = false;
- if (m[1]) {
- end = str.indexOf('%}', begin + 2);
- me.doEval(str.substring(begin + 2, end));
- end += 2;
- } else if (m[2]) {
- end = str.indexOf(']}', begin + 2);
- me.doExpr(str.substring(begin + 2, end));
- end += 2;
- } else if (m[3]) {
-
- me.doTag(m[3]);
- } else if (m[4]) {
-
- actions = null;
- while ((subMatch = actionsRe.exec(m[4])) !== null) {
- s = subMatch[2] || subMatch[3];
- if (s) {
- s = Ext.String.htmlDecode(s);
-
- t = subMatch[1];
- t = aliases[t] || t;
- actions = actions || {};
- prev = actions[t];
- if (typeof prev == 'string') {
- actions[t] = [
- prev,
- s
- ];
- } else if (prev) {
- actions[t].push(s);
- } else {
- actions[t] = s;
- }
- }
- }
- if (!actions) {
- if (me.elseRe.test(m[4])) {
- me.doElse();
- } else if (me.defaultRe.test(m[4])) {
- me.doDefault();
- } else {
- me.doTpl();
- stack.push({
- type: 'tpl'
- });
- }
- } else if (actions['if']) {
- me.doIf(actions['if'], actions);
- stack.push({
- type: 'if'
- });
- } else if (actions['switch']) {
- me.doSwitch(actions['switch'], actions);
- stack.push({
- type: 'switch'
- });
- expectTplNext = true;
- } else if (actions['case']) {
- me.doCase(actions['case'], actions);
- } else if (actions['elif']) {
- me.doElseIf(actions['elif'], actions);
- } else if (actions['for']) {
- ++me.level;
-
- if (prop = me.propRe.exec(m[4])) {
- actions.propName = prop[1] || prop[2];
- }
- me.doFor(actions['for'], actions);
- stack.push({
- type: 'for',
- actions: actions
- });
- } else if (actions['foreach']) {
- ++me.level;
-
- if (prop = me.propRe.exec(m[4])) {
- actions.propName = prop[1] || prop[2];
- }
- me.doForEach(actions['foreach'], actions);
- stack.push({
- type: 'foreach',
- actions: actions
- });
- } else if (actions.exec) {
- me.doExec(actions.exec, actions);
- stack.push({
- type: 'exec',
- actions: actions
- });
- }
- }
-
- else if (m[0].length === 5) {
-
-
- stack.push({
- type: 'tpl'
- });
- } else {
- frame = stack.pop();
- me.doEnd(frame.type, frame.actions);
- if (frame.type == 'for' || frame.type == 'foreach') {
- --me.level;
- }
- }
- }
- },
-
- topRe: /(?:(\{\%)|(\{\[)|\{([^{}]+)\})|(?:<tpl([^>]*)\>)|(?:<\/tpl>)/g,
- actionsRe: /\s*(elif|elseif|if|for|foreach|exec|switch|case|eval|between)\s*\=\s*(?:(?:"([^"]*)")|(?:'([^']*)'))\s*/g,
- propRe: /prop=(?:(?:"([^"]*)")|(?:'([^']*)'))/,
- defaultRe: /^\s*default\s*$/,
- elseRe: /^\s*else\s*$/
- });
- Ext.define('Ext.util.XTemplateCompiler', {
- extend: Ext.util.XTemplateParser,
-
-
-
- useEval: Ext.isGecko,
-
-
-
- useIndex: Ext.isIE8m,
- useFormat: true,
- propNameRe: /^[\w\d\$]*$/,
- compile: function(tpl) {
- var me = this,
- code = me.generate(tpl);
-
-
-
-
- return me.useEval ? me.evalTpl(code) : (new Function('Ext', code))(Ext);
- },
- generate: function(tpl) {
- var me = this,
-
- definitions = 'var fm=Ext.util.Format,ts=Object.prototype.toString;',
- code;
-
- me.maxLevel = 0;
- me.body = [
- 'var c0=values, a0=' + me.createArrayTest(0) + ', p0=parent, n0=xcount, i0=xindex, k0, v;\n'
- ];
- if (me.definitions) {
- if (typeof me.definitions === 'string') {
- me.definitions = [
- me.definitions,
- definitions
- ];
- } else {
- me.definitions.push(definitions);
- }
- } else {
- me.definitions = [
- definitions
- ];
- }
- me.switches = [];
- me.parse(tpl);
- me.definitions.push((me.useEval ? '$=' : 'return') + ' function (' + me.fnArgs + ') {', me.body.join(''), '}');
- code = me.definitions.join('\n');
-
- me.definitions.length = me.body.length = me.switches.length = 0;
- me.definitions = me.body = me.switches = 0;
- return code;
- },
-
-
- doText: function(text) {
- var me = this,
- out = me.body;
- text = text.replace(me.aposRe, "\\'").replace(me.newLineRe, '\\n');
- if (me.useIndex) {
- out.push('out[out.length]=\'', text, '\'\n');
- } else {
- out.push('out.push(\'', text, '\')\n');
- }
- },
- doExpr: function(expr) {
- var out = this.body;
- out.push('if ((v=' + expr + ') != null) out');
-
-
- if (this.useIndex) {
- out.push('[out.length]=v\n');
- } else {
- out.push('.push(v)\n');
- }
- },
- doTag: function(tag) {
- var expr = this.parseTag(tag);
- if (expr) {
- this.doExpr(expr);
- } else {
-
- this.doText('{' + tag + '}');
- }
- },
- doElse: function() {
- this.body.push('} else {\n');
- },
- doEval: function(text) {
- this.body.push(text, '\n');
- },
- doIf: function(action, actions) {
- var me = this;
-
- if (action === '.') {
- me.body.push('if (values) {\n');
- } else if (me.propNameRe.test(action)) {
- me.body.push('if (', me.parseTag(action), ') {\n');
- } else
- {
- me.body.push('if (', me.addFn(action), me.callFn, ') {\n');
- }
- if (actions.exec) {
- me.doExec(actions.exec);
- }
- },
- doElseIf: function(action, actions) {
- var me = this;
-
- if (action === '.') {
- me.body.push('else if (values) {\n');
- } else if (me.propNameRe.test(action)) {
- me.body.push('} else if (', me.parseTag(action), ') {\n');
- } else
- {
- me.body.push('} else if (', me.addFn(action), me.callFn, ') {\n');
- }
- if (actions.exec) {
- me.doExec(actions.exec);
- }
- },
- doSwitch: function(action) {
- var me = this,
- key;
-
- if (action === '.' || action === '#') {
- key = action === '.' ? 'values' : 'xindex';
- me.body.push('switch (', key, ') {\n');
- } else if (me.propNameRe.test(action)) {
- me.body.push('switch (', me.parseTag(action), ') {\n');
- } else
- {
- me.body.push('switch (', me.addFn(action), me.callFn, ') {\n');
- }
- me.switches.push(0);
- },
- doCase: function(action) {
- var me = this,
- cases = Ext.isArray(action) ? action : [
- action
- ],
- n = me.switches.length - 1,
- match, i;
- if (me.switches[n]) {
- me.body.push('break;\n');
- } else {
- me.switches[n]++;
- }
- for (i = 0 , n = cases.length; i < n; ++i) {
- match = me.intRe.exec(cases[i]);
- cases[i] = match ? match[1] : ("'" + cases[i].replace(me.aposRe, "\\'") + "'");
- }
- me.body.push('case ', cases.join(': case '), ':\n');
- },
- doDefault: function() {
- var me = this,
- n = me.switches.length - 1;
- if (me.switches[n]) {
- me.body.push('break;\n');
- } else {
- me.switches[n]++;
- }
- me.body.push('default:\n');
- },
- doEnd: function(type, actions) {
- var me = this,
- L = me.level - 1;
- if (type == 'for' || type == 'foreach') {
-
- if (actions.exec) {
- me.doExec(actions.exec);
- }
- me.body.push('}\n');
- me.body.push('parent=p', L, ';values=r', L + 1, ';xcount=n' + L + ';xindex=i', L, '+1;xkey=k', L, ';\n');
- } else if (type == 'if' || type == 'switch') {
- me.body.push('}\n');
- }
- },
- doFor: function(action, actions) {
- var me = this,
- s,
- L = me.level,
- up = L - 1,
- parentAssignment;
-
- if (action === '.') {
- s = 'values';
- } else if (me.propNameRe.test(action)) {
- s = me.parseTag(action);
- } else
- {
- s = me.addFn(action) + me.callFn;
- }
-
-
- if (me.maxLevel < L) {
- me.maxLevel = L;
- me.body.push('var ');
- }
- if (action == '.') {
- parentAssignment = 'c' + L;
- } else {
- parentAssignment = 'a' + up + '?c' + up + '[i' + up + ']:c' + up;
- }
- me.body.push('i', L, '=0,n', L, '=0,c', L, '=', s, ',a', L, '=', me.createArrayTest(L), ',r', L, '=values,p', L, ',k', L, ';\n', 'p', L, '=parent=', parentAssignment, '\n', 'if (c', L, '){if(a', L, '){n', L, '=c', L, '.length;}else if (c', L, '.isMixedCollection){c', L, '=c', L, '.items;n', L, '=c', L, '.length;}else if(c', L, '.isStore){c', L, '=c', L, '.data.items;n', L, '=c', L, '.length;}else{c', L, '=[c', L, '];n', L, '=1;}}\n', 'for (xcount=n', L, ';i', L, '<n' + L + ';++i', L, '){\n', 'values=c', L, '[i', L, ']');
- if (actions.propName) {
- me.body.push('.', actions.propName);
- }
- me.body.push('\n', 'xindex=i', L, '+1\n');
- if (actions.between) {
- me.body.push('if(xindex>1){ out.push("', actions.between, '"); } \n');
- }
- },
- doForEach: function(action, actions) {
- var me = this,
- s,
- L = me.level,
- up = L - 1,
- parentAssignment;
-
- if (action === '.') {
- s = 'values';
- } else if (me.propNameRe.test(action)) {
- s = me.parseTag(action);
- } else
- {
- s = me.addFn(action) + me.callFn;
- }
-
-
- if (me.maxLevel < L) {
- me.maxLevel = L;
- me.body.push('var ');
- }
- if (action == '.') {
- parentAssignment = 'c' + L;
- } else {
- parentAssignment = 'a' + up + '?c' + up + '[i' + up + ']:c' + up;
- }
- me.body.push('i', L, '=-1,n', L, '=0,c', L, '=', s, ',a', L, '=', me.createArrayTest(L), ',r', L, '=values,p', L, ',k', L, ';\n', 'p', L, '=parent=', parentAssignment, '\n', 'for(k', L, ' in c', L, '){\n', 'xindex=++i', L, '+1;\n', 'xkey=k', L, ';\n', 'values=c', L, '[k', L, '];');
- if (actions.propName) {
- me.body.push('.', actions.propName);
- }
- if (actions.between) {
- me.body.push('if(xindex>1){ out.push("', actions.between, '"); } \n');
- }
- },
- createArrayTest: ('isArray' in Array) ? function(L) {
- return 'Array.isArray(c' + L + ')';
- } : function(L) {
- return 'ts.call(c' + L + ')==="[object Array]"';
- },
- doExec: function(action, actions) {
- var me = this,
- name = 'f' + me.definitions.length,
- guards = me.guards[me.strict ? 0 : 1];
- me.definitions.push('function ' + name + '(' + me.fnArgs + ') {', guards.doTry, ' var $v = values; with($v) {', ' ' + action, ' }', guards.doCatch, '}');
- me.body.push(name + me.callFn + '\n');
- },
-
-
- guards: [
- {
- doTry: '',
- doCatch: ''
- },
- {
- doTry: 'try { ',
- doCatch: ' } catch(e) {\n' +
- 'Ext.log.warn("XTemplate evaluation exception: " + e.message);\n' +
- '}'
- }
- ],
- addFn: function(body) {
- var me = this,
- name = 'f' + me.definitions.length,
- guards = me.guards[me.strict ? 0 : 1];
- if (body === '.') {
- me.definitions.push('function ' + name + '(' + me.fnArgs + ') {', ' return values', '}');
- } else if (body === '..') {
- me.definitions.push('function ' + name + '(' + me.fnArgs + ') {', ' return parent', '}');
- } else {
- me.definitions.push('function ' + name + '(' + me.fnArgs + ') {', guards.doTry, ' var $v = values; with($v) {', ' return(' + body + ')', ' }', guards.doCatch, '}');
- }
- return name;
- },
- parseTag: function(tag) {
- var me = this,
- m = me.tagRe.exec(tag),
- name, format, args, math, v;
- if (!m) {
- return null;
- }
- name = m[1];
- format = m[2];
- args = m[3];
- math = m[4];
-
- if (name == '.') {
-
- if (!me.validTypes) {
- me.definitions.push('var validTypes={string:1,number:1,boolean:1};');
- me.validTypes = true;
- }
- v = 'validTypes[typeof values] || ts.call(values) === "[object Date]" ? values : ""';
- }
-
- else if (name == '#') {
- v = 'xindex';
- }
-
- else if (name == '$') {
- v = 'xkey';
- } else if (name.substr(0, 7) == "parent.") {
- v = name;
- }
-
- else if (isNaN(name) && name.indexOf('-') == -1 && name.indexOf('.') != -1) {
- v = "values." + name;
- } else
-
- {
- v = "values['" + name + "']";
- }
- if (math) {
- v = '(' + v + math + ')';
- }
- if (format && me.useFormat) {
- args = args ? ',' + args : "";
- if (format.substr(0, 5) != "this.") {
- format = "fm." + format + '(';
- } else {
- format += '(';
- }
- } else {
- return v;
- }
- return format + v + args + ')';
- },
-
- evalTpl: function($) {
-
-
-
-
- eval($);
- return $;
- },
- newLineRe: /\r\n|\r|\n/g,
- aposRe: /[']/g,
- intRe: /^\s*(\d+)\s*$/,
- tagRe: /^([\w-\.\#\$]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\/]\s?[\d\.\+\-\*\/\(\)]+)?$/
- }, function() {
- var proto = this.prototype;
- proto.fnArgs = 'out,values,parent,xindex,xcount,xkey';
- proto.callFn = '.call(this,' + proto.fnArgs + ')';
- });
- Ext.define('Ext.XTemplate', {
- extend: Ext.Template,
- isXTemplate: true,
-
- emptyObj: {},
-
-
-
- fn: null,
-
- strict: false,
- apply: function(values, parent, xindex, xcount) {
- var buffer = this.applyOut(values, [], parent, xindex, xcount);
-
-
-
- return buffer.length === 1 ? buffer[0] : buffer.join('');
- },
- applyOut: function(values, out, parent, xindex, xcount) {
- var me = this,
- compiler;
- if (!me.fn) {
- compiler = new Ext.util.XTemplateCompiler({
- useFormat: me.disableFormats !== true,
- definitions: me.definitions,
- strict: me.strict
- });
- me.fn = compiler.compile(me.html);
- }
-
- xindex = xindex || 1;
-
- xcount = xcount || 1;
- if (me.strict) {
- me.fn(out, values, parent || me.emptyObj, xindex, xcount);
- } else {
- try {
- me.fn(out, values, parent || me.emptyObj, xindex, xcount);
- } catch (e) {
-
- Ext.log.warn('XTemplate evaluation exception: ' + e.message);
- }
- }
-
- return out;
- },
-
- compile: function() {
- return this;
- },
- statics: {
- get: function(config, source, defaultTpl) {
- var ret = config;
- if (config == null) {
- if (source && defaultTpl) {
- ret = this.getTpl(source, defaultTpl);
- }
- } else if ((config || config === '') && !config.isTemplate) {
- ret = new this(config);
- }
- return ret;
- },
-
- getTpl: function(instance, name) {
- var tpl = instance[name],
-
- owner;
- if (tpl) {
-
- if (!tpl.isTemplate) {
-
- tpl = Ext.XTemplate.get(tpl);
- }
- if (!tpl.owner) {
-
- if (instance.hasOwnProperty(name)) {
-
- owner = instance;
- } else {
-
- for (owner = instance.self.prototype; owner && !owner.hasOwnProperty(name); owner = owner.superclass) {}
- }
- owner[name] = tpl;
- tpl.owner = owner;
- }
- }
-
-
- return tpl || null;
- }
- }
- });
- Ext.define('Ext.util.translatable.Dom', {
- extend: Ext.util.translatable.Abstract,
- alias: 'translatable.dom',
-
- config: {
- element: null
- },
- applyElement: function(element) {
- if (!element) {
- return;
- }
- return Ext.get(element);
- },
- updateElement: function() {
- this.refresh();
- }
- });
- Ext.define('Ext.util.translatable.CssPosition', {
- extend: Ext.util.translatable.Dom,
- alias: 'translatable.cssposition',
-
- doTranslate: function(x, y) {
- var domStyle = this.getElement().dom.style;
- if (typeof x === 'number') {
- domStyle.left = x + 'px';
- }
- if (typeof y === 'number') {
- domStyle.top = y + 'px';
- }
- this.callParent([
- x,
- y
- ]);
- },
- syncPosition: function() {
- var domStyle = this.getElement().dom.style;
- return [
- this.x = parseFloat(domStyle.left),
- this.y = parseFloat(domStyle.top)
- ];
- },
- destroy: function() {
- var domStyle = this.getElement().dom.style;
- domStyle.left = null;
- domStyle.top = null;
- this.callParent();
- }
- });
- Ext.define('Ext.util.translatable.CssTransform', {
- extend: Ext.util.translatable.Dom,
- alias: 'translatable.csstransform',
-
- isCssTransform: true,
- posRegex: /(\d+)px[^\d]*(\d+)px/,
- doTranslate: function(x, y) {
- var me = this,
- element = me.getElement();
- if (!me.destroyed && !element.destroyed) {
- element.translate(x, y);
- }
- me.callParent([
- x,
- y
- ]);
- },
- syncPosition: function() {
- var pos = this.posRegex.exec(this.getElement().dom.style.tranform);
- if (pos) {
- this.x = parseFloat(pos[1]);
- this.y = parseFloat(pos[2]);
- }
- return [
- this.x,
- this.y
- ];
- },
- destroy: function() {
- var element = this.getElement();
- if (element && !element.destroyed) {
- element.dom.style.webkitTransform = null;
- }
- this.callParent();
- }
- });
- Ext.define('Ext.util.CSS', function() {
- var CSS,
- rules = null,
- doc = document,
- camelRe = /(-[a-z])/gi,
- camelFn = function(m, a) {
- return a.charAt(1).toUpperCase();
- };
- return {
- singleton: true,
- rules: rules,
- initialized: false,
-
- constructor: function() {
-
- CSS = this;
- },
-
- createStyleSheet: function(cssText, id) {
- var ss,
- head = doc.getElementsByTagName('head')[0],
- styleEl = doc.createElement('style');
- styleEl.setAttribute('type', 'text/css');
- if (id) {
- styleEl.setAttribute('id', id);
- }
-
- ss = styleEl.styleSheet;
- if (ss) {
- head.appendChild(styleEl);
- ss.cssText = cssText;
- } else {
- styleEl.appendChild(doc.createTextNode(cssText));
- head.appendChild(styleEl);
- ss = styleEl.sheet;
- }
- CSS.cacheStyleSheet(ss);
- return ss;
- },
-
- removeStyleSheet: function(stylesheet) {
- var styleEl = (typeof stylesheet === 'string') ? doc.getElementById(stylesheet) : stylesheet.ownerNode;
- if (styleEl) {
- styleEl.parentNode.removeChild(styleEl);
- }
- },
-
- swapStyleSheet: function(id, url) {
- var ss;
- CSS.removeStyleSheet(id);
- ss = doc.createElement("link");
- ss.setAttribute("rel", "stylesheet");
- ss.setAttribute("type", "text/css");
- ss.setAttribute("id", id);
- ss.setAttribute("href", url);
- doc.getElementsByTagName("head")[0].appendChild(ss);
- },
-
- cacheStyleSheet: function(ss) {
- if (!rules) {
- rules = CSS.rules = {};
- }
- try {
-
- var ssRules = ss.cssRules || ss.rules,
- i = ssRules.length - 1,
- imports = ss.imports,
- len = imports ? imports.length : 0,
- rule, j;
-
- for (j = 0; j < len; ++j) {
- CSS.cacheStyleSheet(imports[j]);
- }
- for (; i >= 0; --i) {
- rule = ssRules[i];
-
- if (rule.styleSheet) {
- CSS.cacheStyleSheet(rule.styleSheet);
- }
- CSS.cacheRule(rule, ss);
- }
- } catch (e) {}
- },
- cacheRule: function(cssRule, styleSheet) {
-
- if (cssRule.styleSheet) {
- return CSS.cacheStyleSheet(cssRule.styleSheet);
- }
- var selectorText = cssRule.selectorText,
- selectorCount, j;
- if (selectorText) {
-
- selectorText = selectorText.split(',');
- selectorCount = selectorText.length;
- for (j = 0; j < selectorCount; j++) {
-
-
- rules[Ext.String.trim(selectorText[j]).toLowerCase()] = {
- parentStyleSheet: styleSheet,
- cssRule: cssRule
- };
- }
- }
- },
-
- getRules: function(refreshCache) {
- var result = {},
- selector;
- if (rules === null || refreshCache) {
- CSS.refreshCache();
- }
- for (selector in rules) {
- result[selector] = rules[selector].cssRule;
- }
- return result;
- },
-
- refreshCache: function() {
- var ds = doc.styleSheets,
- i = 0,
- len = ds.length;
- rules = CSS.rules = {};
- for (; i < len; i++) {
- try {
- if (!ds[i].disabled) {
- CSS.cacheStyleSheet(ds[i]);
- }
- } catch (e) {}
- }
- },
-
- getRule: function(selector, refreshCache, rawCache) {
- var i, result;
- if (!rules || refreshCache) {
- CSS.refreshCache();
- }
- if (!Ext.isArray(selector)) {
- result = rules[selector.toLowerCase()];
- if (result && !rawCache) {
- result = result.cssRule;
- }
- return result || null;
- }
- for (i = 0; i < selector.length; i++) {
- if (rules[selector[i]]) {
- return rawCache ? rules[selector[i].toLowerCase()] : rules[selector[i].toLowerCase()].cssRule;
- }
- }
- return null;
- },
-
- createRule: function(styleSheet, selector, cssText) {
- var result,
- ruleSet = styleSheet.cssRules || styleSheet.rules,
- index = ruleSet.length;
- if (styleSheet.insertRule) {
- styleSheet.insertRule(selector + ' {' + cssText + '}', index);
- } else {
- styleSheet.addRule(selector, cssText || ' ');
- }
- CSS.cacheRule(result = ruleSet[index], styleSheet);
- return result;
- },
-
- updateRule: function(selector, property, value) {
- var rule, i, styles;
- if (!Ext.isArray(selector)) {
- rule = CSS.getRule(selector);
- if (rule) {
-
- if (arguments.length === 2) {
- styles = Ext.Element.parseStyles(property);
- for (property in styles) {
- rule.style[property.replace(camelRe, camelFn)] = styles[property];
- }
- } else {
- rule.style[property.replace(camelRe, camelFn)] = value;
- }
- return true;
- }
- } else {
- for (i = 0; i < selector.length; i++) {
- if (CSS.updateRule(selector[i], property, value)) {
- return true;
- }
- }
- }
- return false;
- },
- deleteRule: function(selector) {
- var rule = CSS.getRule(selector, false, true),
- styleSheet, index;
- if (rule) {
- styleSheet = rule.parentStyleSheet;
- index = Ext.Array.indexOf(styleSheet.cssRules || styleSheet.rules, rule.cssRule);
- if (styleSheet.deleteRule) {
- styleSheet.deleteRule(index);
- } else {
- styleSheet.removeRule(index);
- }
- delete rules[selector];
- }
- }
- };
- });
- Ext.define('Ext.util.translatable.ScrollPosition', {
- extend: Ext.util.translatable.Dom,
- alias: 'translatable.scrollposition',
-
- constructor: function(config) {
- if (config && config.element) {
- this.x = config.element.getScrollLeft();
- this.y = config.element.getScrollTop();
- }
- this.callParent([
- config
- ]);
- },
- translateAnimated: function() {
- var element = this.getElement();
- this.x = element.getScrollLeft();
- this.y = element.getScrollTop();
- this.callParent(arguments);
- },
- doTranslate: function(x, y) {
- var element = this.getElement();
- element.setScrollLeft(Math.round(x));
- element.setScrollTop(Math.round(y));
- },
- getPosition: function() {
- var me = this,
- position = me.position,
- element = me.getElement();
- position.x = element.getScrollLeft();
- position.y = element.getScrollTop();
- return position;
- }
- });
- Ext.define('Ext.scroll.Scroller', {
- extend: Ext.Evented,
- alias: 'scroller.scroller',
- mixins: [
- Ext.mixin.Factoryable,
- Ext.mixin.Bufferable
- ],
- factoryConfig: {
- defaultType: 'scroller'
- },
- bufferableMethods: {
- onDomScrollEnd: 100
- },
- isScroller: true,
-
-
-
-
- config: {
-
- direction: undefined,
-
-
- element: undefined,
-
- scrollbars: null,
-
- snapSelector: null,
-
- snapOffset: null,
-
- msSnapInterval: null,
-
- x: true,
-
- y: true,
-
- scrollElement: null,
-
- size: null,
- spacerXY: null,
-
- touchAction: null
- },
- snappableCls: Ext.baseCSSPrefix + 'scroller-snappable',
- elementCls: Ext.baseCSSPrefix + 'scroller',
- spacerCls: Ext.baseCSSPrefix + 'scroller-spacer',
- noScrollbarsCls: Ext.baseCSSPrefix + 'no-scrollbars',
- statics: {
-
- create: function(config, type) {
- return Ext.Factory.scroller(config, type);
- },
-
- getScrollingElement: function() {
- var doc = document,
- standard = this.$standardScrollElement,
- el = doc.scrollingElement,
- iframe, frameDoc;
-
-
-
- if (el) {
- return el;
- }
-
-
- if (standard === undefined) {
- iframe = document.createElement('iframe');
- iframe.style.height = '1px';
- document.body.appendChild(iframe);
- frameDoc = iframe.contentWindow.document;
- frameDoc.write('<!DOCTYPE html><div style="height:9999em">x</div>');
- frameDoc.close();
- standard = frameDoc.documentElement.scrollHeight > frameDoc.body.scrollHeight;
- iframe.parentNode.removeChild(iframe);
- this.$standardScrollElement = standard;
- }
- return standard ? doc.documentElement : doc.body;
- },
-
- initViewportScroller: function() {
- var scroller = Ext.getViewportScroller();
- if (!scroller.getElement()) {
-
-
-
- scroller.setElement(Ext.getBody());
- }
- }
- },
- constructor: function(config) {
- var me = this;
- me.position = {
- x: 0,
- y: 0
- };
- me.callParent([
- config
- ]);
- },
- destroy: function() {
- var me = this,
- partners = me._partners,
- key;
- Ext.undefer(me.restoreTimer);
-
- me.setX(Ext.emptyString);
- me.setY(Ext.emptyString);
- if (me._spacer) {
- me._spacer.destroy();
- }
- if (me.scrollListener) {
- me.scrollListener.destroy();
- }
- if (partners) {
- for (key in partners) {
- me.removePartner(partners[key].scroller);
- }
- }
-
-
- me.setElement(null);
- me._partners = me.component = null;
- if (me.translatable) {
- me.translatable.destroy();
- me.translatable = null;
- }
- me.removeSnapStylesheet();
- me.callParent();
- },
-
- addPartner: function(partner, axis) {
- var me = this,
- partners = me._partners || (me._partners = {}),
- otherPartners = partner._partners || (partner._partners = {});
-
- axis = me.axisConfigs[axis || 'both'];
- partners[partner.getId()] = {
- scroller: partner,
- axes: axis
- };
- otherPartners[me.getId()] = {
- scroller: me,
- axes: axis
- };
- },
- applyElement: function(element, oldElement) {
- var me = this;
- if (oldElement && me.scrollListener) {
- me.scrollListener.destroy();
- }
- if (element) {
-
- if (typeof element === 'string' && !Ext.get(element)) {
- Ext.raise("Cannot create Ext.scroll.Scroller instance. " + "Element with id '" + element + "' not found.");
- }
-
- element = Ext.get(element);
- }
- return element;
- },
- applySize: function(size, oldSize) {
- var x, y;
- if (size === null || typeof size === 'number') {
- x = y = size;
- } else if (size) {
- x = size.x;
- y = size.y;
- }
- if (x === null) {
- x = 0;
- } else if (x === undefined) {
- x = (oldSize ? oldSize.x : 0);
- }
- if (y === null) {
- y = 0;
- } else if (y === undefined) {
- y = (oldSize ? oldSize.y : 0);
- }
- if (!oldSize || x !== oldSize.x || y !== oldSize.y) {
- return {
- x: x,
- y: y
- };
- }
- },
-
- getClientSize: function() {
- var dom = this.getElement().dom;
- return {
- x: dom.clientWidth,
- y: dom.clientHeight
- };
- },
-
- getScrollbarSize: function() {
- var me = this,
- width = 0,
- height = 0,
- element = me.getElement(),
- dom, x, y, hasXScroll, hasYScroll, scrollbarSize;
- if (element && !element.destroyed) {
- x = me.getX();
- y = me.getY();
- dom = element.dom;
- if (x || y) {
- scrollbarSize = Ext.getScrollbarSize();
- }
- if (x === 'scroll') {
- hasXScroll = true;
- } else if (x) {
- hasXScroll = dom.scrollWidth > dom.clientWidth;
- }
- if (y === 'scroll') {
- hasYScroll = true;
- } else if (y) {
- hasYScroll = dom.scrollHeight > dom.clientHeight;
- }
- if (hasXScroll) {
- height = scrollbarSize.height;
- }
- if (hasYScroll) {
- width = scrollbarSize.width;
- }
- }
- return {
- width: width,
- height: height
- };
- },
-
- getPosition: function() {
- var me = this;
- if (me.positionDirty) {
- me.updateDomScrollPosition();
- }
- return me.position;
- },
-
- getSize: function() {
- var element = this.getElement(),
- size, dom;
- if (element && !element.destroyed) {
- dom = element.dom;
- size = {
- x: dom.scrollWidth,
- y: dom.scrollHeight
- };
- } else {
- size = {
- x: 0,
- y: 0
- };
- }
- return size;
- },
-
- getMaxPosition: function() {
- var element = this.getElement(),
- x = 0,
- y = 0,
- dom;
- if (element && !element.destroyed) {
- dom = element.dom;
- x = dom.scrollWidth - dom.clientWidth;
- y = dom.scrollHeight - dom.clientHeight;
- }
- return {
- x: x,
- y: y
- };
- },
-
- getMaxUserPosition: function() {
- var me = this,
- element = me.getElement(),
- x = 0,
- y = 0,
- dom;
- if (element && !element.destroyed) {
- dom = element.dom;
- if (me.getX()) {
- x = dom.scrollWidth - dom.clientWidth;
- }
- if (me.getY()) {
- y = dom.scrollHeight - dom.clientHeight;
- }
- }
- return {
- x: x,
- y: y
- };
- },
-
- refresh: function() {
-
-
- this.positionDirty = true;
- this.fireEvent('refresh', this);
- return this;
- },
-
- removePartner: function(partner) {
- var partners = this._partners,
- otherPartners = partner._partners;
- if (partners) {
- delete partners[partner.getId()];
- }
- if (otherPartners) {
- delete (otherPartners[this.getId()]);
- }
- },
-
- scrollBy: function(deltaX, deltaY, animate) {
- var position = this.getPosition();
- if (deltaX) {
- if (deltaX.length) {
-
- animate = deltaY;
- deltaY = deltaX[1];
- deltaX = deltaX[0];
- } else if (typeof deltaX !== 'number') {
-
- animate = deltaY;
- deltaY = deltaX.y;
- deltaX = deltaX.x;
- }
- }
- deltaX = (typeof deltaX === 'number') ? deltaX + position.x : null;
- deltaY = (typeof deltaY === 'number') ? deltaY + position.y : null;
- return this.doScrollTo(deltaX, deltaY, animate);
- },
-
- ensureVisible: function(el, options) {
- var me = this,
- position = me.getPosition(),
- highlight, newPosition, ret;
-
- if (el) {
- if (el && el.element && !el.isElement) {
- options = el;
- el = options.element;
- }
- options = options || {};
- highlight = options.highlight;
- newPosition = me.getEnsureVisibleXY(el, options);
-
- if (newPosition.y !== position.y || newPosition.x !== position.x) {
- if (highlight) {
- me.on({
- scrollend: 'doHighlight',
- scope: me,
- single: true,
- args: [
- el,
- highlight
- ]
- });
- }
- ret = me.doScrollTo(newPosition.x, newPosition.y, options.animation);
- } else {
-
- if (highlight) {
- me.doHighlight(el, highlight);
- }
-
- ret = Ext.Deferred.getCachedResolved();
- }
- } else {
-
- ret = Ext.Deferred.getCachedRejected();
- }
- return ret;
- },
-
- scrollIntoView: function(el, hscroll, animate, highlight) {
- return this.ensureVisible(el, {
- animation: animate,
- highlight: highlight,
- x: hscroll
- });
- },
-
- isInView: function(el) {
- return this.doIsInView(el);
- },
-
- scrollTo: function(x, y, animation) {
- var maxPosition;
- if (x) {
- if (x.length) {
-
- animation = y;
- y = x[1];
- x = x[0];
- } else if (typeof x !== 'number') {
-
- animation = y;
- y = x.y;
- x = x.x;
- }
- }
- if (x < 0 || y < 0) {
- maxPosition = this.getMaxPosition();
- if (x < 0) {
- x += maxPosition.x;
- }
- if (y < 0) {
- y += maxPosition.y;
- }
- }
- return this.doScrollTo(x, y, animation);
- },
- updateDirection: function(direction) {
- var me = this,
- x, y;
- if (!direction) {
-
-
-
- x = me.getX();
- y = me.getY();
- if (x && y) {
- direction = (y === 'scroll' && x === 'scroll') ? 'both' : 'auto';
- } else if (y) {
- direction = 'vertical';
- } else if (x) {
- direction = 'horizontal';
- }
-
-
- me._direction = direction;
- } else {
- if (direction === 'auto') {
- x = true;
- y = true;
- } else if (direction === 'vertical') {
- x = false;
- y = true;
- } else if (direction === 'horizontal') {
- x = true;
- y = false;
- } else if (direction === 'both') {
- x = 'scroll';
- y = 'scroll';
- }
- me.setX(x);
- me.setY(y);
- }
- },
- updateScrollbars: function(scrollbars, oldScrollbars) {
- this.syncScrollbarCls();
- },
- updateSize: function(size) {
- var me = this,
- element = me.getElement(),
- x = size.x,
- y = size.y,
- spacer;
- if (element) {
- me.positionDirty = true;
- spacer = me.getSpacer();
-
-
-
-
- if (!x && !y) {
- spacer.hide();
- } else {
-
- if (x > 0) {
- x -= 1;
- }
- if (y > 0) {
- y -= 1;
- }
- me.setSpacerXY({
- x: x,
- y: y
- });
- spacer.show();
- }
- }
- },
- updateMsSnapInterval: function() {
- this.initMsSnapInterval();
- },
- updateSnapSelector: function() {
- this.initSnap();
- },
- updateSnapOffset: function() {
- this.initSnap();
- },
- updateTouchAction: function(touchAction) {
- var element = this.getElement();
- if (element) {
- element.setTouchAction(touchAction);
- }
- },
- updateElement: function(element, oldElement) {
- var me = this,
- touchAction = me.getTouchAction(),
- scrollListener = me.scrollListener,
- elementCls = me.elementCls,
- eventSource, scrollEl;
-
- if (scrollListener) {
- scrollListener.destroy();
- me.scrollListener = null;
- me.setScrollElement(null);
- }
- if (oldElement && !oldElement.destroyed) {
-
- oldElement.setStyle('overflow', 'hidden');
- oldElement.removeCls(elementCls);
- }
- if (element) {
- if (element.dom === document.documentElement || element.dom === document.body) {
-
-
- eventSource = Ext.getWin();
- scrollEl = Ext.scroll.Scroller.getScrollingElement();
- } else {
- scrollEl = eventSource = element;
- }
- me.setScrollElement(Ext.get(scrollEl));
- me.scrollListener = eventSource.on({
- scroll: me.onDomScroll,
- scope: me,
- destroyable: true
- });
- if (touchAction) {
- element.setTouchAction(touchAction);
- }
- me.initXStyle();
- me.initYStyle();
- element.addCls(elementCls);
- me.initSnap();
- me.initMsSnapInterval();
- me.syncScrollbarCls();
- }
- },
- updateX: function(x) {
- this.initXStyle();
- },
- updateY: function(y) {
- this.initYStyle();
- },
- deprecated: {
- '5': {
- methods: {
-
- getScroller: function() {
- return this;
- }
- }
- },
- '5.1.0': {
- methods: {
-
- scrollToTop: function(animate) {
- return this.scrollTo(0, 0, animate);
- },
-
- scrollToEnd: function(animate) {
- return this.scrollTo(Infinity, Infinity, animate);
- }
- }
- }
- },
- privates: {
- axisConfigs: {
- x: {
- x: true
- },
- y: {
- y: true
- },
- both: {
- x: true,
- y: true
- }
- },
-
- getEnsureVisibleXY: function(el, options) {
- var position = this.getPosition(),
- viewport = this.component ? this.component.getScrollableClientRegion() : this.getElement(),
- newPosition, align;
- if (el && el.element && !el.isElement) {
- options = el;
- el = options.element;
- }
- options = options || {};
- align = options.align;
- if (align) {
- if (Ext.isString(align)) {
- align = {
- x: options.x === false ? null : align,
- y: options.y === false ? null : align
- };
- } else if (Ext.isObject(align)) {
- if (align.x && options.x === false) {
- align.x = null;
- }
- if (align.y && options.y === false) {
- align.y = null;
- }
- }
- }
- newPosition = Ext.fly(el).getScrollIntoViewXY(viewport, position.x, position.y, align);
- newPosition.x = options.x === false ? position.x : newPosition.x;
- newPosition.y = options.y === false ? position.y : newPosition.y;
- return newPosition;
- },
- getSpacer: function() {
- var me = this,
- spacer = me._spacer,
- element;
-
-
-
-
-
- if (!spacer) {
- element = me.getElement();
- spacer = me._spacer = element.createChild({
- cls: me.spacerCls,
- role: 'presentation'
- }, element.dom.firstChild);
- spacer.setVisibilityMode(2);
-
- spacer.hide();
-
-
- element.position();
- }
- return spacer;
- },
- applySpacerXY: function(pos, oldPos) {
-
- if (oldPos && pos.x === oldPos.x && pos.y === oldPos.y) {
- pos = undefined;
- }
- return pos;
- },
- updateSpacerXY: function(pos) {
- var me = this,
- spacer = me.getSpacer(),
- sStyle = spacer.dom.style,
- scrollHeight = pos.y,
- shortfall;
- sStyle.marginTop = '';
- me.translateSpacer(pos.x, me.constrainScrollRange(scrollHeight));
-
-
- sStyle.lineHeight = Number(!parseInt(sStyle.lineHeight, 10)) + 'px';
-
- if (scrollHeight > 1000000) {
- shortfall = scrollHeight - me.getElement().dom.scrollHeight;
- if (shortfall > 0) {
- sStyle.marginTop = Math.min(shortfall, me.maxSpacerMargin || 0) + 'px';
- }
- }
- },
-
- translateSpacer: function(x, y) {
- this.getSpacer().translate(x, y);
- },
- doIsInView: function(el, skipCheck) {
- var me = this,
- c = me.component,
- result = {
- x: false,
- y: false
- },
- elRegion,
- myEl = me.getElement(),
- myElRegion;
- if (el && (skipCheck || (myEl.contains(el) || (c && c.owns(el))))) {
- myElRegion = myEl.getRegion();
- elRegion = Ext.fly(el).getRegion();
- result.x = elRegion.right > myElRegion.left && elRegion.left < myElRegion.right;
- result.y = elRegion.bottom > myElRegion.top && elRegion.top < myElRegion.bottom;
- }
- return result;
- },
-
-
-
- contains: function(component) {
- var el = this.getElement(),
- owner = component;
- while (owner && owner !== Ext.Viewport) {
- if (el.contains(owner.el)) {
- return true;
- }
- owner = owner.getRefOwner();
- }
- return false;
- },
- constrainScrollRange: function(scrollRange) {
-
-
- if (scrollRange < 1000000) {
- return scrollRange;
- }
- if (!this.maxSpacerTranslate) {
-
-
-
-
-
-
-
- var maxScrollHeight = Math.pow(2, 32),
- tooHigh = maxScrollHeight,
- tooLow = 500,
- scrollTest = Ext.getBody().createChild({
- style: {
- position: 'absolute',
- left: '-10000px',
- top: '0',
- width: '500px',
- height: '500px'
- },
- cn: {
- cls: this.spacerCls
- }
- }, null, true),
- stretcher = Ext.get(scrollTest.firstChild),
- sStyle = stretcher.dom.style;
- stretcher.translate(0, maxScrollHeight - 1);
- sStyle.lineHeight = Number(!parseInt(sStyle.lineHeight, 10)) + 'px';
-
- while (tooHigh !== tooLow + 1) {
- stretcher.translate(0, (maxScrollHeight = tooLow + Math.floor((tooHigh - tooLow) / 2)));
-
-
- sStyle.lineHeight = Number(!parseInt(sStyle.lineHeight, 10)) + 'px';
- if (scrollTest.scrollHeight < maxScrollHeight) {
- tooHigh = maxScrollHeight;
- } else {
- tooLow = maxScrollHeight;
- }
- }
- stretcher.translate(0, Ext.scroll.Scroller.prototype.maxSpacerTranslate = tooLow);
-
- tooHigh = tooLow * 2;
- while (tooHigh !== tooLow + 1) {
- stretcher.dom.style.marginTop = ((maxScrollHeight = tooLow + Math.floor((tooHigh - tooLow) / 2))) + 'px';
-
-
- sStyle.lineHeight = Number(!parseInt(sStyle.lineHeight, 10)) + 'px';
- if (scrollTest.scrollHeight < maxScrollHeight) {
- tooHigh = maxScrollHeight;
- } else {
- tooLow = maxScrollHeight;
- }
- }
- Ext.fly(scrollTest).destroy();
- Ext.scroll.Scroller.prototype.maxSpacerMargin = tooLow - Ext.scroll.Scroller.prototype.maxSpacerTranslate;
- }
-
-
- return Math.min(scrollRange, this.maxSpacerTranslate);
- },
-
- convertX: function(x) {
- return x;
- },
-
- doHighlight: function(el, highlight) {
- if (highlight !== true) {
-
- Ext.fly(el).highlight(highlight);
- } else {
- Ext.fly(el).highlight();
- }
- },
- doScrollTo: function(x, y, animate) {
-
-
- var me = this,
- element = me.getScrollElement(),
- maxPosition, dom, xInf, yInf, ret, translatable, deferred;
- if (element && !element.destroyed) {
- dom = element.dom;
- xInf = (x === Infinity);
- yInf = (y === Infinity);
- if (xInf || yInf) {
- maxPosition = me.getMaxPosition();
- if (xInf) {
- x = maxPosition.x;
- }
- if (yInf) {
- y = maxPosition.y;
- }
- }
- if (x !== null) {
- x = me.convertX(x);
- }
- if (animate) {
- translatable = me.translatable;
- if (!translatable) {
- me.translatable = translatable = new Ext.util.translatable.ScrollPosition({
- element: element
- });
- }
- deferred = new Ext.Deferred();
-
- translatable.on('animationend', function() {
-
- if (me.destroyed) {
- deferred.reject();
- } else {
- deferred.resolve();
- }
- }, Ext.global, {
- single: true,
- onFrame: true
- });
- translatable.translate(x, y, animate);
- ret = deferred.promise;
- } else {
- if (y != null) {
- dom.scrollTop = y;
- }
- if (x != null) {
- dom.scrollLeft = x;
- }
- ret = Ext.Deferred.getCachedResolved();
- }
-
- me.positionDirty = true;
- } else {
- ret = Ext.Deferred.getCachedRejected();
- }
- return ret;
- },
- fireScrollStart: function(x, y, xDelta, yDelta) {
- var me = this,
- component = me.component;
- me.invokePartners('onPartnerScrollStart', x, y, xDelta, yDelta);
- me.startX = x - xDelta;
- me.startY = y - yDelta;
- if (me.hasListeners.scrollstart) {
- me.fireEvent('scrollstart', me, x, y);
- }
- if (component && component.onScrollStart) {
- component.onScrollStart(x, y);
- }
- Ext.GlobalEvents.fireEvent('scrollstart', me, x, y);
- },
- fireScroll: function(x, y, xDelta, yDelta) {
- var me = this,
- component = me.component;
- me.invokePartners('onPartnerScroll', x, y, xDelta, yDelta);
- if (me.hasListeners.scroll) {
- me.fireEvent('scroll', me, x, y, xDelta, yDelta);
- }
- if (component && component.onScrollMove) {
- component.onScrollMove(x, y);
- }
- Ext.GlobalEvents.fireEvent('scroll', me, x, y, xDelta, yDelta);
- },
- fireScrollEnd: function(x, y, xDelta, yDelta) {
- var me = this,
- component = me.component,
- dx = x - me.startX,
- dy = y - me.startY;
- me.startX = me.startY = null;
- me.invokePartners('onPartnerScrollEnd', x, y, xDelta, yDelta);
- if (me.hasListeners.scrollend) {
- me.fireEvent('scrollend', me, x, y, dx, dy);
- }
- if (component && component.onScrollEnd) {
- component.onScrollEnd(x, y);
- }
- Ext.GlobalEvents.fireEvent('scrollend', me, x, y, dx, dy);
- },
-
- getElementScroll: function(element) {
- return element.getScroll();
- },
- initSnap: function() {
- var me = this,
- snapOffset = me.getSnapOffset(),
- snapSelector = me.getSnapSelector(),
- element = me.getElement(),
- offsetX, offsetY, snapCoordinate;
- if (element && snapSelector) {
- element.addCls(me.snappableCls);
- me.removeSnapStylesheet();
- if (snapOffset) {
- offsetX = snapOffset.x || 0;
- offsetY = snapOffset.y || 0;
- if (offsetX) {
- offsetX = -offsetX + 'px';
- }
- if (offsetY) {
- offsetY = -offsetY + 'px';
- }
- }
- snapCoordinate = offsetX + ' ' + offsetY + ';';
- me.snapStylesheet = Ext.util.CSS.createStyleSheet('#' + element.id + ' ' + snapSelector + '{-webkit-scroll-snap-coordinate:' + snapCoordinate + 'scroll-snap-coordinate:' + snapCoordinate + '}');
- }
- },
- initMsSnapInterval: function() {
- var element = this.getElement(),
- interval, x, y, style;
- if (element) {
- interval = this.getMsSnapInterval();
- if (interval) {
- x = interval.x;
- y = interval.y;
- style = element.dom.style;
- if (x) {
- style['-ms-scroll-snap-points-x'] = 'snapInterval(0px, ' + x + 'px)';
- }
- if (y) {
- style['-ms-scroll-snap-points-y'] = 'snapInterval(0px, ' + y + 'px)';
- }
- }
- }
- },
- initXStyle: function() {
- var element = this.getElement(),
- x = this.getX();
-
- if (element && element.dom) {
- if (!x) {
- x = 'hidden';
- } else if (x === true) {
- x = 'auto';
- }
- element.setStyle('overflow-x', x);
- }
- },
- initYStyle: function() {
- var element = this.getElement(),
- y = this.getY();
-
- if (element && element.dom) {
- if (!y) {
- y = 'hidden';
- } else if (y === true) {
- y = 'auto';
- }
- element.setStyle('overflow-y', y);
- }
- },
- invokePartners: function(method, x, y, xDelta, yDelta) {
- var me = this,
- partners = me._partners,
- partner, id, axes;
- if (!me.suspendSync) {
- me.invokingPartners = true;
- for (id in partners) {
- axes = partners[id].axes;
- partner = partners[id].scroller;
-
- if (!partner.invokingPartners && (xDelta && axes.x || yDelta && axes.y)) {
- partner[method](me, axes.x ? x : null, axes.y ? y : null, xDelta, yDelta);
- }
- }
- me.invokingPartners = false;
- }
- },
- suspendPartnerSync: function() {
- this.suspendSync = (this.suspendSync || 0) + 1;
- },
- resumePartnerSync: function(syncNow) {
- var me = this,
- position;
- if (me.suspendSync) {
- me.suspendSync--;
- }
- if (!me.suspendSync && syncNow) {
- position = me.getPosition();
- me.invokePartners('onPartnerScroll', position.x, position.y);
- me.invokePartners('onPartnerScrollEnd', position.x, position.y);
- }
- },
- readPosition: function(position) {
- var me = this,
- element = me.getScrollElement(),
- elScroll;
- position = position || {};
- if (element && !element.destroyed) {
- elScroll = me.getElementScroll(element);
- position.x = elScroll.left;
- position.y = elScroll.top;
- }
- return position;
- },
- updateDomScrollPosition: function(silent) {
- var me = this,
- position = me.position,
- oldX = position.x,
- oldY = position.y,
- x, y, xDelta, yDelta;
- me.readPosition(position);
- x = position.x;
- y = position.y;
- me.positionDirty = false;
- if (!silent) {
- xDelta = x - oldX;
- yDelta = y - oldY;
-
-
-
- if (xDelta || yDelta) {
- if (!me.isScrolling) {
- me.isScrolling = Ext.isScrolling = true;
- me.fireScrollStart(x, y, xDelta, yDelta);
- }
- me.fireScroll(x, y, xDelta, yDelta);
- me.onDomScrollEnd(x, y, xDelta, yDelta);
- }
- }
- return position;
- },
-
- syncWithPartners: function() {
- var me = this,
- partners = me._partners,
- id, partner, position;
- me.suspendPartnerSync();
- for (id in partners) {
- partner = partners[id].scroller;
- position = partner.getPosition();
- me.onPartnerScroll(partner, position.x, position.y);
- }
- me.resumePartnerSync();
- },
- syncScrollbarCls: function() {
- var element = this.getElement();
- if (element) {
- element.toggleCls(this.noScrollbarsCls, this.getScrollbars() === false);
- }
- },
- onDomScroll: function() {
- var hasTimer = !!this.restoreTimer;
- this.updateDomScrollPosition(hasTimer);
- if (hasTimer) {
- Ext.undefer(this.onDomScrollEnd.timer);
- return;
- }
- },
- doOnDomScrollEnd: function(x, y, xDelta, yDelta) {
- var me = this;
-
- if (me.destroying || me.destroyed) {
- return;
- }
- me.isScrolling = Ext.isScrolling = false;
-
- if (x === undefined) {
- return;
- }
- me.trackingScrollLeft = x;
- me.trackingScrollTop = y;
- me.fireScrollEnd(x, y, xDelta, yDelta);
- },
- onPartnerScrollStart: function(partner, x, y, xDelta, yDelta) {
-
- this.isScrolling = true;
- this.fireScrollStart(x, y, xDelta, yDelta);
- },
- onPartnerScroll: function(partner, x, y, xDelta, yDelta) {
- this.doScrollTo(x, y, false);
-
-
-
-
- this.updateDomScrollPosition(true);
-
- this.fireScroll(x, y, xDelta, yDelta);
- },
- onPartnerScrollEnd: function(partner, x, y, xDelta, yDelta) {
-
- this.cancelOnDomScrollEnd();
-
-
-
- this.doOnDomScrollEnd(x, y, xDelta, yDelta);
- },
- removeSnapStylesheet: function() {
- var stylesheet = this.snapStylesheet;
- if (stylesheet) {
- Ext.util.CSS.removeStyleSheet(stylesheet);
- this.snapStylesheet = null;
- }
- },
- restoreState: function() {
- var me = this,
- el = me.getScrollElement();
- if (el) {
-
-
- if (me.trackingScrollTop !== undefined) {
-
-
-
-
-
-
- if (!me.restoreTimer) {
- me.restoreTimer = Ext.defer(function() {
- me.restoreTimer = null;
- }, 50);
- }
- me.doScrollTo(me.trackingScrollLeft, me.trackingScrollTop, false);
- }
- }
- }
- }
- },
- function(Scroller) {
-
- Ext.getViewportScroller = function() {
-
-
-
-
- var scroller = Scroller.viewport;
- if (!scroller) {
- Scroller.viewport = scroller = new Scroller();
- Scroller.initViewportScroller();
- }
- return scroller;
- };
-
- Ext.setViewportScroller = function(scroller) {
- if (Scroller.viewport !== scroller) {
- Ext.destroy(Scroller.viewport);
- if (scroller && !scroller.isScroller) {
- scroller = new Scroller(scroller);
- }
- Scroller.viewport = scroller;
- }
- };
- Ext.onReady(function() {
-
-
-
-
-
-
- Scroller.initViewportScrollerTimer = Ext.defer(Scroller.initViewportScroller, 100);
- });
- });
- Ext.define('Ext.ProgressBase', {
- mixinId: 'progressbase',
- config: {
-
- value: 0,
-
- textTpl: null
- },
- applyTextTpl: function(textTpl) {
- if (!textTpl.isTemplate) {
- textTpl = new Ext.XTemplate(textTpl);
- }
- return textTpl;
- },
- applyValue: function(value) {
- return value || 0;
- }
- });
- Ext.define('Ext.Progress', {
- extend: Ext.Gadget,
- xtype: [
- 'progress',
- 'progressbarwidget'
- ],
- alternateClassName: 'Ext.ProgressBarWidget',
- mixins: [
- Ext.ProgressBase
- ],
- config: {
-
- text: null,
-
- animate: false
- },
- cachedConfig: {
- textCls: Ext.baseCSSPrefix + 'progress-text',
- cls: null
- },
- baseCls: Ext.baseCSSPrefix + 'progress',
- template: [
- {
- reference: 'backgroundEl'
- },
- {
- reference: 'barEl',
- cls: Ext.baseCSSPrefix + 'progress-bar',
- children: [
- {
- reference: 'textEl'
- }
- ]
- }
- ],
- defaultBindProperty: 'value',
- updateCls: function(cls, oldCls) {
- var el = this.element;
- if (oldCls) {
- el.removeCls(oldCls);
- }
- if (cls) {
- el.addCls(cls);
- }
- },
- updateUi: function(ui, oldUi) {
- var element = this.element,
- barEl = this.barEl,
- baseCls = this.baseCls + '-';
- this.callParent([
- ui,
- oldUi
- ]);
- if (oldUi) {
- element.removeCls(baseCls + oldUi);
- barEl.removeCls(baseCls + 'bar-' + oldUi);
- }
- element.addCls(baseCls + ui);
- barEl.addCls(baseCls + 'bar-' + ui);
- },
- updateTextCls: function(textCls) {
- this.backgroundEl.addCls(textCls + ' ' + textCls + '-back');
- this.textEl.addCls(textCls);
- },
- updateValue: function(value, oldValue) {
- var me = this,
- textTpl = me.getTextTpl();
- if (textTpl) {
- me.setText(textTpl.apply({
- value: value,
- percent: Math.round(value * 100)
- }));
- }
- if (!me.isConfiguring && me.getAnimate()) {
- me.stopBarAnimation();
- me.startBarAnimation(Ext.apply({
- from: {
- width: (oldValue * 100) + '%'
- },
- to: {
- width: (value * 100) + '%'
- }
- }, me.animate));
- } else {
- me.barEl.setStyle('width', (value * 100) + '%');
- }
- },
- updateText: function(text) {
- this.backgroundEl.setHtml(text);
- this.textEl.setHtml(text);
- },
- doDestroy: function() {
- this.stopBarAnimation();
- this.callParent();
- },
- privates: {
- startBarAnimation: Ext.privateFn,
- stopBarAnimation: Ext.privateFn
- }
- });
- Ext.define('Ext.fx.State', {
- isAnimatable: {
- 'background-color': true,
- 'background-image': true,
- 'background-position': true,
- 'border-bottom-color': true,
- 'border-bottom-width': true,
- 'border-color': true,
- 'border-left-color': true,
- 'border-left-width': true,
- 'border-right-color': true,
- 'border-right-width': true,
- 'border-spacing': true,
- 'border-top-color': true,
- 'border-top-width': true,
- 'border-width': true,
- 'bottom': true,
- 'color': true,
- 'crop': true,
- 'font-size': true,
- 'font-weight': true,
- 'height': true,
- 'left': true,
- 'letter-spacing': true,
- 'line-height': true,
- 'margin-bottom': true,
- 'margin-left': true,
- 'margin-right': true,
- 'margin-top': true,
- 'max-height': true,
- 'max-width': true,
- 'min-height': true,
- 'min-width': true,
- 'opacity': true,
- 'outline-color': true,
- 'outline-offset': true,
- 'outline-width': true,
- 'padding-bottom': true,
- 'padding-left': true,
- 'padding-right': true,
- 'padding-top': true,
- 'right': true,
- 'text-indent': true,
- 'text-shadow': true,
- 'top': true,
- 'vertical-align': true,
- 'visibility': true,
- 'width': true,
- 'word-spacing': true,
- 'z-index': true,
- 'zoom': true,
- 'transform': true
- },
- constructor: function(data) {
- this.data = {};
- this.set(data);
- },
- setConfig: function(data) {
- this.set(data);
- return this;
- },
- setRaw: function(data) {
- this.data = data;
- return this;
- },
- clear: function() {
- return this.setRaw({});
- },
- setTransform: function(name, value) {
- var data = this.data,
- isArray = Ext.isArray(value),
- transform = data.transform,
- ln, key;
- if (!transform) {
- transform = data.transform = {
- translateX: 0,
- translateY: 0,
- translateZ: 0,
- scaleX: 1,
- scaleY: 1,
- scaleZ: 1,
- rotate: 0,
- rotateX: 0,
- rotateY: 0,
- rotateZ: 0,
- skewX: 0,
- skewY: 0
- };
- }
- if (typeof name == 'string') {
- switch (name) {
- case 'translate':
- if (isArray) {
- ln = value.length;
- if (ln == 0) {
- break;
- }
- transform.translateX = value[0];
- if (ln == 1) {
- break;
- }
- transform.translateY = value[1];
- if (ln == 2) {
- break;
- }
- transform.translateZ = value[2];
- } else {
- transform.translateX = value;
- };
- break;
- case 'rotate':
- if (isArray) {
- ln = value.length;
- if (ln == 0) {
- break;
- }
- transform.rotateX = value[0];
- if (ln == 1) {
- break;
- }
- transform.rotateY = value[1];
- if (ln == 2) {
- break;
- }
- transform.rotateZ = value[2];
- } else {
- transform.rotate = value;
- };
- break;
- case 'scale':
- if (isArray) {
- ln = value.length;
- if (ln == 0) {
- break;
- }
- transform.scaleX = value[0];
- if (ln == 1) {
- break;
- }
- transform.scaleY = value[1];
- if (ln == 2) {
- break;
- }
- transform.scaleZ = value[2];
- } else {
- transform.scaleX = value;
- transform.scaleY = value;
- };
- break;
- case 'skew':
- if (isArray) {
- ln = value.length;
- if (ln == 0) {
- break;
- }
- transform.skewX = value[0];
- if (ln == 1) {
- break;
- }
- transform.skewY = value[1];
- } else {
- transform.skewX = value;
- };
- break;
- default:
- transform[name] = value;
- }
- } else {
- for (key in name) {
- if (name.hasOwnProperty(key)) {
- value = name[key];
- this.setTransform(key, value);
- }
- }
- }
- },
- set: function(name, value) {
- var data = this.data,
- key;
- if (typeof name != 'string') {
- for (key in name) {
- value = name[key];
- if (key === 'transform') {
- this.setTransform(value);
- } else {
- data[key] = value;
- }
- }
- } else {
- if (name === 'transform') {
- this.setTransform(value);
- } else {
- data[name] = value;
- }
- }
- return this;
- },
- unset: function(name) {
- var data = this.data;
- if (data.hasOwnProperty(name)) {
- delete data[name];
- }
- return this;
- },
- getData: function() {
- return this.data;
- }
- });
- Ext.define('Ext.fx.animation.Abstract', {
- extend: Ext.Evented,
- mixins: [
- Ext.mixin.Factoryable
- ],
- factoryConfig: {
- type: 'animation'
- },
- isAnimation: true,
- config: {
- name: '',
- element: null,
-
- before: null,
- from: {},
- to: {},
- after: null,
- states: {},
- duration: 300,
-
- easing: 'linear',
- iteration: 1,
- direction: 'normal',
- delay: 0,
- onBeforeStart: null,
- callback: null,
- onEnd: null,
- onBeforeEnd: null,
- scope: null,
- reverse: null,
- preserveEndState: false,
- replacePrevious: true
- },
- STATE_FROM: '0%',
- STATE_TO: '100%',
- DIRECTION_UP: 'up',
- DIRECTION_TOP: 'top',
- DIRECTION_DOWN: 'down',
- DIRECTION_BOTTOM: 'bottom',
- DIRECTION_LEFT: 'left',
- DIRECTION_RIGHT: 'right',
- stateNameRegex: /^(?:[\d\.]+)%$/,
- constructor: function() {
- this.states = {};
- this.callParent(arguments);
- return this;
- },
- applyElement: function(element) {
- return Ext.get(element);
- },
- applyBefore: function(before, current) {
- if (before) {
- return Ext.factory(before, Ext.fx.State, current);
- }
- },
- applyAfter: function(after, current) {
- if (after) {
- return Ext.factory(after, Ext.fx.State, current);
- }
- },
- setFrom: function(from) {
- return this.setState(this.STATE_FROM, from);
- },
- setTo: function(to) {
- return this.setState(this.STATE_TO, to);
- },
- getFrom: function() {
- return this.getState(this.STATE_FROM);
- },
- getTo: function() {
- return this.getState(this.STATE_TO);
- },
- setStates: function(states) {
- var validNameRegex = this.stateNameRegex,
- name;
- for (name in states) {
- if (validNameRegex.test(name)) {
- this.setState(name, states[name]);
- }
- }
- return this;
- },
- getStates: function() {
- return this.states;
- },
- updateCallback: function(callback) {
- if (callback) {
- this.setOnEnd(callback);
- }
- },
- end: function() {
-
-
- this.stop();
- },
- stop: function() {
- this.fireEvent('stop', this);
- },
- destroy: function() {
-
- this.destroying = true;
- this.stop();
- this.callParent();
- this.destroying = false;
- this.destroyed = true;
- },
- setState: function(name, state) {
- var states = this.getStates(),
- stateInstance;
- stateInstance = Ext.factory(state, Ext.fx.State, states[name]);
- if (stateInstance) {
- states[name] = stateInstance;
- }
-
- else if (name === this.STATE_TO) {
- Ext.Logger.error("Setting and invalid '100%' / 'to' state of: " + state);
- }
-
- return this;
- },
- getState: function(name) {
- return this.getStates()[name];
- },
- getData: function() {
- var me = this,
- states = me.getStates(),
- statesData = {},
- before = me.getBefore(),
- after = me.getAfter(),
- from = states[me.STATE_FROM],
- to = states[me.STATE_TO],
- fromData = from.getData(),
- toData = to.getData(),
- data, name, state;
- for (name in states) {
- if (states.hasOwnProperty(name)) {
- state = states[name];
- data = state.getData();
- statesData[name] = data;
- }
- }
- return {
- before: before ? before.getData() : {},
- after: after ? after.getData() : {},
- states: statesData,
- from: fromData,
- to: toData,
- duration: me.getDuration(),
- iteration: me.getIteration(),
- direction: me.getDirection(),
- easing: me.getEasing(),
- delay: me.getDelay(),
- onEnd: me.getOnEnd(),
- onBeforeEnd: me.getOnBeforeEnd(),
- onBeforeStart: me.getOnBeforeStart(),
- scope: me.getScope(),
- preserveEndState: me.getPreserveEndState(),
- replacePrevious: me.getReplacePrevious()
- };
- }
- });
- Ext.define('Ext.fx.animation.Slide', {
- extend: Ext.fx.animation.Abstract,
- alternateClassName: 'Ext.fx.animation.SlideIn',
- alias: [
- 'animation.slide',
- 'animation.slideIn'
- ],
- config: {
-
- direction: 'left',
-
- out: false,
-
- offset: 0,
-
- easing: 'auto',
- containerBox: 'auto',
- elementBox: 'auto',
- isElementBoxFit: true,
- useCssTransform: true
- },
- reverseDirectionMap: {
- up: 'down',
- top: 'down',
- down: 'up',
- bottom: 'up',
- left: 'right',
- right: 'left'
- },
- applyEasing: function(easing) {
- if (easing === 'auto') {
- return 'ease-' + ((this.getOut()) ? 'in' : 'out');
- }
- return easing;
- },
- getContainerBox: function() {
- var box = this._containerBox;
- if (box === 'auto') {
- box = this.getElement().getParent().getBox();
- }
- return box;
- },
- getElementBox: function() {
- var box = this._elementBox;
- if (this.getIsElementBoxFit()) {
- return this.getContainerBox();
- }
- if (box === 'auto') {
- box = this.getElement().getBox();
- }
- return box;
- },
- getData: function() {
- var elementBox = this.getElementBox(),
- containerBox = this.getContainerBox(),
- box = elementBox ? elementBox : containerBox,
- from = this.getFrom(),
- to = this.getTo(),
- out = this.getOut(),
- offset = this.getOffset(),
- direction = this.getDirection(),
- useCssTransform = this.getUseCssTransform(),
- reverse = this.getReverse(),
- translateX = 0,
- translateY = 0,
- offsetPct, fromX, fromY, toX, toY;
- if (typeof offset === 'string') {
- offsetPct = true;
- offset = parseFloat(offset);
- }
- if (reverse) {
- direction = this.reverseDirectionMap[direction];
- }
- switch (direction) {
- case this.DIRECTION_UP:
- case this.DIRECTION_TOP:
- if (offsetPct) {
- offset = box.height * offset / 100;
- };
- if (out) {
- translateY = containerBox.top - box.top - box.height - offset;
- } else {
- translateY = containerBox.bottom - box.bottom + box.height + offset;
- };
- break;
- case this.DIRECTION_DOWN:
- case this.DIRECTION_BOTTOM:
- if (offsetPct) {
- offset = box.height * offset / 100;
- };
- if (out) {
- translateY = containerBox.bottom - box.bottom + box.height + offset;
- } else {
- translateY = containerBox.top - box.height - box.top - offset;
- };
- break;
- case this.DIRECTION_RIGHT:
- if (offsetPct) {
- offset = box.width * offset / 100;
- };
- if (out) {
- translateX = containerBox.right - box.right + box.width + offset;
- } else {
- translateX = containerBox.left - box.left - box.width - offset;
- };
- break;
- case this.DIRECTION_LEFT:
- if (offsetPct) {
- offset = box.width * offset / 100;
- };
- if (out) {
- translateX = containerBox.left - box.left - box.width - offset;
- } else {
- translateX = containerBox.right - box.right + box.width + offset;
- };
- break;
- }
- fromX = (out) ? 0 : translateX;
- fromY = (out) ? 0 : translateY;
- if (useCssTransform) {
- from.setTransform({
- translateX: fromX,
- translateY: fromY
- });
- } else {
- from.set('left', fromX);
- from.set('top', fromY);
- }
- toX = (out) ? translateX : 0;
- toY = (out) ? translateY : 0;
- if (useCssTransform) {
- to.setTransform({
- translateX: toX,
- translateY: toY
- });
- } else {
- to.set('left', toX);
- to.set('top', toY);
- }
- return this.callParent(arguments);
- }
- });
- Ext.define('Ext.fx.animation.SlideOut', {
- extend: Ext.fx.animation.Slide,
- alias: [
- 'animation.slideOut'
- ],
- config: {
-
- out: true
- }
- });
- Ext.define('Ext.fx.animation.Fade', {
- extend: Ext.fx.animation.Abstract,
- alternateClassName: 'Ext.fx.animation.FadeIn',
- alias: [
- 'animation.fade',
- 'animation.fadeIn'
- ],
- config: {
-
- out: false,
-
- before: {
- display: null,
- opacity: 0
- },
- after: {
- opacity: null
- },
- reverse: null
- },
- updateOut: function(newOut) {
- var to = this.getTo(),
- from = this.getFrom();
- if (newOut) {
- from.set('opacity', 1);
- to.set('opacity', 0);
- } else {
- from.set('opacity', 0);
- to.set('opacity', 1);
- }
- }
- });
- Ext.define('Ext.fx.animation.FadeOut', {
- extend: Ext.fx.animation.Fade,
- alias: 'animation.fadeOut',
- config: {
-
- out: true,
- before: {}
- }
- });
- Ext.define('Ext.fx.animation.Flip', {
- extend: Ext.fx.animation.Abstract,
- alias: 'animation.flip',
- config: {
- easing: 'ease-in',
-
- direction: 'right',
- half: false,
- out: null
- },
- getData: function() {
- var me = this,
- from = me.getFrom(),
- to = me.getTo(),
- direction = me.getDirection(),
- out = me.getOut(),
- half = me.getHalf(),
- rotate = half ? 90 : 180,
- fromScale = 1,
- toScale = 1,
- fromRotateX = 0,
- fromRotateY = 0,
- toRotateX = 0,
- toRotateY = 0;
- if (out) {
- toScale = 0.8;
- } else {
- fromScale = 0.8;
- }
- switch (direction) {
- case this.DIRECTION_UP:
- case this.DIRECTION_TOP:
- if (out) {
- toRotateX = rotate;
- } else {
- fromRotateX = -rotate;
- };
- break;
- case this.DIRECTION_DOWN:
- case this.DIRECTION_BOTTOM:
- if (out) {
- toRotateX = -rotate;
- } else {
- fromRotateX = rotate;
- };
- break;
- case this.DIRECTION_RIGHT:
- if (out) {
- toRotateY = rotate;
- } else {
- fromRotateY = -rotate;
- };
- break;
- case this.DIRECTION_LEFT:
- if (out) {
- toRotateY = -rotate;
- } else {
- fromRotateY = rotate;
- };
- break;
- }
- from.setTransform({
- rotateX: fromRotateX,
- rotateY: fromRotateY,
- scale: fromScale
- });
- to.setTransform({
- rotateX: toRotateX,
- rotateY: toRotateY,
- scale: toScale
- });
- return this.callParent();
- }
- });
- Ext.define('Ext.fx.animation.Pop', {
- extend: Ext.fx.animation.Abstract,
- alias: [
- 'animation.pop',
- 'animation.popIn'
- ],
- alternateClassName: 'Ext.fx.animation.PopIn',
- config: {
-
- out: false,
- before: {
- display: null,
- opacity: 0
- },
- after: {
- opacity: null
- }
- },
- getData: function() {
- var to = this.getTo(),
- from = this.getFrom(),
- out = this.getOut();
- if (out) {
- from.set('opacity', 1);
- from.setTransform({
- scale: 1
- });
- to.set('opacity', 0);
- to.setTransform({
- scale: 0
- });
- } else {
- from.set('opacity', 0);
- from.setTransform({
- scale: 0
- });
- to.set('opacity', 1);
- to.setTransform({
- scale: 1
- });
- }
- return this.callParent(arguments);
- }
- });
- Ext.define('Ext.fx.animation.PopOut', {
- extend: Ext.fx.animation.Pop,
- alias: 'animation.popOut',
- config: {
-
- out: true,
- before: {}
- }
- });
- Ext.define('Ext.fx.Animation', {
-
- constructor: function(config) {
- var defaultClass = Ext.fx.animation.Abstract,
- type;
- if (typeof config == 'string') {
- type = config;
- config = {};
- } else if (config && config.type) {
- type = config.type;
- }
- if (type) {
- defaultClass = Ext.ClassManager.getByAlias('animation.' + type);
-
- if (!defaultClass) {
- Ext.Logger.error("Invalid animation type of: '" + type + "'");
- }
- }
-
- return Ext.factory(config, defaultClass);
- }
- });
- Ext.define('Ext.app.EventDomain', {
- statics: {
-
- instances: {}
- },
-
- isEventDomain: true,
- isInstance: false,
- constructor: function() {
- var me = this;
- if (!me.isInstance) {
- Ext.app.EventDomain.instances[me.type] = me;
- }
- me.bus = {};
- me.monitoredClasses = [];
- },
-
- dispatch: function(target, ev, args) {
- ev = Ext.canonicalEventName(ev);
- var me = this,
- bus = me.bus,
- selectors = bus[ev],
- selector, controllers, id, info, events, len, i, event;
- if (!selectors) {
- return true;
- }
-
- for (selector in selectors) {
-
-
- if (selectors.hasOwnProperty(selector) && me.match(target, selector, me.controller)) {
-
- controllers = selectors[selector];
- for (id in controllers) {
- if (controllers.hasOwnProperty(id)) {
- info = controllers[id];
- if (info.controller.isActive()) {
-
-
- events = info.list;
- len = events.length;
- for (i = 0; i < len; i++) {
- event = events[i];
-
- if (event.fire.apply(event, args) === false) {
- return false;
- }
- }
- }
- }
- }
- }
- }
- return true;
- },
-
- listen: function(selectors, controller) {
- var me = this,
- bus = me.bus,
- idProperty = me.idProperty,
- monitoredClasses = me.monitoredClasses,
- monitoredClassesCount = monitoredClasses.length,
- controllerId = controller.getId(),
- isComponentDomain = (me.type === 'component'),
- refMap = isComponentDomain ? controller.getRefMap() : null,
- i, tree, info, selector, options, listener, scope, event, listeners, ev, classHasListeners;
- for (selector in selectors) {
- listeners = selectors[selector];
- if (isComponentDomain) {
-
-
-
-
-
-
-
-
-
-
-
-
- selector = refMap[selector] || selector;
- }
- if (listeners) {
- if (idProperty) {
-
- if (!/^[*#]/.test(selector)) {
- Ext.raise('Selectors containing id should begin with #');
- }
-
- selector = selector === '*' ? selector : selector.substring(1);
- }
- for (ev in listeners) {
- options = null;
- listener = listeners[ev];
- scope = controller;
- ev = Ext.canonicalEventName(ev);
- event = new Ext.util.Event(controller, ev);
-
- if (Ext.isObject(listener)) {
- options = listener;
- listener = options.fn;
- scope = options.scope || controller;
- delete options.fn;
- delete options.scope;
- }
-
- if ((!options || !options.scope) && typeof listener === 'string') {
-
-
- if (!scope[listener]) {
- Ext.raise('Cannot resolve "' + listener + '" on controller.');
- }
- scope = null;
- }
-
- else if (typeof listener === 'string') {
- listener = scope[listener];
- }
- event.addListener(listener, scope, options);
- for (i = 0; i < monitoredClassesCount; ++i) {
- classHasListeners = monitoredClasses[i].hasListeners;
- if (classHasListeners) {
-
- classHasListeners._incr_(ev);
- }
- }
-
- tree = bus[ev] || (bus[ev] = {});
- tree = tree[selector] || (tree[selector] = {});
- info = tree[controllerId] || (tree[controllerId] = {
- controller: controller,
- list: []
- });
-
- info.list.push(event);
- }
- }
- }
- },
-
- match: function(target, selector) {
- var idProperty = this.idProperty;
- if (idProperty) {
- return selector === '*' || target[idProperty] === selector;
- }
- return false;
- },
-
- monitor: function(observable) {
- var domain = this,
- prototype = observable.isInstance ? observable : observable.prototype,
- doFireEvent = prototype.doFireEvent;
- domain.monitoredClasses.push(observable);
- prototype.doFireEvent = function(ev, args) {
- var me = this,
- ret;
- ret = doFireEvent.apply(me, arguments);
-
-
- if (ret !== false && !me.destroyed && !me.isSuspended(ev)) {
- ret = domain.dispatch(me, ev, args);
- }
- return ret;
- };
- },
-
- unlisten: function(controllerId) {
- var bus = this.bus,
- id = controllerId,
- monitoredClasses = this.monitoredClasses,
- monitoredClassesCount = monitoredClasses.length,
- controllers, ev, events, len, item, selector, selectors, i, j, info, classHasListeners;
- if (controllerId.isController) {
- id = controllerId.getId();
- }
- for (ev in bus) {
- ev = Ext.canonicalEventName(ev);
- if (bus.hasOwnProperty(ev) && (selectors = bus[ev])) {
- for (selector in selectors) {
- controllers = selectors[selector];
- info = controllers[id];
- if (info) {
- events = info.list;
- if (events) {
- for (i = 0 , len = events.length; i < len; ++i) {
- item = events[i];
- item.clearListeners();
- for (j = 0; j < monitoredClassesCount; ++j) {
- classHasListeners = monitoredClasses[j].hasListeners;
- if (classHasListeners) {
-
-
- classHasListeners._decr_(item.name);
- }
- }
- }
- delete controllers[id];
- }
- }
- }
- }
- }
- },
- destroy: function() {
- this.monitoredClasses = this.bus = null;
- this.callParent();
- }
- });
- Ext.define('Ext.app.domain.Component', {
- extend: Ext.app.EventDomain,
- singleton: true,
- type: 'component',
- constructor: function() {
- this.callParent();
- this.monitor(Ext.Widget);
- },
- dispatch: function(target, ev, args) {
- var controller = target.lookupController(false),
-
- domain, view;
- while (controller) {
- domain = controller.compDomain;
- if (domain) {
- if (domain.dispatch(target, ev, args) === false) {
- return false;
- }
- }
- view = controller.getView();
- controller = view ? view.lookupController(true) : null;
- }
- return this.callParent([
- target,
- ev,
- args
- ]);
- },
- match: function(target, selector) {
- return target.is(selector);
- }
- });
- Ext.define('Ext.app.EventBus', {
- singleton: true,
- constructor: function() {
- var me = this,
- domains = Ext.app.EventDomain.instances;
- me.callParent();
- me.domains = domains;
- me.bus = domains.component.bus;
- },
-
-
- control: function(selectors, controller) {
- return this.domains.component.listen(selectors, controller);
- },
-
- listen: function(to, controller) {
- var domains = this.domains,
- domain;
- for (domain in to) {
- if (to.hasOwnProperty(domain)) {
- domains[domain].listen(to[domain], controller);
- }
- }
- },
-
- unlisten: function(controllerId) {
- var domains = Ext.app.EventDomain.instances,
- domain;
- for (domain in domains) {
- domains[domain].unlisten(controllerId);
- }
- }
- });
- Ext.define('Ext.app.domain.Global', {
- extend: Ext.app.EventDomain,
- singleton: true,
- type: 'global',
- constructor: function() {
- var me = this;
- me.callParent();
- me.monitor(Ext.GlobalEvents);
- },
-
- listen: function(listeners, controller) {
- this.callParent([
- {
- global: listeners
- },
- controller
- ]);
- },
- match: Ext.returnTrue
- });
- Ext.define('Ext.route.Handler', {
-
-
-
- lazy: false,
-
-
-
-
-
- statics: {
-
- fromRouteConfig: function(config, scope) {
- var handler = {
- action: config.action,
- before: config.before,
- lazy: config.lazy,
- exit: config.exit,
- scope: scope,
- single: config.single
- };
- return new this(handler);
- }
- },
- constructor: function(config) {
- Ext.apply(this, config);
- }
- });
- Ext.define('Ext.route.Action', {
- config: {
-
- actions: null,
-
- befores: null,
-
- urlParams: []
- },
-
-
- started: false,
-
- stopped: false,
- constructor: function(config) {
- var me = this;
- me.deferred = new Ext.Deferred();
- me.resume = me.resume.bind(me);
- me.stop = me.stop.bind(me);
- me.initConfig(config);
- me.callParent([
- config
- ]);
- },
- applyActions: function(actions) {
- if (actions) {
- actions = Ext.Array.from(actions);
- }
- return actions;
- },
- applyBefores: function(befores) {
- if (befores) {
- befores = Ext.Array.from(befores);
- }
- return befores;
- },
- destroy: function() {
- this.deferred = null;
- this.setBefores(null).setActions(null).setUrlParams(null);
- this.callParent();
- },
-
- resume: function() {
- return this.next();
- },
-
- stop: function() {
- this.stopped = true;
- return this.done();
- },
-
- next: function() {
- var me = this,
- actions = me.getActions(),
- befores = me.getBefores(),
- urlParams = me.getUrlParams(),
- config, ret, args;
- if (Ext.isArray(urlParams)) {
- args = urlParams.slice();
- } else {
- args = [
- urlParams
- ];
- }
- if (me.stopped || (befores ? !befores.length : true) && (actions ? !actions.length : true)) {
- me.done();
- } else {
- if (befores && befores.length) {
- config = befores.shift();
- args.push(me);
- ret = Ext.callback(config.fn, config.scope, args);
- if (ret && ret.then) {
- ret.then(function(arg) {
- me.resume(arg);
- }, function(arg) {
- me.stop(arg);
- });
- }
- } else if (actions && actions.length) {
- config = actions.shift();
- Ext.callback(config.fn, config.scope, args);
- me.next();
- } else {
-
- me.next();
- }
- }
- return me;
- },
-
- run: function() {
- var deferred = this.deferred;
- if (!this.started) {
- this.next();
- this.started = true;
- }
- return deferred.promise;
- },
-
- done: function() {
- var deferred = this.deferred;
- if (this.stopped) {
- deferred.reject();
- } else {
- deferred.resolve();
- }
- this.destroy();
- return this;
- },
-
- before: function(first, fn, scope) {
- if (!Ext.isBoolean(first)) {
- scope = fn;
- fn = first;
- first = false;
- }
- var befores = this.getBefores(),
- config = {
- fn: fn,
- scope: scope
- };
-
- if (this.destroyed) {
- Ext.raise('This action has has already resolved and therefore will never execute this function.');
- return;
- }
-
- if (befores) {
- if (first) {
- befores.unshift(config);
- } else {
- befores.push(config);
- }
- } else {
- this.setBefores(config);
- }
- return this;
- },
-
- action: function(first, fn, scope) {
- if (!Ext.isBoolean(first)) {
- scope = fn;
- fn = first;
- first = false;
- }
- var actions = this.getActions(),
- config = {
- fn: fn,
- scope: scope
- };
-
- if (this.destroyed) {
- Ext.raise('This action has has already resolved and therefore will never execute this function.');
- return;
- }
-
- if (actions) {
- if (first) {
- actions.unshift(config);
- } else {
- actions.push(config);
- }
- } else {
- this.setActions(config);
- }
- return this;
- },
-
- then: function(resolve, reject) {
-
- if (this.destroyed) {
- Ext.raise('This action has has already resolved and therefore will never execute either function.');
- return;
- }
-
- return this.deferred.then(resolve, reject);
- }
- });
- Ext.define('Ext.route.Route', {
-
-
- config: {
-
- name: null,
-
- url: null,
-
- allowInactive: false,
-
- conditions: {},
-
- caseInsensitive: false,
-
- handlers: [],
-
- types: {
- cached: true,
- $value: {
- alpha: {
- re: '([a-zA-Z]+)'
- },
- alphanum: {
- re: '([a-zA-Z0-9]+|[0-9]+(?:\\.[0-9]+)?|[0-9]*(?:\\.[0-9]+){1})',
- parse: function(value) {
- var test;
- if (value && this.numRe.test(value)) {
- test = parseFloat(value);
- if (!isNaN(test)) {
- value = test;
- }
- }
- return value;
- }
- },
- num: {
-
- re: '([0-9]+(?:\\.[0-9]+)?|[0-9]*(?:\\.[0-9]+){1})',
- parse: function(value) {
- if (value) {
- value = parseFloat(value);
- }
- return value;
- }
- },
- '...': {
- re: '(.+)?',
- split: '/',
- parse: function(values) {
- var length, i, value;
- if (values) {
- length = values.length;
- for (i = 0; i < length; i++) {
- value = parseFloat(values[i]);
- if (!isNaN(value)) {
- values[i] = value;
- }
- }
- }
- return values;
- }
- }
- }
- }
- },
-
- defaultMatcher: '([%a-zA-Z0-9\\-\\_\\s,]+)',
-
-
- numRe: /^[0-9]*(?:\.[0-9]*)?$/,
-
- typeParamRegex: /:{([0-9A-Za-z\_]+)(?::?([0-9A-Za-z\_]+|.{3})?)}/g,
-
- optionalGroupRegex: /\((.+?)\)/g,
-
- paramMatchingRegex: /:([0-9A-Za-z\_]+)/g,
-
-
-
- isRoute: true,
- constructor: function(config) {
- var me = this,
- url;
- this.initConfig(config);
- url = me.getUrl().replace(me.optionalGroupRegex, function(match, middle) {
- return '(?:' + middle + ')?';
- });
- if (url.match(me.typeParamRegex)) {
- me.handleNamedPattern(url);
- } else {
- me.handlePositionalPattern(url);
- }
- },
-
- handlePositionalPattern: function(url) {
- var me = this;
- me.paramsInMatchString = url.match(me.paramMatchingRegex) || [];
- me.matcherRegex = me.createMatcherRegex(url);
- me.mode = 'positional';
- },
-
- handleNamedPattern: function(url) {
- var me = this,
- typeParamRegex = me.typeParamRegex,
- conditions = me.getConditions(),
- types = me.getTypes(),
- defaultMatcher = me.defaultMatcher,
- params = {},
- re = url.replace(typeParamRegex, function(match, param, typeMatch) {
- var type = typeMatch && types[typeMatch],
- matcher = conditions[param] || type || defaultMatcher;
-
- if (params[param]) {
- Ext.raise('"' + param + '" already defined in route "' + url + '"');
- }
- if (typeMatch && !type) {
- Ext.raise('Unknown parameter type "' + typeMatch + '" in route "' + url + '"');
- }
-
- if (Ext.isObject(matcher)) {
- matcher = matcher.re;
- }
- params[param] = {
- matcher: matcher,
- type: typeMatch
- };
- return matcher;
- });
-
- if (re.search(me.paramMatchingRegex) !== -1) {
- Ext.raise('URL parameter mismatch. Positional url parameter found while in named mode.');
- }
-
- me.paramsInMatchString = params;
- me.matcherRegex = new RegExp('^' + re + '$', me.getCaseInsensitive() ? 'i' : '');
- me.mode = 'named';
- },
-
- recognize: function(url) {
- var me = this,
- recognized = me.recognizes(url),
- handlers, length, hasHandler, i, handler, matches, urlParams, arg, params;
- if (recognized) {
- handlers = me.getHandlers();
- length = handlers.length;
- for (i = 0; i < length; i++) {
- handler = handlers[i];
- if (handler.lastToken !== url) {
-
- hasHandler = true;
- break;
- }
- }
- if (!hasHandler && url === me.lastToken) {
-
- return true;
- }
-
- matches = me.matchesFor(url);
- urlParams = me.getUrlParams(url);
- return Ext.applyIf(matches, {
- historyUrl: url,
- urlParams: urlParams
- });
- }
- return false;
- },
-
- getUrlParams: function(url) {
- if (this.mode === 'named') {
- return this.getNamedUrlParams(url);
- } else {
- return this.getPositionalUrlParams(url);
- }
- },
-
- getPositionalUrlParams: function(url) {
- var params = [],
- conditions = this.getConditions(),
- keys = this.paramsInMatchString,
- values = url.match(this.matcherRegex),
- length = keys.length,
- i, key, type, value;
-
- values.shift();
- for (i = 0; i < length; i++) {
- key = keys[i];
- value = values[i];
- if (conditions[key]) {
- type = conditions[key];
- } else if (key[0] === ':') {
- key = key.substr(1);
- if (conditions[key]) {
- type = conditions[key];
- }
- }
- value = this.parseValue(value, type);
- if (Ext.isDefined(value) && value !== '') {
- if (Ext.isArray(value)) {
- params.push.apply(params, value);
- } else {
- params.push(value);
- }
- }
- }
- return params;
- },
-
- getNamedUrlParams: function(url) {
- var conditions = this.getConditions(),
- types = this.getTypes(),
- params = {},
- keys = this.paramsInMatchString,
- values = url.match(this.matcherRegex),
- name, obj, value, type, condition;
-
- values.shift();
- for (name in keys) {
- obj = keys[name];
- value = values.shift();
- condition = conditions[name];
- type = types[obj.type];
- if (condition || type) {
- type = Ext.merge({}, condition, types[obj.type]);
- }
- params[name] = this.parseValue(value, type);
- }
- return params;
- },
-
- parseValue: function(value, type) {
- if (type) {
- if (value && type.split) {
- value = value.split(type.split);
-
-
-
-
- if (!value[0]) {
- value.shift();
- }
-
-
-
-
- if (!value[value.length - 1]) {
- value.pop();
- }
- }
- if (type.parse) {
- value = type.parse.call(this, value);
- }
- }
- if (!value && Ext.isString(value)) {
-
-
- value = undefined;
- }
- return value;
- },
-
- recognizes: function(url) {
- return this.matcherRegex.test(url);
- },
-
- execute: function(token, argConfig) {
- var me = this,
- allowInactive = me.getAllowInactive(),
- handlers = me.getHandlers(),
- queue = Ext.route.Router.getQueueRoutes(),
- length = handlers.length,
- befores = [],
- actions = [],
- urlParams = (argConfig && argConfig.urlParams) || [],
- i, handler, scope, action, promises, single, remover;
- me.lastToken = token;
- if (!queue) {
- promises = [];
- }
- return new Ext.Promise(function(resolve, reject) {
- if (argConfig === false) {
- reject();
- } else {
- if (queue) {
- action = new Ext.route.Action({
- urlParams: urlParams
- });
- }
- for (i = 0; i < length; i++) {
- handler = handlers[i];
- if (token != null && handler.lastToken === token) {
-
-
- continue;
- }
- scope = handler.scope;
- handler.lastToken = token;
- if (!allowInactive && scope.isActive && !scope.isActive()) {
-
- continue;
- }
- if (!queue) {
- action = new Ext.route.Action({
- urlParams: urlParams
- });
- }
- single = handler.single;
- if (handler.before) {
- action.before(handler.before, scope);
- }
- if (handler.action) {
- action.action(handler.action, scope);
- }
- if (single) {
- remover = Ext.bind(me.removeHandler, me, [
- null,
- handler
- ]);
- if (single === true) {
- if (handler.action) {
- action.action(remover, me);
- } else {
- action.before(function() {
- remover();
- return Ext.Promise.resolve();
- }, me);
- }
- } else {
-
-
-
- action.before(single === 'before', function() {
- remover();
- return Ext.Promise.resolve();
- }, me);
- }
- }
- if (!queue) {
- if (Ext.fireEvent('beforeroute', action, me) === false) {
- action.destroy();
- } else {
- promises.push(action.run());
- }
- }
- }
- if (queue) {
- if (Ext.fireEvent('beforeroute', action, me) === false) {
- action.destroy();
- reject();
- } else {
- action.run().then(resolve, reject);
- }
- } else {
- Ext.Promise.all(promises).then(resolve, reject);
- }
- }
- });
- },
-
- matchesFor: function(url) {
- var params = {},
- keys = this.mode === 'named' ? Ext.Object.getKeys(this.paramsInMatchString) : this.paramsInMatchString,
- values = url.match(this.matcherRegex),
- length = keys.length,
- i;
-
- values.shift();
- for (i = 0; i < length; i++) {
- params[keys[i].replace(':', '')] = values[i];
- }
- return params;
- },
-
- createMatcherRegex: function(url) {
-
-
- var me = this,
- paramsInMatchString = me.paramsInMatchString,
- conditions = me.getConditions(),
- defaultMatcher = me.defaultMatcher,
- length = paramsInMatchString.length,
- modifiers = me.getCaseInsensitive() ? 'i' : '',
- i, param, matcher;
- if (url === '*') {
-
- url = url.replace('*', '\\*');
- } else {
- for (i = 0; i < length; i++) {
- param = paramsInMatchString[i];
-
-
- if (conditions[param]) {
- matcher = conditions[param];
- }
-
- else if (param[0] === ':' && conditions[param.substr(1)]) {
- matcher = conditions[param.substr(1)];
- } else {
- matcher = defaultMatcher;
- }
- if (Ext.isObject(matcher)) {
- matcher = matcher.re;
- }
- url = url.replace(new RegExp(param), matcher || defaultMatcher);
- }
- }
-
- return new RegExp('^' + url + '$', modifiers);
- },
-
- addHandler: function(handler) {
- var handlers = this.getHandlers();
- if (!handler.isInstance) {
- handler = new Ext.route.Handler(handler);
- }
- handlers.push(handler);
- return handler.route = this;
- },
-
- removeHandler: function(scope, handler) {
- var handlers = this.getHandlers(),
- length = handlers.length,
- newHandlers = [],
- i, item;
- for (i = 0; i < length; i++) {
- item = handlers[i];
- if (handler) {
- if (item !== handler) {
- newHandlers.push(item);
- }
- } else if (item.scope !== scope) {
- newHandlers.push(item);
- }
- }
- this.setHandlers(newHandlers);
- return this;
- },
-
- clearLastTokens: function() {
- var handlers = this.getHandlers(),
- length = handlers.length,
- i;
- for (i = 0; i < length; i++) {
- handlers[i].lastToken = null;
- }
- this.lastToken = null;
- },
-
- onExit: function() {
- var me = this,
- handlers = me.getHandlers(),
- allowInactive = me.getAllowInactive(),
- length = handlers.length,
- action = new Ext.route.Action({
- urlParams: [
- me.lastToken
- ]
- }),
- i, handler, scope;
-
-
-
- me.clearLastTokens();
- for (i = 0; i < length; i++) {
- handler = handlers[i];
- if (handler.exit) {
- scope = handler.scope;
- if (!allowInactive && scope.isActive && !scope.isActive()) {
-
- continue;
- }
- action.action(handler.exit, scope);
- }
- }
- if (Ext.fireEvent('beforerouteexit', action, me) === false) {
- action.destroy();
- } else {
- action.run();
- }
- }
- });
- Ext.define('Ext.util.Observable', {
- extend: Ext.mixin.Observable,
-
-
- $applyConfigs: true
- }, function(Observable) {
- var Super = Ext.mixin.Observable;
-
- Observable.releaseCapture = Super.releaseCapture;
-
- Observable.capture = Super.capture;
-
- Observable.captureArgs = Super.captureArgs;
-
- Observable.observe = Observable.observeClass = Super.observe;
- });
- Ext.define('Ext.util.History', {
- singleton: true,
- alternateClassName: 'Ext.History',
- mixins: {
- observable: Ext.util.Observable
- },
-
- useTopWindow: false,
-
-
-
-
- hashRe: /^(#?!?)/,
- constructor: function() {
- var me = this;
- me.ready = false;
- me.currentToken = null;
- me.mixins.observable.constructor.call(me);
- },
-
- getHash: function() {
- return (this.win.location.hash || '').replace(this.hashRe, '');
- },
-
- setHash: function(hash, replace) {
- var me = this,
- hashRe = me.hashRe,
- loc = me.win.location;
-
- hash = hash.replace(hashRe, me.hashbang ? '#!' : '#');
- try {
- if (replace) {
- loc.replace(hash);
- } else {
- loc.hash = hash;
- }
-
- me.currentToken = hash.replace(hashRe, '');
- } catch (e) {}
- },
-
-
- handleStateChange: function(token) {
-
- token = token.replace(this.hashRe, '');
- this.fireEvent('change', this.currentToken = token);
- },
-
- startUp: function() {
- var me = this;
- me.currentToken = me.getHash();
- Ext.get(me.win).on('hashchange', me.onHashChange, me);
- me.ready = true;
- me.fireEvent('ready', me);
- },
- onHashChange: function() {
- var me = this,
- newHash = me.getHash();
- if (newHash !== me.hash) {
- me.hash = newHash;
- me.handleStateChange(newHash);
- }
- },
-
- init: function(onReady, scope) {
- var me = this;
- if (me.ready) {
- Ext.callback(onReady, scope, [
- me
- ]);
- return;
- }
- if (!Ext.isReady) {
- Ext.onInternalReady(function() {
- me.init(onReady, scope);
- });
- return;
- }
- me.win = me.useTopWindow ? window.top : window;
- me.hash = me.getHash();
- if (onReady) {
- me.on('ready', onReady, scope, {
- single: true
- });
- }
- me.startUp();
- },
-
- add: function(token, preventDuplicates) {
- var me = this,
- set = false;
- if (preventDuplicates === false || me.getToken() !== token) {
- me.setHash(token);
- set = true;
- }
- return set;
- },
-
- replace: function(token, preventDuplicates) {
- var me = this,
- set = false;
- if (preventDuplicates === false || me.getToken() !== token) {
- this.setHash(token, true);
- set = true;
- }
- return set;
- },
-
- back: function() {
- this.win.history.go(-1);
- },
-
- forward: function() {
- this.win.history.go(1);
- },
-
- getToken: function() {
- return this.ready ? this.currentToken : this.getHash();
- }
- });
- Ext.define('Ext.route.Router', {
- singleton: true,
-
-
- config: {
-
- hashbang: null,
-
- multipleToken: '|',
-
- queueRoutes: true
- },
-
-
- constructor: function() {
- var History = Ext.util.History;
- if (!History.ready) {
- History.init();
- }
- History.on('change', this.onStateChange, this);
- this.initConfig();
- this.clear();
- },
- updateHashbang: function(hashbang) {
- Ext.util.History.hashbang = hashbang;
- },
-
- onStateChange: function(token) {
- var me = this,
- tokens = token.split(me.getMultipleToken()),
- queue, i, length;
- if (me.isSuspended) {
- queue = me.suspendedQueue;
- i = 0;
- length = tokens.length;
- if (queue) {
- for (; i < length; i++) {
- token = tokens[i];
-
- if (!Ext.Array.contains(queue, token)) {
- queue.push(token);
- }
- }
- }
- } else {
- me.handleBefore(tokens);
- }
- },
-
- handleBefore: function(tokens) {
- var me = this,
- action = new Ext.route.Action();
- if (Ext.fireEvent('beforeroutes', action, tokens) === false) {
- action.destroy();
- } else {
- action.run().then(me.handleBeforeRoute.bind(me, tokens), Ext.emptyFn);
- }
- },
-
- handleBeforeRoute: function(tokens) {
- var me = this,
- beforeRoute = me.getByName('*');
- if (beforeRoute) {
- beforeRoute.execute().then(me.doRun.bind(me, tokens), Ext.emptyFn);
- } else {
-
- me.doRun(tokens);
- }
- },
-
- doRun: function(tokens) {
- var me = this,
- app = me.application,
- routes = me.routes,
- i = 0,
- length = tokens.length,
- matched = {},
- unmatched = [],
- token, found, name, route, recognize;
- for (; i < length; i++) {
- token = tokens[i];
- found = false;
- for (name in routes) {
- route = routes[name];
- recognize = route.recognize(token);
- if (recognize) {
- found = true;
- if (recognize !== true) {
-
-
-
- route.execute(token, recognize).then(null, Ext.bind(me.onRouteRejection, me, [
- route
- ], 0));
- }
- Ext.Array.remove(unmatched, route);
- if (!matched[name]) {
- matched[name] = 1;
- }
- } else if (!matched[name]) {
- unmatched.push(route);
- }
- }
- if (!found) {
- if (app) {
-
- app.fireEvent('unmatchedroute', token);
- }
- Ext.fireEvent('unmatchedroute', token);
- }
- }
- i = 0;
- length = unmatched.length;
- for (; i < length; i++) {
- unmatched[i].onExit();
- }
- },
-
- onRouteRejection: function(route, error) {
- Ext.fireEvent('routereject', route, error);
- if (error) {
- Ext.raise(error);
- }
- },
-
- connect: function(url, config, instance) {
- var routes = this.routes,
- delimiter = this.getMultipleToken(),
- name = config.name || url,
- handler, route;
- if (url[0] === '!') {
-
- if (!Ext.util.History.hashbang) {
- Ext.log({
- level: 'error',
- msg: 'Route found with "!" ("' + url + '"). Should use new hashbang functionality instead. ' + 'Please see the router guide for more: https://docs.sencha.com/extjs/' + Ext.getVersion().version + '/guides/application_architecture/router.html'
- });
- }
-
- url = url.substr(1);
- this.setHashbang(true);
- }
- if (Ext.isString(config)) {
- config = {
- action: config
- };
- }
- handler = Ext.route.Handler.fromRouteConfig(config, instance);
- route = routes[name];
- if (!route) {
- config.name = name;
- config.url = url;
- route = routes[name] = new Ext.route.Route(config);
- }
- route.addHandler(handler);
- if (handler.lazy) {
- var currentHash = Ext.util.History.getToken(),
- tokens = currentHash.split(delimiter),
- length = tokens.length,
- matched = [],
- i, token;
- for (i = 0; i < length; i++) {
- token = tokens[i];
- if (Ext.Array.indexOf(matched, token) === -1 && route.recognize(token)) {
- matched.push(token);
- }
- }
- this.onStateChange(matched.join(delimiter));
- }
- return handler;
- },
-
- disconnect: function(instance, config) {
- var routes = this.routes,
- route, name;
- if (config) {
- route = config.route || this.getByName(config.name || config.url);
- if (route) {
- route.removeHandler(instance, config);
- }
- } else {
- for (name in routes) {
- route = routes[name];
- route.removeHandler(instance);
- }
- }
- },
-
- recognize: function(url) {
- var routes = this.routes,
- matches = [],
- name, arr, i, length, route, urlParams;
- for (name in routes) {
- arr = routes[name];
- length = arr && arr.length;
- if (length) {
- i = 0;
- for (; i < length; i++) {
- route = arr[i];
- urlParams = route.recognize(url);
- if (urlParams) {
- matches.push({
- route: route,
- urlParams: urlParams
- });
- }
- }
- }
- }
- return matches.length ? matches : false;
- },
-
- draw: function(fn) {
- fn.call(this, this);
- },
-
- clear: function() {
- this.routes = {};
- },
-
- clearLastTokens: function(token) {
- var routes = this.routes,
- name, route;
- for (name in routes) {
- route = routes[name];
- if (!token || route.recognize(token)) {
- route.clearLastTokens();
- }
- }
- },
-
- getByName: function(name) {
- var routes = this.routes;
- if (routes) {
- return routes[name];
- }
- },
-
- suspend: function(trackTokens) {
- this.isSuspended = true;
- if (!this.suspendedQueue && trackTokens !== false) {
- this.suspendedQueue = [];
- }
- },
-
- resume: function(discardQueue) {
- var me = this,
- queue = me.suspendedQueue,
- token;
- if (me.isSuspended) {
- me.isSuspended = false;
- me.suspendedQueue = null;
- if (!discardQueue && queue) {
- token = queue.join(me.getMultipleToken());
- me.onStateChange(token);
- }
- }
- }
- });
- Ext.define('Ext.route.Mixin', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'routerable',
- before: {
- destroy: 'destroyRouterable'
- }
- },
- config: {
-
- routes: null
- },
- destroyRouterable: function() {
- Ext.route.Router.disconnect(this);
- },
- applyRoutes: function(routes, oldRoutes) {
- var Router = Ext.route.Router,
- url;
- if (routes) {
- for (url in routes) {
- routes[url] = Router.connect(url, routes[url], this);
- }
- }
- if (oldRoutes) {
- for (url in oldRoutes) {
- Router.disconnect(this, oldRoutes[url]);
- }
- }
- return routes;
- },
-
- redirectTo: function(hash, opt) {
- var me = this,
- currentHash = Ext.util.History.getToken(),
- Router = Ext.route.Router,
- delimiter = Router.getMultipleToken(),
- tokens = currentHash ? currentHash.split(delimiter) : [],
- length = tokens.length,
- force, i, name, obj, route, token, match;
- if (hash === -1) {
- return Ext.util.History.back();
- } else if (hash === 1) {
- return Ext.util.History.forward();
- } else if (hash.isModel) {
- hash = hash.toUrl();
- } else if (Ext.isObject(hash)) {
-
- for (name in hash) {
- obj = hash[name];
- if (!Ext.isObject(obj)) {
- obj = {
- token: obj
- };
- }
- if (length) {
- route = Router.getByName(name);
- if (route) {
- match = false;
- for (i = 0; i < length; i++) {
- token = tokens[i];
- if (route.matcherRegex.test(token)) {
- match = true;
- if (obj.token) {
-
- if (obj.fn && obj.fn.call(this, token, tokens, obj) === false) {
-
-
- continue;
- }
- tokens[i] = obj.token;
- if (obj.force) {
-
- route.lastToken = null;
- }
- } else {
-
- tokens.splice(i, 1);
- i--;
- length--;
-
- route.lastToken = null;
- }
- }
- }
- if (obj && obj.token && !match) {
-
- tokens.push(obj.token);
- }
- }
- } else if (obj && obj.token) {
-
- tokens.push(obj.token);
- }
- }
- hash = tokens.join(delimiter);
- }
- if (opt === true) {
-
- force = opt;
- opt = null;
- } else if (opt) {
- force = opt.force;
- }
- length = tokens.length;
- if (force && length) {
- for (i = 0; i < length; i++) {
- token = tokens[i];
- Router.clearLastTokens(token);
- }
- }
- if (currentHash === hash) {
- if (force) {
-
- Router.onStateChange(hash);
- }
-
- return false;
- }
- if (opt && opt.replace) {
- Ext.util.History.replace(hash);
- } else {
- Ext.util.History.add(hash);
- }
- return true;
- },
- privates: {
- afterClassMixedIn: function(targetClass) {
- var proto = targetClass.prototype,
- routes = proto.routes;
- if (routes) {
- delete proto.routes;
- targetClass.getConfigurator().add({
- routes: routes
- });
- }
- }
- }
- });
- Ext.define('Ext.app.BaseController', {
- mixins: [
- Ext.mixin.Observable,
- Ext.route.Mixin
- ],
- isController: true,
- config: {
-
- id: undefined,
-
- control: null,
-
- listen: null
- },
-
- constructor: function(config) {
- var me = this;
-
-
-
-
-
- Ext.apply(me, config);
-
-
- delete me.control;
- delete me.listen;
- me.eventbus = Ext.app.EventBus;
-
- me.mixins.observable.constructor.call(me, config);
- },
- updateId: function(id) {
- this.id = id;
- },
- applyListen: function(listen) {
- if (Ext.isObject(listen)) {
- listen = Ext.clone(listen);
- }
- return listen;
- },
- applyControl: function(control) {
- if (Ext.isObject(control)) {
- control = Ext.clone(control);
- }
- return control;
- },
-
- updateControl: function(control) {
- this.getId();
- if (control) {
- this.control(control);
- }
- },
-
- updateListen: function(listen) {
- this.getId();
- if (listen) {
- this.listen(listen);
- }
- },
- isActive: function() {
- return true;
- },
-
- control: function(selectors, listeners, controller) {
- var me = this,
- ctrl = controller,
- obj;
- if (Ext.isString(selectors)) {
- obj = {};
- obj[selectors] = listeners;
- } else {
- obj = selectors;
- ctrl = listeners;
- }
- me.eventbus.control(obj, ctrl || me);
- },
-
- listen: function(to, controller) {
- this.eventbus.listen(to, controller || this);
- },
- destroy: function() {
- var me = this,
- bus = me.eventbus;
- if (bus) {
- bus.unlisten(me);
- me.eventbus = null;
- }
- me.callParent();
- }
- });
- Ext.define('Ext.app.Util', {}, function() {
- Ext.apply(Ext.app, {
- namespaces: {
- Ext: {}
- },
-
- addNamespaces: function(namespace) {
- var namespaces = Ext.app.namespaces,
- i, l;
- if (!Ext.isArray(namespace)) {
- namespace = [
- namespace
- ];
- }
- for (i = 0 , l = namespace.length; i < l; i++) {
- namespaces[namespace[i]] = true;
- }
- },
-
- clearNamespaces: function() {
- Ext.app.namespaces = {};
- },
-
- getNamespace: function(className) {
- var namespaces = Ext.apply({}, Ext.ClassManager.paths, Ext.app.namespaces),
- deepestPrefix = '',
- prefix;
- for (prefix in namespaces) {
- if (namespaces.hasOwnProperty(prefix) && prefix.length > deepestPrefix.length && (prefix + '.' === className.substring(0, prefix.length + 1))) {
- deepestPrefix = prefix;
- }
- }
- return deepestPrefix === '' ? undefined : deepestPrefix;
- },
-
- setupPaths: function(appName, appFolder, paths) {
- var manifestPaths = Ext.manifest,
- ns;
-
- if (appName && appFolder !== null) {
- manifestPaths = manifestPaths && manifestPaths.paths;
-
-
-
-
-
- if (!manifestPaths || appFolder !== undefined) {
- Ext.Loader.setPath(appName, (appFolder === undefined) ? 'app' : appFolder);
- }
- }
- if (paths) {
- for (ns in paths) {
- if (paths.hasOwnProperty(ns)) {
- Ext.Loader.setPath(ns, paths[ns]);
- }
- }
- }
- }
- });
-
- Ext.getNamespace = Ext.app.getNamespace;
- });
- Ext.define('Ext.util.Filter', {
- isFilter: true,
- config: {
-
- property: null,
-
- value: null,
-
- filterFn: null,
-
- id: null,
-
- anyMatch: false,
-
- exactMatch: false,
-
- caseSensitive: false,
-
- disabled: false,
-
- disableOnEmpty: false,
-
- operator: null,
-
- root: null,
-
- serializer: null,
-
- convert: null
- },
-
- scope: null,
-
-
- $configStrict: false,
-
- generation: 0,
- statics: {
-
- createFilterFn: function(filters) {
- if (!filters) {
- return Ext.returnTrue;
- }
- return function(candidate) {
- var items = filters.isCollection ? filters.items : filters,
- length = items.length,
- match = true,
- i, filter;
- for (i = 0; match && i < length; i++) {
- filter = items[i];
-
- if (!filter.getDisabled()) {
- match = filter.filter(candidate);
- }
- }
- return match;
- };
- },
-
- isEqual: function(filter1, filter2) {
- if (filter1.getProperty() !== filter2.getProperty()) {
- return false;
- }
- if (filter1.getOperator() !== filter2.getOperator()) {
- return false;
- }
- if (filter1.getValue() === filter2.getValue()) {
- return true;
- } else if (Ext.isArray(filter1) && Ext.isArray(filter2) && Ext.Array.equals(filter1, filter2)) {
- return true;
- }
- return false;
- },
-
- isInvalid: function(cfg) {
- if (!cfg.filterFn) {
-
- if (!cfg.property) {
- return 'A Filter requires either a property or a filterFn to be set';
- }
- if (!cfg.hasOwnProperty('value') && !cfg.operator) {
- return 'A Filter requires either a property and value, or a filterFn to be set';
- }
- }
- return false;
- }
- },
-
- constructor: function(config) {
-
- var warn = Ext.util.Filter.isInvalid(config);
- if (warn) {
- Ext.log.warn(warn);
- }
-
- this.initConfig(config);
- },
- preventConvert: {
- 'in': 1,
- notin: 1
- },
- filter: function(item) {
- var me = this,
- filterFn = me._filterFn || me.getFilterFn(),
- convert = me.getConvert(),
- value = me._value;
- me._filterValue = value;
- me.isDateValue = Ext.isDate(value);
- if (me.isDateValue) {
- me.dateValue = value.getTime();
- }
- if (convert && !me.preventConvert[me.getOperator()]) {
- me._filterValue = convert.call(me.scope || me, value);
- }
- return filterFn.call(me.scope || me, item);
- },
- getId: function() {
- var id = this._id;
- if (!id) {
- id = this.getProperty();
- if (!id) {
- id = Ext.id(null, 'ext-filter-');
- }
- this._id = id;
- }
- return id;
- },
- getFilterFn: function() {
- var me = this,
- filterFn = me._filterFn,
- operator;
- if (!filterFn) {
- operator = me.getOperator();
- if (operator) {
- filterFn = me.operatorFns[operator];
- } else {
-
-
-
- filterFn = me.createRegexFilter();
- }
- me._filterFn = filterFn;
-
-
- me.generatedFilterFn = true;
- }
- return filterFn;
- },
-
- createRegexFilter: function() {
- var me = this,
- anyMatch = !!me.getAnyMatch(),
- exact = !!me.getExactMatch(),
- value = me.getValue(),
- matcher = Ext.String.createRegex(value, !anyMatch,
- !anyMatch && exact,
- !me.getCaseSensitive());
- return function(item) {
- var val = me.getPropertyValue(item);
- return matcher ? matcher.test(val) : (val == null);
- };
- },
-
- getPropertyValue: function(item) {
- var root = this._root,
- value = (root == null) ? item : item[root];
- return value[this._property];
- },
-
- getState: function() {
- var config = this.getInitialConfig(),
- result = {},
- name;
- for (name in config) {
-
-
- if (config.hasOwnProperty(name)) {
- result[name] = config[name];
- }
- }
- delete result.root;
- result.value = this.getValue();
- return result;
- },
- getScope: function() {
- return this.scope;
- },
-
- serialize: function() {
- var result = this.getState(),
- serializer = this.getSerializer(),
- serialized;
- delete result.id;
- delete result.serializer;
- if (serializer) {
- serialized = serializer.call(this, result);
- if (serialized) {
- result = serialized;
- }
- }
- return result;
- },
- updateDisabled: function() {
-
- this.generation++;
- },
- updateOperator: function() {
-
- this.onConfigMutation();
- },
- updateConvert: function() {
-
- this.onConfigMutation();
- },
- updateProperty: function() {
-
- this.onConfigMutation();
- },
- updateAnyMatch: function() {
-
- this.onConfigMutation();
- },
- updateExactMatch: function() {
-
- this.onConfigMutation();
- },
- updateCaseSensitive: function() {
-
- this.onConfigMutation();
- },
- updateValue: function(value) {
-
- this.onConfigMutation();
- if (this.getDisableOnEmpty()) {
- this.setDisabled(Ext.isEmpty(value));
- }
- },
- updateFilterFn: function(filterFn) {
- delete this.generatedFilterFn;
- },
- onConfigMutation: function() {
-
- this.generation++;
- if (this.generatedFilterFn) {
- this._filterFn = null;
- }
- },
- updateDisableOnEmpty: function(disableOnEmpty) {
-
-
- if (disableOnEmpty) {
- this.setDisabled(Ext.isEmpty(this.getValue()));
- }
- },
- privates: {
- getCandidateValue: function(candidate, v, preventCoerce) {
- var me = this,
- convert = me._convert,
- result = me.getPropertyValue(candidate);
- if (convert) {
- result = convert.call(me.scope || me, result);
- } else if (!preventCoerce) {
- result = Ext.coerce(result, v);
- }
- return result;
- }
- }
- }, function() {
- var prototype = this.prototype,
- operatorFns = (prototype.operatorFns = {
- "<": function(candidate) {
- var v = this._filterValue;
- return this.getCandidateValue(candidate, v) < v;
- },
- "<=": function(candidate) {
- var v = this._filterValue;
- return this.getCandidateValue(candidate, v) <= v;
- },
- "=": function(candidate) {
- var me = this,
- v = me._filterValue;
- candidate = me.getCandidateValue(candidate, v);
- if (me.isDateValue && candidate instanceof Date) {
- candidate = candidate.getTime();
- v = me.dateValue;
- }
- return candidate == v;
- },
- "===": function(candidate) {
- var me = this,
- v = me._filterValue;
- candidate = me.getCandidateValue(candidate, v, true);
- if (me.isDateValue && candidate instanceof Date) {
- candidate = candidate.getTime();
- v = me.dateValue;
- }
- return candidate === v;
- },
- ">=": function(candidate) {
- var v = this._filterValue;
- return this.getCandidateValue(candidate, v) >= v;
- },
- ">": function(candidate) {
- var v = this._filterValue;
- return this.getCandidateValue(candidate, v) > v;
- },
- "!=": function(candidate) {
- var me = this,
- v = me._filterValue;
- candidate = me.getCandidateValue(candidate, v);
- if (me.isDateValue && candidate instanceof Date) {
- candidate = candidate.getTime();
- v = me.dateValue;
- }
- return candidate != v;
- },
- "!==": function(candidate) {
- var me = this,
- v = me._filterValue;
- candidate = me.getCandidateValue(candidate, v, true);
- if (me.isDateValue && candidate instanceof Date) {
- candidate = candidate.getTime();
- v = me.dateValue;
- }
- return candidate !== v;
- },
- "in": function(candidate) {
- var v = this._filterValue;
- return Ext.Array.contains(v, this.getCandidateValue(candidate, v));
- },
- notin: function(candidate) {
- var v = this._filterValue;
- return !Ext.Array.contains(v, this.getCandidateValue(candidate, v));
- },
- like: function(candidate) {
- var v = this._filterValue;
- return v && this.getCandidateValue(candidate, v).toLowerCase().indexOf(v.toLowerCase()) > -1;
- },
- "/=": function(candidate) {
- var me = this,
- v = me._filterValue;
- candidate = me.getCandidateValue(candidate, v);
-
- if (v !== me.lastRegExpSource) {
- me.lastRegExpSource = v;
- try {
- me.regex = new RegExp(v, 'i');
- } catch (e) {
- me.regex = null;
- }
- }
- return me.regex ? me.regex.test(candidate) : false;
- }
- });
-
- operatorFns['=='] = operatorFns['='];
- operatorFns.gt = operatorFns['>'];
- operatorFns.ge = operatorFns['>='];
- operatorFns.lt = operatorFns['<'];
- operatorFns.le = operatorFns['<='];
- operatorFns.eq = operatorFns['='];
- operatorFns.ne = operatorFns['!='];
- });
- Ext.define('Ext.util.AbstractMixedCollection', {
- mixins: {
- observable: Ext.util.Observable
- },
-
- isMixedCollection: true,
-
- generation: 0,
-
- indexGeneration: 0,
- constructor: function(allowFunctions, keyFn) {
- var me = this;
-
- if (arguments.length === 1 && Ext.isObject(allowFunctions)) {
- me.initialConfig = allowFunctions;
- Ext.apply(me, allowFunctions);
- } else
- {
- me.allowFunctions = allowFunctions === true;
- if (keyFn) {
- me.getKey = keyFn;
- }
- me.initialConfig = {
- allowFunctions: me.allowFunctions,
- getKey: me.getKey
- };
- }
- me.items = [];
- me.map = {};
- me.keys = [];
- me.indexMap = {};
- me.length = 0;
-
-
-
-
- me.mixins.observable.constructor.call(me);
- },
- destroy: function() {
- var me = this;
- me.items = me.map = me.keys = me.indexMap = null;
- me.callParent();
- },
-
- allowFunctions: false,
-
- add: function(key, obj) {
- var len = this.length,
- out;
- if (arguments.length === 1) {
- out = this.insert(len, key);
- } else {
- out = this.insert(len, key, obj);
- }
- return out;
- },
-
- getKey: function(item) {
- return item.id;
- },
-
- replace: function(key, o) {
- var me = this,
- old, index;
- if (arguments.length == 1) {
- o = arguments[0];
- key = me.getKey(o);
- }
- old = me.map[key];
- if (typeof key == 'undefined' || key === null || typeof old == 'undefined') {
- return me.add(key, o);
- }
- me.generation++;
- index = me.indexOfKey(key);
- me.items[index] = o;
- me.map[key] = o;
- if (me.hasListeners.replace) {
- me.fireEvent('replace', key, old, o);
- }
- return o;
- },
-
- reorder: function(mapping) {
- var me = this,
- items = me.items,
- index = 0,
- length = items.length,
- order = [],
- remaining = [],
- oldIndex;
- me.suspendEvents();
-
- for (oldIndex in mapping) {
- order[mapping[oldIndex]] = items[oldIndex];
- }
- for (index = 0; index < length; index++) {
- if (mapping[index] == undefined) {
- remaining.push(items[index]);
- }
- }
- for (index = 0; index < length; index++) {
- if (order[index] == undefined) {
- order[index] = remaining.shift();
- }
- }
- me.clear();
- me.addAll(order);
- me.resumeEvents();
- },
-
- updateKey: function(oldKey, newKey) {
- var me = this,
- map = me.map,
- index = me.indexOfKey(oldKey),
-
- indexMap = me.indexMap,
- item;
- if (index > -1) {
- item = map[oldKey];
- delete map[oldKey];
- delete indexMap[oldKey];
- map[newKey] = item;
- indexMap[newKey] = index;
- me.keys[index] = newKey;
-
-
- me.indexGeneration = ++me.generation;
- }
- },
-
- addAll: function(objs) {
- var me = this,
- key;
- if (arguments.length > 1 || Ext.isArray(objs)) {
- me.insert(me.length, arguments.length > 1 ? arguments : objs);
- } else {
- for (key in objs) {
- if (objs.hasOwnProperty(key)) {
- if (me.allowFunctions || typeof objs[key] != 'function') {
- me.add(key, objs[key]);
- }
- }
- }
- }
- },
-
- each: function(fn, scope) {
- var items = Ext.Array.push([], this.items),
-
- i = 0,
- len = items.length,
- item;
- for (; i < len; i++) {
- item = items[i];
- if (fn.call(scope || item, item, i, len) === false) {
- break;
- }
- }
- },
-
- eachKey: function(fn, scope) {
- var keys = this.keys,
- items = this.items,
- i = 0,
- len = keys.length;
- for (; i < len; i++) {
- fn.call(scope || window, keys[i], items[i], i, len);
- }
- },
-
- findBy: function(fn, scope) {
- var keys = this.keys,
- items = this.items,
- i = 0,
- len = items.length;
- for (; i < len; i++) {
- if (fn.call(scope || window, items[i], keys[i])) {
- return items[i];
- }
- }
- return null;
- },
-
- insert: function(index, key, obj) {
- var out;
- if (Ext.isIterable(key)) {
- out = this.doInsert(index, key, obj);
- } else {
- if (arguments.length > 2) {
- out = this.doInsert(index, [
- key
- ], [
- obj
- ]);
- } else {
- out = this.doInsert(index, [
- key
- ]);
- }
- out = out[0];
- }
- return out;
- },
-
- doInsert: function(index, keys, objects) {
- var me = this,
- itemKey, removeIndex, i,
- len = keys.length,
- deDupedLen = len,
- fireAdd = me.hasListeners.add,
- syncIndices,
- newKeys = {},
- passedDuplicates, oldKeys, oldObjects;
-
-
- if (objects != null) {
- me.useLinearSearch = true;
- } else
- {
- objects = keys;
- keys = new Array(len);
- for (i = 0; i < len; i++) {
- keys[i] = this.getKey(objects[i]);
- }
- }
-
- me.suspendEvents();
- for (i = 0; i < len; i++) {
- itemKey = keys[i];
-
- removeIndex = me.indexOfKey(itemKey);
- if (removeIndex !== -1) {
- if (removeIndex < index) {
- index--;
- }
- me.removeAt(removeIndex);
- }
- if (itemKey != null) {
-
- if (newKeys[itemKey] != null) {
- passedDuplicates = true;
- deDupedLen--;
- }
- newKeys[itemKey] = i;
- }
- }
- me.resumeEvents();
-
- if (passedDuplicates) {
- oldKeys = keys;
- oldObjects = objects;
- keys = new Array(deDupedLen);
- objects = new Array(deDupedLen);
- i = 0;
-
-
- for (itemKey in newKeys) {
- keys[i] = oldKeys[newKeys[itemKey]];
- objects[i] = oldObjects[newKeys[itemKey]];
- i++;
- }
- len = deDupedLen;
- }
-
- syncIndices = index === me.length && me.indexGeneration === me.generation;
-
- Ext.Array.insert(me.items, index, objects);
- Ext.Array.insert(me.keys, index, keys);
- me.length += len;
- me.generation++;
- if (syncIndices) {
- me.indexGeneration = me.generation;
- }
- for (i = 0; i < len; i++ , index++) {
- itemKey = keys[i];
- if (itemKey != null) {
- me.map[itemKey] = objects[i];
-
- if (syncIndices) {
- me.indexMap[itemKey] = index;
- }
- }
- if (fireAdd) {
- me.fireEvent('add', index, objects[i], itemKey);
- }
- }
- return objects;
- },
-
- remove: function(o) {
- var me = this,
- removeKey, index;
-
-
-
-
-
- if (!me.useLinearSearch && (removeKey = me.getKey(o))) {
- index = me.indexOfKey(removeKey);
- } else
- {
- index = Ext.Array.indexOf(me.items, o);
- }
- return (index === -1) ? false : me.removeAt(index);
- },
-
- removeAll: function(items) {
- var me = this,
- i;
- if (items || me.hasListeners.remove) {
-
- if (items) {
- for (i = items.length - 1; i >= 0; --i) {
- me.remove(items[i]);
- }
- } else {
- while (me.length) {
- me.removeAt(0);
- }
- }
- } else {
- me.length = me.items.length = me.keys.length = 0;
- me.map = {};
- me.indexMap = {};
- me.generation++;
- me.indexGeneration = me.generation;
- }
- },
-
- removeAt: function(index) {
- var me = this,
- o, key;
- if (index < me.length && index >= 0) {
- me.length--;
- o = me.items[index];
- Ext.Array.erase(me.items, index, 1);
- key = me.keys[index];
- if (typeof key != 'undefined') {
- delete me.map[key];
- }
- Ext.Array.erase(me.keys, index, 1);
- if (me.hasListeners.remove) {
- me.fireEvent('remove', o, key);
- }
- me.generation++;
- return o;
- }
- return false;
- },
-
- removeRange: function(index, removeCount) {
- var me = this,
- o, key, i, limit, syncIndices, trimming;
- if (index < me.length && index >= 0) {
- if (!removeCount) {
- removeCount = 1;
- }
- limit = Math.min(index + removeCount, me.length);
- removeCount = limit - index;
-
- trimming = limit === me.length;
- syncIndices = trimming && me.indexGeneration === me.generation;
-
- for (i = index; i < limit; i++) {
- key = me.keys[i];
- if (key != null) {
- delete me.map[key];
- if (syncIndices) {
- delete me.indexMap[key];
- }
- }
- }
-
- o = me.items[i - 1];
- me.length -= removeCount;
- me.generation++;
- if (syncIndices) {
- me.indexGeneration = me.generation;
- }
-
-
-
-
- if (trimming) {
- me.items.length = me.keys.length = me.length;
- } else {
- me.items.splice(index, removeCount);
- me.keys.splice(index, removeCount);
- }
-
- return o;
- }
- return false;
- },
-
- removeAtKey: function(key) {
- var me = this,
- keys = me.keys,
- i;
-
- if (key == null) {
- for (i = keys.length - 1; i >= 0; i--) {
- if (keys[i] == null) {
- me.removeAt(i);
- }
- }
- } else
- {
- return me.removeAt(me.indexOfKey(key));
- }
- },
-
- getCount: function() {
- return this.length;
- },
-
- indexOf: function(o) {
- var me = this,
- key;
- if (o != null) {
-
-
-
-
-
- if (!me.useLinearSearch && (key = me.getKey(o))) {
- return this.indexOfKey(key);
- }
-
- return Ext.Array.indexOf(me.items, o);
- }
-
- return -1;
- },
-
- indexOfKey: function(key) {
- if (!this.map.hasOwnProperty(key)) {
- return -1;
- }
- if (this.indexGeneration !== this.generation) {
- this.rebuildIndexMap();
- }
- return this.indexMap[key];
- },
- rebuildIndexMap: function() {
- var me = this,
- indexMap = me.indexMap = {},
- keys = me.keys,
- len = keys.length,
- i;
- for (i = 0; i < len; i++) {
- indexMap[keys[i]] = i;
- }
- me.indexGeneration = me.generation;
- },
-
- get: function(key) {
- var me = this,
- mk = me.map[key],
- item = mk !== undefined ? mk : (typeof key == 'number') ? me.items[key] : undefined;
- return typeof item != 'function' || me.allowFunctions ? item : null;
- },
-
-
- getAt: function(index) {
- return this.items[index];
- },
-
- getByKey: function(key) {
- return this.map[key];
- },
-
- contains: function(o) {
- var me = this,
- key;
- if (o != null) {
-
-
-
-
-
- if (!me.useLinearSearch && (key = me.getKey(o))) {
- return this.map[key] != null;
- }
-
- return Ext.Array.indexOf(this.items, o) !== -1;
- }
- return false;
- },
-
- containsKey: function(key) {
- return this.map.hasOwnProperty(key);
- },
-
- clear: function() {
- var me = this;
-
- if (me.generation) {
- me.length = 0;
- me.items = [];
- me.keys = [];
- me.map = {};
- me.indexMap = {};
- me.generation++;
- me.indexGeneration = me.generation;
- }
- if (me.hasListeners.clear) {
- me.fireEvent('clear');
- }
- },
-
- first: function() {
- return this.items[0];
- },
-
- last: function() {
- return this.items[this.length - 1];
- },
-
- sum: function(property, root, start, end) {
- var values = this.extractValues(property, root),
- length = values.length,
- sum = 0,
- i;
- start = start || 0;
- end = (end || end === 0) ? end : length - 1;
- for (i = start; i <= end; i++) {
- sum += values[i];
- }
- return sum;
- },
-
- collect: function(property, root, allowNull) {
- var values = this.extractValues(property, root),
- length = values.length,
- hits = {},
- unique = [],
- value, strValue, i;
- for (i = 0; i < length; i++) {
- value = values[i];
- strValue = String(value);
- if ((allowNull || !Ext.isEmpty(value)) && !hits[strValue]) {
- hits[strValue] = true;
- unique.push(value);
- }
- }
- return unique;
- },
-
- extractValues: function(property, root) {
- var values = this.items;
- if (root) {
- values = Ext.Array.pluck(values, root);
- }
- return Ext.Array.pluck(values, property);
- },
-
- hasRange: function(start, end) {
- return (end < this.length);
- },
-
- getRange: function(start, end) {
- var me = this,
- items = me.items,
- range = [],
- len = items.length,
- tmp, reverse;
- if (len < 1) {
- return range;
- }
- if (start > end) {
- reverse = true;
- tmp = start;
- start = end;
- end = tmp;
- }
- if (start < 0) {
- start = 0;
- }
- if (end == null || end >= len) {
- end = len - 1;
- }
- range = items.slice(start, end + 1);
- if (reverse && range.length) {
- range.reverse();
- }
- return range;
- },
-
- filter: function(property, value, anyMatch, caseSensitive) {
- var filters = [];
-
- if (Ext.isString(property)) {
- filters.push(new Ext.util.Filter({
- property: property,
- value: value,
- anyMatch: anyMatch,
- caseSensitive: caseSensitive
- }));
- } else if (Ext.isArray(property) || property instanceof Ext.util.Filter) {
- filters = filters.concat(property);
- }
-
-
-
- return this.filterBy(Ext.util.Filter.createFilterFn(filters));
- },
-
- filterBy: function(fn, scope) {
- var me = this,
- newMC = new me.self(me.initialConfig),
- keys = me.keys,
- items = me.items,
- length = items.length,
- i;
- newMC.getKey = me.getKey;
- for (i = 0; i < length; i++) {
- if (fn.call(scope || me, items[i], keys[i])) {
- newMC.add(keys[i], items[i]);
- }
- }
-
-
-
- newMC.useLinearSearch = me.useLinearSearch;
- return newMC;
- },
-
- findIndex: function(property, value, start, anyMatch, caseSensitive) {
- if (Ext.isEmpty(value, false)) {
- return -1;
- }
- value = this.createValueMatcher(value, anyMatch, caseSensitive);
- return this.findIndexBy(function(o) {
- return o && value.test(o[property]);
- }, null, start);
- },
-
- findIndexBy: function(fn, scope, start) {
- var me = this,
- keys = me.keys,
- items = me.items,
- i = start || 0,
- len = items.length;
- for (; i < len; i++) {
- if (fn.call(scope || me, items[i], keys[i])) {
- return i;
- }
- }
- return -1;
- },
-
- createValueMatcher: function(value, anyMatch, caseSensitive, exactMatch) {
- if (!value.exec) {
-
- var er = Ext.String.escapeRegex;
- value = String(value);
- if (anyMatch === true) {
- value = er(value);
- } else {
- value = '^' + er(value);
- if (exactMatch === true) {
- value += '$';
- }
- }
- value = new RegExp(value, caseSensitive ? '' : 'i');
- }
- return value;
- },
-
- clone: function() {
- var me = this,
- copy = new me.self(me.initialConfig);
- copy.add(me.keys, me.items);
-
-
-
- copy.useLinearSearch = me.useLinearSearch;
- return copy;
- }
- });
- Ext.define('Ext.util.Sorter', {
- isSorter: true,
- config: {
-
- property: null,
-
- sorterFn: null,
-
- root: null,
-
- transform: null,
-
- direction: "ASC",
-
- id: undefined
- },
- statics: {
-
- createComparator: function(sorters, nextFn) {
- nextFn = nextFn || 0;
- return function(lhs, rhs) {
- var items = sorters.isCollection ? sorters.items : sorters,
- n = items.length,
- comp, i;
- for (i = 0; i < n; ++i) {
- comp = items[i].sort(lhs, rhs);
- if (comp) {
- return comp;
- }
- }
- return nextFn && nextFn(lhs, rhs);
- };
- }
- },
-
- multiplier: 1,
- constructor: function(config) {
-
- if (config && !this.isGrouper) {
- if (!config.property === !config.sorterFn) {
-
- Ext.raise("A Sorter requires either a property or a sorterFn.");
- }
- }
-
- this.initConfig(config);
- },
- getId: function() {
- var id = this._id;
- if (!id) {
- id = this.getProperty();
- if (!id) {
- id = Ext.id(null, 'ext-sorter-');
- }
- this._id = id;
- }
- return id;
- },
- sort: function(lhs, rhs) {
- return this.multiplier * this.sortFn(lhs, rhs);
- },
-
- sortFn: function(item1, item2) {
- var me = this,
- transform = me._transform,
- root = me._root,
- property = me._property,
- lhs, rhs;
- if (root) {
- item1 = item1[root];
- item2 = item2[root];
- }
- lhs = item1[property];
- rhs = item2[property];
- if (transform) {
- lhs = transform(lhs);
- rhs = transform(rhs);
- }
- return (lhs > rhs) ? 1 : (lhs < rhs ? -1 : 0);
- },
- applyDirection: function(direction) {
- return direction ? direction : 'ASC';
- },
- updateDirection: function(direction) {
- this.multiplier = (direction.toUpperCase() === "DESC") ? -1 : 1;
- },
- updateProperty: function(property) {
- if (property) {
-
- delete this.sortFn;
- }
- },
- updateSorterFn: function(sorterFn) {
-
- this.sortFn = sorterFn;
- },
-
- toggle: function() {
- this.setDirection(Ext.String.toggle(this.getDirection(), "ASC", "DESC"));
- },
-
- getState: function() {
- var me = this,
- result = {
- root: me.getRoot(),
- property: me.getProperty(),
- direction: me.getDirection()
- };
-
-
- if (me._id) {
- result.id = me._id;
- }
- return result;
- },
-
- serialize: function() {
- return {
- property: this.getProperty(),
- direction: this.getDirection()
- };
- }
- });
- Ext.define("Ext.util.Sortable", {
-
- isSortable: true,
- $configPrefixed: false,
- $configStrict: false,
- config: {
-
- sorters: null
- },
-
- defaultSortDirection: "ASC",
-
-
- multiSortLimit: 3,
- statics: {
-
- createComparator: function(sorters) {
- return sorters && sorters.length ? function(r1, r2) {
- var result = sorters[0].sort(r1, r2),
- length = sorters.length,
- i = 1;
-
-
- for (; !result && i < length; i++) {
- result = sorters[i].sort.call(sorters[i], r1, r2);
- }
- return result;
- } : function() {
- return 0;
- };
- }
- },
-
- applySorters: function(sorters) {
- var me = this,
- sortersCollection = me.getSorters() || new Ext.util.MixedCollection(false, Ext.returnId);
-
- if (sorters) {
- sortersCollection.addAll(me.decodeSorters(sorters));
- }
- return sortersCollection;
- },
-
- sort: function(sorters, direction, insertionPosition, doSort) {
- var me = this,
- sorter, overFlow,
- currentSorters = me.getSorters();
- if (!currentSorters) {
- me.setSorters(null);
- currentSorters = me.getSorters();
- }
- if (Ext.isArray(sorters)) {
- doSort = insertionPosition;
- insertionPosition = direction;
- } else if (Ext.isObject(sorters)) {
- sorters = [
- sorters
- ];
- doSort = insertionPosition;
- insertionPosition = direction;
- } else if (Ext.isString(sorters)) {
- sorter = currentSorters.get(sorters);
- if (!sorter) {
- sorter = {
- property: sorters,
- direction: direction
- };
- } else if (direction == null) {
- sorter.toggle();
- } else {
- sorter.setDirection(direction);
- }
- sorters = [
- sorter
- ];
- }
- if (sorters && sorters.length) {
- sorters = me.decodeSorters(sorters);
- switch (insertionPosition) {
-
-
-
-
- case "multi":
-
- currentSorters.insert(0, sorters[0]);
-
- overFlow = currentSorters.getCount() - me.multiSortLimit;
- if (overFlow > 0) {
- currentSorters.removeRange(me.multiSortLimit, overFlow);
- };
- break;
- case "prepend":
- currentSorters.insert(0, sorters);
- break;
- case "append":
- currentSorters.addAll(sorters);
- break;
- case undefined:
- case null:
- case "replace":
- currentSorters.clear();
- currentSorters.addAll(sorters);
- break;
- default:
-
- Ext.raise('Sorter insertion point must be "multi", "prepend", "append" or "replace"');
- }
- }
-
- if (doSort !== false) {
- me.fireEvent('beforesort', me, sorters);
- me.onBeforeSort(sorters);
- if (me.getSorterCount()) {
-
- me.doSort(me.generateComparator());
- }
- }
- return sorters;
- },
-
- getSorterCount: function() {
- return this.getSorters().items.length;
- },
-
- generateComparator: function() {
- var sorters = this.getSorters().getRange();
- return sorters.length ? this.createComparator(sorters) : this.emptyComparator;
- },
- emptyComparator: function() {
- return 0;
- },
- onBeforeSort: Ext.emptyFn,
-
- decodeSorters: function(sorters) {
- if (!Ext.isArray(sorters)) {
- if (sorters === undefined) {
- sorters = [];
- } else {
- sorters = [
- sorters
- ];
- }
- }
- var length = sorters.length,
- Sorter = Ext.util.Sorter,
- model = this.getModel ? this.getModel() : this.model,
- field, config, i;
- for (i = 0; i < length; i++) {
- config = sorters[i];
- if (!(config instanceof Sorter)) {
- if (Ext.isString(config)) {
- config = {
- property: config
- };
- }
- Ext.applyIf(config, {
- root: this.sortRoot,
- direction: "ASC"
- });
-
- if (config.fn) {
- config.sorterFn = config.fn;
- }
-
- if (typeof config == 'function') {
- config = {
- sorterFn: config
- };
- }
-
- if (model && !config.transform) {
- field = model.getField(config.property);
- config.transform = field && field.sortType !== Ext.identityFn ? field.sortType : undefined;
- }
- sorters[i] = new Ext.util.Sorter(config);
- }
- }
- return sorters;
- },
-
- getFirstSorter: function() {
- var sorters = this.getSorters().items,
- len = sorters.length,
- i = 0,
- sorter;
- for (; i < len; ++i) {
- sorter = sorters[i];
- if (!sorter.isGrouper) {
- return sorter;
- }
- }
- return null;
- }
- }, function() {
-
- this.prototype.createComparator = this.createComparator;
- });
- Ext.define('Ext.util.MixedCollection', {
- extend: Ext.util.AbstractMixedCollection,
- mixins: {
- sortable: Ext.util.Sortable
- },
-
-
- constructor: function() {
- this.initConfig();
- this.callParent(arguments);
- },
- doSort: function(sorterFn) {
- this.sortBy(sorterFn);
- },
-
- _sort: function(property, dir, fn) {
- var me = this,
- i, len,
- dsc = String(dir).toUpperCase() == 'DESC' ? -1 : 1,
-
- c = [],
- keys = me.keys,
- items = me.items,
- o;
-
- fn = fn || function(a, b) {
- return a - b;
- };
-
- for (i = 0 , len = items.length; i < len; i++) {
- c[c.length] = {
- key: keys[i],
- value: items[i],
- index: i
- };
- }
-
- Ext.Array.sort(c, function(a, b) {
- return fn(a[property], b[property]) * dsc || (
- a.index < b.index ? -1 : 1);
- });
-
-
- for (i = 0 , len = c.length; i < len; i++) {
- o = c[i];
- items[i] = o.value;
- keys[i] = o.key;
- me.indexMap[o.key] = i;
- }
- me.generation++;
- me.indexGeneration = me.generation;
- me.fireEvent('sort', me);
- },
-
- sortBy: function(sorterFn) {
- var me = this,
- items = me.items,
- item,
- keys = me.keys,
- key,
- length = items.length,
- i;
-
- for (i = 0; i < length; i++) {
- items[i].$extCollectionIndex = i;
- }
- Ext.Array.sort(items, function(a, b) {
- return sorterFn(a, b) || (
- a.$extCollectionIndex < b.$extCollectionIndex ? -1 : 1);
- });
-
- for (i = 0; i < length; i++) {
- item = items[i];
- key = me.getKey(item);
- keys[i] = key;
- me.indexMap[key] = i;
- delete item.$extCollectionIndex;
- }
- me.generation++;
- me.indexGeneration = me.generation;
- me.fireEvent('sort', me, items, keys);
- },
-
- findInsertionIndex: function(newItem, sorterFn) {
- var me = this,
- items = me.items,
- start = 0,
- end = items.length - 1,
- middle, comparison;
- if (!sorterFn) {
- sorterFn = me.generateComparator();
- }
- while (start <= end) {
- middle = (start + end) >> 1;
- comparison = sorterFn(newItem, items[middle]);
- if (comparison >= 0) {
- start = middle + 1;
- } else if (comparison < 0) {
- end = middle - 1;
- }
- }
- return start;
- },
-
- reorder: function(mapping) {
- this.callParent([
- mapping
- ]);
- this.fireEvent('sort', this);
- },
-
- sortByKey: function(dir, fn) {
- this._sort('key', dir, fn || function(a, b) {
- var v1 = String(a).toUpperCase(),
- v2 = String(b).toUpperCase();
- return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
- });
- }
- });
- Ext.define('Ext.util.CollectionKey', {
- mixins: [
- Ext.mixin.Identifiable
- ],
- isCollectionKey: true,
- observerPriority: -200,
- config: {
- collection: null,
-
- keyFn: null,
-
- property: null,
-
- rootProperty: null,
- unique: true
- },
-
- generation: 0,
-
- map: null,
-
- mapRebuilds: 0,
-
- constructor: function(config) {
- this.initConfig(config);
-
- if (!Ext.isFunction(this.getKey)) {
- Ext.raise('CollectionKey requires a keyFn or property config');
- }
- },
-
-
- get: function(key) {
- var map = this.map || this.getMap();
- return map[key] || null;
- },
-
- clear: function() {
- this.map = null;
- },
- getRootProperty: function() {
- var me = this,
- root = this.callParent();
- return root !== null ? root : me.getCollection().getRootProperty();
- },
-
- indexOf: function(key, startAt) {
- var map = this.map || this.getMap(),
- item = map[key],
- collection = this.getCollection(),
- length = collection.length,
- i, index, items, n;
- if (!item) {
- return -1;
- }
- if (startAt === undefined) {
- startAt = -1;
- }
- if (item instanceof Array) {
- items = item;
- index = length;
-
- for (n = items.length; n-- > 0; ) {
- i = collection.indexOf(items[n]);
- if (i < index && i > startAt) {
- index = i;
- }
- }
- if (index === length) {
- return -1;
- }
- } else {
- index = collection.indexOf(item);
- }
- return (index > startAt) ? index : -1;
- },
-
- updateKey: function(item, oldKey) {
- var me = this,
- map = me.map,
- bucket, index;
- if (map) {
- bucket = map[oldKey];
- if (bucket instanceof Array) {
- index = Ext.Array.indexOf(bucket, item);
- if (index >= 0) {
- if (bucket.length > 2) {
- bucket.splice(index, 1);
- } else {
-
-
-
- map[oldKey] = bucket[1 - index];
- }
- }
- }
-
- else if (bucket) {
-
- if (me.getUnique() && bucket !== item) {
- Ext.raise('Incorrect oldKey "' + oldKey + '" for item with newKey "' + me.getKey(item) + '"');
- }
-
- delete map[oldKey];
- }
- me.add([
- item
- ]);
- }
- },
-
-
- onCollectionAdd: function(collection, add) {
- if (this.map) {
- this.add(add.items);
- }
- },
- onCollectionItemChange: function(collection, details) {
- this.map = null;
- },
- onCollectionRefresh: function() {
- this.map = null;
- },
- onCollectionRemove: function(collection, remove) {
- var me = this,
- map = me.map,
- items = remove.items,
- length = items.length,
- i, item, key;
- if (map) {
- if (me.getUnique() && length < collection.length / 2) {
- for (i = 0; i < length; ++i) {
- key = me.getKey(item = items[i]);
- delete map[key];
- }
- } else {
- me.map = null;
- }
- }
- },
-
-
- add: function(items) {
- var me = this,
- map = me.map,
- bucket, i, item, key, length, unique;
- length = items.length;
- unique = me.getUnique();
- for (i = 0; i < length; ++i) {
- key = me.getKey(item = items[i]);
- if (unique || !(key in map)) {
- map[key] = item;
- } else {
- if (!((bucket = map[key]) instanceof Array)) {
- map[key] = bucket = [
- bucket
- ];
- }
- bucket.push(item);
- }
- }
- },
- applyKeyFn: function(keyFn) {
- if (Ext.isString(keyFn)) {
- this.getKey = function(item) {
- return item[keyFn]();
- };
- } else {
- this.getKey = keyFn;
- }
- },
- updateProperty: function(property) {
- var root = this.getRootProperty();
- this.getKey = function(item) {
- return (root ? item[root] : item)[property];
- };
- },
- getMap: function() {
- var me = this,
- map = me.map;
- if (!map) {
- me.map = map = {};
- me.keysByItemKey = {};
- ++me.mapRebuilds;
- me.add(me.getCollection().items);
- }
- return map;
- },
- updateCollection: function(collection, oldCollection) {
- if (collection) {
- collection.addObserver(this);
- }
- if (oldCollection) {
- oldCollection.removeObserver(this);
- }
- },
- clone: function() {
- return new Ext.util.CollectionKey(this.getCurrentConfig());
- },
- destroy: function() {
- this.clear();
- this.getCollection().removeObserver(this);
- this.destroyed = true;
- }
- });
- Ext.define('Ext.util.Grouper', {
- extend: Ext.util.Sorter,
- isGrouper: true,
- config: {
-
- groupFn: null,
-
-
- sortProperty: null
- },
- constructor: function(config) {
-
- if (config) {
- if (config.getGroupString) {
- Ext.raise("Cannot set getGroupString - use groupFn instead");
- }
- }
-
- this.callParent(arguments);
- },
-
- getGroupString: function(item) {
- var group = this._groupFn(item);
- return (group != null) ? String(group) : '';
- },
- sortFn: function(item1, item2) {
- var me = this,
- lhs = me._groupFn(item1),
- rhs = me._groupFn(item2),
- property = me._sortProperty,
-
- root = me._root,
- sorterFn = me._sorterFn,
- transform = me._transform;
-
-
- if (lhs === rhs) {
- return 0;
- }
- if (property || sorterFn) {
- if (sorterFn) {
- return sorterFn.call(this, item1, item2);
- }
- if (root) {
- item1 = item1[root];
- item2 = item2[root];
- }
- lhs = item1[property];
- rhs = item2[property];
- if (transform) {
- lhs = transform(lhs);
- rhs = transform(rhs);
- }
- }
- return (lhs > rhs) ? 1 : (lhs < rhs ? -1 : 0);
- },
- standardGroupFn: function(item) {
- var root = this._root;
- return (root ? item[root] : item)[this._property];
- },
- updateSorterFn: function() {},
-
- updateProperty: function() {
-
- if (!this.getGroupFn()) {
- this.setGroupFn(this.standardGroupFn);
- }
- }
- });
- Ext.define('Ext.util.Collection', {
- mixins: [
- Ext.mixin.Observable
- ],
-
- isCollection: true,
- config: {
- autoFilter: true,
-
- autoSort: true,
-
- autoGroup: true,
-
- decoder: null,
-
- extraKeys: null,
-
- filters: null,
-
- grouper: null,
-
- groups: null,
-
- groupConfig: null,
-
- rootProperty: null,
-
- sorters: null,
-
- multiSortLimit: 3,
-
- defaultSortDirection: 'ASC',
-
- source: null,
-
- trackGroups: true
- },
-
- generation: 0,
-
- indices: null,
-
- indexRebuilds: 0,
-
- updating: 0,
-
- grouped: false,
-
- sorted: false,
-
- filtered: false,
-
- $endUpdatePriority: 1001,
-
- manageSorters: true,
-
-
-
-
-
-
-
-
-
-
- constructor: function(config) {
- var me = this;
-
- me.callParent([
- config
- ]);
-
-
- me.items = [];
-
- me.map = {};
-
- me.length = 0;
-
- if (config && config.keyFn) {
- me.getKey = config.keyFn;
- }
- me.mixins.observable.constructor.call(me, config);
- },
-
- destroy: function() {
- var me = this,
- filters = me._filters,
- sorters = me._sorters,
- groups = me._groups;
- if (filters) {
- filters.destroy();
- me._filters = null;
- }
- if (sorters) {
-
-
- me.grouped = me.sorted = false;
- me.setSorters(null);
- if (me.manageSorters) {
- sorters.destroy();
- }
- }
- if (groups) {
- groups.destroy();
- me._groups = null;
- }
- me.setSource(null);
- me.observers = me.items = me.map = null;
- me.callParent();
- },
-
- add: function(item) {
- var me = this,
- items = me.decodeItems(arguments, 0),
- ret = items;
- if (items.length) {
- me.splice(me.length, 0, items);
- ret = (items.length === 1) ? items[0] : items;
- }
- return ret;
- },
-
- replaceAll: function() {
- var me = this,
- ret, items;
- items = me.decodeItems(arguments, 0);
- ret = items;
- if (items.length) {
- me.splice(0, me.length, items);
- ret = (items.length === 1) ? items[0] : items;
- } else {
- me.removeAll();
- }
- return ret;
- },
-
- aggregate: function(property, operation, begin, end, scope) {
- var me = this,
- args = Ext.Array.slice(arguments);
- args.unshift(me.items);
- return me.aggregateItems.apply(me, args);
- },
-
- aggregateByGroup: function(property, operation, scope) {
- var groups = this.getGroups();
- return this.aggregateGroups(groups, property, operation, scope);
- },
-
- aggregateItems: function(items, property, operation, begin, end, scope) {
- var me = this,
- range = Ext.Number.clipIndices(items.length, [
- begin,
- end
- ]),
-
- subsetRequested = (begin !== 0 && end !== items.length),
- i, j, rangeLen, root, value, values, valueItems;
- begin = range[0];
- end = range[1];
- if (!Ext.isFunction(operation)) {
- operation = me._aggregators[operation];
- return operation.call(me, items, begin, end, property, me.getRootProperty());
- }
- root = me.getRootProperty();
-
-
- values = new Array(rangeLen);
- valueItems = subsetRequested ? new Array(rangeLen) : items;
-
- for (i = begin , j = 0; i < end; ++i , j++) {
- if (subsetRequested) {
- valueItems[j] = value = items[i];
- }
- values[j] = (root ? value[root] : value)[property];
- }
- return operation.call(scope || me, items, values, 0);
- },
-
- aggregateGroups: function(groups, property, operation, scope) {
- var items = groups.items,
- len = items.length,
- callDirect = !Ext.isFunction(operation),
- out = {},
- i, group, result;
- for (i = 0; i < len; ++i) {
- group = items[i];
- if (!callDirect) {
- result = this.aggregateItems(group.items, property, operation, null, null, scope);
- } else {
- result = group[operation](property);
- }
- out[group.getGroupKey()] = result;
- }
- return out;
- },
-
- beginUpdate: function() {
- if (!this.updating++) {
-
- this.notify('beginupdate');
- }
- },
-
- clear: function() {
- var me = this,
- generation = me.generation,
- ret = generation ? me.items : [],
- extraKeys, indexName;
- if (generation) {
- me.items.length = me.length = 0;
- me.map = {};
- me.indices = {};
- me.generation++;
-
- extraKeys = me.getExtraKeys();
- if (extraKeys) {
- for (indexName in extraKeys) {
- extraKeys[indexName].clear();
- }
- }
- }
- return ret;
- },
-
- clone: function() {
- var me = this,
- copy = new me.self(me.initialConfig);
- copy.add(me.items);
- return copy;
- },
-
- collect: function(property, root, allowNull) {
- var items = this.items,
- length = items.length,
- map = {},
- ret = [],
- i, strValue, value;
- for (i = 0; i < length; ++i) {
- value = items[i];
- value = (root ? value[root] : value)[property];
- strValue = String(value);
- if ((allowNull || !Ext.isEmpty(value)) && !map[strValue]) {
- map[strValue] = 1;
- ret.push(value);
- }
- }
- return ret;
- },
-
- contains: function(item) {
- var ret = false,
- key;
- if (item != null) {
- key = this.getKey(item);
- ret = this.map[key] === item;
- }
- return ret;
- },
-
- containsAll: function(items) {
- var all = Ext.isArray(items) ? items : arguments,
- i;
- for (i = all.length; i-- > 0; ) {
- if (!this.contains(all[i])) {
- return false;
- }
- }
- return true;
- },
-
- containsKey: function(key) {
- return key in this.map;
- },
-
- createFiltered: function(property, value, anyMatch, caseSensitive, exactMatch) {
- var me = this,
- ret = new me.self(me.initialConfig),
- root = me.getRootProperty(),
- items = me.items,
- length, i, filters, fn, scope;
- if (Ext.isFunction(property)) {
- fn = property;
- scope = value;
- } else {
-
- if (Ext.isString(property)) {
- filters = [
- new Ext.util.Filter({
- property: property,
- value: value,
- root: root,
- anyMatch: anyMatch,
- caseSensitive: caseSensitive,
- exactMatch: exactMatch
- })
- ];
- } else if (property instanceof Ext.util.Filter) {
- filters = [
- property
- ];
- property.setRoot(root);
- } else if (Ext.isArray(property)) {
- filters = property.slice(0);
- for (i = 0 , length = filters.length; i < length; ++i) {
- filters[i].setRoot(root);
- }
- }
-
-
-
- fn = Ext.util.Filter.createFilterFn(filters);
- }
- scope = scope || me;
- for (i = 0 , length = items.length; i < length; i++) {
- if (fn.call(scope, items[i])) {
- ret.add(items[i]);
- }
- }
- return ret;
- },
-
- filterBy: function(fn, scope) {
- return this.createFiltered(fn, scope);
- },
-
- each: function(fn, scope) {
- var items = this.items,
- len = items.length,
- i, ret;
- if (len) {
- scope = scope || this;
- items = items.slice(0);
-
- for (i = 0; i < len; i++) {
- ret = fn.call(scope, items[i], i, len);
- if (ret === false) {
- break;
- }
- }
- }
- return ret;
- },
-
- eachKey: function(fn, scope) {
- var me = this,
- items = me.items,
- len = items.length,
- i, item, key, ret;
- if (len) {
- scope = scope || me;
- items = items.slice(0);
-
- for (i = 0; i < len; i++) {
- key = me.getKey(item = items[i]);
- ret = fn.call(scope, key, item, i, len);
- if (ret === false) {
- break;
- }
- }
- }
- return ret;
- },
-
- endUpdate: function() {
- if (!--this.updating) {
- this.notify('endupdate');
- }
- },
-
- find: function(property, value, start, startsWith, endsWith, ignoreCase) {
- if (Ext.isEmpty(value, false)) {
- return null;
- }
- var regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase),
- root = this.getRootProperty();
- return this.findBy(function(item) {
- return item && regex.test((root ? item[root] : item)[property]);
- }, null, start);
- },
-
- findBy: function(fn, scope, start) {
- var me = this,
- items = me.items,
- len = items.length,
- i, item, key;
- scope = scope || me;
- for (i = start || 0; i < len; i++) {
- key = me.getKey(item = items[i]);
- if (fn.call(scope, item, key)) {
- return items[i];
- }
- }
- return null;
- },
-
- findIndex: function(property, value, start, startsWith, endsWith, ignoreCase) {
- var item = this.find(property, value, start, startsWith, endsWith, ignoreCase);
- return item ? this.indexOf(item) : -1;
- },
-
- findIndexBy: function(fn, scope, start) {
- var item = this.findBy(fn, scope, start);
- return item ? this.indexOf(item) : -1;
- },
-
- first: function(grouped) {
- var groups = grouped ? this.getGroups() : undefined;
- return groups ? this.aggregateGroups(groups, null, 'first') : this.items[0];
- },
-
- last: function(grouped) {
- var groups = grouped ? this.getGroups() : undefined;
- return groups ? this.aggregateGroups(groups, null, 'last') : this.items[this.length - 1];
- },
-
- get: function(key) {
- return this.map[key];
- },
-
- getAt: function(index) {
- return this.items[index];
- },
-
- getByKey: function(key) {
- return this.map[key];
- },
-
- getCount: function() {
- return this.length;
- },
-
- getKey: function(item) {
- var id = item.id;
- return (id === 0 || id) ? id : ((id = item._id) === 0 || id) ? id : item.getId();
- },
-
- getRange: function(begin, end) {
- var items = this.items,
- length = items.length,
- range;
-
- if (begin > end) {
- Ext.raise('Inverted range passed to Collection.getRange: [' + begin + ',' + end + ']');
- }
-
- if (!length) {
- range = [];
- } else {
- range = Ext.Number.clipIndices(length, [
- begin,
- end
- ]);
- range = items.slice(range[0], range[1]);
- }
- return range;
- },
-
-
- getValues: function(property, root, start, end) {
- var items = this.items,
- range = Ext.Number.clipIndices(items.length, [
- start,
- end
- ]),
- ret = [],
- i, value;
- for (i = range[0] , end = range[1]; i < end; ++i) {
- value = items[i];
- value = (root ? value[root] : value)[property];
- ret.push(value);
- }
- return ret;
- },
-
- indexOf: function(item) {
- if (!item) {
- return -1;
- }
- var key = this.getKey(item);
- return this.indexOfKey(key);
- },
-
- indexOfKey: function(key) {
- var me = this,
- indices = me.indices;
- if (key in me.map) {
- if (!indices) {
- indices = me.getIndices();
- }
- return indices[key];
- }
- return -1;
- },
-
- insert: function(index, item) {
- var me = this,
- items = me.decodeItems(arguments, 1),
- ret = items;
- if (items.length) {
- me.splice(index, 0, items);
- ret = (items.length === 1) ? items[0] : items;
- }
- return ret;
- },
-
- itemChanged: function(item, modified, oldKey, meta) {
- var me = this,
- keyChanged = oldKey !== undefined,
- filtered = me.filtered && me.getAutoFilter(),
- filterChanged = false,
- itemMovement = 0,
- items = me.items,
- last = me.length - 1,
- sorted = me.sorted && last > 0 && me.getAutoSort(),
-
-
-
-
- source = me.getSource(),
- toRemove = 0,
- itemFiltered = false,
- wasFiltered = false,
- details, newKey, sortFn, toAdd, index, newIndex;
-
- if (source && !source.updating) {
- me.sourceUpdating = true;
- source.itemChanged(item, modified, oldKey, meta);
- me.sourceUpdating = false;
- } else
-
- {
- newKey = me.getKey(item);
- if (filtered) {
- index = me.indexOfKey(keyChanged ? oldKey : newKey);
- wasFiltered = (index < 0);
- itemFiltered = me.isItemFiltered(item);
- filterChanged = (wasFiltered !== itemFiltered);
- }
- if (filterChanged) {
- if (itemFiltered) {
- toRemove = [
- item
- ];
- newIndex = -1;
- } else {
- toAdd = [
- item
- ];
- newIndex = me.length;
- }
- }
-
-
-
- else if (sorted && !itemFiltered) {
-
-
- if (!filtered) {
-
-
- index = me.indexOfKey(keyChanged ? oldKey : newKey);
- }
- sortFn = me.getSortFn();
- if (index !== -1) {
- if (index && sortFn(items[index - 1], items[index]) > 0) {
-
-
-
- itemMovement = -1;
-
-
- newIndex = Ext.Array.binarySearch(items, item, 0, index, sortFn);
- } else if (index < last && sortFn(items[index], items[index + 1]) > 0) {
-
-
-
- itemMovement = 1;
-
-
- newIndex = Ext.Array.binarySearch(items, item, index + 1, sortFn);
- }
- if (itemMovement) {
- toAdd = [
- item
- ];
- }
- }
- }
-
-
-
-
-
-
- details = {
- item: item,
- key: newKey,
- index: newIndex,
- filterChanged: filterChanged,
- keyChanged: keyChanged,
- indexChanged: !!itemMovement,
- filtered: itemFiltered,
- oldIndex: index,
- newIndex: newIndex,
- wasFiltered: wasFiltered,
- meta: meta
- };
- if (keyChanged) {
- details.oldKey = oldKey;
- }
- if (modified) {
- details.modified = modified;
- }
- ++me.generation;
- me.beginUpdate();
- me.notify('beforeitemchange', [
- details
- ]);
- if (keyChanged) {
- me.updateKey(item, oldKey, details);
- }
- if (toAdd || toRemove) {
-
-
-
-
-
- me.splice(newIndex, toRemove, toAdd);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (itemMovement > 0) {
- details.newIndex--;
- } else if (itemMovement < 0) {
- details.oldIndex++;
- }
-
-
-
- me.notify(itemFiltered ? 'filtereditemchange' : 'itemchange', [
- details
- ]);
- me.endUpdate();
- }
- },
-
- remove: function(item) {
- var me = this,
- items = me.decodeRemoveItems(arguments, 0),
- length = me.length;
- me.splice(0, items);
- return length - me.length;
- },
-
- removeAll: function() {
- var me = this,
- length = me.length;
- if (me.generation && length) {
- me.splice(0, length);
- }
- return me;
- },
-
- removeAt: function(index, count) {
- var me = this,
- length = me.length,
- Num = Ext.Number,
- range = Num.clipIndices(length, [
- index,
- (count === undefined) ? 1 : count
- ], Num.Clip.COUNT),
- n = range[0],
- removeCount = range[1] - n,
- item = (removeCount === 1) && me.getAt(n),
- removed;
- me.splice(n, removeCount);
- removed = me.length - length;
- return (item && removed) ? item : removed;
- },
-
- removeByKey: function(key) {
- var item = this.getByKey(key);
- if (!item || !this.remove(item)) {
- return false;
- }
- return item;
- },
-
- replace: function(item) {
- var index = this.indexOf(item);
- if (index === -1) {
- this.add(item);
- } else {
- this.insert(index, item);
- }
- },
-
- splice: function(index, toRemove, toAdd) {
- var me = this,
- autoSort = me.sorted && me.getAutoSort(),
- map = me.map,
- items = me.items,
- length = me.length,
- removeItems = (toRemove instanceof Array) ? me.decodeRemoveItems(toRemove) : null,
- isRemoveCount = !removeItems,
- Num = Ext.Number,
- range = Num.clipIndices(length, [
- index,
- isRemoveCount ? toRemove : 0
- ], Num.Clip.COUNT),
- begin = range[0],
- end = range[1],
-
- removeCount = end - begin,
- newItems = me.decodeItems(arguments, 2),
- newCount = newItems ? newItems.length : 0,
- addItems, newItemsMap, removeMap,
- insertAt = begin,
- indices = me.indices || ((newCount || removeItems) ? me.getIndices() : null),
- adds = null,
- removes = removeCount ? [
- begin
- ] : null,
- newKeys = null,
- source = me.getSource(),
- chunk, chunkItems, chunks, i, item, itemIndex, k, key, keys, n, duplicates, sorters;
- if (source && !source.updating) {
-
-
-
-
- if (isRemoveCount) {
- removeItems = [];
- for (i = 0; i < removeCount; ++i) {
- removeItems.push(items[begin + i]);
- }
- }
- if (begin < length) {
-
-
- i = source.indexOf(items[begin]);
- } else {
-
- i = source.length;
- }
-
- me.requestedIndex = index;
- source.splice(i, removeItems, newItems);
- delete me.requestedIndex;
- return me;
- }
-
-
-
-
- if (newCount) {
- addItems = newItems;
- newKeys = [];
- newItemsMap = {};
-
-
-
-
- if (autoSort) {
-
- sorters = me.getSorters();
- if (newCount > 1) {
- if (!addItems.$cloned) {
- newItems = addItems = addItems.slice(0);
- }
- me.sortData(addItems);
- }
- }
- for (i = 0; i < newCount; ++i) {
- key = me.getKey(item = newItems[i]);
- if ((k = newItemsMap[key]) !== undefined) {
-
-
-
- (duplicates || (duplicates = {}))[k] = 1;
- } else {
-
-
-
- itemIndex = indices[key];
- if (itemIndex < begin || end <= itemIndex) {
- (removes || (removes = [])).push(itemIndex);
- }
- }
-
- newItemsMap[key] = i;
-
- newKeys.push(key);
- }
-
- if (duplicates) {
- keys = newKeys;
- addItems = [];
- newKeys = [];
- addItems.$cloned = true;
- for (i = 0; i < newCount; ++i) {
- if (!duplicates[i]) {
- item = newItems[i];
- addItems.push(item);
- newKeys.push(keys[i]);
- }
- }
- newCount = addItems.length;
- }
- adds = {
-
-
-
- items: addItems,
- keys: newKeys
- };
- }
-
- for (i = removeItems ? removeItems.length : 0; i-- > 0; ) {
- key = me.getKey(removeItems[i]);
- if ((itemIndex = indices[key]) !== undefined) {
-
- (removes || (removes = [])).push(itemIndex);
- }
- }
-
- if (!adds && !removes) {
- return me;
- }
- me.beginUpdate();
-
-
-
- if (removes) {
- chunk = null;
- chunks = [];
- removeMap = {};
- if (removes.length > 1) {
- removes.sort(Ext.Array.numericSortFn);
- }
-
-
- for (i = 0 , n = removes.length; i < n; ++i) {
- key = me.getKey(item = items[itemIndex = removes[i]]);
- if (!(key in map)) {
-
- continue;
- }
-
-
- delete map[key];
-
-
-
-
-
-
-
-
-
- if (!chunk || itemIndex > (chunk.at + chunkItems.length)) {
- chunks.push(chunk = {
- at: itemIndex,
- items: (chunkItems = []),
- keys: (keys = []),
- map: removeMap,
- next: chunk,
- replacement: adds
- });
-
- if (adds) {
- adds.replaced = chunk;
- }
- }
- chunkItems.push(removeMap[key] = item);
- keys.push(key);
- if (itemIndex < insertAt - 1) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --insertAt;
- }
- if (removeCount > 1 && itemIndex === begin) {
-
-
-
-
-
-
- --removeCount;
-
- removes[i--] = ++begin;
- }
- }
-
-
- if (adds) {
- adds.at = insertAt;
- }
-
-
-
- for (k = chunks.length; k-- > 0; ) {
- chunk = chunks[k];
- i = chunk.at;
- n = chunk.items.length;
- if (i + n < length) {
-
-
-
- me.indices = indices = null;
- }
- me.length = length -= n;
-
-
-
-
- items.splice(i, n);
- if (indices) {
- keys = chunk.keys;
- for (i = 0; i < n; ++i) {
- delete indices[keys[i]];
- }
- }
- ++me.generation;
- me.notify('remove', [
- chunk
- ]);
- }
- }
-
- if (adds) {
- if (autoSort && newCount > 1 && length) {
- me.spliceMerge(addItems, newKeys);
- } else {
- if (autoSort) {
- if (newCount > 1) {
-
- insertAt = 0;
- me.indices = indices = null;
- } else {
-
-
- insertAt = sorters.findInsertionIndex(adds.items[0], items, me.getSortFn(), index);
- }
- }
- if (insertAt === length) {
- end = insertAt;
-
-
- for (i = addItems.length - 1; i >= 0; --i) {
- items[end + i] = addItems[i];
- }
-
-
- indices = me.indices;
- if (indices) {
- for (i = 0; i < newCount; ++i) {
- indices[newKeys[i]] = insertAt + i;
- }
- }
- } else {
-
- me.indices = null;
- Ext.Array.insert(items, insertAt, addItems);
- }
- for (i = 0; i < newCount; ++i) {
- map[newKeys[i]] = addItems[i];
- }
- me.length += newCount;
- adds.at = insertAt;
- adds.atItem = insertAt === 0 ? null : items[insertAt - 1];
- ++me.generation;
- me.notify('add', [
- adds
- ]);
- }
- }
-
- me.endUpdate();
- return me;
- },
-
- update: function(fn, scope) {
- var me = this;
- me.beginUpdate();
- try {
- return fn.call(scope || me, me);
- } catch (e) {
-
- Ext.log.error(this.$className + ': Unhandled Exception: ', e.description || e.message);
-
- throw e;
- } finally {
- me.endUpdate();
- }
- },
-
- updateKey: function(item, oldKey, details) {
- var me = this,
- map = me.map,
- indices = me.indices,
- source = me.getSource(),
- newKey;
- if (source && !source.updating) {
-
-
- source.updateKey(item, oldKey);
- } else if ((newKey = me.getKey(item)) !== oldKey) {
-
-
- if (map[oldKey] === item && !(newKey in map)) {
- delete map[oldKey];
-
-
-
- me.updating++;
- me.generation++;
- map[newKey] = item;
- if (indices) {
- indices[newKey] = indices[oldKey];
- delete indices[oldKey];
- }
- me.notify('updatekey', [
- Ext.apply({
- item: item,
- newKey: newKey,
- oldKey: oldKey
- }, details)
- ]);
- me.updating--;
- } else
- {
-
-
-
- if (newKey in map && map[newKey] !== item) {
-
-
- Ext.raise('Duplicate newKey "' + newKey + '" for item with oldKey "' + oldKey + '"');
- }
- if (oldKey in map && map[oldKey] !== item) {
-
-
-
- Ext.raise('Incorrect oldKey "' + oldKey + '" for item with newKey "' + newKey + '"');
- }
- }
- }
- },
-
- findInsertIndex: function(item) {
- var source = this.getSource(),
- sourceItems = source.items,
- i = source.indexOf(item) - 1,
- sourceItem, index;
- while (i > -1) {
- sourceItem = sourceItems[i];
- index = this.indexOf(sourceItem);
- if (index > -1) {
- return index + 1;
- }
- --i;
- }
-
-
- return 0;
- },
-
-
-
- onCollectionAdd: function(source, details) {
- var me = this,
- atItem = details.atItem,
- items = details.items,
- requestedIndex = me.requestedIndex,
- filtered, index, copy, i, item, n;
-
- if (!me.sorted) {
-
-
- if (requestedIndex !== undefined) {
- index = requestedIndex;
- } else if (atItem) {
- index = me.indexOf(atItem);
- if (index === -1) {
-
-
-
- index = me.findInsertIndex(items[0]);
- } else {
-
- ++index;
- }
- } else {
-
-
-
- index = 0;
- }
- }
- if (me.getAutoFilter() && me.filtered) {
- for (i = 0 , n = items.length; i < n; ++i) {
- item = items[i];
- if (me.isItemFiltered(item)) {
-
-
- if (!copy) {
- copy = items.slice(0, i);
- }
- if (!filtered) {
- filtered = [];
- }
- filtered.push(item);
- } else if (copy) {
-
-
- copy.push(item);
- }
- }
- }
- me.splice((index < 0) ? me.length : index, 0, copy || items);
- if (filtered) {
-
-
- me.notify('filteradd', [
- filtered
- ]);
- }
- },
-
- onCollectionBeforeItemChange: function(source, details) {
-
- this.onCollectionUpdateKey = null;
-
-
- if (!this.sourceUpdating) {
- this.notify('beforeitemchange', [
- details
- ]);
- }
- },
-
- onCollectionBeginUpdate: function() {
- this.beginUpdate();
- },
-
- onCollectionEndUpdate: function() {
- this.endUpdate();
- },
-
- onCollectionItemChange: function(source, details) {
-
- delete this.onCollectionUpdateKey;
- this.itemChanged(details.item, details.modified, details.oldKey, details.meta);
- },
- onCollectionFilteredItemChange: function() {
- delete this.onCollectionUpdateKey;
- },
-
- onCollectionRefresh: function(source) {
- var me = this,
- map = {},
- indices = {},
- items = me.items,
- sourceItems = source.items,
- filterFn = me.getFilterFn(),
- i, item, key, length, newLength;
-
-
-
- if (me.filtered && me.getAutoFilter()) {
- for (i = 0 , newLength = 0 , length = sourceItems.length; i < length; i++) {
- if (filterFn(sourceItems[i])) {
- items[newLength++] = sourceItems[i];
- }
- }
- items.length = newLength;
- } else {
- items.length = 0;
- items.push.apply(items, sourceItems);
- }
- if (me.sorted) {
- me.sortData(items);
- }
- me.length = length = items.length;
- me.map = map;
- me.indices = indices;
- for (i = 0; i < length; ++i) {
- key = me.getKey(item = items[i]);
- map[key] = item;
- indices[key] = i;
- }
- ++me.generation;
- me.notify('refresh');
- },
-
- onCollectionRemove: function(source, details) {
- this.splice(0, details.items);
- },
-
-
-
-
-
- onCollectionUpdateKey: function(source, details) {
- this.updateKey(details.item, details.oldKey, details);
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- _aggregators: {
- average: function(items, begin, end, property, root) {
- var n = end - begin;
- return n && this._aggregators.sum.call(this, items, begin, end, property, root) / n;
- },
- bounds: function(items, begin, end, property, root) {
- for (var value, max, min,
- i = begin; i < end; ++i) {
- value = items[i];
- value = (root ? value[root] : value)[property];
-
-
-
- if (!(value < max)) {
-
- max = value;
- }
- if (!(value > min)) {
-
- min = value;
- }
- }
- return [
- min,
- max
- ];
- },
- count: function(items) {
- return items.length;
- },
- extremes: function(items, begin, end, property, root) {
- var most = null,
- least = null,
- i, item, max, min, value;
- for (i = begin; i < end; ++i) {
- item = items[i];
- value = (root ? item[root] : item)[property];
-
- if (!(value < max)) {
-
- max = value;
- most = item;
- }
- if (!(value > min)) {
-
- min = value;
- least = item;
- }
- }
- return [
- least,
- most
- ];
- },
- max: function(items, begin, end, property, root) {
- var b = this._aggregators.bounds.call(this, items, begin, end, property, root);
- return b[1];
- },
- maxItem: function(items, begin, end, property, root) {
- var b = this._aggregators.extremes.call(this, items, begin, end, property, root);
- return b[1];
- },
- min: function(items, begin, end, property, root) {
- var b = this._aggregators.bounds.call(this, items, begin, end, property, root);
- return b[0];
- },
- minItem: function(items, begin, end, property, root) {
- var b = this._aggregators.extremes.call(this, items, begin, end, property, root);
- return b[0];
- },
- sum: function(items, begin, end, property, root) {
- for (var value,
- sum = 0,
- i = begin; i < end; ++i) {
- value = items[i];
- value = (root ? value[root] : value)[property];
- sum += value;
- }
- return sum;
- }
- },
- _eventToMethodMap: {
- add: 'onCollectionAdd',
- beforeitemchange: 'onCollectionBeforeItemChange',
- beginupdate: 'onCollectionBeginUpdate',
- endupdate: 'onCollectionEndUpdate',
- itemchange: 'onCollectionItemChange',
- filtereditemchange: 'onCollectionFilteredItemChange',
- refresh: 'onCollectionRefresh',
- remove: 'onCollectionRemove',
- beforesort: 'beforeCollectionSort',
- sort: 'onCollectionSort',
- filter: 'onCollectionFilter',
- filteradd: 'onCollectionFilterAdd',
- updatekey: 'onCollectionUpdateKey'
- },
-
- addObserver: function(observer) {
- var me = this,
- observers = me.observers;
- if (!observers) {
- me.observers = observers = [];
- }
-
- if (Ext.Array.contains(observers, observer)) {
- Ext.Error.raise('Observer already added');
- }
-
-
- if (me.notifying) {
- me.observers = observers = observers.slice(0);
- }
- observers.push(observer);
- if (observers.length > 1) {
-
-
- Ext.Array.sort(observers, me.prioritySortFn);
- }
- },
- prioritySortFn: function(o1, o2) {
- var a = o1.observerPriority || 0,
- b = o2.observerPriority || 0;
- return a - b;
- },
- applyExtraKeys: function(extraKeys, oldExtraKeys) {
- var me = this,
- ret = oldExtraKeys || {},
- config, name, value;
- for (name in extraKeys) {
- value = extraKeys[name];
- if (!value.isCollectionKey) {
- config = {
- collection: me
- };
- if (Ext.isString(value)) {
- config.property = value;
- } else {
- config = Ext.apply(config, value);
- }
- value = new Ext.util.CollectionKey(config);
- } else {
- value.setCollection(me);
- }
- ret[name] = me[name] = value;
- value.name = name;
- }
- return ret;
- },
- applyGrouper: function(grouper) {
- if (grouper) {
- grouper = this.getSorters().decodeSorter(grouper, Ext.util.Grouper);
- }
- return grouper;
- },
-
- decodeItems: function(args, index) {
- var me = this,
- ret = (index === undefined) ? args : args[index],
- cloned, decoder, i;
- if (!ret || !ret.$cloned) {
- cloned = args.length > index + 1 || !Ext.isIterable(ret);
- if (cloned) {
- ret = Ext.Array.slice(args, index);
- if (ret.length === 1 && ret[0] === undefined) {
- ret.length = 0;
- }
- }
- decoder = me.getDecoder();
- if (decoder) {
- if (!cloned) {
- ret = ret.slice(0);
- cloned = true;
- }
- for (i = ret.length; i-- > 0; ) {
- if ((ret[i] = decoder.call(me, ret[i])) === false) {
- ret.splice(i, 1);
- }
- }
- }
- if (cloned) {
- ret.$cloned = true;
- }
- }
- return ret;
- },
-
- getIndices: function() {
- var me = this,
- indices = me.indices,
- items = me.items,
- n = items.length,
- i, key;
- if (!indices) {
- me.indices = indices = {};
- ++me.indexRebuilds;
- for (i = 0; i < n; ++i) {
- key = me.getKey(items[i]);
- indices[key] = i;
- }
- }
- return indices;
- },
-
- notify: function(eventName, args) {
- var me = this,
- observers = me.observers,
- methodName = me._eventToMethodMap[eventName],
- added = 0,
- index, length, method, observer;
- args = args || [];
- if (observers && methodName) {
- me.notifying = true;
- for (index = 0 , length = observers.length; index < length; ++index) {
- method = (observer = observers[index])[methodName];
- if (method) {
- if (!added++) {
-
- args.unshift(me);
- }
-
- method.apply(observer, args);
- }
- }
- me.notifying = false;
- }
-
- if (!me.hasListeners) {
- return;
- }
- if (me.hasListeners[eventName]) {
- if (!added) {
- args.unshift(me);
- }
-
- me.fireEventArgs(eventName, args);
- }
- },
-
- getFilterFn: function() {
- return this.getFilters().getFilterFn();
- },
-
- getFilters: function(autoCreate) {
- var ret = this._filters;
- if (!ret && autoCreate !== false) {
- ret = new Ext.util.FilterCollection();
- this.setFilters(ret);
- }
- return ret;
- },
-
- isItemFiltered: function(item) {
- return !this.getFilters().filterFn(item);
- },
-
- onFilterChange: function(filters) {
- var me = this,
- source = me.getSource(),
- extraKeys, newKeys, key;
- if (!source) {
-
-
-
- extraKeys = me.getExtraKeys();
- if (extraKeys) {
- newKeys = {};
- for (key in extraKeys) {
- newKeys[key] = extraKeys[key].clone(me);
- }
- }
- source = new Ext.util.Collection({
- keyFn: me.getKey,
- extraKeys: newKeys,
- rootProperty: me.getRootProperty()
- });
- if (me.length) {
- source.add(me.items);
- }
- me.setSource(source);
- me.autoSource = source;
- } else {
- if (source.destroyed) {
- return;
- }
- if (source.length || me.length) {
-
- me.onCollectionRefresh(source);
- }
- }
- me.notify('filter');
- },
-
-
- applyFilters: function(filters, collection) {
- if (!filters || filters.isFilterCollection) {
- return filters;
- }
- if (filters) {
- if (!collection) {
- collection = this.getFilters();
- }
- collection.splice(0, collection.length, filters);
- }
- return collection;
- },
- updateFilters: function(newFilters, oldFilters) {
- var me = this;
- if (oldFilters) {
-
-
-
-
- oldFilters.un('endupdate', 'onEndUpdateFilters', me);
- }
- if (newFilters) {
- newFilters.on({
- endupdate: 'onEndUpdateFilters',
- scope: me,
- priority: me.$endUpdatePriority
- });
- newFilters.$filterable = me;
- }
- me.onEndUpdateFilters(newFilters);
- },
- onEndUpdateFilters: function(filters) {
- var me = this,
- was = me.filtered,
- is = !!filters && (filters.getFilterCount() > 0);
-
- if (was || is) {
- me.filtered = is;
- me.onFilterChange(filters);
- }
- },
-
- getSortFn: function() {
- return this._sortFn || this.createSortFn();
- },
-
- getSorters: function(autoCreate) {
- var ret = this._sorters;
- if (!ret && autoCreate !== false) {
- ret = new Ext.util.SorterCollection();
- this.setSorters(ret);
- }
- return ret;
- },
-
- onSortChange: function() {
- if (this.sorted) {
- this.sortItems();
- }
- },
-
- sort: function(property, direction, mode) {
- var sorters = this.getSorters();
- sorters.addSort.apply(sorters, arguments);
- return this;
- },
-
- sortData: function(data) {
- Ext.Array.sort(data, this.getSortFn());
- return data;
- },
-
- sortItems: function(sortFn) {
- var me = this;
- if (me.sorted) {
-
- if (sortFn) {
- Ext.raise('Collections with sorters cannot resorted');
- }
-
- sortFn = me.getSortFn();
- }
- me.indices = null;
- me.notify('beforesort', [
- me.getSorters(false)
- ]);
- if (me.length) {
- Ext.Array.sort(me.items, sortFn);
- }
-
-
- me.notify('sort');
- },
-
- sortBy: function(sortFn) {
- return this.sortItems(sortFn);
- },
-
- findInsertionIndex: function(item, items, comparatorFn, index) {
- return Ext.Array.findInsertionIndex(item, items || this.items, comparatorFn || this.getSortFn(), index);
- },
- applySorters: function(sorters, collection) {
- if (!sorters || sorters.isSorterCollection) {
- return sorters;
- }
- if (sorters) {
- if (!collection) {
- collection = this.getSorters();
- }
- collection.splice(0, collection.length, sorters);
- }
- return collection;
- },
- createSortFn: function() {
- var me = this,
- grouper = me.getGrouper(),
- sorters = me.getSorters(false),
- sorterFn = sorters ? sorters.getSortFn() : null;
- if (!grouper) {
- return sorterFn;
- }
- return function(lhs, rhs) {
- var ret = grouper.sort(lhs, rhs);
- if (!ret && sorterFn) {
- ret = sorterFn(lhs, rhs);
- }
- return ret;
- };
- },
- updateGrouper: function(grouper) {
- var me = this,
- groups = me.getGroups(),
- sorters = me.getSorters(),
- populate;
- me.onSorterChange();
- me.grouped = !!grouper;
- if (grouper) {
- if (me.getTrackGroups()) {
- if (!groups) {
- groups = new Ext.util.GroupCollection({
- itemRoot: me.getRootProperty(),
- groupConfig: me.getGroupConfig()
- });
- groups.$groupable = me;
- me.setGroups(groups);
- }
- groups.setGrouper(grouper);
- populate = true;
- }
- } else {
- if (groups) {
- me.removeObserver(groups);
- groups.destroy();
- }
- me.setGroups(null);
- }
- if (!sorters.updating) {
- me.onEndUpdateSorters(sorters);
- }
- if (populate) {
- groups.onCollectionRefresh(me);
- }
- },
- updateSorters: function(newSorters, oldSorters) {
- var me = this;
- if (oldSorters && !oldSorters.destroyed) {
-
-
-
-
- oldSorters.un('endupdate', 'onEndUpdateSorters', me);
- }
- if (newSorters) {
- newSorters.on({
- endupdate: 'onEndUpdateSorters',
- scope: me,
- priority: me.$endUpdatePriority
- });
- if (me.manageSorters) {
- newSorters.$sortable = me;
- }
- }
- me.onSorterChange();
- me.onEndUpdateSorters(newSorters);
- },
- onSorterChange: function() {
- this._sortFn = null;
- },
- onEndUpdateSorters: function(sorters) {
- var me = this,
- was = me.sorted,
- is = (me.grouped && me.getAutoGroup()) || (sorters && sorters.length > 0);
- if (was || is) {
-
-
- me.sorted = !!is;
- me.onSortChange(sorters);
- }
- },
-
- removeObserver: function(observer) {
- var observers = this.observers;
- if (observers) {
- Ext.Array.remove(observers, observer);
- }
- },
-
- spliceMerge: function(newItems, newKeys) {
- var me = this,
- map = me.map,
- newLength = newItems.length,
- oldIndex = 0,
- oldItems = me.items,
- oldLength = oldItems.length,
- adds = [],
- count = 0,
- items = [],
- sortFn = me.getSortFn(),
-
- addItems, end, i, newItem, oldItem, newIndex;
- me.items = items;
-
-
-
-
-
-
-
-
-
-
-
-
-
- for (newIndex = 0; newIndex < newLength; newIndex = end) {
- newItem = newItems[newIndex];
-
- for (; oldIndex < oldLength; ++oldIndex) {
-
-
-
-
- if (sortFn(newItem, oldItem = oldItems[oldIndex]) < 0) {
- break;
- }
- items.push(oldItem);
- }
- if (oldIndex === oldLength) {
-
-
-
-
- adds[count++] = {
- at: items.length,
- itemAt: items[items.length - 1],
- items: (addItems = [])
- };
- if (count > 1) {
- adds[count - 2].next = adds[count - 1];
- }
- for (; newIndex < newLength; ++newIndex) {
- addItems.push(newItem = newItems[newIndex]);
- items.push(newItem);
- }
- break;
- }
-
-
-
-
- adds[count++] = {
- at: items.length,
- itemAt: items[items.length - 1],
- items: (addItems = [
- newItem
- ])
- };
- if (count > 1) {
- adds[count - 2].next = adds[count - 1];
- }
- items.push(newItem);
- for (end = newIndex + 1; end < newLength; ++end) {
-
-
-
- if (sortFn(newItem = newItems[end], oldItem) >= 0) {
- break;
- }
- items.push(newItem);
- addItems.push(newItem);
- }
- }
-
-
- for (; oldIndex < oldLength; ++oldIndex) {
-
-
- items.push(oldItems[oldIndex]);
- }
- for (i = 0; i < newLength; ++i) {
- map[newKeys[i]] = newItems[i];
- }
- me.length = items.length;
- ++me.generation;
- me.indices = null;
-
- for (i = 0; i < count; ++i) {
- me.notify('add', [
- adds[i]
- ]);
- }
- },
- getGroups: function() {
- return this.callParent() || null;
- },
- updateAutoGroup: function(autoGroup) {
- var groups = this.getGroups();
- if (groups) {
- groups.setAutoGroup(autoGroup);
- }
-
-
- this.onEndUpdateSorters(this._sorters);
- },
- updateGroups: function(newGroups, oldGroups) {
- if (oldGroups) {
- this.removeObserver(oldGroups);
- }
- if (newGroups) {
- this.addObserver(newGroups);
- }
- },
- updateSource: function(newSource, oldSource) {
- var auto = this.autoSource;
- if (oldSource) {
- if (!oldSource.destroyed) {
- oldSource.removeObserver(this);
- }
- if (oldSource === auto) {
- auto.destroy();
- this.autoSource = null;
- }
- }
- if (newSource) {
- newSource.addObserver(this);
- if (newSource.length || this.length) {
- this.onCollectionRefresh(newSource);
- }
- }
- }
- }, function() {
- var prototype = this.prototype;
-
- prototype.removeAtKey = prototype.removeByKey;
-
- prototype.decodeRemoveItems = prototype.decodeItems;
- Ext.Object.each(prototype._aggregators, function(name) {
- prototype[name] = function(property, begin, end) {
- return this.aggregate(property, name, begin, end);
- };
- prototype[name + 'ByGroup'] = function(property) {
- return this.aggregateByGroup(property, name);
- };
- });
- });
- Ext.define('Ext.data.Range', {
- isDataRange: true,
-
- begin: 0,
-
- buffer: 0,
-
- end: 0,
-
- length: 0,
-
-
- store: null,
- constructor: function(config) {
- var me = this,
- activeRanges, store;
- Ext.apply(me, config);
- store = me.store;
- if (!(activeRanges = store.activeRanges)) {
- store.activeRanges = activeRanges = [];
- }
- activeRanges.push(me);
- me.refresh();
- if ('begin' in config) {
- me.begin = me.end = 0;
-
- me.goto(config.begin, config.end);
- }
- },
- destroy: function() {
- var me = this,
- store = me.store,
- activeRanges = store && store.activeRanges;
- Ext.destroy(me.storeListeners);
- if (activeRanges) {
- Ext.Array.remove(activeRanges, me);
- }
- me.callParent();
- },
- "goto": function(begin, end) {
- var me = this,
- buffer = me.buffer,
- task = me.task;
- me.begin = begin;
- me.end = end;
- me.length = end - begin;
- if (buffer > 0) {
- if (!task) {
- me.task = task = new Ext.util.DelayedTask(me.doGoto, me);
- }
- task.delay(buffer);
- } else {
- me.doGoto();
- }
- },
- privates: {
- lastBegin: 0,
- lastEnd: 0,
- doGoto: Ext.privateFn,
- refresh: function() {
- this.records = this.store.getData().items;
- }
- }
- });
- Ext.define('Ext.util.ObjectTemplate', {
- isObjectTemplate: true,
- excludeProperties: {},
- valueRe: /^[{][a-z\.]+[}]$/i,
- statics: {
-
- create: function(template, options) {
-
- if (!Ext.isObject(template)) {
- Ext.raise('The template is not an Object');
- }
-
- return template.isObjectTemplate ? template : new Ext.util.ObjectTemplate(template, options);
- }
- },
-
- constructor: function(template, options) {
- Ext.apply(this, options);
- this.template = template;
- },
-
- apply: function(context) {
- var me = this;
- delete me.apply;
- me.apply = me.compile(me.template);
- return me.apply(context);
- },
- privates: {
-
- compile: function(template) {
- var me = this,
- exclude = me.excludeProperties,
- compiled, i, len, fn;
-
- if (Ext.isString(template)) {
- if (template.indexOf('{') < 0) {
- fn = function() {
- return template;
- };
- } else if (me.valueRe.test(template)) {
- template = template.substring(1, template.length - 1).split('.');
- fn = function(context) {
- for (var v = context,
- i = 0; v && i < template.length; ++i) {
- v = v[template[i]];
- }
- return v;
- };
- } else {
- template = new Ext.XTemplate(template);
- fn = function(context) {
- return template.apply(context);
- };
- }
- } else if (!template || Ext.isPrimitive(template) || Ext.isFunction(template)) {
- fn = function() {
- return template;
- };
- } else if (template instanceof Array) {
- compiled = [];
- for (i = 0 , len = template.length; i < len; ++i) {
- compiled[i] = me.compile(template[i]);
- }
- fn = function(context) {
- var ret = [],
- i;
- for (i = 0; i < len; ++i) {
- ret[i] = compiled[i](context);
- }
- return ret;
- };
- } else {
- compiled = {};
- for (i in template) {
- if (!exclude[i]) {
- compiled[i] = me.compile(template[i]);
- }
- }
- fn = function(context) {
- var ret = {},
- i, v;
- for (i in template) {
- v = exclude[i] ? template[i] : compiled[i](context);
- if (v !== undefined) {
- ret[i] = v;
- }
- }
- return ret;
- };
- }
- return fn;
- }
- }
- });
- Ext.define('Ext.data.schema.Role', {
-
- isRole: true,
-
- left: true,
-
- owner: false,
-
- side: 'left',
-
- isMany: false,
-
-
-
-
- defaultReaderType: 'json',
- _internalReadOptions: {
- recordsOnly: true,
- asRoot: true
- },
- constructor: function(association, config) {
- var me = this,
- extra = config.extra;
- Ext.apply(me, config);
- if (extra) {
- extra = Ext.apply({}, extra);
- delete extra.type;
- Ext.apply(me, extra);
- delete me.extra;
- }
- me.association = association;
-
-
- if (association.owner === me.side) {
- association.owner = me;
- me.owner = true;
- }
- },
- processUpdate: function() {
- Ext.raise('Only the "many" for an association may be processed. "' + this.role + '" is not valid.');
- },
-
- processLoad: function(store, associatedEntity, records, session) {
- return records;
- },
-
- checkMembership: Ext.emptyFn,
-
- adoptAssociated: function(record, session) {
- var other = this.getAssociatedItem(record);
- if (other) {
- session.adopt(other);
- }
- },
- $roleFilterId: '$associationRoleFilter',
- createAssociationStore: function(session, from, records, isComplete) {
- var me = this,
- association = me.association,
- foreignKeyName = association.getFieldName(),
- isMany = association.isManyToMany,
- storeConfig = me.storeConfig,
- id = from.getId(),
- config = {
-
- asynchronousLoad: false,
- model: me.cls,
- role: me,
- session: session,
- associatedEntity: from,
- disableMetaChangeEvent: true,
- pageSize: null,
- remoteFilter: true,
- trackRemoved: !session
- },
- store;
- if (isMany) {
-
- config.filters = [
- {
- id: me.$roleFilterId,
- property: me.inverse.field,
-
- value: id,
- exactMatch: true
- }
- ];
- } else if (foreignKeyName) {
- config.filters = [
- {
- id: me.$roleFilterId,
- property: foreignKeyName,
-
- value: id,
- exactMatch: true
- }
- ];
- config.foreignKeyName = foreignKeyName;
- }
- if (storeConfig) {
- Ext.apply(config, storeConfig);
- }
- store = Ext.Factory.store(config);
- me.onStoreCreate(store, session, id);
-
- if (!isMany || session) {
- store.on({
- scope: me,
- add: 'onAddToMany',
- remove: 'onRemoveFromMany',
- clear: 'onRemoveFromMany'
- });
- }
- if (records) {
- store.loadData(records);
- }
- store.complete = !!isComplete;
- return store;
- },
- onStoreCreate: Ext.emptyFn,
- getAssociatedStore: function(inverseRecord, options, scope, records, allowInfer) {
-
-
-
-
- var me = this,
- storeName = me.getStoreName(),
- store = inverseRecord[storeName],
- hadStore = store,
- session = inverseRecord.session,
- load = options && options.reload,
- source = inverseRecord.$source,
- isComplete = false,
- phantom = false,
- hadSourceStore, args, i, len, raw, rec, sourceStore, hadRecords, isLoading;
- if (!store) {
- if (session) {
-
-
-
- if (source) {
- phantom = source.phantom;
- }
- if (!records && source) {
- sourceStore = source[storeName];
- if (sourceStore && !sourceStore.isLoading()) {
- records = [];
- raw = sourceStore.getData().items;
- for (i = 0 , len = raw.length; i < len; ++i) {
- rec = raw[i];
- records.push(session.getRecord(rec.self, rec.id));
- }
- isComplete = !!sourceStore.complete;
- hadSourceStore = true;
- }
- }
- if (!hadSourceStore) {
-
- hadRecords = !!records;
- records = me.findRecords(session, inverseRecord, records, allowInfer);
- if (!hadRecords && (!records || !records.length)) {
- records = null;
- }
- isComplete = phantom || hadRecords;
- }
- } else {
-
- isComplete = !!records;
- }
-
- store = me.createAssociationStore(session, inverseRecord, records, isComplete || inverseRecord.phantom);
- store.$source = sourceStore;
- if (!records && (me.autoLoad || options)) {
- load = true;
- }
- inverseRecord[storeName] = store;
- }
- if (options) {
-
-
- if (load || store.isLoading()) {
- store.on('load', function(store, records, success, operation) {
- args = [
- store,
- operation
- ];
- scope = scope || options.scope || inverseRecord;
- if (success) {
- Ext.callback(options.success, scope, args);
- } else {
- Ext.callback(options.failure, scope, args);
- }
- args.push(success);
- Ext.callback(options, scope, args);
- Ext.callback(options.callback, scope, args);
- }, null, {
- single: true
- });
- } else {
-
- args = [
- store,
- null
- ];
- scope = scope || options.scope || inverseRecord;
- Ext.callback(options.success, scope, args);
- args.push(true);
- Ext.callback(options, scope, args);
- Ext.callback(options.callback, scope, args);
- }
- }
- isLoading = store.isLoading();
- if (load) {
- if (!isLoading) {
- store.load();
- }
- } else if (hadStore && records && !isLoading) {
- store.loadData(records);
- }
- return store;
- },
-
- getAssociatedItem: function(rec) {
- var key = this.isMany ? this.getStoreName() : this.getInstanceName();
- return rec[key] || null;
- },
- onDrop: Ext.emptyFn,
- onIdChanged: Ext.emptyFn,
- getReaderRoot: function() {
- var me = this;
- return me.associationKey || (me.associationKey = me.association.schema.getNamer().readerRoot(me.role));
- },
- getReader: function() {
- var me = this,
- reader = me.reader,
- Model = me.cls,
- useSimpleAccessors = !me.associationKey,
- root = this.getReaderRoot();
- if (reader && !reader.isReader) {
- if (Ext.isString(reader)) {
- reader = {
- type: reader
- };
- }
- Ext.applyIf(reader, {
- model: Model,
- rootProperty: root,
- useSimpleAccessors: useSimpleAccessors,
- type: me.defaultReaderType
- });
- reader = me.reader = Ext.createByAlias('reader.' + reader.type, reader);
- }
- return reader;
- },
- getInstanceName: function() {
- var me = this;
- return me.instanceName || (me.instanceName = me.association.schema.getNamer().instanceName(me.role));
- },
- getOldInstanceName: function() {
- return this.oldInstanceName || (this.oldInstanceName = '$old' + this.getInstanceName());
- },
- getStoreName: function() {
- var me = this;
- return me.storeName || (me.storeName = me.association.schema.getNamer().storeName(me.role));
- },
- constructReader: function(fromReader) {
- var me = this,
- reader = me.getReader(),
- Model = me.cls,
- useSimpleAccessors = !me.associationKey,
- root = me.getReaderRoot(),
- proxyReader, proxy;
-
- if (!reader) {
- proxy = Model.getProxy();
-
- if (proxy) {
- proxyReader = proxy.getReader();
- reader = new proxyReader.self();
- reader.copyFrom(proxyReader);
- reader.setRootProperty(root);
- } else {
- reader = new fromReader.self({
- model: Model,
- useSimpleAccessors: useSimpleAccessors,
- rootProperty: root
- });
- }
- me.reader = reader;
- }
- return reader;
- },
- read: function(record, data, fromReader, readOptions) {
- var reader = this.constructReader(fromReader),
- root = reader.getRoot(data);
- if (root) {
- return reader.readRecords(root, readOptions, this._internalReadOptions);
- }
- },
- getCallbackOptions: function(options, scope, defaultScope) {
- if (typeof options === 'function') {
- options = {
- callback: options,
- scope: scope || defaultScope
- };
- } else if (options) {
- options = Ext.apply({}, options);
- options.scope = scope || options.scope || defaultScope;
- }
- return options;
- },
- doGetFK: function(leftRecord, options, scope) {
-
-
-
-
-
- var me = this,
-
- cls = me.cls,
-
- foreignKey = me.association.getFieldName(),
-
- instanceName = me.getInstanceName(),
-
- rightRecord = leftRecord[instanceName],
-
- reload = options && options.reload,
- done = rightRecord !== undefined && !reload,
- session = leftRecord.session,
- foreignKeyId, args;
- if (!done) {
-
- if (session) {
- foreignKeyId = leftRecord.get(foreignKey);
- if (foreignKeyId || foreignKeyId === 0) {
- done = session.peekRecord(cls, foreignKeyId, true) && !reload;
- rightRecord = session.getRecord(cls, foreignKeyId, false);
- } else {
- done = true;
- leftRecord[instanceName] = rightRecord = null;
- }
- } else if (foreignKey) {
-
-
- foreignKeyId = leftRecord.get(foreignKey);
- if (!foreignKeyId && foreignKeyId !== 0) {
-
-
- done = true;
- leftRecord[instanceName] = rightRecord = null;
- } else {
-
-
-
- if (!rightRecord) {
-
- rightRecord = cls.createWithId(foreignKeyId);
- }
- }
- } else
- {
-
-
- done = true;
- rightRecord = null;
- }
- } else if (rightRecord) {
-
- done = !rightRecord.isLoading();
- }
- if (done) {
- if (options) {
- args = [
- rightRecord,
- null
- ];
- scope = scope || options.scope || leftRecord;
- Ext.callback(options.success, scope, args);
- args.push(true);
- Ext.callback(options, scope, args);
- Ext.callback(options.callback, scope, args);
- }
- } else {
- leftRecord[instanceName] = rightRecord;
- options = me.getCallbackOptions(options, scope, leftRecord);
- rightRecord.load(options);
- }
- return rightRecord;
- },
- doSetFK: function(leftRecord, rightRecord, options, scope) {
-
-
-
-
-
- var me = this,
- foreignKey = me.association.getFieldName(),
-
- instanceName = me.getInstanceName(),
-
- current = leftRecord[instanceName],
- inverse = me.inverse,
- inverseSetter = inverse.setterName,
-
- session = leftRecord.session,
- modified, oldInstanceName;
- if (rightRecord && rightRecord.isEntity) {
- if (current !== rightRecord) {
- oldInstanceName = me.getOldInstanceName();
- leftRecord[oldInstanceName] = current;
- leftRecord[instanceName] = rightRecord;
- if (current && current.isEntity) {
- current[inverse.getInstanceName()] = undefined;
- }
- if (foreignKey) {
- leftRecord.set(foreignKey, rightRecord.getId());
- }
- delete leftRecord[oldInstanceName];
- leftRecord.onAssociatedRecordSet(rightRecord, me);
- if (inverseSetter) {
-
-
-
- rightRecord[inverseSetter](leftRecord);
- }
- }
- } else {
-
-
-
- if (!foreignKey) {
- Ext.raise('No foreignKey specified for "' + me.association.left.role + '" by ' + leftRecord.$className);
- }
-
- modified = (leftRecord.changingKey && !inverse.isMany) || leftRecord.set(foreignKey, rightRecord);
-
- if (modified && current && current.isEntity && !current.isEqual(current.getId(), rightRecord)) {
-
-
- leftRecord[instanceName] = undefined;
- if (!inverse.isMany) {
- current[inverse.getInstanceName()] = undefined;
- }
- }
- }
- if (options) {
- if (Ext.isFunction(options)) {
- options = {
- callback: options,
- scope: scope || leftRecord
- };
- }
- return leftRecord.save(options);
- }
- }
- });
- Ext.define('Ext.data.schema.Association', {
- isOneToOne: false,
- isManyToOne: false,
- isManyToMany: false,
-
-
-
-
-
-
- owner: null,
-
-
- field: null,
-
-
-
-
- constructor: function(config) {
- var me = this,
- left, right;
- Ext.apply(me, config);
- me.left = left = new me.Left(me, me.left);
- me.right = right = new me.Right(me, me.right);
- left.inverse = right;
- right.inverse = left;
- },
- hasField: function() {
- return !!this.field;
- },
- getFieldName: function() {
- var field = this.field;
- return field ? field.name : '';
- }
- });
- Ext.define('Ext.data.schema.OneToOne', {
- extend: Ext.data.schema.Association,
- isOneToOne: true,
- isToOne: true,
- kind: 'one-to-one',
- Left: Ext.define(null, {
- extend: 'Ext.data.schema.Role',
- onDrop: function(rightRecord, session) {
- var leftRecord = this.getAssociatedItem(rightRecord);
- rightRecord[this.getInstanceName()] = null;
- if (leftRecord) {
- leftRecord[this.inverse.getInstanceName()] = null;
- }
- },
- onIdChanged: function(rightRecord, oldId, newId) {
- var leftRecord = this.getAssociatedItem(rightRecord),
- fieldName = this.association.getFieldName();
- if (!rightRecord.session && leftRecord && fieldName) {
- leftRecord.set(fieldName, newId);
- }
- },
- createGetter: function() {
- var me = this;
- return function() {
-
- return me.doGet(this);
- };
- },
- createSetter: function() {
- var me = this;
- return function(value) {
-
- return me.doSet(this, value);
- };
- },
- doGet: function(rightRecord) {
-
-
-
-
-
-
- var instanceName = this.getInstanceName(),
-
- ret = rightRecord[instanceName],
- session = rightRecord.session;
- if (!ret && session) {}
-
-
- return ret || null;
- },
- doSet: function(rightRecord, leftRecord) {
-
-
-
- var instanceName = this.getInstanceName(),
-
- ret = rightRecord[instanceName],
- inverseSetter = this.inverse.setterName;
-
- if (ret !== leftRecord) {
- rightRecord[instanceName] = leftRecord;
- if (inverseSetter) {
-
-
-
- leftRecord[inverseSetter](rightRecord);
- }
- rightRecord.onAssociatedRecordSet(leftRecord, this);
- }
- return ret;
- },
- read: function(rightRecord, node, fromReader, readOptions) {
- var me = this,
- leftRecords = me.callParent([
- rightRecord,
- node,
- fromReader,
- readOptions
- ]),
- leftRecord;
- if (leftRecords) {
- leftRecord = leftRecords[0];
- if (leftRecord) {
- leftRecord[me.inverse.getInstanceName()] = rightRecord;
- rightRecord[me.getInstanceName()] = leftRecord;
-
- delete rightRecord.data[me.role];
- }
- }
- }
- }),
- Right: Ext.define(null, {
- extend: 'Ext.data.schema.Role',
- left: false,
- side: 'right',
- createGetter: function() {
-
-
- var me = this;
- return function(options, scope) {
-
- return me.doGetFK(this, options, scope);
- };
- },
- createSetter: function() {
- var me = this;
- return function(value, options, scope) {
-
- return me.doSetFK(this, value, options, scope);
- };
- },
- onDrop: function(leftRecord, session) {
- var me = this,
- field = me.association.field,
- rightRecord = me.getAssociatedItem(leftRecord),
- id;
- if (me.inverse.owner) {
- if (session && field) {
- id = leftRecord.get(field.name);
- if (id || id === 0) {
- rightRecord = session.getEntry(me.cls, id).record;
- if (rightRecord) {
- rightRecord.drop();
- }
- }
- } else {
- if (rightRecord) {
- rightRecord.drop();
- }
- }
- }
- if (field) {
- leftRecord.set(field.name, null);
- }
- leftRecord[me.getInstanceName()] = null;
- if (rightRecord) {
- rightRecord[me.inverse.getInstanceName()] = null;
- }
- },
- onValueChange: function(leftRecord, session, newValue) {
-
- var me = this,
- rightRecord = leftRecord[me.getOldInstanceName()] || me.getAssociatedItem(leftRecord),
- hasNewValue = newValue || newValue === 0,
- instanceName = me.getInstanceName(),
- cls = me.cls;
- leftRecord.changingKey = true;
- me.doSetFK(leftRecord, newValue);
- if (!hasNewValue) {
- leftRecord[instanceName] = null;
- } else if (session && cls) {
-
- leftRecord[instanceName] = session.peekRecord(cls, newValue) || undefined;
- }
- if (me.inverse.owner && rightRecord) {
- me.association.schema.queueKeyCheck(rightRecord, me);
- }
- leftRecord.changingKey = false;
- },
- checkKeyForDrop: function(rightRecord) {
- var leftRecord = this.inverse.getAssociatedItem(rightRecord);
- if (!leftRecord) {
-
- rightRecord.drop();
- }
- },
- read: function(leftRecord, node, fromReader, readOptions) {
- var me = this,
- rightRecords = me.callParent([
- leftRecord,
- node,
- fromReader,
- readOptions
- ]),
- rightRecord, field, fieldName, session, refs, id, oldId, setKey, data;
- if (rightRecords) {
- rightRecord = rightRecords[0];
- field = me.association.field;
- if (field) {
- fieldName = field.name;
- }
- session = leftRecord.session;
- data = leftRecord.data;
- if (rightRecord) {
- if (session) {
- refs = session.getRefs(rightRecord, this.inverse, true);
-
-
- setKey = (refs && refs[leftRecord.id]) || (data[fieldName] === undefined);
- } else {
- setKey = true;
- }
- if (setKey) {
-
-
- if (field) {
- oldId = data[fieldName];
- id = rightRecord.id;
- if (oldId !== id) {
- data[fieldName] = id;
- if (session) {
- session.updateReference(leftRecord, field, id, oldId);
- }
- }
- }
- rightRecord[me.inverse.getInstanceName()] = leftRecord;
- leftRecord[me.getInstanceName()] = rightRecord;
- }
-
- delete data[me.role];
- }
- }
- }
- })
- });
- Ext.define('Ext.data.schema.ManyToOne', {
- extend: Ext.data.schema.Association,
- isManyToOne: true,
- isToOne: true,
- kind: 'many-to-one',
- Left: Ext.define(null, {
- extend: 'Ext.data.schema.Role',
- isMany: true,
- onDrop: function(rightRecord, session) {
- var me = this,
- store = me.getAssociatedItem(rightRecord),
- leftRecords, len, i, refs, id;
- if (store) {
-
- leftRecords = store.removeAll();
- if (leftRecords && me.inverse.owner) {
-
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- leftRecords[i].drop();
- }
- }
- store.destroy();
- rightRecord[me.getStoreName()] = null;
- } else if (session) {
- leftRecords = session.getRefs(rightRecord, me);
- if (leftRecords) {
- for (id in leftRecords) {
- leftRecords[id].drop();
- }
- }
- }
- },
- onIdChanged: function(rightRecord, oldId, newId) {
- var fieldName = this.association.getFieldName(),
- store = this.getAssociatedItem(rightRecord),
- leftRecords, i, len, filter;
- if (store) {
- filter = store.getFilters().get(this.$roleFilterId);
- if (filter) {
- filter.setValue(newId);
- }
-
-
- if (!rightRecord.session && fieldName) {
- leftRecords = store.getDataSource().items;
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- leftRecords[i].set(fieldName, newId);
- }
- }
- }
- },
- processUpdate: function(session, associationData) {
- var me = this,
- entityType = me.inverse.cls,
- items = associationData.R,
- id, rightRecord, store, leftRecords;
- if (items) {
- for (id in items) {
- rightRecord = session.peekRecord(entityType, id);
- if (rightRecord) {
- leftRecords = session.getEntityList(me.cls, items[id]);
- store = me.getAssociatedItem(rightRecord);
- if (store) {
- store.loadData(leftRecords);
- store.complete = true;
- } else {
-
- rightRecord[me.getterName](null, null, leftRecords);
- }
- } else {
- session.onInvalidAssociationEntity(entityType, id);
- }
- }
- }
- },
- findRecords: function(session, rightRecord, leftRecords, allowInfer) {
- var ret = leftRecords,
- refs = session.getRefs(rightRecord, this, true),
- field = this.association.field,
- fieldName, leftRecord, id, i, len, seen;
- if (field && (refs || allowInfer)) {
- fieldName = field.name;
- ret = [];
- if (leftRecords) {
- seen = {};
-
-
-
-
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- leftRecord = leftRecords[i];
- id = leftRecord.id;
- if (refs && refs[id]) {
- ret.push(leftRecord);
- } else if (allowInfer && leftRecord.data[fieldName] === undefined) {
- ret.push(leftRecord);
- leftRecord.data[fieldName] = rightRecord.id;
- session.updateReference(leftRecord, field, rightRecord.id, undefined);
- }
- seen[id] = true;
- }
- }
-
- if (refs) {
- for (id in refs) {
- if (!seen || !seen[id]) {
- ret.push(refs[id]);
- }
- }
- }
- }
- return ret;
- },
- processLoad: function(store, rightRecord, leftRecords, session) {
- var ret = leftRecords;
- if (session) {
-
- ret = this.findRecords(session, rightRecord, leftRecords, true);
- }
- this.onLoadMany(rightRecord, ret, session);
- return ret;
- },
- adoptAssociated: function(rightRecord, session) {
- var store = this.getAssociatedItem(rightRecord),
- leftRecords, i, len;
- if (store) {
- store.setSession(session);
- leftRecords = store.getData().items;
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- session.adopt(leftRecords[i]);
- }
- }
- },
- createGetter: function() {
- var me = this;
- return function(options, scope, leftRecords) {
-
- return me.getAssociatedStore(this, options, scope, leftRecords, true);
- };
- },
- createSetter: null,
-
- onAddToMany: function(store, leftRecords) {
- var rightRecord = store.getAssociatedEntity();
- if (this.association.field) {
- this.syncFK(leftRecords, rightRecord, false);
- } else {
- this.setInstances(rightRecord, leftRecords);
- }
- },
- onLoadMany: function(rightRecord, leftRecords, session) {
- this.setInstances(rightRecord, leftRecords, session);
- },
- onRemoveFromMany: function(store, leftRecords) {
- if (this.association.field) {
- this.syncFK(leftRecords, store.getAssociatedEntity(), true);
- } else {
- this.setInstances(null, leftRecords);
- }
- },
- read: function(rightRecord, node, fromReader, readOptions) {
- var me = this,
-
-
- instanceName = me.inverse.getInstanceName(),
- leftRecords = me.callParent([
- rightRecord,
- node,
- fromReader,
- readOptions
- ]),
- store, len, i;
- if (leftRecords) {
-
- store = rightRecord[me.getterName](null, null, leftRecords);
-
- delete rightRecord.data[me.role];
- leftRecords = store.getData().items;
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- leftRecords[i][instanceName] = rightRecord;
- }
- }
- },
- setInstances: function(rightRecord, leftRecords, session) {
- var instanceName = this.inverse.getInstanceName(),
- id = rightRecord ? rightRecord.getId() : null,
- field = this.association.field,
- len = leftRecords.length,
- i, leftRecord, oldId, data, name;
- for (i = 0; i < len; ++i) {
- leftRecord = leftRecords[i];
- leftRecord[instanceName] = rightRecord;
- if (field) {
- name = field.name;
- data = leftRecord.data;
- oldId = data[name];
- if (oldId !== id) {
- data[name] = id;
- if (session) {
- session.updateReference(leftRecord, field, id, oldId);
- }
- }
- }
- }
- },
- syncFK: function(leftRecords, rightRecord, clearing) {
-
-
-
-
- var foreignKeyName = this.association.getFieldName(),
- inverse = this.inverse,
- setter = inverse.setterName,
-
- instanceName = inverse.getInstanceName(),
- i = leftRecords.length,
- id = rightRecord.getId(),
- different, leftRecord, val;
- while (i-- > 0) {
- leftRecord = leftRecords[i];
- different = !leftRecord.isEqual(id, leftRecord.get(foreignKeyName));
- val = clearing ? null : rightRecord;
- if (different !== clearing) {
-
-
-
-
-
-
-
-
- leftRecord.changingKey = true;
- leftRecord[setter](val);
- leftRecord.changingKey = false;
- } else {
-
- leftRecord[instanceName] = val;
- }
- }
- }
- }),
- Right: Ext.define(null, {
- extend: 'Ext.data.schema.Role',
- left: false,
- side: 'right',
- onDrop: function(leftRecord, session) {
-
-
-
-
- var field = this.association.field;
- if (field) {
- leftRecord.set(field.name, null);
- }
- leftRecord[this.getInstanceName()] = null;
- },
- createGetter: function() {
-
-
- var me = this;
- return function(options, scope) {
-
- return me.doGetFK(this, options, scope);
- };
- },
- createSetter: function() {
- var me = this;
- return function(rightRecord, options, scope) {
-
- return me.doSetFK(this, rightRecord, options, scope);
- };
- },
- checkMembership: function(session, leftRecord) {
- var field = this.association.field,
- store;
- if (field) {
- store = this.getSessionStore(session, leftRecord.get(field.name));
-
- if (store && !store.contains(leftRecord)) {
- store.add(leftRecord);
- }
- }
- },
- onValueChange: function(leftRecord, session, newValue, oldValue) {
-
-
- var me = this,
- instanceName = me.getInstanceName(),
- cls = me.cls,
- hasNewValue, joined, store, i, associated, rightRecord;
- if (!leftRecord.changingKey) {
- hasNewValue = newValue || newValue === 0;
- if (!hasNewValue) {
- leftRecord[instanceName] = null;
- }
- if (session) {
-
- store = me.getSessionStore(session, oldValue);
- if (store) {
- store.remove(leftRecord);
- }
-
- if (hasNewValue) {
- store = me.getSessionStore(session, newValue);
- if (store && !store.isLoading()) {
- store.add(leftRecord);
- }
- if (cls) {
- rightRecord = session.peekRecord(cls, newValue);
- }
-
- leftRecord[instanceName] = rightRecord || undefined;
- }
- } else {
- joined = leftRecord.joined;
- if (joined) {
-
-
- for (i = joined.length - 1; i >= 0; i--) {
- store = joined[i];
- if (store.isStore) {
- associated = store.getAssociatedEntity();
- if (associated && associated.self === me.cls && associated.getId() === oldValue) {
- store.remove(leftRecord);
- }
- }
- }
- }
- }
- }
- if (me.owner && newValue === null) {
- me.association.schema.queueKeyCheck(leftRecord, me);
- }
- },
- checkKeyForDrop: function(leftRecord) {
- var field = this.association.field;
- if (leftRecord.get(field.name) === null) {
- leftRecord.drop();
- }
- },
- getSessionStore: function(session, value) {
-
- var cls = this.cls,
- rec;
- if (cls) {
- rec = session.peekRecord(cls, value);
- if (rec) {
- return this.inverse.getAssociatedItem(rec);
- }
- }
- },
- read: function(leftRecord, node, fromReader, readOptions) {
- var rightRecords = this.callParent([
- leftRecord,
- node,
- fromReader,
- readOptions
- ]),
- rightRecord;
- if (rightRecords) {
- rightRecord = rightRecords[0];
- if (rightRecord) {
- leftRecord[this.getInstanceName()] = rightRecord;
- delete leftRecord.data[this.role];
- }
- }
- }
- })
- });
- Ext.define('Ext.data.schema.ManyToMany', {
- extend: Ext.data.schema.Association,
- isManyToMany: true,
- isToMany: true,
- kind: 'many-to-many',
- Left: Ext.define(null, {
- extend: 'Ext.data.schema.Role',
- isMany: true,
- digitRe: /^\d+$/,
- findRecords: function(session, rightRecord, leftRecords) {
- var slice = session.getMatrixSlice(this.inverse, rightRecord.id),
- members = slice.members,
- ret = [],
- cls = this.cls,
- seen, i, len, id, member, leftRecord;
- if (leftRecords) {
- seen = {};
-
-
- for (i = 0 , len = leftRecords.length; i < len; ++i) {
- leftRecord = leftRecords[i];
- id = leftRecord.id;
- member = members[id];
- if (!(member && member[2] === -1)) {
- ret.push(leftRecord);
- }
- seen[id] = true;
- }
- }
-
- for (id in members) {
- member = members[id];
- if (!seen || !seen[id] && (member && member[2] !== -1)) {
- leftRecord = session.peekRecord(cls, id);
- if (leftRecord) {
- ret.push(leftRecord);
- }
- }
- }
- return ret;
- },
- onIdChanged: function(rightRecord, oldId, newId) {
- var store = this.getAssociatedItem(rightRecord);
- if (store) {
- store.getFilters().get(this.$roleFilterId).setValue(newId);
- }
- },
- processLoad: function(store, rightRecord, leftRecords, session) {
- var ret = leftRecords;
- if (session) {
- ret = this.findRecords(session, rightRecord, leftRecords);
- this.onAddToMany(store, ret, true);
- }
- return ret;
- },
- processUpdate: function(session, associationData) {
- var me = this,
- entityType = me.inverse.cls,
- items = associationData.R,
- id, rightRecord, store, leftRecords;
- if (items) {
- for (id in items) {
- rightRecord = session.peekRecord(entityType, id);
- if (rightRecord) {
- leftRecords = session.getEntityList(me.cls, items[id]);
- store = me.getAssociatedItem(rightRecord);
- if (store) {
- store.loadData(leftRecords);
- store.complete = true;
- } else {
-
- rightRecord[me.getterName](null, null, leftRecords);
- }
- } else {
- session.onInvalidAssociationEntity(entityType, id);
- }
- }
- }
- me.processMatrixBlock(session, associationData.C, 1);
- me.processMatrixBlock(session, associationData.D, -1);
- },
- checkMembership: function(session, rightRecord) {
- var matrix = session.getMatrix(this.association, true),
- side, entityType, inverse, slice, slices, id, members, member, leftRecord, store;
- if (!matrix) {
- return;
- }
- side = this.left ? matrix.right : matrix.left;
- entityType = side.inverse.role.cls;
- inverse = this.inverse;
- slices = side.slices;
- if (slices) {
- slice = slices[rightRecord.id];
- if (slice) {
- members = slice.members;
- for (id in members) {
- member = members[id];
- if (member[2] !== -1) {
-
- leftRecord = session.peekRecord(entityType, id);
- if (leftRecord) {
- store = inverse.getAssociatedItem(leftRecord);
- if (store) {
- store.matrixUpdate = 1;
- store.add(rightRecord);
- store.matrixUpdate = 0;
- }
- }
- }
- }
- }
- }
- },
- onStoreCreate: function(store, session, id) {
- var me = this,
- matrix;
- if (session) {
-
-
-
- matrix = session.getMatrixSlice(me.inverse, id);
- matrix.attach(store);
- matrix.notify = me.onMatrixUpdate;
- matrix.scope = me;
- }
- },
- processMatrixBlock: function(session, leftKeys, state) {
- var inverse = this.inverse,
- digitRe = this.digitRe,
- slice, id;
- if (leftKeys) {
- for (id in leftKeys) {
-
-
- if (digitRe.test(id)) {
- id = parseInt(id, 10);
- }
- slice = session.getMatrixSlice(inverse, id);
- slice.update(leftKeys[id], state);
- }
- }
- },
- createGetter: function() {
- var me = this;
- return function(options, scope, leftRecords) {
-
- return me.getAssociatedStore(this, options, scope, leftRecords, false);
- };
- },
-
- onAddToMany: function(store, leftRecords, load) {
- if (!store.matrixUpdate) {
- store.matrixUpdate = 1;
-
-
- store.matrix.update(leftRecords, load === true ? 0 : 1);
- store.matrixUpdate = 0;
- }
- },
-
- onRemoveFromMany: function(store, records) {
- if (!store.matrixUpdate) {
- store.matrixUpdate = 1;
- store.matrix.update(records, -1);
- store.matrixUpdate = 0;
- }
- },
- read: function(rightRecord, node, fromReader, readOptions) {
- var me = this,
- leftRecords = me.callParent([
- rightRecord,
- node,
- fromReader,
- readOptions
- ]);
- if (leftRecords) {
-
- rightRecord[me.getterName](null, null, leftRecords);
-
- delete rightRecord.data[me.role];
- }
- },
- onMatrixUpdate: function(matrixSlice, id, state) {
- var store = matrixSlice.store,
- index, leftRecord, entry;
- if (store && !store.loading && !store.matrixUpdate) {
- store.matrixUpdate = 1;
- index = store.indexOfId(id);
- if (state < 0) {
- if (index >= 0) {
- store.remove([
- index
- ]);
- }
- } else if (index < 0) {
- entry = store.getSession().getEntry(this.type, id);
- leftRecord = entry && entry.record;
- if (leftRecord) {
- store.add(leftRecord);
- }
- }
- store.matrixUpdate = 0;
- }
- },
- adoptAssociated: function(record, session) {
- var store = this.getAssociatedItem(record),
- records, i, len;
- if (store) {
- store.setSession(session);
- this.onStoreCreate(store, session, record.getId());
- records = store.getData().items;
- for (i = 0 , len = records.length; i < len; ++i) {
- session.adopt(records[i]);
- }
- }
- }
- }, function() {
- var Left = this;
-
- Ext.ClassManager.onCreated(function() {
- Ext.data.schema.ManyToMany.prototype.Right = Ext.define(null, {
- extend: Left,
- left: false,
- side: 'right'
- });
- }, null, 'Ext.data.schema.ManyToMany');
- })
- });
- Ext.define('Ext.util.Inflector', {
-
- singleton: true,
-
-
- plurals: [
- [
- (/(quiz)$/i),
- "$1zes"
- ],
- [
- (/^(ox)$/i),
- "$1en"
- ],
- [
- (/([m|l])ouse$/i),
- "$1ice"
- ],
- [
- (/(matr|vert|ind)ix|ex$/i),
- "$1ices"
- ],
- [
- (/(x|ch|ss|sh)$/i),
- "$1es"
- ],
- [
- (/([^aeiouy]|qu)y$/i),
- "$1ies"
- ],
- [
- (/(hive)$/i),
- "$1s"
- ],
- [
- (/(?:([^f])fe|([lr])f)$/i),
- "$1$2ves"
- ],
- [
- (/sis$/i),
- "ses"
- ],
- [
- (/([ti])um$/i),
- "$1a"
- ],
- [
- (/(buffal|tomat|potat)o$/i),
- "$1oes"
- ],
- [
- (/(bu)s$/i),
- "$1ses"
- ],
- [
- (/(alias|status|sex)$/i),
- "$1es"
- ],
- [
- (/(octop|vir)us$/i),
- "$1i"
- ],
- [
- (/(ax|test)is$/i),
- "$1es"
- ],
- [
- (/^(p)erson$/i),
- "$1eople"
- ],
- [
- (/^(m)an$/i),
- "$1en"
- ],
- [
- (/(.*)(child)(ren)?$/i),
- "$1$2ren"
- ],
- [
- (/s$/i),
- "s"
- ],
- [
- (/$/),
- "s"
- ]
- ],
-
- singulars: [
- [
- (/(address)$/i),
- "$1"
- ],
- [
- (/(quiz)zes$/i),
- "$1"
- ],
- [
- (/(matr)ices$/i),
- "$1ix"
- ],
- [
- (/(vert|ind)ices$/i),
- "$1ex"
- ],
- [
- (/^(ox)en/i),
- "$1"
- ],
- [
- (/(alias|status)es$/i),
- "$1"
- ],
- [
- (/(octop|vir)i$/i),
- "$1us"
- ],
- [
- (/(cris|ax|test)es$/i),
- "$1is"
- ],
- [
- (/(shoe)s$/i),
- "$1"
- ],
- [
- (/(o)es$/i),
- "$1"
- ],
- [
- (/(bus)es$/i),
- "$1"
- ],
- [
- (/([m|l])ice$/i),
- "$1ouse"
- ],
- [
- (/(x|ch|ss|sh)es$/i),
- "$1"
- ],
- [
- (/(m)ovies$/i),
- "$1ovie"
- ],
- [
- (/(s)eries$/i),
- "$1eries"
- ],
- [
- (/([^aeiouy]|qu)ies$/i),
- "$1y"
- ],
- [
- (/([lr])ves$/i),
- "$1f"
- ],
- [
- (/(tive)s$/i),
- "$1"
- ],
- [
- (/(hive)s$/i),
- "$1"
- ],
- [
- (/([^f])ves$/i),
- "$1fe"
- ],
- [
- (/(^analy)ses$/i),
- "$1sis"
- ],
- [
- (/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i),
- "$1$2sis"
- ],
- [
- (/([ti])a$/i),
- "$1um"
- ],
- [
- (/(n)ews$/i),
- "$1ews"
- ],
- [
- (/(p)eople$/i),
- "$1erson"
- ],
- [
- (/s$/i),
- ""
- ]
- ],
-
- uncountable: [
- "sheep",
- "fish",
- "series",
- "species",
- "money",
- "rice",
- "information",
- "equipment",
- "grass",
- "mud",
- "offspring",
- "deer",
- "means"
- ],
-
- singular: function(matcher, replacer) {
- this.singulars.unshift([
- matcher,
- replacer
- ]);
- },
-
- plural: function(matcher, replacer) {
- this.plurals.unshift([
- matcher,
- replacer
- ]);
- },
-
- clearSingulars: function() {
- this.singulars = [];
- },
-
- clearPlurals: function() {
- this.plurals = [];
- },
-
- isTransnumeral: function(word) {
- return Ext.Array.indexOf(this.uncountable, word) != -1;
- },
-
- pluralize: function(word) {
- if (this.isTransnumeral(word)) {
- return word;
- }
- var plurals = this.plurals,
- length = plurals.length,
- tuple, regex, i;
- for (i = 0; i < length; i++) {
- tuple = plurals[i];
- regex = tuple[0];
- if (regex == word || (regex.test && regex.test(word))) {
- return word.replace(regex, tuple[1]);
- }
- }
- return word;
- },
-
- singularize: function(word) {
- if (this.isTransnumeral(word)) {
- return word;
- }
- var singulars = this.singulars,
- length = singulars.length,
- tuple, regex, i;
- for (i = 0; i < length; i++) {
- tuple = singulars[i];
- regex = tuple[0];
- if (regex == word || (regex.test && regex.test(word))) {
- return word.replace(regex, tuple[1]);
- }
- }
- return word;
- },
-
- classify: function(word) {
- return Ext.String.capitalize(this.singularize(word));
- },
-
- ordinalize: function(number) {
- var parsed = parseInt(number, 10),
- mod10 = parsed % 10,
- mod100 = parsed % 100;
-
- if (11 <= mod100 && mod100 <= 13) {
- return number + "th";
- } else {
- switch (mod10) {
- case 1:
- return number + "st";
- case 2:
- return number + "nd";
- case 3:
- return number + "rd";
- default:
- return number + "th";
- }
- }
- }
- }, function() {
-
- var irregulars = {
- alumnus: 'alumni',
- cactus: 'cacti',
- focus: 'foci',
- nucleus: 'nuclei',
- radius: 'radii',
- stimulus: 'stimuli',
- ellipsis: 'ellipses',
- paralysis: 'paralyses',
- oasis: 'oases',
- appendix: 'appendices',
- index: 'indexes',
- beau: 'beaux',
- bureau: 'bureaux',
- tableau: 'tableaux',
- woman: 'women',
- child: 'children',
- man: 'men',
- corpus: 'corpora',
- criterion: 'criteria',
- curriculum: 'curricula',
- genus: 'genera',
- memorandum: 'memoranda',
- phenomenon: 'phenomena',
- foot: 'feet',
- goose: 'geese',
- tooth: 'teeth',
- antenna: 'antennae',
- formula: 'formulae',
- nebula: 'nebulae',
- vertebra: 'vertebrae',
- vita: 'vitae'
- },
- singular;
- for (singular in irregulars) {
- if (irregulars.hasOwnProperty(singular)) {
- this.plural(singular, irregulars[singular]);
- this.singular(irregulars[singular], singular);
- }
- }
- });
- Ext.define('Ext.data.schema.Namer', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'namer.default',
-
- isNamer: true,
-
-
- capitalize: function(name) {
- return Ext.String.capitalize(name);
- },
-
- fieldRole: function(name) {
- var match = name.match(this.endsWithIdRe, '');
- if (match) {
- name = name.substr(0, name.length - (match[1] || match[2]).length);
- }
- return this.apply('uncapitalize', name);
- },
- idField: function(name) {
-
- return this.apply('uncapitalize,singularize', name) + 'Id';
- },
- instanceName: function(roleName) {
- return this.apply('underscore', roleName);
- },
- multiRole: function(name) {
- return this.apply('undotted,uncapitalize,pluralize', name);
- },
- pluralize: function(name) {
- return Ext.util.Inflector.pluralize(name);
- },
- readerRoot: function(roleName) {
- return this.apply('uncapitalize', roleName);
- },
- singularize: function(name) {
- return Ext.util.Inflector.singularize(name);
- },
- storeName: function(roleName) {
- return this.apply('underscore', roleName);
- },
- uncapitalize: function(name) {
- return Ext.String.uncapitalize(name);
- },
- underscore: function(name) {
- return '_' + name;
- },
- uniRole: function(name) {
- return this.apply('undotted,uncapitalize,singularize', name);
- },
- undotted: function(name) {
- if (name.indexOf('.') < 0) {
- return name;
- }
- var parts = name.split('.'),
- index = parts.length;
- while (index-- > 1) {
- parts[index] = this.apply('capitalize', parts[index]);
- }
- return parts.join('');
- },
-
-
- getterName: function(role) {
- var name = role.role;
- if (role && role.isMany) {
-
- return name;
- }
-
- return 'get' + this.apply('capitalize', name);
- },
- inverseFieldRole: function(leftType, unique, rightRole, rightType) {
-
-
-
-
- var me = this,
- leftRole = me.apply(unique ? 'uniRole' : 'multiRole', leftType),
- s1 = me.apply('pluralize', rightRole),
- s2 = me.apply('undotted,pluralize', rightType);
- if (s1.toLowerCase() !== s2.toLowerCase()) {
-
-
-
- leftRole = rightRole + me.apply('capitalize', leftRole);
- }
- return leftRole;
- },
- manyToMany: function(relation, leftType, rightType) {
- var me = this,
-
- ret = me.apply('undotted,capitalize,singularize', leftType) + me.apply('undotted,capitalize,pluralize', rightType);
- if (relation) {
- ret = me.apply('capitalize', relation + ret);
- }
- return ret;
- },
-
- manyToOne: function(leftType, leftRole, rightType, rightRole) {
-
-
- return this.apply('capitalize,singularize', rightType) + this.apply('capitalize', leftRole);
- },
- matrixRole: function(relation, entityType) {
- var ret = this.apply(relation ? 'multiRole,capitalize' : 'multiRole', entityType);
- return relation ? relation + ret : ret;
- },
- oneToOne: function(leftType, leftRole, rightType, rightRole) {
- return this.apply('undotted,capitalize,singularize', rightType) + this.apply('capitalize', leftRole);
- },
- setterName: function(role) {
- return 'set' + this.apply('capitalize', role.role);
- },
-
-
- endsWithIdRe: /(?:(_id)|[^A-Z](Id))$/,
- cache: {},
- apply: function(operation, name) {
- var me = this,
- cache = me.cache,
- entry = cache[name] || (cache[name] = {}),
- ret = entry[operation],
- i, length, operations;
- if (!ret) {
- if (operation.indexOf(',') < 0) {
- ret = me[operation](name);
- } else {
- length = (operations = operation.split(',')).length;
- ret = name;
- for (i = 0; i < length; ++i) {
- ret = me.apply(operations[i], ret);
- }
- }
- entry[operation] = ret;
- }
- return ret;
- }
- });
- Ext.define('Ext.data.schema.Schema', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'schema.default',
-
- aliasPrefix: 'schema.',
- isSchema: true,
-
- type: 'default',
- statics: {
-
- instances: {},
-
-
- clearInstance: function(id) {
- var schema = this.instances[id];
- delete this.instances[id];
- if (schema) {
- schema.clear(true);
- schema.destroy();
- }
- },
-
-
- get: function(config) {
- var Schema = this,
- cache = Schema.instances,
- id = 'default',
- isString = config && Ext.isString(config),
- instance, newConfig;
- if (config) {
- if (config.isSchema) {
- return config;
- }
- id = isString ? config : (config.id || id);
- }
- if (!(instance = cache[id])) {
- cache[id] = instance = Schema.create(config);
- instance.id = id;
- } else if (config && !isString) {
-
- if (id !== 'default') {
- Ext.raise('Only the default Schema instance can be reconfigured');
- }
-
-
-
-
-
-
-
- newConfig = Ext.merge({}, instance.config);
- Ext.merge(newConfig, config);
- instance.setConfig(newConfig);
- instance.config = newConfig;
-
- instance.setConfig = function() {
- Ext.raise('The schema can only be reconfigured once');
- };
- }
-
- return instance;
- },
- lookupEntity: function(entity) {
- var ret = null,
- instances = this.instances,
- match, name, schema;
- if (entity) {
- if (entity.isEntity) {
- ret = entity.self;
- }
-
- else if (Ext.isFunction(entity)) {
-
- ret = entity;
- } else if (Ext.isString(entity)) {
- ret = Ext.ClassManager.get(entity);
-
- if (ret && (!ret.prototype || !ret.prototype.isEntity)) {
- ret = null;
- }
- if (!ret) {
- for (name in instances) {
- schema = instances[name];
- match = schema.getEntity(entity);
- if (match) {
- if (ret) {
- Ext.raise('Ambiguous entity name "' + entity + '". Defined by schema "' + ret.schema.type + '" and "' + name + '"');
- }
- ret = match;
- }
- }
- }
- if (!ret) {
- Ext.raise('No such Entity "' + entity + '".');
- }
- }
- }
- return ret;
- }
- },
-
- assocCount: 0,
-
- entityCount: 0,
- config: {
-
- defaultIdentifier: null,
-
- keyCheckDelay: 10,
-
- namer: 'default',
-
- namespace: null,
-
- proxy: {
- type: 'ajax',
- url: '{prefix}/{entityName}'
- },
-
- urlPrefix: ''
- },
- onClassExtended: function(cls, data) {
- var alias = data.alias;
- if (alias && !data.type) {
- if (!Ext.isString(alias)) {
- alias = alias[0];
- }
- cls.prototype.type = alias.substring(this.prototype.aliasPrefix.length);
- }
- },
- constructor: function(config) {
- this.initConfig(config);
- this.clear();
- },
-
-
-
- applyDefaultIdentifier: function(identifier) {
- return identifier && Ext.Factory.dataIdentifier(identifier);
- },
- applyNamer: function(namer) {
- var ret = Ext.data.schema.Namer.create(namer);
- ret.schema = this;
- return ret;
- },
- applyNamespace: function(namespace) {
- if (namespace) {
- var end = namespace.length - 1;
- if (namespace.charAt(end) !== '.') {
- namespace += '.';
- }
- }
- return namespace;
- },
- applyProxy: function(proxy) {
- return Ext.util.ObjectTemplate.create(proxy);
- },
-
-
-
- eachAssociation: function(fn, scope) {
- var associations = this.associations,
- name;
- for (name in associations) {
- if (associations.hasOwnProperty(name)) {
- if (fn.call(scope, name, associations[name]) === false) {
- break;
- }
- }
- }
- },
- eachEntity: function(fn, scope) {
- var entities = this.entities,
- name;
- for (name in entities) {
- if (entities.hasOwnProperty(name)) {
- if (fn.call(scope, name, entities[name].cls) === false) {
- break;
- }
- }
- }
- },
-
- getAssociation: function(name) {
- var entry = this.associations[name];
- return entry || null;
- },
-
- getEntity: function(name) {
- var entry = this.entityClasses[name] || this.entities[name];
- return (entry && entry.cls) || null;
- },
-
- getEntityName: function(cls) {
- var ns = this.getNamespace(),
- index, name;
- if (typeof cls === 'string') {
- name = cls;
- } else {
- name = cls.$className || null;
- }
- if (name) {
-
- if (ns) {
- index = ns.length;
- if (name.substring(0, index) !== ns) {
- return name;
- }
- }
- if (index) {
- name = name.substring(index);
- }
- }
- return name;
- },
-
- hasAssociations: function(name) {
- name = name.entityName || name;
- return !!this.associationEntityMap[name];
- },
-
- hasEntity: function(entity) {
- var name = this.getEntityName(entity);
- return !!(this.entities[name] || this.entityClasses[name]);
- },
-
-
-
- addMatrix: function(entityType, matrixName, relation, left, right) {
- var me = this,
- namer = me.getNamer(),
- associations = me.associations,
- entities = me.entities,
- leftType = left.type,
- rightType = right.type,
- leftField = left.field || namer.apply('idField', leftType),
- rightField = right.field || namer.apply('idField', rightType),
- leftRole = left.role || namer.matrixRole(relation, leftType),
- rightRole = right.role || namer.matrixRole(relation, rightType),
- matrix, leftEntry, rightEntry;
- leftEntry = entities[leftType] || (entities[leftType] = {
- cls: null,
- name: leftType,
- associations: {}
- });
- rightEntry = entities[rightType] || (entities[rightType] = {
- cls: null,
- name: rightType,
- associations: {}
- });
- ++me.assocCount;
- associations[matrixName] = matrix = new Ext.data.schema.ManyToMany({
- name: matrixName,
- schema: me,
- definedBy: entityType,
- left: {
- cls: leftEntry.cls,
- type: leftType,
- role: leftRole,
- field: leftField,
- associationKey: left.associationKey
- },
- right: {
- cls: rightEntry.cls,
- type: rightType,
- role: rightRole,
- field: rightField,
- associationKey: right.associationKey
- }
- });
- leftEntry.associations[matrix.right.role] = matrix.right;
- rightEntry.associations[matrix.left.role] = matrix.left;
- if (leftEntry.cls) {
- me.associationEntityMap[leftEntry.cls.entityName] = true;
- }
- if (rightEntry.cls) {
- me.associationEntityMap[rightEntry.cls.entityName] = true;
- }
- me.decorateModel(matrix);
- },
-
- addReference: function(entityType, referenceField, descr, unique, dupeCheck) {
- var me = this,
- namer = me.getNamer(),
- entities = me.entities,
- associations = me.associations,
- entityName = entityType.entityName,
- association = descr.association,
- child = descr.child,
- parent = descr.parent,
- rightRole = descr.role,
-
- rightType = descr.type || parent || child,
- leftVal = descr.inverse,
- left = Ext.isString(leftVal) ? {
- role: leftVal
- } : leftVal,
- leftRole = left && left.role,
- entry, T;
- if (!rightRole) {
-
-
-
- if (!referenceField || descr.legacy) {
- rightRole = namer.apply('uncapitalize', rightType);
- } else {
- rightRole = namer.apply('fieldRole', referenceField.name);
- }
- }
- if (!leftRole) {
- leftRole = namer.inverseFieldRole(entityName, unique, rightRole, rightType);
- }
- if (!association) {
- if (unique) {
- association = namer.oneToOne(entityType, leftRole, rightType, rightRole);
- } else {
- association = namer.manyToOne(entityType, leftRole, rightType, rightRole);
- }
- }
- if (dupeCheck && association in associations) {
- if (dupeCheck(associations[association], association, leftRole, rightRole) !== false) {
- return;
- }
- }
-
- if (association in associations) {
- Ext.raise('Duplicate association: "' + association + '" declared by ' + entityName + (referenceField ? ('.' + referenceField.name) : '') + ' (collides with ' + associations[association].definedBy.entityName + ')');
- }
- if (referenceField && referenceField.definedBy === entities[rightType]) {
- Ext.raise('ForeignKey reference should not be owned by the target model');
- }
-
-
-
- entry = entities[rightType] || (entities[rightType] = {
- cls: null,
- name: rightType,
- associations: {}
- });
-
- T = unique ? Ext.data.schema.OneToOne : Ext.data.schema.ManyToOne;
- association = new T({
- name: association,
-
- owner: child ? 'left' : (parent ? 'right' : null),
- definedBy: entityType,
- schema: me,
- field: referenceField,
- nullable: referenceField ? !!referenceField.allowBlank : true,
- left: {
- cls: entityType,
- type: entityName,
- role: leftRole,
- extra: left
- },
- right: {
- cls: entry.cls,
- type: rightType,
- role: rightRole,
- extra: descr
- },
- meta: descr
- });
-
-
-
- entityType.associations[rightRole] = association.right;
- entry.associations[leftRole] = association.left;
- if (referenceField) {
-
-
- referenceField.reference = association.right;
- entityType.references.push(referenceField);
- }
- ++me.assocCount;
- me.associationEntityMap[entityName] = true;
- if (entry.cls) {
- me.associationEntityMap[entry.cls.entityName] = true;
- }
- associations[association.name] = association;
- if (association.right.cls) {
- me.decorateModel(association);
- }
- },
-
- privates: {
-
- addEntity: function(entityType) {
- var me = this,
- entities = me.entities,
- entityName = entityType.entityName,
- entry = entities[entityName],
- fields = entityType.fields,
- associations, field, i, length, name;
- if (!entry) {
- entities[entityName] = entry = {
- name: entityName,
- associations: {}
- };
- }
-
- else if (entry.cls) {
- Ext.raise('Duplicate entity name "' + entityName + '": ' + entry.cls.$className + ' and ' + entityType.$className);
- } else
- {
- associations = entry.associations;
- for (name in associations) {
-
-
- associations[name].inverse.cls = entityType;
- me.associationEntityMap[entityName] = true;
-
-
- me.decorateModel(associations[name].association);
- }
- }
- entry.cls = entityType;
- entityType.prototype.associations = entityType.associations = entry.associations;
- me.entityClasses[entityType.$className] = entry;
- ++me.entityCount;
- for (i = 0 , length = fields.length; i < length; ++i) {
- field = fields[i];
- if (field.reference) {
- me.addReferenceDescr(entityType, field);
- }
- }
- },
-
- addMatrices: function(entityType, matrices) {
- var me = this,
- i, length, matrixName;
- if (Ext.isString(matrices)) {
- me.addMatrixDescr(entityType, null, matrices);
- } else if (matrices[0]) {
-
- for (i = 0 , length = matrices.length; i < length; ++i) {
- me.addMatrixDescr(entityType, null, matrices[i]);
- }
- } else {
- for (matrixName in matrices) {
- me.addMatrixDescr(entityType, matrixName, matrices[matrixName]);
- }
- }
- },
-
- addMatrixDescr: function(entityType, matrixName, matrixDef) {
- var me = this,
- entityName = entityType.entityName,
- associations = me.associations,
- namer = me.getNamer(),
- left = matrixDef.left,
- right = matrixDef.right,
- last, relation;
- if (Ext.isString(matrixDef)) {
- if (matrixDef.charAt(0) === '#') {
-
-
- left = {
- type: entityName
- };
-
- right = {
- type: matrixDef.substring(1)
- };
- }
-
- else if (matrixDef.charAt(last = matrixDef.length - 1) === '#') {
-
-
- left = {
- type: matrixDef.substring(0, last)
- };
-
- right = {
- type: entityName
- };
- }
-
- else if (namer.apply('multiRole', entityName) < namer.apply('multiRole', matrixDef)) {
-
- left = {
- type: entityName
- };
-
- right = {
- type: matrixDef
- };
- } else
- {
-
- left = {
- type: matrixDef
- };
-
- right = {
- type: entityName
- };
- }
- } else
- {
-
- Ext.Assert.isString(matrixDef.type, 'No "type" for manyToMany in ' + entityName);
-
- relation = matrixDef.relation;
- if (left || (!right && namer.apply('multiRole', entityName) < namer.apply('multiRole', matrixDef.type))) {
- if (!left || left === true) {
-
- left = {
- type: entityName
- };
- } else
- {
-
- left = Ext.apply({
- type: entityName
- }, left);
- }
-
- right = matrixDef;
- } else
- {
- if (!right || right === true) {
-
- right = {
- type: entityName
- };
- } else
- {
-
- right = Ext.apply({
- type: entityName
- }, right);
- }
-
- left = matrixDef;
- }
- }
-
- if (!matrixName) {
- matrixName = namer.manyToMany(relation, left.type, right.type);
- }
- if (!(matrixName in associations)) {
- me.addMatrix(entityType, matrixName, relation, left, right);
- } else
-
-
-
-
-
- {
- var entry = associations[matrixName],
- before = [
- entry.kind,
- entry.left.type,
- entry.left.role,
- entry.left.field,
- entry.right.type,
- entry.right.role,
- entry.right.field
- ].join('|');
-
- delete associations[matrixName];
- me.addMatrix(entityType, matrixName, relation, left, right);
- var after = associations[matrixName];
-
- associations[matrixName] = entry;
- entry.left.cls.associations[entry.right.role] = entry.right;
- entry.right.cls.associations[entry.left.role] = entry.left;
- --me.assocCount;
-
- after = [
- after.kind,
- after.left.type,
- after.left.role,
- after.left.field,
- after.right.type,
- after.right.role,
- after.right.field
- ].join('|');
- if (before != after) {
- Ext.log.warn(matrixName + '(' + entry.definedBy.entityName + '): ' + before);
- Ext.log.warn(matrixName + '(' + entityName + '): ' + after);
- Ext.raise('Conflicting association: "' + matrixName + '" declared by ' + entityName + ' was previously declared by ' + entry.definedBy.entityName);
- }
- }
- },
-
-
- addReferenceDescr: function(entityType, referenceField) {
- var me = this,
- descr = referenceField.$reference;
- if (Ext.isString(descr)) {
- descr = {
- type: descr
- };
- } else {
- descr = Ext.apply({}, descr);
- }
- me.addReference(entityType, referenceField, descr, referenceField.unique);
- },
- addBelongsTo: function(entityType, assoc) {
- this.addKeylessSingle(entityType, assoc, false);
- },
- addHasOne: function(entityType, assoc) {
- this.addKeylessSingle(entityType, assoc, true);
- },
- addKeylessSingle: function(entityType, assoc, unique) {
- var foreignKey, referenceField;
- assoc = Ext.apply({}, this.checkLegacyAssociation(entityType, assoc));
- assoc.type = this.getEntityName(assoc.child || assoc.parent || assoc.type);
- foreignKey = assoc.foreignKey || (assoc.type.toLowerCase() + '_id');
- referenceField = entityType.getField(foreignKey);
- assoc.fromSingle = true;
- if (referenceField) {
- referenceField.$reference = assoc;
- referenceField.unique = true;
- assoc.legacy = true;
-
- Ext.log.warn('Using foreignKey is deprecated, use a keyed association. See Ext.data.field.Field.reference');
- }
-
- this.addReference(entityType, referenceField, assoc, unique);
- },
- addHasMany: function(entityType, assoc) {
- var me = this,
- entities = me.entities,
- pending = me.pending,
- cls, name, referenceField, target, foreignKey, inverseOptions, child, declaredInverse;
- assoc = Ext.apply({}, this.checkLegacyAssociation(entityType, assoc));
- assoc.type = this.getEntityName(assoc.child || assoc.parent || assoc.type);
- name = assoc.type;
- target = entities[name];
- cls = target && target.cls;
- if (cls) {
- name = entityType.entityName;
- foreignKey = assoc.foreignKey || (name.toLowerCase() + '_id');
- delete assoc.foreignKey;
-
-
- declaredInverse = Ext.apply({}, assoc.inverse);
- delete assoc.inverse;
- inverseOptions = Ext.apply({}, assoc);
- delete inverseOptions.type;
- assoc = Ext.apply({
- type: name,
- inverse: inverseOptions
- }, declaredInverse);
- child = inverseOptions.child;
- if (child) {
- delete inverseOptions.child;
- assoc.parent = name;
- }
- referenceField = cls.getField(foreignKey);
- if (referenceField) {
- referenceField.$reference = assoc;
- assoc.legacy = true;
-
- Ext.log.warn('Using foreignKey is deprecated, use a keyed association. See Ext.data.field.Field.reference');
- }
-
-
- me.addReference(cls, referenceField, assoc, false,
- function(association, name, leftRole, rightRole) {
-
- var result = !!association.meta.fromSingle && cls === association.left.cls,
- l, r;
- if (result) {
- l = cls.entityName;
- r = entityType.entityName;
- Ext.raise('hasMany ("' + r + '") and belongsTo ("' + l + '") should not be used in conjunction to declare a relationship. Use only one.');
- }
- return result;
- });
- } else
- {
-
- if (!pending[name]) {
- pending[name] = [];
- }
- pending[name].push([
- entityType,
- assoc
- ]);
- }
- },
- checkLegacyAssociation: function(entityType, assoc) {
- if (Ext.isString(assoc)) {
- assoc = {
- type: assoc
- };
- } else {
- assoc = Ext.apply({}, assoc);
- }
- if (assoc.model) {
- assoc.type = assoc.model;
-
- delete assoc.model;
- }
- var name = assoc.associatedName || assoc.name;
- if (name) {
-
- delete assoc.associatedName;
- delete assoc.name;
- assoc.role = name;
- }
- return assoc;
- },
- afterKeylessAssociations: function(cls) {
- var pending = this.pending,
- name = cls.entityName,
- mine = pending[name],
- i, len;
- if (mine) {
- for (i = 0 , len = mine.length; i < len; ++i) {
- this.addHasMany.apply(this, mine[i]);
- }
- delete pending[name];
- }
- },
- clear: function(clearNamespace) {
-
- var me = this,
- timer = me.timer;
- delete me.setConfig;
- if (timer) {
- window.clearTimeout(timer);
- me.timer = null;
- }
- me.associations = {};
- me.associationEntityMap = {};
- me.entities = {};
- me.entityClasses = {};
- me.pending = {};
- me.assocCount = me.entityCount = 0;
- if (clearNamespace) {
- me.setNamespace(null);
- }
- },
- constructProxy: function(Model) {
- var me = this,
- data = Ext.Object.chain(Model),
- proxy = me.getProxy();
- data.schema = me;
- data.prefix = me.getUrlPrefix();
- return proxy.apply(data);
- },
- applyDecoration: function(role) {
- var me = this,
-
-
-
-
- cls = role.inverse.cls,
- namer = me.getNamer(),
- getterName, setterName, proto;
-
-
- if (cls && !role.decorated) {
- role.decorated = true;
- proto = cls.prototype;
- if (!(getterName = role.getterName)) {
- role.getterName = getterName = namer.getterName(role);
- }
- proto[getterName] = role.createGetter();
-
- if (role.createSetter) {
- if (!(setterName = role.setterName)) {
- role.setterName = setterName = namer.setterName(role);
- }
- proto[setterName] = role.createSetter();
- }
- }
- },
- decorateModel: function(association) {
- this.applyDecoration(association.left);
- this.applyDecoration(association.right);
- },
- processKeyChecks: function(processAll) {
- var me = this,
- keyCheckQueue = me.keyCheckQueue,
- timer = me.timer,
- len, i, item;
- if (timer) {
- window.clearTimeout(timer);
- me.timer = null;
- }
- if (!keyCheckQueue) {
- return;
- }
-
-
-
-
- do {
- keyCheckQueue = me.keyCheckQueue;
- me.keyCheckQueue = [];
- for (i = 0 , len = keyCheckQueue.length; i < len; ++i) {
- item = keyCheckQueue[i];
- item.role.checkKeyForDrop(item.record);
- }
- } while (processAll && me.keyCheckQueue.length);
- },
- queueKeyCheck: function(record, role) {
- var me = this,
- keyCheckQueue = me.keyCheckQueue,
- timer = me.timer;
- if (!keyCheckQueue) {
- me.keyCheckQueue = keyCheckQueue = [];
- }
- keyCheckQueue.push({
- record: record,
- role: role
- });
- if (!timer) {
- me.timer = timer = Ext.defer(me.processKeyChecks, me.getKeyCheckDelay(), me);
- }
- },
- rankEntities: function() {
- var me = this,
- entities = me.entities,
- entityNames = Ext.Object.getKeys(entities),
- length = entityNames.length,
- entityType, i;
- me.nextRank = 1;
-
- entityNames.sort();
- for (i = 0; i < length; ++i) {
- entityType = entities[entityNames[i]].cls;
- if (!entityType.rank) {
- me.rankEntity(entityType);
- }
- }
-
- me.topoStack = null;
- },
-
-
- rankEntity: function(entityType) {
- var associations = entityType.associations,
- associatedType, role, roleName;
-
- var topoStack = this.topoStack || (this.topoStack = []),
- entityName = entityType.entityName;
- topoStack.push(entityName);
- if (entityType.rank === 0) {
- Ext.raise(entityName + " has circular foreign-key references: " + topoStack.join(" --> "));
- }
- entityType.rank = 0;
-
-
- for (roleName in associations) {
- role = associations[roleName];
-
-
-
-
-
- if (!role.left && role.association.field) {
-
-
- associatedType = role.cls;
- if (!associatedType.rank) {
- this.rankEntity(associatedType);
- }
- }
- }
- entityType.rank = this.nextRank++;
-
- topoStack.pop();
- }
- }
- });
- Ext.define('Ext.data.AbstractStore', {
- mixins: [
- Ext.mixin.Observable,
- Ext.mixin.Factoryable
- ],
- factoryConfig: {
- defaultType: 'store',
- type: 'store'
- },
- $configPrefixed: false,
- $configStrict: false,
- config: {
-
- filters: null,
-
- autoDestroy: undefined,
-
- storeId: null,
-
- statefulFilters: false,
-
- sorters: null,
-
- remoteSort: {
- lazy: true,
- $value: false
- },
-
- remoteFilter: {
- lazy: true,
- $value: false
- },
-
- groupField: undefined,
-
- groupDir: 'ASC',
-
- grouper: null,
-
- pageSize: 25,
-
- autoSort: null,
-
- reloadOnClearSorters: false
- },
-
- currentPage: 1,
-
- loading: false,
-
- isStore: true,
-
- updating: 0,
-
- constructor: function(config) {
- var me = this,
- storeId;
-
- me.callParent([
- config
- ]);
-
-
-
-
-
-
-
-
-
-
-
- me.isInitializing = true;
- me.mixins.observable.constructor.call(me, config);
- me.isInitializing = false;
- storeId = me.getStoreId();
- if (!storeId && (config && config.id)) {
- me.setStoreId(storeId = config.id);
- }
- if (storeId) {
- Ext.data.StoreManager.register(me);
- }
- },
-
- createActiveRange: function(config) {
- var range = Ext.apply({
- store: this
- }, config);
- return new Ext.data.Range(range);
- },
-
- syncActiveRanges: function() {
- var activeRanges = this.activeRanges,
- len = activeRanges && activeRanges.length,
- i;
- for (i = 0; i < len; i++) {
- activeRanges[i].refresh();
- }
- },
-
- getCount: function() {
- var data = this.getData();
-
-
- return data ? data.getCount() : 0;
- },
-
- rangeCached: function(start, end) {
- return this.getData().getCount() >= Math.max(start, end);
- },
-
-
- find: function(property, value, startIndex, anyMatch, caseSensitive, exactMatch) {
-
-
-
-
-
- var startsWith = !anyMatch,
- endsWith = !!(startsWith && exactMatch);
- return this.getData().findIndex(property, value, startIndex, startsWith, endsWith, !caseSensitive);
- },
-
- findRecord: function() {
- var me = this,
- index = me.find.apply(me, arguments);
- return index !== -1 ? me.getAt(index) : null;
- },
-
- findExact: function(fieldName, value, startIndex) {
- return this.getData().findIndexBy(function(rec) {
- return rec.isEqual(rec.get(fieldName), value);
- }, this, startIndex);
- },
-
- findBy: function(fn, scope, start) {
- return this.getData().findIndexBy(fn, scope, start);
- },
-
- getAt: function(index) {
- return this.getData().getAt(index) || null;
- },
-
- getRange: function(start, end, options) {
-
- var result = this.getData().getRange(start, Ext.isNumber(end) ? end + 1 : end);
-
-
- if (options && options.callback) {
- options.callback.call(options.scope || this, result, start, end, options);
- }
- return result;
- },
-
- getFilters: function(autoCreate) {
- var result = this.callParent();
- if (!result && autoCreate !== false) {
- this.setFilters([]);
- result = this.callParent();
- }
- return result;
- },
- applyFilters: function(filters, filtersCollection) {
- var created;
- if (!filtersCollection) {
- filtersCollection = this.createFiltersCollection();
- created = true;
- }
- filtersCollection.add(filters);
- if (created) {
- this.onRemoteFilterSet(filtersCollection, this.getRemoteFilter());
- }
- return filtersCollection;
- },
-
- getSorters: function(autoCreate) {
- var result = this.callParent();
- if (!result && autoCreate !== false) {
-
- this.setSorters([]);
- result = this.callParent();
- }
- return result;
- },
- applySorters: function(sorters, sortersCollection) {
- var created;
- if (!sortersCollection) {
- sortersCollection = this.createSortersCollection();
- created = true;
- }
- sortersCollection.add(sorters);
- if (created) {
- this.onRemoteSortSet(sortersCollection, this.getRemoteSort());
- }
- return sortersCollection;
- },
-
- filter: function(filters, value, suppressEvent) {
- if (Ext.isString(filters)) {
- filters = {
- property: filters,
- value: value
- };
- }
- this.suppressNextFilter = !!suppressEvent;
- this.getFilters().add(filters);
- this.suppressNextFilter = false;
- },
-
- removeFilter: function(toRemove, suppressEvent) {
- var me = this,
- filters = me.getFilters();
- me.suppressNextFilter = !!suppressEvent;
- if (toRemove instanceof Ext.util.Filter) {
- filters.remove(toRemove);
- } else {
- filters.removeByKey(toRemove);
- }
- me.suppressNextFilter = false;
- },
- updateAutoSort: function(autoSort) {
-
- this.getData().setAutoSort(autoSort);
- },
- updateRemoteSort: function(remoteSort) {
-
-
- this.onRemoteSortSet(this.getSorters(false), remoteSort);
- },
- updateRemoteFilter: function(remoteFilter) {
- this.onRemoteFilterSet(this.getFilters(false), remoteFilter);
- },
-
- addFilter: function(filters, suppressEvent) {
- this.suppressNextFilter = !!suppressEvent;
- this.getFilters().add(filters);
- this.suppressNextFilter = false;
- },
-
- filterBy: function(fn, scope) {
- this.getFilters().add({
- filterFn: fn,
- scope: scope || this
- });
- },
-
- clearFilter: function(suppressEvent) {
- var me = this,
- filters = me.getFilters(false);
- if (!filters || filters.getCount() === 0) {
- return;
- }
- me.suppressNextFilter = !!suppressEvent;
- filters.removeAll();
- me.suppressNextFilter = false;
- },
-
- isFiltered: function() {
- return this.getFilters().getCount() > 0;
- },
-
- isSorted: function() {
- var sorters = this.getSorters(false);
- return !!(sorters && sorters.length > 0) || this.isGrouped();
- },
- addFieldTransform: function(sorter) {
-
- if (sorter.getTransform()) {
- return;
- }
- var fieldName = sorter.getProperty(),
- Model = this.getModel(),
- field, sortType;
- if (Model) {
- field = Model.getField(fieldName);
- sortType = field ? field.getSortType() : null;
- }
- if (sortType && sortType !== Ext.identityFn) {
- sorter.setTransform(sortType);
- }
- },
-
- beginUpdate: function() {
- if (!this.updating++ && this.hasListeners.beginupdate) {
-
- this.fireEvent('beginupdate');
- }
- },
-
- endUpdate: function() {
- if (this.updating && !--this.updating) {
- if (this.hasListeners.endupdate) {
- this.fireEvent('endupdate');
- }
- this.onEndUpdate();
- }
- },
-
- getState: function() {
- var me = this,
- sorters = [],
- filters = me.getFilters(),
- grouper = me.getGrouper(),
- filterState, hasState, result;
-
- me.getSorters().each(function(s) {
- sorters[sorters.length] = s.getState();
- hasState = true;
- });
-
-
- if (me.statefulFilters && me.saveStatefulFilters) {
-
-
-
- hasState = true;
- filterState = [];
- filters.each(function(f) {
- filterState[filterState.length] = f.getState();
- });
- }
- if (grouper) {
- hasState = true;
- }
-
- if (hasState) {
- result = {};
- if (sorters.length) {
- result.sorters = sorters;
- }
- if (filterState) {
- result.filters = filterState;
- }
- if (grouper) {
- result.grouper = grouper.getState();
- }
- }
- return result;
- },
-
- applyState: function(state) {
- var me = this,
- stateSorters = state.sorters,
- stateFilters = state.filters,
- stateGrouper = state.grouper;
- if (stateSorters) {
- me.getSorters().replaceAll(stateSorters);
- }
- if (stateFilters) {
-
- me.saveStatefulFilters = true;
- me.getFilters().replaceAll(stateFilters);
- }
- if (stateGrouper) {
- me.setGrouper(stateGrouper);
- }
- },
-
-
- hasPendingLoad: Ext.emptyFn,
-
- isLoaded: Ext.emptyFn,
-
- isLoading: Ext.emptyFn,
- destroy: function() {
- var me = this;
- if (me.hasListeners.beforedestroy) {
- me.fireEvent('beforedestroy', me);
- }
- me.destroying = true;
- if (me.getStoreId()) {
- Ext.data.StoreManager.unregister(me);
- }
- me.doDestroy();
- if (me.hasListeners.destroy) {
- me.fireEvent('destroy', me);
- }
- me.destroying = false;
-
- me.callParent();
- },
-
- doDestroy: Ext.emptyFn,
-
- sort: function(field, direction, mode) {
- var me = this;
- if (arguments.length === 0) {
- if (me.getRemoteSort()) {
- me.load();
- } else {
- me.forceLocalSort();
- }
- } else {
- me.getSorters().addSort(field, direction, mode);
- }
- },
-
-
- onBeforeCollectionSort: function(store, sorters) {
- if (sorters) {
- this.fireEvent('beforesort', this, sorters.getRange());
- }
- },
- onSorterEndUpdate: function() {
- var me = this,
- fireSort = true,
- sorters = me.getSorters(false),
- sorterCount;
-
-
- if (me.settingGroups || !sorters) {
- return;
- }
- sorters = sorters.getRange();
- sorterCount = sorters.length;
- if (me.getRemoteSort()) {
-
-
-
-
- if (sorters.length || me.getReloadOnClearSorters()) {
-
- fireSort = false;
- me.load({
- callback: function() {
- me.fireEvent('sort', me, sorters);
- }
- });
- }
- } else if (sorterCount) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- if (fireSort) {
-
- me.fireEvent('sort', me, sorters);
- }
- },
- onFilterEndUpdate: function() {
- var me = this,
- suppressNext = me.suppressNextFilter,
- filters = me.getFilters(false);
-
- if (!filters) {
- return;
- }
- if (me.getRemoteFilter()) {
-
- me.getFilters().each(function(filter) {
- if (filter.getInitialConfig().filterFn) {
- Ext.raise('Unable to use a filtering function in conjunction with remote filtering.');
- }
- });
-
- me.currentPage = 1;
- if (!suppressNext) {
- me.load();
- }
- } else if (!suppressNext) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- if (me.trackStateChanges) {
-
- me.saveStatefulFilters = true;
- }
-
- me.fireEvent('filterchange', me, me.getFilters().getRange());
- },
- updateGroupField: function(field) {
- if (field) {
- this.setGrouper({
- property: field,
- direction: this.getGroupDir()
- });
- } else {
- this.setGrouper(null);
- }
- },
-
-
- getGrouper: function() {
- return this.getData().getGrouper();
- },
-
- group: function(grouper, direction) {
- var me = this,
- sorters = me.getSorters(false),
- change = grouper || (sorters && sorters.length),
- data = me.getData();
- if (grouper && typeof grouper === 'string') {
- grouper = {
- property: grouper,
- direction: direction || me.getGroupDir()
- };
- }
- me.settingGroups = true;
-
-
-
- if (grouper === data.getGrouper()) {
- data.updateGrouper(grouper);
- } else {
- data.setGrouper(grouper);
- }
- delete me.settingGroups;
- if (change) {
- if (me.getRemoteSort()) {
- if (!me.isInitializing) {
- me.load({
- scope: me,
- callback: me.fireGroupChange
- });
- }
- } else {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- me.fireGroupChange();
- }
- } else
-
- {
- me.fireGroupChange();
- }
- },
- fireGroupChange: function() {
- if (!this.destroyed) {
- this.fireEvent('groupchange', this, this.getGrouper());
- }
- },
-
- clearGrouping: function() {
- this.group(null);
- },
- getGroupField: function() {
- var grouper = this.getGrouper(),
- group = '';
- if (grouper) {
- group = grouper.getProperty();
- }
- return group;
- },
-
- isGrouped: function() {
- return !!this.getGrouper();
- },
- applyGrouper: function(grouper) {
- this.group(grouper);
- return this.getData().getGrouper();
- },
-
- getGroups: function() {
- return this.getData().getGroups();
- },
- onEndUpdate: Ext.emptyFn,
- privates: {
- _metaProperties: {
- count: 'getCount',
- first: 'first',
- last: 'last',
- loading: 'hasPendingLoad',
- totalCount: 'getTotalCount'
- },
- interpret: function(name) {
- var me = this,
- accessor = me._metaProperties[name];
- return accessor && me[accessor]();
- },
-
- loadsSynchronously: Ext.privateFn,
- onRemoteFilterSet: function(filters, remoteFilter) {
- if (filters) {
- filters[remoteFilter ? 'on' : 'un']('endupdate', 'onFilterEndUpdate', this);
- }
- },
-
-
-
-
-
-
- onRemoteSortSet: function(sorters, remoteSort) {
- var me = this,
- data;
- if (sorters) {
- sorters[remoteSort ? 'on' : 'un']('endupdate', 'onSorterEndUpdate', me);
- data = me.getData();
- if (data) {
- data[remoteSort ? 'un' : 'on']('beforesort', 'onBeforeCollectionSort', me);
- }
- }
- }
- },
- deprecated: {
- 5: {
- methods: {
- destroyStore: function() {
- this.destroy();
- }
- }
- }
- }
- });
- Ext.define('Ext.data.Error', {
- isError: true,
- $configPrefixed: false,
-
- config: {
-
- field: null,
-
- message: ''
- },
- constructor: function(config) {
- this.initConfig(config);
- this.msg = this.message;
- }
- });
- Ext.define('Ext.data.ErrorCollection', {
- extend: Ext.util.MixedCollection,
-
- alternateClassName: 'Ext.data.Errors',
- init: function(record) {
- var me = this,
- fields = record.fields,
- data = record.data,
- before, field, item, i, len, msg, val, name;
- for (i = 0 , len = fields.length; i < len; ++i) {
- field = fields[i];
- name = field.name;
- val = data[name];
- if (field.validate && !field.validate.$nullFn) {
- before = me.length;
- msg = field.validate(val, null, me, record);
- if (before === me.length && msg !== true) {
- me.add(name, msg);
- }
- }
- }
- return me;
- },
- add: function(key, value) {
- var me = this,
- defaultMessage = Ext.data.field.Field.defaultInvalidMessage,
- obj = key,
-
- current;
- if (Ext.isString(key)) {
- obj = new Ext.data.Error({
- field: key,
- message: value || defaultMessage
- });
- } else {
- if (!(obj.isError)) {
- obj = new Ext.data.Error({
- field: obj.field || obj.name,
- message: obj.error || obj.message || obj.msg || defaultMessage
- });
- }
- key = obj.field;
- }
- current = me.get(key);
- if (current) {
- if (Ext.isArray(current)) {
- current.push(obj);
- return current;
- }
- me.removeAtKey(key);
- obj = [
- current,
- obj
- ];
- obj.field = key;
-
-
- obj = [
- obj
- ];
- }
- return me.callParent([
- obj
- ]);
- },
- getKey: function(item) {
- return item.field;
- },
-
- isValid: function() {
- return this.length === 0;
- },
-
- getByField: function(fieldName) {
- var values = this.get(fieldName);
- if (values && !Ext.isArray(values)) {
- values = [
- values
- ];
- }
- return values || [];
- }
- });
- Ext.define('Ext.data.operation.Operation', {
- alternateClassName: 'Ext.data.Operation',
- isOperation: true,
- config: {
-
- synchronous: false,
-
- url: '',
-
- params: undefined,
-
- callback: undefined,
-
- scope: undefined,
-
- resultSet: null,
-
- response: null,
-
- request: null,
-
- records: null,
-
- id: undefined,
-
- proxy: null,
-
- batch: null,
-
- recordCreator: null,
-
-
-
-
- internalCallback: null,
-
- internalScope: null
- },
-
- order: 0,
-
- foreignKeyDirection: 1,
-
- started: false,
-
- running: false,
-
- complete: false,
-
- success: undefined,
-
- exception: false,
-
- error: undefined,
- idPrefix: 'ext-operation-',
-
- constructor: function(config) {
-
-
-
-
-
-
- var scope = config && config.scope;
- this.initConfig(config);
- if (config) {
- config.scope = scope;
- }
- if (scope) {
- this.setScope(scope);
- this.initialConfig.scope = scope;
- }
-
- this._internalId = Ext.id(this, this.idPrefix);
- },
- getAction: function() {
- return this.action;
- },
-
- execute: function() {
- var me = this,
- request;
- delete me.error;
- delete me.success;
- me.complete = me.exception = false;
- me.setStarted();
- me.request = request = me.doExecute();
- if (request) {
- request.setOperation(me);
- }
- return request;
- },
- doExecute: Ext.emptyFn,
-
- abort: function() {
- var me = this,
- request = me.request,
- proxy;
- me.aborted = true;
- if (me.running && request) {
- proxy = me.getProxy();
- if (proxy && !proxy.destroyed) {
- proxy.abort(request);
- }
- me.request = null;
- }
- me.running = false;
- },
- process: function(resultSet, request, response, autoComplete) {
- var me = this;
- autoComplete = autoComplete !== false;
- me.setResponse(response);
- me.setResultSet(resultSet);
- if (resultSet.getSuccess()) {
- me.doProcess(resultSet, request, response);
- me.setSuccessful(autoComplete);
- } else if (autoComplete) {
- me.setException(resultSet.getMessage());
- }
- },
-
- _commitSetOptions: {
- convert: true,
- commit: true
- },
-
- doProcess: function(resultSet, request, response) {
- var me = this,
- commitSetOptions = me._commitSetOptions,
- clientRecords = me.getRecords(),
- clientLen = clientRecords.length,
- clientIdProperty = clientRecords[0].clientIdProperty,
- serverRecords = resultSet.getRecords(),
-
- serverLen = serverRecords ? serverRecords.length : 0,
- clientMap, serverRecord, clientRecord, i;
- if (serverLen && clientIdProperty) {
-
- clientMap = Ext.Array.toValueMap(clientRecords, 'id');
-
-
- for (i = 0; i < serverLen; ++i) {
- serverRecord = serverRecords[i];
- clientRecord = clientMap[serverRecord[clientIdProperty]];
- if (clientRecord) {
-
- delete clientMap[clientRecord.id];
-
- delete serverRecord[clientIdProperty];
- clientRecord.set(serverRecord, commitSetOptions);
- } else
-
- {
- Ext.log.warn('Ignoring server record: ' + Ext.encode(serverRecord));
- }
- }
-
-
- for (i in clientMap) {
- clientMap[i].commit();
- }
- } else {
-
-
-
- for (i = 0; i < clientLen; ++i) {
- clientRecord = clientRecords[i];
- if (serverLen === 0 || !(serverRecord = serverRecords[i])) {
-
- clientRecord.commit();
- } else {
- clientRecord.set(serverRecord, commitSetOptions);
- }
- }
- }
- },
-
- setStarted: function() {
- this.started = this.running = true;
- },
-
- setCompleted: function() {
- var me = this,
- proxy;
- me.complete = true;
- me.running = false;
- if (!me.destroying) {
- me.triggerCallbacks();
- }
-
- if (me.destroyed) {
- return;
- }
- proxy = me.getProxy();
-
- if (proxy && !proxy.destroyed) {
- proxy.completeOperation(me);
- }
- },
-
- setSuccessful: function(complete) {
- this.success = true;
- if (complete) {
- this.setCompleted();
- }
- },
-
- setException: function(error) {
- var me = this;
- me.exception = true;
- me.success = me.running = false;
- me.error = error;
- me.setCompleted();
- },
- triggerCallbacks: function() {
- var me = this,
- callback = me.getInternalCallback();
-
- if (callback) {
- callback.call(me.getInternalScope() || me, me);
-
- if (me.destroyed) {
- return;
- }
- me.setInternalCallback(null);
- me.setInternalScope(null);
- }
-
- if (callback = me.getCallback()) {
-
- callback.call(me.getScope() || me, me.getRecords(), me, me.wasSuccessful());
- if (me.destroyed) {
- return;
- }
- me.setCallback(null);
- me.setScope(null);
- }
- },
-
- hasException: function() {
- return this.exception;
- },
-
- getError: function() {
- return this.error;
- },
-
- getRecords: function() {
- var resultSet;
- return this._records || ((resultSet = this.getResultSet()) ? resultSet.getRecords() : null);
- },
-
- isStarted: function() {
- return this.started;
- },
-
- isRunning: function() {
- return this.running;
- },
-
- isComplete: function() {
- return this.complete;
- },
-
- wasSuccessful: function() {
- return this.isComplete() && this.success === true;
- },
-
-
- allowWrite: function() {
- return true;
- },
- destroy: function() {
- var me = this;
- me.destroying = true;
- if (me.running) {
- me.abort();
- }
-
- me._params = me._callback = me._scope = me._resultSet = me._response = null;
- me.request = me._request = me._records = me._proxy = me._batch = null;
- me._recordCreator = me._internalCallback = me._internalScope = null;
- me.callParent();
- }
- });
- Ext.define('Ext.data.operation.Create', {
- extend: Ext.data.operation.Operation,
- alias: 'data.operation.create',
- action: 'create',
- isCreateOperation: true,
- order: 10,
- config: {
- recordCreator: Ext.identityFn
- },
- doExecute: function() {
- return this.getProxy().create(this);
- }
- });
- Ext.define('Ext.data.operation.Destroy', {
- extend: Ext.data.operation.Operation,
- alias: 'data.operation.destroy',
- action: 'destroy',
- isDestroyOperation: true,
- order: 30,
- foreignKeyDirection: -1,
- doProcess: function()
- {
- var clientRecords = this.getRecords(),
- clientLen = clientRecords.length,
- i;
- for (i = 0; i < clientLen; ++i) {
- clientRecords[i].setErased();
- }
- },
- doExecute: function() {
- return this.getProxy().erase(this);
- },
- getRecordData: function(record, operation) {
- var data = {},
- idField = record.idField,
- nameProperty = this.getNameProperty() || 'name';
- data[idField[nameProperty]] = record.id;
- return data;
- }
- });
- Ext.define('Ext.data.operation.Read', {
- extend: Ext.data.operation.Operation,
- alias: 'data.operation.read',
- action: 'read',
- isReadOperation: true,
- config: {
-
- filters: undefined,
-
- sorters: undefined,
-
- grouper: undefined,
-
- start: undefined,
-
- limit: undefined,
-
- page: undefined,
-
- addRecords: false
- },
- doExecute: function() {
- return this.getProxy().read(this);
- },
- doProcess: Ext.emptyFn,
- allowWrite: function() {
- return false;
- }
- });
- Ext.define('Ext.data.operation.Update', {
- extend: Ext.data.operation.Operation,
- alias: 'data.operation.update',
- action: 'update',
- isUpdateOperation: true,
- order: 20,
- config: {
- recordCreator: Ext.identityFn
- },
- doExecute: function() {
- return this.getProxy().update(this);
- }
- });
- Ext.define('Ext.data.SortTypes', function() {
- var me;
- return {
- singleton: true,
- constructor: function() {
- me = this;
- },
-
- none: Ext.identityFn,
-
- stripCommasRe: /,/g,
-
- stripTagsRE: /<\/?[^>]+>/gi,
-
- asText: function(s) {
-
- return (s != null) ? String(s).replace(me.stripTagsRE, '') : '\x00';
- },
-
- asUCText: function(s) {
-
- return (s != null) ? String(s).toUpperCase().replace(me.stripTagsRE, '') : '\x00';
- },
-
- asUCString: function(s) {
-
- return (s != null) ? String(s).toUpperCase() : '\x00';
- },
-
- asDate: function(s) {
- if (!s) {
- return 0;
- }
- if (Ext.isDate(s)) {
- return s.getTime();
- }
- return Date.parse(String(s));
- },
-
- asFloat: function(s) {
- var val = parseFloat(String(s).replace(me.stripCommasRe, ''));
- return isNaN(val) ? 0 : val;
- },
-
- asInt: function(s) {
- var val = parseInt(String(s).replace(me.stripCommasRe, ''), 10);
- return isNaN(val) ? 0 : val;
- }
- };
- });
- Ext.define('Ext.data.validator.Validator', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'data.validator.base',
-
- isValidator: true,
- factoryConfig: {
- cacheable: true
- },
-
- type: 'base',
-
- constructor: function(config) {
- if (typeof config === 'function') {
- this.fnOnly = true;
- this.validate = config;
- } else {
- this.initConfig(config);
- }
- },
-
- validate: function() {
- return true;
- },
-
- clone: function() {
- var me = this;
- if (me.fnOnly) {
- return new Ext.data.validator.Validator(me.validate);
- }
- return new me.self(me.getCurrentConfig());
- }
- }, function(Validator) {
- Ext.Factory.validator = Ext.Factory.dataValidator;
- });
- Ext.define('Ext.data.field.Field', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alternateClassName: 'Ext.data.Field',
- alias: 'data.field.auto',
-
- aliasPrefix: 'data.field.',
- type: 'auto',
-
- factoryConfig: {
- defaultProperty: 'name'
- },
- isDataField: true,
- isField: true,
-
-
-
-
-
-
-
- allowBlank: true,
-
- allowNull: false,
-
-
-
- critical: false,
-
- defaultInvalidMessage: 'This field is invalid',
-
- defaultValue: undefined,
-
- definedBy: null,
-
- depends: null,
-
- dependents: null,
-
- mapping: null,
-
- name: null,
-
- ordinal: undefined,
-
- persist: null,
-
- reference: null,
-
-
- summary: null,
-
- summaryField: '',
-
-
- unique: false,
-
-
- rank: null,
-
- stripRe: /[\$,%]/g,
-
- calculated: false,
-
- evil: false,
-
- identifier: false,
- onClassExtended: function(cls, data) {
- var sortType = data.sortType,
- proto = cls.prototype,
- superValidators = proto.validators,
- validators = data.validators;
- if (sortType && Ext.isString(sortType)) {
- proto.sortType = Ext.data.SortTypes[sortType];
- }
- if (validators) {
-
- if (!Ext.isArray(validators)) {
- validators = [
- validators
- ];
- }
- delete data.validators;
-
- if (superValidators) {
- validators = superValidators.concat(validators);
- }
- proto.validators = validators;
- }
- },
- argumentNamesRe: /^function\s*\(\s*([^,\)\s]+)/,
- calculateRe: /[^\.a-z0-9_]([a-z_][a-z_0-9]*)\.([a-z_][a-z_0-9]*)/gi,
- constructor: function(config) {
- var me = this,
- calculateRe = me.calculateRe,
- calculate, calculated, defaultValue, sortType, depends, map, match, dataProp, str, fld, validators;
-
-
- if (config) {
- if (Ext.isString(config)) {
- me.name = config;
- } else {
- validators = config.validators;
- if (validators) {
- delete config.validators;
- me.instanceValidators = validators;
- }
- Ext.apply(me, config);
- }
- }
- if (!me.allowNull) {
- me.allowNull = !!me.reference;
- }
- calculate = me.calculate;
- depends = me.depends;
- if (calculate) {
- me.convert = me.doCalculate;
- if (!depends) {
- if (!(depends = calculate.$depends)) {
- map = {};
- str = Ext.Function.toCode(calculate);
-
- calculate.$depends = depends = [];
- match = me.argumentNamesRe.exec(str);
- dataProp = match ? match[1] : 'data';
- while ((match = calculateRe.exec(str))) {
- if (dataProp === match[1] && !map[fld = match[2]]) {
- map[fld] = 1;
- depends.push(fld);
- }
- }
- }
- me.depends = depends;
- }
- }
- defaultValue = me.defaultValue;
- if (me.convert) {
- me.calculated = calculated = me.convert.length > 1;
- me.evil = calculated && !depends;
- }
- if (me.persist === null) {
- me.persist = !calculate;
- }
- sortType = me.sortType;
- if (!me.sortType) {
- me.sortType = Ext.data.SortTypes.none;
- } else if (Ext.isString(sortType)) {
- me.sortType = Ext.data.SortTypes[sortType];
- }
- if (depends && typeof depends === 'string') {
- me.depends = [
- depends
- ];
- }
- me.cloneDefaultValue = defaultValue !== undefined && (Ext.isDate(defaultValue) || Ext.isArray(defaultValue) || Ext.isObject(defaultValue));
- },
- setModelValidators: function(modelValidators) {
- this._validators = null;
- this.modelValidators = modelValidators;
- },
- constructValidators: function(validators) {
- if (validators) {
- if (!(validators instanceof Array)) {
- validators = [
- validators
- ];
- }
- var length = validators.length,
- all = this._validators,
-
- i, item, validator, presence;
- for (i = 0; i < length; ++i) {
- item = validators[i];
- if (item.fn) {
- item = item.fn;
- }
- validator = Ext.Factory.dataValidator(item);
- if (!validator.isPresence) {
- all.push(validator);
- } else {
- presence = validator;
- }
- }
- if (presence) {
- this.presence = [
- presence
- ];
- }
- }
- },
-
- collate: function(value1, value2) {
- var me = this,
- lhs = value1,
- rhs = value2;
- if (me.sortType) {
- lhs = me.sortType(lhs);
- rhs = me.sortType(rhs);
- }
- return (lhs === rhs) ? 0 : ((lhs < rhs) ? -1 : 1);
- },
-
- compare: function(value1, value2) {
- return (value1 === value2) ? 0 : ((value1 < value2) ? -1 : 1);
- },
-
- isEqual: function(value1, value2) {
- return this.compare(value1, value2) === 0;
- },
-
- convert: null,
-
- serialize: null,
-
- validate: function(value, separator, errors, record) {
- var me = this,
- validators = me.getValidators(),
- result, presence;
- presence = this.presence;
- if (presence && (value == null || value === '')) {
- result = me.validateGroup(presence, value, separator, errors, record);
- if (result !== true) {
- return result;
- }
- }
- return me.validateGroup(validators, value, separator, errors, record);
- },
- validateGroup: function(validators, value, separator, errors, record) {
- var ret = '',
- validator, length, i, result;
- for (i = 0 , length = validators.length; i < length; ++i) {
- validator = validators[i];
- result = validator.validate(value, record);
- if (result !== true) {
- result = result || this.defaultInvalidMessage;
- if (errors) {
- if (errors.isMixedCollection) {
- errors.add(this.name, result);
- } else if (errors.isCollection) {
- errors.add(result);
- } else {
- errors.push(result);
- }
- ret = ret || result;
- } else if (separator) {
- if (ret) {
- ret += separator;
- }
- ret += result;
- } else {
- ret = result;
- break;
- }
- }
- }
- return ret || true;
- },
- doCalculate: function(v, rec) {
- return rec ? this.calculate(rec.data) : v;
- },
-
- getName: function() {
- return this.name;
- },
-
- getAllowBlank: function() {
- return this.allowBlank;
- },
-
- getAllowNull: function() {
- return this.allowNull;
- },
-
- getConvert: function() {
- return this.convert;
- },
-
- getDefaultValue: function() {
- return this.defaultValue;
- },
-
- getDepends: function() {
- return this.depends;
- },
-
- getMapping: function() {
- return this.mapping;
- },
-
- hasMapping: function() {
- var map = this.mapping;
- return !!(map || map === 0);
- },
-
- getPersist: function() {
- return this.persist;
- },
-
- getSortType: function() {
- return this.sortType;
- },
-
- getSummary: function() {
- var me = this,
- doneSummary = me.doneSummary,
- summary = me.summary;
- if (!doneSummary) {
- me.doneSummary = true;
- if (summary) {
- me.summary = summary = Ext.Factory.dataSummary(summary);
- }
- }
- return summary || null;
- },
-
- getType: function() {
- return 'auto';
- },
- privates: {
- getValidators: function() {
- var me = this,
- validators = me._validators;
- if (!validators) {
- me._validators = validators = [];
- me.constructValidators(me.validators);
- me.constructValidators(me.modelValidators);
- me.constructValidators(me.instanceValidators);
- }
- return validators;
- }
- },
- deprecated: {
- 5.1: {
- methods: {
-
- getSortDir: function() {
- return this.sortDir;
- }
- }
- }
- }
- });
- Ext.define('Ext.data.field.Boolean', {
- extend: Ext.data.field.Field,
- alias: [
- 'data.field.bool',
- 'data.field.boolean'
- ],
- isBooleanField: true,
-
- trueRe: /^\s*(?:true|yes|on|1)\s*$/i,
- convert: function(v) {
- if (typeof v === 'boolean') {
- return v;
- }
- if (this.allowNull && (v === undefined || v === null || v === '')) {
- return null;
- }
- return this.trueRe.test(String(v));
- },
- getType: function() {
- return 'bool';
- }
- });
- Ext.define('Ext.data.field.Date', {
- extend: Ext.data.field.Field,
- alias: 'data.field.date',
- sortType: 'asDate',
- isDateField: true,
-
- dateFormat: null,
-
- dateReadFormat: null,
-
- dateWriteFormat: null,
-
- compare: function(lhs, rhs) {
- var lhsIsDate = lhs instanceof Date,
- rhsIsDate = rhs instanceof Date,
- result;
- if (rhsIsDate && lhsIsDate) {
- result = lhs.getTime() - rhs.getTime();
- if (result === 0) {
- result = 0;
- } else {
- result = result < 0 ? -1 : 1;
- }
- } else if (lhsIsDate === rhsIsDate) {
- result = 0;
- } else {
- result = lhsIsDate ? 1 : -1;
- }
- return result;
- },
- convert: function(v) {
- if (!v) {
- return null;
- }
-
-
- if (v instanceof Date) {
- return v;
- }
- var dateFormat = this.dateReadFormat || this.dateFormat,
- parsed;
- if (dateFormat) {
- return Ext.Date.parse(v, dateFormat, this.useStrict);
- }
- parsed = Date.parse(v);
- return parsed ? new Date(parsed) : null;
- },
- serialize: function(value) {
- var result = null,
- format;
- if (Ext.isDate(value)) {
- format = this.getDateWriteFormat();
- result = format ? Ext.Date.format(value, format) : value;
- }
- return result;
- },
-
- getDateFormat: function() {
- return this.dateFormat;
- },
-
- getDateReadFormat: function() {
- return this.dateReadFormat;
- },
-
- getDateWriteFormat: function() {
- var me = this;
- if (me.hasOwnProperty('dateWriteFormat')) {
- return me.dateWriteFormat;
- }
- if (me.hasOwnProperty('dateFormat')) {
- return me.dateFormat;
- }
- return me.dateWriteFormat || me.dateFormat || 'timestamp';
- },
- getType: function() {
- return 'date';
- }
- });
- Ext.define('Ext.data.field.Integer', {
- extend: Ext.data.field.Field,
- alias: [
- 'data.field.int',
- 'data.field.integer'
- ],
- isNumeric: true,
- isIntegerField: true,
- numericType: 'int',
- convert: function(v) {
-
-
-
- if (typeof v === 'number') {
- return this.getNumber(v);
- }
- var empty = v == null || v === '',
- allowNull = this.allowNull,
- out;
- if (empty) {
- out = allowNull ? null : 0;
- } else {
- out = this.parse(v);
- if (allowNull && isNaN(out)) {
- out = null;
- }
- }
- return out;
- },
- getNumber: function(v) {
- return parseInt(v, 10);
- },
- getType: function() {
- return this.numericType;
- },
- parse: function(v) {
- return parseInt(String(v).replace(this.stripRe, ''), 10);
- },
- sortType: function(s) {
-
- if (s == null) {
- s = Infinity;
- }
- return s;
- }
- });
- Ext.define('Ext.data.field.Number', {
- extend: Ext.data.field.Integer,
- alias: [
- 'data.field.float',
- 'data.field.number'
- ],
- isIntegerField: false,
- isNumberField: true,
- numericType: 'float',
- getNumber: Ext.identityFn,
- parse: function(v) {
- return parseFloat(String(v).replace(this.stripRe, ''));
- }
- });
- Ext.define('Ext.data.field.String', {
- extend: Ext.data.field.Field,
- alias: 'data.field.string',
- sortType: 'asUCString',
- isStringField: true,
- convert: function(v) {
- var defaultValue = this.allowNull ? null : '';
- return (v === undefined || v === null) ? defaultValue : String(v);
- },
- getType: function() {
- return 'string';
- }
- });
- Ext.define('Ext.data.identifier.Generator', {
- 'abstract': true,
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'data.identifier.default',
-
- factoryConfig: {
- defaultType: 'sequential'
- },
-
-
- isGenerator: true,
- config: {
-
- id: null
- },
-
- constructor: function(config) {
- var me = this,
- id;
- me.initConfig(config);
- id = me.getId();
- if (id) {
- Ext.data.identifier.Generator.all[id] = me;
- }
- },
-
- privates: {
-
- clone: function(config) {
- var cfg = this.getInitialConfig();
- cfg = config ? Ext.apply({}, config, cfg) : cfg;
- return new this.self(cfg);
- },
- statics: {
-
- all: {}
- }
- }
- }, function() {
- var Generator = this,
- Factory = Ext.Factory,
- factory = Factory.dataIdentifier;
-
-
-
- Factory.dataIdentifier = function(config) {
- var id = Ext.isString(config) ? config : (config && config.id),
- existing = id && Generator.all[id];
- return existing || factory(config);
- };
- });
- Ext.define('Ext.data.identifier.Sequential', {
- extend: Ext.data.identifier.Generator,
- alias: 'data.identifier.sequential',
- config: {
-
- increment: 1,
-
- prefix: null,
-
- seed: 1
- },
-
- generate: function() {
- var me = this,
- seed = me._seed,
- prefix = me._prefix;
- me._seed += me._increment;
- return (prefix !== null) ? prefix + seed : seed;
- }
- });
- Ext.define('Ext.data.Model', {
- alternateClassName: 'Ext.data.Record',
-
- isEntity: true,
-
- isModel: true,
-
- validIdRe: null,
- erasing: false,
- loadOperation: null,
- loadCount: 0,
- observableType: 'record',
-
- crudState: 'R',
-
- crudStateWas: null,
- constructor: function(data, session) {
- var me = this,
- cls = me.self,
- identifier = cls.identifier,
- Model = Ext.data.Model,
- modelIdentifier = Model.identifier,
- idProperty = me.idField.name,
- array, id, initializeFn, internalId, len, i, fields;
-
-
-
-
-
-
-
- me.data = me.data = data || (data = {});
- me.internalId = internalId = modelIdentifier.generate();
-
- var dataId = data[idProperty];
- if (session && !session.isSession) {
- Ext.raise('Bad Model constructor argument 2 - "session" is not a Session');
- }
-
- if ((array = data) instanceof Array) {
- me.data = data = {};
- fields = me.getFields();
- len = Math.min(fields.length, array.length);
- for (i = 0; i < len; ++i) {
- data[fields[i].name] = array[i];
- }
- }
- if (!(initializeFn = cls.initializeFn)) {
- cls.initializeFn = initializeFn = Model.makeInitializeFn(cls);
- }
- if (!initializeFn.$nullFn) {
- cls.initializeFn(me);
- }
-
- if (!me.isSummaryModel) {
- if (!(me.id = id = data[idProperty]) && id !== 0) {
-
- if (dataId) {
- Ext.raise('The model ID configured in data ("' + dataId + '") has been rejected by the ' + me.fieldsMap[idProperty].type + ' field converter for the ' + idProperty + ' field');
- }
-
- if (session) {
- identifier = session.getIdentifier(cls);
- id = identifier.generate();
- } else if (modelIdentifier === identifier) {
- id = internalId;
- } else {
- id = identifier.generate();
- }
- data[idProperty] = me.id = id;
- me.phantom = true;
- me.crudState = 'C';
- }
- if (session) {
- session.add(me);
- }
-
- if (me.phantom) {
- me.crudStateWas = 'C';
- }
- }
- if (me.init && Ext.isFunction(me.init)) {
- me.init();
- }
- },
-
-
- editing: false,
-
- dirty: false,
-
- session: null,
-
- dropped: false,
-
- erased: false,
-
- clientIdProperty: null,
- evented: false,
-
- phantom: false,
-
- idProperty: 'id',
-
- manyToMany: null,
-
- identifier: null,
-
-
-
-
-
-
-
- previousValues: undefined,
-
-
-
- proxy: undefined,
-
-
- schema: 'default',
-
- summary: null,
-
- versionProperty: null,
-
- generation: 1,
-
-
- validationSeparator: null,
-
- convertOnSet: true,
-
-
-
-
-
-
- beginEdit: function() {
- var me = this,
- modified = me.modified,
- previousValues = me.previousValues;
- if (!me.editing) {
- me.editing = true;
- me.editMemento = {
- dirty: me.dirty,
- data: Ext.apply({}, me.data),
- generation: me.generation,
- modified: modified && Ext.apply({}, modified),
- previousValues: previousValues && Ext.apply({}, previousValues)
- };
- }
- },
-
- calculateSummary: function(records) {
- var fields = this.getFields(),
- len = fields.length,
- recLen = records.length,
- i, result, summary, prop, name, field;
- for (i = 0; i < len; ++i) {
- field = fields[i];
- summary = field.getSummary();
- if (summary) {
- result = result || {};
- name = field.name;
- prop = field.summaryField || name;
- result[name] = summary.calculate(records, prop, 'data', 0, recLen);
- }
- }
- if (result) {
- this.set(result, this._commitOptions);
- }
- },
-
- cancelEdit: function() {
- var me = this,
- editMemento = me.editMemento,
- validation = me.validation;
- if (editMemento) {
- me.editing = false;
-
- Ext.apply(me, editMemento);
- me.editMemento = null;
- if (validation && validation.syncGeneration !== me.generation) {
- validation.syncGeneration = 0;
- }
- }
- },
-
- endEdit: function(silent, modifiedFieldNames) {
- var me = this,
- editMemento = me.editMemento;
- if (editMemento) {
- me.editing = false;
- me.editMemento = null;
-
-
- me.previousValues = editMemento.previousValues;
- if (!silent) {
- if (!modifiedFieldNames) {
- modifiedFieldNames = me.getModifiedFieldNames(editMemento.data);
- }
- if (me.dirty || (modifiedFieldNames && modifiedFieldNames.length)) {
- me.callJoined('afterEdit', [
- modifiedFieldNames
- ]);
- }
- }
- }
- },
- getField: function(name) {
- return this.self.getField(name);
- },
-
- getFields: function() {
- return this.self.getFields();
- },
- getFieldsMap: function() {
- return this.fieldsMap;
- },
-
- getIdProperty: function() {
- return this.idProperty;
- },
-
- getId: function() {
- return this.id;
- },
-
- getObservableId: function() {
- return this.internalId;
- },
-
- setId: function(id, options) {
- this.set(this.idProperty, id, options);
- },
-
- getPrevious: function(fieldName) {
- var previousValues = this.previousValues;
- return previousValues && previousValues[fieldName];
- },
-
- isModified: function(fieldName) {
- var modified = this.modified;
- return !!(modified && modified.hasOwnProperty(fieldName));
- },
-
- getModified: function(fieldName) {
- var out;
- if (this.isModified(fieldName)) {
- out = this.modified[fieldName];
- }
- return out;
- },
-
- get: function(fieldName) {
- return this.data[fieldName];
- },
-
-
-
- _singleProp: {},
- _rejectOptions: {
- convert: false,
- silent: true
- },
-
- set: function(fieldName, newValue, options) {
- var me = this,
- cls = me.self,
- data = me.data,
- modified = me.modified,
- prevVals = me.previousValues,
- session = me.session,
- single = Ext.isString(fieldName),
- opt = (single ? options : newValue),
- convertOnSet = opt ? opt.convert !== false : me.convertOnSet,
- fieldsMap = me.fieldsMap,
- silent = opt && opt.silent,
- commit = opt && opt.commit,
- updateRefs = !(opt && opt.refs === false) && session,
-
-
- dirty = !(opt && opt.dirty === false && !commit),
- modifiedFieldNames = null,
- dirtyRank = 0,
- associations = me.associations,
- currentValue, field, idChanged, key, name, oldId, comparator, dep, dependents, i, numFields, newId, rankedFields, reference, value, values, roleName;
- if (single) {
- values = me._singleProp;
- values[fieldName] = newValue;
- } else {
- values = fieldName;
- }
- if (!(rankedFields = cls.rankedFields)) {
-
-
- rankedFields = cls.rankFields();
- }
- numFields = rankedFields.length;
- do {
- for (name in values) {
- value = values[name];
- currentValue = data[name];
- comparator = me;
- field = fieldsMap[name];
- if (field) {
- if (convertOnSet && field.convert) {
- value = field.convert(value, me);
- }
- comparator = field;
- reference = field.reference;
- } else {
- reference = null;
- }
- if (comparator.isEqual(currentValue, value)) {
-
- continue;
- }
- data[name] = value;
- (modifiedFieldNames || (modifiedFieldNames = [])).push(name);
- (prevVals || (me.previousValues = prevVals = {}))[name] = currentValue;
- if (reference && reference.cls) {
- if (updateRefs) {
- session.updateReference(me, field, value, currentValue);
- }
- reference.onValueChange(me, session, value, currentValue);
- }
- i = (dependents = field && field.dependents) && dependents.length;
- while (i-- > 0) {
- (dep = dependents[i]).dirty = true;
- dirtyRank = dirtyRank ? Math.min(dirtyRank, dep.rank) : dep.rank;
- }
- if (!field || field.persist) {
- if (modified && modified.hasOwnProperty(name)) {
- if (!dirty || comparator.isEqual(modified[name], value)) {
- delete modified[name];
- me.dirty = -1;
- }
- } else if (dirty) {
- if (!modified) {
- me.modified = modified = {};
- }
- me.dirty = true;
- modified[name] = currentValue;
- }
- }
- if (name === me.idField.name) {
- idChanged = true;
- oldId = currentValue;
- newId = value;
- }
- }
- if (!dirtyRank) {
- break;
- }
- field = rankedFields[dirtyRank - 1];
- field.dirty = false;
- if (single) {
- delete values[fieldName];
- } else {
- values = me._singleProp;
- single = true;
- }
- fieldName = field.name;
- values[fieldName] = data[fieldName];
- convertOnSet = true;
- for (; dirtyRank < numFields; ++dirtyRank) {
- if (rankedFields[dirtyRank].dirty) {
- break;
- }
- }
- if (dirtyRank < numFields) {
- ++dirtyRank;
- } else {
- dirtyRank = 0;
- }
- } while (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1);
- if (me.dirty < 0) {
-
-
- me.dirty = false;
- for (key in modified) {
- if (modified.hasOwnProperty(key)) {
- me.dirty = true;
- break;
- }
- }
- }
- if (single) {
-
-
- delete values[fieldName];
- }
- ++me.generation;
- if (idChanged) {
- me.id = newId;
- me.onIdChanged(newId, oldId);
- me.callJoined('onIdChanged', [
- oldId,
- newId
- ]);
- if (associations) {
- for (roleName in associations) {
- associations[roleName].onIdChanged(me, oldId, newId);
- }
- }
- }
- if (commit) {
- me.commit(silent, modifiedFieldNames);
- } else if (!silent && !me.editing && modifiedFieldNames) {
- me.callJoined('afterEdit', [
- modifiedFieldNames
- ]);
- }
- return modifiedFieldNames;
- },
-
- reject: function(silent) {
- var me = this,
- modified = me.modified;
-
- if (me.erased) {
- Ext.raise('Cannot reject once a record has been erased.');
- }
-
- if (modified) {
- me.set(modified, me._rejectOptions);
- }
- me.dropped = false;
- me.clearState();
- if (!silent) {
- me.callJoined('afterReject');
- }
- },
-
- commit: function(silent, modifiedFieldNames) {
- var me = this,
- versionProperty = me.versionProperty,
- data = me.data,
- erased;
- me.clearState();
- if (versionProperty && !me.phantom && !isNaN(data[versionProperty])) {
- ++data[versionProperty];
- }
- me.phantom = false;
- if (me.dropped) {
- me.erased = erased = true;
- }
- if (!silent) {
- if (erased) {
- me.callJoined('afterErase');
- } else {
- me.callJoined('afterCommit', [
- modifiedFieldNames
- ]);
- }
- }
- },
- clearState: function() {
- var me = this;
- me.dirty = me.editing = false;
- me.editMemento = me.modified = null;
- },
-
- drop: function(cascade) {
- var me = this,
- associations = me.associations,
- session = me.session,
- roleName;
- if (me.erased || me.dropped) {
- return;
- }
- me.dropped = true;
- if (associations && cascade !== false) {
- for (roleName in associations) {
- associations[roleName].onDrop(me, session);
- }
- }
- me.callJoined('afterDrop');
- if (me.phantom) {
- me.setErased();
- }
- },
-
- join: function(owner) {
- var me = this,
- joined = me.joined;
-
- if (!joined) {
- joined = me.joined = [
- owner
- ];
- } else if (!joined.length) {
- joined[0] = owner;
- } else {
-
- Ext.Array.include(joined, owner);
- }
- if (owner.isStore && !me.store) {
-
- me.store = owner;
- }
- },
-
- unjoin: function(owner) {
- var me = this,
- joined = me.joined,
-
-
- len = joined && joined.length,
- store = me.store,
- i;
- if (owner === me.session) {
- me.session = null;
- } else {
- if (len === 1 && joined[0] === owner) {
- joined.length = 0;
- } else if (len) {
- Ext.Array.remove(joined, owner);
- }
- if (store === owner) {
- store = null;
- if (joined) {
- for (i = 0 , len = joined.length; i < len; ++i) {
- owner = joined[i];
- if (owner.isStore) {
- store = owner;
- break;
- }
- }
- }
- me.store = store;
- }
- }
- },
-
- clone: function(session) {
- var me = this,
- modified = me.modified,
- ret = me.copy(me.id, session);
- if (modified) {
-
- ret.modified = Ext.apply({}, modified);
- }
- ret.dirty = me.dirty;
- ret.dropped = me.dropped;
- ret.phantom = me.phantom;
- return ret;
- },
-
- copy: function(newId, session) {
- var me = this,
- data = Ext.apply({}, me.data),
- idProperty = me.idProperty,
- T = me.self;
- if (newId || newId === 0) {
- data[idProperty] = newId;
- } else if (newId === null) {
- delete data[idProperty];
- }
- return new T(data, session);
- },
-
- getProxy: function() {
- return this.self.getProxy();
- },
-
- getValidation: function(refresh) {
- var me = this,
- ret = me.validation;
- if (!ret) {
- me.validation = ret = new Ext.data.Validation();
- ret.attach(me);
- }
- if (refresh === true || (refresh !== false && ret.syncGeneration !== me.generation)) {
- ret.refresh(refresh);
- }
- return ret;
- },
-
- validate: function() {
- return new Ext.data.ErrorCollection().init(this);
- },
-
- isValid: function() {
- return this.getValidation().isValid();
- },
-
- toUrl: function() {
- var pieces = this.$className.split('.'),
- name = pieces[pieces.length - 1].toLowerCase();
- return name + '/' + this.getId();
- },
-
- erase: function(options) {
- var me = this;
- me.erasing = true;
-
-
-
-
- me.drop();
- me.erasing = false;
- return me.save(options);
- },
- setErased: function() {
- this.erased = true;
- this.callJoined('afterErase');
- },
-
- getChanges: function() {
- return this.getData(this._getChangesOptions);
- },
-
- getCriticalFields: function() {
- var cls = this.self,
- ret = cls.criticalFields;
- if (!ret) {
- cls.rankFields();
- ret = cls.criticalFields;
- }
- return ret;
- },
-
-
- getAssociatedData: function(result, options) {
- var me = this,
- associations = me.associations,
- deep, i, item, items, itemData, length, record, role, roleName, opts, clear, associated;
- result = result || {};
- me.$gathering = 1;
- if (options) {
- options = Ext.apply({}, options);
- }
- for (roleName in associations) {
- role = associations[roleName];
- item = role.getAssociatedItem(me);
- if (!item || item.$gathering) {
-
- continue;
- }
- if (item.isStore) {
- item.$gathering = 1;
- items = item.getData().items;
-
- length = items.length;
- itemData = [];
- for (i = 0; i < length; ++i) {
-
-
-
-
- record = items[i];
- deep = !record.$gathering;
- record.$gathering = 1;
- if (options) {
- associated = options.associated;
- if (associated === undefined) {
- options.associated = deep;
- clear = true;
- } else if (!deep) {
- options.associated = false;
- clear = true;
- }
- opts = options;
- } else {
- opts = deep ? me._getAssociatedOptions : me._getNotAssociatedOptions;
- }
- itemData.push(record.getData(opts));
- if (clear) {
- options.associated = associated;
- clear = false;
- }
- delete record.$gathering;
- }
- delete item.$gathering;
- } else {
- opts = options || me._getAssociatedOptions;
- if (options && options.associated === undefined) {
- opts.associated = true;
- }
- itemData = item.getData(opts);
- }
- result[roleName] = itemData;
- }
- delete me.$gathering;
- return result;
- },
-
- getData: function(options) {
- var me = this,
- ret = {},
- opts = (options === true) ? me._getAssociatedOptions : (options || ret),
-
- data = me.data,
- associated = opts.associated,
- changes = opts.changes,
- critical = changes && opts.critical,
- content = changes ? me.modified : data,
- fieldsMap = me.fieldsMap,
- persist = opts.persist,
- serialize = opts.serialize,
- criticalFields, field, n, name, value;
-
-
-
-
- if (content) {
-
- for (name in content) {
- value = data[name];
- field = fieldsMap[name];
- if (field) {
- if (persist && !field.persist) {
-
- continue;
- }
- if (serialize && field.serialize) {
- value = field.serialize(value, me);
- }
- }
- ret[name] = value;
- }
- }
- if (critical) {
- criticalFields = me.self.criticalFields || me.getCriticalFields();
- for (n = criticalFields.length; n-- > 0; ) {
- name = (field = criticalFields[n]).name;
- if (!(name in ret)) {
- value = data[name];
- if (serialize && field.serialize) {
- value = field.serialize(value, me);
- }
- ret[name] = value;
- }
- }
- }
- if (associated) {
- if (typeof associated === 'object') {
- me.getNestedData(opts, ret);
- } else {
- me.getAssociatedData(ret, opts);
- }
- }
- return ret;
- },
- getNestedData: function(options, result) {
- var me = this,
- associations = me.associations,
- graph = options.associated,
- i, item, items, itemData, length, record, role, roleName, opts;
- result = result || {};
-
-
-
-
-
-
-
-
-
-
-
-
- for (roleName in graph) {
- role = associations[roleName];
- opts = graph[roleName];
- if (opts === true) {
- delete options.associated;
- } else {
- options.associated = opts;
- }
- item = role.getAssociatedItem(me);
- if (item.isStore) {
- items = item.getData().items;
-
- length = items.length;
- itemData = [];
- for (i = 0; i < length; ++i) {
- record = items[i];
- itemData.push(record.getData(options));
- }
- } else {
- itemData = item.getData(options);
- }
- result[roleName] = itemData;
- }
- options.associated = graph;
-
- return result;
- },
-
- getTransientFields: function() {
- var cls = this.self,
- ret = cls.transientFields;
- if (!ret) {
- cls.rankFields();
-
- ret = cls.transientFields;
- }
- return ret;
- },
-
- isLoading: function() {
- return !!this.loadOperation;
- },
-
- abort: function() {
- var operation = this.loadOperation;
- if (operation) {
- operation.abort();
- }
- },
-
- load: function(options) {
- options = Ext.apply({}, options);
- var me = this,
- scope = options.scope || me,
- proxy = me.getProxy(),
- callback = options.callback,
- operation = me.loadOperation,
- id = me.getId(),
- extras;
- if (operation) {
-
- extras = operation.extraCalls;
- if (!extras) {
- extras = operation.extraCalls = [];
- }
- extras.push(options);
- return operation;
- }
-
- var doIdCheck = true;
- if (me.phantom) {
- doIdCheck = false;
- }
-
- options.id = id;
-
-
- options.recordCreator = function(data, type, readOptions) {
-
-
-
- var session = me.session;
- if (readOptions) {
- readOptions.recordCreator = session ? session.recordCreator : null;
- }
- me.set(data, me._commitOptions);
-
-
- if (doIdCheck && me.getId() !== id) {
- Ext.raise('Invalid record id returned for ' + id + '@' + me.entityName);
- }
-
- return me;
- };
- options.internalCallback = function(operation) {
- var success = operation.wasSuccessful() && operation.getRecords().length > 0,
- op = me.loadOperation,
- extras = op.extraCalls,
- successFailArgs = [
- me,
- operation
- ],
- callbackArgs = [
- me,
- operation,
- success
- ],
- i, len;
- me.loadOperation = null;
- ++me.loadCount;
- if (success) {
- Ext.callback(options.success, scope, successFailArgs);
- } else {
- Ext.callback(options.failure, scope, successFailArgs);
- }
- Ext.callback(callback, scope, callbackArgs);
-
-
-
- if (extras) {
- for (i = 0 , len = extras.length; i < len; ++i) {
- options = extras[i];
- if (success) {
- Ext.callback(options.success, scope, successFailArgs);
- } else {
- Ext.callback(options.failure, scope, successFailArgs);
- }
- Ext.callback(options.callback, scope, callbackArgs);
- }
- }
- me.callJoined('afterLoad');
- };
- delete options.callback;
- me.loadOperation = operation = proxy.createOperation('read', options);
- operation.execute();
- return operation;
- },
-
- mergeData: function(data) {
- if (!this.dirty) {
- this.set(data, this._commitOptions);
- }
- },
-
- save: function(options) {
- options = Ext.apply({}, options);
- var me = this,
- phantom = me.phantom,
- dropped = me.dropped,
- action = dropped ? 'destroy' : (phantom ? 'create' : 'update'),
- scope = options.scope || me,
- callback = options.callback,
- proxy = me.getProxy(),
- operation;
- options.records = [
- me
- ];
- options.internalCallback = function(operation) {
- var args = [
- me,
- operation
- ],
- success = operation.wasSuccessful();
- if (success) {
- Ext.callback(options.success, scope, args);
- } else {
- Ext.callback(options.failure, scope, args);
- }
- args.push(success);
- Ext.callback(callback, scope, args);
- };
- delete options.callback;
- operation = proxy.createOperation(action, options);
-
-
- if (dropped && phantom) {
-
- operation.setResultSet(Ext.data.reader.Reader.prototype.nullResultSet);
- me.setErased();
- operation.setSuccessful(true);
- } else {
- operation.execute();
- }
- return operation;
- },
-
-
- statics: {
-
- defaultProxy: 'memory'
- },
- inheritableStatics: {
-
- _associatedReadOptions: {
- recordsOnly: true,
- asRoot: true
- },
-
- loadData: function(data, session) {
- var rec;
- if (data) {
- rec = this.getProxy().getReader().readRecords([
- data
- ], session ? {
- recordCreator: session.recordCreator
- } : undefined, this._associatedReadOptions)[0];
- } else {
- rec = new this(data, session);
- }
- return rec;
- },
-
- getSummaryModel: function() {
- var me = this,
- proto = me.prototype,
- summaryModel = me.summaryModel;
- if (!summaryModel) {
- summaryModel = Ext.define(null, {
- extend: me,
- fields: proto.summaryFields || [],
- isSummaryModel: true
- });
- summaryModel.isSummaryModel = true;
- me.summaryModel = proto.summaryModel = summaryModel;
- }
- return summaryModel || null;
- },
-
- addFields: function(newFields) {
- this.replaceFields(newFields);
- },
-
- replaceFields: function(newFields, removeFields) {
- var me = this,
- proto = me.prototype,
- Field = Ext.data.field.Field,
- fields = me.fields,
- fieldsMap = me.fieldsMap,
- ordinals = me.fieldOrdinals,
- field, i, idField, len, name, ordinal, cleared;
- if (removeFields === true) {
- fields.length = 0;
- me.fieldsMap = fieldsMap = {};
- me.fieldOrdinals = ordinals = {};
- cleared = true;
- } else if (removeFields) {
- for (i = removeFields.length; i-- > 0; ) {
- name = removeFields[i];
- if (name in ordinals) {
- delete ordinals[name];
- delete fieldsMap[name];
- }
- }
- for (i = 0 , len = fields.length; i < len; ++i) {
- name = (field = fields[i]).name;
- if (name in ordinals) {
- ordinals[name] = i;
- } else {
-
- fields.splice(i, 1);
- --i;
- --len;
- }
- }
- }
-
-
- for (i = 0 , len = newFields ? newFields.length : 0; i < len; i++) {
- name = (field = newFields[i]).name;
- if (!(name in ordinals)) {
- ordinals[name] = ordinal = fields.length;
-
- fields.push(field = Field.create(field));
- fieldsMap[name] = field;
- field.ordinal = ordinal;
- field.definedBy = field.owner = this;
- }
- }
-
-
-
- if (!cleared) {
- for (i = 0 , len = fields.length; i < len; ++i) {
- fields[i].rank = null;
- }
- }
-
- me.idField = proto.idField = idField = fieldsMap[proto.idProperty];
- if (idField) {
- idField.allowNull = idField.critical = idField.identifier = true;
- idField.defaultValue = null;
- }
-
-
- me.initializeFn = me.rankedFields = me.transientFields = me.criticalFields = null;
- },
-
- removeFields: function(removeFields) {
- this.replaceFields(null, removeFields);
- },
-
- getIdFromData: function(data) {
- var T = this,
- idField = T.idField,
- id = idField.calculated ? (new T(data)).id : data[idField.name];
- return id;
- },
-
- createWithId: function(id, data, session) {
- var d = data,
- T = this;
- if (id || id === 0) {
- d = {};
- if (data) {
- Ext.apply(d, data);
- }
- d[T.idField.name] = id;
- }
- return new T(d, session);
- },
-
- getFields: function() {
- return this.fields;
- },
-
- getFieldsMap: function() {
- return this.fieldsMap;
- },
-
- getField: function(name) {
- return this.fieldsMap[name] || null;
- },
-
- getProxy: function() {
- var me = this,
- proxy = me.proxy,
- defaultProxy = me.defaultProxy,
- defaults;
- if (!proxy) {
-
- proxy = me.proxyConfig;
- if (!proxy && defaultProxy) {
- proxy = defaultProxy;
- }
- if (!proxy || !proxy.isProxy) {
- if (typeof proxy === 'string') {
- proxy = {
- type: proxy
- };
- }
-
-
- defaults = Ext.merge(me.schema.constructProxy(me), proxy);
- if (proxy && proxy.type) {
- proxy = proxy.schema === false ? proxy : defaults;
- } else {
- proxy = defaults;
- }
- }
- proxy = me.setProxy(proxy);
- }
- return proxy;
- },
-
- setProxy: function(proxy) {
- var me = this,
- model;
- if (proxy) {
- if (!proxy.isProxy) {
- proxy = Ext.Factory.proxy(proxy);
- } else {
- model = proxy.getModel();
- if (model && model !== me) {
- proxy = proxy.clone();
- }
- }
- proxy.setModel(me);
- }
- return (me.prototype.proxy = me.proxy = proxy);
- },
-
- load: function(id, options, session) {
- var data = {},
- rec;
- if (session) {
- rec = session.peekRecord(this, id);
- }
- if (!rec) {
- data[this.prototype.idProperty] = id;
- rec = new this(data, session);
- }
- rec.load(options);
- return rec;
- }
- },
- deprecated: {
- 5: {
- methods: {
- hasId: null,
- markDirty: null,
- setDirty: null,
- eachStore: function(callback, scope) {
- var me = this,
- stores = me.stores,
- len = stores.length,
- i;
- for (i = 0; i < len; ++i) {
- callback.call(scope, stores[i]);
- }
- },
- join: function(item) {
- var me = this,
- stores = me.stores,
- joined = me.joined;
- if (!joined) {
- joined = me.joined = [
- item
- ];
- } else {
- joined.push(item);
- }
- if (item.isStore) {
- me.store = me.store || item;
- if (!stores) {
- stores = me.stores = [];
- }
- stores.push(item);
- }
- },
- unjoin: function(item) {
- var me = this,
- stores = me.stores,
- joined = me.joined;
- if (joined.length === 1) {
- joined.length = 0;
- } else {
- Ext.Array.remove(joined, item);
- }
- if (item.isStore) {
- Ext.Array.remove(stores, item);
- me.store = stores[0] || null;
- }
- }
- },
- properties: {
- persistenceProperty: null
- },
- inheritableStatics: {
- methods: {
- setFields: null
- }
- }
- }
- },
-
- privates: {
- _commitOptions: {
- commit: true
- },
- _getChangesOptions: {
- changes: true
- },
- _getAssociatedOptions: {
- associated: true
- },
- _getNotAssociatedOptions: {
- associated: false
- },
- _metaProperties: {
- dirty: 'isDirty',
- phantom: 'isPhantom',
- valid: 'isValid'
- },
-
- copyFrom: function(sourceRecord) {
- var me = this,
- fields = me.fields,
- fieldCount = fields.length,
- modifiedFieldNames = [],
- field,
- i = 0,
- myData, sourceData,
- idProperty = me.idProperty,
- name, value;
- if (sourceRecord) {
- myData = me.data;
- sourceData = sourceRecord.data;
- for (; i < fieldCount; i++) {
- field = fields[i];
- name = field.name;
-
-
-
-
-
-
- if (name !== idProperty) {
- value = sourceData[name];
-
-
- if (value !== undefined && !me.isEqual(myData[name], value)) {
- myData[name] = value;
- modifiedFieldNames.push(name);
- }
- }
- }
-
- if (me.phantom && !sourceRecord.phantom) {
-
-
- me.beginEdit();
- me.setId(sourceRecord.getId());
- me.endEdit(true);
- me.commit(true);
- }
- }
- return modifiedFieldNames;
- },
-
- callJoined: function(funcName, args) {
- var me = this,
- joined = me.joined,
- session = me.session,
- state = me.dropped ? 'D' : (me.phantom ? 'C' : (me.dirty ? 'U' : 'R')),
- i, len, fn, item;
- me.crudState = state;
- if (joined || session) {
- if (args) {
- args.unshift(me);
- } else {
- args = [
- me
- ];
- }
- fn = session && session[funcName];
- if (fn) {
- fn.apply(session, args);
- }
- if (joined) {
- for (i = 0 , len = joined.length; i < len; ++i) {
- item = joined[i];
- if (item && (fn = item[funcName])) {
- fn.apply(item, args);
- }
- }
- }
- }
- me.crudStateWas = state;
- },
-
- hasPendingLoad: function() {
- return this.isLoading();
- },
- interpret: function(name) {
- var me = this,
- accessor = me._metaProperties[name];
- if (!accessor) {
- accessor = me.associations;
-
- accessor = accessor && accessor[name] && accessor[name].getterName;
- }
- if (accessor) {
- return me[accessor]();
- }
-
- return me.data[name];
- },
-
- isDirty: function() {
-
- return this.dirty;
- },
-
- isPhantom: function() {
-
- return this.phantom;
- },
-
- onAssociatedRecordSet: function(record, role) {
- this.callJoined('afterAssociatedRecordSet', [
- record,
- role
- ]);
- },
-
- onIdChanged: Ext.privateFn,
-
- setSession: function(session) {
-
- if (session) {
- if (this.session) {
- Ext.raise('This model already belongs to a session.');
- }
- if (!this.id) {
- Ext.raise('The model must have an id to participate in a session.');
- }
- }
-
- this.session = session;
- if (session) {
- session.add(this);
- }
- },
-
- getModifiedFieldNames: function(old) {
- var me = this,
- data = me.data,
- modified = [],
- oldData = old || me.editMemento.data,
- key;
- for (key in data) {
- if (data.hasOwnProperty(key)) {
- if (!me.isEqual(data[key], oldData[key], key)) {
- modified.push(key);
- }
- }
- }
- return modified;
- },
-
- isEqual: function(lhs, rhs, field) {
- var f;
- if (field) {
- f = field.isField ? field : this.fieldsMap[field];
- if (f) {
- return f.isEqual(lhs, rhs);
- }
- }
-
-
- if (lhs instanceof Date && rhs instanceof Date) {
- return lhs.getTime() === rhs.getTime();
- }
- return lhs === rhs;
- },
- statics: {
-
- EDIT: 'edit',
-
- REJECT: 'reject',
-
- COMMIT: 'commit',
- rankFields: function() {
- var cls = this,
- prototype = cls.prototype,
- fields = cls.fields,
- length = fields.length,
- rankedFields = [],
- criticalFields = [],
- transientFields = [],
- evilFields, field, i;
- cls.rankedFields = prototype.rankedFields = rankedFields;
- cls.criticalFields = prototype.criticalFields = criticalFields;
- cls.transientFields = prototype.transientFields = transientFields;
-
-
-
-
-
- for (i = 0; i < length; ++i) {
- field = fields[i];
- if (field.critical) {
- criticalFields.push(field);
- }
- if (!field.persist) {
- transientFields.push(field);
- }
- if (field.evil) {
- (evilFields || (evilFields = [])).push(field);
- } else if (!field.depends) {
- rankedFields.push(field);
- field.rank = rankedFields.length;
- }
- }
-
- for (i = 0; i < length; ++i) {
- if (!(field = fields[i]).rank && !field.evil) {
- cls.topoAdd(field);
- }
- }
- if (evilFields) {
- for (i = 0 , length = evilFields.length; i < length; ++i) {
- rankedFields.push(field = evilFields[i]);
- field.rank = rankedFields.length;
- }
- }
-
-
- cls.topoStack = null;
-
-
- return rankedFields;
- },
- topoAdd: function(field) {
- var cls = this,
- dep = field.depends,
- dependsLength = dep ? dep.length : 0,
- rankedFields = cls.rankedFields,
- i, targetField;
-
- var topoStack = cls.topoStack || (cls.topoStack = []);
- topoStack.push(field.name);
- if (field.rank === 0) {
-
- Ext.raise(cls.$className + " has circular field dependencies: " + topoStack.join(" --> "));
- }
- if (topoStack.length && field.evil) {
- Ext.raise(cls.$className + ": Field " + topoStack[topoStack.length - 1] + " cannot depend on depends-less field " + field.name);
- }
- field.rank = 0;
-
-
- for (i = 0; i < dependsLength; ++i) {
-
-
- targetField = cls.fieldsMap[dep[i]];
-
- if (!targetField) {
- Ext.raise(cls.$className + ": Field " + field.name + " depends on undefined field " + dep[i]);
- }
-
- (targetField.dependents || (targetField.dependents = [])).push(field);
- if (!targetField.rank) {
-
- cls.topoAdd(targetField);
- }
- }
- rankedFields.push(field);
- field.rank = rankedFields.length;
-
-
- topoStack.pop();
- },
-
- initFields: function(data, cls, proto) {
- var Field = Ext.data.field.Field,
- fieldDefs = data.fields,
-
- fields = [],
- fieldOrdinals = {},
- fieldsMap = {},
- references = [],
- superFields = proto.fields,
- versionProperty = data.versionProperty || proto.versionProperty,
- idProperty = cls.idProperty,
- idField, field, i, length, name, ordinal, reference, superIdField, superIdFieldName, superIdDeclared, idDeclared;
-
-
- cls.fields = proto.fields = fields;
- cls.fieldOrdinals = proto.fieldOrdinals = fieldOrdinals;
- cls.fieldsMap = proto.fieldsMap = fieldsMap;
- cls.references = proto.references = references;
- if (superFields) {
-
- for (i = 0 , length = superFields.length; i < length; ++i) {
- fields[i] = field = Ext.Object.chain(superFields[i]);
- field.dependents = null;
-
- field.owner = cls;
- fieldOrdinals[name = field.name] = i;
- fieldsMap[name] = field;
-
-
- field.rank = null;
- if (field.generated) {
- superIdField = field;
- superIdFieldName = field.name;
- }
- }
- }
-
- delete data.fields;
- if (fieldDefs) {
- for (i = 0 , length = fieldDefs.length; i < length; ++i) {
- field = fieldDefs[i];
- reference = field.reference;
-
-
- if (reference && typeof reference !== 'string') {
-
- reference = Ext.merge({}, reference);
- }
- field.$reference = reference;
- field = Field.create(fieldDefs[i]);
- name = field.name;
- ordinal = fieldOrdinals[name];
- if (ordinal === undefined) {
-
- fieldOrdinals[name] = ordinal = fields.length;
- }
-
- fieldsMap[name] = field;
- fields[ordinal] = field;
- field.definedBy = field.owner = cls;
- field.ordinal = ordinal;
- if (name === idProperty) {
- idDeclared = field;
- }
- if (name === superIdFieldName) {
- superIdDeclared = true;
- }
- }
- }
-
-
- idField = fieldsMap[idProperty];
- if (!idField) {
- if (superIdField && superIdField.generated) {
- ordinal = superIdField.ordinal;
- } else {
- ordinal = fields.length;
- }
- delete fieldsMap[superIdFieldName];
- delete fieldOrdinals[superIdFieldName];
- idField = new Field(idProperty);
- fields[ordinal] = idField;
- fieldOrdinals[idProperty] = ordinal;
- fieldsMap[idProperty] = idField;
- idField.definedBy = cls;
- idField.ordinal = ordinal;
- idField.generated = true;
- } else if (idDeclared && !superIdDeclared && superIdField && superIdField.generated) {
-
-
-
-
- Ext.Array.remove(fields, superIdField);
- delete fieldsMap[superIdFieldName];
- delete fieldOrdinals[superIdFieldName];
- fieldsMap[idProperty] = idDeclared;
- for (i = 0 , length = fields.length; i < length; ++i) {
- field = fields[i];
- fields.ordinal = i;
- fieldOrdinals[field.name] = i;
- }
- }
- idField.allowNull = idField.critical = idField.identifier = true;
- idField.defaultValue = null;
- cls.idField = proto.idField = idField;
- if (versionProperty) {
- field = fieldsMap[versionProperty];
- if (!field) {
- ordinal = fields.length;
- field = new Field({
- name: versionProperty,
- type: 'int'
- });
- fields[ordinal] = field;
- fieldOrdinals[versionProperty] = ordinal;
- fieldsMap[versionProperty] = field;
- field.definedBy = cls;
- field.ordinal = ordinal;
- field.generated = true;
- }
- field.defaultValue = 1;
- field.critical = true;
- }
- },
-
-
- initSummaries: function(data, cls, proto) {
- var summaryDefs = data.summary,
- superSummaries = proto.summaryFields,
- summaries, summaryMap, name, summary, len, i, index, field;
- if (superSummaries) {
- summaries = [];
- summaryMap = {};
- for (i = 0 , len = superSummaries.length; i < len; ++i) {
- summary = superSummaries[i];
- summaries.push(summary);
- summaries[summary.name] = i;
- }
- }
- if (summaryDefs) {
- delete data.summary;
- summaries = summaries || [];
- summaryMap = summaryMap || {};
- for (name in summaryDefs) {
- summary = summaryDefs[name];
- if (typeof summary === 'function') {
- summary = {
- summary: summary
- };
- }
-
-
- index = summaryMap[name];
- summary = Ext.apply({
- name: name
- }, summary);
- field = summary.field;
- if (field) {
- delete summary.field;
- summary.summaryField = field;
- }
- if (index === undefined) {
- index = summaries.length;
- summaryMap[name] = summary;
- }
- summaries[index] = summary;
- }
- }
- if (summaries) {
-
- for (i = 0 , len = summaries.length; i < len; ++i) {
- if (summaries[i].name in proto.fieldsMap) {
- Ext.raise('Cannot redefine field, use the summary property on the field.');
- }
- }
-
-
- proto.summaryFields = summaries;
- }
- },
- initValidators: function(data, cls, proto) {
- var superValidators = proto.validators,
- validators, field, copy, validatorDefs, i, length, fieldValidator, name, validator, item;
- if (superValidators) {
- validators = {};
- for (field in superValidators) {
- validators[field] = Ext.Array.clone(superValidators[field]);
- }
- }
- validatorDefs = data.validators || data.validations;
-
- if (data.validations) {
- delete data.validations;
- Ext.log.warn((cls.$className || 'Ext.data.Model') + ': validations has been deprecated. Please use validators instead.');
- }
-
- if (validatorDefs) {
- delete data.validators;
- validators = validators || {};
-
- if (Ext.isArray(validatorDefs)) {
- copy = {};
- for (i = 0 , length = validatorDefs.length; i < length; ++i) {
- item = validatorDefs[i];
- name = item.field;
- if (!copy[name]) {
- copy[name] = [];
- }
-
- item = item.fn || item;
- copy[name].push(item);
- }
- validatorDefs = copy;
- }
- for (name in validatorDefs) {
- fieldValidator = validatorDefs[name];
- if (!Ext.isArray(fieldValidator)) {
- fieldValidator = [
- fieldValidator
- ];
- }
- validator = validators[name];
- if (validator) {
-
- Ext.Array.push(validator, fieldValidator);
- } else {
- validators[name] = fieldValidator;
- }
- }
- }
- if (validators) {
- for (name in validators) {
- field = cls.getField(name);
- if (field) {
- field.setModelValidators(validators[name]);
- }
- }
- }
- cls.validators = proto.validators = validators;
- },
- initAssociations: function(schema, data, cls) {
-
- var associations = data.associations,
- belongsTo = data.belongsTo,
- hasMany = data.hasMany,
- hasOne = data.hasOne,
-
- matrices = data.manyToMany,
- i, length, assoc, o;
- delete data.associations;
- delete data.belongsTo;
- delete data.hasMany;
- delete data.hasOne;
- delete data.manyToMany;
- if (matrices) {
- schema.addMatrices(cls, matrices);
- }
- if (associations) {
- associations = Ext.isArray(associations) ? associations : [
- associations
- ];
- for (i = 0 , length = associations.length; i < length; ++i) {
- assoc = associations[i];
- o = Ext.apply({}, assoc);
- delete o.type;
- switch (assoc.type) {
- case 'belongsTo':
- schema.addBelongsTo(cls, o);
- break;
- case 'hasMany':
- schema.addHasMany(cls, o);
- break;
- case 'hasOne':
- schema.addHasOne(cls, o);
- break;
-
- default:
- Ext.raise('Invalid association type: "' + assoc.type + '"');
- }
- }
- }
-
- if (belongsTo) {
- belongsTo = Ext.isArray(belongsTo) ? belongsTo : [
- belongsTo
- ];
- for (i = 0 , length = belongsTo.length; i < length; ++i) {
- schema.addBelongsTo(cls, belongsTo[i]);
- }
- }
- if (hasMany) {
- hasMany = Ext.isArray(hasMany) ? hasMany : [
- hasMany
- ];
- for (i = 0 , length = hasMany.length; i < length; ++i) {
- schema.addHasMany(cls, hasMany[i]);
- }
- }
- if (hasOne) {
- hasOne = Ext.isArray(hasOne) ? hasOne : [
- hasOne
- ];
- for (i = 0 , length = hasOne.length; i < length; ++i) {
- schema.addHasOne(cls, hasOne[i]);
- }
- }
- schema.afterKeylessAssociations(cls);
- },
- initIdentifier: function(data, cls, proto) {
- var identifier = data.identifier || data.idgen,
- superIdent = proto.identifier || cls.schema._defaultIdentifier,
- generatorPrefix;
-
- if (data.idgen) {
- Ext.log.warn('Ext.data.Model: idgen has been deprecated. Please use identifier instead.');
- }
-
- if (identifier) {
- delete data.identifier;
- delete data.idgen;
-
- identifier = Ext.Factory.dataIdentifier(identifier);
- } else if (superIdent) {
-
-
-
- if (superIdent.clone && !superIdent.getId()) {
- identifier = superIdent.clone();
- } else if (superIdent.isGenerator) {
- identifier = superIdent;
- } else {
- identifier = Ext.Factory.dataIdentifier(superIdent);
- }
- }
- cls.identifier = proto.identifier = identifier;
- if (!identifier) {
-
-
-
-
- generatorPrefix = cls.entityName;
- if (!generatorPrefix) {
- generatorPrefix = Ext.id(null, 'extModel');
- }
- cls.identifier = Ext.Factory.dataIdentifier({
- type: 'sequential',
- prefix: generatorPrefix + '-'
- });
- }
- },
- findValidator: function(validators, name, cfg) {
- var type = cfg.type || cfg,
- field = validators[name],
- len, i, item;
- if (field) {
- for (i = 0 , len = field.length; i < len; ++i) {
- item = field[i];
- if (item.type === type) {
- return item;
- }
- }
- }
- return null;
- },
-
- makeInitializeFn: function(cls) {
- var code = [
- 'var '
- ],
- body = [
- '\nreturn function (e) {\n var data = e.data, v;\n'
- ],
- work = 0,
- bc, ec,
- convert, expr, factory, field, fields, fs, hasDefValue, i, length;
- if (!(fields = cls.rankedFields)) {
-
-
- fields = cls.rankFields();
- }
- for (i = 0 , length = fields.length; i < length; ++i) {
-
-
-
- field = fields[i];
- fs = 'f' + i;
- convert = field.convert;
- if (i) {
- code.push(', \n ');
- }
- code.push(fs, ' = $fields[' + i + ']');
-
-
- code.push(' /* ', field.name, ' */');
-
-
-
-
-
- if ((hasDefValue = (field.defaultValue !== undefined)) || convert) {
-
-
-
-
- expr = 'data["' + field.name + '"]';
- ++work;
- bc = ec = '';
- if (field.cloneDefaultValue) {
- bc = 'Ext.clone(';
- ec = ')';
- }
- body.push('\n');
- if (convert && hasDefValue) {
-
-
-
-
-
-
-
-
-
-
-
- body.push(' v = ', expr, ';\n' + ' if (v !== undefined) {\n' + ' v = ', fs, '.convert(v, e);\n' + ' }\n' + ' if (v === undefined) {\n' + ' v = ', bc, fs, '.defaultValue', ec, ';\n' + ' }\n' + ' ', expr, ' = v;');
- } else if (convert) {
-
-
-
-
-
-
- body.push(' v = ', fs, '.convert(', expr, ',e);\n' + ' if (v !== undefined) {\n' + ' ', expr, ' = v;\n' + ' }\n');
- } else if (hasDefValue) {
-
-
-
-
-
-
-
- body.push(' if (', expr, ' === undefined) {\n' + ' ', expr, ' = ', bc, fs, '.defaultValue', ec, ';\n' + ' }\n');
- }
- }
- }
- if (!work) {
-
- return Ext.emptyFn;
- }
- code.push(';\n');
- code.push.apply(code, body);
- code.push('}');
- code = code.join('');
-
-
- factory = new Function('$fields', 'Ext', code);
- return factory(fields, Ext);
- }
- }
- }
- },
- function() {
- var Model = this,
- proto = Model.prototype,
- Schema = Ext.data.schema.Schema,
- defaultSchema;
- Model.proxyConfig = proto.proxy;
- delete proto.proxy;
-
- Model.fields = [];
-
- Model.fieldsMap = proto.fieldsMap = {};
- Model.schema = proto.schema = Schema.get(proto.schema);
- proto.idField = new Ext.data.field.Field(proto.idProperty);
- Model.identifier = new Ext.data.identifier.Sequential();
- Model.onExtended(function(cls, data) {
- var proto = cls.prototype,
- schemaName = data.schema,
- superCls = proto.superclass.self,
- schema, entityName, proxy;
- cls.idProperty = data.idProperty || proto.idProperty;
- if (schemaName) {
- delete data.schema;
- schema = Schema.get(schemaName);
- } else if (!(schema = proto.schema)) {
- schema = defaultSchema || (defaultSchema = Schema.get('default'));
- }
-
- cls.rankFields = Model.rankFields;
- cls.topoAdd = Model.topoAdd;
-
-
- proto.schema = cls.schema = schema;
-
-
- if (!(entityName = data.entityName)) {
- proto.entityName = entityName = schema.getEntityName(cls);
-
- if (!entityName) {
- if (data.associations) {
- Ext.raise('Anonymous entities cannot specify "associations"');
- }
- if (data.belongsTo) {
- Ext.raise('Anonymous entities cannot specify "belongsTo"');
- }
- if (data.hasMany) {
- Ext.raise('Anonymous entities cannot specify "hasMany"');
- }
- if (data.hasOne) {
- Ext.raise('Anonymous entities cannot specify "hasOne"');
- }
- if (data.matrices) {
- Ext.raise('Anonymous entities cannot specify "manyToMany"');
- }
- }
- }
-
- cls.entityName = entityName;
- cls.fieldExtractors = {};
- Model.initIdentifier(data, cls, proto);
- Model.initFields(data, cls, proto);
- Model.initValidators(data, cls, proto);
- if (!data.isSummaryModel) {
- Model.initSummaries(data, cls, proto);
- }
-
-
- cls.fields.items = cls.fields;
- if (entityName) {
- schema.addEntity(cls);
- Model.initAssociations(schema, data, cls);
- }
- proxy = data.proxy;
- if (proxy) {
- delete data.proxy;
- } else if (superCls !== Model) {
- proxy = superCls.proxyConfig || superCls.proxy;
- }
- cls.proxyConfig = proxy;
- });
- });
- Ext.define('Ext.data.ResultSet', {
-
- isResultSet: true,
- $configPrefixed: false,
- config: {
-
- loaded: true,
-
- count: null,
-
- total: null,
-
- remoteTotal: null,
-
- success: false,
-
- records: null,
-
- message: null,
-
- metadata: null,
-
- groupData: null,
-
- summaryData: null
- },
-
- constructor: function(config) {
- this.initConfig(config);
- },
- getCount: function() {
- var count = this.callParent(),
- records;
- if (!count) {
- records = this.getRecords();
- if (records) {
- count = records.length;
- }
- }
- return count;
- }
- });
- Ext.define('Ext.data.reader.Reader', {
- alternateClassName: [
- 'Ext.data.Reader',
- 'Ext.data.DataReader'
- ],
- mixins: [
- Ext.mixin.Observable,
- Ext.mixin.Factoryable
- ],
- alias: 'reader.base',
- factoryConfig: {
- defaultType: null
- },
- config: {
-
- groupRootProperty: '',
-
- implicitIncludes: true,
-
- keepRawData: null,
-
- messageProperty: '',
-
- model: null,
-
- proxy: null,
-
- readRecordsOnFailure: true,
-
- rootProperty: '',
-
- successProperty: 'success',
-
- summaryRootProperty: '',
-
- totalProperty: 'total',
-
- transform: null,
-
- typeProperty: ''
- },
-
-
-
- isReader: true,
-
-
- constructor: function(config) {
- if (config && config.hasOwnProperty('root')) {
- config = Ext.apply({}, config);
- config.rootProperty = config.root;
- delete config.root;
-
- Ext.log.error('Ext.data.reader.Reader: Using the deprecated "root" configuration. Use "rootProperty" instead.');
- }
-
- var me = this;
- me.duringInit = 1;
-
- me.mixins.observable.constructor.call(me, config);
- --me.duringInit;
- me.buildExtractors();
- },
- forceBuildExtractors: function() {
- if (!this.duringInit) {
- this.buildExtractors(true);
- }
- },
- updateGroupRootProperty: function() {
- this.forceBuildExtractors();
- },
- updateMessageProperty: function() {
- this.forceBuildExtractors();
- },
- applyModel: function(model) {
- return Ext.data.schema.Schema.lookupEntity(model);
- },
- updateSuccessProperty: function() {
- this.forceBuildExtractors();
- },
- updateTotalProperty: function() {
- this.forceBuildExtractors();
- },
- applyTransform: function(transform) {
- if (transform) {
- if (Ext.isFunction(transform)) {
- transform = {
- fn: transform
- };
- } else if (transform.charAt) {
-
- transform = {
- fn: this[transform]
- };
- }
- return transform.fn.bind(transform.scope || this);
- }
- return transform;
- },
-
- read: function(response, readOptions) {
- var data, result, responseText;
- if (response) {
- responseText = response.responseText;
- if (response.responseType || responseText) {
- result = this.getResponseData(response);
- if (result && result.__$isError) {
- return new Ext.data.ResultSet({
- total: 0,
- count: 0,
- records: [],
- success: false,
- message: result.msg
- });
- } else {
- data = this.readRecords(result, readOptions);
- }
- } else if (responseText !== '') {
- data = this.readRecords(response, readOptions);
- }
- }
- return data || this.nullResultSet;
- },
-
- getNullResultSet: function() {
- return this.nullResultSet;
- },
-
- createReadError: function(msg) {
- return {
- __$isError: true,
- msg: msg
- };
- },
-
- readRecords: function(data, readOptions, internalReadOptions) {
- var me = this,
- recordsOnly = internalReadOptions && internalReadOptions.recordsOnly,
- asRoot = internalReadOptions && internalReadOptions.asRoot,
- groupData = null,
- summaryData = null,
- success, recordCount, records, root, remoteTotal, total, value, message, transform, meta, summaryOptions;
-
-
-
- meta = me.getMeta ? me.getMeta(data) : data.metaData;
- if (meta) {
- me.onMetaChange(meta);
- }
- transform = me.getTransform();
- if (transform) {
- data = transform(data);
- }
- me.buildExtractors();
- if (me.getKeepRawData()) {
- me.rawData = data;
- }
- if (me.hasListeners.rawdata) {
- me.fireEventArgs('rawdata', [
- data
- ]);
- }
- data = me.getData(data);
- success = true;
- recordCount = 0;
- records = [];
- if (me.getSuccessProperty()) {
- value = me.getSuccess(data);
- if (value === false || value === 'false') {
- success = false;
- }
- }
- if (me.getMessageProperty()) {
- message = me.getMessage(data);
- }
-
- if (success || me.getReadRecordsOnFailure()) {
-
-
- root = (asRoot || Ext.isArray(data)) ? data : me.getRoot(data);
- if (root) {
- total = root.length;
- }
- if (me.getTotalProperty()) {
- value = parseInt(me.getTotal(data), 10);
- if (!isNaN(value)) {
- remoteTotal = total = value;
- }
- }
- if (root) {
- records = me.extractData(root, readOptions);
- recordCount = records.length;
- }
- if (me.getGroupRootProperty()) {
- root = me.getGroupRoot(data);
- if (root) {
- summaryOptions = {
- includes: false,
- model: me.getModel().getSummaryModel()
- };
- groupData = me.extractData(root, summaryOptions) || null;
- }
- }
- if (me.getSummaryRootProperty()) {
- root = me.getSummaryRoot(data);
- if (root) {
- summaryOptions = summaryOptions || {
- includes: false,
- model: me.getModel().getSummaryModel()
- };
- summaryData = me.extractData(root, summaryOptions) || null;
-
- if (summaryData) {
- summaryData = summaryData[0];
- }
- }
- }
- }
- return recordsOnly ? records : new Ext.data.ResultSet({
- total: total || recordCount,
- remoteTotal: remoteTotal,
- metadata: meta,
- count: recordCount,
- records: records,
- success: success,
- message: message,
- groupData: groupData,
- summaryData: summaryData
- });
- },
-
- extractData: function(root, readOptions) {
- var me = this,
- entityType = readOptions && readOptions.model ? Ext.data.schema.Schema.lookupEntity(readOptions.model) : me.getModel(),
- schema = entityType.schema,
- includes = readOptions && 'includes' in readOptions ? readOptions.includes : schema.hasAssociations(entityType) && me.getImplicitIncludes(),
- fieldExtractorInfo = me.getFieldExtractorInfo(entityType),
- length = root.length,
- records = new Array(length),
- typeProperty = me.getTypeProperty(),
- reader, node, nodeType, record, i;
- if (!length && Ext.isObject(root)) {
- root = [
- root
- ];
- length = 1;
- }
- for (i = 0; i < length; i++) {
- record = root[i];
- if (!record.isModel) {
-
-
- node = record;
-
-
-
-
-
-
- if (typeProperty && (nodeType = me.getChildType(schema, node, typeProperty))) {
- reader = nodeType.getProxy().getReader();
- record = reader.extractRecord(node, readOptions, nodeType, schema.hasAssociations(nodeType) && reader.getImplicitIncludes(), reader.getFieldExtractorInfo(nodeType));
- } else {
- record = me.extractRecord(node, readOptions, entityType, includes, fieldExtractorInfo);
- }
-
-
-
-
-
- if (record.isModel && record.isNode) {
- record.raw = node;
- }
- }
- if (record.onLoad) {
- record.onLoad();
- }
- records[i] = record;
- }
- return records;
- },
-
- getChildType: function(schema, rawNode, typeProperty) {
- var namespace;
- switch (typeof typeProperty) {
- case 'string':
- return schema.getEntity(rawNode[typeProperty]);
- case 'object':
- namespace = typeProperty.namespace;
- return schema.getEntity((namespace ? namespace + '.' : '') + rawNode[typeProperty.name]);
- case 'function':
- return schema.getEntity(typeProperty(rawNode));
- }
- },
- extractRecordData: function(node, readOptions) {
- var entityType = readOptions && readOptions.model ? Ext.data.schema.Schema.lookupEntity(readOptions.model) : this.getModel(),
- fieldExtractorInfo = this.getFieldExtractorInfo(entityType);
- return this.extractRecord(node, readOptions, entityType, false, fieldExtractorInfo);
- },
- extractRecord: function(node, readOptions, entityType, includes, fieldExtractorInfo) {
- var me = this,
- creatorFn = (readOptions && readOptions.recordCreator) || me.defaultRecordCreator,
- modelData, record;
-
-
-
- modelData = me.extractModelData(node, fieldExtractorInfo);
- record = creatorFn.call(me, modelData, entityType || me.getModel(), readOptions);
- if (includes && record.isModel) {
- me.readAssociated(record, node, readOptions);
- }
- return record;
- },
- getFieldExtractorInfo: function(entityType) {
- var extractors = entityType.fieldExtractors,
- type, extractor;
-
-
- if (!extractors) {
- return;
- }
- type = this.$className;
- extractor = extractors[type];
-
-
- if (extractor === undefined) {
- extractors[type] = extractor = this.buildFieldExtractors(entityType);
- }
- return extractor;
- },
- buildFieldExtractors: function(entityType) {
- var fields = entityType.getFields(),
- len = fields.length,
- buffer = [],
- extractors = [],
- out = null,
- cnt = 0,
- field, name, i, extractor;
- for (i = 0; i < len; ++i) {
- field = fields[i];
- extractor = this.createFieldAccessor(field);
- if (extractor) {
- name = field.name;
-
- buffer.push('val = extractors[' + cnt + '](raw, self); if (val !== undefined) { data[\'' + name + '\'] = val; }');
- extractors.push(extractor);
- ++cnt;
- }
- }
- if (buffer.length) {
- out = {
- extractors: extractors,
- fn: new Function('raw', 'data', 'extractors', 'self', 'var val;' + buffer.join('\n'))
- };
- }
- return out;
- },
- defaultRecordCreator: function(data, Model) {
- return new Model(data);
- },
- defaultRecordCreatorFromServer: function(data, Model) {
- var record = new Model(data);
-
-
- record.phantom = false;
- return record;
- },
- getModelData: function(raw) {
- return {};
- },
- extractModelData: function(raw, fieldExtractorInfo) {
- var data = this.getModelData(raw),
- fn;
-
- if (fieldExtractorInfo) {
- fn = fieldExtractorInfo.fn;
- fn(raw, data, fieldExtractorInfo.extractors, this);
- }
- return data;
- },
-
- readAssociated: function(record, data, readOptions) {
- var roles = record.associations,
- key, role;
- for (key in roles) {
- if (roles.hasOwnProperty(key)) {
- role = roles[key];
-
- if (role.cls) {
- role.read(record, data, this, readOptions);
- }
- }
- }
- },
-
- getData: Ext.identityFn,
-
- getRoot: Ext.identityFn,
-
- getResponseData: function(response) {
-
- Ext.raise("getResponseData must be implemented in the Ext.data.reader.Reader subclass");
- },
-
-
- onMetaChange: function(meta) {
- var me = this,
- fields = meta.fields,
- model, newModel, clientIdProperty, proxy;
-
- me.metaData = meta;
-
- if (meta.root) {
- me.setRootProperty(meta.root);
- }
- if (meta.totalProperty) {
- me.setTotalProperty(meta.totalProperty);
- }
- if (meta.successProperty) {
- me.setSuccessProperty(meta.successProperty);
- }
- if (meta.messageProperty) {
- me.setMessageProperty(meta.messageProperty);
- }
- clientIdProperty = meta.clientIdProperty;
- if (fields) {
- newModel = Ext.define(null, {
- extend: 'Ext.data.Model',
- fields: fields,
- clientIdProperty: clientIdProperty
- });
- me.setModel(newModel);
- proxy = me.getProxy();
- if (proxy) {
- proxy.setModel(newModel);
- }
- } else if (clientIdProperty) {
- model = me.getModel();
- if (model) {
- model.self.prototype.clientIdProperty = clientIdProperty;
- }
- }
- },
-
- buildExtractors: function(force) {
- var me = this,
- totalProp, successProp, messageProp;
- if (force || !me.hasExtractors) {
- totalProp = me.getTotalProperty();
- successProp = me.getSuccessProperty();
- messageProp = me.getMessageProperty();
-
- if (totalProp) {
- me.getTotal = me.getAccessor(totalProp);
- }
- if (successProp) {
- me.getSuccess = me.getAccessor(successProp);
- }
- if (messageProp) {
- me.getMessage = me.getAccessor(messageProp);
- }
- me.hasExtractors = true;
- return true;
- }
- },
- getAccessor: function(prop) {
- var me = this,
- cache = me.extractorCache,
- ret, key;
- if (typeof prop === 'string') {
- key = me.getAccessorKey(prop);
- if (key) {
- ret = cache.get(key);
- }
- if (!ret) {
- ret = me.createAccessor(prop);
- if (key) {
- cache.add(key, ret);
- }
- }
- } else {
- ret = me.createAccessor(prop);
- }
- return ret;
- },
- getAccessorKey: function(prop) {
- var className = this.$className;
- return className ? className + prop : '';
- },
- createAccessor: Ext.emptyFn,
- createFieldAccessor: Ext.emptyFn,
- destroy: function() {
- var me = this;
- me.model = me.getTotal = me.getSuccess = me.getMessage = me.rawData = null;
-
- me.onMetaChange = null;
-
- me.transform = null;
- me.callParent();
- },
- privates: {
- copyFrom: function(reader) {
- var me = this;
- reader.buildExtractors();
- me.getTotal = reader.getTotal;
- me.getSuccess = reader.getSuccess;
- me.getMessage = reader.getMessage;
- ++me.duringInit;
- me.setConfig(reader.getConfig());
- --me.duringInit;
- me.hasExtractors = true;
- },
- getGroupRoot: Ext.privateFn,
- getSummaryRoot: Ext.privateFn
- }
- }, function(Cls) {
- var proto = Cls.prototype;
- Ext.apply(proto, {
-
- nullResultSet: new Ext.data.ResultSet({
- total: 0,
- count: 0,
- records: [],
- success: true,
- message: ''
- })
- });
- proto.extractorCache = new Ext.util.LruCache();
- });
- Ext.define('Ext.data.writer.Writer', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'writer.base',
- factoryConfig: {
- defaultType: null
- },
- alternateClassName: [
- 'Ext.data.DataWriter',
- 'Ext.data.Writer'
- ],
- config: {
-
- clientIdProperty: null,
-
- allDataOptions: {
- persist: true
- },
-
- partialDataOptions: {
- changes: true,
- critical: true
- },
-
- writeAllFields: false,
-
- dateFormat: null,
-
- nameProperty: 'name',
-
- writeRecordId: true,
-
- transform: null
- },
-
- isWriter: true,
-
- constructor: function(config) {
- this.initConfig(config);
- },
- applyTransform: function(transform) {
- if (transform) {
- if (Ext.isFunction(transform)) {
- transform = {
- fn: transform
- };
- }
- return transform.fn.bind(transform.scope || this);
- }
- return transform;
- },
-
- write: function(request) {
- var operation = request.getOperation(),
- records = operation.getRecords() || [],
- len = records.length,
- data = [],
- i;
- for (i = 0; i < len; i++) {
- data.push(this.getRecordData(records[i], operation));
- }
- return this.writeRecords(request, data);
- },
-
- writeRecords: Ext.emptyFn,
-
- getRecordData: function(record, operation) {
- var me = this,
- nameProperty = me.getNameProperty(),
- mapping = nameProperty !== 'name',
- idField = record.self.idField,
- key = idField[nameProperty] || idField.name,
-
- value = record.id,
- writeAll = me.getWriteAllFields(),
- ret, dateFormat, phantom, options, clientIdProperty, fieldsMap, data, field;
- if (idField.serialize) {
- value = idField.serialize(value);
- }
- if (!writeAll && operation && operation.isDestroyOperation) {
- ret = {};
- ret[key] = value;
- } else {
- dateFormat = me.getDateFormat();
- phantom = record.phantom;
- options = (phantom || writeAll) ? me.getAllDataOptions() : me.getPartialDataOptions();
- clientIdProperty = phantom && me.getClientIdProperty();
- fieldsMap = record.getFieldsMap();
- options.serialize = false;
-
- data = record.getData(options);
-
-
- ret = mapping ? {} : data;
- if (clientIdProperty) {
-
- ret[clientIdProperty] = value;
-
- delete data[key];
- }
-
- else if (!me.getWriteRecordId()) {
- delete data[key];
- }
- for (key in data) {
- value = data[key];
- if (!(field = fieldsMap[key])) {
-
-
-
- if (mapping) {
- ret[key] = value;
- }
- } else {
-
-
-
- if (field.isDateField && dateFormat && Ext.isDate(value)) {
- value = Ext.Date.format(value, dateFormat);
- } else if (field.serialize) {
- value = field.serialize(value, record);
- }
- if (mapping) {
- key = field[nameProperty] || key;
- }
- ret[key] = value;
- }
- }
- }
- return ret;
- }
- });
- Ext.define('Ext.data.proxy.Proxy', {
- mixins: [
- Ext.mixin.Factoryable,
- Ext.mixin.Observable
- ],
- $configPrefixed: false,
- alias: 'proxy.proxy',
-
- alternateClassName: [
- 'Ext.data.DataProxy',
- 'Ext.data.Proxy'
- ],
- config: {
-
- batchOrder: 'create,update,destroy',
-
- batchActions: true,
-
- model: undefined,
-
-
- reader: {
- type: 'json'
- },
-
-
- writer: {
- type: 'json'
- }
- },
-
- isProxy: true,
-
- isSynchronous: false,
-
-
- constructor: function(config) {
-
- this.mixins.observable.constructor.call(this, config);
-
- this.pendingOperations = {};
- },
- applyModel: function(model) {
- return Ext.data.schema.Schema.lookupEntity(model);
- },
- updateModel: function(model) {
- if (model) {
- var reader = this.getReader();
- if (reader && !reader.getModel()) {
- reader.setModel(model);
- }
- }
- },
- applyReader: function(reader) {
-
-
-
-
- if (this.isSynchronous) {
- reader = reader || {};
- reader.keepRawData = true;
- }
- return Ext.Factory.reader(reader);
- },
- updateReader: function(reader) {
- if (reader) {
- var me = this,
- model = me.getModel();
- if (!model) {
- model = reader.getModel();
- if (model) {
- me.setModel(model);
- }
- } else {
- reader.setModel(model);
- }
- if (reader.responseType != null) {
- me.responseType = reader.responseType;
- }
- }
- },
- applyWriter: function(writer) {
- var reader = this.getReader();
- writer = Ext.Factory.writer(writer);
-
-
- if (writer.getRecord && !writer.getRecord() && reader && reader.getRecord) {
- reader = reader.getRecord();
- if (reader) {
- writer.setRecord(reader);
- }
- }
- return writer;
- },
- abort: Ext.emptyFn,
-
- onMetaChange: function(meta) {
- this.fireEvent('metachange', this, meta);
- },
-
- create: Ext.emptyFn,
-
- read: Ext.emptyFn,
-
- update: Ext.emptyFn,
-
- erase: Ext.emptyFn,
-
- batch: function(options, listeners) {
- var me = this,
- useBatch = me.getBatchActions(),
- batch, records, actions, aLen, action, a, r, rLen, record;
- if (options.operations === undefined) {
-
-
- options = {
- operations: options,
- listeners: listeners
- };
- }
- if (options.batch) {
- if (Ext.isDefined(options.batch.runOperation)) {
- batch = Ext.applyIf(options.batch, {
- proxy: me,
- listeners: {}
- });
- }
- } else {
- options.batch = {
- proxy: me,
- listeners: options.listeners || {}
- };
- }
- if (!batch) {
- batch = new Ext.data.Batch(options.batch);
- }
-
- batch.on('complete', Ext.bind(me.onBatchComplete, me, [
- options
- ], 0), null, {
- single: true,
- priority: 1000
- });
- batch.$destroyOwner = options.$destroyOwner;
- actions = me.getBatchOrder().split(',');
- aLen = actions.length;
- for (a = 0; a < aLen; a++) {
- action = actions[a];
- records = options.operations[action];
- if (records) {
- if (useBatch) {
- batch.add(me.createOperation(action, {
- records: records,
-
- params: options.params
- }));
- } else {
- rLen = records.length;
- for (r = 0; r < rLen; r++) {
- record = records[r];
- batch.add(me.createOperation(action, {
- records: [
- record
- ],
-
- params: options.params
- }));
- }
- }
- }
- }
- batch.start();
- return batch;
- },
-
- onBatchComplete: function(batchOptions, batch) {
- var scope = batchOptions.scope || this;
- if (batch.hasException()) {
- if (Ext.isFunction(batchOptions.failure)) {
- Ext.callback(batchOptions.failure, scope, [
- batch,
- batchOptions
- ]);
- }
- } else if (Ext.isFunction(batchOptions.success)) {
- Ext.callback(batchOptions.success, scope, [
- batch,
- batchOptions
- ]);
- }
- if (Ext.isFunction(batchOptions.callback)) {
- Ext.callback(batchOptions.callback, scope, [
- batch,
- batchOptions
- ]);
- }
-
-
-
- if (!batch.$destroyOwner) {
- batch.destroy();
- }
- },
- createOperation: function(action, config) {
- var operation = Ext.createByAlias('data.operation.' + action, config);
- operation.setProxy(this);
- this.pendingOperations[operation._internalId] = operation;
- return operation;
- },
- completeOperation: function(operation) {
- delete this.pendingOperations[operation._internalId];
- },
- clone: function() {
- return new this.self(this.getInitialConfig());
- },
- destroy: function() {
- var ops = this.pendingOperations,
- opId, op;
- for (opId in ops) {
- op = ops[opId];
- if (op && op.isRunning()) {
- op.abort();
- }
- op.destroy();
- }
- this.pendingOperations = null;
- this.callParent();
- }
- });
- Ext.define('Ext.data.proxy.Client', {
- extend: Ext.data.proxy.Proxy,
- alternateClassName: 'Ext.data.ClientProxy',
-
- isSynchronous: true,
-
- clear: function() {
-
- Ext.raise("The Ext.data.proxy.Client subclass that you are using has not defined a 'clear' function. See src/data/ClientProxy.js for details.");
- }
- });
- Ext.define('Ext.data.proxy.Memory', {
- extend: Ext.data.proxy.Client,
- alias: 'proxy.memory',
- alternateClassName: 'Ext.data.MemoryProxy',
- isMemoryProxy: true,
- config: {
-
- enablePaging: null,
-
- data: {
- $value: null,
-
-
- merge: function(newValue, currentValue, target, mixinClass) {
- return newValue ? Ext.clone(newValue) : newValue;
- }
- },
-
- clearOnRead: null
- },
-
- finishOperation: function(operation) {
- var recs = operation.getRecords(),
- len = recs.length,
- i;
- for (i = 0; i < len; i++) {
-
- recs[i].dropped = !!operation.isDestroyOperation;
- recs[i].commit();
- }
- operation.setSuccessful(true);
- },
-
- create: function(operation) {
- this.finishOperation(operation);
- },
-
- update: function(operation) {
- this.finishOperation(operation);
- },
-
- erase: function(operation) {
- this.finishOperation(operation);
- },
-
- read: function(operation) {
- var me = this,
- reader = me.getReader(),
- resultSet = reader.read(me.getData(), {
- recordCreator: reader.defaultRecordCreatorFromServer
- }),
- records = resultSet.getRecords(),
- sorters = operation.getSorters(),
- grouper = operation.getGrouper(),
- filters = operation.getFilters(),
- start = operation.getStart(),
- limit = operation.getLimit(),
- meta;
-
- if (operation.process(resultSet, null, null, false) !== false) {
-
- if (operation.success && me.getClearOnRead()) {
- this.setData(null);
- }
-
- if (filters && filters.length) {
-
- resultSet.setRecords(records = Ext.Array.filter(records, Ext.util.Filter.createFilterFn(filters)));
- resultSet.setTotal(records.length);
- }
-
- if (grouper) {
-
- sorters = sorters ? sorters.concat(grouper) : sorters;
- }
-
- if (sorters && sorters.length) {
- resultSet.setRecords(records = Ext.Array.sort(records, Ext.util.Sortable.createComparator(sorters)));
- }
-
-
- if (me.getEnablePaging() && start !== undefined && limit !== undefined) {
-
- if (start >= resultSet.getTotal()) {
- resultSet.setConfig({
- success: false,
- records: [],
- total: 0
- });
- } else
- {
- resultSet.setRecords(Ext.Array.slice(records, start, start + limit));
- }
- }
- operation.setCompleted();
-
-
- if (meta = resultSet.getMetadata()) {
- me.onMetaChange(meta);
- }
- }
- },
- clear: Ext.emptyFn
- });
- Ext.define('Ext.data.ProxyStore', {
- extend: Ext.data.AbstractStore,
- config: {
-
-
- model: undefined,
-
-
- fields: null,
-
-
- proxy: undefined,
-
- autoLoad: undefined,
-
- autoSync: false,
-
- batchUpdateMode: 'operation',
-
- sortOnLoad: true,
-
- trackRemoved: true,
-
- asynchronousLoad: undefined
- },
- onClassExtended: function(cls, data, hooks) {
- var model = data.model,
- onBeforeClassCreated;
- if (typeof model === 'string') {
- onBeforeClassCreated = hooks.onBeforeCreated;
- hooks.onBeforeCreated = function() {
- var me = this,
- args = arguments;
- Ext.require(model, function() {
- onBeforeClassCreated.apply(me, args);
- });
- };
- }
- },
-
- implicitModel: 'Ext.data.Model',
-
-
- autoSyncSuspended: 0,
-
- removed: null,
-
-
-
-
-
- constructor: function(config) {
- var me = this;
-
- var configModel = me.model;
-
- me.callParent(arguments);
- if (me.getAsynchronousLoad() === false) {
- me.flushLoad();
- }
-
- if (!me.getModel() && me.useModelWarning !== false && me.getStoreId() !== 'ext-empty-store') {
-
- var logMsg = [
- Ext.getClassName(me) || 'Store',
- ' created with no model.'
- ];
- if (typeof configModel === 'string') {
- logMsg.push(" The name '", configModel, "'", ' does not correspond to a valid model.');
- }
- Ext.log.warn(logMsg.join(''));
- }
- },
-
-
- doDestroy: function() {
- var me = this,
- proxy = me.getProxy();
- me.clearLoadTask();
- Ext.destroy(me.getData());
- me.data = null;
- me.setProxy(null);
- if (proxy.autoCreated) {
- proxy.destroy();
- }
- me.setModel(null);
- me.callParent();
- },
- applyAsynchronousLoad: function(asynchronousLoad) {
-
-
- if (asynchronousLoad == null) {
- asynchronousLoad = !this.loadsSynchronously();
- }
- return asynchronousLoad;
- },
- updateAutoLoad: function(autoLoad) {
-
- this.getData();
- if (autoLoad) {
-
- this.load(Ext.isObject(autoLoad) ? autoLoad : undefined);
- }
- },
-
- getTotalCount: function() {
- return this.totalCount || 0;
- },
- applyFields: function(fields) {
- if (fields) {
- this.createImplicitModel(fields);
- }
- },
- applyModel: function(model) {
- if (model) {
- model = Ext.data.schema.Schema.lookupEntity(model);
- } else if (!this.destroying) {
-
- this.getFields();
- model = this.getModel() || this.createImplicitModel();
- }
- return model;
- },
- applyProxy: function(proxy) {
- var model = this.getModel();
- if (proxy !== null) {
- if (proxy) {
- if (proxy.isProxy) {
- proxy.setModel(model);
- } else {
- if (Ext.isString(proxy)) {
- proxy = {
- type: proxy,
- model: model
- };
- } else if (!proxy.model) {
- proxy = Ext.apply({
- model: model
- }, proxy);
- }
- proxy = Ext.createByAlias('proxy.' + proxy.type, proxy);
- proxy.autoCreated = true;
- }
- } else if (model) {
- proxy = model.getProxy();
- this.useModelProxy = true;
- }
- if (!proxy) {
- proxy = Ext.createByAlias('proxy.memory');
- proxy.autoCreated = true;
- }
- }
- return proxy;
- },
- applyState: function(state) {
- var me = this;
- me.callParent([
- state
- ]);
-
-
-
-
- if (me.getAutoLoad() || me.isLoaded()) {
- me.load();
- }
- },
- updateProxy: function(proxy, oldProxy) {
- this.proxyListeners = Ext.destroy(this.proxyListeners);
- },
- updateTrackRemoved: function(track) {
- this.cleanRemoved();
- this.removed = track ? [] : null;
- },
-
- onMetaChange: function(proxy, meta) {
- this.fireEvent('metachange', this, meta);
- },
-
- create: function(data, options) {
- var me = this,
- Model = me.getModel(),
- instance = new Model(data),
- operation;
- options = Ext.apply({}, options);
- if (!options.records) {
- options.records = [
- instance
- ];
- }
- options.internalScope = me;
- options.internalCallback = me.onProxyWrite;
- operation = me.createOperation('create', options);
- return operation.execute();
- },
- read: function() {
- return this.load.apply(this, arguments);
- },
- update: function(options) {
- var me = this,
- operation;
- options = Ext.apply({}, options);
- if (!options.records) {
- options.records = me.getUpdatedRecords();
- }
- options.internalScope = me;
- options.internalCallback = me.onProxyWrite;
- operation = me.createOperation('update', options);
- return operation.execute();
- },
-
- onProxyWrite: function(operation) {
- var me = this,
- success = operation.wasSuccessful(),
- records = operation.getRecords();
- switch (operation.getAction()) {
- case 'create':
- me.onCreateRecords(records, operation, success);
- break;
- case 'update':
- me.onUpdateRecords(records, operation, success);
- break;
- case 'destroy':
- me.onDestroyRecords(records, operation, success);
- break;
- }
- if (success) {
- me.fireEvent('write', me, operation);
- me.fireEvent('datachanged', me);
- }
- },
-
- onCreateRecords: Ext.emptyFn,
-
- onUpdateRecords: Ext.emptyFn,
-
- onDestroyRecords: function(records, operation, success) {
- if (success) {
- this.cleanRemoved();
- }
- },
-
-
- erase: function(options) {
- var me = this,
- operation;
- options = Ext.apply({}, options);
- if (!options.records) {
- options.records = me.getRemovedRecords();
- }
- options.internalScope = me;
- options.internalCallback = me.onProxyWrite;
- operation = me.createOperation('destroy', options);
- return operation.execute();
- },
-
- onBatchOperationComplete: function(batch, operation) {
- return this.onProxyWrite(operation);
- },
-
- onBatchComplete: function(batch, operation) {
- var me = this,
- operations = batch.operations,
- length = operations.length,
- i;
- if (me.batchUpdateMode !== 'operation') {
- me.suspendEvents();
- for (i = 0; i < length; i++) {
- me.onProxyWrite(operations[i]);
- }
- me.resumeEvents();
- }
- me.isSyncing = false;
- if (batch.$destroyOwner === me) {
- batch.destroy();
- }
- me.fireEvent('datachanged', me);
- },
-
- onBatchException: function(batch, operation) {},
-
-
-
-
-
-
- filterNew: function(item) {
-
- return item.phantom && item.isValid();
- },
-
- getNewRecords: function() {
- return [];
- },
-
- getUpdatedRecords: function() {
- return [];
- },
-
- getModifiedRecords: function() {
- return [].concat(this.getNewRecords(), this.getUpdatedRecords());
- },
-
- filterUpdated: function(item) {
-
- return item.dirty && !item.phantom && item.isValid();
- },
-
- getRemovedRecords: function() {
- var removed = this.getRawRemovedRecords();
- return removed ? Ext.Array.clone(removed) : [];
- },
-
- sync: function(options) {
- var me = this,
- operations = {},
- toCreate = me.getNewRecords(),
- toUpdate = me.getUpdatedRecords(),
- toDestroy = me.getRemovedRecords(),
- needsSync = false;
-
- if (me.isSyncing) {
- Ext.log.warn('Sync called while a sync operation is in progress. Consider configuring autoSync as false.');
- }
-
- me.needsSync = false;
- if (toCreate.length > 0) {
- operations.create = toCreate;
- needsSync = true;
- }
- if (toUpdate.length > 0) {
- operations.update = toUpdate;
- needsSync = true;
- }
- if (toDestroy.length > 0) {
- operations.destroy = toDestroy;
- needsSync = true;
- }
- if (needsSync && me.fireEvent('beforesync', operations) !== false) {
- me.isSyncing = true;
- options = options || {};
- me.proxy.batch(Ext.apply(options, {
- operations: operations,
- listeners: me.getBatchListeners(),
- $destroyOwner: me
- }));
- }
- return me;
- },
-
- getBatchListeners: function() {
- var me = this,
- listeners = {
- scope: me,
- exception: me.onBatchException,
- complete: me.onBatchComplete
- };
- if (me.batchUpdateMode === 'operation') {
- listeners.operationcomplete = me.onBatchOperationComplete;
- }
- return listeners;
- },
-
- save: function() {
- return this.sync.apply(this, arguments);
- },
-
- load: function(options) {
- var me = this;
-
- if (typeof options === 'function') {
- options = {
- callback: options
- };
- } else {
-
- options = options ? Ext.Object.chain(options) : {};
- }
- me.pendingLoadOptions = options;
-
-
- if (me.getAsynchronousLoad()) {
- if (!me.loadTimer) {
- me.loadTimer = Ext.asap(me.flushLoad, me);
- }
- } else
-
- {
- me.flushLoad();
- }
- return me;
- },
-
- flushLoad: function() {
- var me = this,
- options = me.pendingLoadOptions,
- operation;
- if (me.destroying || me.destroyed) {
- return;
- }
-
- me.clearLoadTask();
- if (!options) {
- return;
- }
- me.setLoadOptions(options);
- if (me.getRemoteSort() && options.sorters) {
- me.fireEvent('beforesort', me, options.sorters);
- }
- operation = Ext.apply({
- internalScope: me,
- internalCallback: me.onProxyLoad,
- scope: me
- }, options);
- me.lastOptions = operation;
- operation = me.createOperation('read', operation);
- if (me.fireEvent('beforeload', me, operation) !== false) {
- me.onBeforeLoad(operation);
- me.loading = true;
-
-
- if (me.hasListeners.beginload) {
- me.fireEvent('beginload', me, operation);
- }
- operation.execute();
- }
- },
-
- reload: function(options) {
- return this.load(Ext.apply({}, options, this.lastOptions));
- },
- onEndUpdate: function() {
- var me = this;
- if (me.needsSync && me.autoSync && !me.autoSyncSuspended) {
- me.sync();
- }
- },
-
- afterReject: function(record) {
- var me = this;
-
-
-
-
-
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.REJECT, null);
- me.fireEvent('update', me, record, Ext.data.Model.REJECT, null);
- me.fireEvent('datachanged', me);
- }
- },
-
- afterCommit: function(record, modifiedFieldNames) {
- var me = this;
- if (!modifiedFieldNames) {
- modifiedFieldNames = null;
- }
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.COMMIT, modifiedFieldNames);
- me.fireEvent('update', me, record, Ext.data.Model.COMMIT, modifiedFieldNames);
- me.fireEvent('datachanged', me);
- }
- },
- afterErase: function(record) {
- this.onErase(record);
- },
- onErase: Ext.emptyFn,
- onUpdate: Ext.emptyFn,
-
- hasPendingLoad: function() {
- return !!this.pendingLoadOptions || this.isLoading();
- },
-
- isLoading: function() {
- return !!this.loading;
- },
-
- isLoaded: function() {
- return this.loadCount > 0;
- },
-
- suspendAutoSync: function() {
- ++this.autoSyncSuspended;
- },
-
- resumeAutoSync: function(syncNow) {
- var me = this;
-
- if (!me.autoSyncSuspended) {
- Ext.log.warn('Mismatched call to resumeAutoSync - auto synchronization is currently not suspended.');
- }
-
- if (me.autoSyncSuspended && !--me.autoSyncSuspended) {
- if (syncNow) {
- me.sync();
- }
- }
- },
-
- removeAll: Ext.emptyFn,
-
-
-
- clearData: Ext.emptyFn,
- privates: {
-
- getRawRemovedRecords: function() {
- return this.removed;
- },
- onExtraParamsChanged: function() {},
- clearLoadTask: function() {
- this.pendingLoadOptions = this.loadTimer = Ext.unasap(this.loadTimer);
- },
- cleanRemoved: function() {
-
-
-
-
- var removed = this.getRawRemovedRecords(),
- len, i;
- if (removed) {
- for (i = 0 , len = removed.length; i < len; ++i) {
- removed[i].unjoin(this);
- }
- removed.length = 0;
- }
- },
- createOperation: function(type, options) {
- var me = this,
- proxy = me.getProxy(),
- listeners;
- if (!me.proxyListeners) {
- listeners = {
- scope: me,
- destroyable: true,
- beginprocessresponse: me.beginUpdate,
- endprocessresponse: me.endUpdate
- };
- if (!me.disableMetaChangeEvent) {
- listeners.metachange = me.onMetaChange;
- }
- me.proxyListeners = proxy.on(listeners);
- }
- return proxy.createOperation(type, options);
- },
- createImplicitModel: function(fields) {
- var me = this,
- modelCfg = {
- extend: me.implicitModel,
- statics: {
- defaultProxy: 'memory'
- }
- },
- proxy, model;
- if (fields) {
- modelCfg.fields = fields;
- }
- model = Ext.define(null, modelCfg);
- me.setModel(model);
- proxy = me.getProxy();
- if (proxy) {
- model.setProxy(proxy);
- } else {
- me.setProxy(model.getProxy());
- }
- },
- loadsSynchronously: function() {
- return this.getProxy().isSynchronous;
- },
- onBeforeLoad: Ext.privateFn,
- removeFromRemoved: function(record) {
-
-
-
-
- var removed = this.getRawRemovedRecords();
- if (removed) {
- Ext.Array.remove(removed, record);
- record.unjoin(this);
- }
- },
- setLoadOptions: function(options) {
- var me = this,
- filters, sorters;
- if (me.getRemoteFilter()) {
- filters = me.getFilters(false);
- if (filters && filters.getCount()) {
- options.filters = filters.getRange();
- }
- }
- if (me.getRemoteSort()) {
- sorters = me.getSorters(false);
- if (sorters && sorters.getCount()) {
- options.sorters = sorters.getRange();
- }
- }
- }
- }
- });
- Ext.define('Ext.util.Group', {
- extend: Ext.util.Collection,
- config: {
- groupKey: null
- },
-
-
-
-
- $endUpdatePriority: 2001,
- manageSorters: false
- });
- Ext.define('Ext.data.Group', {
- extend: Ext.util.Group,
- store: null,
-
- getSummaryRecord: function() {
- var me = this,
- summaryRecord = me.summaryRecord,
- store = me.store,
- generation = store.getData().generation,
- M, T;
- if (!summaryRecord) {
- M = store.getModel();
- T = M.getSummaryModel();
- me.summaryRecord = summaryRecord = new T();
- }
- if (!summaryRecord.isRemote && summaryRecord.summaryGeneration !== generation) {
- summaryRecord.calculateSummary(me.items);
- summaryRecord.summaryGeneration = generation;
- }
- return summaryRecord;
- }
- });
- Ext.define('Ext.data.LocalStore', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'localstore'
- },
- config: {
- extraKeys: null
- },
- applyExtraKeys: function(extraKeys) {
- var indexName,
- data = this.getData();
-
- data.setExtraKeys(extraKeys);
-
- extraKeys = data.getExtraKeys();
- for (indexName in extraKeys) {
- this[indexName] = extraKeys[indexName];
- }
- },
-
- add: function(record) {
- return this.insert(this.getCount(), arguments.length === 1 ? record : arguments);
- },
- constructDataCollection: function() {
- var result = new Ext.util.Collection({
- rootProperty: 'data',
- groupConfig: {
- xclass: 'Ext.data.Group',
- store: this
- }
- });
-
-
- result.addObserver(this);
- return result;
- },
-
- createModel: function(record) {
- var session = this.getSession(),
- Model;
- if (!record.isModel) {
- Model = this.getModel();
- record = new Model(record, session);
- }
- return record;
- },
- createFiltersCollection: function() {
- return this.getData().getFilters();
- },
- createSortersCollection: function() {
- var sorters = this.getData().getSorters();
- sorters.setSorterConfigure(this.addFieldTransform, this);
- return sorters;
- },
-
- getSummaryRecord: function() {
- var me = this,
- summaryRecord = me.summaryRecord,
- data = me.getData(),
- generation = data.generation,
- T;
- if (!summaryRecord) {
- T = me.getModel().getSummaryModel();
- me.summaryRecord = summaryRecord = new T();
- }
- if (!summaryRecord.isRemote && summaryRecord.summaryGeneration !== generation) {
- summaryRecord.calculateSummary(data.items);
- summaryRecord.summaryGeneration = generation;
- }
- return summaryRecord;
- },
- onCollectionBeginUpdate: function() {
- this.beginUpdate();
- },
- onCollectionEndUpdate: function() {
- this.endUpdate();
- },
-
-
- onCollectionSort: function() {
- this.onSorterEndUpdate();
- },
-
-
- onCollectionFilter: function() {
- this.onFilterEndUpdate();
- },
- notifySorterChange: function() {
- this.getData().onSorterChange();
- },
- forceLocalSort: function() {
- var sorters = this.getSorters();
-
-
-
- sorters.beginUpdate();
- sorters.endUpdate();
- },
-
- contains: function(record) {
- return this.indexOf(record) > -1;
- },
-
- each: function(fn, scope, includeOptions) {
- var data = this.getData(),
- bypassFilters = includeOptions,
- len, record, i;
- if (typeof includeOptions === 'object') {
- bypassFilters = includeOptions.filtered;
- }
- if (bypassFilters && data.filtered) {
- data = data.getSource();
- }
- data = data.items.slice(0);
-
- len = data.length;
- for (i = 0; i < len; ++i) {
- record = data[i];
- if (fn.call(scope || record, record, i, len) === false) {
- break;
- }
- }
- },
-
- collect: function(property, includeOptions, filtered) {
- var me = this,
- allowNull = includeOptions,
- data = me.getData();
- if (typeof includeOptions === 'object') {
- filtered = includeOptions.filtered;
- allowNull = includeOptions.allowNull;
- }
- if (filtered && data.filtered) {
- data = data.getSource();
- }
- return data.collect(property, 'data', allowNull);
- },
-
- getById: function(id) {
- var data = this.getData();
- if (data.filtered) {
- data = data.getSource();
- }
- return data.get(id) || null;
- },
-
- getByInternalId: function(internalId) {
- var data = this.getData(),
- keyCfg;
- if (data.filtered) {
- if (!data.$hasExtraKeys) {
- keyCfg = this.makeInternalKeyCfg();
- data.setExtraKeys(keyCfg);
- data.$hasExtraKeys = true;
- }
- data = data.getSource();
- }
- if (!data.$hasExtraKeys) {
- data.setExtraKeys(keyCfg || this.makeInternalKeyCfg());
- data.$hasExtraKeys = true;
- }
- return data.byInternalId.get(internalId) || null;
- },
-
- getDataSource: function() {
- var data = this.getData();
- return data.getSource() || data;
- },
-
- indexOf: function(record) {
- return this.getData().indexOf(record);
- },
-
- indexOfId: function(id) {
- return this.indexOf(this.getById(id));
- },
-
- insert: function(index, records) {
- var me = this,
- len, i;
- if (records) {
- if (!Ext.isIterable(records)) {
- records = [
- records
- ];
- } else {
- records = Ext.Array.clone(records);
- }
- len = records.length;
- }
- if (!len) {
- return [];
- }
- for (i = 0; i < len; ++i) {
- records[i] = me.createModel(records[i]);
- }
- me.getData().insert(index, records);
- return records;
- },
-
- queryBy: function(fn, scope) {
- var data = this.getData();
- return (data.getSource() || data).createFiltered(fn, scope);
- },
-
- query: function(property, value, anyMatch, caseSensitive, exactMatch) {
- var data = this.getData();
- return (data.getSource() || data).createFiltered(property, value, anyMatch, caseSensitive, exactMatch);
- },
-
- first: function(grouped) {
- return this.getData().first(grouped) || null;
- },
-
- last: function(grouped) {
- return this.getData().last(grouped) || null;
- },
-
- sum: function(field, grouped) {
- var data = this.getData();
- return (grouped && this.isGrouped()) ? data.sumByGroup(field) : data.sum(field);
- },
-
- count: function(grouped) {
- var data = this.getData();
- return (grouped && this.isGrouped()) ? data.countByGroup() : data.count();
- },
-
- min: function(field, grouped) {
- var data = this.getData();
- return (grouped && this.isGrouped()) ? data.minByGroup(field) : data.min(field);
- },
-
- max: function(field, grouped) {
- var data = this.getData();
- return (grouped && this.isGrouped()) ? data.maxByGroup(field) : data.max(field);
- },
-
- average: function(field, grouped) {
- var data = this.getData();
- return (grouped && this.isGrouped()) ? data.averageByGroup(field) : data.average(field);
- },
-
- aggregate: function(fn, scope, grouped, field) {
- var me = this,
- groups, len, out, group, i;
- if (grouped && me.isGrouped()) {
- groups = me.getGroups().items;
- len = groups.length;
- out = {};
- for (i = 0; i < len; ++i) {
- group = groups[i];
- out[group.getGroupKey()] = me.getAggregate(fn, scope || me, group.items, field);
- }
- return out;
- } else {
- return me.getAggregate(fn, scope, me.getData().items, field);
- }
- },
- getAggregate: function(fn, scope, records, field) {
- var values = [],
- len = records.length,
- i;
-
- for (i = 0; i < len; ++i) {
- values[i] = records[i].get(field);
- }
- return fn.call(scope || this, records, values);
- },
- addObserver: function(observer) {
- var observers = this.observers;
- if (!observers) {
- this.observers = observers = new Ext.util.Collection();
- }
- observers.add(observer);
- },
- removeObserver: function(observer) {
- var observers = this.observers;
- if (observers) {
- observers.remove(observer);
- }
- },
- callObservers: function(action, args) {
- var observers = this.observers,
- len, items, i, methodName, item;
- if (observers) {
- items = observers.items;
- if (args) {
- args.unshift(this);
- } else {
- args = [
- this
- ];
- }
- for (i = 0 , len = items.length; i < len; ++i) {
- item = items[i];
- methodName = 'onSource' + action;
- if (item[methodName]) {
- item[methodName].apply(item, args);
- }
- }
- }
- },
-
- queryRecordsBy: function(fn, scope) {
- var data = this.getData(),
- matches = [],
- len, i, record;
- data = (data.getSource() || data).items;
- scope = scope || this;
- for (i = 0 , len = data.length; i < len; ++i) {
- record = data[i];
- if (fn.call(scope, record) === true) {
- matches.push(record);
- }
- }
- return matches;
- },
-
- queryRecords: function(field, value) {
- var data = this.getData(),
- matches = [],
- len, i, record;
- data = (data.getSource() || data).items;
- for (i = 0 , len = data.length; i < len; ++i) {
- record = data[i];
- if (record.get(field) === value) {
- matches.push(record);
- }
- }
- return matches;
- },
- privates: {
- isLast: function(record) {
- return record === this.last();
- },
- makeInternalKeyCfg: function() {
- return {
- byInternalId: {
- property: 'internalId',
- rootProperty: ''
- }
- };
- }
- }
- });
- Ext.define('Ext.data.proxy.Server', {
- extend: Ext.data.proxy.Proxy,
- alias: 'proxy.server',
- alternateClassName: 'Ext.data.ServerProxy',
- isRemote: true,
- config: {
-
- url: '',
-
- pageParam: 'page',
-
- startParam: 'start',
-
- limitParam: 'limit',
-
- groupParam: 'group',
-
- groupDirectionParam: 'groupDir',
-
- sortParam: 'sort',
-
- filterParam: 'filter',
-
- directionParam: 'dir',
-
- idParam: 'id',
-
- simpleSortMode: false,
-
- simpleGroupMode: false,
-
- noCache: true,
-
- cacheString: "_dc",
-
- timeout: 30000,
-
- api: {
- create: undefined,
- read: undefined,
- update: undefined,
- destroy: undefined
- },
-
- extraParams: {}
- },
- primitiveRe: /string|number|boolean/,
-
-
- create: function() {
- return this.doRequest.apply(this, arguments);
- },
- read: function() {
- return this.doRequest.apply(this, arguments);
- },
- update: function() {
- return this.doRequest.apply(this, arguments);
- },
- erase: function() {
- return this.doRequest.apply(this, arguments);
- },
-
- setExtraParam: function(name, value) {
- var extraParams = this.getExtraParams();
- extraParams[name] = value;
- this.fireEvent('extraparamschanged', extraParams);
- },
- updateExtraParams: function(newExtraParams, oldExtraParams) {
- this.fireEvent('extraparamschanged', newExtraParams);
- },
-
- buildRequest: function(operation) {
- var me = this,
- initialParams = Ext.apply({}, operation.getParams()),
-
- params = Ext.applyIf(initialParams, me.getExtraParams() || {}),
- request, operationId, idParam;
-
- Ext.applyIf(params, me.getParams(operation));
-
-
-
- operationId = operation.getId();
- idParam = me.getIdParam();
- if (operationId !== undefined && params[idParam] === undefined) {
- params[idParam] = operationId;
- }
- request = new Ext.data.Request({
- params: params,
- action: operation.getAction(),
- records: operation.getRecords(),
- url: operation.getUrl(),
- operation: operation,
-
-
- proxy: me
- });
- request.setUrl(me.buildUrl(request));
-
- operation.setRequest(request);
- return request;
- },
-
- processResponse: function(success, operation, request, response) {
- var me = this,
- exception, reader, resultSet, meta, destroyOp;
-
-
- if (me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
-
-
-
- me.fireEvent('beginprocessresponse', me, response, operation);
- if (success === true) {
- reader = me.getReader();
- if (response.status === 204) {
- resultSet = reader.getNullResultSet();
- } else {
- resultSet = reader.read(me.extractResponseData(response), {
-
- recordCreator: operation.getRecordCreator() || reader.defaultRecordCreatorFromServer
- });
- }
- if (!operation.$destroyOwner) {
- operation.$destroyOwner = me;
- destroyOp = true;
- }
- operation.process(resultSet, request, response);
- exception = !operation.wasSuccessful();
- } else {
- me.setException(operation, response);
- exception = true;
- }
-
-
- if (me.destroyed) {
- if (!operation.destroyed && destroyOp && operation.$destroyOwner === me) {
- operation.destroy();
- }
- return;
- }
- if (exception) {
- me.fireEvent('exception', me, response, operation);
- } else
-
- {
- meta = resultSet.getMetadata();
- if (meta) {
- me.onMetaChange(meta);
- }
- }
-
- if (me.destroyed) {
- if (!operation.destroyed && destroyOp && operation.$destroyOwner === me) {
- operation.destroy();
- }
- return;
- }
- me.afterRequest(request, success);
-
-
-
- me.fireEvent('endprocessresponse', me, response, operation);
- if (!operation.destroyed && destroyOp && operation.$destroyOwner === me) {
- operation.destroy();
- }
- },
-
- setException: function(operation, response) {
- operation.setException({
- status: response.status,
- statusText: response.statusText,
- response: response
- });
- },
-
- extractResponseData: Ext.identityFn,
-
- applyEncoding: function(value) {
- return Ext.encode(value);
- },
-
- encodeSorters: function(sorters, preventArray) {
- var out = [],
- length = sorters.length,
- i;
- for (i = 0; i < length; i++) {
- out[i] = sorters[i].serialize();
- }
- return this.applyEncoding(preventArray ? out[0] : out);
- },
-
- encodeFilters: function(filters) {
- var out = [],
- length = filters.length,
- needsEncoding, i, filter, encodedFilter;
- for (i = 0; i < length; i++) {
- filter = filters[i];
-
-
-
-
- filter.getFilterFn();
- if (filter.generatedFilterFn) {
- encodedFilter = filter.serialize();
- needsEncoding |= !this.primitiveRe.test(typeof encodedFilter);
- out.push(encodedFilter);
- }
- }
-
-
- return needsEncoding ? this.applyEncoding(out) : out;
- },
-
- getParams: function(operation) {
- if (!operation.isReadOperation) {
- return {};
- }
- var me = this,
- params = {},
- grouper = operation.getGrouper(),
- sorters = operation.getSorters(),
- filters = operation.getFilters(),
- page = operation.getPage(),
- start = operation.getStart(),
- limit = operation.getLimit(),
- simpleSortMode = me.getSimpleSortMode(),
- simpleGroupMode = me.getSimpleGroupMode(),
- pageParam = me.getPageParam(),
- startParam = me.getStartParam(),
- limitParam = me.getLimitParam(),
- groupParam = me.getGroupParam(),
- groupDirectionParam = me.getGroupDirectionParam(),
- sortParam = me.getSortParam(),
- filterParam = me.getFilterParam(),
- directionParam = me.getDirectionParam(),
- hasGroups, index;
- if (pageParam && page) {
- params[pageParam] = page;
- }
- if (startParam && (start || start === 0)) {
- params[startParam] = start;
- }
- if (limitParam && limit) {
- params[limitParam] = limit;
- }
- hasGroups = groupParam && grouper;
- if (hasGroups) {
-
- if (simpleGroupMode) {
- params[groupParam] = grouper.getProperty();
-
- if (groupDirectionParam === groupParam) {
- params[groupParam] += ' ' + grouper.getDirection();
- } else {
- params[groupDirectionParam] = grouper.getDirection();
- }
- } else {
- params[groupParam] = me.encodeSorters([
- grouper
- ], true);
- }
- }
- if (sortParam && sorters && sorters.length > 0) {
- if (simpleSortMode) {
-
- for (index = (sorters.length > 1 && hasGroups) ? 1 : 0; index < sorters.length; index++) {
-
- if (directionParam === sortParam) {
- params[sortParam] = Ext.Array.push(params[sortParam] || [], sorters[index].getProperty() + ' ' + sorters[index].getDirection());
- } else {
- params[sortParam] = Ext.Array.push(params[sortParam] || [], sorters[index].getProperty());
- params[directionParam] = Ext.Array.push(params[directionParam] || [], sorters[index].getDirection());
- }
- }
- } else {
- params[sortParam] = me.encodeSorters(sorters);
- }
- }
- if (filterParam && filters && filters.length > 0) {
- params[filterParam] = me.encodeFilters(filters);
- }
- return params;
- },
-
- buildUrl: function(request) {
- var me = this,
- url = me.getUrl(request);
-
- if (!url) {
- Ext.raise("You are using a ServerProxy but have not supplied it with a url.");
- }
-
- if (me.getNoCache()) {
- url = Ext.urlAppend(url, Ext.String.format("{0}={1}", me.getCacheString(), Ext.Date.now()));
- }
- return url;
- },
-
- getUrl: function(request) {
- var url;
- if (request) {
- url = request.getUrl() || this.getApi()[request.getAction()];
- }
- return url ? url : this.callParent();
- },
-
- doRequest: function(operation, callback, scope) {
-
- Ext.raise("The doRequest function has not been implemented on your Ext.data.proxy.Server subclass. See src/data/ServerProxy.js for details");
- },
-
-
- afterRequest: Ext.emptyFn,
- destroy: function() {
- var me = this;
- me.destroying = true;
-
- me.reader = me.writer = Ext.destroy(me.reader, me.writer);
- me.callParent();
- me.destroying = false;
- me.destroyed = true;
- }
- });
- Ext.define('Ext.data.proxy.Ajax', {
- extend: Ext.data.proxy.Server,
- alias: 'proxy.ajax',
- alternateClassName: [
- 'Ext.data.HttpProxy',
- 'Ext.data.AjaxProxy'
- ],
- isAjaxProxy: true,
-
-
-
-
- defaultActionMethods: {
- create: 'POST',
- read: 'GET',
- update: 'POST',
- destroy: 'POST'
- },
- config: {
-
- binary: false,
-
- headers: undefined,
-
- paramsAsJson: false,
-
- withCredentials: false,
-
- useDefaultXhrHeader: true,
-
- username: null,
-
- password: null,
-
- actionMethods: {
- create: 'POST',
- read: 'GET',
- update: 'POST',
- destroy: 'POST'
- }
- },
- doRequest: function(operation) {
- var me = this,
- writer = me.getWriter(),
- request = me.buildRequest(operation),
- method = me.getMethod(request),
- jsonData, params;
- if (writer && operation.allowWrite()) {
- request = writer.write(request);
- }
- request.setConfig({
- binary: me.getBinary(),
- headers: me.getHeaders(),
- timeout: me.getTimeout(),
- scope: me,
- callback: me.createRequestCallback(request, operation),
- method: method,
- useDefaultXhrHeader: me.getUseDefaultXhrHeader(),
- disableCaching: false
- });
-
- if (me.responseType != null && Ext.supports.XHR2) {
- request.setResponseType(me.responseType);
- }
- if (method.toUpperCase() !== 'GET' && me.getParamsAsJson()) {
- params = request.getParams();
- if (params) {
- jsonData = request.getJsonData();
- if (jsonData) {
- jsonData = Ext.Object.merge({}, jsonData, params);
- } else {
- jsonData = params;
- }
- request.setJsonData(jsonData);
- request.setParams(undefined);
- }
- }
- if (me.getWithCredentials()) {
- request.setWithCredentials(true);
- request.setUsername(me.getUsername());
- request.setPassword(me.getPassword());
- }
- return me.sendRequest(request);
- },
-
- sendRequest: function(request) {
- request.setRawRequest(Ext.Ajax.request(request.getCurrentConfig()));
- this.lastRequest = request;
- return request;
- },
-
- abort: function(request) {
- request = request || this.lastRequest;
- if (request) {
- Ext.Ajax.abort(request.getRawRequest());
- }
- },
-
- getMethod: function(request) {
- var actions = this.getActionMethods(),
- action = request.getAction(),
- method;
- if (actions) {
- method = actions[action];
- }
- return method || this.defaultActionMethods[action];
- },
-
- createRequestCallback: function(request, operation) {
- return function(options, success, response) {
- var me = this;
- if (request === me.lastRequest) {
- me.lastRequest = null;
- }
- if (!me.destroying && !me.destroyed) {
- me.processResponse(success, operation, request, response);
- }
- };
- },
- destroy: function() {
- this.lastRequest = null;
- this.callParent();
- }
- });
- Ext.define('Ext.data.reader.Json', {
- extend: Ext.data.reader.Reader,
- alternateClassName: 'Ext.data.JsonReader',
- alias: 'reader.json',
- config: {
-
- record: null,
-
- metaProperty: 'metaData',
-
- useSimpleAccessors: false,
-
- preserveRawData: false
- },
-
- responseType: 'json',
- updateRootProperty: function() {
- this.forceBuildExtractors();
- },
- updateMetaProperty: function() {
- this.forceBuildExtractors();
- },
-
- getResponseData: function(response) {
- var error;
- if (typeof response.responseJson === 'object') {
- return response.responseJson;
- }
- try {
- return Ext.decode(response.responseText);
- } catch (ex) {
- error = this.createReadError(ex.message);
- Ext.Logger.warn('Unable to parse the JSON returned by the server');
- this.fireEvent('exception', this, response, error);
- return error;
- }
- },
- buildExtractors: function(force) {
- var me = this,
- emptyFn = Ext.emptyFn,
- prop;
-
- if (me.callParent([
- force
- ])) {
- me.getRoot = me.setupExtractor(me.getRootProperty(), Ext.identityFn);
- me.getGroupRoot = me.setupExtractor(me.getGroupRootProperty(), emptyFn);
- me.getSummaryRoot = me.setupExtractor(me.getSummaryRootProperty(), emptyFn);
- me.getMeta = me.setupExtractor(me.getMetaProperty(), emptyFn);
- }
- },
-
- extractData: function(root, readOptions) {
- var recordName = this.getRecord(),
- data = [],
- length, i;
- if (recordName) {
- length = root.length;
- if (!length && Ext.isObject(root)) {
- length = 1;
- root = [
- root
- ];
- }
- for (i = 0; i < length; i++) {
- data[i] = root[i][recordName];
- }
- } else {
- data = root;
- }
- return this.callParent([
- data,
- readOptions
- ]);
- },
- getModelData: function(raw) {
- return this.getPreserveRawData() ? Ext.apply({}, raw) : raw;
- },
-
- createAccessor: (function() {
- var re = /[\[\.]/;
- return function(expr) {
- var simple = this.getUseSimpleAccessors(),
- operatorIndex, result, current, parts, part, inExpr, isDot, isLeft, isRight, special, c, i, bracketed, len;
- if (!(expr || expr === 0)) {
- return;
- }
- if (typeof expr === 'function') {
- return expr;
- }
- if (!simple) {
- operatorIndex = String(expr).search(re);
- }
- if (simple === true || operatorIndex < 0) {
- result = function(raw) {
- return raw == null ? null : raw[expr];
- };
- } else {
-
-
-
- current = 'raw';
- parts = [];
- part = '';
- inExpr = 0;
- len = expr.length;
-
-
-
- for (i = 0; i <= len; ++i) {
- c = expr[i];
- isDot = c === '.';
- isLeft = c === '[';
- isRight = c === ']';
- special = isDot || isLeft || isRight || !c;
-
-
-
-
-
- if (!special || inExpr > 1 || (inExpr && !isRight)) {
- part += c;
- } else if (special) {
- bracketed = false;
- if (isLeft) {
- ++inExpr;
- } else if (isRight) {
- --inExpr;
- bracketed = true;
- }
- if (part) {
- if (bracketed) {
- part = '[' + part + ']';
- } else {
- part = '.' + part;
- }
- current += part;
-
-
-
-
- parts.push('' + current);
- part = '';
- }
- }
- }
- result = parts.join(' && ');
- result = Ext.functionFactory('raw', 'return ' + result);
- }
- return result;
- };
- }()),
-
- createFieldAccessor: function(field) {
-
- var me = this,
- mapping = field.mapping,
- hasMap = mapping || mapping === 0,
- map = hasMap ? mapping : field.name;
- if (hasMap) {
- if (typeof map === 'function') {
- return function(raw, self) {
- return field.mapping(raw, self);
- };
- } else {
- return me.createAccessor(map);
- }
- }
- },
- getAccessorKey: function(prop) {
- var simple = this.getUseSimpleAccessors() ? 'simple' : '';
- return this.callParent([
- simple + prop
- ]);
- },
- privates: {
- copyFrom: function(reader) {
- this.callParent([
- reader
- ]);
- this.getRoot = reader.getRoot;
- },
- setupExtractor: function(prop, defaultFn) {
- return prop ? this.getAccessor(prop) : defaultFn;
- }
- }
- });
- Ext.define('Ext.data.writer.Json', {
- extend: Ext.data.writer.Writer,
- alternateClassName: 'Ext.data.JsonWriter',
- alias: 'writer.json',
- config: {
-
- rootProperty: undefined,
-
- encode: false,
-
- allowSingle: true,
-
- expandData: false
- },
-
- constructor: function(config) {
- if (config && config.hasOwnProperty('root')) {
- config = Ext.apply({}, config);
- config.rootProperty = config.root;
- delete config.root;
- Ext.log.warn('Ext.data.writer.Json: Using the deprecated "root" configuration. Use "rootProperty" instead.');
- }
- this.callParent([
- config
- ]);
- },
-
-
- getExpandedData: function(data) {
- var dataLength = data.length,
- i = 0,
- item, prop, nameParts, j, tempObj,
- toObject = function(name, value) {
- var o = {};
- o[name] = value;
- return o;
- };
- for (; i < dataLength; i++) {
- item = data[i];
- for (prop in item) {
- if (item.hasOwnProperty(prop)) {
-
- nameParts = prop.split('.');
- j = nameParts.length - 1;
- if (j > 0) {
-
-
- tempObj = item[prop];
- for (; j > 0; j--) {
-
-
-
- tempObj = toObject(nameParts[j], tempObj);
- }
-
-
-
- item[nameParts[0]] = item[nameParts[0]] || {};
-
-
- Ext.Object.merge(item[nameParts[0]], tempObj);
-
- delete item[prop];
- }
- }
- }
- }
- return data;
- },
- writeRecords: function(request, data) {
- var me = this,
- root = me.getRootProperty(),
- json, single, transform;
- if (me.getExpandData()) {
- data = me.getExpandedData(data);
- }
- if (me.getAllowSingle() && data.length === 1) {
-
- data = data[0];
- single = true;
- }
- transform = this.getTransform();
- if (transform) {
- data = transform(data, request);
- }
- if (me.getEncode()) {
- if (root) {
-
- request.setParam(root, Ext.encode(data));
- } else {
-
- Ext.raise('Must specify a root when using encode');
- }
- }
-
- else if (single || (data && data.length)) {
-
- json = request.getJsonData() || {};
- if (root) {
- json[root] = data;
- } else {
- json = data;
- }
- request.setJsonData(json);
- }
- return request;
- }
- });
- Ext.define('Ext.util.SorterCollection', {
- extend: Ext.util.Collection,
- isSorterCollection: true,
-
- $sortable: null,
-
- sortFn: null,
- config: {
-
- sorterOptionsFn: null,
-
- sorterOptionsScope: null
- },
- constructor: function(config) {
- var me = this;
- me.sortFn = Ext.util.Sorter.createComparator(me);
- me.callParent([
- config
- ]);
- me.setDecoder(me.decodeSorter);
- },
- addSort: function(property, direction, mode) {
- var me = this,
- count, index, limit, options, primary, sorter, sorters;
- if (!property) {
-
- me.beginUpdate();
- me.endUpdate();
- } else {
- options = me.getOptions();
- if (property instanceof Array) {
- sorters = property;
- mode = direction;
- direction = null;
- } else if (Ext.isString(property)) {
- if (!(sorter = me.get(property))) {
- sorters = [
- {
- property: property,
- direction: direction || options.getDefaultSortDirection()
- }
- ];
- } else {
- sorters = [
- sorter
- ];
- }
- } else if (Ext.isFunction(property)) {
- sorters = [
- {
- sorterFn: property,
- direction: direction || options.getDefaultSortDirection()
- }
- ];
- } else {
-
- if (!Ext.isObject(property)) {
- Ext.raise('Invalid sort descriptor: ' + property);
- }
-
- sorters = [
- property
- ];
- mode = direction;
- direction = null;
- }
-
- if (mode && !me._sortModes[mode]) {
- Ext.raise('Sort mode should be "multi", "append", "prepend" or "replace", not "' + mode + '"');
- }
-
- mode = me._sortModes[mode || 'replace'];
- primary = me.getAt(0);
- count = me.length;
- index = mode.append ? count : 0;
-
-
- me.beginUpdate();
-
-
- me.splice(index, mode.replace ? count : 0, sorters);
- if (mode.multi) {
- count = me.length;
- limit = options.getMultiSortLimit();
- if (count > limit) {
- me.removeAt(limit, count);
- }
- }
-
- if (sorter && direction) {
- sorter.setDirection(direction);
- } else if (index === 0 && primary && primary === me.getAt(0)) {
-
-
- primary.toggle();
- }
- me.endUpdate();
- }
- },
- clear: function() {
-
-
- this.beginUpdate();
- this.callParent();
- this.endUpdate(this.items);
- },
-
- getSortFn: function() {
- return this.sortFn;
- },
-
- getByProperty: function(prop) {
- var items = this.items,
- len = items.length,
- i, item;
- for (i = 0; i < len; ++i) {
- item = items[i];
- if (item.getProperty() === prop) {
- return item;
- }
- }
- return null;
- },
-
-
- _sortModes: {
- append: {
- append: 1
- },
- multi: {
- multi: 1
- },
- prepend: {
- prepend: 1
- },
- replace: {
- replace: 1
- }
- },
- decodeSorter: function(sorter, xclass) {
- var me = this,
- options = me.getOptions(),
- root = options.getRootProperty(),
- sorterOptionsFn = me.getSorterOptionsFn(),
- currentSorter, sorterConfig, type;
- if (sorter.isSorter) {
- if (!sorter.getRoot()) {
- sorter.setRoot(root);
- }
- } else {
- sorterConfig = {
- direction: options.getDefaultSortDirection(),
- root: root
- };
- type = typeof sorter;
-
- if (type === 'string') {
- currentSorter = me.get(sorter);
- if (currentSorter) {
- return currentSorter;
- }
- sorterConfig.property = sorter;
- }
-
- else if (type === 'function') {
- sorterConfig.sorterFn = sorter;
- } else
-
- {
-
-
- if (!Ext.isObject(sorter)) {
- Ext.raise('Invalid sorter specified: ' + sorter);
- }
-
- sorterConfig = Ext.apply(sorterConfig, sorter);
- if (sorterConfig.fn) {
- sorterConfig.sorterFn = sorterConfig.fn;
- delete sorterConfig.fn;
- }
- }
-
- sorter = Ext.create(xclass || Ext.util.Sorter, sorterConfig);
- }
- if (sorterOptionsFn) {
- sorterOptionsFn.call(me.getSorterOptionsScope() || me, sorter);
- }
- return sorter;
- },
- setSorterConfigure: function(fn, scope) {
- this.setSorterOptionsFn(fn);
- this.setSorterOptionsScope(scope);
- },
- decodeRemoveItems: function(args, index) {
- var me = this,
- ret = (index === undefined) ? args : args[index];
- if (!ret || !ret.$cloned) {
- if (args.length > index + 1 || !Ext.isIterable(ret)) {
- ret = Ext.Array.slice(args, index);
- }
- var currentSorters = me.items,
- ln = ret.length,
- remove = [],
- i, item, n, sorter, type;
- for (i = 0; i < ln; i++) {
- sorter = ret[i];
- if (sorter && sorter.isSorter) {
- remove.push(sorter);
- } else {
- type = typeof sorter;
- if (type === 'string') {
- sorter = me.get(sorter);
- if (sorter) {
- remove.push(sorter);
- }
- } else if (type === 'function') {
- for (n = currentSorters.length; n-- > 0; ) {
- item = currentSorters[n];
- if (item.getSorterFn() === sorter) {
- remove.push(item);
- }
- }
- } else
- {
- Ext.raise('Invalid sorter specification: ' + sorter);
- }
- }
- }
-
- ret = remove;
- ret.$cloned = true;
- }
- return ret;
- },
- getOptions: function() {
-
-
-
-
- return this.$sortable || this;
- }
- });
- Ext.define('Ext.util.FilterCollection', {
- extend: Ext.util.Collection,
- isFilterCollection: true,
-
- $filterable: null,
-
- filterFn: null,
- constructor: function(config) {
- var me = this;
-
-
- me.filterFn = Ext.util.Filter.createFilterFn(me);
- me.callParent([
- config
- ]);
- me.setDecoder(me.decodeFilter);
- },
-
- filterData: function(data) {
- return this.filtered ? Ext.Array.filter(data, this.filterFn) : data;
- },
-
- getFilterFn: function() {
- return this.filterFn;
- },
- isItemFiltered: function(item) {
- return !this.filterFn(item);
- },
-
- getFilterCount: function() {
- var filters = this.items,
- len = filters.length,
- i;
- for (i = len - 1; i >= 0; i--) {
- if (filters[i].getDisabled()) {
- len--;
- }
- }
- return len;
- },
-
-
- decodeFilter: function(filter) {
- var options = this.getOptions(),
- filterRoot = options.getRootProperty(),
- filterConfig;
- if (filter.isFilter) {
- if (!filter.getRoot()) {
- filter.setRoot(filterRoot);
- }
- } else {
- filterConfig = {
- root: filterRoot
- };
- if (Ext.isFunction(filter)) {
- filterConfig.filterFn = filter;
- } else
-
- {
-
-
- if (!Ext.isObject(filter)) {
- Ext.raise('Invalid filter specified: ' + filter);
- }
-
- filterConfig = Ext.apply(filterConfig, filter);
- if (filterConfig.fn) {
- filterConfig.filterFn = filterConfig.fn;
- delete filterConfig.fn;
- }
- if (Ext.util.Filter.isInvalid(filterConfig)) {
- return false;
- }
- }
- filter = new Ext.util.Filter(filterConfig);
- }
- return filter;
- },
- decodeRemoveItems: function(args, index) {
- var me = this,
- ret = (index === undefined) ? args : args[index];
- if (!ret.$cloned) {
- if (args.length > index + 1 || !Ext.isIterable(ret)) {
- ret = Ext.Array.slice(args, index);
- }
- var currentFilters = me.items,
- ln = ret.length,
- remove = [],
- filter, i, isFunction, isProp, isString, item, match, n, type;
- for (i = 0; i < ln; i++) {
- filter = ret[i];
- if (filter && filter.isFilter) {
- remove.push(filter);
- } else {
- type = typeof filter;
- isFunction = type === 'function';
- isProp = filter.property !== undefined && filter.value !== undefined;
- isString = type === 'string';
-
- if (!isFunction && !isProp && !isString) {
- Ext.raise('Invalid filter specification: ' + filter);
- }
-
- for (n = currentFilters.length; n-- > 0; ) {
- item = currentFilters[n];
- match = false;
- if (isString) {
- match = item.getProperty() === filter;
- } else if (isFunction) {
- match = item.getFilterFn() === filter;
- } else if (isProp) {
- match = item.getProperty() === filter.property && item.getValue() === filter.value;
- }
- if (match) {
- remove.push(item);
- }
- }
- }
- }
- ret = remove;
- ret.$cloned = true;
- }
- return ret;
- },
- getOptions: function() {
-
-
-
-
- return this.$filterable || this;
- }
- });
- Ext.define('Ext.util.GroupCollection', {
- extend: Ext.util.Collection,
- isGroupCollection: true,
- config: {
- grouper: null,
- groupConfig: null,
- itemRoot: null
- },
- observerPriority: -100,
- emptyGroupRetainTime: 300000,
-
- constructor: function(config) {
- this.emptyGroups = {};
- this.callParent([
- config
- ]);
- this.on('remove', 'onGroupRemove', this);
- },
-
- getItemGroup: function(item) {
- var key = this.getGrouper().getGroupString(item);
- return this.get(key);
- },
-
-
- onCollectionAdd: function(source, details) {
- if (!this.isConfiguring) {
- this.addItemsToGroups(source, details.items, details.at);
- }
- },
- onCollectionBeforeItemChange: function(source, details) {
- this.changeDetails = details;
- },
- onCollectionBeginUpdate: function() {
- this.beginUpdate();
- },
- onCollectionEndUpdate: function() {
- this.endUpdate();
- },
- onCollectionItemChange: function(source, details) {
-
-
-
- if (!details.indexChanged) {
- this.syncItemGrouping(source, details);
- }
- this.changeDetails = null;
- },
- onCollectionRefresh: function(source) {
- if (source.generation) {
- var me = this,
- itemGroupKeys = me.itemGroupKeys = {},
- groupData = me.createEntries(source, source.items),
- entries = groupData.entries,
- groupKey, i, len, entry, j;
-
- for (i = 0 , len = entries.length; i < len; ++i) {
- entry = entries[i];
-
- entry.group.splice(0, 1.0E99, entry.items);
-
- for (j = 0; j < entry.items.length; j++) {
- itemGroupKeys[source.getKey(entry.items[j])] = entry.group;
- }
- }
-
- entries = null;
- for (groupKey in me.map) {
- if (!(groupKey in groupData.groups)) {
- (entries || (entries = [])).push(me.map[groupKey]);
- }
- }
- if (entries) {
- me.remove(entries);
- }
-
-
- me.sortItems();
- }
- },
- onCollectionRemove: function(source, details) {
- var me = this,
- changeDetails = me.changeDetails,
- itemGroupKeys = me.itemGroupKeys || (me.itemGroupKeys = {}),
- entries, entry, group, i, n, j, removeGroups, item;
- if (source.getCount()) {
- if (changeDetails) {
-
-
- item = changeDetails.item || changeDetails.items[0];
- entries = me.createEntries(source, [
- item
- ]).entries;
- entries[0].group = itemGroupKeys['oldKey' in details ? details.oldKey : source.getKey(item)];
- } else {
- entries = me.createEntries(source, details.items).entries;
- }
- for (i = 0 , n = entries.length; i < n; ++i) {
- group = (entry = entries[i]).group;
- if (group) {
- group.remove(entry.items);
- }
-
- for (j = 0; j < entry.items.length; j++) {
- delete itemGroupKeys[source.getKey(entry.items[j])];
- }
- if (group && !group.length) {
- (removeGroups || (removeGroups = [])).push(group);
- }
- }
- } else
- {
- me.itemGroupKeys = {};
- removeGroups = me.items;
- for (i = 0 , n = removeGroups.length; i < n; ++i) {
- removeGroups[i].clear();
- }
- }
- if (removeGroups) {
- me.remove(removeGroups);
- }
- },
-
-
-
- onCollectionSort: function(source) {
-
- var me = this,
- sorters = source.getSorters(false),
- items, length, i, group;
- if (sorters) {
- items = me.items;
- length = me.length;
- for (i = 0; i < length; ++i) {
- group = items[i];
- if (group.getSorters() !== sorters) {
- group.setSorters(sorters);
- }
- }
- }
- },
- onCollectionUpdateKey: function(source, details) {
- if (!details.indexChanged) {
- details.oldIndex = source.indexOf(details.item);
- this.syncItemGrouping(source, details);
- }
- },
-
-
- addItemsToGroups: function(source, items, at, oldIndex) {
- var me = this,
- itemGroupKeys = me.itemGroupKeys || (me.itemGroupKeys = {}),
- entries = me.createEntries(source, items).entries,
- index = -1,
- sourceStartIndex, entry, i, len, j, group, firstIndex, item;
- for (i = 0 , len = entries.length; i < len; ++i) {
- entry = entries[i];
- group = entry.group;
-
- if (oldIndex || oldIndex === 0) {
- item = items[0];
- if (group.getCount() > 0 && source.getSorters().getCount() === 0) {
-
-
- firstIndex = source.indexOf(group.items[0]);
- if (oldIndex < firstIndex) {
- index = 0;
- } else {
- index = oldIndex - firstIndex;
- }
- }
- if (index === -1) {
- group.add(item);
- } else {
- group.insert(index, item);
- }
- } else {
- if (me.length > 1 && at) {
- sourceStartIndex = source.indexOf(entries[0].group.getAt(0));
- at = Math.max(at - sourceStartIndex, 0);
- }
- entry.group.insert(at != null ? at : group.items.length, entry.items);
-
- for (j = 0; j < entry.items.length; j++) {
- itemGroupKeys[source.getKey(entry.items[j])] = entry.group;
- }
- }
- }
-
-
- me.sortItems();
- },
- createEntries: function(source, items) {
-
- var me = this,
- groups = {},
- entries = [],
- grouper = me.getGrouper(),
- entry, group, groupKey, i, item, len;
- for (i = 0 , len = items.length; i < len; ++i) {
- groupKey = grouper.getGroupString(item = items[i]);
- if (!(entry = groups[groupKey])) {
- group = me.getGroup(source, groupKey);
- entries.push(groups[groupKey] = entry = {
- group: group,
- items: []
- });
- }
-
-
- entry.items.push(item);
- }
- return {
- groups: groups,
- entries: entries
- };
- },
- syncItemGrouping: function(source, details) {
- var me = this,
- itemGroupKeys = me.itemGroupKeys || (me.itemGroupKeys = {}),
- item = details.item,
- oldKey, itemKey, oldGroup, group;
- itemKey = source.getKey(item);
- oldKey = 'oldKey' in details ? details.oldKey : itemKey;
-
- oldGroup = itemGroupKeys[oldKey];
-
- group = me.getGroup(source, me.getGrouper().getGroupString(item));
- details.group = group;
- details.oldGroup = oldGroup;
-
- if (!(details.groupChanged = group !== oldGroup)) {
-
- oldGroup.itemChanged(item, details.modified, details.oldKey, details);
- } else {
-
- if (oldGroup) {
-
- oldGroup.updateKey(item, oldKey, itemKey);
- oldGroup.remove(item);
-
- if (!oldGroup.length) {
- me.remove(oldGroup);
- }
- }
-
- me.addItemsToGroups(source, [
- item
- ], null, details.oldIndex);
- }
-
- delete itemGroupKeys[oldKey];
- itemGroupKeys[itemKey] = group;
- },
- getGroup: function(source, key) {
- var me = this,
- group = me.get(key),
- autoSort = me.getAutoSort();
- if (group) {
- group.setSorters(source.getSorters());
- } else {
- group = me.emptyGroups[key] || Ext.create(Ext.apply({
- xclass: 'Ext.util.Group',
- groupKey: key,
- rootProperty: me.getItemRoot(),
- sorters: source.getSorters()
- }, me.getGroupConfig()));
- group.ejectTime = null;
- me.setAutoSort(false);
- me.add(group);
- me.setAutoSort(autoSort);
- }
- return group;
- },
- getKey: function(item) {
- return item.getGroupKey();
- },
- createSortFn: function() {
- var me = this,
- grouper = me.getGrouper(),
- sorterFn = me.getSorters().getSortFn();
- if (!grouper) {
- return sorterFn;
- }
- return function(lhs, rhs) {
-
-
-
- return grouper.sort(lhs.items[0], rhs.items[0]) || sorterFn(lhs, rhs);
- };
- },
- updateGrouper: function(grouper) {
- var me = this;
- me.grouped = !!(grouper && me.$groupable.getAutoGroup());
- me.onSorterChange();
- me.onEndUpdateSorters(me.getSorters());
- },
- destroy: function() {
- var me = this;
- me.$groupable = null;
-
-
- me.destroyGroups(me.items);
- Ext.undefer(me.checkRemoveQueueTimer);
- me.callParent();
- },
- privates: {
- destroyGroups: function(groups) {
- var len = groups.length,
- i;
- for (i = 0; i < len; ++i) {
- groups[i].destroy();
- }
- },
- onGroupRemove: function(collection, info) {
- var me = this,
- groups = info.items,
- emptyGroups = me.emptyGroups,
- len, group, i;
- groups = Ext.Array.from(groups);
- for (i = 0 , len = groups.length; i < len; i++) {
- group = groups[i];
- group.setSorters(null);
- emptyGroups[group.getGroupKey()] = group;
- group.ejectTime = Ext.now();
- }
-
- me.checkRemoveQueue();
- },
- checkRemoveQueue: function() {
- var me = this,
- emptyGroups = me.emptyGroups,
- groupKey, group, reschedule;
- for (groupKey in emptyGroups) {
- group = emptyGroups[groupKey];
-
- if (!group.getCount() && Ext.now() - group.ejectTime > me.emptyGroupRetainTime) {
- Ext.destroy(group);
- delete emptyGroups[groupKey];
- } else {
- reschedule = true;
- }
- }
-
- if (reschedule) {
- Ext.undefer(me.checkRemoveQueueTimer);
- me.checkRemoveQueueTimer = Ext.defer(me.checkRemoveQueue, me.emptyGroupRetainTime, me);
- }
- }
- }
- });
- Ext.define('Ext.data.Store', {
- extend: Ext.data.ProxyStore,
- alias: 'store.store',
- mixins: [
- Ext.data.LocalStore
- ],
- config: {
-
- data: undefined,
-
-
- clearRemovedOnLoad: true,
-
- clearOnPageLoad: true,
-
- associatedEntity: null,
-
- role: null,
-
- session: null
- },
-
-
- addRecordsOptions: {
- addRecords: true
- },
-
- loadCount: 0,
-
- complete: false,
- moveMapCount: 0,
-
- constructor: function(config) {
- var me = this,
- data;
- if (config) {
- if (config.buffered) {
-
- if (this.self !== Ext.data.Store) {
- Ext.raise('buffered config not supported on derived Store classes. ' + 'Please derive from Ext.data.BufferedStore.');
- }
-
-
- return new Ext.data['BufferedStore'](config);
- }
-
- if (config.remoteGroup) {
- Ext.log.warn('Ext.data.Store: remoteGroup has been removed. Use remoteSort instead.');
- }
- }
-
-
-
-
-
- me.callParent([
- config
- ]);
-
- data = me.inlineData;
- if (data) {
- delete me.inlineData;
- me.loadInlineData(data);
- }
- },
-
-
- applyData: function(data, dataCollection) {
-
-
-
- var me = this;
-
- me.getFields();
- me.getModel();
-
- if (data && data.isCollection) {
- dataCollection = data;
- } else {
- if (!dataCollection) {
- dataCollection = me.constructDataCollection();
- }
- if (data) {
- if (me.isInitializing) {
-
-
-
-
-
-
-
-
- me.inlineData = data;
- } else {
-
-
- me.loadData(data);
- }
- }
- }
- return dataCollection;
- },
- loadInlineData: function(data) {
- var me = this,
- proxy = me.getProxy();
- if (proxy && proxy.isMemoryProxy) {
- proxy.setData(data);
-
- me.suspendEvents();
- me.read();
- me.resumeEvents();
- } else {
-
- me.removeAll(true);
-
-
-
- me.suspendEvents();
- me.loadData(data);
- me.resumeEvents();
- }
- },
-
- onCollectionAdd: function(collection, info) {
- this.loadCount = this.loadCount || 1;
- this.onCollectionAddItems(collection, info.items, info);
- },
- onCollectionFilterAdd: function(collection, items) {
- this.onCollectionAddItems(collection, items);
- },
- onCollectionAddItems: function(collection, records, info) {
- var me = this,
- len = records.length,
- lastChunk = info ? !info.next : false,
-
-
-
-
- removed = me.removed,
- ignoreAdd = me.ignoreCollectionAdd,
- session = me.getSession(),
- replaced = info && info.replaced,
- i, sync, record, replacedItems;
-
-
-
- if (me.activeRanges) {
- me.syncActiveRanges();
- }
- for (i = 0; i < len; ++i) {
- record = records[i];
- if (session) {
- session.adopt(record);
- }
-
-
- if (!ignoreAdd) {
- record.join(me);
- if (removed && removed.length) {
- Ext.Array.remove(removed, record);
- }
- sync = sync || record.phantom || record.dirty;
- }
- }
- if (ignoreAdd) {
- return;
- }
- if (replaced) {
- replacedItems = [];
- do {
- Ext.Array.push(replacedItems, replaced.items);
- replaced = replaced.next;
- } while (replaced);
- me.setMoving(replacedItems, true);
- }
- if (info) {
-
-
-
-
- if (info.replaced) {
- if (lastChunk) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- } else {
- me.fireEvent('add', me, records, info.at);
-
-
-
- if (lastChunk) {
- me.fireEvent('datachanged', me);
- }
- }
- }
- if (replacedItems) {
- me.setMoving(replacedItems, false);
- }
-
- me.needsSync = me.needsSync || sync;
- },
- onCollectionBeforeItemChange: function(collection, info) {
- var record = info.item,
- modifiedFieldNames = info.modified || null,
- type = info.meta;
-
- this.fireEvent('beforeupdate', this, record, type, modifiedFieldNames, info);
- },
-
- onCollectionFilteredItemChange: function() {
- this.onCollectionItemChange.apply(this, arguments);
- },
- onCollectionItemChange: function(collection, info) {
- var me = this,
- record = info.item,
- modifiedFieldNames = info.modified || null,
- type = info.meta;
- if (me.fireChangeEvent(record)) {
-
-
-
- me.onUpdate(record, type, modifiedFieldNames, info);
- me.fireEvent('update', me, record, type, modifiedFieldNames, info);
- me.fireEvent('datachanged', me);
- }
- },
- afterChange: function(record, modifiedFieldNames, type) {
- this.getData().itemChanged(record, modifiedFieldNames || null, undefined, type);
- },
- afterCommit: function(record, modifiedFieldNames) {
- this.afterChange(record, modifiedFieldNames, Ext.data.Model.COMMIT);
- },
- afterEdit: function(record, modifiedFieldNames) {
- this.needsSync = this.needsSync || record.dirty;
- this.afterChange(record, modifiedFieldNames, Ext.data.Model.EDIT);
- },
- afterReject: function(record) {
- this.afterChange(record, null, Ext.data.Model.REJECT);
- },
- afterDrop: function(record) {
- this.getData().remove(record);
- },
- afterErase: function(record) {
- this.removeFromRemoved(record);
- },
-
-
- addSorted: function(record) {
- var me = this,
- remote = me.getRemoteSort(),
- data = me.getData(),
- index;
- if (remote) {
- data.setSorters(me.getSorters());
- }
- index = data.findInsertionIndex(record);
- if (remote) {
- data.setSorters(null);
- }
- return me.insert(index, record);
- },
-
- remove: function(records, isMove, silent) {
- var me = this,
- data = me.getDataSource(),
- len, i, toRemove, record;
- if (records) {
- if (records.isModel) {
- if (data.indexOf(records) > -1) {
- toRemove = [
- records
- ];
- len = 1;
- } else {
- len = 0;
- }
- } else {
- toRemove = [];
- for (i = 0 , len = records.length; i < len; ++i) {
- record = records[i];
- if (record && record.isEntity) {
- if (!data.contains(record)) {
-
- continue;
- }
- } else if (!(record = data.getAt(record))) {
-
-
- continue;
- }
- toRemove.push(record);
- }
- len = toRemove.length;
- }
- }
- if (!len) {
- return [];
- }
- me.removeIsMove = isMove === true;
- me.removeIsSilent = silent;
- data.remove(toRemove);
- me.removeIsSilent = false;
- return toRemove;
- },
- onCollectionRemove: function(collection, info) {
- var me = this,
-
-
-
-
- removed = me.removed,
- records = info.items,
- len = records.length,
- index = info.at,
- replacement = info.replacement,
- isMove = me.removeIsMove || (replacement && Ext.Array.equals(records, replacement.items)),
- silent = me.removeIsSilent,
- lastChunk = !info.next,
- data = me.getDataSource(),
- i, record;
- if (me.ignoreCollectionRemove) {
- return;
- }
- if (replacement) {
- me.setMoving(replacement.items, true);
- }
- for (i = len - 1; i >= 0; i--) {
- record = records[i];
-
-
- if (!data.contains(record)) {
-
-
- if (removed && !isMove && !record.phantom && !record.erasing) {
-
-
- record.removedFrom = index + i;
- removed.push(record);
-
-
- me.needsSync = true;
- } else {
-
-
- record.unjoin(me);
- }
- }
- }
- if (!silent) {
-
-
-
-
-
-
-
-
-
- if (!replacement || !replacement.items.length) {
- me.fireEvent('remove', me, records, index, isMove);
-
-
-
- if (lastChunk) {
- me.fireEvent('datachanged', me);
- }
- }
- }
- if (replacement) {
- me.setMoving(replacement.items, false);
- }
- },
- onFilterEndUpdate: function() {
- var me = this;
- if (me.destroying || me.destroyed) {
- return;
- }
-
-
-
- if (me.activeRanges) {
- me.syncActiveRanges();
- }
- me.callParent(arguments);
- me.callObservers('Filter');
- },
-
- removeAt: function(index, count) {
- var data = this.getData();
-
- index = Math.max(index, 0);
- if (index < data.length) {
- if (arguments.length === 1) {
- count = 1;
- } else if (!count) {
- return;
- }
- data.removeAt(index, count);
- }
- },
-
- removeAll: function(silent) {
- var me = this,
- data = me.getData(),
- records = data.getRange();
-
- if (data.length) {
-
- me.removeIsSilent = true;
- me.callObservers('BeforeRemoveAll');
- data.removeAll();
- me.removeIsSilent = false;
- if (!silent) {
- me.fireEvent('clear', me, records);
- me.fireEvent('datachanged', me);
- }
- me.callObservers('AfterRemoveAll', [
- !!silent
- ]);
- }
- return records;
- },
-
- setRecords: function(records) {
- var count = this.getCount();
- ++this.loadCount;
- if (count) {
- this.getData().splice(0, count, records);
- } else {
- this.add(records);
- }
- },
-
- splice: function(index, toRemove, toAdd) {
- return this.getData().splice(index, toRemove, toAdd);
- },
-
- onProxyLoad: function(operation) {
- var me = this,
- resultSet = operation.getResultSet(),
- records = operation.getRecords(),
- successful = operation.wasSuccessful();
- if (me.destroyed) {
- return;
- }
- if (resultSet) {
- me.totalCount = resultSet.getTotal();
- }
- if (successful) {
- records = me.processAssociation(records);
- me.loadRecords(records, operation.getAddRecords() ? {
- addRecords: true
- } : undefined);
- me.attachSummaryRecord(resultSet);
- } else {
- me.loading = false;
- }
- if (me.hasListeners.load) {
- me.fireEvent('load', me, records, successful, operation);
- }
- me.callObservers('AfterLoad', [
- records,
- successful,
- operation
- ]);
- },
- onProxyWrite: function(operation) {
- if (operation.wasSuccessful()) {
- this.attachSummaryRecord(operation.getResultSet());
- }
- this.callParent([
- operation
- ]);
- },
-
- filterDataSource: function(fn) {
- var source = this.getDataSource(),
- items = source.items,
- len = items.length,
- ret = [],
- i;
- for (i = 0; i < len; i++) {
- if (fn.call(source, items[i])) {
- ret.push(items[i]);
- }
- }
- return ret;
- },
- getNewRecords: function() {
- return this.filterDataSource(this.filterNew);
- },
- getRejectRecords: function() {
- return this.filterDataSource(this.filterRejects);
- },
- getUpdatedRecords: function() {
- return this.filterDataSource(this.filterUpdated);
- },
-
- loadData: function(data, append) {
- var me = this,
- length = data.length,
- newData = [],
- i;
-
- for (i = 0; i < length; i++) {
- newData.push(me.createModel(data[i]));
- }
- newData = me.processAssociation(newData);
- me.loadRecords(newData, append ? me.addRecordsOptions : undefined);
- },
-
- loadRawData: function(data, append) {
- var me = this,
- session = me.getSession(),
- result = me.getProxy().getReader().read(data, session ? {
- recordCreator: session.recordCreator
- } : undefined),
- records = result.getRecords(),
- success = result.getSuccess();
- if (success) {
- me.totalCount = result.getTotal();
- me.loadRecords(records, append ? me.addRecordsOptions : undefined);
- }
- return success;
- },
-
- loadRecords: function(records, options) {
- var me = this,
- length = records.length,
- data = me.getData(),
- addRecords, i, skipSort;
- if (options) {
- addRecords = options.addRecords;
- }
- if (!me.getRemoteSort() && !me.getSortOnLoad()) {
- skipSort = true;
- data.setAutoSort(false);
- }
- if (!addRecords) {
- me.clearData(true);
- }
-
-
- me.loading = false;
- me.ignoreCollectionAdd = true;
- me.callObservers('BeforePopulate');
- data.add(records);
- me.ignoreCollectionAdd = false;
- if (skipSort) {
- data.setAutoSort(true);
- }
- for (i = 0; i < length; i++) {
- records[i].join(me);
- }
- if (!me.isEmptyStore) {
- ++me.loadCount;
- me.complete = true;
- }
- if (me.hasListeners.datachanged) {
- me.fireEvent('datachanged', me);
- }
- if (me.hasListeners.refresh) {
- me.fireEvent('refresh', me);
- }
- me.callObservers('AfterPopulate');
- },
-
-
- loadPage: function(page, options) {
- var me = this,
- size = me.getPageSize();
- me.currentPage = page;
-
- options = Ext.apply({
- page: page,
- start: (page - 1) * size,
- limit: size,
- addRecords: !me.getClearOnPageLoad()
- }, options);
- me.read(options);
- },
-
- nextPage: function(options) {
- this.loadPage(this.currentPage + 1, options);
- },
-
- previousPage: function(options) {
- this.loadPage(this.currentPage - 1, options);
- },
-
- clearData: function(isLoad) {
- var me = this,
- removed = me.removed,
- data = me.getDataSource(),
- clearRemovedOnLoad = me.getClearRemovedOnLoad(),
- needsUnjoinCheck = removed && isLoad && !clearRemovedOnLoad,
- records, record, i, len;
-
-
-
-
-
- if (data) {
- records = data.items;
- for (i = 0 , len = records.length; i < len; ++i) {
- record = records[i];
- if (needsUnjoinCheck && Ext.Array.contains(removed, record)) {
-
- continue;
- }
- record.unjoin(me);
- }
- me.ignoreCollectionRemove = true;
- me.callObservers('BeforeClear');
- data.removeAll();
- me.ignoreCollectionRemove = false;
- me.callObservers('AfterClear');
- }
- if (removed && (!isLoad || clearRemovedOnLoad)) {
- removed.length = 0;
- }
- },
- onIdChanged: function(rec, oldId, newId) {
- this.getData().updateKey(rec, oldId);
-
- this.fireEvent('idchanged', this, rec, oldId, newId);
- },
-
- commitChanges: function() {
- var me = this,
- recs = me.getModifiedRecords(),
- len = recs.length,
- i = 0;
- Ext.suspendLayouts();
- me.beginUpdate();
- for (; i < len; i++) {
- recs[i].commit();
- }
- me.cleanRemoved();
- me.endUpdate();
- Ext.resumeLayouts(true);
-
- me.fireEvent('commit', me);
- },
- filterNewOnly: function(item) {
- return item.phantom === true;
- },
- filterRejects: function(item) {
- return item.phantom || item.dirty;
- },
-
- rejectChanges: function() {
- var me = this,
- recs = me.getRejectRecords(),
- len = recs.length,
- i, rec, toRemove, sorted, data, currentAutoSort;
- Ext.suspendLayouts();
- me.beginUpdate();
- for (i = 0; i < len; i++) {
- rec = recs[i];
- if (rec.phantom) {
- toRemove = toRemove || [];
- toRemove.push(rec);
- } else {
- rec.reject();
- }
- }
- if (toRemove) {
- me.remove(toRemove);
- for (i = 0 , len = toRemove.length; i < len; ++i) {
- toRemove[i].reject();
- }
- }
-
- recs = me.getRawRemovedRecords();
- if (recs) {
- len = recs.length;
- sorted = !me.getRemoteSort() && me.isSorted();
- if (sorted) {
-
-
- data = me.getData();
- currentAutoSort = data.getAutoSort();
- data.setAutoSort(false);
- }
- for (i = len - 1; i >= 0; i--) {
- rec = recs[i];
- rec.reject();
- if (!sorted) {
- me.insert(rec.removedFrom || 0, rec);
- }
- }
- if (sorted) {
-
- data.setAutoSort(currentAutoSort);
- me.add(recs);
- }
-
-
- recs.length = 0;
- }
- me.endUpdate();
- Ext.resumeLayouts(true);
-
- me.fireEvent('reject', me);
- },
- doDestroy: function() {
- var me = this,
- task = me.loadTask,
- data = me.getData(),
- source = data.getSource();
-
- me.clearData();
- me.setSession(null);
- me.observers = null;
- if (task) {
- task.cancel();
- me.loadTask = null;
- }
- if (source) {
- source.destroy();
- }
- me.callParent();
- },
- privates: {
- commitOptions: {
- commit: true
- },
- attachSummaryRecord: function(resultSet) {
- if (!resultSet) {
- return;
- }
- var me = this,
- summary = resultSet.getSummaryData(),
- grouper = me.getGrouper(),
- current = me.summaryRecord,
- commitOptions = me.commitOptions,
- groups, len, i, rec, group;
- if (summary) {
- if (current) {
- current.set(summary.data, commitOptions);
- } else {
- me.summaryRecord = summary;
- summary.isRemote = true;
- }
- }
- if (grouper) {
- summary = resultSet.getGroupData();
- if (summary) {
- groups = me.getGroups();
- for (i = 0 , len = summary.length; i < len; ++i) {
- rec = summary[i];
- group = groups.getItemGroup(rec);
- if (group) {
- current = group.summaryRecord;
- if (current) {
- current.set(rec.data, commitOptions);
- } else {
- group.summaryRecord = rec;
- rec.isRemote = true;
- }
- }
- }
- }
- }
- },
-
- fetch: function(options) {
- options = Ext.apply({}, options);
- this.setLoadOptions(options);
- var operation = this.createOperation('read', options);
- operation.execute();
- },
- fireChangeEvent: function(record) {
- return this.getDataSource().contains(record);
- },
- onBeforeLoad: function(operation) {
- this.callObservers('BeforeLoad', [
- operation
- ]);
- },
- onRemoteFilterSet: function(filters, remoteFilter) {
- if (filters) {
- this.getData().setFilters(remoteFilter ? null : filters);
- }
- this.callParent([
- filters,
- remoteFilter
- ]);
- },
- onRemoteSortSet: function(sorters, remoteSort) {
- var data = this.getData();
- if (sorters) {
- data.setSorters(remoteSort ? null : sorters);
- }
- data.setAutoGroup(!remoteSort);
- this.callParent([
- sorters,
- remoteSort
- ]);
- },
-
- isMoving: function(records, getMap) {
- var map = this.moveMap,
- moving = 0,
- len, i;
- if (map) {
- if (records) {
- if (Ext.isArray(records)) {
- for (i = 0 , len = records.length; i < len; ++i) {
- moving += map[records[i].id] ? 1 : 0;
- }
- } else if (map[records.id]) {
- ++moving;
- }
- } else {
- moving = getMap ? map : this.moveMapCount;
- }
- }
- return moving;
- },
- setLoadOptions: function(options) {
-
- var me = this,
- pageSize = me.getPageSize(),
- session, grouper;
- if (me.getRemoteSort() && !options.grouper) {
- grouper = me.getGrouper();
- if (grouper) {
- options.grouper = grouper;
- }
- }
- if (pageSize || 'start' in options || 'limit' in options || 'page' in options) {
- options.page = options.page != null ? options.page : me.currentPage;
- options.start = (options.start !== undefined) ? options.start : (options.page - 1) * pageSize;
- options.limit = options.limit != null ? options.limit : pageSize;
- me.currentPage = options.page;
- }
- options.addRecords = options.addRecords || false;
- if (!options.recordCreator) {
- session = me.getSession();
- if (session) {
- options.recordCreator = session.recordCreator;
- }
- }
- me.callParent([
- options
- ]);
- },
- setMoving: function(records, isMoving) {
- var me = this,
- map = me.moveMap || (me.moveMap = {}),
- len = records.length,
- i, id;
- for (i = 0; i < len; ++i) {
- id = records[i].id;
- if (isMoving) {
- if (map[id]) {
- ++map[id];
- } else {
- map[id] = 1;
- ++me.moveMapCount;
- }
- } else {
- if (--map[id] === 0) {
- delete map[id];
- --me.moveMapCount;
- }
- }
- }
- if (me.moveMapCount === 0) {
- me.moveMap = null;
- }
- },
- processAssociation: function(records) {
- var me = this,
- associatedEntity = me.getAssociatedEntity();
- if (associatedEntity) {
- records = me.getRole().processLoad(me, associatedEntity, records, me.getSession());
- }
- return records;
- }
- }
- });
- Ext.define('Ext.data.reader.Array', {
- extend: Ext.data.reader.Json,
- alternateClassName: 'Ext.data.ArrayReader',
- alias: 'reader.array',
-
- config: {
-
- totalProperty: undefined,
-
- successProperty: undefined
- },
-
-
- createFieldAccessor: function(field) {
-
-
- var oldMap = field.mapping,
- index = field.hasMapping() ? oldMap : field.ordinal,
- result;
-
- field.mapping = index;
- result = this.callParent(arguments);
- field.mapping = oldMap;
- return result;
- },
- getModelData: function(raw) {
-
- return {};
- }
- });
- Ext.define('Ext.data.ArrayStore', {
- extend: Ext.data.Store,
- alias: 'store.array',
- alternateClassName: [
- 'Ext.data.SimpleStore'
- ],
- config: {
- proxy: {
- type: 'memory',
- reader: 'array'
- }
- },
- loadData: function(data, append) {
- if (this.expandData) {
- var r = [],
- i = 0,
- ln = data.length;
- for (; i < ln; i++) {
- r[r.length] = [
- data[i]
- ];
- }
- data = r;
- }
- this.callParent([
- data,
- append
- ]);
- }
- });
- Ext.define('Ext.data.StoreManager', {
- extend: Ext.util.MixedCollection,
- alternateClassName: [
- 'Ext.StoreMgr',
- 'Ext.data.StoreMgr',
- 'Ext.StoreManager'
- ],
- singleton: true,
-
-
- register: function() {
- for (var i = 0,
- s; (s = arguments[i]); i++) {
- this.add(s);
- }
- },
-
- unregister: function() {
- for (var i = 0,
- s; (s = arguments[i]); i++) {
- this.remove(this.lookup(s));
- }
- },
-
- lookup: function(store, defaultType) {
-
- if (Ext.isArray(store)) {
- var first = store[0],
- data = store,
- arrays, fields, i, len;
- if (Ext.isObject(first)) {
-
- store = {
- data: data
- };
- } else {
- arrays = Ext.isArray(first);
- fields = [
- 'field1'
- ];
- if (arrays) {
-
- for (i = 2 , len = first.length; i <= len; ++i) {
- fields.push('field' + i);
- }
- } else {
-
- data = [];
- for (i = 0 , len = store.length; i < len; ++i) {
- data.push([
- store[i]
- ]);
- }
- }
- return new Ext.data.ArrayStore({
- data: data,
- fields: fields,
- autoDestroy: true,
- autoCreated: true,
- expanded: !arrays
- });
- }
- }
- if (Ext.isString(store)) {
-
- return this.get(store);
- } else {
-
- return Ext.Factory.store(store, defaultType);
- }
- },
-
- getKey: function(o) {
- return o.storeId;
- },
- addEmptyStore: function() {
-
-
-
- var emptyStore = this.$emptyStore,
- destoryable = {
- destroy: Ext.emptyFn
- };
- if (!emptyStore) {
- emptyStore = this.$emptyStore = Ext.regStore('ext-empty-store', {
- proxy: 'memory',
- useModelWarning: false
- });
- emptyStore.isEmptyStore = true;
- emptyStore.on = emptyStore.addListener = function() {
- return destoryable;
- };
- emptyStore.un = emptyStore.removeListener = Ext.emptyFn;
-
- emptyStore.add = emptyStore.remove = emptyStore.insert = emptyStore.destroy = emptyStore.loadData = function() {
- Ext.raise('Cannot modify ext-empty-store');
- };
- }
-
- this.add(emptyStore);
- },
- clear: function() {
- this.callParent();
- this.addEmptyStore();
- }
- }, function() {
-
- Ext.regStore = function(id, config) {
- var store;
- if (Ext.isObject(id)) {
- config = id;
- } else {
- if (Ext.data.StoreManager.containsKey(id)) {
- return Ext.data.StoreManager.lookup(id);
- }
- config.storeId = id;
- }
- if (config instanceof Ext.data.Store) {
- store = config;
- } else {
- store = new Ext.data.Store(config);
- }
- Ext.data.StoreManager.register(store);
- return store;
- };
-
- Ext.getStore = function(name) {
- return Ext.data.StoreManager.lookup(name);
- };
- Ext.data.StoreManager.addEmptyStore();
- });
- Ext.define('Ext.app.domain.Store', {
- extend: Ext.app.EventDomain,
- singleton: true,
- type: 'store',
- prefix: 'store.',
- idMatchRe: /^\#/,
- constructor: function() {
- var me = this;
- me.callParent();
- me.monitor(Ext.data.AbstractStore);
- },
- match: function(target, selector) {
- var result = false,
- alias = target.alias;
- if (selector === '*') {
- result = true;
- } else if (this.idMatchRe.test(selector)) {
- result = target.getStoreId() === selector.substring(1);
- } else if (alias) {
- result = Ext.Array.indexOf(alias, this.prefix + selector) > -1;
- }
- return result;
- }
- });
- Ext.define('Ext.app.Controller', {
- extend: Ext.app.BaseController,
- statics: {
- strings: {
- model: {
- getter: 'getModel',
- upper: 'Model'
- },
- view: {
- getter: 'getView',
- upper: 'View'
- },
- controller: {
- getter: 'getController',
- upper: 'Controller'
- },
- store: {
- getter: 'getStore',
- upper: 'Store'
- },
- profile: {
- getter: 'getProfile',
- upper: 'Profiles'
- }
- },
- controllerRegex: /^(.*)\.controller\./,
- profileRegex: /^(.*)\.profile\./,
- createGetter: function(baseGetter, name) {
- return function() {
- return this[baseGetter](name);
- };
- },
- getGetterName: function(name, kindUpper) {
- var fn = 'get',
- parts = name.split('.'),
- numParts = parts.length,
- index;
-
- for (index = 0; index < numParts; index++) {
- fn += Ext.String.capitalize(parts[index]);
- }
- fn += kindUpper;
- return fn;
- },
- resolveNamespace: function(cls, data) {
- var Controller = Ext.app.Controller,
- namespaceRe = cls.prototype.isProfile ? Controller.profileRegex : Controller.controllerRegex,
- className, namespace, match;
-
- className = Ext.getClassName(cls);
- namespace = data.$namespace || data.namespace || Ext.app.getNamespace(className) || ((match = namespaceRe.exec(className)) && match[1]);
-
- if (!namespace) {
- Ext.log.warn("Missing namespace for " + className + ", please define it " + "in namespaces property of your Application class.");
- }
-
- return namespace;
- },
-
- processDependencies: function(cls, requires, namespace, kind, names, profileName) {
- if (!names || !names.length) {
- return;
- }
- var me = this,
- strings = me.strings[kind],
- o, absoluteName, shortName, name, j, subLn, getterName, getter;
- if (!Ext.isArray(names)) {
- names = [
- names
- ];
- }
- for (j = 0 , subLn = names.length; j < subLn; j++) {
- name = names[j];
- o = me.getFullName(name, kind, namespace, profileName);
-
- names[j] = absoluteName = o.absoluteName;
- shortName = o.shortName;
- requires.push(absoluteName);
- getterName = me.getGetterName(shortName, strings.upper);
- if (!cls[getterName]) {
- cls[getterName] = getter = me.createGetter(strings.getter, name);
- }
-
- else if (getterName === 'getMainView') {
- Ext.log.warn('Cannot have a view named \'Main\' - getter conflicts with mainView config.');
- }
-
-
- if (getter && kind !== 'controller') {
-
-
-
-
- getter['Ext.app.getter'] = true;
- }
- }
- },
- getFullName: function(name, kind, namespace, profileName) {
- var shortName = name,
- sep, absoluteName;
- if ((sep = name.indexOf('@')) > 0) {
-
-
-
-
- shortName = name.substring(0, sep);
-
- absoluteName = name.substring(sep + 1) + '.' + shortName;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- else if (name.indexOf('.') > 0 && (Ext.ClassManager.isCreated(name) || this.hasRegisteredPrefix(name))) {
- absoluteName = name;
- shortName = name.replace(namespace + '.' + kind + '.', '');
- } else {
-
- if (!namespace) {
- Ext.log.warn("Cannot find namespace for " + kind + " " + name + ", " + "assuming it is fully qualified class name");
- }
-
- if (namespace) {
- absoluteName = namespace + '.' + kind + '.' + (profileName ? profileName + '.' + name : name);
- shortName = name;
- } else {
- absoluteName = name;
- }
- }
- return {
- absoluteName: absoluteName,
- shortName: shortName
- };
- },
- hasRegisteredPrefix: function(className) {
- var inventory = Ext.ClassManager,
- prefix = inventory.getPrefix(className);
-
- return prefix && prefix !== className;
- }
- },
-
-
- models: null,
-
-
- views: null,
-
-
- stores: null,
-
- controllers: null,
- config: {
-
- application: null,
-
- refs: null,
- active: true,
-
- moduleClassName: null
- },
- onClassExtended: function(cls, data, hooks) {
- var onBeforeClassCreated = hooks.onBeforeCreated;
- hooks.onBeforeCreated = function(cls, data) {
- var Controller = Ext.app.Controller,
- requires = [],
- namespace, proto;
- proto = cls.prototype;
- namespace = Controller.resolveNamespace(cls, data);
- if (namespace) {
- proto.$namespace = namespace;
- }
- Controller.processDependencies(proto, requires, namespace, 'model', data.models);
- Controller.processDependencies(proto, requires, namespace, 'view', data.views);
- Controller.processDependencies(proto, requires, namespace, 'store', data.stores);
- Controller.processDependencies(proto, requires, namespace, 'controller', data.controllers);
- Ext.require(requires, Ext.Function.pass(onBeforeClassCreated, arguments, this));
- };
- },
-
- constructor: function(config) {
- this.initAutoGetters();
- this.callParent([
- config
- ]);
- },
-
- normalizeRefs: function(refs) {
- var me = this,
- newRefs = [];
- if (refs) {
- if (Ext.isObject(refs)) {
- Ext.Object.each(refs, function(key, value) {
- if (Ext.isString(value)) {
- value = {
- selector: value
- };
- }
- value.ref = key;
- newRefs.push(value);
- });
- } else if (Ext.isArray(refs)) {
- newRefs = Ext.Array.merge(newRefs, refs);
- }
- }
- refs = me.refs;
- if (refs) {
- me.refs = null;
- refs = me.normalizeRefs(refs);
- if (refs) {
- newRefs = Ext.Array.merge(newRefs, refs);
- }
- }
- return newRefs;
- },
-
- getRefMap: function() {
- var me = this,
- refMap = me._refMap,
- refs, ref, ln, i;
- if (!refMap) {
- refs = me.getRefs();
- refMap = me._refMap = {};
- if (refs) {
- for (i = 0 , ln = refs.length; i < ln; i++) {
- ref = refs[i];
- refMap[ref.ref] = ref.selector;
- }
- }
- }
- return refMap;
- },
- applyId: function(id) {
- return id || Ext.app.Controller.getFullName(this.$className, 'controller', this.$namespace).shortName;
- },
- applyRefs: function(refs) {
- return this.normalizeRefs(Ext.clone(refs));
- },
-
- updateRefs: function(refs) {
- if (refs) {
- this.ref(refs);
- }
- },
- initAutoGetters: function() {
- var proto = this.self.prototype,
- prop, fn;
- for (prop in proto) {
- fn = proto[prop];
-
-
- if (fn && fn['Ext.app.getter']) {
- fn.call(this);
- }
- }
- },
- doInit: function(app) {
- var me = this;
- if (!me._initialized) {
- me.init(app);
- me._initialized = true;
- }
- },
- finishInit: function(app) {
- var me = this,
- controllers = me.controllers,
- controller, i, l;
- if (me._initialized && controllers && controllers.length) {
- for (i = 0 , l = controllers.length; i < l; i++) {
- controller = me.getController(controllers[i]);
- controller.finishInit(app);
- }
- }
- },
-
- init: Ext.emptyFn,
-
- onLaunch: Ext.emptyFn,
-
- activate: function() {
- this.setActive(true);
- },
-
- deactivate: function() {
- this.setActive(false);
- },
-
- isActive: function() {
- return this.getActive();
- },
- ref: function(refs) {
- var me = this,
- i = 0,
- length = refs.length,
- info, ref, fn;
- refs = Ext.Array.from(refs);
- me.references = me.references || [];
- for (; i < length; i++) {
- info = refs[i];
- ref = info.ref;
- fn = 'get' + Ext.String.capitalize(ref);
- if (!me[fn]) {
- me[fn] = Ext.Function.pass(me.getRef, [
- ref,
- info
- ], me);
- }
- me.references.push(ref.toLowerCase());
- }
- },
-
- addRef: function(refs) {
- this.ref(refs);
- },
- getRef: function(ref, info, config) {
- var me = this,
- refCache = me.refCache || (me.refCache = {}),
- cached = refCache[ref];
- info = info || {};
- config = config || {};
- Ext.apply(info, config);
- if (info.forceCreate) {
- return Ext.ComponentManager.create(info, 'component');
- }
- if (!cached) {
- if (info.selector) {
- refCache[ref] = cached = Ext.ComponentQuery.query(info.selector)[0];
- }
- if (!cached && info.autoCreate) {
- refCache[ref] = cached = Ext.ComponentManager.create(info, 'component');
- }
- if (cached) {
- cached.on('destroy', function() {
- refCache[ref] = null;
- });
- }
- }
- return cached;
- },
-
- hasRef: function(ref) {
- var references = this.references;
- return references && Ext.Array.indexOf(references, ref.toLowerCase()) !== -1;
- },
-
- getController: function(id) {
- var app = this.getApplication();
- if (id === this.getId()) {
- return this;
- }
- return app && app.getController(id);
- },
-
- getStore: function(name) {
- var storeId, store;
- storeId = (name.indexOf('@') === -1) ? name : name.split('@')[0];
- store = Ext.StoreManager.get(storeId);
- if (!store) {
- name = Ext.app.Controller.getFullName(name, 'store', this.$namespace);
- if (name) {
- store = Ext.create(name.absoluteName, {
-
-
- id: storeId
- });
- }
- }
- return store;
- },
-
- getModel: function(modelName) {
- var name = Ext.app.Controller.getFullName(modelName, 'model', this.$namespace),
- ret = Ext.ClassManager.get(name.absoluteName);
- if (!ret) {
- ret = Ext.data.schema.Schema.lookupEntity(modelName);
- }
- return ret;
- },
-
- getProfile: function(name) {
- name = Ext.app.Controller.getFullName(name, 'profile', this.$namespace);
- return name;
- },
-
- getView: function(view) {
- var name = Ext.app.Controller.getFullName(view, 'view', this.$namespace);
- return name && Ext.ClassManager.get(name.absoluteName);
- },
-
- destroy: function(destroyRefs, fromApp) {
- var me = this,
- app = me.application,
- refCache, ref;
- if (!fromApp && app) {
- app.unregister(me);
- }
- me.application = null;
- if (destroyRefs) {
-
- refCache = me.refCache;
- for (ref in refCache) {
- if (refCache.hasOwnProperty(ref)) {
- Ext.destroy(refCache[ref]);
- }
- }
- }
- me.callParent();
- }
- });
- Ext.define('Ext.app.Application', {
- extend: Ext.app.Controller,
- isApplication: true,
-
-
-
- scope: undefined,
-
- namespaces: [],
-
- paths: null,
-
-
- config: {
-
- name: '',
-
- appProperty: 'app',
-
-
- profiles: [],
-
- currentProfile: null,
-
-
- mainView: {
- $value: null,
- lazy: true
- },
-
- defaultToken: null,
-
- glyphFontFamily: null,
-
- quickTips: true,
-
- router: null
- },
- onClassExtended: function(cls, data, hooks) {
- var Controller = Ext.app.Controller,
- proto = cls.prototype,
- requires = [],
- onBeforeClassCreated, paths, namespace, ns;
-
-
- namespace = data.name || cls.superclass.name;
- if (namespace) {
- data.$namespace = namespace;
- Ext.app.addNamespaces(namespace);
- }
- if (data.namespaces) {
- Ext.app.addNamespaces(data.namespaces);
- }
- if (data['paths processed']) {
- delete data['paths processed'];
- } else {
- Ext.app.setupPaths(namespace, ('appFolder' in data) ? data.appFolder : cls.superclass.appFolder, data.paths);
- }
-
- Controller.processDependencies(proto, requires, namespace, 'profile', data.profiles);
-
-
- proto.getDependencies(cls, data, requires);
-
- if (requires.length) {
- onBeforeClassCreated = hooks.onBeforeCreated;
- hooks.onBeforeCreated = function(cls, data) {
- var args = Ext.Array.clone(arguments);
-
-
-
-
- if (data.__handleRequires) {
- data.__handleRequires.call(this, requires, Ext.bind(function() {
- return onBeforeClassCreated.apply(this, args);
- }, this));
- return;
- }
-
- Ext.require(requires, function() {
- return onBeforeClassCreated.apply(this, args);
- });
- };
- }
- },
- getDependencies: Ext.emptyFn,
-
- constructor: function(config) {
- var me = this;
- Ext.route.Router.application = me;
- me.callParent([
- config
- ]);
-
- if (Ext.isEmpty(me.getName())) {
- Ext.raise("[Ext.app.Application] Name property is required");
- }
-
- me.doInit(me);
- Ext.on('appupdate', me.onAppUpdate, me, {
- single: true
- });
-
- Ext.Loader.setConfig({
- enabled: true
- });
-
- this.onProfilesReady();
- },
- applyId: function(id) {
- return id || this.$className;
- },
- updateRouter: function(cfg) {
- if (cfg) {
- Ext.route.Router.setConfig(cfg);
- }
- },
-
- onAppUpdate: Ext.emptyFn,
- onProfilesReady: function() {
- var me = this,
- profiles = me.getProfiles(),
- length = profiles.length,
- current, i, instance;
- for (i = 0; i < length; i++) {
- instance = Ext.create(profiles[i], {
- application: me
- });
- if (instance.isActive() && !current) {
- current = instance;
- me.setCurrentProfile(current);
- }
- }
- if (current) {
- current.init();
- }
- me.initControllers();
- me.onBeforeLaunch();
- me.finishInitControllers();
- },
- doInit: function(app) {
- this.initNamespace(app);
- this.callParent([
- app
- ]);
- },
- initNamespace: function(me) {
- var appProperty = me.getAppProperty(),
- ns = Ext.namespace(me.getName());
- if (ns) {
- ns.getApplication = function() {
- return me;
- };
- if (appProperty) {
- if (!ns[appProperty]) {
- ns[appProperty] = me;
- }
-
- else if (ns[appProperty] !== me) {
- Ext.log.warn('An existing reference is being overwritten for ' + name + '.' + appProperty + '. See the appProperty config.');
- }
- }
- }
- },
-
- initControllers: function() {
- var me = this,
- controllers = Ext.Array.from(me.controllers),
- profile = me.getCurrentProfile(),
- i, ln;
- me.controllers = new Ext.util.MixedCollection();
- for (i = 0 , ln = controllers.length; i < ln; i++) {
- me.getController(controllers[i]);
- }
-
-
- if (profile) {
- controllers = profile.getControllers();
- for (i = 0 , ln = controllers.length; i < ln; i++) {
- me.getController(controllers[i]);
- }
- }
- },
- finishInitControllers: function() {
- var me = this,
- controllers, i, l;
- controllers = me.controllers.getRange();
- for (i = 0 , l = controllers.length; i < l; i++) {
- controllers[i].finishInit(me);
- }
- },
-
- launch: Ext.emptyFn,
-
- onBeforeLaunch: function() {
- var me = this,
- History = Ext.util.History,
- defaultToken = me.getDefaultToken(),
- currentProfile = me.getCurrentProfile(),
- controllers, c, cLen, controller, token;
- me.initMainView();
- if (currentProfile) {
- currentProfile.launch();
- }
- me.launch.call(me.scope || me);
- me.launched = true;
- me.fireEvent('launch', me);
- controllers = me.controllers.items;
- cLen = controllers.length;
- for (c = 0; c < cLen; c++) {
- controller = controllers[c];
- controller.onLaunch(me);
- }
- if (!History.ready) {
- History.init();
- }
- token = History.getToken();
- if (token || token === defaultToken) {
- Ext.route.Router.onStateChange(token);
- } else if (defaultToken) {
- History.replace(defaultToken);
- }
-
-
- if (Ext.Microloader && Ext.Microloader.appUpdate && Ext.Microloader.appUpdate.updated) {
- Ext.Microloader.fireAppUpdate();
- }
-
- if (!me.cnsTimer) {
- me.cnsTimer = Ext.defer(Ext.ClassManager.clearNamespaceCache, 2000, Ext.ClassManager);
- }
- },
- getModuleClassName: function(name, kind) {
- return Ext.app.Controller.getFullName(name, kind, this.getName()).absoluteName;
- },
- initMainView: function() {
- var me = this,
- currentProfile = me.getCurrentProfile(),
- mainView;
- if (currentProfile) {
- mainView = currentProfile.getMainView();
- }
- if (mainView) {
- me.setMainView(mainView);
- } else {
-
- me.getMainView();
- }
- },
- applyMainView: function(value) {
- var view = this.getView(value);
-
- return view.create({
- $initParent: this.viewport
- });
- },
-
- createController: function(name) {
- return this.getController(name);
- },
-
- destroyController: function(controller) {
- if (typeof controller === 'string') {
- controller = this.getController(controller, true);
- }
- Ext.destroy(controller);
- },
-
- getController: function(name, preventCreate) {
- var me = this,
- controllers = me.controllers,
- className, controller, len, i, c, all;
-
- controller = controllers.get(name);
-
-
-
-
- if (!controller) {
- all = controllers.items;
- for (i = 0 , len = all.length; i < len; ++i) {
- c = all[i];
- className = c.getModuleClassName();
- if (className && className === name) {
- controller = c;
- break;
- }
- }
- }
- if (!controller && !preventCreate) {
- className = me.getModuleClassName(name, 'controller');
- controller = Ext.create(className, {
- application: me,
- moduleClassName: className
- });
- controllers.add(controller);
- if (me._initialized) {
- controller.doInit(me);
- }
- }
- return controller;
- },
-
- unregister: function(controller) {
- this.controllers.remove(controller);
- },
- getApplication: function() {
- return this;
- },
- destroy: function(destroyRefs) {
- var me = this,
- controllers = me.controllers,
- ns = Ext.namespace(me.getName()),
- appProp = me.getAppProperty();
- Ext.undefer(me.cnsTimer);
- Ext.un('appupdate', me.onAppUpdate, me);
- Ext.destroy(me.viewport);
- if (controllers) {
- controllers.each(function(controller) {
- controller.destroy(destroyRefs, true);
- });
- }
- me.controllers = null;
- me.callParent([
- destroyRefs,
- true
- ]);
-
- if (ns && ns[appProp] === me) {
- delete ns[appProp];
- }
- if (Ext.route.Router.application === me) {
- Ext.route.Router.application = null;
- }
- if (Ext.app.Application.instance === me) {
- Ext.app.Application.instance = null;
- }
- },
- updateGlyphFontFamily: function(fontFamily) {
- Ext.setGlyphFontFamily(fontFamily);
- },
-
- applyProfiles: function(profiles) {
- var me = this;
- return Ext.Array.map(profiles, function(profile) {
- return me.getModuleClassName(profile, "profile");
- });
- }
- }, function() {
-
- Ext.getApplication = function() {
- return Ext.app.Application.instance;
- };
- });
- Ext.application = function(config) {
- var createApp = function(App) {
-
- Ext.onReady(function() {
- var Viewport = Ext.viewport;
- Viewport = Viewport && Viewport['Viewport'];
- if (Viewport && Viewport.setup) {
- Viewport.setup(App.prototype.config.viewport);
- }
- Ext.app.Application.instance = new App();
- });
- };
- if (typeof config === "string") {
- Ext.require(config, function() {
- createApp(Ext.ClassManager.get(config));
- });
- } else {
- config = Ext.apply({
- extend: 'Ext.app.Application'
- },
- config);
-
-
- Ext.app.setupPaths(config.name, config.appFolder, config.paths);
- config['paths processed'] = true;
-
- Ext.define(config.name + ".$application", config, function() {
- createApp(this);
- });
- }
- };
- Ext.define('Ext.util.ItemCollection', {
- extend: Ext.util.MixedCollection,
- alternateClassName: 'Ext.ItemCollection',
- getKey: function(item) {
- return item.getItemId && item.getItemId();
- },
- has: function(item) {
- return this.map.hasOwnProperty(item.getId());
- }
- });
- Ext.define('Ext.mixin.Queryable', {
- mixinId: 'queryable',
- isQueryable: true,
-
- query: function(selector) {
- selector = selector || '*';
- return Ext.ComponentQuery.query(selector, this.getQueryRoot());
- },
-
- queryBy: function(fn, scope) {
- var out = [],
- items = this.getQueryRoot().getRefItems(true),
- i = 0,
- len = items.length,
- item;
- for (; i < len; ++i) {
- item = items[i];
- if (fn.call(scope || item, item) !== false) {
- out.push(item);
- }
- }
- return out;
- },
-
- queryById: function(id) {
- return this.down(Ext.makeIdSelector(id));
- },
-
- child: function(selector) {
- var children = this.getQueryRoot().getRefItems();
- if (selector && selector.isComponent) {
- return this.matchById(children, selector.getItemId());
- }
-
- if (selector) {
- children = Ext.ComponentQuery.query(selector, children);
- }
-
- if (children.length) {
- return children[0];
- }
- return null;
- },
-
- down: function(selector) {
- if (selector && selector.isComponent) {
- return this.matchById(this.getRefItems(true), selector.getItemId());
- }
- selector = selector || '';
- return this.query(selector)[0] || null;
- },
-
- visitPreOrder: function(selector, fn, scope, extraArgs) {
- Ext.ComponentQuery._visit(true, selector, this.getQueryRoot(), fn, scope, extraArgs);
- },
-
- visitPostOrder: function(selector, fn, scope, extraArgs) {
- Ext.ComponentQuery._visit(false, selector, this.getQueryRoot(), fn, scope, extraArgs);
- },
- getRefItems: function() {
- return [];
- },
- getQueryRoot: function() {
- return this;
- },
- privates: {
- matchById: function(items, id) {
- var len = items.length,
- i, item;
- for (i = 0; i < len; ++i) {
- item = items[i];
- if (item.getItemId() === id) {
- return item;
- }
- }
- return null;
- }
- }
- });
- Ext.define('Ext.mixin.Container', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'container'
- },
-
- isContainer: true,
-
- nameHolder: false,
-
- referenceHolder: false,
-
- getNamedItems: function() {
- var CM = Ext.ComponentManager;
- if (CM.referencesDirty) {
- CM.fixReferences();
- }
- return this.nameRefs || null;
- },
-
- getReferences: function() {
- var CM = Ext.ComponentManager;
- if (CM.referencesDirty) {
- CM.fixReferences();
- }
- return this.refs || null;
- },
-
- lookup: function(ref) {
- var refs = this.getReferences();
- return (refs && refs[ref]) || null;
- },
-
- lookupName: function(name) {
- var items = this.getNamedItems();
- return (items && items[name]) || null;
- },
-
- lookupReference: function(ref) {
- return this.lookup(ref);
- },
- privates: {
-
- attachNameRef: function(component) {
- var me = this,
- key = component.name || component._name,
- entry, nameRefs;
-
- if (key && !me.destroying && !me.destroyed) {
- nameRefs = me.nameRefs || (me.nameRefs = {});
- entry = nameRefs[key];
- if (!entry) {
- entry = component.shareableName ? [
- component
- ] : component;
- } else if (!entry.isInstance) {
-
-
-
- entry.push(component);
- } else
- {
- Ext.raise('Duplicate name: "' + key + '" on ' + me.id + ' between ' + entry.id + ' and ' + component.id);
- }
-
- nameRefs[key] = entry;
- }
- },
-
- attachReference: function(component) {
- var me = this,
- key, refs;
-
- if (!me.destroying && !me.destroyed) {
- refs = me.refs || (me.refs = {});
- key = component.referenceKey;
-
- if (refs[key] && refs[key] !== component) {
- Ext.log.warn('Duplicate reference: "' + key + '" on ' + me.id);
- }
-
- refs[key] = component;
- }
- },
- containerOnAdded: function(component, instanced) {
-
-
-
- if (instanced) {
- Ext.ComponentManager.markReferencesDirty();
- }
- },
- containerOnRemoved: function(destroying) {
-
- if (!destroying) {
-
-
-
-
- Ext.ComponentManager.markReferencesDirty();
- }
- },
- initContainerInheritedState: function(inheritedState, inheritedStateInner) {
- var me = this,
- controller = me.getController(),
- session = me.getSession(),
-
-
- viewModel = me.getConfig('viewModel', true),
- reference = me.reference,
- referenceHolder = me.referenceHolder;
- if (me.nameHolder) {
- inheritedState.nameHolder = me;
- }
- if (controller) {
- inheritedState.referenceHolder = controller;
- referenceHolder = true;
- } else if (referenceHolder) {
- inheritedState.referenceHolder = me;
- }
- if (referenceHolder) {
- inheritedState.referencePath = '';
- } else if (reference && me.isParentReference) {
- inheritedState.referencePath = me.referenceKey + '.';
- }
- if (session) {
- inheritedState.session = session;
- }
- if (viewModel) {
- inheritedState.viewModelPath = '';
- } else if (reference && me.isParentReference) {
- inheritedState.viewModelPath = me.viewModelKey + '.';
- }
- },
- setupReference: function(reference) {
- var len;
- if (reference && reference.charAt(len = reference.length - 1) === '>') {
- this.isParentReference = true;
- reference = reference.substring(0, len);
- }
-
- if (reference && !Ext.validIdRe.test(reference)) {
- Ext.Error.raise('Invalid reference "' + reference + '" for ' + this.getId() + ' - not a valid identifier');
- }
-
- return reference;
- }
- }
- });
- Ext.define('Ext.util.KeyMap', {
- alternateClassName: 'Ext.KeyMap',
-
-
-
-
-
-
-
- eventName: 'keydown',
- constructor: function(config) {
- var me = this;
-
-
-
- if ((arguments.length !== 1) || (typeof config === 'string') || config.dom || config.tagName || config === document || config.isComponent) {
- Ext.raise("Legacy multi-argument KeyMap constructor is removed. Use a config object instead.");
- }
-
- Ext.apply(me, config);
- me.bindings = [];
- if (!me.target.isComponent) {
- me.target = Ext.get(me.target);
- }
- if (me.binding) {
- me.addBinding(me.binding);
- } else if (config.key) {
- me.addBinding(config);
- }
- me.enable();
- },
-
- addBinding: function(binding) {
- var me = this,
- keyCode = binding.key,
- i, len;
- if (me.processing) {
- me.bindings = me.bindings.slice(0);
- }
- if (Ext.isArray(binding)) {
- for (i = 0 , len = binding.length; i < len; i++) {
- me.addBinding(binding[i]);
- }
- return;
- }
- me.bindings.push(Ext.apply({
- keyCode: me.processKeys(keyCode)
- }, binding));
- },
-
- removeBinding: function(binding) {
- var me = this,
- bindings = me.bindings,
- len = bindings.length,
- i, item, keys;
- if (me.processing) {
- me.bindings = bindings.slice(0);
- }
- keys = me.processKeys(binding.key);
- for (i = 0; i < len; i++) {
- item = bindings[i];
- if ((item.fn || item.handler) === (binding.fn || binding.handler) && item.scope === binding.scope) {
- if (binding.alt === item.alt && binding.ctrl === item.ctrl && binding.shift === item.shift) {
- if (Ext.Array.equals(item.keyCode, keys)) {
- Ext.Array.erase(me.bindings, i, 1);
- return;
- }
- }
- }
- }
- },
- processKeys: function(keyCode) {
- var processed = false,
- key, keys, keyString, len, i;
-
- if (keyCode.test) {
- return keyCode;
- }
-
- if (Ext.isString(keyCode)) {
- keys = [];
- keyString = keyCode.toUpperCase();
- for (i = 0 , len = keyString.length; i < len; i++) {
- keys.push(keyString.charCodeAt(i));
- }
- keyCode = keys;
- processed = true;
- }
-
- if (!Ext.isArray(keyCode)) {
- keyCode = [
- keyCode
- ];
- }
- if (!processed) {
- for (i = 0 , len = keyCode.length; i < len; i++) {
- key = keyCode[i];
- if (Ext.isString(key)) {
- keyCode[i] = key.toUpperCase().charCodeAt(0);
- }
- }
- }
- return keyCode;
- },
-
- handleTargetEvent: function(event) {
- var me = this,
- bindings, i, len, result;
- if (me.enabled) {
- bindings = me.bindings;
-
- event = me.processEvent.apply(me.processEventScope || me, arguments);
-
- if (event) {
- me.lastKeyEvent = event;
-
- if (me.ignoreInputFields && Ext.fly(event.target).isInputField()) {
- return;
- }
-
-
- if (!event.getKey) {
- return event;
- }
- me.processing = true;
- for (i = 0 , len = bindings.length; i < len; i++) {
- result = me.processBinding(bindings[i], event);
- if (result === false) {
- me.processing = false;
- return result;
- }
- }
- me.processing = false;
- }
- }
- },
-
- processEvent: Ext.identityFn,
-
- processBinding: function(binding, event) {
- if (this.checkModifiers(binding, event)) {
- var key = event.getKey(),
- handler = binding.fn || binding.handler,
- scope = binding.scope || this,
- keyCode = binding.keyCode,
- defaultEventAction = binding.defaultEventAction,
- i, len, result;
-
- if (keyCode.test) {
- if (keyCode.test(String.fromCharCode(event.getCharCode()))) {
- result = handler.call(scope, key, event);
- if (result !== true && defaultEventAction) {
- event[defaultEventAction]();
- }
- if (result === false) {
- return result;
- }
- }
- }
-
- else if (keyCode.length) {
- for (i = 0 , len = keyCode.length; i < len; i++) {
- if (key === keyCode[i]) {
- result = handler.call(scope, key, event);
- if (result !== true && defaultEventAction) {
- event[defaultEventAction]();
- }
- if (result === false) {
- return result;
- }
- break;
- }
- }
- }
- }
- },
-
- checkModifiers: function(binding, event) {
- var keys = [
- 'shift',
- 'ctrl',
- 'alt'
- ],
- i, len, val, key;
- for (i = 0 , len = keys.length; i < len; i++) {
- key = keys[i];
- val = binding[key];
- if (!(val === undefined || (val === event[key + 'Key']))) {
- return false;
- }
- }
- return true;
- },
-
- on: function(key, fn, scope) {
- var keyCode, shift, ctrl, alt;
- if (Ext.isObject(key) && !Ext.isArray(key)) {
- keyCode = key.key;
- shift = key.shift;
- ctrl = key.ctrl;
- alt = key.alt;
- } else {
- keyCode = key;
- }
- this.addBinding({
- key: keyCode,
- shift: shift,
- ctrl: ctrl,
- alt: alt,
- fn: fn,
- scope: scope
- });
- },
-
- un: function(key, fn, scope) {
- var keyCode, shift, ctrl, alt;
- if (Ext.isObject(key) && !Ext.isArray(key)) {
- keyCode = key.key;
- shift = key.shift;
- ctrl = key.ctrl;
- alt = key.alt;
- } else {
- keyCode = key;
- }
- this.removeBinding({
- key: keyCode,
- shift: shift,
- ctrl: ctrl,
- alt: alt,
- fn: fn,
- scope: scope
- });
- },
-
- isEnabled: function() {
- return !!this.enabled;
- },
-
- enable: function() {
- var me = this;
- if (!me.enabled) {
- me.target.on(me.eventName, me.handleTargetEvent, me, {
- capture: me.capture,
- priority: me.priority
- });
- me.enabled = true;
- }
- },
-
- disable: function() {
- var me = this;
- if (me.enabled) {
- if (!me.target.destroyed) {
- me.target.removeListener(me.eventName, me.handleTargetEvent, me);
- }
- me.enabled = false;
- }
- },
-
- setDisabled: function(disabled) {
- if (disabled) {
- this.disable();
- } else {
- this.enable();
- }
- },
-
- destroy: function(removeTarget) {
- var me = this,
- target = me.target;
- me.bindings = [];
- me.disable();
- me.target = null;
- if (removeTarget) {
- target.destroy();
- Ext.raise("Using removeTarget argument in KeyMap destructor is not supported.");
- }
- me.callParent();
- }
- });
- Ext.define('Ext.util.KeyNav', {
- alternateClassName: 'Ext.KeyNav',
-
- disabled: false,
-
- defaultEventAction: false,
-
- forceKeyDown: false,
-
-
- eventName: 'keypress',
-
-
-
-
-
-
- statics: {
- keyOptions: {
- left: 37,
- right: 39,
- up: 38,
- down: 40,
- space: 32,
- pageUp: 33,
- pageDown: 34,
- del: 46,
- backspace: 8,
- home: 36,
- end: 35,
- enter: 13,
- esc: 27,
- tab: 9
- }
- },
- constructor: function(config) {
- var me = this,
- keymapCfg, map;
-
- if (arguments.length === 2) {
- Ext.raise("2-argument KeyNav constructor is removed. Use a config object instead.");
- }
-
- config = config || {};
- keymapCfg = {
- target: config.target,
- ignoreInputFields: config.ignoreInputFields,
- eventName: me.getKeyEvent('forceKeyDown' in config ? config.forceKeyDown : me.forceKeyDown, config.eventName),
- capture: config.capture
- };
- if (me.map) {
- me.map.destroy();
- }
-
- me.initConfig(config);
- if (config.processEvent) {
- keymapCfg.processEvent = config.processEvent;
- keymapCfg.processEventScope = config.processEventScope || me;
- }
- if (config.priority) {
- keymapCfg.priority = config.priority;
- }
-
- if (config.keyMap) {
- map = me.map = config.keyMap;
- } else
- {
- map = me.map = new Ext.util.KeyMap(keymapCfg);
- me.destroyKeyMap = true;
- }
- me.addBindings(config);
- map.disable();
- if (!config.disabled) {
- map.enable();
- }
- },
- addBindings: function(bindings) {
- var me = this,
- map = me.map,
- keyCodes = Ext.util.KeyNav.keyOptions,
- Event = Ext.event.Event,
- defaultScope = bindings.scope || me,
- binding, keyName, keyCode;
- for (keyName in bindings) {
- binding = bindings[keyName];
-
-
-
-
-
-
- keyCode = keyName.length === 1 ? keyName.charCodeAt(0) : (keyCodes[keyName] || Event[keyName.toUpperCase()]);
- if (keyCode != null) {
- keyName = keyCode;
- }
- if (binding && (keyName.length === 1 || !isNaN(keyName = parseInt(keyName, 10)))) {
- if (typeof binding === 'function') {
- binding = {
- handler: binding,
- defaultEventAction: (bindings.defaultEventAction !== undefined) ? bindings.defaultEventAction : me.defaultEventAction
- };
- }
- map.addBinding({
- key: keyName,
- ctrl: binding.ctrl,
- shift: binding.shift,
- alt: binding.alt,
- handler: Ext.Function.bind(me.handleEvent, binding.scope || defaultScope, [
- binding.handler || binding.fn,
- me
- ], true),
- defaultEventAction: (binding.defaultEventAction !== undefined) ? binding.defaultEventAction : me.defaultEventAction
- });
- }
- }
- },
-
- handleEvent: function(keyCode, event, handler, keyNav) {
- keyNav.lastKeyEvent = event;
- return handler.call(this, event);
- },
-
- destroy: function(removeEl) {
- var me = this;
- if (removeEl) {
- Ext.raise("removeEl argument in KeyNav destructor is not supported anymore.");
- }
- if (me.destroyKeyMap) {
- me.map.destroy(removeEl);
- }
- me.map = null;
- me.callParent();
- },
-
- enable: function() {
-
- if (this.map) {
- this.map.enable();
- this.disabled = false;
- }
- },
-
- disable: function() {
-
- if (this.map) {
- this.map.disable();
- }
- this.disabled = true;
- },
-
- setDisabled: function(disabled) {
- this.map.setDisabled(disabled);
- this.disabled = disabled;
- },
- isEnabled: function() {
- return !this.disabled;
- },
-
- getKeyEvent: function(forceKeyDown, configuredEventName) {
- if (forceKeyDown || (Ext.supports.SpecialKeyDownRepeat && !configuredEventName)) {
- return 'keydown';
- } else {
- return configuredEventName || this.eventName;
- }
- }
- });
- Ext.define('Ext.mixin.FocusableContainer', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'focusablecontainer'
- },
- isFocusableContainer: true,
-
- focusableContainer: false,
-
- resetFocusPosition: false,
-
- activeChildTabIndex: 0,
-
- inactiveChildTabIndex: -1,
-
- allowFocusingDisabledChildren: false,
-
- focusableContainerEl: 'el',
- privates: {
- initFocusableContainer: function(clearChildren) {
- var items, i, len;
-
-
- if (this.focusableContainer) {
- clearChildren = clearChildren != null ? clearChildren : true;
- this.doInitFocusableContainer(clearChildren);
- } else
-
-
-
-
- {
- items = this.getFocusables();
- for (i = 0 , len = items.length; i < len; i++) {
- items[i].ownerFocusableContainer = null;
- }
- }
- },
- doInitFocusableContainer: function(clearChildren) {
- var me = this,
- el = me.focusableContainerEl,
- child;
-
-
- if (!el.isElement) {
- el = me.focusableContainerEl = me[el];
- }
- if (me.initFocusableContainerKeyNav) {
- me.initFocusableContainerKeyNav(el);
- }
-
-
-
-
-
- if (clearChildren) {
- me.clearFocusables();
- if (!me.isDisabled()) {
- child = me.findNextFocusableChild({
- step: 1
- }) || me.findNextFocusableChild({
- beforeRender: true
- });
- if (child) {
- me.activateFocusable(child);
- }
- }
- }
- child = me.findNextFocusableChild({
- firstTabbable: true
- });
-
-
- me.activateFocusableContainer(!!child && !me.isDisabled());
- },
- initFocusableContainerKeyNav: function(el) {
- var me = this;
- if (!me.focusableKeyNav) {
- el = el || me.focusableContainerEl;
- me.focusableKeyNav = new Ext.util.KeyNav({
- target: el,
- disabled: true,
- eventName: 'keydown',
-
- processEvent: me.processFocusableContainerKeyEvent,
- processEventScope: me,
- scope: me,
- tab: me.onFocusableContainerTabKey,
- enter: {
- handler: me.onFocusableContainerEnterKey,
- ctrl: false,
- shift: false,
- alt: false
- },
- space: {
- handler: me.onFocusableContainerSpaceKey,
- ctrl: false,
- shift: false,
- alt: false
- },
- up: {
- handler: me.onFocusableContainerUpKey,
- ctrl: false,
- shift: false,
- alt: false
- },
- down: {
- handler: me.onFocusableContainerDownKey,
- ctrl: false,
- shift: false,
- alt: false
- },
- left: {
- handler: me.onFocusableContainerLeftKey,
- ctrl: false,
- shift: false,
- alt: false
- },
- right: {
- handler: me.onFocusableContainerRightKey,
- ctrl: false,
- shift: false,
- alt: false
- }
- });
- }
- },
- destroyFocusableContainer: function() {
- this.focusableKeyNav = Ext.destroy(this.focusableKeyNav);
- },
- activateFocusableContainer: function(enable) {
- var keyNav = this.focusableKeyNav;
- if (keyNav) {
- keyNav.setDisabled(!enable);
- }
- },
- isFocusableContainerActive: function() {
- var keyNav = this.focusableKeyNav;
- return keyNav ? !keyNav.disabled : false;
- },
-
- getFocusables: function() {
- return this.items.items;
- },
- initDefaultFocusable: function() {
- var me = this,
- haveFocusable = false,
- items, item, i, len;
- items = me.getFocusables();
- len = items.length;
- if (!len) {
- return;
- }
-
-
-
- for (i = 0; i < len; i++) {
- item = items[i];
- if (!item.isDisabled() && item.isFocusable()) {
- haveFocusable = true;
-
-
- break;
- }
- }
- if (!haveFocusable) {
- return;
- }
- item = me.findNextFocusableChild({
- items: items,
- step: true
- });
- if (item) {
- me.activateFocusable(item);
- }
- return item;
- },
- clearFocusables: function(skipFocused) {
- var me = this,
- items = me.getFocusables(),
- len = items.length,
- item, i;
- for (i = 0; i < len; i++) {
- item = items[i];
- if (!item.destroyed && item.focusable && item.isTabbable()) {
- me.deactivateFocusable(item);
- }
- }
- },
-
- processFocusableContainerKeyEvent: function(e) {
- if (!Ext.fly(e.target).isInputField()) {
- return e;
- }
- },
- activateFocusable: function(child) {
- child.setTabIndex(this.activeChildTabIndex);
- },
- deactivateFocusable: function(child) {
- child.setTabIndex(this.inactiveChildTabIndex);
- },
- onFocusableContainerTabKey: function() {
- return true;
- },
- onFocusableContainerEnterKey: function() {
- return true;
- },
- onFocusableContainerSpaceKey: function() {
- return true;
- },
- onFocusableContainerUpKey: function(e) {
-
- e.preventDefault();
- return this.moveChildFocus(e, false);
- },
- onFocusableContainerDownKey: function(e) {
-
- e.preventDefault();
- return this.moveChildFocus(e, true);
- },
- onFocusableContainerLeftKey: function(e) {
-
- e.preventDefault();
- return this.moveChildFocus(e, false);
- },
- onFocusableContainerRightKey: function(e) {
-
- e.preventDefault();
- return this.moveChildFocus(e, true);
- },
- getFocusableFromEvent: function(e) {
- var child = Ext.Component.from(e);
-
- if (!child) {
- Ext.raise("No focusable child found for keyboard event!");
- }
-
- return child;
- },
- moveChildFocus: function(e, forward) {
- var child = this.getFocusableFromEvent(e);
- return this.focusChild(child, forward, e);
- },
- focusChild: function(child, forward) {
- var nextChild = this.findNextFocusableChild({
- child: child,
- step: forward
- });
- if (nextChild) {
- nextChild.focus();
- }
- return nextChild;
- },
- findNextFocusableChild: function(options) {
-
- var beforeRender = options.beforeRender,
- firstTabbable = options.firstTabbable,
- items, item, child, step, idx, i, len, allowDisabled;
- items = options.items || this.getFocusables();
- step = options.step != null ? options.step : 1;
- child = options.child;
-
- allowDisabled = !!this.allowFocusingDisabledChildren;
-
-
-
- idx = Ext.Array.indexOf(items, child);
-
- step = step === true ? 1 : step === false ? -1 : step;
- len = items.length;
- i = step > 0 ? (idx < len ? idx + step : 0) : (idx > 0 ? idx + step : len - 1);
- for (; ; i += step) {
-
-
- if (idx < 0 && (i >= len || i < 0)) {
- return null;
- }
-
- else if (i >= len) {
- i = -1;
-
-
- continue;
- }
-
- else if (i < 0) {
- i = len;
-
- continue;
- }
-
- else if (i === idx) {
- return null;
- }
- item = items[i];
- if (!item || !item.focusable || (item.isDisabled() && !allowDisabled)) {
-
- continue;
- }
- if (firstTabbable) {
- if (item.isTabbable && item.isTabbable()) {
- return item;
- }
- }
-
-
-
-
-
-
-
-
- else if (beforeRender || (item.isFocusable && item.isFocusable())) {
- return item;
- }
- }
- return null;
- },
- onFocusEnter: function(e) {
- var me = this,
- target = e.toComponent,
- child;
-
-
-
-
-
- if (target === me) {
- child = me.initDefaultFocusable();
- if (child) {
- child.focus();
- }
- }
-
- me.activateFocusableContainer(true);
- },
- onFocusLeave: function(e) {
- var me = this;
- if (me.resetFocusPosition) {
- me.clearFocusables();
- me.initDefaultFocusable();
- }
- },
- beforeFocusableChildBlur: Ext.privateFn,
- afterFocusableChildBlur: Ext.privateFn,
- beforeFocusableChildFocus: function(child) {
- var me = this;
- if (!me.focusableContainer || me.destroying || me.destroyed) {
- return;
- }
-
- me.clearFocusables();
- me.activateFocusable(child);
- },
- afterFocusableChildFocus: function(child) {
- var me = this;
- if (!me.focusableContainer || me.destroying || me.destroyed) {
- return;
- }
- me.lastFocusedChild = child;
- },
- onFocusableChildAdd: function(child) {
- var me = this;
- if (child.focusable) {
- child.ownerFocusableContainer = me;
- }
- },
- onFocusableChildRemove: function(child) {
- var me = this,
- next;
- child.ownerFocusableContainer = null;
-
-
- if (child === me.lastFocusedChild) {
- me.lastFocusedChild = null;
- next = me.initDefaultFocusable();
-
-
-
- if (child.hasFocus) {
- next = next || child.findFocusTarget();
- if (next) {
- next.focus();
- }
- }
- }
- child = next || me.findNextFocusableChild({
- step: 1,
- beforeRender: true
- });
- if (!child) {
- me.activateFocusableContainer(false);
- }
- },
- beforeFocusableChildEnable: Ext.privateFn,
- onFocusableChildEnable: function(child) {
- var me = this,
- active;
- if (!me.focusableContainer || me.destroying || me.destroyed) {
- return;
- }
-
- if (me.containsFocus) {
- active = Ext.ComponentManager.getActiveComponent();
- me.clearFocusables();
- me.activateFocusable(active);
- } else if (me.resetFocusPosition || me.lastFocusedChild == null) {
- me.clearFocusables();
- if (child.hasFocus) {
- me.activateFocusable(child);
- active = child;
- }
- } else {
- me.deactivateFocusable(child);
-
-
-
-
-
-
- if (child === me.lastFocusedChild) {
- me.clearFocusables();
- me.activateFocusable(child);
- }
- active = me.findNextFocusableChild({
- firstTabbable: true
- });
- }
- if (!active) {
- me.initDefaultFocusable();
- }
-
- me.activateFocusableContainer(true);
- },
- beforeFocusableChildDisable: function(child) {
- var me = this,
- next;
- if (!me.focusableContainer || me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
-
-
- if (child.hasFocus) {
- next = me.findNextFocusableChild({
- child: child
- }) || child.findFocusTarget();
-
-
-
-
- if (next) {
- next.focus();
- }
- }
- },
- onFocusableChildDisable: function(child) {
- var me = this,
- next;
- if (!me.focusableContainer || me.destroying || me.destroyed) {
- return;
- }
-
-
- next = me.findNextFocusableChild({
- firstTabbable: true
- });
-
- if (!next) {
- next = me.initDefaultFocusable();
- }
-
-
-
- if (!next) {
- me.activateFocusableContainer(false);
- }
- },
- beforeFocusableChildHide: function(child) {
- return this.beforeFocusableChildDisable(child);
- },
- onFocusableChildHide: function(child) {
- return this.onFocusableChildDisable(child);
- },
- beforeFocusableChildShow: function(child) {
- return this.beforeFocusableChildEnable(child);
- },
- onFocusableChildShow: function(child) {
- return this.onFocusableChildEnable(child);
- },
-
- onFocusableChildMasked: Ext.privateFn,
- onFocusableChildDestroy: Ext.privateFn,
- onFocusableChildUpdate: Ext.privateFn
- },
- deprecated: {
- 7: {
- configs: {
- enableFocusableContainer: 'focusableContainer'
- }
- }
- }
- });
- Ext.define('Ext.mixin.Hookable', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'hookable'
- },
- bindHook: function(instance, boundMethod, bindingMethod, preventDefault, extraArgs) {
- instance.afterMethod(boundMethod, bindingMethod || boundMethod, this, preventDefault, extraArgs);
- return this;
- },
- unbindHook: function(instance, boundMethod, bindingMethod) {
- instance.removeMethodListener(boundMethod, bindingMethod || boundMethod, this);
- return this;
- }
- });
- Ext.define('Ext.app.Profile', {
- mixins: [
- Ext.mixin.Observable
- ],
-
- isProfile: true,
-
-
- config: {
-
- mainView: {
- $value: null,
- lazy: true
- },
-
- application: null,
-
-
- controllers: [],
-
-
- models: [],
-
-
- views: [],
-
-
- stores: []
- },
-
- constructor: function(config) {
- this.initConfig(config);
- this.mixins.observable.constructor.apply(this, arguments);
- },
-
- isActive: function() {
- return false;
- },
-
- init: function() {
- var views = this.getViews(),
- xtype;
- if (views && !(views instanceof Array)) {
- for (xtype in views) {
- Ext.ClassManager.setXType(views[xtype], xtype);
- }
- }
- },
-
- launch: Ext.emptyFn,
- onClassExtended: function(cls, data, hooks) {
- var onBeforeClassCreated = hooks.onBeforeCreated;
- hooks.onBeforeCreated = function(cls, data) {
- var Controller = Ext.app.Controller,
- className = cls.$className,
- requires = [],
- proto = cls.prototype,
- views = data.views,
- name, namespace;
-
-
- name = data.name;
- if (name) {
- delete data.name;
- } else {
- name = className.split('.');
- name = name[name.length - 1];
- }
- cls._name = name;
- cls._namespace = name = (data.namespace || name).toLowerCase();
- delete data.namespace;
- namespace = Controller.resolveNamespace(cls, data);
- Controller.processDependencies(proto, requires, namespace, 'model', data.models, name);
- Controller.processDependencies(proto, requires, namespace, 'store', data.stores, name);
- Controller.processDependencies(proto, requires, namespace, 'controller', data.controllers, name);
- if (views) {
- if (views instanceof Array) {
- Controller.processDependencies(proto, requires, namespace, 'view', views, name);
- } else {
- Ext.app.Profile.processViews(className, views, requires);
- }
- }
- Ext.require(requires, Ext.Function.pass(onBeforeClassCreated, arguments, this));
- };
- },
- getName: function() {
-
-
- return this.self._name;
- },
- getNamespace: function() {
-
-
- return this.self._namespace;
- },
- privates: {
- statics: {
- processViews: function(className, views, requires) {
- var body, cls, s, xtype;
- for (xtype in views) {
- cls = views[xtype];
- if (typeof cls !== 'string') {
- s = cls.xclass;
-
- if (!s) {
- Ext.raise('Views must specify an xclass');
- }
-
- body = Ext.apply({
- extend: s
- }, cls);
- delete body.xclass;
-
- Ext.define(views[xtype] = className + '$' + xtype, body);
- cls = s;
- }
- requires.push(cls);
- }
- }
- }
- }
- });
- Ext.define('Ext.app.domain.View', {
- extend: Ext.app.EventDomain,
- isInstance: true,
- constructor: function(controller) {
- this.callParent([
- controller
- ]);
- this.controller = controller;
- this.monitoredClasses = [
- Ext.Widget
- ];
- },
- match: function(target, selector, controller) {
- var out = false;
- if (selector === '#') {
- out = controller === target.getController();
- } else {
- out = target.is(selector);
- }
- return out;
- },
- destroy: function() {
- this.controller = null;
- this.callParent();
- }
- });
- Ext.define('Ext.app.ViewController', {
- extend: Ext.app.BaseController,
- alias: 'controller.controller',
- mixins: [
- Ext.mixin.Factoryable
- ],
- isViewController: true,
-
- factoryConfig: {
-
- type: 'controller'
- },
- config: {
-
- bindings: {
- $value: null,
- lazy: true
- },
- closeViewAction: 'destroy'
- },
- view: null,
- constructor: function(config) {
- this.compDomain = new Ext.app.domain.View(this);
- this.callParent([
- config
- ]);
- },
-
- beforeInit: Ext.emptyFn,
-
- init: Ext.emptyFn,
-
- initViewModel: Ext.emptyFn,
-
- destroy: function() {
- var me = this,
- domain = me.compDomain,
- bind, b, key;
- if (me.$hasBinds) {
- bind = me.getBindings();
- for (key in bind) {
- b = bind[key];
- if (b) {
- b.destroy();
- }
- }
- }
- if (domain) {
- domain.unlisten(me);
- domain.destroy();
- }
- me.compDomain = me.view = null;
- me.callParent();
- },
-
- closeView: function() {
- var view = this.getView(),
- action;
- if (view) {
- action = this.getCloseViewAction();
- view[action]();
- }
- },
- control: function(selectors, listeners) {
- var obj = selectors;
- if (Ext.isString(selectors)) {
- obj = {};
- obj[selectors] = listeners;
- }
- this.compDomain.listen(obj, this);
- },
- listen: function(to, controller) {
- var component = to.component;
- if (component) {
- to = Ext.apply({}, to);
- delete to.component;
- this.control(component);
- }
- this.callParent([
- to,
- controller
- ]);
- },
- applyId: function(id) {
- if (!id) {
- id = Ext.id(null, 'controller-');
- }
- return id;
- },
-
- getReferences: function() {
- var view = this.view;
- return view && view.getReferences();
- },
-
- getView: function() {
- return this.view;
- },
-
- lookup: function(key) {
- var view = this.view;
- return view && view.lookup(key);
- },
-
- lookupReference: function(key) {
- return this.lookup(key);
- },
-
- getSession: function() {
- var view = this.view;
- return view && view.lookupSession();
- },
-
- getViewModel: function() {
- var view = this.view;
- return view && view.lookupViewModel();
- },
-
- getStore: function(name) {
- var viewModel = this.getViewModel();
- return viewModel ? viewModel.getStore(name) : null;
- },
-
- fireViewEvent: function(eventName, args) {
- var view = this.view,
- result = false,
- a = arguments;
- if (view) {
- if (view !== args) {
- a = Ext.Array.slice(a);
- a.splice(1, 0, view);
- }
-
- result = view.fireEvent.apply(view, a);
- }
- return result;
- },
-
- applyBindings: function(bindings) {
- if (!bindings) {
- return null;
- }
- var me = this,
- viewModel = me.getViewModel(),
- getBindTemplateScope = me.getBindTemplateScope(),
- b, fn, descriptor;
- me.$hasBinds = true;
-
- if (!viewModel) {
- Ext.raise('Cannot use bind config without a viewModel');
- }
-
- for (fn in bindings) {
- descriptor = bindings[fn];
- b = null;
- if (descriptor) {
- b = viewModel.bind(descriptor, fn, me);
- b.getTemplateScope = getBindTemplateScope;
- }
- bindings[fn] = b;
- }
- return bindings;
- },
-
- privates: {
- view: null,
-
- attachReference: function(component) {
- var view = this.view;
- if (view) {
- view.attachReference(component);
- }
- },
- getBindTemplateScope: function() {
-
-
- return this.scope;
- },
- initBindings: function() {
-
- this.getBindings();
- },
-
- setView: function(view) {
- this.view = view;
- if (!this.beforeInit.$nullFn) {
- this.beforeInit(view);
- }
- }
- }
- });
- Ext.define('Ext.util.Bag', {
- isBag: true,
- constructor: function() {
-
- this.items = [];
-
- this.map = {};
- },
-
- generation: 0,
-
- length: 0,
- beginUpdate: Ext.emptyFn,
- endUpdate: Ext.emptyFn,
- add: function(item) {
- var me = this,
- items = me.items,
- map = me.map,
- n = 1,
- old, i, idx, id, it, ret, was;
- if (Ext.isArray(item)) {
- old = ret = [];
- n = item.length;
- }
- for (i = 0; i < n; i++) {
- id = me.getKey(it = old ? item[i] : item);
- idx = map[id];
- if (idx === undefined) {
- items.push(it);
- map[id] = me.length++;
- if (old) {
- old.push(it);
- } else {
- ret = it;
- }
- } else {
- was = items[idx];
- if (old) {
- old.push(was);
- } else {
- ret = was;
- }
- items[idx] = it;
- }
- }
- ++me.generation;
- return ret;
- },
- clear: function() {
- var me = this,
- needsClear = me.generation || me.length,
- ret = needsClear ? me.items : [];
- if (needsClear) {
- me.items = [];
- me.length = 0;
- me.map = {};
- ++me.generation;
- }
- return ret;
- },
- clone: function() {
- var me = this,
- ret = new me.self(),
- len = me.length;
- if (len) {
- Ext.apply(ret.map, me.map);
- ret.items = me.items.slice();
- ret.length = me.length;
- }
- return ret;
- },
- contains: function(item) {
- var ret = false,
- map = this.map,
- key;
- if (item != null) {
- key = this.getKey(item);
- if (key in map) {
- ret = this.items[map[key]] === item;
- }
- }
- return ret;
- },
- containsKey: function(key) {
- return key in this.map;
- },
- destroy: function() {
- this.items = this.map = null;
- this.callParent();
- },
- each: function(fn, scope) {
- var items = this.items,
- len = items.length,
- i, ret;
- if (len) {
- scope = scope || this;
- items = items.slice(0);
-
- for (i = 0; i < len; i++) {
- ret = fn.call(scope, items[i], i, len);
- if (ret === false) {
- break;
- }
- }
- }
- return ret;
- },
- getAt: function(index) {
- var out = null;
- if (index < this.length) {
- out = this.items[index];
- }
- return out;
- },
- get: function(key) {
- return this.getByKey(key);
- },
- getByKey: function(key) {
- var map = this.map,
- ret = (key in map) ? this.items[map[key]] : null;
- return ret;
- },
- indexOfKey: function(key) {
- var map = this.map,
- ret = (key in map) ? map[key] : -1;
- return ret;
- },
- last: function() {
- return this.items[this.length - 1];
- },
- updateKey: function(item, oldKey) {
- var me = this,
- map = me.map,
- newKey;
- if (!item || !oldKey) {
- return;
- }
- if ((newKey = me.getKey(item)) !== oldKey) {
- if (me.getAt(map[oldKey]) === item && !(newKey in map)) {
- me.generation++;
- map[newKey] = map[oldKey];
- delete map[oldKey];
- }
- } else
- {
-
-
-
- if (newKey in map && me.getAt(map[newKey]) !== item) {
-
-
- Ext.raise('Duplicate newKey "' + newKey + '" for item with oldKey "' + oldKey + '"');
- }
- if (oldKey in map && me.getAt(map[oldKey]) !== item) {
-
-
-
- Ext.raise('Incorrect oldKey "' + oldKey + '" for item with newKey "' + newKey + '"');
- }
- }
- },
-
- getCount: function() {
- return this.length;
- },
- getKey: function(item) {
- return item.id || item.getId();
- },
- getRange: function(begin, end) {
- var items = this.items,
- length = items.length,
- range;
- if (!length) {
- range = [];
- } else {
- range = Ext.Number.clipIndices(length, [
- begin,
- end
- ]);
- range = items.slice(range[0], range[1]);
- }
- return range;
- },
- remove: function(item) {
- var me = this,
- map = me.map,
- items = me.items,
- ret = null,
- n = 1,
- changed, old, i, idx, id, last, was;
- if (Ext.isArray(item)) {
- n = item.length;
- old = ret = [];
- }
- if (me.length) {
- for (i = 0; i < n; i++) {
- idx = map[id = me.getKey(old ? item[i] : item)];
- if (idx !== undefined) {
- delete map[id];
- was = items[idx];
- if (old) {
- old.push(was);
- } else {
- ret = was;
- }
- last = items.pop();
- if (idx < --me.length) {
- items[idx] = last;
- map[me.getKey(last)] = idx;
- }
- changed = true;
- }
- }
- if (changed) {
- ++me.generation;
- }
- }
- return ret;
- },
- removeByKey: function(key) {
- var item = this.getByKey(key);
- if (item) {
- this.remove(item);
- }
- return item || null;
- },
- replace: function(item) {
- this.add(item);
- return item;
- },
- sort: function(fn) {
- var me = this,
- items = me.items,
- n = items.length,
- item;
- if (n) {
- Ext.Array.sort(items, fn);
- me.map = {};
- while (n-- > 0) {
- item = items[n];
- me.map[me.getKey(item)] = n;
- }
- ++me.generation;
- }
- }
- });
- Ext.define('Ext.util.Scheduler', {
- mixins: [
- Ext.mixin.Observable
- ],
- busyCounter: 0,
- lastBusyCounter: 0,
- destroyed: false,
- firing: null,
- notifyIndex: -1,
- nextId: 0,
- orderedItems: null,
- passes: 0,
- scheduledCount: 0,
- validIdRe: null,
- config: {
-
- cycleLimit: 5,
-
- preSort: null,
-
- tickDelay: 5
- },
-
- suspendOnNotify: true,
- constructor: function(config) {
-
- if (Ext.util.Scheduler.instances) {
- Ext.util.Scheduler.instances.push(this);
- } else {
- Ext.util.Scheduler.instances = [
- this
- ];
- }
- this.id = Ext.util.Scheduler.count = (Ext.util.Scheduler.count || 0) + 1;
-
- this.mixins.observable.constructor.call(this, config);
- this.items = new Ext.util.Bag();
- },
- destroy: function() {
- var me = this,
- timer = me.timer;
- if (timer) {
- window.clearTimeout(timer);
- me.timer = null;
- }
- me.items.destroy();
- me.items = me.orderedItems = null;
- me.callParent();
-
- Ext.Array.remove(Ext.util.Scheduler.instances, this);
- },
-
-
- add: function(item) {
- var me = this,
- items = me.items;
- if (items === me.firing) {
- me.items = items = items.clone();
- }
- item.id = item.id || ++me.nextId;
- item.scheduler = me;
- items.add(item);
- if (!me.sortMap) {
-
-
- me.orderedItems = null;
- }
- },
-
- remove: function(item) {
- var me = this,
- items = me.items;
- if (me.destroyed) {
- return;
- }
-
- if (me.sortMap) {
- Ext.raise('Items cannot be removed during sort');
- }
-
- if (items === me.firing) {
- me.items = items = items.clone();
- }
- if (item.scheduled) {
- me.unscheduleItem(item);
- item.scheduled = false;
- }
- items.remove(item);
- me.orderedItems = null;
- },
-
- sort: function() {
- var me = this,
- items = me.items,
- sortMap = {},
- preSort = me.getPreSort(),
- i, item;
- me.orderedItems = [];
- me.sortMap = sortMap;
-
- me.sortStack = [];
-
- if (preSort) {
- items.sort(preSort);
- }
- items = items.items;
-
-
- for (i = 0; i < items.length; ++i) {
- item = items[i];
- if (!sortMap[item.id]) {
- me.sortItem(item);
- }
- }
- me.sortMap = null;
-
- me.sortStack = null;
- },
-
-
- sortItem: function(item) {
- var me = this,
- sortMap = me.sortMap,
- orderedItems = me.orderedItems,
- itemId;
- if (!item.scheduler) {
- me.add(item);
- }
- itemId = item.id;
-
- if (item.scheduler !== me) {
- Ext.raise('Item ' + itemId + ' belongs to another Scheduler');
- }
- me.sortStack.push(item);
- if (sortMap[itemId] === 0) {
- for (var cycle = [],
- i = 0; i < me.sortStack.length; ++i) {
- cycle[i] = me.sortStack[i].getFullName();
- }
- Ext.raise('Dependency cycle detected: ' + cycle.join('\n --> '));
- }
-
- if (!(itemId in sortMap)) {
-
-
-
-
-
- sortMap[itemId] = 0;
- if (!item.sort.$nullFn) {
- item.sort();
- }
- sortMap[itemId] = 1;
- item.order = me.orderedItems.length;
- orderedItems.push(item);
- }
-
- me.sortStack.pop();
-
- return me;
- },
-
- sortItems: function(items) {
- var me = this,
- sortItem = me.sortItem;
- if (items) {
- if (items instanceof Array) {
- Ext.each(items, sortItem, me);
- } else {
- Ext.Object.eachValue(items, sortItem, me);
- }
- }
- return me;
- },
- applyPreSort: function(preSort) {
- if (typeof preSort === 'function') {
- return preSort;
- }
- var parts = preSort.split(','),
- direction = [],
- length = parts.length,
- c, i, s;
- for (i = 0; i < length; ++i) {
- direction[i] = 1;
- s = parts[i];
- if ((c = s.charAt(0)) === '-') {
- direction[i] = -1;
- } else if (c !== '+') {
- c = 0;
- }
- if (c) {
- parts[i] = s.substring(1);
- }
- }
- return function(lhs, rhs) {
- var ret = 0,
- i, prop, v1, v2;
- for (i = 0; !ret && i < length; ++i) {
- prop = parts[i];
- v1 = lhs[prop];
- v2 = rhs[prop];
- ret = direction[i] * ((v1 < v2) ? -1 : ((v2 < v1) ? 1 : 0));
- }
- return ret;
- };
- },
-
-
-
-
- notify: function() {
- var me = this,
- timer = me.timer,
- cyclesLeft = me.getCycleLimit(),
- globalEvents = Ext.GlobalEvents,
- suspend = me.suspendOnNotify,
- busyCounter, i, item, len, queue, firedEvent;
- if (timer) {
- window.clearTimeout(timer);
- me.timer = null;
- }
-
-
- if (!me.firing && me.scheduledCount) {
- if (suspend) {
- Ext.suspendLayouts();
- }
- while (me.scheduledCount) {
- if (cyclesLeft) {
- --cyclesLeft;
- } else {
- me.firing = null;
-
- if (me.onCycleLimitExceeded) {
- me.onCycleLimitExceeded();
- }
-
- break;
- }
- if (!firedEvent) {
- firedEvent = true;
- if (globalEvents.hasListeners.beforebindnotify) {
- globalEvents.fireEvent('beforebindnotify', me);
- }
- }
- ++me.passes;
-
-
- if (!(queue = me.orderedItems)) {
- me.sort();
- queue = me.orderedItems;
- }
- len = queue.length;
- if (len) {
- me.firing = me.items;
- for (i = 0; i < len; ++i) {
- item = queue[i];
- if (item.scheduled) {
- item.scheduled = false;
- --me.scheduledCount;
- me.notifyIndex = i;
-
-
-
-
- item.react();
- if (!me.scheduledCount) {
- break;
- }
- }
- }
- }
- }
- me.firing = null;
- me.notifyIndex = -1;
- if (suspend) {
- Ext.resumeLayouts(true);
- }
- }
-
-
- if ((busyCounter = me.busyCounter) !== me.lastBusyCounter) {
- if (!(me.lastBusyCounter = busyCounter)) {
-
-
- me.fireEvent('idle', me);
- }
- }
- },
-
- onTick: function() {
- this.timer = null;
- this.notify();
- },
-
- scheduleItem: function(item) {
- var me = this;
- ++me.scheduledCount;
-
- if (!me.timer && !me.firing) {
- me.scheduleTick();
- }
- },
-
- scheduleTick: function() {
- var me = this;
- if (!me.destroyed && !me.timer) {
- me.timer = Ext.defer(me.onTick, me.getTickDelay(), me);
- }
- },
-
- unscheduleItem: function(item) {
- if (this.scheduledCount) {
- --this.scheduledCount;
- }
- },
-
-
-
-
-
- adjustBusy: function(adjustment) {
- var me = this,
- busyCounter = me.busyCounter + adjustment;
- me.busyCounter = busyCounter;
- if (busyCounter) {
-
-
- if (!me.lastBusyCounter) {
- me.lastBusyCounter = busyCounter;
- me.fireEvent('busy', me);
- }
- } else if (me.lastBusyCounter && !me.timer) {
-
-
- me.scheduleTick();
- }
- },
-
- isBusy: function() {
- return !this.isIdle();
- },
-
- isIdle: function() {
- return !(this.busyCounter + this.lastBusyCounter);
- },
-
- debugHooks: {
- $enabled: false,
-
- onCycleLimitExceeded: function() {
- Ext.raise('Exceeded cycleLimit ' + this.getCycleLimit());
- },
- scheduleItem: function(item) {
- if (!item) {
- Ext.raise('scheduleItem: Invalid argument');
- }
- Ext.log('Schedule item: ' + item.getFullName() + ' - ' + (this.scheduledCount + 1));
- if (item.order <= this.notifyIndex) {
- Ext.log.warn('Suboptimal order: ' + item.order + ' < ' + this.notifyIndex);
- }
- this.callParent([
- item
- ]);
- },
- unscheduleItem: function(item) {
- if (!this.scheduledCount) {
- Ext.raise('Invalid scheduleCount');
- }
- this.callParent([
- item
- ]);
- Ext.log('Unschedule item: ' + item.getFullName() + ' - ' + this.scheduledCount);
- }
- }
- });
- Ext.define('Ext.data.Batch', {
- mixins: {
- observable: Ext.mixin.Observable
- },
- config: {
-
- pauseOnException: false
- },
-
- current: -1,
-
- total: 0,
-
- running: false,
-
- complete: false,
-
- exception: false,
-
- constructor: function(config) {
- var me = this;
- me.mixins.observable.constructor.call(me, config);
-
-
-
-
- me.operations = [];
-
- me.exceptions = [];
- },
-
- add: function(operation) {
- var me = this,
- i, len;
- if (Ext.isArray(operation)) {
- for (i = 0 , len = operation.length; i < len; ++i) {
- me.add(operation[i]);
- }
- } else {
- me.total++;
- operation.setBatch(me);
- me.operations.push(operation);
- }
- return me;
- },
-
- sort: function() {
- this.operations.sort(this.sortFn);
- },
- sortFn: function(operation1, operation2) {
- var ret = operation1.order - operation2.order;
- if (ret) {
- return ret;
- }
- var entityType1 = operation1.entityType,
- entityType2 = operation2.entityType,
- rank;
-
-
- if (!entityType1 || !entityType2) {
- return 0;
- }
-
-
- if (!(rank = entityType1.rank)) {
-
- entityType1.schema.rankEntities();
-
- rank = entityType1.rank;
- }
- return (rank - entityType2.rank) * operation1.foreignKeyDirection;
- },
-
- start: function(index) {
- var me = this;
- if (me.destroyed || !me.operations.length || me.running) {
- return me;
- }
- me.exceptions.length = 0;
- me.exception = false;
- me.running = true;
- return me.runOperation(Ext.isDefined(index) ? index : me.current + 1);
- },
- abort: function() {
- var me = this,
- op;
- if (me.running) {
- op = me.getCurrent();
- if (!op.destroyed) {
- op.abort();
- }
- }
- me.running = false;
- me.aborted = true;
- me.current = undefined;
- },
-
- retry: function() {
- return this.start(this.current);
- },
-
- runNextOperation: function() {
- var me = this;
- if (me.running) {
- me.runOperation(me.current + 1);
- }
- return me;
- },
-
- pause: function() {
- this.running = false;
- return this;
- },
-
- getOperations: function() {
- return this.operations;
- },
-
- getExceptions: function() {
- return this.exceptions;
- },
-
- getCurrent: function() {
- var out = null,
- current = this.current;
- if (!(current === -1 || this.complete)) {
- out = this.operations[current];
- }
- return out;
- },
-
- getTotal: function() {
- return this.total;
- },
-
- isRunning: function() {
- return this.running;
- },
-
- isComplete: function() {
- return this.complete;
- },
-
- hasException: function() {
- return this.exception;
- },
-
- runOperation: function(index) {
- var me = this,
- operations = me.operations,
- operation = operations[index];
- if (operation === undefined) {
- me.running = false;
- me.complete = true;
- me.fireEvent('complete', me, operations[operations.length - 1]);
- } else {
- me.current = index;
- operation.setInternalCallback(me.onOperationComplete);
- operation.setInternalScope(me);
- operation.execute();
- }
- return me;
- },
- onOperationComplete: function(operation) {
- var me = this,
- exception = operation.hasException();
- if (exception) {
- me.exception = true;
- me.exceptions.push(operation);
- me.fireEvent('exception', me, operation);
- }
- if (exception && me.getPauseOnException()) {
- me.pause();
- } else {
- me.fireEvent('operationcomplete', me, operation);
- me.runNextOperation();
- }
- },
- destroy: function() {
- var me = this,
- operations = me.operations,
- op, i, len;
- if (me.running) {
- me.abort();
- }
- for (i = 0 , len = me.operations.length; i < len; i++) {
- op = operations[i];
- if (op) {
- if (!op.destroyed && !op.$destroyOwner) {
- op.destroy();
- }
- op[i] = null;
- }
- }
-
- me.operations = me.exceptions = null;
- me.callParent();
- }
- });
- Ext.define('Ext.data.matrix.Slice', {
- constructor: function(side, id) {
-
- this.id = id;
-
- this.side = side;
-
- this.members = {};
- },
- attach: function(store) {
- var me = this;
-
- Ext.Assert.falsey(me.store, 'Store is already attached');
-
- me.store = store;
- store.matrix = me;
- store.on('load', me.onStoreLoad, me, {
- single: true
- });
- },
- commit: function() {
- var members = this.members,
- id;
- for (id in members) {
- members[id][2] = 0;
- }
- },
- onStoreLoad: function(store) {
- this.update(store.getData().items, 0);
- },
- update: function(recordsOrIds, state) {
-
- if (!(recordsOrIds instanceof Array)) {
- Ext.raise('Only array of records or record ids are supported');
- }
-
- var me = this,
- MatrixSlice = Ext.data.matrix.Slice,
- side = me.side,
- assocIndex = side.index,
- length = recordsOrIds.length,
- id = me.id,
- members = me.members,
- otherSide = side.inverse,
- otherSlices = otherSide.slices,
- assoc, call, i, item, otherId, otherSlice, record;
- for (i = 0; i < length; ++i) {
- call = record = null;
- item = recordsOrIds[i];
- otherId = item.isEntity ? (record = item).id : item;
- assoc = members[otherId];
-
-
- if (state < 0 && assoc && assoc[2] === 1) {
- delete members[otherId];
- otherSlice = otherSlices[otherId];
- if (otherSlice) {
- delete otherSlice.members[id];
- }
- call = 1;
- } else {
- if (!assoc) {
-
-
-
- assoc = [
- otherId,
- otherId,
- state
- ];
- assoc[assocIndex] = id;
- members[otherId] = assoc;
- otherSlice = otherSlices[otherId];
- if (!otherSlice) {
- otherSlices[otherId] = otherSlice = new MatrixSlice(otherSide, otherId);
- }
- otherSlice.members[id] = assoc;
- call = 1;
- } else if (state !== assoc[2] && state !== 0 && !(state === 1 && assoc[2] === 0)) {
-
-
- assoc[2] = state;
- otherSlice = otherSlices[otherId];
-
- call = 1;
- }
- }
- if (call) {
- if (me.notify) {
- me.notify.call(me.scope, me, otherId, state);
- }
- if (otherSlice && otherSlice.notify) {
- otherSlice.notify.call(otherSlice.scope, otherSlice, id, state);
- }
- }
- }
- },
- updateId: function(newId) {
- var me = this,
- oldId = me.id,
- side = me.side,
- slices = side.slices,
- slice = slices[oldId],
- members = slice.members,
- index = side.index,
- otherSlices = side.inverse.slices,
- assoc, otherId, otherMembers;
- me.id = newId;
- slices[newId] = slice;
- delete slices[oldId];
- for (otherId in members) {
- assoc = members[otherId];
- assoc[index] = newId;
- otherMembers = otherSlices[otherId].members;
- otherMembers[newId] = otherMembers[oldId];
- delete otherMembers[oldId];
- }
- },
- destroy: function() {
- var me = this,
- store = me.store;
- if (store) {
- store.matrix = null;
- store.un('load', me.onStoreLoad, me);
- }
- me.notify = me.scope = me.store = me.side = me.members = null;
- me.callParent();
- }
- });
- Ext.define('Ext.data.matrix.Side', {
-
- constructor: function(matrix, index, role) {
- var me = this;
-
- me.matrix = matrix;
-
- me.index = index;
-
- me.role = role;
-
- me.slices = {};
- },
- commit: function() {
- var slices = this.slices,
- id;
- for (id in slices) {
- slices[id].commit();
- }
- },
- get: function(id1, id2) {
- var me = this,
- slices = me.slices,
- slice = slices[id1] || (slices[id1] = new Ext.data.matrix.Slice(me, id1));
- return (id2 || id2 === 0) ? slice.members[id2] : slice;
- },
- update: function(id1, id2, state) {
- var slice = this.get(id1);
- return slice.update(id2, state);
- },
- updateId: function(oldId, newId) {
- var slice = this.get(oldId);
- if (slice) {
- slice.updateId(newId);
- }
- },
- destroy: function() {
- var me = this,
- slices = me.slices,
- id;
- for (id in slices) {
- slices[id].destroy();
- }
- me.inverse = me.matrix = me.role = me.slices = null;
- me.callParent();
- }
- });
- Ext.define('Ext.data.matrix.Matrix', {
-
-
-
- constructor: function(session, matrix) {
- var me = this,
- association = matrix.isManyToMany ? matrix : session.getSchema().getAssociation(matrix),
- Side = Ext.data.matrix.Side,
- left = new Side(me, 0, association.left),
- right = new Side(me, 1, association.right);
-
- Ext.Assert.truthy(association.isManyToMany, 'Association is not many-to-many');
-
- me.association = association;
- me.session = session;
- me.left = left;
- me.right = right;
- left.inverse = right;
- right.inverse = left;
- },
- commit: function() {
- this.left.commit();
- this.right.commit();
- },
- update: function(id1, id2, state) {
- return this.left.update(id1, id2, state);
- },
- updateId: function(record, oldId, newId) {
- var Type = record.self,
- left = this.left,
- right = this.right,
- matchSide;
-
- if (Type === left.role.cls) {
- matchSide = left;
- }
- if (Type === right.role.cls) {
- matchSide = right;
- }
- if (matchSide) {
- matchSide.updateId(oldId, newId);
- }
- },
- destroy: function() {
- var me = this;
- me.left.destroy();
- me.right.destroy();
- me.association = me.session = me.left = me.right = null;
- me.callParent();
- }
- });
- Ext.define('Ext.data.session.ChangesVisitor', {
- constructor: function(session) {
- var me = this,
- crud;
- me.session = session;
- crud = session.getCrudProperties();
- me.result = null;
- me.writerOptions = {};
-
- me.createKey = crud.create;
- me.readKey = crud.read;
- me.updateKey = crud.update;
- me.dropKey = crud.drop;
- },
- onDirtyRecord: function(record) {
- var me = this,
- crud = me.crud,
- created = record.phantom,
- dropped = record.dropped,
- updated = !created && !dropped,
- type = record.$className,
- prop = (created || dropped) ? 'allDataOptions' : 'partialDataOptions',
- writerOptions = me.writerOptions,
- name = record.entityName,
- options, bucket, entry, result;
- if (created && dropped) {
- return false;
- }
- crud = created ? me.createKey : (dropped ? me.dropKey : me.updateKey);
- writerOptions = writerOptions[type] || (writerOptions[type] = {});
- if (dropped) {
-
-
- if (!(options = writerOptions.drop)) {
- writerOptions.drop = options = {
- all: record.getProxy().getWriter().getWriteAllFields()
- };
- }
- if (!options.all) {
- entry = record.id;
- }
- }
-
- if (!entry) {
-
-
-
- if (!(options = writerOptions[prop])) {
- options = record.getProxy().getWriter().getConfig(prop);
- writerOptions[prop] = options = Ext.Object.chain(options);
- me.setupOptions(options);
- }
- entry = record.getData(options);
- }
-
-
-
-
-
-
-
-
-
- result = me.result || (me.result = {});
- bucket = result[name] || (result[name] = {});
- bucket = bucket[crud] || (bucket[crud] = []);
- bucket.push(entry);
- },
- setupOptions: function(options) {
- options.serialize = true;
- },
- onMatrixChange: function(association, id1, id2, state) {
- var me = this,
- name = association.left.type,
-
- assocName = association.right.role,
-
- operation = state < 0 ? me.dropKey : me.createKey,
- bucket, result;
-
-
-
-
-
-
-
-
-
-
- result = me.result || (me.result = {});
- bucket = result[name] || (result[name] = {});
-
- bucket = bucket[assocName] || (bucket[assocName] = {});
-
- bucket = bucket[operation] || (bucket[operation] = {});
-
- bucket = bucket[id1] || (bucket[id1] = []);
- bucket.push(id2);
- }
- });
- Ext.define('Ext.data.session.ChildChangesVisitor', {
- extend: Ext.data.session.ChangesVisitor,
- constructor: function() {
- this.seen = {};
- this.callParent(arguments);
- },
- setupOptions: function(options) {
- this.callParent([
- options
- ]);
- options.serialize = false;
- },
- onDirtyRecord: function(record) {
- if (this.callParent(arguments) !== false) {
-
-
- if (!record.$source && (record.dropped || !record.phantom)) {
- this.readEntity(record);
- }
- }
- },
- readEntity: function(record) {
- var me = this,
- readKey = me.readKey,
- name = record.entityName,
- id = record.id,
- seen = me.seen,
- seenKey = name + id,
- result, bucket;
-
- if (seen[seenKey]) {
- return;
- }
- seen[seenKey] = true;
- result = me.result || (me.result = {});
- bucket = result[name] || (result[name] = {});
- bucket = bucket[readKey] || (bucket[readKey] = []);
- bucket.push(Ext.apply({}, record.modified, record.data));
- }
- });
- Ext.define('Ext.data.session.BatchVisitor', {
- map: null,
- constructor: function(batch) {
- this.batch = batch;
- },
- getBatch: function(sort) {
- var map = this.map,
- batch = this.batch,
- bucket, entity, name, operation, operationType, proxy, batchActions, records, len, i;
- if (map) {
- if (!batch) {
- batch = new Ext.data.Batch();
- }
- for (name in map) {
- bucket = map[name];
- entity = bucket.entity;
-
- proxy = entity.getProxy();
- batchActions = proxy.getBatchActions();
- delete bucket.entity;
-
- for (operationType in bucket) {
- if (batchActions) {
- operation = proxy.createOperation(operationType, {
- records: bucket[operationType]
- });
- operation.entityType = entity;
- batch.add(operation);
- } else {
- records = bucket[operationType];
- for (i = 0 , len = records.length; i < len; ++i) {
- operation = proxy.createOperation(operationType, {
- records: [
- records[i]
- ]
- });
- operation.entityType = entity;
- batch.add(operation);
- }
- }
- }
- }
- }
- if (batch && sort !== false) {
- batch.sort();
- }
- return batch;
- },
- onDirtyRecord: function(record) {
- var me = this,
- operation = record.phantom ? 'create' : (record.dropped ? 'destroy' : 'update'),
- name = record.$className,
- map = (me.map || (me.map = {})),
- bucket = (map[name] || (map[name] = {
- entity: record.self
- }));
-
-
-
-
-
-
- bucket = bucket[operation] || (bucket[operation] = []);
- bucket.push(record);
- }
- });
- Ext.define('Ext.mixin.Dirty', {
- mixinId: 'dirty',
-
- config: {
-
- dirty: {
- $value: false,
- lazy: true
- }
- },
- dirty: false,
-
-
- _dirtyRecordCount: 0,
-
- ignoreDirty: false,
-
- recordStateIsDirtyState: true,
-
- isDirty: function() {
-
- return this.getDirty();
- },
- applyDirty: function(dirty) {
- return this.ignoreDirty ? false : dirty;
- },
- updateDirty: function(dirty) {
- var me = this;
-
- me.dirty = dirty;
- if (me.fireEvent && !me.isDirtyInitializing) {
- me.fireDirtyChange();
- }
- },
-
- clearRecordStates: function() {
- var me = this,
- counters = me._crudCounters;
- if (counters) {
- counters.C = counters.U = counters.D = 0;
- }
- me._dirtyRecordCount = 0;
- if (me.recordStateIsDirtyState) {
- me.setDirty(false);
- }
- },
- fireDirtyChange: function() {
- var me = this;
- if (!me.ignoreDirty && me.hasListeners.dirtychange) {
- me.fireEvent('dirtychange', me, me.dirty);
- }
- },
-
- trackRecordState: function(record, initial) {
- var me = this,
- counters = me._crudCounters || (me._crudCounters = {
- C: 0,
- R: 0,
- U: 0,
- D: 0
- }),
- dirtyRecordCountWas = me._dirtyRecordCount,
- state = record.crudState,
- stateWas = record.crudStateWas,
- changed, dirtyRecordCount;
- if (initial || state !== stateWas) {
- if (!initial && stateWas) {
- --counters[stateWas];
- }
- if (!(record.phantom && state === 'D')) {
- ++counters[state];
- }
-
- me.checkCounters();
-
- me._dirtyRecordCount = dirtyRecordCount = counters.C + counters.U + counters.D;
- changed = !dirtyRecordCount !== !dirtyRecordCountWas;
- if (changed && me.recordStateIsDirtyState) {
- me.setDirty(dirtyRecordCount > 0);
- }
- }
- return changed;
- },
-
- untrackRecordState: function(record) {
- var me = this,
- counters = me._crudCounters,
- dirtyRecordCountWas = me._dirtyRecordCount,
- state = record.crudState,
- changed, dirtyRecordCount;
-
- if (counters && state !== 'D' && !record.erased) {
- --counters[state];
-
- me.checkCounters();
-
- me._dirtyRecordCount = dirtyRecordCount = counters.C + counters.U + counters.D;
- changed = !dirtyRecordCount !== !dirtyRecordCountWas;
- if (changed && me.recordStateIsDirtyState) {
- me.setDirty(dirtyRecordCount > 0);
- }
- }
- return changed;
- },
-
- checkCounters: function() {
- var counters = this._crudCounters,
- key;
- for (key in counters) {
- if (counters[key] < 0) {
- Ext.raise('Invalid state for ' + key);
- }
- }
- }
- });
- Ext.define('Ext.data.Session', {
- mixins: [
- Ext.mixin.Dirty,
- Ext.mixin.Observable
- ],
- isSession: true,
- config: {
-
- schema: 'default',
-
- parent: null,
-
- autoDestroy: true,
- crudProperties: {
- create: 'C',
- read: 'R',
- update: 'U',
- drop: 'D'
- }
- },
- crudOperations: [
- {
- type: 'R',
- entityMethod: 'readEntities'
- },
- {
- type: 'C',
- entityMethod: 'createEntities'
- },
- {
- type: 'U',
- entityMethod: 'updateEntities'
- },
- {
- type: 'D',
- entityMethod: 'dropEntities'
- }
- ],
- crudKeys: {
- C: 1,
- R: 1,
- U: 1,
- D: 1
- },
- statics: {
- nextId: 1
- },
- constructor: function(config) {
- var me = this;
-
- me.data = {};
-
- me.matrices = {};
- me.id = Ext.data.Session.nextId++;
- me.identifierCache = {};
-
- me.recordCreator = me.recordCreator.bind(me);
- me.mixins.observable.constructor.call(me, config);
- },
- destroy: function() {
- var me = this,
- matrices = me.matrices,
- data = me.data,
- entityName, entities, record, id;
- for (id in matrices) {
- matrices[id].destroy();
- }
- for (entityName in data) {
- entities = data[entityName];
- for (id in entities) {
- record = entities[id].record;
- if (record) {
-
-
- record.$source = null;
-
-
-
- record.unjoin(me);
- }
- }
- }
-
- me.identifierCache = me.recordCreator = me.matrices = me.data = null;
- me.setSchema(null);
- me.callParent();
- },
-
- adopt: function(record) {
- var me = this,
- associations = record.associations,
- roleName;
-
- me.checkModelType(record.self);
- if (record.session && record.session !== me) {
- Ext.raise('Record already belongs to an existing session');
- }
-
- if (record.session !== me) {
- me.add(record);
- if (associations) {
- for (roleName in associations) {
- associations[roleName].adoptAssociated(record, me);
- }
- }
- }
- },
-
- commit: function() {
- var me = this,
- data = me.data,
- matrices = me.matrices,
- dirtyWas = me.getDirty(),
- entityName, entities, id, record;
- me.suspendEvent('dirtychange');
- for (entityName in data) {
- entities = data[entityName];
- for (id in entities) {
- record = entities[id].record;
- if (record) {
- record.commit();
- }
- }
- }
- for (id in matrices) {
- matrices[id].commit();
- }
- me.clearRecordStates();
- me.resumeEvent('dirtychange');
- if (me.getDirty() !== dirtyWas) {
- me.fireDirtyChange();
- }
- },
-
- createRecord: function(type, data, preventAdd) {
-
- this.checkModelType(type);
-
- var Model = type.$isClass ? type : this.getSchema().getEntity(type),
- parent = this.getParent(),
- id;
-
- if (data && parent) {
- id = Model.getIdFromData(data);
- if (parent.peekRecord(Model, id)) {
- Ext.raise('A parent session already contains an entry for ' + Model.entityName + ': ' + id);
- }
- }
-
- return new Model(data, preventAdd ? null : this);
- },
-
- getChanges: function() {
- var visitor = new Ext.data.session.ChangesVisitor(this);
- this.visitData(visitor);
- return visitor.result;
- },
-
- getChangesForParent: function() {
- var visitor = new Ext.data.session.ChildChangesVisitor(this);
- this.visitData(visitor);
- return visitor.result;
- },
-
- getRecord: function(type, id, autoLoad) {
- var me = this,
- wasInstance = type.isModel,
- record, Model, parent, parentRec;
- if (wasInstance) {
- wasInstance = type;
- id = type.id;
- type = type.self;
- }
- record = me.peekRecord(type, id);
- if (!record) {
- Model = type.$isClass ? type : me.getSchema().getEntity(type);
- parent = me.getParent();
- if (parent) {
- parentRec = parent.peekRecord(Model, id);
- }
- if (parentRec) {
- if (parentRec.isLoading()) {
-
-
-
- wasInstance = false;
- } else {
- record = parentRec.copy(undefined, me);
- record.$source = parentRec;
- }
- }
- if (!record) {
- if (wasInstance) {
- record = wasInstance;
- me.adopt(record);
- } else {
- record = Model.createWithId(id, null, me);
- if (autoLoad !== false) {
- record.load(Ext.isObject(autoLoad) ? autoLoad : undefined);
- }
- }
- }
- }
- return record;
- },
-
- getSaveBatch: function(sort) {
- var visitor = new Ext.data.session.BatchVisitor();
- this.visitData(visitor);
- return visitor.getBatch(sort);
- },
-
- onInvalidAssociationEntity: function(entityType, id) {
- Ext.raise('Unable to read association entity: ' + this.getModelIdentifier(entityType, id));
- },
-
- onInvalidEntityCreate: function(entityType, id) {
- Ext.raise('Cannot create, record already not exists: ' + this.getModelIdentifier(entityType, id));
- },
-
- onInvalidEntityDrop: function(entityType, id) {
- Ext.raise('Cannot drop, record does not exist: ' + this.getModelIdentifier(entityType, id));
- },
-
- onInvalidEntityRead: function(entityType, id) {
- Ext.raise('Cannot read, record already not exists: ' + this.getModelIdentifier(entityType, id));
- },
-
- onInvalidEntityUpdate: function(entityType, id, dropped) {
- if (dropped) {
- Ext.raise('Cannot update, record dropped: ' + this.getModelIdentifier(entityType, id));
- } else {
- Ext.raise('Cannot update, record does not exist: ' + this.getModelIdentifier(entityType, id));
- }
- },
-
- peekRecord: function(type, id, deep) {
-
-
-
- this.checkModelType(type);
-
- var entityType = type.$isClass ? type : this.getSchema().getEntity(type),
- entityName = entityType.entityName,
- entry = this.data[entityName],
- ret, parent;
- entry = entry && entry[id];
- ret = entry && entry.record;
- if (!ret && deep) {
- parent = this.getParent();
- ret = parent && parent.peekRecord(type, id, deep);
- }
- return ret || null;
- },
-
- save: function() {
- var me = this,
- parent = me.getParent(),
- visitor;
- if (parent) {
- visitor = new Ext.data.session.ChildChangesVisitor(me);
- me.visitData(visitor);
- parent.update(visitor.result);
- me.commit();
- } else
- {
- Ext.raise('Cannot commit session, no parent exists');
- }
- },
-
-
- spawn: function() {
- return new this.self({
- schema: this.getSchema(),
- parent: this
- });
- },
-
- update: function(data) {
- var me = this,
- schema = me.getSchema(),
- crudOperations = me.crudOperations,
- len = crudOperations.length,
- crudKeys = me.crudKeys,
- dirtyWas = me.getDirty(),
- entityName, entityType, entityInfo, i, operation, item, associations, key, role, associationData;
- me.suspendEvent('dirtychange');
-
- me.getSchema().processKeyChecks(true);
-
- for (entityName in data) {
- entityType = schema.getEntity(entityName);
-
- if (!entityType) {
- Ext.raise('Invalid entity type: ' + entityName);
- }
-
- entityInfo = data[entityName];
- for (i = 0; i < len; ++i) {
- operation = crudOperations[i];
- item = entityInfo[operation.type];
- if (item) {
- me[operation.entityMethod](entityType, item);
- }
- }
- }
-
- for (entityName in data) {
- entityType = schema.getEntity(entityName);
- associations = entityType.associations;
- entityInfo = data[entityName];
- for (key in entityInfo) {
-
- if (crudKeys[key]) {
-
- continue;
- }
- role = associations[key];
-
- if (!role) {
- Ext.raise('Invalid association key for ' + entityName + ', "' + key + '"');
- }
-
- associationData = entityInfo[role.role];
- role.processUpdate(me, associationData);
- }
- }
- me.resumeEvent('dirtychange');
- if (me.getDirty() !== dirtyWas) {
- me.fireDirtyChange();
- }
- },
-
-
- afterCommit: function(record) {
- this.trackRecordState(record);
- },
-
- afterDrop: function(record) {
- this.trackRecordState(record);
- },
-
- afterEdit: function(record) {
- this.trackRecordState(record);
- },
-
- afterErase: function(record) {
- this.evict(record);
- },
-
- afterReject: function(record) {
- this.trackRecordState(record);
- },
- privates: {
-
- add: function(record) {
- var me = this,
- id = record.id,
- entry = me.getEntry(record.self, id),
- associations, roleName;
-
- if (entry.record) {
- Ext.raise('Duplicate id ' + record.id + ' for ' + record.entityName);
- }
-
- record.session = me;
- entry.record = record;
- me.trackRecordState(record, true);
- me.registerReferences(record);
- associations = record.associations;
- for (roleName in associations) {
- associations[roleName].checkMembership(me, record);
- }
- },
-
- applySchema: function(schema) {
- return Ext.data.schema.Schema.get(schema);
- },
-
-
- checkModelType: function(name) {
- if (name.$isClass) {
- name = name.entityName;
- }
- if (!name) {
- Ext.raise('Unable to use anonymous models in a Session');
- } else if (!this.getSchema().getEntity(name)) {
- Ext.raise('Unknown entity type ' + name);
- }
- },
-
-
- createEntities: function(entityType, items) {
- var me = this,
- len = items.length,
- i, data, rec, id;
- for (i = 0; i < len; ++i) {
- data = items[i];
- id = entityType.getIdFromData(data);
- rec = me.peekRecord(entityType, id);
- if (!rec) {
-
-
-
-
-
-
-
-
- rec = me.createRecord(entityType, data, true);
- rec.phantom = true;
- rec.crudState = 'C';
- me.add(rec);
-
- rec.crudStateWas = 'C';
- } else {
- me.onInvalidEntityCreate(entityType, id);
- }
- }
- },
-
- dropEntities: function(entityType, ids) {
- var len = ids.length,
- i, rec, id, extractId;
- if (len) {
-
- extractId = Ext.isObject(ids[0]);
- }
- for (i = 0; i < len; ++i) {
- id = ids[i];
- if (extractId) {
- id = entityType.getIdFromData(id);
- }
- rec = this.peekRecord(entityType, id);
- if (rec) {
- rec.drop();
- } else {
- this.onInvalidEntityDrop(entityType, id);
- }
- }
- },
-
- evict: function(record) {
- var me = this,
- entityName = record.entityName,
- entities = me.data[entityName],
- id = record.id;
- if (entities && entities[id]) {
- me.untrackRecordState(record);
-
-
-
- record.unjoin(me);
- delete entities[id];
- }
- },
-
-
- getEntityList: function(entityType, ids) {
- var len = ids.length,
- i, id, rec, invalid;
- for (i = 0; i < len; ++i) {
- id = ids[i];
- rec = this.peekRecord(entityType, id);
- if (rec) {
- ids[i] = rec;
- } else {
- invalid = true;
- ids[i] = null;
- this.onInvalidAssociationEntity(entityType, id);
- }
- }
- if (invalid) {
- ids = Ext.Array.clean(ids);
- }
- return ids;
- },
-
- getEntry: function(type, id) {
- if (type.isModel) {
- id = type.getId();
- type = type.self;
- }
- var entityType = type.$isClass ? type : this.getSchema().getEntity(type),
- entityName = entityType.entityName,
- data = this.data,
- entry;
- entry = data[entityName] || (data[entityName] = {});
- entry = entry[id] || (entry[id] = {});
- return entry;
- },
- getRefs: function(record, role, includeParent) {
- var entry = this.getEntry(record),
- refs = entry && entry.refs && entry.refs[role.role],
- parent = includeParent && this.getParent(),
- parentRefs, id, rec;
- if (parent) {
- parentRefs = parent.getRefs(record, role);
- if (parentRefs) {
- for (id in parentRefs) {
- rec = parentRefs[id];
- if ((!refs || !refs[id])) {
-
-
- this.getRecord(rec.self, rec.id);
- }
- }
-
- refs = entry && entry.refs && entry.refs[role.role];
- }
- }
- return refs || null;
- },
- getIdentifier: function(entityType) {
- var parent = this.getParent(),
- cache, identifier, key, ret;
- if (parent) {
- ret = parent.getIdentifier(entityType);
- } else {
- cache = this.identifierCache;
- identifier = entityType.identifier;
- key = identifier.getId() || entityType.entityName;
- ret = cache[key];
- if (!ret) {
- if (identifier.clone) {
- ret = identifier.clone({
- id: null
- });
- } else {
- ret = identifier;
- }
- cache[key] = ret;
- }
- }
- return ret;
- },
- getMatrix: function(matrix, preventCreate) {
- var name = matrix.isManyToMany ? matrix.name : matrix,
- matrices = this.matrices,
- ret;
- ret = matrices[name];
- if (!ret && !preventCreate) {
- ret = matrices[name] = new Ext.data.matrix.Matrix(this, matrix);
- }
- return ret || null;
- },
- getMatrixSlice: function(role, id) {
- var matrix = this.getMatrix(role.association),
- side = matrix[role.side];
- return side.get(id);
- },
-
- getModelIdentifier: function(entityType, id) {
- return id + '@' + entityType.entityName;
- },
- onIdChanged: function(record, oldId, newId) {
- var me = this,
- matrices = me.matrices,
- entityName = record.entityName,
- id = record.id,
- bucket = me.data[entityName],
- entry = bucket[oldId],
- associations = record.associations,
- refs = entry.refs,
- setNoRefs = me._setNoRefs,
- association, fieldName, matrix, refId, role, roleName, roleRefs, key;
-
- if (bucket[newId]) {
- Ext.raise('Cannot change ' + entityName + ' id from ' + oldId + ' to ' + newId + ' id already exists');
- }
-
- delete bucket[oldId];
- bucket[newId] = entry;
- for (key in matrices) {
- matrices[key].updateId(record, oldId, newId);
- }
- if (refs) {
- for (roleName in refs) {
- roleRefs = refs[roleName];
- role = associations[roleName];
- association = role.association;
- if (!association.isManyToMany) {
- fieldName = association.field.name;
- for (refId in roleRefs) {
- roleRefs[refId].set(fieldName, id, setNoRefs);
- }
- }
- }
- }
- me.registerReferences(record, oldId);
- },
- processManyBlock: function(entityType, role, items, processor) {
- var me = this,
- id, record, records, store;
- if (items) {
- for (id in items) {
- record = me.peekRecord(entityType, id);
- if (record) {
- records = me.getEntityList(role.cls, items[id]);
- store = role.getAssociatedItem(record);
- me[processor](role, store, record, records);
- } else {
- me.onInvalidAssociationEntity(entityType, id);
- }
- }
- }
- },
- processManyCreate: function(role, store, record, records) {
- if (store) {
-
- store.add(records);
- } else {
- record[role.getterName](null, null, records);
- }
- },
- processManyDrop: function(role, store, record, records) {
- if (store) {
- store.remove(records);
- }
- },
- processManyRead: function(role, store, record, records) {
- if (store) {
- store.setRecords(records);
- } else {
-
- record[role.getterName](null, null, records);
- }
- },
-
- readEntities: function(entityType, items) {
- var me = this,
- len = items.length,
- i, data, rec, id;
- for (i = 0; i < len; ++i) {
- data = items[i];
- id = entityType.getIdFromData(data);
- rec = me.peekRecord(entityType, id);
- if (!rec) {
- rec = me.createRecord(entityType, data, true);
- } else {
- me.onInvalidEntityRead(entityType, id);
- }
-
-
- rec.phantom = false;
- me.add(rec);
- }
- },
- recordCreator: function(data, Model) {
- var me = this,
- id = Model.getIdFromData(data),
- record = me.peekRecord(Model, id, true);
-
- if (!record) {
-
-
-
-
- record = new Model(data, me);
- } else {
- record = me.getRecord(Model, id);
- record.mergeData(data);
- }
- return record;
- },
- registerReferences: function(record, oldId) {
- var entityName = record.entityName,
- id = record.id,
- recordData = record.data,
- remove = oldId || oldId === 0,
- entry, i, fk, len, reference, references, refs, roleName;
-
- len = (references = record.references).length;
- for (i = 0; i < len; ++i) {
- reference = references[i];
-
- fk = recordData[reference.name];
-
- if (fk || fk === 0) {
- reference = reference.reference;
-
- entityName = reference.type;
- roleName = reference.inverse.role;
-
- entry = this.getEntry(reference.cls, fk);
- refs = entry.refs || (entry.refs = {});
- refs = refs[roleName] || (refs[roleName] = {});
- refs[id] = record;
- if (remove) {
- delete refs[oldId];
- }
- }
- }
- },
-
- updateEntities: function(entityType, items) {
- var len = items.length,
- i, data, rec, id, modified;
-
- if (Ext.isArray(items)) {
- for (i = 0; i < len; ++i) {
- data = items[i];
- id = entityType.getIdFromData(data);
- rec = this.peekRecord(entityType, id);
- if (rec) {
- rec.set(data);
- } else {
- this.onInvalidEntityUpdate(entityType, id);
- }
- }
- } else {
- for (id in items) {
- data = items[id];
- rec = this.peekRecord(entityType, id);
- if (rec && !rec.dropped) {
- modified = rec.set(data);
- } else {
- this.onInvalidEntityUpdate(entityType, id, !!rec);
- }
- }
- }
- },
- updateReference: function(record, field, newValue, oldValue) {
- var reference = field.reference,
- entityName = reference.type,
- roleName = reference.inverse.role,
- id = record.id,
- entry, refs;
- if (oldValue || oldValue === 0) {
-
- refs = this.getEntry(entityName, oldValue).refs[roleName];
- delete refs[id];
- }
- if (newValue || newValue === 0) {
- entry = this.getEntry(entityName, newValue);
- refs = entry.refs || (entry.refs = {});
- refs = refs[roleName] || (refs[roleName] = {});
- refs[id] = record;
- }
- },
-
- visitData: function(visitor) {
- var me = this,
- data = me.data,
- matrices = me.matrices,
- all, assoc, id, id2, matrix, members, name, record, slice, slices, state;
-
- me.getSchema().processKeyChecks(true);
- for (name in data) {
- all = data[name];
-
- for (id in all) {
- record = all[id].record;
- if (record) {
- if (record.phantom || record.dirty || record.dropped) {
- if (visitor.onDirtyRecord) {
- visitor.onDirtyRecord(record);
- }
- } else if (visitor.onCleanRecord) {
- visitor.onCleanRecord(record);
- }
- }
- }
- }
- if (visitor.onMatrixChange) {
- for (name in matrices) {
- matrix = matrices[name].left;
-
- slices = matrix.slices;
- assoc = matrix.role.association;
- for (id in slices) {
- slice = slices[id];
- members = slice.members;
- for (id2 in members) {
- state = (record = members[id2])[2];
- if (state) {
- visitor.onMatrixChange(assoc, record[0], record[1], state);
- }
- }
- }
- }
- }
- return visitor;
- },
-
-
- _setNoRefs: {
- refs: false
- }
- }
- });
- Ext.define('Ext.util.Schedulable', {
- 'abstract': true,
- isSchedulable: true,
- scheduled: false,
- constructor: function() {
- this.getScheduler().add(this);
- },
- destroy: function() {
- var me = this,
- scheduler = me.getScheduler();
- if (scheduler && !scheduler.destroyed) {
- scheduler.remove(me);
- }
- me.scheduler = null;
- me.schedule = me.react = Ext.emptyFn;
- me.callParent();
- },
- getFullName: function() {
- return this.name || this.id;
- },
- privates: {
-
- getScheduler: function() {
- return this.scheduler;
- },
-
- schedule: function() {
- var me = this,
- scheduler;
- if (!me.scheduled) {
- scheduler = me.getScheduler();
- if (scheduler) {
- me.scheduled = true;
- if (me.onSchedule) {
- me.onSchedule();
- }
- scheduler.scheduleItem(me);
- }
- }
- },
-
- unschedule: function() {
- var me = this,
- scheduler;
- if (me.scheduled) {
- scheduler = me.getScheduler();
- if (scheduler && !scheduler.destroyed) {
- scheduler.unscheduleItem(me);
- }
- me.scheduled = false;
- }
- },
-
-
- sort: function() {}
- }
- });
- Ext.define('Ext.app.bind.BaseBinding', {
- extend: Ext.util.Schedulable,
- isBinding: true,
- calls: 0,
- kind: 20,
- defaultOptions: {},
- lastValue: undefined,
-
- constructor: function(owner, callback, scope, options) {
- var me = this;
- me.options = options;
- me.owner = owner;
- me.scope = scope;
- me.callback = callback;
-
- if (!callback) {
- Ext.raise('Callback is required');
- }
-
-
- me.lateBound = Ext.isString(callback);
- if (options && options.deep) {
- me.deep = true;
- }
- me.callParent();
- },
- destroy: function() {
- var me = this,
- owner = me.owner;
- if (owner) {
- owner.onBindDestroy(me);
- }
- me.callParent();
- me.scope = me.callback = me.owner = null;
- },
- isReadOnly: function() {
- return true;
- },
- privates: {
- getScheduler: function() {
- var owner = this.owner;
- return owner && owner.getScheduler();
- },
- getSession: function() {
- var owner = this.owner;
- return owner.isSession ? owner : owner.getSession();
- },
- notify: function(value) {
- var me = this,
- options = me.options || me.defaultOptions,
- previous = me.lastValue;
-
-
-
-
-
-
- if (!me.calls || me.deep || me.valueChanged(value, previous)) {
- ++me.calls;
- me.lastValue = value;
- if (me.lateBound) {
-
-
- me.scope[me.callback](value, previous, me);
- } else {
- me.callback.call(me.scope, value, previous, me);
- }
- if (options.single) {
- me.destroy();
- }
- }
- },
- valueChanged: function(value, previous) {
- var ret = true;
- if (previous !== value) {
- if (value && previous && value instanceof Date && previous instanceof Date) {
- ret = value.getTime() !== previous.getTime();
- }
- } else {
- ret = Ext.isArray(value);
- }
- return ret;
- }
- }
- });
- Ext.define('Ext.app.bind.Binding', {
- extend: Ext.app.bind.BaseBinding,
-
- constructor: function(stub, callback, scope, options) {
- var me = this;
- me.callParent([
- stub.owner,
- callback,
- scope,
- options
- ]);
- me.stub = stub;
- me.depth = stub.depth;
-
-
- if (stub.isAvailable() && !stub.scheduled) {
- me.schedule();
- }
- },
-
- destroy: function(fromParent) {
- var me = this,
- stub = me.stub;
- if (stub && !fromParent) {
- stub.unbind(me);
- me.stub = null;
- }
- me.callParent();
- },
-
- bindValidation: function(callback, scope) {
- var stub = this.stub;
- return stub && stub.bindValidation(callback, scope);
- },
-
- bindValidationField: function(callback, scope) {
- var stub = this.stub;
- return stub && stub.bindValidationField(callback, scope);
- },
-
- getFullName: function() {
- return this.fullName || (this.fullName = '@(' + this.stub.getFullName() + ')');
- },
-
- getValue: function() {
- var me = this,
- stub = me.stub;
- return stub && stub.getValue();
- },
-
- isAvailable: function() {
- var stub = this.stub;
- return stub && stub.isAvailable();
- },
-
- isLoading: function() {
- var stub = this.stub;
- return stub && stub.isLoading();
- },
-
- isReadOnly: function() {
- var stub = this.stub,
- options = this.options,
- ret = true;
- if (!(options && options.twoWay === false)) {
- if (stub) {
- ret = stub.isReadOnly();
- }
- }
- return ret;
- },
-
- refresh: function() {},
-
-
- setValue: function(value) {
-
- if (this.isReadOnly()) {
- Ext.raise('Cannot setValue on a readonly binding');
- }
-
- this.stub.set(value);
- },
- privates: {
- getDataObject: function() {
- var stub = this.stub;
- return stub && stub.getDataObject();
- },
- getRawValue: function() {
- var me = this,
- stub = me.stub;
- return stub && stub.getRawValue();
- },
- isDescendantOf: function(item) {
- var stub = this.stub;
- return stub ? (item === stub) || stub.isDescendantOf(item) : false;
- },
- react: function() {
- this.notify(this.getValue());
- },
- schedule: function() {
-
-
- if (!this.stub.scheduled) {
- this.callParent();
- }
- },
- sort: function() {
- var stub = this.stub;
- stub.scheduler.sortItem(stub);
- }
- }
- });
- Ext.define('Ext.app.bind.AbstractStub', {
- extend: Ext.util.Schedulable,
- children: null,
- depth: 0,
- generation: 1,
- kind: 10,
- parent: null,
- constructor: function(owner, name) {
- var me = this;
-
- me.owner = owner;
- me.name = name;
- me.callParent();
- },
- destroy: function() {
- var me = this,
- children = me.children,
- bindings = me.bindings,
- len, i, key;
- if (bindings) {
- for (i = 0 , len = bindings.length; i < len; ++i) {
- bindings[i].destroy(true);
- }
- }
- for (key in children) {
- children[key].destroy();
- }
- if (me.scheduled) {
- me.unschedule();
- }
- me.callParent();
- },
- add: function(child) {
- var me = this;
- (me.children || (me.children = {}))[child.name] = child;
- child.depth = me.depth + 1;
- child.parent = me;
- },
- getChild: function(path) {
- var pathArray = Ext.isString(path) ? path.split('.') : path;
- if (pathArray && pathArray.length) {
- return this.descend(pathArray, 0);
- }
- return this;
- },
- getFullName: function() {
- var me = this,
- name = me.fullName,
- parent = me.parent,
- s;
- if (!name) {
- name = me.name || me.id;
- if (parent && (s = parent.getFullName())) {
- name = ((s.charAt(s.length - 1) !== ':') ? s + '.' : s) + name;
- }
- me.fullName = name;
- }
- return name;
- },
- getSession: function() {
- var owner = this.owner;
- return owner.isSession ? owner : owner.getSession();
- },
- bind: function(callback, scope, options) {
- var me = this,
- binding = new Ext.app.bind.Binding(me, callback, scope, options),
- bindings = (me.bindings || (me.bindings = []));
- binding.depth = me.depth;
- bindings.push(binding);
- return binding;
- },
- getValue: function() {
- return this.isAvailable() ? this.getRawValue() : null;
- },
- graft: function(replacement) {
- var me = this,
- bindings = me.bindings,
- name = me.name,
- i;
-
- me.parent = me.bindings = null;
- me.destroy();
-
- replacement.depth = me.depth;
- replacement.bindings = bindings;
- replacement.generation = me.generation + 1;
- replacement.name = name;
- replacement.id = me.id;
- replacement.path = me.path;
-
- if (bindings) {
- for (i = bindings.length; i-- > 0; ) {
- bindings[i].stub = replacement;
- }
- }
- return replacement;
- },
- isDescendantOf: function(item) {
- for (var parent = this; parent = parent.parent; ) {
- if (parent === item) {
- return true;
- }
- }
- return false;
- },
- isAvailable: function() {
- return true;
- },
- isLoading: function() {
- return false;
- },
- onSchedule: function() {
-
-
-
-
- for (var i, len, binding, bindings,
- p = this.parent; p; p = p.parent) {
- bindings = p.bindings;
- if (bindings) {
- for (i = 0 , len = bindings.length; i < len; ++i) {
- binding = bindings[i];
- if (binding.deep && !binding.scheduled) {
- binding.schedule();
- }
- }
- }
- }
- },
- react: function() {
- var bindings = this.bindings,
- binding, i, len;
- if (bindings) {
- for (i = 0 , len = bindings.length; i < len; ++i) {
- binding = bindings[i];
- if (!binding.scheduled) {
- binding.schedule();
- }
- }
- }
- },
- unbind: function(binding) {
- var bindings = this.bindings;
- if (bindings && bindings.length) {
- Ext.Array.remove(bindings, binding);
- }
- },
- privates: {
- collect: function() {
- var children = this.children,
- bindings = this.bindings,
- totalCount = 0,
- count = 0,
- child, key;
- if (children) {
- for (key in children) {
- child = children[key];
- count = child.collect();
- if (count === 0) {
-
-
- child.destroy();
- delete children[key];
- }
- totalCount += count;
- }
- }
- if (bindings) {
- totalCount += bindings.length;
- }
- return totalCount;
- },
- getScheduler: function() {
- var owner = this.owner;
- return owner && owner.getScheduler();
- },
- sort: function() {
- var parent = this.parent;
- if (parent) {
-
-
-
-
- this.scheduler.sortItem(parent);
- }
- }
- }
- });
- Ext.define('Ext.app.bind.Stub', {
- extend: Ext.app.bind.AbstractStub,
- isStub: true,
- dirty: true,
- formula: null,
- validationKey: 'validation',
- constructor: function(owner, name, parent) {
- var me = this,
- path = name;
- me.callParent([
- owner,
- name
- ]);
- me.boundValue = null;
- if (parent) {
- parent.add(me);
- if (!parent.isRootStub) {
- path = parent.path + '.' + name;
- }
- me.checkHadValue();
- }
- me.path = path;
- },
- destroy: function() {
- var me = this,
- formula = me.formula,
- storeBinding = me.storeBinding;
- if (formula) {
- formula.destroy();
- }
- if (storeBinding) {
- storeBinding.destroy();
- }
- me.detachBound();
- me.callParent();
- },
- bindValidation: function(callback, scope) {
- var parent = this.parent;
- return parent && parent.descend([
- this.validationKey,
- this.name
- ]).bind(callback, scope);
- },
- bindValidationField: function(callback, scope) {
- var parent = this.parent,
- name = this.name,
- lateBound = typeof callback === 'string',
- ret;
- if (parent) {
- ret = parent.bind(function(value) {
- var field = null;
- if (value && value.isModel) {
- field = value.getField(name);
- }
- if (lateBound) {
- scope[callback](field, value, this);
- } else {
- callback.call(scope, field, value, this);
- }
- });
- }
- return ret || null;
- },
- descend: function(path, index) {
- var me = this,
- children = me.children || (me.children = {}),
- pos = index || 0,
- name = path[pos++],
- ret;
- if (!(ret = children[name])) {
- ret = new Ext.app.bind.Stub(me.owner, name, me);
- }
- if (pos < path.length) {
- ret = ret.descend(path, pos);
- }
- return ret;
- },
- getChildValue: function(parentData) {
- var me = this,
- name = me.name,
- bindMappings = me.bindMappings,
- storeMappings = bindMappings.store,
- modelMappings = bindMappings.model,
- ret;
- if (!parentData && !Ext.isString(parentData)) {
-
-
- ret = me.hadValue ? null : undefined;
- } else {
- ret = me.inspectValue(parentData);
- if (!ret) {
- if (parentData.isEntity) {
-
- if (modelMappings[name]) {
- ret = parentData[modelMappings[name]]();
- } else {
- ret = parentData.data[name];
- }
- } else if (parentData.isStore && storeMappings[name]) {
- ret = parentData[storeMappings[name]]();
- } else {
- ret = parentData[name];
- if (ret === undefined && me.hadValue) {
- ret = null;
- }
- }
- }
- }
- return ret;
- },
- getDataObject: function() {
- var me = this,
- parentData = me.parent.getDataObject(),
-
- name = me.name,
- ret = parentData ? parentData[name] : null,
- storeMappings = me.bindMappings.store,
- associations;
- if (!ret) {
- if (parentData && parentData.isEntity) {
-
- associations = parentData.associations;
- if (associations && name in associations) {
- ret = parentData[associations[name].getterName]();
- }
- }
- } else if (parentData.isStore && name in storeMappings) {
- ret = parentData[storeMappings[name]]();
- }
- if (!ret || !(ret.$className || Ext.isObject(ret))) {
- parentData[name] = ret = {};
-
- me.hadValue = true;
-
-
- me.invalidate(true, true);
- }
- return ret;
- },
- getRawValue: function() {
-
-
- return this.getChildValue(this.getParentValue());
- },
- graft: function(replacement) {
- var me = this,
- parent = me.parent,
- children = me.children,
- name = me.name,
- i, ret;
- replacement.parent = parent;
- replacement.children = children;
- if (parent) {
- parent.children[name] = replacement;
- }
- if (children) {
- for (i in children) {
- children[i].parent = replacement;
- }
- }
- me.children = null;
- replacement.checkHadValue();
- ret = me.callParent([
- replacement
- ]);
- ret.invalidate(true, true);
- return ret;
- },
- isAvailable: function() {
- return this.checkAvailability();
- },
- isLoading: function() {
- return !this.checkAvailability(true);
- },
- invalidate: function(deep, dirtyOnly) {
- var me = this,
- children = me.children,
- name;
- me.dirty = true;
- me.checkHadValue();
- if (!dirtyOnly && me.isAvailable()) {
- if (!me.scheduled) {
-
- me.schedule();
- }
- }
- if (deep && children) {
- for (name in children) {
- children[name].invalidate(deep, dirtyOnly);
- }
- }
- },
- isReadOnly: function() {
- var formula = this.formula;
- return !!(formula && !formula.set);
- },
- set: function(value, preventClimb) {
- var me = this,
- parent = me.parent,
- name = me.name,
- formula = me.formula,
- parentData, associations, association, formulaStub, setterName;
- if (formula && !formula.settingValue && formula.set) {
- formula.setValue(value);
- return;
- } else if (me.isLinkStub) {
- formulaStub = me.getLinkFormulaStub();
- formula = formulaStub ? formulaStub.formula : null;
- if (formula) {
-
- if (formulaStub.isReadOnly()) {
- Ext.raise('Cannot setValue on a readonly formula');
- }
-
- formula.setValue(value);
- return;
- }
- }
-
- parentData = parent.getDataObject();
- if (parentData.isEntity) {
- associations = parentData.associations;
- if (associations && (name in associations)) {
- association = associations[name];
- setterName = association.setterName;
- if (setterName) {
- parentData[setterName](value);
- }
-
- me.invalidate(true);
- } else {
-
- parentData.set(name, value);
- }
- }
-
-
- else if ((value && value.constructor === Object) || !(value === parentData[name] && parentData.hasOwnProperty(name))) {
-
-
- if (preventClimb || !me.setByLink(value)) {
- if (value === undefined) {
- delete parentData[name];
- } else {
- parentData[name] = value;
- }
- me.inspectValue(parentData);
-
-
- me.invalidate(true);
- }
- }
- },
- onStoreDataChanged: function() {
- this.invalidate(true);
- },
- afterLoad: function(record) {
- this.invalidate(true);
- },
- afterCommit: function(record) {
-
- this.afterEdit(record, null);
- },
- afterEdit: function(record, modifiedFieldNames) {
- var children = this.children,
- len = modifiedFieldNames && modifiedFieldNames.length,
- associations = record.associations,
- bindMappings = this.bindMappings.model,
- key, i, child, name, ref;
-
- if (children) {
- if (len) {
-
- for (i = 0; i < len; ++i) {
- name = modifiedFieldNames[i];
- child = children[name];
- if (!child) {
- ref = record.fieldsMap[name];
- ref = ref && ref.reference;
- child = ref && children[ref.role];
- }
- if (child) {
- child.invalidate(true);
- }
- }
- } else {
-
-
-
- for (key in children) {
- if (!(associations && key in associations)) {
- children[key].invalidate(true);
- }
- }
- }
-
-
- for (key in bindMappings) {
- child = children[key];
- if (child) {
- child.invalidate();
- }
- }
- }
- this.invalidate();
- },
- afterReject: function(record) {
-
- this.afterEdit(record, null);
- },
- afterAssociatedRecordSet: function(record, associated, role) {
- var children = this.children,
- key = role.role;
- if (children && key in children) {
- children[key].invalidate(true);
- }
- },
- setByLink: function(value) {
- var me = this,
- n = 0,
- ret = false,
- i, link, path, stub, root, name;
- for (stub = me; stub; stub = stub.parent) {
- if (stub.isLinkStub) {
- link = stub;
- if (n) {
- for (path = [] , i = 0 , stub = me; stub !== link; stub = stub.parent) {
- ++i;
- path[n - i] = stub.name;
- }
- }
- break;
- }
- ++n;
- }
- stub = null;
- if (link) {
- root = link.parent;
- name = link.name;
- if (!root.shouldClimb(name)) {
-
- stub = root.insertChild(name);
- } else {
- stub = link.getTargetStub();
- }
- }
- if (stub) {
-
-
-
- if (path) {
- stub = stub.descend(path);
- }
- stub.set(value);
- ret = true;
- }
- return ret;
- },
- setFormula: function(formula) {
- var me = this,
- oldFormula = me.formula;
- if (oldFormula) {
- oldFormula.destroy();
- }
-
-
- me.formula = new Ext.app.bind.Formula(me, formula);
- },
- react: function() {
- var me = this,
- bound = this.boundValue,
- children = me.children,
- generation;
- if (bound) {
- if (bound.isValidation) {
- bound.refresh();
- generation = bound.generation;
-
- if (me.lastValidationGeneration === generation) {
- return;
- }
- me.lastValidationGeneration = generation;
- } else if (bound.isModel) {
-
-
-
- if (children && children[me.validationKey]) {
-
- bound.isValid();
- }
- }
- }
- this.callParent();
- },
- privates: {
- bindMappings: {
- store: {
- count: 'getCount',
- first: 'first',
- last: 'last',
- loading: 'hasPendingLoad',
- totalCount: 'getTotalCount'
- },
- model: {
- dirty: 'isDirty',
- phantom: 'isPhantom',
- valid: 'isValid'
- }
- },
- checkAvailability: function(isLoading) {
- var me = this,
- parent = me.parent,
- bindMappings = me.bindMappings,
- name = me.name,
- available = !!(parent && parent.checkAvailability(isLoading)),
- associations, parentValue, value, availableSet, loading;
- if (available) {
- parentValue = me.getParentValue();
- value = me.inspectValue(parentValue);
-
- if (value) {
- if (isLoading) {
- available = !value.hasPendingLoad();
- } else {
-
- if (value.isStore) {
- available = true;
- } else {
-
-
- available = !value.isLoading() || value.loadCount > 0;
- }
- }
- } else {
- if (parentValue) {
- if (parentValue.isModel) {
- if (bindMappings.model[name]) {
- available = !parent.isLoading();
- availableSet = true;
- } else {
- associations = parentValue.associations;
-
-
-
-
- if (!(associations && name in associations)) {
- available = true;
- availableSet = true;
- }
- }
- } else if (parentValue.isStore && bindMappings.store[name] && name !== 'loading') {
- available = !parent.isLoading();
- availableSet = true;
- }
- }
- if (!availableSet) {
- available = me.hadValue || me.getRawValue() !== undefined;
- }
- }
- }
- return available;
- },
- checkHadValue: function() {
- if (!this.hadValue) {
- this.hadValue = this.getRawValue() !== undefined;
- }
- },
- collect: function() {
- var me = this,
- result = me.callParent(),
- storeBinding = me.storeBinding ? 1 : 0,
- formula = me.formula ? 1 : 0;
- return result + storeBinding + formula;
- },
- getLinkFormulaStub: function() {
-
-
-
- var stub = this;
- while (stub.isLinkStub) {
- stub = stub.binding.stub;
- }
- return stub.formula ? stub : null;
- },
- getParentValue: function() {
- var me = this;
-
-
- if (me.dirty) {
- me.parentValue = me.parent.getValue();
- me.dirty = false;
- }
- return me.parentValue;
- },
- setStore: function(storeBinding) {
- this.storeBinding = storeBinding;
- },
- inspectValue: function(parentData) {
- var me = this,
- name = me.name,
- current = me.boundValue,
- boundValue = null,
- associations, raw, changed, associatedEntity;
- if (parentData && parentData.isEntity) {
- associations = parentData.associations;
- if (associations && (name in associations)) {
- boundValue = parentData[associations[name].getterName]();
- } else if (name === me.validationKey) {
- boundValue = parentData.getValidation();
-
- me.lastValidationGeneration = null;
- }
- } else if (parentData) {
- raw = parentData[name];
- if (raw && (raw.isModel || raw.isStore)) {
- boundValue = raw;
- }
- }
-
-
- changed = current !== boundValue;
- if (changed) {
- if (current) {
- me.detachBound();
- }
- if (boundValue) {
- if (boundValue.isModel) {
- boundValue.join(me);
- } else {
-
-
- associatedEntity = boundValue.associatedEntity;
- if (associatedEntity && boundValue.autoLoad !== false && !boundValue.complete && !boundValue.hasPendingLoad()) {
- boundValue.load();
- }
-
-
- boundValue.on({
- scope: me,
-
-
-
-
-
-
-
- beginload: 'onStoreDataChanged',
- load: 'onStoreDataChanged',
- datachanged: 'onStoreDataChanged',
- destroy: 'onDestroyBound'
- });
- }
- }
- me.boundValue = boundValue;
- }
- return boundValue;
- },
- detachBound: function() {
- var me = this,
- current = me.boundValue;
- if (current && !current.destroyed) {
- if (current.isModel) {
- current.unjoin(me);
- } else {
- current.un({
- scope: me,
- beginload: 'onStoreDataChanged',
- load: 'onStoreDataChanged',
- datachanged: 'onStoreDataChanged',
- destroy: 'onDestroyBound'
- });
- }
- }
- },
- onDestroyBound: function() {
- if (!this.owner.destroying) {
- this.set(null);
- }
- },
- sort: function() {
- var me = this,
- formula = me.formula,
- scheduler = me.scheduler,
- storeBinding = me.storeBinding;
- me.callParent();
- if (storeBinding) {
- scheduler.sortItem(storeBinding);
- }
- if (formula) {
-
-
-
- scheduler.sortItem(formula);
- }
- }
- }
- });
- Ext.define('Ext.app.bind.LinkStub', {
- extend: Ext.app.bind.Stub,
- isLinkStub: true,
- binding: null,
- destroy: function() {
- var me = this,
- binding = me.binding,
- owner = me.owner;
- if (binding) {
- me.binding = null;
- binding.destroy();
- if (owner) {
- delete owner.linkData[me.name];
- }
- }
- me.target = null;
- me.callParent();
- },
- getFullName: function() {
- var me = this;
- return me.fullName || (me.fullName = '(' + me.callParent() + ' -> ' + me.binding.getFullName() + ')');
- },
- getDataObject: function() {
- var binding = this.binding,
- root = this.parent,
- name = this.name,
- rootData, ret;
- if (root.isRootStub && !root.shouldClimb(name)) {
- rootData = root.owner.getData();
- if (!rootData.hasOwnProperty(name)) {
- rootData[name] = ret = {};
- }
- } else {
- ret = binding && binding.getDataObject();
- }
- return ret;
- },
- getRawValue: function() {
- var binding = this.binding;
- return binding && binding.getRawValue();
- },
- getValue: function() {
- var binding = this.binding;
- return binding && binding.getValue();
- },
- getTargetStub: function() {
- var binding = this.binding;
- return binding && binding.stub;
- },
- isAvailable: function() {
- var binding = this.binding;
- return binding ? binding.isAvailable() : false;
- },
- isLoading: function() {
- var binding = this.binding;
- return binding ? binding.isLoading() : false;
- },
- link: function(bindDescriptor, target) {
- var me = this,
- binding = me.binding;
- if (binding) {
- binding.destroy();
- }
- target = me.target = target || me.owner;
- me.linkDescriptor = bindDescriptor;
- me.binding = target.bind(bindDescriptor, me.onChange, me);
- me.binding.deep = true;
- },
- onChange: function() {
- this.invalidate(true);
- },
- react: function() {
- var me = this,
- linkData = me.owner.linkData;
- linkData[me.name] = me.getValue();
- me.callParent();
- },
- privates: {
- collect: function() {
- var me = this,
- result = me.callParent(),
- binding = me.binding ? 1 : 0;
- return result + binding;
- },
- sort: function() {
- var binding = this.binding;
- if (binding) {
-
-
- this.scheduler.sortItem(binding);
- }
- }
- }
- });
- Ext.define('Ext.app.bind.RootStub', {
- extend: Ext.app.bind.AbstractStub,
- isRootStub: true,
- depth: 0,
- createRootChild: function(name, direct) {
- var me = this,
- owner = me.owner,
- ownerData = owner.getData(),
- children = me.children,
- previous = children && children[name],
- parentStub = previous ? null : me,
- parentVM, stub;
- if (direct || ownerData.hasOwnProperty(name) || !(parentVM = owner.getParent())) {
- stub = new Ext.app.bind.Stub(owner, name, parentStub);
- } else {
- stub = new Ext.app.bind.LinkStub(owner, name, parentStub);
- stub.link('{' + name + '}', parentVM);
- }
- if (previous) {
- previous.graft(stub);
- }
- return stub;
- },
- createStubChild: function(name) {
- return this.createRootChild(name, true);
- },
- descend: function(path, index) {
- var me = this,
- children = me.children,
- pos = index || 0,
- name = path[pos++],
- ret = (children && children[name]) || me.createRootChild(name);
- if (pos < path.length) {
- ret = ret.descend(path, pos);
- }
- return ret;
- },
- getFullName: function() {
- return this.fullName || (this.fullName = this.owner.id + ':');
- },
-
- getDataObject: function() {
- return this.owner.data;
- },
- getRawValue: function() {
- return this.owner.data;
- },
- getValue: function() {
- return this.owner.data;
- },
- isDescendantOf: function() {
- return false;
- },
- set: function(value, preventClimb) {
-
- if (!value || value.constructor !== Object) {
- Ext.raise('Only an object can be set at the root');
- }
-
- var me = this,
- children = me.children || (me.children = {}),
- owner = me.owner,
- data = owner.data,
- parentVM = owner.getParent(),
- stub, v, key, setSelf, created;
- for (key in value) {
-
- if (key.indexOf('.') >= 0) {
- Ext.raise('Value names cannot contain dots');
- }
-
-
-
- v = value[key];
- if (v !== undefined) {
- stub = children[key];
- setSelf = preventClimb || !me.shouldClimb(key);
- if (!stub) {
- stub = me.createRootChild(key, setSelf);
- created = true;
- } else if (setSelf && stub.isLinkStub && !stub.getLinkFormulaStub()) {
- stub = me.insertChild(key);
- }
- if (!created || !data.hasOwnProperty(value)) {
- owner.invalidateChildLinks(key);
- }
- stub.set(v, setSelf);
- }
-
-
- else if (data.hasOwnProperty(key)) {
- delete data[key];
- stub = children[key];
- if (stub) {
- if (!stub.isLinkStub && parentVM) {
- stub = me.createRootChild(key);
- }
- owner.invalidateChildLinks(key, true);
- stub.invalidate(true);
- }
- }
- }
- },
- schedule: Ext.emptyFn,
- unschedule: Ext.emptyFn,
- privates: {
- checkAvailability: function() {
-
- return true;
- },
- insertChild: function(name) {
- return this.createRootChild(name, true);
- },
- invalidateChildLink: function(name, clear) {
- var children = this.children,
- stub = children && children[name];
- if (stub && stub.isLinkStub && !stub.getLinkFormulaStub()) {
- stub = this.createRootChild(name);
- if (clear) {
- stub.invalidate(true);
- }
- this.owner.invalidateChildLinks(name, clear);
- }
- },
- shouldClimb: function(name) {
- var parent = this.owner.getParent();
- while (parent) {
- if (parent.getData().hasOwnProperty(name)) {
- return true;
- }
- parent = parent.getParent();
- }
- return false;
- }
- }
- });
- Ext.define('Ext.app.bind.Multi', {
- extend: Ext.app.bind.BaseBinding,
- isMultiBinding: true,
- missing: 1,
-
-
-
-
- deep: true,
-
- constructor: function(descriptor, owner, callback, scope, options) {
- var me = this,
- trackStatics = options && options.trackStatics;
- me.callParent([
- owner,
- callback,
- scope,
- options
- ]);
- me.bindings = [];
- me.literal = descriptor.$literal;
- if (descriptor.constructor === Object) {
- if (trackStatics) {
- me.staticKeys = [];
- }
- me.addObject(descriptor, me.lastValue = {}, me.staticKeys);
- } else {
- me.addArray(descriptor, me.lastValue = []);
- }
-
-
-
- if (!--me.missing && !me.scheduled) {
- me.schedule();
- }
- },
- destroy: function() {
- var me = this;
- me.bindings = Ext.destroy(me.bindings);
- me.callParent();
- },
- add: function(descriptor, data, property) {
- var me = this,
- owner = me.owner,
- bindings = me.bindings,
- method = me.literal ? (descriptor.reference ? 'bindEntity' : 'bindExpression') : 'bind',
- binding, depth;
- ++me.missing;
- binding = owner[method](descriptor, function(value) {
- data[property] = value;
- if (binding.calls === 1) {
- --me.missing;
- }
- if (!me.missing && !me.scheduled) {
- me.schedule();
- }
- },
- me, null);
- depth = binding.depth;
- if (!bindings.length || depth < me.depth) {
- me.depth = depth;
- }
- bindings.push(binding);
- return !this.isBindingStatic(binding);
- },
- addArray: function(multiBindDescr, array) {
- var me = this,
- n = multiBindDescr.length,
- hasDynamic = false,
- dynamic, b, i;
- for (i = 0; i < n; ++i) {
- b = multiBindDescr[i];
- if (b && (b.reference || Ext.isString(b))) {
- dynamic = me.add(b, array, i);
- } else if (Ext.isArray(b)) {
- dynamic = me.addArray(b, array[i] = []);
- } else if (b && b.constructor === Object) {
- dynamic = me.addObject(b, array[i] = {});
- } else {
- array[i] = b;
- dynamic = false;
- }
- hasDynamic = hasDynamic || dynamic;
- }
- return hasDynamic;
- },
- addObject: function(multiBindDescr, object, staticKeys) {
- var me = this,
- hasDynamic = false,
- dynamic, b, name;
- for (name in multiBindDescr) {
- b = multiBindDescr[name];
- if (b && (b.reference || Ext.isString(b))) {
- dynamic = me.add(b, object, name);
- } else if (Ext.isArray(b)) {
- dynamic = me.addArray(b, object[name] = []);
- } else if (b && b.constructor === Object) {
- dynamic = me.addObject(b, object[name] = {});
- } else {
- object[name] = b;
- dynamic = false;
- }
- if (staticKeys && !dynamic) {
- staticKeys.push(name);
- }
- hasDynamic = hasDynamic || dynamic;
- }
- return hasDynamic;
- },
- getFullName: function() {
- var me = this,
- fullName = me.fullName,
- bindings = me.bindings,
- length = bindings.length,
- i;
- if (!fullName) {
- fullName = '@[';
- for (i = 0; i < length; ++i) {
- if (i) {
- fullName += ',';
- }
- fullName += bindings[i].getFullName();
- }
- fullName += ']';
- me.fullName = fullName;
- }
- return fullName;
- },
- getRawValue: function() {
- return this.lastValue;
- },
- isDescendantOf: function() {
- return false;
- },
- isLoading: function() {
- for (var bindings = this.bindings,
- n = bindings.length; n-- > 0; ) {
- if (bindings[n].isLoading()) {
- return true;
- }
- }
- return false;
- },
- isAvailable: function() {
- for (var bindings = this.bindings,
- n = bindings.length; n-- > 0; ) {
- if (bindings[n].isAvailable()) {
- return true;
- }
- }
- return false;
- },
- isBindingStatic: function(binding) {
- return binding.isTemplateBinding && binding.isStatic;
- },
- isStatic: function() {
- var bindings = this.bindings,
- len = bindings.length,
- i, binding;
- for (i = 0; i < len; ++i) {
- binding = bindings[i];
- if (!this.isBindingStatic(binding)) {
- return false;
- }
- }
- return true;
- },
- pruneStaticKeys: function() {
- var value = Ext.apply({}, this.lastValue),
- keys = this.staticKeys,
- len = keys.length,
- i;
- for (i = 0; i < len; ++i) {
- delete value[keys[i]];
- }
- return value;
- },
- react: function() {
- this.notify(this.lastValue);
- },
- refresh: function() {},
-
- privates: {
- sort: function() {
- this.scheduler.sortItems(this.bindings);
- }
- }
- });
- Ext.define('Ext.app.bind.Formula', {
- extend: Ext.util.Schedulable,
- statics: {
- getFormulaParser: function(name) {
- var cache = this.formulaCache,
- parser, s;
- if (!cache) {
- cache = this.formulaCache = new Ext.util.LruCache({
- maxSize: 20
- });
- }
- parser = cache.get(name);
- if (!parser) {
-
- s = '[^\\.a-z0-9_]' + Ext.String.escapeRegex(name) + '\\(\\s*([\'"])(.*?)\\1\\s*\\)';
- parser = new RegExp(s, 'gi');
- cache.add(name, parser);
- }
- return parser;
- }
- },
- isFormula: true,
- calculation: null,
- explicit: false,
-
-
-
- set: null,
-
- single: false,
- fnKeywordArgumentNamesRe: /^function\s*[^\(]*\(\s*([^,\)\s]+)/,
- fnKeywordRe: /^\s*function/,
- replaceParenRe: /[\(\)]/g,
- constructor: function(stub, formula) {
- var me = this,
- owner = stub.owner,
- bindTo, expressions, getter, options;
- me.owner = owner;
- me.stub = stub;
- me.callParent();
- if (formula instanceof Function) {
- me.get = getter = formula;
- } else {
- me.get = getter = formula.get;
- me.set = formula.set;
- expressions = formula.bind;
- if (formula.single) {
- me.single = formula.single;
- }
- if (expressions) {
- bindTo = expressions.bindTo;
- if (bindTo) {
- options = Ext.apply({}, expressions);
- delete options.bindTo;
- expressions = bindTo;
- }
- }
- }
-
- if (!getter) {
- Ext.raise('Must specify a getter method for a formula');
- }
-
- if (expressions) {
- me.explicit = true;
- } else {
- expressions = getter.$expressions || me.parseFormula(getter);
- }
- me.binding = owner.bind(expressions, me.onChange, me, options);
- },
- destroy: function() {
- var me = this,
- binding = me.binding,
- stub = me.stub;
- if (binding) {
- binding.destroy();
- me.binding = null;
- }
- if (stub) {
- stub.formula = null;
- }
- me.callParent();
-
- me.getterFn = me.owner = null;
- },
- getFullName: function() {
- return this.fullName || (this.fullName = this.stub.getFullName() + '=' + this.callParent() + ')');
- },
- getRawValue: function() {
- return this.calculation;
- },
- onChange: function() {
- if (!this.scheduled) {
- this.schedule();
- }
- },
- parseFormula: function(formula) {
- var str = Ext.Function.toCode(formula),
- defaultProp = 'get',
- expressions = {
- $literal: true
- },
- match, getterProp, formulaRe, expr;
- if (this.fnKeywordRe.test(str)) {
- match = this.fnKeywordArgumentNamesRe.exec(str);
- if (match) {
- getterProp = match[1];
- }
- } else {
- match = str.split('=>')[0];
- if (match) {
- match = Ext.String.trim(match.replace(this.replaceParenRe, '')).split(',');
- getterProp = match[0];
- }
- }
- getterProp = getterProp || defaultProp;
- formulaRe = Ext.app.bind.Formula.getFormulaParser(getterProp);
- while ((match = formulaRe.exec(str))) {
- expr = match[2];
- expressions[expr] = expr;
- }
- expressions.$literal = true;
-
-
- formula.$expressions = expressions;
- return expressions;
- },
- react: function() {
- var me = this,
- owner = me.owner,
- data = me.binding.lastValue,
- getterFn = me.getterFn,
- arg;
- if (me.explicit) {
- arg = data;
- } else {
- arg = owner.getFormulaFn(data);
- }
- me.settingValue = true;
- me.stub.set(me.calculation = me.get.call(owner, arg));
- me.settingValue = false;
- if (me.single) {
- me.destroy();
- }
- },
- setValue: function(value) {
- this.set.call(this.stub.owner, value);
- },
- privates: {
- getScheduler: function() {
- var owner = this.owner;
- return owner && owner.getScheduler();
- },
- sort: function() {
- var me = this,
- binding = me.binding;
-
- if (!binding.destroyed) {
- me.scheduler.sortItem(binding);
- }
- }
- }
- });
- Ext.define('Ext.util.Fly', {
- inheritableStatics: {
- flyPoolSize: 2,
-
- fly: function() {
- var T = this,
- flyweights = T.flyweights || (T.flyweights = []),
- instance = flyweights.length ? flyweights.pop() : new T();
- instance.reset.apply(instance, arguments);
- return instance;
- }
- },
-
- release: function() {
- var me = this,
- T = me.self,
- flyweights = T.flyweights || (T.flyweights = []);
- me.reset();
- if (flyweights.length < T.flyPoolSize) {
- flyweights.push(me);
- }
- },
-
- reset: Ext.emptyFn
- });
- Ext.define('Ext.parse.Tokenizer', function(Tokenizer) {
- var flyweights = (Tokenizer.flyweights = []),
- BOOLEAN = {
- literal: true,
- "boolean": true
- },
- ERROR = {
- error: true
- },
- IDENT = {
- ident: true
- },
- LITERAL = {
- literal: true
- },
- NULL = {
- literal: true,
- nil: true
- },
- NUMBER = {
- literal: true,
- number: true
- },
- STRING = {
- literal: true,
- string: true
- };
- return {
- extend: Ext.util.Fly,
- isTokenizer: true,
- statics: {
- BOOLEAN: BOOLEAN,
- ERROR: ERROR,
- IDENT: IDENT,
- LITERAL: LITERAL,
- NULL: NULL,
- NUMBER: NUMBER,
- STRING: STRING
- },
- config: {
-
- keywords: {
- 'null': {
- type: 'literal',
- is: NULL,
- value: null
- },
- 'false': {
- type: 'literal',
- is: BOOLEAN,
- value: false
- },
- 'true': {
- type: 'literal',
- is: BOOLEAN,
- value: true
- }
- },
-
- operators: {
- '+': 'plus',
- '-': 'minus',
- '*': 'multiply',
- '/': 'divide',
- '!': 'bang',
- ',': 'comma',
- ':': 'colon',
- '[': 'arrayOpen',
- ']': 'arrayClose',
- '{': 'curlyOpen',
- '}': 'curlyClose',
- '(': 'parenOpen',
- ')': 'parenClose'
- }
- },
-
- error: null,
-
- index: -1,
- constructor: function(config) {
- this.operators = {};
- this.initConfig(config);
- },
-
- next: function() {
- var token = this.peek();
- this.head = undefined;
-
- return token;
- },
-
- peek: function() {
- var me = this,
- error = me.error,
- token = me.head;
- if (error) {
- return error;
- }
- if (token === undefined) {
- me.head = token = me.advance();
- }
- return token;
- },
-
- release: function() {
- this.reset();
- if (flyweights.length < Tokenizer.flyPoolSize) {
- flyweights.push(this);
- }
- },
-
- reset: function(text, pos, end) {
- var me = this;
- me.error = null;
- me.head = undefined;
- me.index = -1;
- me.text = text || null;
- me.pos = pos || 0;
- me.end = (text && end == null) ? text.length : end;
- return me;
- },
- privates: {
- digitRe: /[0-9]/,
- identFirstRe: /[a-z_$]/i,
- identRe: /[0-9a-z_$]/i,
- spaceRe: /[ \t]/,
-
- end: 0,
-
- head: undefined,
-
- pos: 0,
-
- text: null,
- applyOperators: function(ops) {
- var operators = this.operators,
- block, c, def, i, len, name, op;
-
- for (op in ops) {
- block = operators;
- name = ops[op];
- len = op.length;
- for (i = 0; i < len; ++i) {
- c = op.charAt(i);
- block = block[c] || (block[c] = {});
- }
- if (name) {
- block.token = def = {
- type: 'operator',
- value: op,
- is: {
- operator: true
- }
- };
- def.is[name] = true;
- } else {
- block.token = null;
- }
- }
- },
-
- advance: function() {
- var me = this,
- spaceRe = me.spaceRe,
- text = me.text,
- length = me.end,
- c;
- while (me.pos < length) {
- c = text.charAt(me.pos);
- if (spaceRe.test(c)) {
- ++me.pos;
-
-
- continue;
- }
- me.index = me.pos;
- return me.parse(c);
- }
- return null;
- },
-
- parse: function(c) {
- var me = this,
- digitRe = me.digitRe,
- text = me.text,
- length = me.end,
- ret;
-
- if (c === '.' && me.pos + 1 < length) {
- if (digitRe.test(text.charAt(me.pos + 1))) {
- ret = me.parseNumber();
- }
- }
- if (!ret && me.operators[c]) {
- ret = me.parseOperator(c);
- }
- if (!ret) {
- if (c === '"' || c === "'") {
- ret = me.parseString();
- } else if (digitRe.test(c)) {
- ret = me.parseNumber();
- } else if (me.identFirstRe.test(c)) {
- ret = me.parseIdent();
- } else {
- ret = me.syntaxError('Unexpected character');
- }
- }
- return ret;
- },
-
- parseIdent: function() {
- var me = this,
- identRe = me.identRe,
- keywords = me.getKeywords(),
- includeDots = !me.operators['.'],
- text = me.text,
- start = me.pos,
- end = start,
- length = me.end,
- prev = 0,
- c, value;
- while (end < length) {
- c = text.charAt(end);
- if (includeDots && c === '.') {
- if (prev === '.') {
- return me.syntaxError(end, 'Unexpected dot operator');
- }
- ++end;
- } else if (identRe.test(c)) {
- ++end;
- } else {
- break;
- }
- prev = c;
- }
- if (prev === '.') {
- return me.syntaxError(end - 1, 'Unexpected dot operator');
- }
- value = text.substring(start, me.pos = end);
- return (keywords && keywords[value]) || {
- type: 'ident',
- is: IDENT,
- value: value
- };
- },
-
- parseNumber: function() {
- var me = this,
- digitRe = me.digitRe,
- text = me.text,
- start = me.pos,
- length = me.end,
- c, decimal, exp, token;
- while (me.pos < length) {
- c = text.charAt(me.pos);
- if (c === '-' || c === '+') {
- if (me.pos !== start) {
- return me.syntaxError(start, 'Invalid number');
- }
- ++me.pos;
- } else if (c === '.') {
- if (decimal) {
- break;
- }
- decimal = true;
- ++me.pos;
- } else if (c === 'e' || c === 'E') {
- if (exp) {
- break;
- }
- decimal = exp = true;
-
- c = text.charAt(++me.pos);
-
- if (c === '-' || c === '+') {
- ++me.pos;
- }
- }
-
- else if (digitRe.test(c)) {
- ++me.pos;
- } else {
- break;
- }
- }
- token = {
- type: 'literal',
- is: NUMBER,
-
-
- value: +text.substring(start, me.pos)
- };
- if (!isFinite(token.value)) {
- token = me.syntaxError(start, 'Invalid number');
- }
- return token;
- },
- parseOperator: function(c) {
- var me = this,
- block = me.operators,
- text = me.text,
- length = me.end,
- end = me.pos,
- match, matchEnd, token;
- while (block[c]) {
- block = block[c];
- token = block.token;
- ++end;
- if (token) {
- match = token;
- matchEnd = end;
- }
- if (end < length) {
- c = text.charAt(end);
- } else {
- break;
- }
- }
- if (match) {
- me.pos = matchEnd;
- }
- return match;
- },
-
- parseString: function() {
- var me = this,
- text = me.text,
- pos = me.pos,
- start = pos,
- length = me.end,
- str = '',
- c, closed, quote;
- quote = text.charAt(pos++);
- while (pos < length) {
- c = text.charAt(pos++);
- if (c === quote) {
- closed = true;
- break;
- }
- if (c === '\\' && pos < length) {
- c = text.charAt(pos++);
- }
-
-
- str += c;
- }
- me.pos = pos;
- if (!closed) {
- return me.syntaxError(start, 'Unterminated string');
- }
- return {
- type: 'literal',
- is: STRING,
- value: str
- };
- },
-
- syntaxError: function(at, message) {
- if (typeof at === 'string') {
- message = at;
- at = this.pos;
- }
- var suffix = (at == null) ? '' : (' (at index ' + at + ')'),
- error = new Error(message + suffix);
- error.type = 'error';
- error.is = ERROR;
- if (suffix) {
- error.at = at;
- }
- return this.error = error;
- }
- }
- };
- });
- Ext.define('Ext.parse.Symbol', {
- priority: 0,
-
- constructor: function(id, config) {
- var me = this,
- defaultProperty = me.defaultProperty;
- if (config && typeof config === 'object') {
- Ext.apply(me, config);
- } else if (config !== undefined && defaultProperty) {
- me[defaultProperty] = config;
- }
- me.id = id;
- },
-
- dump: function() {
- var me = this,
- ret = {
- at: me.at,
- arity: me.arity
- },
- i;
- if ('value' in me) {
- ret.value = me.value;
- }
- if (me.lhs) {
- ret.lhs = me.lhs.dump();
- ret.rhs = me.rhs.dump();
- }
- if (me.operand) {
- ret.operand = me.operand.dump();
- }
- if (me.args) {
- ret.args = [];
- for (i = 0; i < me.args.length; ++i) {
- ret.args.push(me.args[i].dump());
- }
- }
- return ret;
- },
-
-
- led: function() {
- this.parser.syntaxError(this.at, 'Missing operator');
- },
-
- nud: function() {
- this.parser.syntaxError(this.at, 'Undefined');
- },
-
- update: function(config) {
- if (config && typeof config === 'object') {
- var me = this,
- priority = config.priority,
- led = config.led,
- nud = config.nud;
- if (me.priority <= priority) {
- me.priority = priority;
- }
- if (led) {
- me.led = led;
- }
- if (nud) {
- me.nud = nud;
- }
- }
- }
- });
- Ext.define('Ext.parse.symbol.Constant', {
- extend: Ext.parse.Symbol,
- arity: 'literal',
- isLiteral: true,
- defaultProperty: 'value',
- constructor: function(id, config) {
- this.callParent([
- id,
- config
- ]);
- this._value = this.value;
- },
- nud: function() {
- var me = this;
-
- me.value = me._value;
-
-
- me.arity = 'literal';
- me.isLiteral = true;
- return me;
- }
- });
- Ext.define('Ext.parse.symbol.Infix', {
- extend: Ext.parse.Symbol,
- arity: 'binary',
- isBinary: true,
- defaultProperty: 'priority',
- led: function(left) {
- var me = this;
- me.lhs = left;
- me.rhs = me.parser.parseExpression(me.priority);
-
-
- me.arity = 'binary';
- me.isBinary = true;
- return me;
- }
- });
- Ext.define('Ext.parse.symbol.InfixRight', {
- extend: Ext.parse.symbol.Infix,
- led: function(left) {
- var me = this;
- me.lhs = left;
- me.rhs = me.parser.parseExpression(me.priority - 1);
-
-
- me.arity = 'binary';
- me.isBinary = true;
- return me;
- }
- });
- Ext.define('Ext.parse.symbol.Paren', {
- extend: Ext.parse.Symbol,
- arity: 'binary',
- isBinary: true,
- priority: 80,
- led: function(left) {
-
- var me = this,
- args = [],
- parser = me.parser,
- id = left.id,
- type = left.arity;
- if (id !== '.' && id !== '[') {
- if ((type !== "unary" || id !== "function") && type !== "ident" && id !== "(" && id !== "&&" && id !== "||" && id !== "?") {
- parser.syntaxError(left.at, "Expected a variable name.");
- }
- }
- me.arity = 'invoke';
- me.isInvoke = true;
- me.operand = left;
- me.args = args;
- while (parser.token.id !== ')') {
- if (args.length) {
- parser.advance(',');
- }
- args.push(parser.parseExpression());
- }
- parser.advance(')');
- return me;
- },
- nud: function() {
-
- var parser = this.parser,
- ret = parser.parseExpression();
- parser.advance(")");
- return ret;
- }
- });
- Ext.define('Ext.parse.symbol.Prefix', {
- extend: Ext.parse.Symbol,
- arity: 'unary',
- isUnary: true,
- priority: 70,
- nud: function() {
- var me = this;
- me.operand = me.parser.parseExpression(me.priority);
-
-
- me.arity = 'unary';
- me.isUnary = true;
- return me;
- }
- });
- Ext.define('Ext.parse.Parser', function() {
- var ITSELF = function() {
- return this;
- };
- return {
- extend: Ext.util.Fly,
- isParser: true,
- config: {
-
- constants: {
- 'null': null,
- 'false': false,
- 'true': true
- },
-
- infix: {
-
-
-
-
-
-
- '+': 50,
- '-': 50,
- '*': 60,
- '/': 60
- },
-
- infixRight: {
- '&&': 30,
- '||': 30
- },
-
- prefix: {
- '!': 0,
- '-': 0,
- '+': 0
- },
-
- symbols: {
- ':': 0,
- ',': 0,
- ')': 0,
- '[': 0,
- ']': 0,
- '{': 0,
- '}': 0,
- '(end)': 0,
- '(ident)': {
- arity: 'ident',
- isIdent: true,
- nud: ITSELF
- },
- '(literal)': {
- arity: 'literal',
- isLiteral: true,
- nud: ITSELF
- },
- '(': {
- xclass: 'Ext.parse.symbol.Paren'
- }
- },
-
- tokenizer: {
- keywords: null
- }
- },
-
-
- token: null,
- constructor: function(config) {
- this.symbols = {};
- this.initConfig(config);
- },
-
- advance: function(expected) {
- var me = this,
- tokenizer = me.tokenizer,
- token = tokenizer.peek(),
- symbols = me.symbols,
- index = tokenizer.index,
- is, symbol, value;
- if (me.error) {
- throw me.error;
- }
- if (expected) {
- me.expect(expected);
- }
- if (!token) {
- return me.token = symbols['(end)'];
- }
- tokenizer.next();
- is = token.is;
- value = token.value;
- if (is.ident) {
- symbol = symbols[value] || symbols['(ident)'];
- } else if (is.operator) {
- if (!(symbol = symbols[value])) {
- me.syntaxError(token.at, 'Unknown operator "' + value + '"');
- }
- } else if (is.literal) {
- symbol = symbols['(literal)'];
- } else {
- me.syntaxError(token.at, 'Unexpected token');
- }
- me.token = symbol = Ext.Object.chain(symbol);
- symbol.at = index;
- symbol.value = value;
- if (!symbol.arity) {
- symbol.arity = token.type;
- }
- return symbol;
- },
- expect: function(expected) {
- var token = this.token;
- if (expected !== token.id) {
- this.syntaxError(token.at, 'Expected "' + expected + '"');
- }
- return this;
- },
-
- parseExpression: function(rightPriority) {
- var me = this,
- token = me.token,
- left;
- rightPriority = rightPriority || 0;
- me.advance();
- left = token.nud();
- while (rightPriority < (token = me.token).priority) {
- me.advance();
- left = token.led(left);
- }
- return left;
- },
-
- reset: function(text, pos, end) {
- var me = this;
- me.error = me.token = null;
- me.tokenizer.reset(text, pos, end);
- me.advance();
-
- return me;
- },
-
- syntaxError: function(at, message) {
- if (typeof at === 'string') {
- message = at;
- at = this.pos;
- }
- var suffix = (at == null) ? '' : (' (at index ' + at + ')'),
- error = new Error(message + suffix);
- error.type = 'error';
- if (suffix) {
- error.at = at;
- }
- throw this.error = error;
- },
- privates: {
-
- error: null,
- addSymbol: function(id, config, type, update) {
- var symbols = this.symbols,
- symbol = symbols[id],
- cfg, length, i;
- if (symbol) {
-
-
-
-
- if (typeof config === 'object') {
- cfg = config;
- } else if (update && type) {
- update = Ext.Array.from(update);
- length = update.length;
- cfg = {};
- for (i = 0; i < length; i++) {
- cfg[update[i]] = type.prototype[update[i]];
- }
- } else {
- return symbol;
- }
- symbol.update(cfg);
- } else {
- if (config && config.xclass) {
- type = Ext.ClassManager.get(config.xclass);
- } else {
- type = type || Ext.parse.Symbol;
- }
- symbols[id] = symbol = new type(id, config);
- symbol.parser = this;
- }
- return symbol;
- },
- addSymbols: function(symbols, type, update) {
- for (var id in symbols) {
- this.addSymbol(id, symbols[id], type, update);
- }
- },
- applyConstants: function(constants) {
- this.addSymbols(constants, Ext.parse.symbol.Constant, 'nud');
- },
- applyInfix: function(operators) {
- this.addSymbols(operators, Ext.parse.symbol.Infix, 'led');
- },
- applyInfixRight: function(operators) {
- this.addSymbols(operators, Ext.parse.symbol.InfixRight, 'led');
- },
- applyPrefix: function(operators) {
- this.addSymbols(operators, Ext.parse.symbol.Prefix, 'nud');
- },
- applySymbols: function(symbols) {
- this.addSymbols(symbols);
- },
- applyTokenizer: function(config) {
- var ret = config;
- if (config && !config.isTokenizer) {
- ret = new Ext.parse.Tokenizer(config);
- }
- this.tokenizer = ret;
- }
- }
- };
- });
- Ext.define('Ext.app.bind.Parser', {
- extend: Ext.parse.Parser,
- infix: {
- ':': {
- priority: 70,
-
-
- dump: function() {
- var me = this,
- ret = {
- at: me.at,
- arity: me.arity,
- value: me.value,
- operand: me.operand.dump(),
- fmt: []
- },
- fmt = me.fmt,
- i;
- for (i = 0; i < fmt.length; ++i) {
- ret.fmt.push(fmt[i].dump());
- }
- return ret;
- },
-
- led: function(left) {
-
-
- var me = this;
- me.arity = 'formatter';
- me.operand = left;
- me.fmt = me.parser.parseFmt();
- return me;
- }
- },
- '?': {
- priority: 20,
- led: function(left) {
- var me = this,
- parser = me.parser,
- symbol = parser.symbols[':'],
- temp;
- me.condition = left;
-
- temp = symbol.priority;
- symbol.priority = 0;
- me.tv = parser.parseExpression(0);
- me.parser.advance(':');
-
- symbol.priority = temp;
- me.fv = parser.parseExpression(0);
- me.arity = 'ternary';
- return me;
- }
- },
- '===': 40,
- '!==': 40,
- '==': 40,
- '!=': 40,
- '<': 40,
- '<=': 40,
- '>': 40,
- '>=': 40
- },
- symbols: {
- '(': {
- nud: function() {
-
- var parser = this.parser,
- symbol = parser.symbols[':'],
- ret, temp;
-
- temp = symbol.priority;
- symbol.priority = 70;
- ret = parser.parseExpression();
- parser.advance(")");
-
- symbol.priority = temp;
- return ret;
- }
- }
- },
- prefix: {
- '@': 0
- },
- tokenizer: {
- operators: {
- '@': 'at',
- '?': 'qmark',
- '===': 'feq',
- '!==': 'fneq',
- '==': 'eq',
- '!=': 'neq',
- '<': 'lt',
- '<=': 'lte',
- '>': 'gt',
- '>=': 'gte',
- '&&': 'and',
- '||': 'or'
- }
- },
-
- compileExpression: function(tokens, tokensMaps) {
- var me = this,
- debug, fn;
- me.tokens = tokens;
- me.tokensMap = tokensMaps;
-
- debug = me.token.value === '@' && me.tokenizer.peek();
- if (debug) {
- debug = debug.value === 'debugger';
- if (debug) {
- me.advance();
- me.advance();
- }
- }
-
- fn = me.parseSlot(me.parseExpression(), debug);
- me.tokens = me.tokensMap = null;
- return fn;
- },
-
- compileFormat: function() {
- var fn;
-
- try {
-
- fn = this.parseSlot({
- arity: 'formatter',
- fmt: this.parseFmt(),
- operand: {
- arity: 'ident',
- value: 'dummy'
- }
- });
- this.expect('(end)');
- }
- catch (e) {
- Ext.raise('Invalid format expression: "' + this.tokenizer.text + '"');
- }
-
- return fn;
- },
- privates: {
-
-
-
- useEval: Ext.isGecko,
- escapeRe: /("|'|\\)/g,
-
- parseFmt: function() {
-
-
- var me = this,
- fmt = [],
- priority = me.symbols[':'].priority,
- expr;
- do {
- if (fmt.length) {
- me.advance();
- }
- expr = me.parseExpression(priority);
- if (expr.isIdent || expr.isInvoke) {
- fmt.push(expr);
- } else {
- me.syntaxError(expr.at, 'Expected formatter name');
- }
- } while (me.token.id === ':');
- return fmt;
- },
-
- parseSlot: function(expr, debug) {
- var me = this,
- defs = [],
- body = [],
- tokens = me.tokens || [],
- fn, code, i, length, temp;
- me.definitions = defs;
- me.body = body;
- body.push('return ' + me.compile(expr) + ';');
-
- length = tokens.length;
- code = 'var fm = Ext.util.Format,\nme,';
- temp = 'var a = Ext.Array.from(values);\nme = scope;\n';
- if (tokens.length) {
- for (i = 0; i < length; i++) {
- code += 'v' + i + ((i == length - 1) ? ';' : ',');
- temp += 'v' + i + ' = a[' + i + ']; ';
- }
- } else {
- code += 'v0;';
- temp += 'v0 = a[0];';
- }
- defs = Ext.Array.insert(defs, 0, [
- code
- ]);
- body = Ext.Array.insert(body, 0, [
- temp
- ]);
- body = body.join('\n');
-
- if (debug) {
- body = 'debugger;\n' + body;
- }
-
- defs.push((me.useEval ? '$=' : 'return') + ' function (values, scope) {', body, '}');
- code = defs.join('\n');
- fn = me.useEval ? me.evalFn(code) : (new Function('Ext', code))(Ext);
- me.definitions = me.body = null;
- return fn;
- },
-
- compile: function(expr) {
- var me = this,
- v;
- switch (expr.arity) {
- case 'ident':
-
- return me.addToken(expr.value);
- case 'literal':
- v = expr.value;
-
- return (typeof v === 'string') ? '"' + String(v).replace(me.escapeRe, '\\$1') + '"' : v;
- case 'unary':
- return me.compileUnary(expr);
- case 'binary':
- return me.compileBinary(expr);
- case 'ternary':
- return me.compileTernary(expr);
- case 'formatter':
- return me.compileFormatter(expr);
- }
- return this.syntaxError(expr.at, 'Compile error! Unknown symbol');
- },
-
- compileUnary: function(expr) {
- var v = expr.value,
- op = expr.operand;
- if (v === '!' || v === '-' || v === '+') {
- return v + '(' + this.compile(op) + ')';
- } else if (v === '@') {
-
- if (!op.isIdent) {
- return this.syntaxError(expr.at, 'Compile error! Unexpected symbol');
- }
- return op.value;
- }
- return '';
- },
-
- compileBinary: function(expr) {
- return '(' + this.compile(expr.lhs) + ' ' + expr.value + ' ' + this.compile(expr.rhs) + ')';
- },
-
- compileTernary: function(expr) {
- return '(' + this.compile(expr.condition) + ' ? ' + this.compile(expr.tv) + ' : ' + this.compile(expr.fv) + ')';
- },
-
- compileFormatter: function(expr) {
- var me = this,
- fmt = expr.fmt,
- length = fmt.length,
- body = [
- 'var ret;'
- ],
- i;
- if (fmt.length) {
- body.push('ret = ' + me.compileFormatFn(fmt[0], me.compile(expr.operand)) + ';');
- for (i = 1; i < length; i++) {
- body.push('ret = ' + me.compileFormatFn(fmt[i], 'ret') + ';');
- }
- }
- body.push('return ret;');
- return me.addFn(body.join('\n'));
- },
-
- compileFormatFn: function(expr, value) {
- var fmt,
- args = [],
- code = '',
- length, i;
- if (expr.isIdent) {
-
- fmt = expr.value;
- } else if (expr.isInvoke) {
- fmt = expr.operand.value;
- args = expr.args;
- }
- if (fmt.substring(0, 5) === 'this.') {
- fmt = 'me.' + fmt.substring(5);
- } else {
- if (!(fmt in Ext.util.Format)) {
- return this.syntaxError(expr.at, 'Compile error! Invalid format specified "' + fmt + '"');
- }
- fmt = 'fm.' + fmt;
- }
- code += value;
- length = args.length;
- for (i = 0; i < length; i++) {
- code += ', ' + this.compile(args[i]);
- }
- return fmt + '(' + code + ')';
- },
-
- addFn: function(body) {
- var defs = this.definitions,
- name = 'f' + defs.length;
- defs.push('function ' + name + '() {', body, '}');
- return name + '()';
- },
-
- evalFn: function($) {
- eval($);
- return $;
- },
-
- addToken: function(token) {
- var tokensMap = this.tokensMap,
- tokens = this.tokens,
- pos = 0;
-
- if (tokensMap && tokens) {
- if (token in tokensMap) {
- pos = tokensMap[token];
- } else {
- tokensMap[token] = pos = tokens.length;
- tokens.push(token);
- }
- }
- return 'v' + pos;
- }
- }
- });
- Ext.define('Ext.app.bind.Template', {
-
- escapes: false,
-
- buffer: null,
-
- slots: null,
-
- tokens: null,
-
- constructor: function(text) {
- var me = this,
- initters = me._initters,
- name;
- me.text = text;
- for (name in initters) {
- me[name] = initters[name];
- }
- },
-
- _initters: {
- apply: function(values, scope) {
- return this.parse().apply(values, scope);
- },
- getTokens: function() {
- return this.parse().getTokens();
- }
- },
-
- apply: function(values, scope) {
- var me = this,
- slots = me.slots,
- buffer = me.buffer,
- length = slots.length,
- i, slot;
- for (i = 0; i < length; ++i) {
- slot = slots[i];
- if (slot) {
- buffer[i] = slot(values, scope);
- }
- }
-
-
- if (slot && me.single) {
- return buffer[0];
- }
- return buffer.join('');
- },
- getText: function() {
- return this.buffer.join('');
- },
-
- getTokens: function() {
- return this.tokens;
- },
-
- isStatic: function() {
- var tokens = this.getTokens(),
- slots = this.slots;
- return (tokens.length === 0 && slots.length === 0);
- },
- privates: {
- literalChar: '~',
- escapeChar: '\\',
-
- parse: function() {
-
-
- var me = this,
- text = me.text,
- parser = Ext.app.bind.Parser.fly(),
- buffer = (me.buffer = []),
- slots = (me.slots = []),
- length = text.length,
- pos = 0,
- escapes = me.escapes,
- current = '',
- i = 0,
- esc = me.escapeChar,
- lit = me.literalChar,
- escaped, tokens, tokensMap, lastEscaped, c, prev, key;
-
- for (key in me._initters) {
- delete me[key];
- }
- me.tokens = tokens = [];
- me.tokensMap = tokensMap = {};
-
- while (i < length) {
- c = text[i];
- lastEscaped = escaped;
- escaped = escapes && c === esc;
- if (escaped) {
- c = text[i + 1];
- ++i;
- } else if (c === lit && prev === lit && !lastEscaped) {
- current = current.slice(0, -1);
- current += text.substring(i + 1);
- break;
- } else if (c === '{') {
- if (current) {
- buffer[pos++] = current;
- current = '';
- }
-
- parser.reset(text, i + 1);
- i = me.parseExpression(parser, pos);
- ++pos;
-
- continue;
- }
- current += c;
- ++i;
- prev = c;
- }
- if (current) {
- buffer[pos] = current;
- }
- parser.release();
- me.single = buffer.length === 0 && slots.length === 1;
- return me;
- },
- parseExpression: function(parser, pos) {
- var i;
- this.slots[pos] = parser.compileExpression(this.tokens, this.tokensMap);
- i = parser.token.at + 1;
-
- parser.expect('}');
-
- return i;
- }
- }
- });
- Ext.define('Ext.app.bind.TemplateBinding', {
- extend: Ext.app.bind.BaseBinding,
- isTemplateBinding: true,
- lastValue: undefined,
- value: undefined,
- constructor: function(template, owner, callback, scope, options) {
- var me = this,
- tpl = new Ext.app.bind.Template(template),
- tokens = tpl.getTokens();
- me.callParent([
- owner,
- callback,
- scope,
- options
- ]);
- me.tpl = tpl;
- me.tokens = tokens;
- tokens.$literal = true;
-
- if (!tpl.isStatic()) {
- me.multiBinding = new Ext.app.bind.Multi(tokens, owner, me.onBindData, me);
- } else {
- me.isStatic = true;
- me.onData(tpl.getText());
- }
- },
- destroy: function() {
- var me = this;
- Ext.destroy(me.multiBinding);
- me.tpl = me.multiBinding = null;
- me.callParent();
- },
- getFullName: function() {
- var multi = this.multiBinding;
- return this.fullName || (this.fullName = '$' + (multi ? multi.getFullName() : this.callParent()));
- },
- getRawValue: function() {
- return this.value;
- },
- getTemplateScope: function() {
- return null;
- },
- isAvailable: function() {
- var multi = this.multiBinding;
- return multi ? multi.isAvailable() : false;
- },
- isDescendantOf: function() {
- return false;
- },
- isLoading: function() {
- var multi = this.multiBinding;
- return multi ? multi.isLoading() : false;
- },
- onBindData: function(data) {
- this.onData(this.tpl.apply(data, this.getTemplateScope()));
- },
- onData: function(value) {
- var me = this,
- lastValue = me.value;
- if (lastValue !== (me.value = value)) {
- me.lastValue = lastValue;
- me.schedule();
- }
- },
- react: function() {
- this.notify(this.value);
- },
- refresh: function() {
- var multi = this.multiBinding;
- if (multi) {
- multi.refresh();
- }
- },
- privates: {
- sort: function() {
- var multi = this.multiBinding;
- if (multi) {
- this.scheduler.sortItem(multi);
- }
- }
- }
- });
- Ext.define('Ext.data.ChainedStore', {
- extend: Ext.data.AbstractStore,
- alias: 'store.chained',
-
- isChainedStore: true,
- config: {
-
- source: null,
- remoteFilter: false,
- remoteSort: false
- },
- mixins: [
- Ext.data.LocalStore
- ],
-
- updateRemoteFilter: function(remoteFilter, oldRemoteFilter) {
- if (remoteFilter) {
- Ext.raise('Remote filtering cannot be used with chained stores.');
- }
- this.callParent([
- remoteFilter,
- oldRemoteFilter
- ]);
- },
- updateRemoteSort: function(remoteSort, oldRemoteSort) {
- if (remoteSort) {
- Ext.raise('Remote sorting cannot be used with chained stores.');
- }
- this.callParent([
- remoteSort,
- oldRemoteSort
- ]);
- },
-
- remove: function() {
- var source = this.getSource();
-
- if (!source) {
- Ext.raise('Cannot remove records with no source.');
- }
-
- return source.remove.apply(source, arguments);
- },
- removeAll: function() {
- var source = this.getSource();
-
- if (!source) {
- Ext.raise('Cannot remove records with no source.');
- }
-
- return source.removeAll();
- },
- getData: function() {
- var me = this,
- data = me.data;
- if (!data) {
- me.data = data = me.constructDataCollection();
- }
- return data;
- },
- getTotalCount: function() {
- return this.getCount();
- },
- getSession: function() {
- return this.getSourceValue('getSession', null);
- },
- applySource: function(source) {
- if (source) {
-
- var original = source,
- s;
-
- source = Ext.data.StoreManager.lookup(source);
-
- if (!source) {
- s = 'Invalid source {0}specified for Ext.data.ChainedStore';
- s = Ext.String.format(s, typeof original === 'string' ? '"' + original + '" ' : '');
- Ext.raise(s);
- }
- }
-
- return source;
- },
- updateSource: function(source, oldSource) {
- var me = this,
- data;
- if (oldSource && !oldSource.destroyed) {
- oldSource.removeObserver(me);
- }
- if (source) {
- data = me.getData();
- data.setSource(source.getData());
- if (!me.isInitializing) {
- me.fireEvent('refresh', me);
- me.fireEvent('datachanged', me);
- }
- source.addObserver(me);
- }
- },
-
- getModel: function() {
- return this.getSourceValue('getModel', null);
- },
- getProxy: function() {
- return null;
- },
- onCollectionAdd: function(collection, info) {
- var me = this,
- records = info.items,
- lastChunk = !info.next;
- if (me.ignoreCollectionAdd) {
- return;
- }
-
-
-
- if (me.activeRanges) {
- me.syncActiveRanges();
- }
- me.fireEvent('add', me, records, info.at);
-
-
-
- if (lastChunk) {
- me.fireEvent('datachanged', me);
- }
- },
-
- onCollectionItemChange: function(collection, info) {
- var me = this,
- record = info.item,
- modifiedFieldNames = info.modified || null,
- type = info.meta;
-
-
-
- me.onUpdate(record, type, modifiedFieldNames, info);
- me.fireEvent('update', me, record, type, modifiedFieldNames, info);
- me.fireEvent('datachanged', me);
- },
- onCollectionUpdateKey: function(source, details) {
-
- this.fireEvent('idchanged', this, details.item, details.oldKey, details.newKey);
- },
- onUpdate: Ext.emptyFn,
- onCollectionRemove: function(collection, info) {
- var me = this,
- records = info.items,
- lastChunk = !info.next;
- if (me.ignoreCollectionRemove) {
- return;
- }
- me.fireEvent('remove', me, records, info.at, false);
-
-
-
- if (lastChunk) {
- me.fireEvent('datachanged', me);
- }
- },
- onSourceBeforeLoad: function(source, operation) {
- this.fireEvent('beforeload', this, operation);
- this.callObservers('BeforeLoad', [
- operation
- ]);
- },
- onSourceAfterLoad: function(source, records, successful, operation) {
- this.fireEvent('load', this, records, successful, operation);
- this.callObservers('AfterLoad', [
- records,
- successful,
- operation
- ]);
- },
- onFilterEndUpdate: function() {
- this.callParent(arguments);
- this.callObservers('Filter');
- },
- onSourceBeforePopulate: function() {
- this.ignoreCollectionAdd = true;
- this.callObservers('BeforePopulate');
- },
- onSourceAfterPopulate: function() {
- var me = this;
- me.ignoreCollectionAdd = false;
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- this.callObservers('AfterPopulate');
- },
- onSourceBeforeClear: function() {
- this.ignoreCollectionRemove = true;
- this.callObservers('BeforeClear');
- },
- onSourceAfterClear: function() {
- this.ignoreCollectionRemove = false;
- this.callObservers('AfterClear');
- },
- onSourceBeforeRemoveAll: function() {
- this.ignoreCollectionRemove = true;
- this.callObservers('BeforeRemoveAll');
- },
- onSourceAfterRemoveAll: function(source, silent) {
- var me = this;
- me.ignoreCollectionRemove = false;
- if (!silent) {
- me.fireEvent('clear', me);
- me.fireEvent('datachanged', me);
- }
- this.callObservers('AfterRemoveAll', [
- silent
- ]);
- },
- onSourceFilter: function() {
- var me = this;
- me.fireEvent('refresh', me);
- me.fireEvent('datachanged', me);
- },
- hasPendingLoad: function() {
- return this.getSourceValue('hasPendingLoad', false);
- },
- isLoaded: function() {
- return this.getSourceValue('isLoaded', false);
- },
- isLoading: function() {
- return this.getSourceValue('isLoading', false);
- },
- doDestroy: function() {
- var me = this;
- me.observers = null;
- me.setSource(null);
- me.getData().destroy(true);
- me.data = null;
- me.callParent();
- },
- privates: {
- getSourceValue: function(method, defaultValue) {
- var source = this.getSource(),
- val = defaultValue;
- if (source && !source.destroyed) {
- val = source[method]();
- }
- return val;
- },
- isMoving: function() {
- var source = this.getSource();
- return source.isMoving ? source.isMoving.apply(source, arguments) : false;
- },
- loadsSynchronously: function() {
- return this.getSource().loadsSynchronously();
- }
- }
- });
- Ext.define('Ext.app.ViewModel', {
- mixins: [
- Ext.mixin.Factoryable,
- Ext.mixin.Identifiable
- ],
- alias: 'viewmodel.default',
-
- isViewModel: true,
- factoryConfig: {
- name: 'viewModel'
- },
- collectTimeout: 100,
- expressionRe: /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i,
- statics: {
-
- escape: function(value) {
- var ret = value,
- key;
- if (typeof value === 'string') {
- ret = '~~' + value;
- } else if (value && value.constructor === Object) {
- ret = {};
- for (key in value) {
- ret[key] = this.escape(value[key]);
- }
- }
- return ret;
- }
- },
- $configStrict: false,
-
- config: {
-
- data: true,
-
- formulas: {
- $value: null,
- merge: function(newValue, currentValue, target, mixinClass) {
- return this.mergeNew(newValue, currentValue, target, mixinClass);
- }
- },
-
- links: null,
-
- parent: null,
-
- root: true,
-
- scheduler: null,
-
- schema: 'default',
-
- session: null,
-
-
- stores: null,
-
- view: null
- },
- constructor: function(config) {
-
- this.bindings = {};
-
- this.initConfig(config);
- },
- destroy: function() {
- var me = this,
- scheduler = me._scheduler,
- stores = me.storeInfo,
- parent = me.getParent(),
- task = me.collectTask,
- children = me.children,
- bindings = me.bindings,
- key, store, autoDestroy, storeBinding;
- me.destroying = true;
- if (task) {
- task.cancel();
- me.collectTask = null;
- }
-
-
-
-
- if (children) {
- for (key in children) {
- children[key].destroy();
- }
- }
- if (stores) {
- for (key in stores) {
- store = stores[key];
-
-
- storeBinding = store.$binding;
- autoDestroy = store.autoDestroy;
- if (autoDestroy || (!store.$wasInstance && autoDestroy !== false)) {
- store.destroy();
- }
- Ext.destroy(storeBinding);
- }
- }
- if (parent) {
- parent.unregisterChild(me);
- }
- me.getRoot().destroy();
- for (key in bindings) {
- bindings[key].destroy();
- }
- if (scheduler && scheduler.$owner === me) {
- scheduler.$owner = null;
- scheduler.destroy();
- }
- me.children = me.storeInfo = me._session = me._view = me._scheduler = me.bindings = me._root = me._parent = me.formulaFn = me.$formulaData = null;
- me.destroying = false;
- me.callParent();
- },
-
- bind: function(descriptor, callback, scope, options) {
- var me = this,
- track = true,
- binding;
- scope = scope || me;
- if (!options && descriptor.bindTo !== undefined && !Ext.isString(descriptor)) {
- options = descriptor;
- descriptor = options.bindTo;
- }
- if (!Ext.isString(descriptor)) {
- binding = new Ext.app.bind.Multi(descriptor, me, callback, scope, options);
- } else if (me.expressionRe.test(descriptor)) {
-
- descriptor = descriptor.substring(1, descriptor.length - 1);
- binding = me.bindExpression(descriptor, callback, scope, options);
- track = false;
- } else {
- binding = new Ext.app.bind.TemplateBinding(descriptor, me, callback, scope, options);
- }
- if (track) {
- me.bindings[binding.id] = binding;
- }
- return binding;
- },
-
- getSession: function() {
- var me = this,
- session = me._session,
- parent;
- if (!session && (parent = me.getParent())) {
- me.setSession(session = parent.getSession());
- }
- return session || null;
- },
-
- getStore: function(key) {
- var storeInfo = this.storeInfo,
- store;
- if (storeInfo) {
- store = storeInfo[key];
- }
- return store || null;
- },
-
-
- linkTo: function(key, reference) {
- var me = this,
- stub, create, id, modelType, linkStub, rec;
-
- if (key.indexOf('.') > -1) {
- Ext.raise('Links can only be at the top-level: "' + key + '"');
- }
-
- if (reference.isModel) {
- reference = {
- type: reference.entityName,
- id: reference.id
- };
- }
-
- modelType = reference.type || reference.reference;
- create = reference.create;
- if (modelType) {
-
- id = reference.id;
-
- if (!reference.create && Ext.isEmpty(id)) {
- Ext.raise('No id specified. To create a phantom model, specify "create: true" as part of the reference.');
- }
-
- if (create) {
- id = undefined;
- }
- rec = me.getRecord(modelType, id);
- if (Ext.isObject(create)) {
- rec.set(create);
- rec.commit();
- rec.phantom = true;
- }
-
-
- stub = me.getRoot().createStubChild(key);
- stub.set(rec);
- } else {
- stub = me.getStub(key);
- if (!stub.isLinkStub) {
-
- linkStub = new Ext.app.bind.LinkStub(me, stub.name);
- stub.graft(linkStub);
- stub = linkStub;
- }
- stub.link(reference);
- }
- },
-
- notify: function() {
- var scheduler = this.getScheduler();
- if (!scheduler.firing) {
- scheduler.notify();
- }
- },
-
- get: function(path) {
- return this.getStub(path).getValue();
- },
-
- set: function(path, value) {
- var me = this,
- obj, stub;
-
- me.getData();
- if (value === undefined && path && path.constructor === Object) {
- stub = me.getRoot();
- value = path;
- } else if (path && path.indexOf('.') < 0) {
- obj = {};
- obj[path] = value;
- value = obj;
- stub = me.getRoot();
- } else {
- stub = me.getStub(path);
- }
- stub.set(value);
- },
-
-
- privates: {
- registerChild: function(child) {
- var children = this.children;
- if (!children) {
- this.children = children = {};
- }
- children[child.getId()] = child;
- },
- unregisterChild: function(child) {
- var children = this.children;
-
-
- if (!this.destroying && children) {
- delete children[child.getId()];
- }
- },
-
- getRecord: function(type, id) {
- var session = this.getSession(),
- Model = type,
- hasId = id !== undefined,
- record;
- if (session) {
- if (hasId) {
- record = session.getRecord(type, id);
- } else {
- record = session.createRecord(type);
- }
- } else {
- if (!Model.$isClass) {
- Model = this.getSchema().getEntity(Model);
-
- if (!Model) {
- Ext.raise('Invalid model name: ' + type);
- }
- }
-
- if (hasId) {
- record = Model.createWithId(id);
- record.load();
- } else {
- record = new Model();
- }
- }
- return record;
- },
- bindExpression: function(descriptor, callback, scope, options) {
- var stub = this.getStub(descriptor);
- return stub.bind(callback, scope, options);
- },
- applyScheduler: function(scheduler) {
- if (scheduler && !scheduler.isInstance) {
- if (scheduler === true) {
- scheduler = {};
- }
- if (!('preSort' in scheduler)) {
- scheduler = Ext.apply({
- preSort: 'kind,-depth'
- }, scheduler);
- }
- scheduler = new Ext.util.Scheduler(scheduler);
- scheduler.$owner = this;
- }
- return scheduler;
- },
- getScheduler: function() {
- var me = this,
- scheduler = me._scheduler,
- parent;
- if (!scheduler) {
- if (!(parent = me.getParent())) {
- scheduler = new Ext.util.Scheduler({
-
- preSort: 'kind,-depth'
- });
- scheduler.$owner = me;
- } else {
- scheduler = parent.getScheduler();
- }
- me.setScheduler(scheduler);
- }
- return scheduler;
- },
-
- getStub: function(bindDescr) {
- var root = this.getRoot();
- return bindDescr ? root.getChild(bindDescr) : root;
- },
- collect: function() {
- var me = this,
- parent = me.getParent(),
- task = me.collectTask;
- if (parent) {
- parent.collect();
- return;
- }
- if (!task) {
- task = me.collectTask = new Ext.util.DelayedTask(me.doCollect, me);
- }
-
- if (me.collectTimeout === 0) {
- me.doCollect();
- } else {
- task.delay(me.collectTimeout);
- }
- },
- doCollect: function() {
- var children = this.children,
- key;
-
-
- if (children) {
- for (key in children) {
- children[key].doCollect();
- }
- }
- this.getRoot().collect();
- },
- invalidateChildLinks: function(name, clear) {
- var children = this.children,
- key;
- if (children) {
- for (key in children) {
- children[key].getRoot().invalidateChildLink(name, clear);
- }
- }
- },
- onBindDestroy: function(binding, fromChild) {
- var me = this,
- parent;
- if (me.destroying) {
- return;
- }
- if (!fromChild) {
- delete me.bindings[binding.id];
- }
- parent = me.getParent();
- if (parent) {
- parent.onBindDestroy(binding, true);
- } else {
- me.collect();
- }
- },
-
-
-
- applyData: function(newData, data) {
- var me = this,
- linkData, parent;
-
- me.getSession();
- if (!data) {
- parent = me.getParent();
-
- me.linkData = linkData = parent ? Ext.Object.chain(parent.getData()) : {};
-
- me.data = me._data = Ext.Object.chain(linkData);
- }
- if (newData && newData.constructor === Object) {
- me.getRoot().set(newData, true);
- }
- },
- applyParent: function(parent) {
- if (parent) {
- parent.registerChild(this);
- }
- return parent;
- },
- applyStores: function(stores) {
- var me = this,
- root = me.getRoot(),
- key, cfg, storeBind, stub, listeners;
- me.storeInfo = {};
- me.listenerScopeFn = function() {
- return me.getView().getInheritedConfig('defaultListenerScope');
- };
- for (key in stores) {
- cfg = stores[key];
- if (cfg.isStore) {
- cfg.$wasInstance = true;
- me.setupStore(cfg, key);
-
- continue;
- } else if (Ext.isString(cfg)) {
- cfg = {
- source: cfg
- };
- } else {
- cfg = Ext.apply({}, cfg);
- }
-
- listeners = cfg.listeners;
- delete cfg.listeners;
- storeBind = me.bind(cfg, me.onStoreBind, me, {
- trackStatics: true
- });
- if (storeBind.isStatic()) {
-
-
- storeBind.destroy();
- me.createStore(key, cfg, listeners);
- } else {
- storeBind.$storeKey = key;
- storeBind.$listeners = listeners;
- stub = root.createStubChild(key);
- stub.setStore(storeBind);
- }
- }
- },
- onStoreBind: function(cfg, oldValue, binding) {
- var info = this.storeInfo,
- key = binding.$storeKey,
- store = info[key],
- proxy;
- if (!store) {
- this.createStore(key, cfg, binding.$listeners, binding);
- } else {
- cfg = Ext.merge({}, binding.pruneStaticKeys());
- proxy = cfg.proxy;
- delete cfg.type;
- delete cfg.model;
- delete cfg.fields;
- delete cfg.proxy;
- delete cfg.listeners;
-
-
- if (proxy) {
- delete proxy.reader;
- delete proxy.writer;
- store.getProxy().setConfig(proxy);
- }
- store.setConfig(cfg);
- }
- },
- createStore: function(key, cfg, listeners, binding) {
- var session = this.getSession(),
- store;
- cfg = Ext.apply({}, cfg);
- if (cfg.session) {
- cfg.session = session;
- }
- if (cfg.source) {
- cfg.type = cfg.type || 'chained';
- }
-
- cfg.listeners = listeners;
-
- cfg.resolveListenerScope = this.listenerScopeFn;
- store = Ext.Factory.store(cfg);
- store.$binding = binding;
- this.setupStore(store, key);
- },
- setupStore: function(store, key) {
- var me = this,
- obj = {};
-
- me.getData();
-
- store.resolveListenerScope = me.listenerScopeFn;
- me.storeInfo[key] = store;
- obj[key] = store;
- me.setData(obj);
- },
- applyFormulas: function(formulas) {
- var me = this,
- root = me.getRoot(),
- name, stub;
- me.getData();
-
- for (name in formulas) {
-
- if (name.indexOf('.') >= 0) {
- Ext.raise('Formula names cannot contain dots: ' + name);
- }
-
-
- root.createStubChild(name);
- stub = me.getStub(name);
- stub.setFormula(formulas[name]);
- }
- return formulas;
- },
- applyLinks: function(links) {
- for (var link in links) {
- this.linkTo(link, links[link]);
- }
- },
- applySchema: function(schema) {
- return Ext.data.schema.Schema.get(schema);
- },
- applyRoot: function() {
- var root = new Ext.app.bind.RootStub(this),
- parent = this.getParent();
- if (parent) {
-
-
- root.depth = parent.getRoot().depth - 1000;
- }
- return root;
- },
- getFormulaFn: function(data) {
- var me = this,
- fn = me.formulaFn;
- if (!fn) {
- fn = me.formulaFn = function(name) {
-
-
- return me.$formulaData[name];
- };
- }
- me.$formulaData = data;
- return fn;
- }
- }
- });
- Ext.define('Ext.app.domain.Controller', {
- extend: Ext.app.EventDomain,
- singleton: true,
- type: 'controller',
- prefix: 'controller.',
- idMatchRe: /^\#/,
- constructor: function() {
- var me = this;
- me.callParent();
- me.monitor(Ext.app.BaseController);
- },
- match: function(target, selector) {
- var result = false,
- alias = target.alias;
- if (selector === '*') {
- result = true;
- } else if (selector === '#') {
- result = !!target.isApplication;
- } else if (this.idMatchRe.test(selector)) {
- result = target.getId() === selector.substring(1);
- } else if (alias) {
- result = Ext.Array.indexOf(alias, this.prefix + selector) > -1;
- }
- return result;
- }
- });
- Ext.define('Ext.direct.Manager', {
- singleton: true,
- mixins: [
- Ext.mixin.Observable
- ],
-
- exceptions: {
- TRANSPORT: 'xhr',
- PARSE: 'parse',
- DATA: 'data',
- LOGIN: 'login',
- SERVER: 'exception'
- },
-
- providerClasses: {},
-
- remotingMethods: {},
- config: {
-
- varName: 'Ext.REMOTING_API'
- },
- apiNotFoundError: 'Ext Direct API was not found at {0}',
-
-
-
-
-
- constructor: function() {
- var me = this;
- me.mixins.observable.constructor.call(me);
- me.transactions = new Ext.util.MixedCollection();
- me.providers = new Ext.util.MixedCollection();
- },
-
- addProvider: function(provider) {
- var me = this,
- args = arguments,
- relayers = me.relayers || (me.relayers = {}),
- i, len;
- if (args.length > 1) {
- for (i = 0 , len = args.length; i < len; ++i) {
- me.addProvider(args[i]);
- }
- return;
- }
-
- if (!provider.isProvider) {
- provider = Ext.create('direct.' + provider.type + 'provider', provider);
- }
- me.providers.add(provider);
- provider.on('data', me.onProviderData, me);
- if (provider.relayedEvents) {
- relayers[provider.id] = me.relayEvents(provider, provider.relayedEvents);
- }
- if (!provider.isConnected()) {
- provider.connect();
- }
- return provider;
- },
-
- loadProvider: function(config, callback, scope) {
- var me = this,
- classes = me.providerClasses,
- type, url, varName, provider, i, len;
- if (Ext.isArray(config)) {
- for (i = 0 , len = config.length; i < len; i++) {
- me.loadProvider(config[i], callback, scope);
- }
- return;
- }
-
-
- type = config.type;
- url = config.url;
- if (classes[type] && classes[type].checkConfig(config)) {
- provider = me.addProvider(config);
- me.fireEventArgs('providerload', [
- url,
- provider
- ]);
- Ext.callback(callback, scope, [
- url,
- provider
- ]);
-
-
-
-
- return;
- }
-
-
-
- varName = config.varName || me.getVarName();
- delete config.varName;
-
- if (!url) {
- Ext.raise("Need API discovery URL to load a Remoting provider!");
- }
-
-
-
- delete config.url;
-
-
- Ext.Loader.loadScript({
- url: url,
- scope: me,
- onLoad: function() {
- this.onApiLoadSuccess({
- url: url,
- varName: varName,
- config: config,
- callback: callback,
- scope: scope
- });
- },
- onError: function() {
- this.onApiLoadFailure({
- url: url,
- callback: callback,
- scope: scope
- });
- }
- });
- },
-
- getProvider: function(id) {
- return id.isProvider ? id : this.providers.get(id);
- },
-
- removeProvider: function(provider) {
- var me = this,
- providers = me.providers,
- relayers = me.relayers,
- id;
- provider = provider.isProvider ? provider : providers.get(provider);
- if (provider) {
- provider.un('data', me.onProviderData, me);
- id = provider.id;
- if (relayers[id]) {
- relayers[id].destroy();
- delete relayers[id];
- }
- providers.remove(provider);
- return provider;
- }
- return null;
- },
-
- addTransaction: function(transaction) {
- this.transactions.add(transaction);
- return transaction;
- },
-
- removeTransaction: function(transaction) {
- var me = this;
- transaction = me.getTransaction(transaction);
- me.transactions.remove(transaction);
- return transaction;
- },
-
- getTransaction: function(transaction) {
- return typeof transaction === 'object' ? transaction : this.transactions.get(transaction);
- },
- onProviderData: function(provider, event) {
- var me = this,
- i, len;
- if (Ext.isArray(event)) {
- for (i = 0 , len = event.length; i < len; ++i) {
- me.onProviderData(provider, event[i]);
- }
- return;
- }
- if (event.name && event.name !== 'event' && event.name !== 'exception') {
- me.fireEvent(event.name, event);
- } else if (event.status === false) {
- me.fireEvent('exception', event);
- }
- me.fireEvent('event', event, provider);
- },
-
- parseMethod: function(fn) {
- var current = Ext.global,
- i = 0,
- resolved, parts, len;
- if (Ext.isFunction(fn)) {
- resolved = fn;
- } else if (Ext.isString(fn)) {
- resolved = this.remotingMethods[fn];
-
-
- if (!resolved) {
- parts = fn.split('.');
- len = parts.length;
- while (current && i < len) {
- current = current[parts[i]];
- ++i;
- }
- resolved = Ext.isFunction(current) ? current : null;
- }
- }
- return resolved || null;
- },
-
- resolveApi: function(api, caller) {
- var prefix, action, method, fullName, fn;
- prefix = api && api.prefix;
- if (prefix && prefix.substr(prefix.length - 1) !== '.') {
- prefix += '.';
- }
- for (action in api) {
- method = api[action];
- if (action !== 'prefix' && typeof method !== 'function') {
- fullName = (prefix || '') + method;
- fn = this.parseMethod(fullName);
- if (typeof fn === 'function') {
- api[action] = fn;
- } else
- {
- Ext.raise("Cannot resolve Direct API method '" + fullName + "' for " + action + " action in " + caller.$className + " instance with id: " + (caller.id != null ? caller.id : 'unknown'));
- }
- }
- }
-
- return api;
- },
- privates: {
- addProviderClass: function(type, cls) {
- this.providerClasses[type] = cls;
- },
- onApiLoadSuccess: function(options) {
- var me = this,
- url = options.url,
- varName = options.varName,
- api, provider, error;
- try {
-
-
- api = Ext.apply(options.config, eval(varName));
- provider = me.addProvider(api);
- } catch (e) {
- error = e + '';
- }
- if (error) {
- me.fireEventArgs('providerloaderror', [
- url,
- error
- ]);
- Ext.callback(options.callback, options.scope, [
- url,
- error
- ]);
- } else {
- me.fireEventArgs('providerload', [
- url,
- provider
- ]);
- Ext.callback(options.callback, options.scope, [
- url,
- provider
- ]);
- }
- },
- onApiLoadFailure: function(options) {
- var url = options.url,
- error;
- error = Ext.String.format(this.apiNotFoundError, url);
- this.fireEventArgs('providerloaderror', [
- url,
- error
- ]);
- Ext.callback(options.callback, options.scope, [
- url,
- error
- ]);
- },
- registerMethod: function(name, method) {
- this.remotingMethods[name] = method;
- },
-
- clearAllMethods: function() {
- this.remotingMethods = {};
- }
- }
- }, function() {
-
- Ext.Direct = Ext.direct.Manager;
- });
- Ext.define('Ext.direct.Provider', {
- alias: 'direct.provider',
- mixins: [
- Ext.mixin.Observable
- ],
- isProvider: true,
- $configPrefixed: false,
- $configStrict: false,
-
-
- config: {
-
- headers: undefined
- },
-
-
-
-
- subscribers: 0,
- constructor: function(config) {
- var me = this;
- me.mixins.observable.constructor.call(me, config);
- me.requests = {};
- Ext.applyIf(me, {
- id: Ext.id(null, 'provider-')
- });
- },
- destroy: function() {
- var me = this;
- me.disconnect(true);
- me.callParent();
- },
-
- isConnected: function() {
- return this.subscribers > 0;
- },
-
- connect: function() {
- var me = this;
- if (me.subscribers === 0) {
- me.doConnect();
- me.fireEventArgs('connect', [
- me
- ]);
- }
- me.subscribers++;
- },
-
- doConnect: Ext.emptyFn,
-
- disconnect: function(
- force) {
- var me = this;
- if (me.subscribers > 0 || force) {
- if (force) {
- me.subscribers = 0;
- } else {
- me.subscribers--;
- }
- if (me.subscribers === 0) {
- me.doDisconnect();
- me.fireEventArgs('disconnect', [
- me
- ]);
- }
- }
- },
-
- doDisconnect: function() {
- var requests = this.requests,
- request, id;
- for (id in requests) {
- request = requests[id];
- request.abort();
- }
- this.requests = {};
- },
-
- sendAjaxRequest: function(params) {
- var request = Ext.Ajax.request(params);
- if (request && request.id) {
- this.requests[request.id] = request;
- }
- return request;
- },
-
- onData: function(options, success, response) {
- if (response && response.request) {
- delete this.requests[response.request.id];
- }
- },
- inheritableStatics: {
-
- checkConfig: Ext.returnFalse
- },
- onClassExtended: function(cls, data, hooks) {
- if (data.type) {
- Ext.direct.Manager.addProviderClass(data.type, cls);
- }
- }
- });
- Ext.define('Ext.app.domain.Direct', {
- extend: Ext.app.EventDomain,
- singleton: true,
- type: 'direct',
- idProperty: 'id',
- constructor: function() {
- var me = this;
- me.callParent();
- me.monitor(Ext.direct.Provider);
- }
- });
- Ext.define('Ext.data.PageMap', {
- extend: Ext.util.LruCache,
- config: {
- store: null,
-
- pageSize: 0,
-
- rootProperty: ''
- },
-
- clear: function(initial) {
- var me = this;
- me.pageMapGeneration = (me.pageMapGeneration || 0) + 1;
-
- me.indexMap = {};
- me.callParent([
- initial
- ]);
- },
-
- updatePageSize: function(value, oldValue) {
- if (oldValue != null) {
- throw "pageMap page size may not be changed";
- }
- },
-
- forEach: function(fn, scope) {
- var me = this,
- pageNumbers = Ext.Object.getKeys(me.map),
- pageCount = pageNumbers.length,
- pageSize = me.getPageSize(),
- i, j, pageNumber, page, len;
- for (i = 0; i < pageCount; i++) {
- pageNumbers[i] = +pageNumbers[i];
- }
- Ext.Array.sort(pageNumbers, Ext.Array.numericSortFn);
- scope = scope || me;
- for (i = 0; i < pageCount; i++) {
- pageNumber = pageNumbers[i];
- page = me.getPage(pageNumber);
- len = page.length;
- for (j = 0; j < len; j++) {
- if (fn.call(scope, page[j], (pageNumber - 1) * pageSize + j) === false) {
- return;
- }
- }
- }
- },
-
- findBy: function(fn, scope) {
- var me = this,
- result = null;
- scope = scope || me;
- me.forEach(function(rec, index) {
- if (fn.call(scope, rec, index)) {
- result = rec;
- return false;
- }
- });
- return result;
- },
-
- findIndexBy: function(fn, scope) {
- var me = this,
- result = -1;
- scope = scope || me;
- me.forEach(function(rec, index) {
- if (fn.call(scope, rec)) {
- result = index;
- return false;
- }
- });
- return result;
- },
- find: function(property, value, start, startsWith, endsWith, ignoreCase) {
- if (Ext.isEmpty(value, false)) {
- return null;
- }
- var regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase),
- root = this.getRootProperty();
- return this.findBy(function(item) {
- return item && regex.test((root ? item[root] : item)[property]);
- }, null, start);
- },
- findIndex: function(property, value, start, startsWith, endsWith, ignoreCase) {
- if (Ext.isEmpty(value, false)) {
- return null;
- }
- var regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase),
- root = this.getRootProperty();
- return this.findIndexBy(function(item) {
- return item && regex.test((root ? item[root] : item)[property]);
- }, null, start);
- },
- getPageFromRecordIndex: function(index) {
- return Math.floor(index / this.getPageSize()) + 1;
- },
- addAll: function(records) {
-
- if (this.getCount()) {
- Ext.raise('Cannot addAll to a non-empty PageMap');
- }
-
- this.addPage(1, records);
- },
- addPage: function(pageNumber, records) {
- var me = this,
- pageSize = me.getPageSize(),
- lastPage = pageNumber + Math.floor((records.length - 1) / pageSize),
- storeIndex = (pageNumber - 1) * pageSize,
- indexMap = me.indexMap,
- page, i, len, startIdx;
-
-
- for (startIdx = 0; pageNumber <= lastPage; pageNumber++ , startIdx += pageSize) {
- page = Ext.Array.slice(records, startIdx, startIdx + pageSize);
-
- for (i = 0 , len = page.length; i < len; i++) {
- indexMap[page[i].internalId] = storeIndex++;
- }
- me.add(pageNumber, page);
- me.fireEvent('pageadd', me, pageNumber, page);
- }
- },
- getCount: function() {
- var result = this.callParent();
- if (result) {
- result = (result - 1) * this.getPageSize() + this.last.value.length;
- }
- return result;
- },
- getByInternalId: function(internalId) {
- var index = this.indexMap[internalId];
- if (index != null) {
- return this.getAt(index);
- }
- },
- indexOf: function(record) {
- var result = -1;
- if (record) {
- result = this.indexMap[record.internalId];
- if (result == null) {
- result = -1;
- }
- }
- return result;
- },
- insert: function() {
-
- Ext.raise('insert operation not suppported into buffered Store');
- },
-
- remove: function() {
-
- Ext.raise('remove operation not suppported from buffered Store');
- },
-
- removeAt: function() {
-
- Ext.raise('removeAt operation not suppported from buffered Store');
- },
-
- removeAtKey: function(page) {
-
- var me = this,
- thePage = me.getPage(page),
- len, i, result;
- if (thePage) {
- if (me.fireEvent('beforepageremove', me, page, thePage) !== false) {
- len = thePage.length;
- for (i = 0; i < len; i++) {
- delete me.indexMap[thePage[i].internalId];
- }
- result = me.callParent(arguments);
- me.fireEvent('pageremove', me, page, thePage);
-
- thePage.length = 0;
- }
- }
- return result;
- },
- getPage: function(pageNumber) {
- return this.get(pageNumber);
- },
- hasRange: function(start, end) {
- var me = this,
- pageNumber = me.getPageFromRecordIndex(start),
- endPageNumber = me.getPageFromRecordIndex(end);
- for (; pageNumber <= endPageNumber; pageNumber++) {
- if (!me.hasPage(pageNumber)) {
- return false;
- }
- }
-
- return (endPageNumber - 1) * me._pageSize + me.getPage(endPageNumber).length > end;
- },
- hasPage: function(pageNumber) {
-
- return !!this.get(pageNumber);
- },
- peekPage: function(pageNumber) {
- return this.map[pageNumber];
- },
- getAt: function(index) {
- return this.getRange(index, index + 1)[0];
- },
- getRange: function(start, end) {
-
-
- if (end) {
- end--;
- }
- if (!this.hasRange(start, end)) {
- Ext.raise('PageMap asked for range which it does not have');
- }
- var me = this,
- Array = Ext.Array,
- pageSize = me.getPageSize(),
- startPageNumber = me.getPageFromRecordIndex(start),
- endPageNumber = me.getPageFromRecordIndex(end),
- dataStart = (startPageNumber - 1) * pageSize,
- dataEnd = (endPageNumber * pageSize) - 1,
- pageNumber = startPageNumber,
- result = [],
- sliceBegin, sliceEnd, doSlice;
- for (; pageNumber <= endPageNumber; pageNumber++) {
-
- if (pageNumber === startPageNumber) {
- sliceBegin = start - dataStart;
- doSlice = sliceBegin > 0;
- } else {
- sliceBegin = 0;
- doSlice = false;
- }
- if (pageNumber === endPageNumber) {
- sliceEnd = pageSize - (dataEnd - end);
- doSlice = doSlice || sliceEnd < pageSize;
- }
-
- if (doSlice) {
- Array.push(result, Array.slice(me.getPage(pageNumber), sliceBegin, sliceEnd));
- } else {
- Array.push(result, me.getPage(pageNumber));
- }
- }
- return result;
- }
- });
- Ext.define('Ext.data.BufferedStore', {
- extend: Ext.data.ProxyStore,
- alias: 'store.buffered',
-
- isBufferedStore: true,
-
- buffered: true,
- config: {
- data: 0,
- pageSize: 25,
-
- remoteSort: true,
-
- remoteFilter: true,
-
- sortOnLoad: false,
-
- purgePageCount: 5,
-
- trailingBufferZone: 25,
-
- leadingBufferZone: 200,
-
- defaultViewSize: 100,
-
- viewSize: 0,
-
- trackRemoved: false
- },
-
- applyData: function(data) {
- var dataCollection = this.data || (this.data = this.createDataCollection());
-
- if (data && data !== true) {
- Ext.raise('Cannot load a buffered store with local data - the store is a map of remote data');
- }
-
- return dataCollection;
- },
- applyProxy: function(proxy) {
- proxy = this.callParent([
- proxy
- ]);
-
-
- if (proxy && proxy.setEnablePaging) {
- proxy.setEnablePaging(true);
- }
- return proxy;
- },
- applyAutoSort: function() {},
-
-
- createFiltersCollection: function() {
- return new Ext.util.FilterCollection();
- },
- createSortersCollection: function() {
- return new Ext.util.SorterCollection();
- },
-
- updateRemoteFilter: function(remoteFilter, oldRemoteFilter) {
- if (remoteFilter === false) {
- Ext.raise('Buffered stores are always remotely filtered.');
- }
- this.callParent([
- remoteFilter,
- oldRemoteFilter
- ]);
- },
- updateRemoteSort: function(remoteSort, oldRemoteSort) {
- if (remoteSort === false) {
- Ext.raise('Buffered stores are always remotely sorted.');
- }
- this.callParent([
- remoteSort,
- oldRemoteSort
- ]);
- },
- updateTrackRemoved: function(value) {
- if (value !== false) {
- Ext.raise('Cannot use trackRemoved with a buffered store.');
- }
- this.callParent(arguments);
- },
-
- updateGroupField: function(field) {
- this.group(field);
- },
- getGrouper: function() {
- return this.grouper;
- },
- isGrouped: function() {
- return !!this.grouper;
- },
- createDataCollection: function() {
- var me = this,
- result = new Ext.data.PageMap({
- store: me,
- rootProperty: 'data',
- pageSize: me.getPageSize(),
- maxSize: me.getPurgePageCount(),
- listeners: {
-
-
- clear: me.onPageMapClear,
- scope: me
- }
- });
-
- me.relayEvents(result, [
- 'beforepageremove',
- 'pageadd',
- 'pageremove'
- ]);
- me.pageRequests = {};
- return result;
- },
-
- add: function() {
- Ext.raise('add method may not be called on a buffered store - the store is a map of remote data');
- },
- insert: function() {
- Ext.raise('insert method may not be called on a buffered store - the store is a map of remote data');
- },
-
- removeAll: function(silent) {
- var me = this,
- data = me.getData();
- if (data) {
- if (silent) {
- me.suspendEvent('clear');
- }
- data.clear();
- if (silent) {
- me.resumeEvent('clear');
- }
- }
- },
- flushLoad: function() {
- var me = this,
- options = me.pendingLoadOptions;
-
- me.clearLoadTask();
- if (!options) {
- return;
- }
-
-
- if (!options.preserveOnFlush) {
- me.getData().clear();
- options.page = 1;
- options.start = 0;
- options.limit = me.getViewSize() || me.getDefaultViewSize();
- }
-
-
- options.loadCallback = options.callback;
-
- options.callback = null;
- return me.loadToPrefetch(options);
- },
- reload: function(options) {
- var me = this,
- data = me.getData(),
-
- lastTotal = Number.MAX_VALUE,
- startIdx, endIdx, startPage, endPage, i, waitForReload, bufferZone, records;
- if (!options) {
- options = {};
- }
-
- if (me.loading || me.fireEvent('beforeload', me, options) === false) {
- return;
- }
- waitForReload = function() {
- var newCount = me.totalCount,
- oldRequestSize = endIdx - startIdx;
-
-
- if (endIdx >= newCount) {
- endIdx = newCount - 1;
- startIdx = Math.max(endIdx - oldRequestSize, 0);
- }
- if (me.rangeCached(startIdx, endIdx, false)) {
- me.loadCount = (me.loadCount || 0) + 1;
- me.loading = false;
- data.un('pageadd', waitForReload);
- records = data.getRange(startIdx, endIdx);
- me.fireEvent('refresh', me);
- me.fireEvent('load', me, records, true);
- }
- };
- bufferZone = Math.ceil((me.getLeadingBufferZone() + me.getTrailingBufferZone()) / 2);
-
-
-
-
- if (me.lastRequestStart && me.preserveScrollOnReload) {
- startIdx = me.lastRequestStart;
- endIdx = me.lastRequestEnd;
- lastTotal = me.getTotalCount();
- } else
- {
- startIdx = options.start || 0;
- endIdx = startIdx + (options.count || me.getPageSize()) - 1;
- }
-
- data.clear(true);
-
- delete me.totalCount;
-
- startIdx = Math.max(startIdx - bufferZone, 0);
- endIdx = Math.min(endIdx + bufferZone, lastTotal);
-
-
-
-
- startIdx = startIdx === 0 ? 0 : startIdx - 1;
- endIdx = endIdx === lastTotal ? endIdx : endIdx + 1;
- startPage = me.getPageFromRecordIndex(startIdx);
- endPage = me.getPageFromRecordIndex(endIdx);
- me.loading = true;
- options.waitForReload = waitForReload;
-
-
- data.on('pageadd', waitForReload);
-
- for (i = startPage; i <= endPage; i++) {
- me.prefetchPage(i, options);
- }
- },
- filter: function() {
-
- if (!this.getRemoteFilter()) {
- Ext.raise('Local filtering may not be used on a buffered store - the store is a map of remote data');
- }
-
-
- this.callParent(arguments);
- },
- filterBy: function(fn, scope) {
-
- Ext.raise('Local filtering may not be used on a buffered store - the store is a map of remote data');
- },
-
- loadData: function(data, append) {
-
- Ext.raise('LoadData may not be used on a buffered store - the store is a map of remote data');
- },
-
- loadPage: function(page, options) {
- var me = this;
- options = options || {};
- options.page = me.currentPage = page;
- options.start = (page - 1) * me.getPageSize();
- options.limit = me.getViewSize() || me.getDefaultViewSize();
- options.loadCallback = options.callback;
-
- options.callback = null;
-
-
- options.preserveOnFlush = true;
- return me.load(options);
- },
- clearData: function(isLoad) {
- var me = this,
- data = me.getData();
- if (data) {
- data.clear();
- }
- },
-
- getCount: function() {
- return this.totalCount || 0;
- },
- getRange: function(start, end, options) {
- var me = this,
- maxIndex = me.totalCount - 1,
- lastRequestStart = me.lastRequestStart,
- result = [],
- data = me.getData(),
- pageAddHandler, requiredStart, requiredEnd, requiredStartPage, requiredEndPage;
- options = Ext.apply({
- prefetchStart: start,
- prefetchEnd: end
- }, options);
-
- end = (end >= me.totalCount) ? maxIndex : end;
-
-
-
-
-
- if (options.forRender !== false) {
- requiredStart = start === 0 ? 0 : start - 1;
- requiredEnd = end === maxIndex ? end : end + 1;
- } else {
- requiredStart = start;
- requiredEnd = end;
- }
-
- me.lastRequestStart = start;
- me.lastRequestEnd = end;
-
- if (me.rangeCached(start, end, options.forRender)) {
- me.onRangeAvailable(options);
- result = data.getRange(start, end + 1);
- } else
- {
-
- me.fireEvent('cachemiss', me, start, end);
- requiredStartPage = me.getPageFromRecordIndex(requiredStart);
- requiredEndPage = me.getPageFromRecordIndex(requiredEnd);
-
- pageAddHandler = function(pageMap, page, records) {
- if (page >= requiredStartPage && page <= requiredEndPage && me.rangeCached(start, end)) {
-
- me.fireEvent('cachefilled', me, start, end);
- data.un('pageadd', pageAddHandler);
- me.onRangeAvailable(options);
- }
- };
- data.on('pageadd', pageAddHandler);
-
-
-
- me.prefetchRange(start, end);
- }
-
- me.primeCache(start, end, start < lastRequestStart ? -1 : 1);
- return result;
- },
-
- getById: function(id) {
- var result = this.data.findBy(function(record) {
- return record.getId() === id;
- });
- return result;
- },
-
- getAt: function(index) {
- var data = this.getData();
- if (data.hasRange(index, index)) {
- return data.getAt(index);
- }
- },
-
- getByInternalId: function(internalId) {
- return this.data.getByInternalId(internalId);
- },
-
- contains: function(record) {
- return this.indexOf(record) > -1;
- },
-
- indexOf: function(record) {
- return this.getData().indexOf(record);
- },
-
- indexOfId: function(id) {
- return this.indexOf(this.getById(id));
- },
- group: function(grouper, direction) {
- var me = this,
- oldGrouper;
- if (grouper && typeof grouper === 'string') {
- oldGrouper = me.grouper;
- if (oldGrouper && direction !== undefined) {
- oldGrouper.setDirection(direction);
- } else {
- me.grouper = new Ext.util.Grouper({
- property: grouper,
- direction: direction || 'ASC',
- root: 'data'
- });
- }
- } else {
- me.grouper = grouper ? me.getSorters().decodeSorter(grouper, Ext.util.Grouper) : null;
- }
- me.getData().clear();
- me.loadPage(1, {
- callback: function() {
- me.fireEvent('groupchange', me, me.getGrouper());
- }
- });
- },
-
- getPageFromRecordIndex: function(index) {
- return Math.floor(index / this.getPageSize()) + 1;
- },
- calculatePageCacheSize: function(rangeSizeRequested) {
- var me = this,
- purgePageCount = me.getPurgePageCount();
-
-
-
- return purgePageCount ? Math.max(me.getData().getMaxSize() || 0, Math.ceil((rangeSizeRequested + me.getTrailingBufferZone() + me.getLeadingBufferZone()) / me.getPageSize()) * 2 + purgePageCount) : 0;
- },
- loadToPrefetch: function(options) {
- var me = this,
- prefetchOptions = options,
- i, records, dataSetSize,
-
- startIdx = options.start,
- endIdx = options.start + options.limit - 1,
- rangeSizeRequested = (me.getViewSize() || options.limit),
-
- loadEndIdx = Math.min(endIdx, options.start + rangeSizeRequested - 1),
-
-
- startPage = me.getPageFromRecordIndex(Math.max(startIdx - me.getTrailingBufferZone(), 0)),
- endPage = me.getPageFromRecordIndex(endIdx + me.getLeadingBufferZone()),
- data = me.getData(),
- callbackFn = function() {
-
- records = records || [];
- if (options.loadCallback) {
- options.loadCallback.call(options.scope || me, records, operation, true);
- }
- if (options.callback) {
- options.callback.call(options.scope || me, records, startIdx || 0, endIdx || 0, options);
- }
- },
- fireEventsFn = function() {
- me.loadCount = (me.loadCount || 0) + 1;
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- me.fireEvent('load', me, records, true);
- },
-
- waitForRequestedRange = function() {
- if (me.rangeCached(startIdx, loadEndIdx)) {
- me.loading = false;
- records = data.getRange(startIdx, loadEndIdx + 1);
- data.un('pageadd', waitForRequestedRange);
-
- if (me.hasListeners.guaranteedrange) {
- me.guaranteeRange(startIdx, loadEndIdx, options.callback, options.scope);
- }
- callbackFn();
- fireEventsFn();
- }
- },
- operation;
-
- if (isNaN(me.pageSize) || !me.pageSize) {
- Ext.raise('Buffered store configured without a pageSize', me);
- }
-
-
-
- data.setMaxSize(me.calculatePageCacheSize(rangeSizeRequested));
- if (me.fireEvent('beforeload', me, options) !== false) {
-
- delete me.totalCount;
- me.loading = true;
-
-
- if (options.callback) {
- prefetchOptions = Ext.apply({}, options);
- delete prefetchOptions.callback;
- }
-
-
-
-
- me.on('prefetch', function(store, records, successful, op) {
-
- operation = op;
- if (successful) {
-
-
- if ((dataSetSize = me.getTotalCount())) {
-
- data.on('pageadd', waitForRequestedRange);
-
- loadEndIdx = Math.min(loadEndIdx, dataSetSize - 1);
-
- endPage = me.getPageFromRecordIndex(Math.min(loadEndIdx + me.getLeadingBufferZone(), dataSetSize - 1));
- for (i = startPage + 1; i <= endPage; ++i) {
- me.prefetchPage(i, prefetchOptions);
- }
- } else {
- callbackFn();
- fireEventsFn();
- }
- } else
- {
- me.loading = false;
- callbackFn();
- me.fireEvent('load', me, records, false);
- }
- }, null, {
- single: true
- });
- me.prefetchPage(startPage, prefetchOptions);
- }
- },
-
-
- prefetch: function(options) {
- var me = this,
- pageSize = me.getPageSize(),
- data = me.getData(),
- operation, existingPageRequest;
-
- if (pageSize) {
- if (me.lastPageSize && pageSize != me.lastPageSize) {
- Ext.raise("pageSize cannot be dynamically altered");
- }
- if (!data.getPageSize()) {
- data.setPageSize(pageSize);
- }
- } else
- {
- me.pageSize = data.setPageSize(pageSize = options.limit);
- }
-
- me.lastPageSize = pageSize;
-
- if (!options.page) {
- options.page = me.getPageFromRecordIndex(options.start);
- options.start = (options.page - 1) * pageSize;
- options.limit = Math.ceil(options.limit / pageSize) * pageSize;
- }
-
-
-
- existingPageRequest = me.pageRequests[options.page];
- if (!existingPageRequest || existingPageRequest.getOperation().pageMapGeneration !== data.pageMapGeneration) {
-
- options = Ext.apply({
- action: 'read',
- filters: me.getFilters().items,
- sorters: me.getSorters().items,
- grouper: me.getGrouper(),
- internalCallback: me.onProxyPrefetch,
- internalScope: me
- }, options);
- operation = me.createOperation('read', options);
-
-
- operation.pageMapGeneration = data.pageMapGeneration;
- if (me.fireEvent('beforeprefetch', me, operation) !== false) {
- me.pageRequests[options.page] = operation.execute();
- if (me.getProxy().isSynchronous) {
- delete me.pageRequests[options.page];
- }
- }
- }
- return me;
- },
-
- onPageMapClear: function() {
- var me = this,
- loadingFlag = me.wasLoading,
- reqs = me.pageRequests,
- data = me.getData(),
- page;
-
- data.clearListeners();
-
- data.on('clear', me.onPageMapClear, me);
- me.relayEvents(data, [
- 'beforepageremove',
- 'pageadd',
- 'pageremove'
- ]);
-
-
-
- me.loading = true;
- me.totalCount = 0;
-
-
-
-
- for (page in reqs) {
- if (reqs.hasOwnProperty(page)) {
- reqs[page].getOperation().abort();
- }
- }
-
- me.fireEvent('clear', me);
-
-
- me.loading = loadingFlag;
- },
-
- prefetchPage: function(page, options) {
- var me = this,
- pageSize = me.getPageSize(),
- start = (page - 1) * pageSize,
- total = me.totalCount;
-
- if (total !== undefined && me.data.getCount() === total) {
- return;
- }
-
- me.prefetch(Ext.applyIf({
- page: page,
- start: start,
- limit: pageSize
- }, options));
- },
-
- onProxyPrefetch: function(operation) {
- if (this.destroying || this.destroyed) {
- return;
- }
- var me = this,
- resultSet = operation.getResultSet(),
- records = operation.getRecords(),
- successful = operation.wasSuccessful(),
- page = operation.getPage(),
- waitForReload = operation.waitForReload,
- oldTotal = me.totalCount,
- requests = me.pageRequests,
- key, op;
-
-
- if (operation.pageMapGeneration === me.getData().pageMapGeneration) {
- if (resultSet) {
- me.totalCount = resultSet.getTotal();
- if (me.totalCount !== oldTotal) {
- me.fireEvent('totalcountchange', me.totalCount);
- }
- }
-
- if (page !== undefined) {
- delete me.pageRequests[page];
- }
-
- me.loading = false;
- me.fireEvent('prefetch', me, records, successful, operation);
-
-
- if (successful) {
- if (me.totalCount === 0) {
- if (waitForReload) {
- for (key in requests) {
- op = requests[key].getOperation();
-
-
- if (op.waitForReload === waitForReload) {
- delete op.waitForReload;
- }
- }
- me.getData().un('pageadd', waitForReload);
- me.fireEvent('refresh', me);
- me.fireEvent('load', me, [], true);
- }
- } else {
- me.cachePage(records, operation.getPage());
- }
- }
-
- Ext.callback(operation.getCallback(), operation.getScope() || me, [
- records,
- operation,
- successful
- ]);
- }
- },
-
- cachePage: function(records, page) {
- var me = this,
- len = records.length,
- i;
- if (!Ext.isDefined(me.totalCount)) {
- me.totalCount = records.length;
- me.fireEvent('totalcountchange', me.totalCount);
- }
-
- for (i = 0; i < len; i++) {
- records[i].join(me);
- }
- me.getData().addPage(page, records);
- },
-
- rangeCached: function(start, end, forRender) {
- var requiredStart = start,
- requiredEnd = end;
-
-
-
-
- if (forRender !== false) {
- requiredStart = start === 0 ? 0 : start - 1 , requiredEnd = end === this.totalCount - 1 ? end : end + 1;
- }
- return this.getData().hasRange(requiredStart, requiredEnd);
- },
-
- pageCached: function(page) {
- return this.getData().hasPage(page);
- },
-
- pagePending: function(page) {
- return !!this.pageRequests[page];
- },
-
- rangeSatisfied: function(start, end) {
- return this.rangeCached(start, end);
- },
-
- onRangeAvailable: function(options) {
- var me = this,
- totalCount = me.getTotalCount(),
- start = options.prefetchStart,
- end = (options.prefetchEnd > totalCount - 1) ? totalCount - 1 : options.prefetchEnd,
- range;
- end = Math.max(0, end);
-
- if (start > end) {
- Ext.log({
- level: 'warn',
- msg: 'Start (' + start + ') was greater than end (' + end + ') for the range of records requested (' + start + '-' + options.prefetchEnd + ')' + (this.storeId ? ' from store "' + this.storeId + '"' : '')
- });
- }
-
- range = me.getData().getRange(start, end + 1);
- if (options.fireEvent !== false) {
- me.fireEvent('guaranteedrange', range, start, end, options);
- }
- if (options.callback) {
- options.callback.call(options.scope || me, range, start, end, options);
- }
- },
-
- guaranteeRange: function(start, end, callback, scope, options) {
- options = Ext.apply({
- callback: callback,
- scope: scope
- }, options);
- this.getRange(start, end + 1, options);
- },
-
- prefetchRange: function(start, end) {
- var me = this,
- startPage, endPage, page,
- data = me.getData();
- if (!me.rangeCached(start, end)) {
- startPage = me.getPageFromRecordIndex(start);
- endPage = me.getPageFromRecordIndex(end);
-
-
-
- data.setMaxSize(me.calculatePageCacheSize(end - start + 1));
-
- for (page = startPage; page <= endPage; page++) {
- if (!me.pageCached(page)) {
- me.prefetchPage(page);
- }
- }
- }
- },
- primeCache: function(start, end, direction) {
- var me = this,
- leadingBufferZone = me.getLeadingBufferZone(),
- trailingBufferZone = me.getTrailingBufferZone(),
- pageSize = me.getPageSize(),
- totalCount = me.totalCount;
-
- if (direction === -1) {
- start = Math.max(start - leadingBufferZone, 0);
- end = Math.min(end + trailingBufferZone, totalCount - 1);
- }
-
- else if (direction === 1) {
- start = Math.max(Math.min(start - trailingBufferZone, totalCount - pageSize), 0);
- end = Math.min(end + leadingBufferZone, totalCount - 1);
- } else
- {
- start = Math.min(Math.max(Math.floor(start - ((leadingBufferZone + trailingBufferZone) / 2)), 0), totalCount - me.pageSize);
- end = Math.min(Math.max(Math.ceil(end + ((leadingBufferZone + trailingBufferZone) / 2)), 0), totalCount - 1);
- }
- me.prefetchRange(start, end);
- },
- sort: function(field, direction, mode) {
- if (arguments.length === 0) {
- this.clearAndLoad();
- } else {
- this.getSorters().addSort(field, direction, mode);
- }
- },
- onSorterEndUpdate: function() {
- var me = this,
- sorters = me.getSorters().getRange();
-
- if (sorters.length) {
- me.fireEvent('beforesort', me, sorters);
- me.clearAndLoad({
- callback: function() {
- me.fireEvent('sort', me, sorters);
- }
- });
- } else {
-
- me.fireEvent('sort', me, sorters);
- }
- },
- clearAndLoad: function(options) {
- var me = this;
- me.clearing = true;
- me.getData().clear();
- me.clearing = false;
- me.loadPage(1, options);
- },
- privates: {
- isLast: function(record) {
- return this.indexOf(record) === this.getTotalCount() - 1;
- },
- isMoving: function() {
- return false;
- }
- }
- });
- Ext.define('Ext.data.proxy.Direct', {
-
- extend: Ext.data.proxy.Server,
- alternateClassName: 'Ext.data.DirectProxy',
- alias: 'proxy.direct',
-
-
- config: {
-
- paramOrder: undefined,
-
- paramsAsHash: true,
-
- directFn: undefined,
-
- api: undefined,
-
- metadata: undefined
- },
-
- paramOrderRe: /[\s,|]/,
- constructor: function(config) {
- this.callParent([
- config
- ]);
- this.canceledOperations = {};
- },
- applyParamOrder: function(paramOrder) {
- if (Ext.isString(paramOrder)) {
- paramOrder = paramOrder.split(this.paramOrderRe);
- }
- return paramOrder;
- },
- updateApi: function() {
- this.methodsResolved = false;
- },
- updateDirectFn: function() {
- this.methodsResolved = false;
- },
- resolveMethods: function() {
- var me = this,
- fn = me.getDirectFn(),
- api = me.getApi(),
- method;
- if (fn) {
- me.setDirectFn(method = Ext.direct.Manager.parseMethod(fn));
- if (!Ext.isFunction(method)) {
- Ext.raise('Cannot resolve directFn ' + fn);
- }
- }
- if (api) {
- api = Ext.direct.Manager.resolveApi(api, me);
- me.setApi(api);
- }
- me.methodsResolved = true;
- },
- doRequest: function(operation) {
- var me = this,
- writer, request, action, params, args, api, fn, callback;
- if (!me.methodsResolved) {
- me.resolveMethods();
- }
- request = me.buildRequest(operation);
- action = request.getAction();
- api = me.getApi();
- if (api) {
- fn = api[action];
- }
- fn = fn || me.getDirectFn();
-
- if (!fn || !fn.directCfg) {
- Ext.raise({
- msg: 'No Ext Direct function specified for Direct proxy "' + action + '" operation',
- proxy: me
- });
- }
-
- if (!me.paramOrder && fn.directCfg.method.len > 1) {
- Ext.raise({
- msg: 'Incorrect parameters for Direct proxy "' + action + '" operation',
- proxy: me
- });
- }
-
- writer = me.getWriter();
- if (writer && operation.allowWrite()) {
- request = writer.write(request);
- }
-
-
-
-
-
-
-
-
- if (action === 'read') {
- params = request.getParams();
- } else {
- params = request.getJsonData();
- }
- args = fn.directCfg.method.getArgs({
- params: params,
- allowSingle: writer.getAllowSingle(),
- paramOrder: me.getParamOrder(),
- paramsAsHash: me.getParamsAsHash(),
- paramsAsArray: true,
- metadata: me.getMetadata(),
- callback: me.createRequestCallback(request, operation),
- scope: me
- });
- request.setConfig({
- args: args,
- directFn: fn
- });
- fn.apply(window, args);
-
-
-
- return request;
- },
-
- abort: function(operation) {
- var id;
-
- if (operation && operation.isDataRequest) {
- operation = operation.getOperation();
- }
-
- if (operation && operation.isOperation) {
- id = operation.id;
- }
-
- if (id != null) {
- this.canceledOperations[id] = true;
- }
- },
-
- applyEncoding: Ext.identityFn,
- createRequestCallback: function(request, operation) {
- var me = this;
- return function(data, event) {
- if (!me.canceledOperations[operation.id]) {
- me.processResponse(event.status, operation, request, event);
- }
- delete me.canceledOperations[operation.id];
- };
- },
-
- extractResponseData: function(response) {
- return Ext.isDefined(response.result) ? response.result : response.data;
- },
-
- setException: function(operation, response) {
- operation.setException(response.message);
- },
-
- buildUrl: function() {
- return '';
- }
- });
- Ext.define('Ext.data.DirectStore', {
-
- extend: Ext.data.Store,
- alias: 'store.direct',
-
- constructor: function(config) {
- config = Ext.apply({}, config);
- if (!config.proxy) {
- var proxy = {
- type: 'direct',
- reader: {
- type: 'json'
- }
- };
- Ext.copyTo(proxy, config, 'paramOrder,paramsAsHash,directFn,api,simpleSortMode,extraParams');
- Ext.copyTo(proxy.reader, config, 'totalProperty,root,rootProperty,idProperty');
- config.proxy = proxy;
- }
- this.callParent([
- config
- ]);
- }
- });
- Ext.define('Ext.data.JsonP', {
- singleton: true,
-
- requestCount: 0,
-
- requests: {},
-
- timeout: 30000,
-
- disableCaching: true,
-
- disableCachingParam: '_dc',
-
- callbackKey: 'callback',
-
- request: function(options) {
- options = Ext.apply({}, options);
-
- if (!options.url) {
- Ext.raise('A url must be specified for a JSONP request.');
- }
-
- var me = this,
- disableCaching = Ext.isDefined(options.disableCaching) ? options.disableCaching : me.disableCaching,
- cacheParam = options.disableCachingParam || me.disableCachingParam,
- id = ++me.requestCount,
- callbackName = options.callbackName || 'callback' + id,
- callbackKey = options.callbackKey || me.callbackKey,
- timeout = Ext.isDefined(options.timeout) ? options.timeout : me.timeout,
- params = Ext.apply({}, options.params),
- url = options.url,
- name = Ext.name,
- request, script;
-
- if (disableCaching && !params[cacheParam]) {
- params[cacheParam] = Ext.Date.now();
- }
- options.params = params;
- params[callbackKey] = name + '.data.JsonP.' + callbackName;
- script = me.createScript(url, params, options);
- me.requests[id] = request = {
- url: url,
- params: params,
- script: script,
- id: id,
- scope: options.scope,
- success: options.success,
- failure: options.failure,
- callback: options.callback,
- callbackKey: callbackKey,
- callbackName: callbackName
- };
- if (timeout > 0) {
- request.timeout = Ext.defer(me.handleTimeout, timeout, me, [
- request
- ]);
- }
- me.setupErrorHandling(request);
- me[callbackName] = me.bindResponse(request);
- me.loadScript(request);
- return request;
- },
- bindResponse: function(request) {
- var me = this;
- return function(result) {
- Ext.elevate(function() {
- me.handleResponse(result, request);
- });
- };
- },
-
- abort: function(request) {
- var me = this,
- requests = me.requests,
- key;
- if (request) {
- if (!request.id) {
- request = requests[request];
- }
- me.handleAbort(request);
- } else {
- for (key in requests) {
- if (requests.hasOwnProperty(key)) {
- me.abort(requests[key]);
- }
- }
- }
- },
-
- setupErrorHandling: function(request) {
- request.script.onerror = Ext.bind(this.handleError, this, [
- request
- ]);
- },
-
- handleAbort: function(request) {
- request.errorType = 'abort';
- this.handleResponse(null, request);
- },
-
- handleError: function(request) {
- request.errorType = 'error';
- this.handleResponse(null, request);
- },
-
- cleanupErrorHandling: function(request) {
- request.script.onerror = null;
- },
-
- handleTimeout: function(request) {
- request.errorType = 'timeout';
- this.handleResponse(null, request);
- },
-
- handleResponse: function(result, request) {
- var success = true;
- Ext.undefer(request.timeout);
- delete this[request.callbackName];
- delete this.requests[request.id];
- this.cleanupErrorHandling(request);
- Ext.fly(request.script).destroy();
- if (request.errorType) {
- success = false;
- Ext.callback(request.failure, request.scope, [
- request.errorType
- ]);
- } else {
- Ext.callback(request.success, request.scope, [
- result
- ]);
- }
- Ext.callback(request.callback, request.scope, [
- success,
- result,
- request.errorType
- ]);
- },
-
- createScript: function(url, params, options) {
- var script = document.createElement('script');
- script.setAttribute("src", Ext.urlAppend(url, Ext.Object.toQueryString(params)));
- script.setAttribute("async", true);
- script.setAttribute("type", "text/javascript");
- return script;
- },
-
- loadScript: function(request) {
- Ext.getHead().appendChild(request.script);
- }
- });
- Ext.define('Ext.data.proxy.JsonP', {
- extend: Ext.data.proxy.Server,
- alternateClassName: 'Ext.data.ScriptTagProxy',
- alias: [
- 'proxy.jsonp',
- 'proxy.scripttag'
- ],
- config: {
-
- callbackKey: 'callback',
-
- recordParam: 'records',
-
- autoAppendParams: true
- },
-
- doRequest: function(operation) {
-
- var me = this,
- request = me.buildRequest(operation),
- params = request.getParams();
-
- request.setConfig({
- callbackKey: me.callbackKey,
- timeout: me.timeout,
- scope: me,
- disableCaching: false,
-
- callback: me.createRequestCallback(request, operation)
- });
-
-
- if (me.getAutoAppendParams()) {
- request.setParams({});
- }
- request.setRawRequest(Ext.data.JsonP.request(request.getCurrentConfig()));
-
- request.setParams(params);
- me.lastRequest = request;
- return request;
- },
-
- createRequestCallback: function(request, operation) {
- var me = this;
- return function(success, response, errorType) {
- if (request === me.lastRequest) {
- me.lastRequest = null;
- }
- me.processResponse(success, operation, request, response);
- };
- },
- setException: function(operation, response) {
- operation.setException(operation.getRequest().getRawRequest().errorType);
- },
-
- buildUrl: function(request) {
- var me = this,
- url = me.callParent(arguments),
- records = request.getRecords(),
- writer = me.getWriter(),
- params, filters, filter, i, v;
-
-
- if (writer && request.getOperation().allowWrite()) {
- request = writer.write(request);
- }
-
- params = request.getParams();
- filters = params.filters;
- delete params.filters;
- if (filters && filters.length) {
- for (i = 0; i < filters.length; i++) {
- filter = filters[i];
- v = filter.getValue();
- if (v) {
- params[filter.getProperty()] = v;
- }
- }
- }
-
- if (Ext.isArray(records) && records.length > 0 && (!writer || !writer.getEncode())) {
- params[me.getRecordParam()] = me.encodeRecords(records);
- }
-
-
- if (me.getAutoAppendParams()) {
- url = Ext.urlAppend(url, Ext.Object.toQueryString(params));
- }
- return url;
- },
-
- abort: function(request) {
- request = request || this.lastRequest;
- if (request) {
- Ext.data.JsonP.abort(request.getRawRequest());
- }
- },
-
- encodeRecords: function(records) {
- var encoded = [],
- i = 0,
- len = records.length;
- for (; i < len; i++) {
- encoded.push(Ext.encode(records[i].getData()));
- }
- return encoded;
- }
- });
- Ext.define('Ext.data.JsonPStore', {
- extend: Ext.data.Store,
- alias: 'store.jsonp',
- constructor: function(config) {
- config = Ext.apply({
- proxy: {
- type: 'jsonp',
- reader: 'json'
- }
- }, config);
- this.callParent([
- config
- ]);
- }
- });
- Ext.define('Ext.data.JsonStore', {
- extend: Ext.data.Store,
- alias: 'store.json',
- constructor: function(config) {
- config = Ext.apply({
- proxy: {
- type: 'ajax',
- reader: 'json',
- writer: 'json'
- }
- }, config);
- this.callParent([
- config
- ]);
- }
- });
- Ext.define('Ext.data.ModelManager', {
- alternateClassName: 'Ext.ModelMgr',
- singleton: true,
- deprecated: {
- 5: {
- methods: {
- clear: null,
- create: function(data, name, id) {
- var T = name;
- if (!T.isEntity) {
- T = this.getModel(name || data.name);
- }
- return T.createWithId(id, data);
- },
- each: function(fn, scope) {
- Ext.data.Model.schema.eachEntity(fn, scope);
- },
- get: function(name) {
- return this.getModel(name);
- },
- getCount: function() {
- return Ext.data.Model.schema.entityCount;
- },
-
- getModel: function(id) {
- return Ext.data.schema.Schema.lookupEntity(id);
- },
- isRegistered: function(name) {
- return !!this.getModel(name);
- }
- }
- }
- }
- });
- Ext.define('Ext.data.NodeInterface', {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- statics: {
-
- decorate: function(modelClass) {
- var model = Ext.data.schema.Schema.lookupEntity(modelClass),
- proto = model.prototype,
- idName, idField, idType;
- if (!model.prototype.isObservable) {
- model.mixin(Ext.mixin.Observable.prototype.mixinId, Ext.mixin.Observable);
- }
- if (proto.isNode) {
-
- return;
- }
- idName = proto.idProperty;
- idField = model.getField(idName);
- idType = idField.type;
- model.override(this.getPrototypeBody());
- model.addFields([
- {
- name: 'parentId',
- type: idType,
- defaultValue: null,
- allowNull: idField.allowNull
- },
- {
- name: 'index',
- type: 'int',
- defaultValue: -1,
- persist: false,
- convert: null
- },
- {
- name: 'depth',
- type: 'int',
- defaultValue: 0,
- persist: false,
- convert: null
- },
- {
- name: 'expanded',
- type: 'bool',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'expandable',
- type: 'bool',
- defaultValue: true,
- persist: false,
- convert: null
- },
- {
- name: 'checked',
- type: 'auto',
- defaultValue: null,
- persist: false,
- convert: null
- },
- {
- name: 'leaf',
- type: 'bool',
- defaultValue: false
- },
- {
- name: 'cls',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'iconCls',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'icon',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'glyph',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'root',
- type: 'boolean',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'isLast',
- type: 'boolean',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'isFirst',
- type: 'boolean',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'allowDrop',
- type: 'boolean',
- defaultValue: true,
- persist: false,
- convert: null
- },
- {
- name: 'allowDrag',
- type: 'boolean',
- defaultValue: true,
- persist: false,
- convert: null
- },
- {
- name: 'loaded',
- type: 'boolean',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'loading',
- type: 'boolean',
- defaultValue: false,
- persist: false,
- convert: null
- },
- {
- name: 'href',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'hrefTarget',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'qtip',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'qtitle',
- type: 'string',
- defaultValue: '',
- persist: false,
- convert: null
- },
- {
- name: 'qshowDelay',
- type: 'int',
- defaultValue: 0,
- persist: false,
- convert: null
- },
- {
- name: 'children',
- type: 'auto',
- defaultValue: null,
- persist: false,
- convert: null
- },
- {
- name: 'visible',
- type: 'boolean',
- defaultValue: true,
- persist: false
- },
- {
- name: 'text',
- type: 'string',
- persist: false
- }
- ]);
- },
- getPrototypeBody: function() {
- var bubbledEvents = {
- idchanged: true,
- append: true,
- remove: true,
- move: true,
- insert: true,
- beforeappend: true,
- beforeremove: true,
- beforemove: true,
- beforeinsert: true,
- expand: true,
- collapse: true,
- beforeexpand: true,
- beforecollapse: true,
- sort: true
- },
- silently = {
- silent: true
- };
-
-
-
-
-
-
-
-
-
- return {
-
- isNode: true,
- firstChild: null,
- lastChild: null,
- parentNode: null,
- previousSibling: null,
- nextSibling: null,
- constructor: function() {
- var me = this;
- me.mixins.observable.constructor.call(me);
- me.callParent(arguments);
- me.childNodes = [];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return me;
- },
-
- createNode: function(node) {
- var me = this,
- childType = me.childType,
- store, storeReader, nodeProxy, nodeReader, reader, typeProperty,
- T = me.self;
-
- if (!node.isModel) {
-
- if (childType) {
- T = me.schema.getEntity(childType);
- } else
- {
- store = me.getTreeStore();
- storeReader = store && store.getProxy().getReader();
- nodeProxy = me.getProxy();
- nodeReader = nodeProxy ? nodeProxy.getReader() : null;
-
- reader = !storeReader || (nodeReader && nodeReader.initialConfig.typeProperty) ? nodeReader : storeReader;
- if (reader) {
- typeProperty = reader.getTypeProperty();
- if (typeProperty) {
- T = reader.getChildType(me.schema, node, typeProperty);
- }
- }
- }
- node = new T(node);
- }
-
-
-
- if (!node.childNodes) {
- node.firstChild = node.lastChild = node.parentNode = node.previousSibling = node.nextSibling = null;
- node.childNodes = [];
- }
- return node;
- },
-
- isLeaf: function() {
- return this.get('leaf') === true;
- },
-
- setFirstChild: function(node) {
- this.firstChild = node;
- },
-
- setLastChild: function(node) {
- this.lastChild = node;
- },
-
- updateInfo: function(commit, info) {
- var me = this,
- phantom = me.phantom,
- result;
- commit = {
- silent: true,
- commit: commit
- };
-
- if (info.depth != null && info.depth !== me.data.depth) {
- var childInfo = {
- depth: info.depth + 1
- },
- children = me.childNodes,
- childCount = children.length,
- i;
- for (i = 0; i < childCount; i++) {
- children[i].updateInfo(commit, childInfo);
- }
- }
- result = me.set(info, commit);
-
- me.phantom = phantom;
- return result;
- },
-
- isLast: function() {
- return this.get('isLast');
- },
-
- isFirst: function() {
- return this.get('isFirst');
- },
-
- hasChildNodes: function() {
- return !this.isLeaf() && this.childNodes.length > 0;
- },
-
- isExpandable: function() {
- var me = this;
- if (me.get('expandable')) {
- return !(me.isLeaf() || (me.isLoaded() && !me.phantom && !me.hasChildNodes()));
- }
- return false;
- },
- triggerUIUpdate: function() {
-
-
-
- this.callJoined('afterEdit', []);
- },
-
- appendChild: function(node, suppressEvents, commit) {
- var me = this,
- i, ln, index, oldParent, previousSibling,
- childInfo = {
- isLast: true,
- parentId: me.getId(),
- depth: (me.data.depth || 0) + 1
- },
- result,
- treeStore = me.getTreeStore(),
- halfCheckedValue = treeStore && treeStore.triStateCheckbox ? 1 : false,
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- meChecked, nodeChecked, modifiedFields;
-
- Ext.suspendLayouts();
-
- if (Ext.isArray(node)) {
- ln = node.length;
- result = new Array(ln);
-
- me.callTreeStore('beginFill');
- for (i = 0; i < ln; i++) {
- result[i] = me.appendChild(node[i], suppressEvents, commit);
- }
-
-
- me.callTreeStore('endFill', [
- result
- ]);
- } else {
-
- node = me.createNode(node);
- if (suppressEvents !== true && me.fireBubbledEvent('beforeappend', [
- me,
- node
- ]) === false) {
- Ext.resumeLayouts(true);
- return false;
- }
- index = me.childNodes.length;
- oldParent = node.parentNode;
-
- if (oldParent) {
- if (suppressEvents !== true && node.fireBubbledEvent('beforemove', [
- node,
- oldParent,
- me,
- index
- ]) === false) {
- Ext.resumeLayouts(true);
- return false;
- }
-
- if (oldParent.removeChild(node, false, suppressEvents, oldParent.getTreeStore() === treeStore) === false) {
- Ext.resumeLayouts(true);
- return false;
- }
- }
-
-
- treeStore && treeStore.beginUpdate();
- index = me.childNodes.length;
- if (index === 0) {
- me.setFirstChild(node);
- }
- me.childNodes[index] = node;
- node.parentNode = me;
- node.nextSibling = null;
- me.setLastChild(node);
- previousSibling = me.childNodes[index - 1];
- if (previousSibling) {
- node.previousSibling = previousSibling;
- previousSibling.nextSibling = node;
- previousSibling.updateInfo(commit, {
- isLast: false
- });
-
- if (!bulkUpdate) {
- previousSibling.triggerUIUpdate();
- }
- } else {
- node.previousSibling = null;
- }
-
- childInfo.isFirst = index === 0;
- childInfo.index = index;
-
-
-
- modifiedFields = node.updateInfo(commit, childInfo);
-
- if (me.isLeaf()) {
- me.set('leaf', false);
- }
-
- if (!me.isLoaded()) {
- if (bulkUpdate) {
- me.data.loaded = true;
- } else {
- me.set('loaded', true);
- }
- } else if (me.childNodes.length === 1 && !bulkUpdate) {
- me.triggerUIUpdate();
- }
-
- if (index && me.childNodes[index - 1].isExpanded() && !bulkUpdate) {
- me.childNodes[index - 1].cascade(me.triggerUIUpdate);
- }
-
-
-
-
-
-
- if (treeStore) {
- treeStore.registerNode(me, !bulkUpdate);
- if (bulkUpdate) {
- treeStore.registerNode(node);
- }
- }
-
-
-
- if (suppressEvents !== true) {
- me.fireBubbledEvent('append', [
- me,
- node,
- index
- ]);
- if (oldParent) {
- node.fireBubbledEvent('move', [
- node,
- oldParent,
- me,
- index
- ]);
- }
- }
-
-
- me.callTreeStore('onNodeAppend', [
- node,
- index
- ]);
-
- if (modifiedFields) {
- node.callJoined('afterEdit', [
- modifiedFields
- ]);
- }
- result = node;
-
-
- if (treeStore) {
- treeStore.endUpdate();
- }
- }
-
- Ext.resumeLayouts(true);
- return result;
- },
-
- getOwnerTree: function() {
- var store = this.getTreeStore();
- return store && store.ownerTree;
- },
-
- getTreeStore: function() {
- var root = this;
- while (root && !root.treeStore) {
- root = root.parentNode;
- }
- return root && root.treeStore;
- },
-
- removeChild: function(node, erase, suppressEvents, isMove) {
- var me = this,
- index = me.indexOf(node),
- i, childCount, previousSibling,
- treeStore = me.getTreeStore(),
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- removeContext,
- removeRange = [];
- if (index === -1 || (suppressEvents !== true && me.fireBubbledEvent('beforeremove', [
- me,
- node,
- !!isMove
- ]) === false)) {
- return false;
- }
-
- Ext.suspendLayouts();
-
- treeStore && treeStore.beginUpdate();
-
- Ext.Array.erase(me.childNodes, index, 1);
-
- if (me.firstChild === node) {
- me.setFirstChild(node.nextSibling);
- }
- if (me.lastChild === node) {
- me.setLastChild(node.previousSibling);
- }
-
- previousSibling = node.previousSibling;
- if (previousSibling) {
- node.previousSibling.nextSibling = node.nextSibling;
- }
-
- if (node.nextSibling) {
- node.nextSibling.previousSibling = node.previousSibling;
-
- if (index === 0) {
- node.nextSibling.updateInfo(false, {
- isFirst: true
- });
- }
-
- for (i = index , childCount = me.childNodes.length; i < childCount; i++) {
- me.childNodes[i].updateInfo(false, {
- index: i
- });
- }
- }
-
-
- else if (previousSibling) {
- previousSibling.updateInfo(false, {
- isLast: true
- });
-
-
- if (!bulkUpdate) {
- if (previousSibling.isExpanded()) {
- previousSibling.cascade(me.triggerUIUpdate);
- } else
- {
- previousSibling.triggerUIUpdate();
- }
- }
- }
-
-
- if (!me.childNodes.length && !bulkUpdate) {
- me.triggerUIUpdate();
- }
-
- Ext.resumeLayouts(true);
- if (suppressEvents !== true) {
-
- removeContext = {
- parentNode: node.parentNode,
- previousSibling: node.previousSibling,
- nextSibling: node.nextSibling
- };
-
- me.callTreeStore('beforeNodeRemove', [
- [
- node
- ],
- !!isMove,
- removeRange
- ]);
- node.previousSibling = node.nextSibling = node.parentNode = null;
- me.fireBubbledEvent('remove', [
- me,
- node,
- !!isMove,
- removeContext
- ]);
-
- me.callTreeStore('onNodeRemove', [
- [
- node
- ],
- !!isMove,
- removeRange
- ]);
- }
-
-
- if (erase) {
- node.erase(true);
- } else {
- node.clear();
- }
-
-
-
-
-
-
- if (!isMove) {
- node.set({
- parentId: null,
- lastParentId: me.getId()
- }, silently);
- }
-
- if (treeStore) {
- treeStore.endUpdate();
- }
- return node;
- },
-
- copy: function(newId, session, deep) {
- var me = this,
- result,
- args = [
- newId
- ],
- len = me.childNodes ? me.childNodes.length : 0,
- i;
-
-
-
- if (session && session.isSession) {
- args.push(session);
- } else if (arguments.length < 3) {
- deep = session;
- }
- result = me.callParent(args);
-
- if (deep) {
- for (i = 0; i < len; i++) {
- result.appendChild(me.childNodes[i].copy(undefined, true));
- }
- }
- return result;
- },
-
- clear: function(erase, resetChildren) {
- var me = this,
- data;
-
- me.parentNode = me.previousSibling = me.nextSibling = null;
- if (erase) {
- me.firstChild = me.lastChild = me.childNodes = null;
- }
-
- if (resetChildren) {
- me.firstChild = me.lastChild = null;
- me.childNodes.length = 0;
- if (me.data) {
- me.data.children = null;
- }
- }
- },
- drop: function() {
- var me = this,
- childNodes = me.childNodes,
- parentNode = me.parentNode,
- len, i, node,
- treeStore = me.getTreeStore();
-
-
-
- me.callParent();
-
- if (parentNode) {
-
- parentNode.removeChild(me);
- }
-
- else if (me.get('root')) {
- treeStore.setRoot(null);
- }
-
-
-
-
-
- treeStore && treeStore.beginUpdate();
-
-
- for (i = 0 , len = childNodes ? childNodes.length : 0; i < len; i++) {
- node = childNodes[i];
-
- node.clear();
-
- node.drop();
- }
-
- treeStore && treeStore.endUpdate();
- },
-
- erase: function(options) {
- var me = this,
- childNodes = me.childNodes,
- len = childNodes && childNodes.length,
- i, node;
-
-
-
- me.remove();
-
-
- me.clear(true);
- me.callParent([
- options
- ]);
- for (i = 0; i < len; i++) {
- node = childNodes[i];
-
-
- node.parentNode = null;
- node.erase(options);
- }
- },
-
- insertBefore: function(node, refNode, suppressEvents) {
- var me = this,
- index = me.indexOf(refNode),
- oldParent = node.parentNode,
- refIndex = index,
- childCount, previousSibling, i,
- treeStore = me.getTreeStore(),
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- modifiedFields, sibling, siblingModifiedFields;
- if (!refNode) {
-
- return me.appendChild(node);
- }
-
- if (node === refNode) {
- return false;
- }
-
- node = me.createNode(node);
- if (suppressEvents !== true && me.fireBubbledEvent('beforeinsert', [
- me,
- node,
- refNode
- ]) === false) {
- return false;
- }
-
- if (oldParent === me && me.indexOf(node) < index) {
- refIndex--;
- }
-
- if (oldParent) {
- if (suppressEvents !== true && node.fireBubbledEvent('beforemove', [
- node,
- oldParent,
- me,
- index,
- refNode
- ]) === false) {
- return false;
- }
-
- if (oldParent.removeChild(node, false, suppressEvents, oldParent.getTreeStore() === treeStore) === false) {
- return false;
- }
- }
-
-
-
-
- treeStore && treeStore.beginUpdate();
- if (refIndex === 0) {
- me.setFirstChild(node);
- }
- Ext.Array.splice(me.childNodes, refIndex, 0, node);
- node.parentNode = me;
- node.nextSibling = refNode;
- refNode.previousSibling = node;
- previousSibling = me.childNodes[refIndex - 1];
- if (previousSibling) {
- node.previousSibling = previousSibling;
- previousSibling.nextSibling = node;
- } else {
- node.previousSibling = null;
- }
-
-
-
- modifiedFields = node.updateInfo(false, {
- parentId: me.getId(),
- index: refIndex,
- isFirst: refIndex === 0,
- isLast: false,
- depth: (me.data.depth || 0) + 1
- });
-
- for (i = refIndex + 1 , childCount = me.childNodes.length; i < childCount; i++) {
- sibling = me.childNodes[i];
- siblingModifiedFields = sibling.updateInfo(false, {
- index: i
- });
- if (siblingModifiedFields) {
- sibling.callJoined('afterEdit', [
- siblingModifiedFields
- ]);
- }
- }
- if (!me.isLoaded()) {
- if (bulkUpdate) {
- me.data.loaded = true;
- } else {
- me.set('loaded', true);
- }
- }
-
- else if (me.childNodes.length === 1 && !bulkUpdate) {
- me.triggerUIUpdate();
- }
-
-
-
- if (treeStore) {
- treeStore.registerNode(me, !bulkUpdate);
- }
-
-
-
- if (suppressEvents !== true) {
- me.fireBubbledEvent('insert', [
- me,
- node,
- refNode
- ]);
- if (oldParent) {
- node.fireBubbledEvent('move', [
- node,
- oldParent,
- me,
- refIndex,
- refNode
- ]);
- }
- }
-
- me.callTreeStore('onNodeInsert', [
- node,
- refIndex
- ]);
-
- if (modifiedFields) {
- node.callJoined('afterEdit', [
- modifiedFields
- ]);
- }
-
-
- if (treeStore) {
- treeStore.endUpdate();
- }
- return node;
- },
-
- insertChild: function(index, node) {
- var sibling = this.childNodes[index];
- if (sibling) {
- return this.insertBefore(node, sibling);
- } else {
- return this.appendChild(node);
- }
- },
-
- isLastVisible: function() {
- var me = this,
- result = me.data.isLast,
- next = me.nextSibling;
-
-
-
- if (!result && me.getTreeStore().isFiltered()) {
- while (next) {
- if (next.data.visible) {
- return false;
- }
- next = next.nextSibling;
- }
- return true;
- }
- return result;
- },
-
- remove: function(erase, suppressEvents) {
- var me = this,
- parentNode = me.parentNode;
- if (parentNode) {
- parentNode.removeChild(me, erase, suppressEvents);
- } else if (erase) {
-
- me.erase(true);
- }
- return me;
- },
-
- removeAll: function(erase, suppressEvents, fromParent) {
-
-
-
- var me = this,
- childNodes = me.childNodes,
- len = childNodes.length,
- node, treeStore, i,
- removeRange = [];
-
- if (!len) {
- return me;
- }
-
- if (!fromParent) {
- treeStore = me.getTreeStore();
-
- if (treeStore) {
- treeStore.beginUpdate();
-
-
-
- treeStore.suspendEvent('remove');
- me.callTreeStore('beforeNodeRemove', [
- childNodes,
- false,
- removeRange
- ]);
- }
- }
- for (i = 0; i < len; ++i) {
- node = childNodes[i];
- node.previousSibling = node.nextSibling = node.parentNode = null;
- me.fireBubbledEvent('remove', [
- me,
- node,
- false
- ]);
- if (erase) {
- node.erase(true);
- } else
- {
- node.removeAll(false, suppressEvents, true);
- }
- }
-
- if (!fromParent && treeStore) {
- treeStore.resumeEvent('remove');
- me.callTreeStore('onNodeRemove', [
- childNodes,
- false,
- removeRange
- ]);
-
- treeStore.endUpdate();
- }
- me.firstChild = me.lastChild = null;
- childNodes.length = 0;
- if (!fromParent) {
- me.triggerUIUpdate();
- }
- return me;
- },
-
- getChildAt: function(index) {
- return this.childNodes[index];
- },
-
- replaceChild: function(newChild, oldChild, suppressEvents) {
- var s = oldChild ? oldChild.nextSibling : null;
- this.removeChild(oldChild, false, suppressEvents);
- this.insertBefore(newChild, s, suppressEvents);
- return oldChild;
- },
-
- indexOf: function(child) {
- return Ext.Array.indexOf(this.childNodes, child);
- },
-
- indexOfId: function(id) {
- var childNodes = this.childNodes,
- len = childNodes.length,
- i = 0;
- for (; i < len; ++i) {
- if (childNodes[i].getId() === id) {
- return i;
- }
- }
- return -1;
- },
-
- getPath: function(field, separator) {
- field = field || this.idProperty;
- separator = separator || '/';
- var path = [
- this.get(field)
- ],
- parent = this.parentNode;
- while (parent) {
- path.unshift(parent.get(field));
- parent = parent.parentNode;
- }
- return separator + path.join(separator);
- },
-
- getDepth: function() {
- return this.get('depth');
- },
-
- bubble: function(fn, scope, args) {
- var p = this;
- while (p) {
- if (fn.apply(scope || p, args || [
- p
- ]) === false) {
- break;
- }
- p = p.parentNode;
- }
- },
-
- cascade: function(spec, scope, args, after) {
- var me = this,
- before = spec;
- if (arguments.length === 1 && !Ext.isFunction(spec)) {
- after = spec.after;
- scope = spec.scope;
- args = spec.args;
- before = spec.before;
- }
- if (!before || before.apply(scope || me, args || [
- me
- ]) !== false) {
- var childNodes = me.childNodes,
- length = childNodes.length,
- i;
- for (i = 0; i < length; i++) {
- childNodes[i].cascade.call(childNodes[i], before, scope, args, after);
- }
- if (after) {
- after.apply(scope || me, args || [
- me
- ]);
- }
- }
- },
- cascadeBy: function() {
- return this.cascade.apply(this, arguments);
- },
-
- eachChild: function(fn, scope, args) {
- var childNodes = this.childNodes,
- length = childNodes.length,
- i;
- for (i = 0; i < length; i++) {
- if (fn.apply(scope || this, args || [
- childNodes[i]
- ]) === false) {
- break;
- }
- }
- },
-
- findChild: function(attribute, value, deep) {
- return this.findChildBy(function() {
- return this.get(attribute) == value;
- }, null, deep);
- },
-
- findChildBy: function(fn, scope, deep) {
- var cs = this.childNodes,
- len = cs.length,
- i = 0,
- n, res;
- for (; i < len; i++) {
- n = cs[i];
- if (fn.call(scope || n, n) === true) {
- return n;
- } else if (deep) {
- res = n.findChildBy(fn, scope, deep);
- if (res !== null) {
- return res;
- }
- }
- }
- return null;
- },
-
- contains: function(node) {
- return node.isAncestor(this);
- },
-
- isAncestor: function(node) {
- var p = this.parentNode;
- while (p) {
- if (p === node) {
- return true;
- }
- p = p.parentNode;
- }
- return false;
- },
-
- sort: function(sortFn, recursive, suppressEvent) {
- var me = this,
- childNodes = me.childNodes,
- ln = childNodes.length,
- i, n,
- info = {
- isFirst: true
- };
- if (ln > 0) {
- if (!sortFn) {
- sortFn = me.getTreeStore().getSortFn();
- }
- Ext.Array.sort(childNodes, sortFn);
- me.setFirstChild(childNodes[0]);
- me.setLastChild(childNodes[ln - 1]);
- for (i = 0; i < ln; i++) {
- n = childNodes[i];
- n.previousSibling = childNodes[i - 1];
- n.nextSibling = childNodes[i + 1];
-
- info.isLast = (i === ln - 1);
- info.index = i;
- n.updateInfo(false, info);
- info.isFirst = false;
- if (recursive && !n.isLeaf()) {
- n.sort(sortFn, true, true);
- }
- }
-
- if (suppressEvent !== true) {
- me.fireBubbledEvent('sort', [
- me,
- childNodes
- ]);
-
- me.callTreeStore('onNodeSort', [
- childNodes
- ]);
- }
- }
- },
-
- isExpanded: function() {
- return this.get('expanded');
- },
-
- isLoaded: function() {
- return this.get('loaded');
- },
-
- isBranchLoaded: function() {
- var isBranchLoaded = !this.isLeaf() && this.isLoaded();
- if (isBranchLoaded) {
- this.cascade(function(node) {
- if (!node.isLeaf()) {
- isBranchLoaded = isBranchLoaded || node.isBranchLoaded();
- }
- return isBranchLoaded;
- });
- }
- return isBranchLoaded;
- },
-
- isLoading: function() {
- return this.get('loading');
- },
-
- isRoot: function() {
- return !this.parentNode;
- },
-
- isVisible: function() {
- var parent = this.parentNode;
- while (parent) {
- if (!parent.isExpanded()) {
- return false;
- }
- parent = parent.parentNode;
- }
- return true;
- },
-
- expand: function(recursive, callback, scope) {
- var me = this,
- treeStore, resumeAddEvent;
-
-
-
- if (!me.isLeaf()) {
-
- if (me.isLoading()) {
- me.on('expand', function() {
- me.expand(recursive, callback, scope);
- }, me, {
- single: true
- });
- } else {
-
- if (!me.isExpanded()) {
- if (me.fireBubbledEvent('beforeexpand', [
- me
- ]) !== false) {
-
-
-
-
-
-
-
-
-
-
- if (recursive) {
-
-
-
- if (me.parentNode && me.parentNode.isSynchronousRecursiveExpand) {
- me.isSynchronousRecursiveExpand = true;
- } else {
- treeStore = me.getTreeStore();
- if (treeStore.getProxy().isSynchronous || me.isBranchLoaded()) {
- me.isSynchronousRecursiveExpand = true;
- treeStore.suspendEvent('add', 'datachanged');
- resumeAddEvent = true;
- }
- }
- }
-
-
- me.callTreeStore('onBeforeNodeExpand', [
- me.onChildNodesAvailable,
- me,
- [
- recursive,
- callback,
- scope
- ]
- ]);
-
-
- if (resumeAddEvent) {
- treeStore.resumeEvent('add', 'datachanged');
-
- treeStore.fireEvent('datachanged', treeStore);
- treeStore.fireEvent('refresh', treeStore);
- }
- me.isSynchronousRecursiveExpand = false;
- }
- } else if (recursive) {
-
- me.expandChildren(true, callback, scope);
- } else {
- Ext.callback(callback, scope || me, [
- me.childNodes
- ]);
- }
- }
- } else {
-
- Ext.callback(callback, scope || me);
- }
- },
-
-
- onChildNodesAvailable: function(records, recursive, callback, scope) {
- var me = this,
- treeStore = me.getTreeStore(),
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- ancestor, i, collapsedAncestors;
-
-
- Ext.suspendLayouts();
-
-
-
- for (ancestor = me.parentNode; ancestor; ancestor = ancestor.parentNode) {
- if (!ancestor.isExpanded()) {
- (collapsedAncestors || (collapsedAncestors = [])).unshift(ancestor);
- }
- }
-
- if (bulkUpdate || !treeStore.isVisible(me)) {
- me.data.expanded = true;
- } else {
- me.set('expanded', true);
- }
-
-
- if (collapsedAncestors) {
-
-
- for (i = 1; i < collapsedAncestors.length; i++) {
- ancestor = collapsedAncestors[i];
- if (bulkUpdate || !treeStore.isVisible(ancestor)) {
- ancestor.data.expanded = true;
- } else {
- ancestor.set('expanded', true);
- }
- }
-
-
-
- collapsedAncestors[0].expand();
-
- for (i = 1; i < collapsedAncestors.length; i++) {
- ancestor = collapsedAncestors[i];
- ancestor.fireBubbledEvent('expand', [
- ancestor,
- ancestor.childNodes
- ]);
- }
- } else {
-
- me.callTreeStore('onNodeExpand', [
- records,
- false
- ]);
- }
- me.fireBubbledEvent('expand', [
- me,
- records
- ]);
-
- if (recursive) {
- me.expandChildren(true, callback, scope);
- } else {
- Ext.callback(callback, scope || me, [
- me.childNodes
- ]);
- }
- Ext.resumeLayouts(true);
- },
-
- expandChildren: function(recursive, callback, scope, singleExpand) {
- var me = this,
- origCallback, i, allNodes, expandNodes, ln, node, treeStore;
-
-
-
-
- if (Ext.isBoolean(callback)) {
- origCallback = callback;
- callback = scope;
- scope = singleExpand;
- singleExpand = origCallback;
- }
- if (singleExpand === undefined) {
- treeStore = me.getTreeStore();
- singleExpand = treeStore && treeStore.singleExpand;
- }
- allNodes = me.childNodes;
- expandNodes = [];
- ln = singleExpand ? Math.min(allNodes.length, 1) : allNodes.length;
- for (i = 0; i < ln; ++i) {
- node = allNodes[i];
- if (!node.isLeaf()) {
- expandNodes[expandNodes.length] = node;
- }
- }
- ln = expandNodes.length;
- for (i = 0; i < ln; ++i) {
- expandNodes[i].expand(recursive);
- }
- if (callback) {
- Ext.callback(callback, scope || me, [
- me.childNodes
- ]);
- }
- },
-
- collapse: function(recursive, callback, scope) {
- var me = this,
- expanded = me.isExpanded(),
- treeStore = me.getTreeStore(),
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- len = me.childNodes.length,
- i, collapseChildren;
-
-
-
-
- if (!me.isLeaf() && ((!expanded && recursive) || me.fireBubbledEvent('beforecollapse', [
- me
- ]) !== false)) {
-
-
- Ext.suspendLayouts();
-
- if (me.isExpanded()) {
-
-
-
-
-
- if (recursive) {
- collapseChildren = function() {
- for (i = 0; i < len; i++) {
- me.childNodes[i].setCollapsed(true);
- }
- };
- if (callback) {
- callback = Ext.Function.createSequence(collapseChildren, Ext.Function.bind(callback, scope, [
- me.childNodes
- ]));
- } else {
- callback = collapseChildren;
- }
- } else if (callback) {
- callback = Ext.Function.bind(callback, scope, [
- me.childNodes
- ]);
- }
-
- if (bulkUpdate || !treeStore.contains(me)) {
- me.data.expanded = false;
- } else {
- me.set('expanded', false);
- }
-
-
-
- me.callTreeStore('onNodeCollapse', [
- me.childNodes,
- callback,
- scope
- ]);
- me.fireBubbledEvent('collapse', [
- me,
- me.childNodes
- ]);
-
- callback = null;
- }
-
-
-
-
- else if (recursive) {
- for (i = 0; i < len; i++) {
- me.childNodes[i].setCollapsed(true);
- }
- }
- Ext.resumeLayouts(true);
- }
-
- Ext.callback(callback, scope || me, [
- me.childNodes
- ]);
- },
-
- setCollapsed: function(recursive) {
- var me = this,
- len = me.childNodes.length,
- i;
-
- if (!me.isLeaf() && me.fireBubbledEvent('beforecollapse', [
- me
- ]) !== false) {
-
- me.data.expanded = false;
-
-
-
- me.fireBubbledEvent('collapse', [
- me,
- me.childNodes
- ]);
- if (recursive) {
- for (i = 0; i < len; i++) {
- me.childNodes[i].setCollapsed(true);
- }
- }
- }
- },
-
- collapseChildren: function(recursive, callback, scope) {
- var me = this,
- i,
- allNodes = me.childNodes,
- ln = allNodes.length,
- collapseNodes = [],
- node;
-
- for (i = 0; i < ln; ++i) {
- node = allNodes[i];
- if (!node.isLeaf() && node.isLoaded() && node.isExpanded()) {
- collapseNodes.push(node);
- }
- }
- ln = collapseNodes.length;
- if (ln) {
-
-
- for (i = 0; i < ln; ++i) {
- node = collapseNodes[i];
- if (i === ln - 1) {
- node.collapse(recursive, callback, scope);
- } else {
- node.collapse(recursive);
- }
- }
- } else {
-
- Ext.callback(callback, scope);
- }
- },
-
- fireEvent: function(eventName) {
- return this.fireBubbledEvent(eventName, Ext.Array.slice(arguments, 1));
- },
-
-
-
- fireBubbledEvent: function(eventName, args) {
- var result, eventSource, topNode;
-
- if (bubbledEvents[eventName]) {
- for (eventSource = this; result !== false && eventSource; eventSource = (topNode = eventSource).parentNode) {
- result = eventSource.fireEventArgs.call(eventSource, eventName, args);
- }
-
-
- if (result !== false) {
- eventSource = topNode.getTreeStore();
- if (eventSource && eventSource.hasListeners && eventSource.hasListeners[eventName = 'node' + eventName]) {
- result = eventSource.fireEventArgs(eventName, args);
- }
- }
- return result;
- } else
- {
- return this.fireEventArgs.apply(this, arguments);
- }
- },
-
- serialize: function(writerParam) {
- var writer = writerParam || new Ext.data.writer.Json({
- writeAllFields: true
- }),
- result = writer.getRecordData(this),
- childNodes = this.childNodes,
- len = childNodes.length,
- children, i;
- if (len > 0) {
- result.children = children = [];
- for (i = 0; i < len; i++) {
- children.push(childNodes[i].serialize(writer));
- }
- }
- return result;
- },
-
- callTreeStore: function(funcName, args) {
- var me = this,
- target = me.getTreeStore(),
- fn = target && target[funcName];
- if (target && fn) {
- args = args || [];
- if (args[0] !== me) {
- args.unshift(me);
- }
- fn.apply(target, args);
- }
- },
- addCls: function(cls) {
- this.replaceCls(null, cls);
- },
- removeCls: function(cls) {
- this.replaceCls(cls);
- },
- replaceCls: function(oldCls, newCls) {
- var pieces = this._parseCls(this.data.cls),
- parts = this._parseCls(oldCls);
- if (parts.length) {
- pieces = Ext.Array.difference(pieces, parts);
- }
- parts = this._parseCls(newCls);
- if (parts.length) {
- pieces = Ext.Array.unique(pieces.concat(parts));
- }
- this.set('cls', pieces.join(' '));
- },
- toggleCls: function(cls, state) {
- if (state === undefined) {
- var pieces = this._parseCls(this.data.cls),
- parts = this._parseCls(cls),
- len = parts.length,
- i, p;
- for (i = 0; i < len; ++i) {
- p = parts[i];
- if (Ext.Array.contains(pieces, p)) {
- Ext.Array.remove(pieces, p);
- } else {
- pieces.push(p);
- }
- }
- this.set('cls', pieces.join(' '));
- } else if (state) {
- this.addCls(cls);
- } else {
- this.removeCls(cls);
- }
- },
-
- privates: {
- _noCls: [],
- spacesRe: /\s+/,
- join: function(store) {
-
- if (store.isTreeStore) {
- if (this.isRoot()) {
- this.treeStore = this.store = store;
- }
- } else
-
- {
- this.callParent([
- store
- ]);
- }
- },
-
- callJoined: function(funcName, args) {
- this.callParent([
- funcName,
- args
- ]);
- this.callTreeStore(funcName, args);
- },
- _parseCls: function(cls) {
- if (!cls) {
- return this._noCls;
- }
- if (typeof cls === 'string') {
- return cls.split(this.spacesRe);
- }
- return cls;
- }
- }
- };
- }
- }
- });
- Ext.define('Ext.data.TreeModel', {
- extend: Ext.data.Model,
- mixins: [
- Ext.mixin.Queryable
- ],
-
- getRefItems: function() {
- return this.childNodes;
- },
- getRefOwner: function() {
- return this.parentNode;
- },
- statics: {
- defaultProxy: 'memory'
- }
- }, function() {
- Ext.data.NodeInterface.decorate(this);
- });
- Ext.define('Ext.data.NodeStore', {
- extend: Ext.data.Store,
- alias: 'store.node',
-
- isNodeStore: true,
- config: {
-
- node: null,
-
- recursive: false,
-
- rootVisible: false,
-
- folderSort: false
- },
- implicitModel: 'Ext.data.TreeModel',
-
-
-
- getTotalCount: function() {
- return this.getCount();
- },
- updateFolderSort: function(folderSort) {
- var data = this.getData();
- data.setTrackGroups(false);
- if (folderSort) {
- data.setGrouper({
- groupFn: this.folderSortFn
- });
- } else {
- data.setGrouper(null);
- }
- },
- folderSortFn: function(node) {
- return node.data.leaf ? 1 : 0;
- },
- afterReject: function(record) {
- var me = this;
-
-
-
-
-
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.REJECT, null);
- me.fireEvent('update', me, record, Ext.data.Model.REJECT, null);
- }
- },
- afterCommit: function(record, modifiedFieldNames) {
- var me = this;
- if (!modifiedFieldNames) {
- modifiedFieldNames = null;
- }
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.COMMIT, modifiedFieldNames);
- me.fireEvent('update', me, record, Ext.data.Model.COMMIT, modifiedFieldNames);
- }
- },
- onNodeAppend: function(parent, node) {
- if (parent === this.getNode()) {
- this.add([
- node
- ].concat(this.retrieveChildNodes(node)));
- }
- },
- onNodeInsert: function(parent, node, refNode) {
- var me = this,
- idx;
- if (parent === me.getNode()) {
- idx = me.indexOf(refNode) || 0;
- me.insert(0, [
- node
- ].concat(me.retrieveChildNodes(node)));
- }
- },
- onNodeRemove: function(parent, node) {
- if (parent === this.getNode()) {
- this.remove([
- node
- ].concat(this.retrieveChildNodes(node)));
- }
- },
- onNodeExpand: function(parent, records) {
- if (parent === this.getNode()) {
- this.loadRecords(records);
- }
- },
- applyNode: function(node) {
- if (node) {
- if (!node.isModel) {
- node = new (this.getModel())(node);
- }
- if (!node.isNode) {
- Ext.data.NodeInterface.decorate(node);
- }
- }
- return node;
- },
- updateNode: function(node, oldNode) {
- var me = this,
- data;
- if (oldNode && !oldNode.destroyed) {
- oldNode.un({
- append: 'onNodeAppend',
- insert: 'onNodeInsert',
- remove: 'onNodeRemove',
- scope: me
- });
- oldNode.unjoin(me);
- }
- if (node) {
- node.on({
- scope: me,
- append: 'onNodeAppend',
- insert: 'onNodeInsert',
- remove: 'onNodeRemove'
- });
- node.join(me);
- data = [];
- if (node.childNodes.length) {
- data = data.concat(me.retrieveChildNodes(node));
- }
- if (me.getRootVisible()) {
- data.push(node);
- } else if (node.isLoaded() || node.isLoading()) {
- node.set('expanded', true);
- }
- me.getData().clear();
- me.fireEvent('clear', me);
- me.suspendEvents();
- if (me.isInitializing) {
- me.inlineData = data;
- } else {
- me.add(data);
- }
- me.resumeEvents();
- if (data.length === 0) {
- me.loaded = node.loaded = true;
- }
- me.fireEvent('refresh', me, me.data);
- }
- },
-
- isVisible: function(node) {
- var parent = node.parentNode;
- if (!this.getRecursive() && parent !== this.getNode()) {
- return false;
- }
- while (parent) {
- if (!parent.isExpanded()) {
- return false;
- }
-
-
-
- if (parent === this.getNode()) {
- break;
- }
- parent = parent.parentNode;
- }
- return true;
- },
- privates: {
-
- retrieveChildNodes: function(root) {
- var node = this.getNode(),
- recursive = this.getRecursive(),
- added = [],
- child = root;
- if (!root.childNodes.length || (!recursive && root !== node)) {
- return added;
- }
- if (!recursive) {
- return root.childNodes;
- }
- while (child) {
- if (child._added) {
- delete child._added;
- if (child === root) {
- break;
- } else {
- child = child.nextSibling || child.parentNode;
- }
- } else {
- if (child !== root) {
- added.push(child);
- }
- if (child.firstChild) {
- child._added = true;
- child = child.firstChild;
- } else {
- child = child.nextSibling || child.parentNode;
- }
- }
- }
- return added;
- }
- }
- });
- Ext.define('Ext.data.Request', {
- isDataRequest: true,
- config: {
-
- action: undefined,
-
- params: undefined,
-
- method: 'GET',
-
- url: null,
-
- operation: null,
-
- proxy: null,
-
- disableCaching: false,
-
- headers: {},
-
- callbackKey: null,
-
- rawRequest: null,
-
- jsonData: undefined,
-
- xmlData: undefined,
-
- withCredentials: false,
-
- username: null,
-
- password: null,
-
- binary: false,
- callback: null,
- scope: null,
- timeout: 30000,
- records: null,
-
-
- directFn: null,
- args: null,
- useDefaultXhrHeader: null,
- responseType: null
- },
-
- constructor: function(config) {
- this.initConfig(config);
- },
-
- getParam: function(key) {
- var params = this.getParams(),
- val;
- if (params) {
- return params[key];
- }
- return val;
- },
-
- setParam: function(key, value) {
- var params = this.getParams() || {};
- params[key] = value;
- this.setParams(params);
- }
- });
- Ext.define('Ext.data.TreeStore', {
- extend: Ext.data.Store,
- alias: 'store.tree',
-
- isTreeStore: true,
- config: {
-
- root: null,
-
- rootVisible: false,
-
- defaultRootProperty: 'children',
-
- parentIdProperty: null,
-
- clearOnLoad: true,
-
- clearRemovedOnLoad: true,
-
- nodeParam: 'node',
-
- defaultRootId: 'root',
-
- defaultRootText: 'Root',
-
- folderSort: false,
-
- pageSize: null
- },
-
-
- filterer: 'topdown',
-
- lazyFill: false,
- fillCount: 0,
- bulkUpdate: 0,
- nodesToUnregister: 0,
-
- _silentOptions: {
- silent: true
- },
-
- implicitModel: 'Ext.data.TreeModel',
-
- groupField: null,
-
- groupDir: null,
-
- grouper: null,
- constructor: function(config) {
- var me = this;
- me.byIdMap = {};
- me.callParent([
- config
- ]);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (Ext.isDefined(me.nodeParameter)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.data.TreeStore: nodeParameter has been deprecated. Please use nodeParam instead.');
- }
- me.nodeParam = me.nodeParameter;
- delete me.nodeParameter;
- }
- },
-
-
- applyFields: function(fields, oldFields) {
- var me = this;
- if (fields) {
- if (me.defaultRootProperty !== me.self.prototype.config.defaultRootProperty) {
-
- fields = fields.concat({
- name: me.defaultRootProperty,
- type: 'auto',
- defaultValue: null,
- persist: false
- });
- }
- }
- me.callParent([
- fields,
- oldFields
- ]);
- },
- applyGroupField: function(field) {
- return null;
- },
- applyGroupDir: function(dir) {
- return null;
- },
- applyGrouper: function(grouper) {
-
- if (grouper) {
- Ext.raise('You can\'t group a TreeStore');
- }
-
- return null;
- },
-
- group: Ext.emptyFn,
-
- onSorterEndUpdate: function() {
- var me = this,
- sorterCollection = me.getSorters(),
- sorters = sorterCollection.getRange(),
- rootNode = me.getRoot(),
- folderSort = me.getFolderSort();
- me.fireEvent('beforesort', me, sorters);
-
- if (rootNode && (folderSort || sorters.length)) {
- if (me.getRemoteSort()) {
- if (sorters.length) {
- me.load({
- callback: function() {
- me.fireEvent('sort', me, sorters);
- }
- });
- }
- } else {
- rootNode.sort(this.getSortFn(), true);
-
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- me.fireEvent('sort', me, sorters);
- }
- } else
- {
- me.fireEvent('sort', me, sorters);
- }
- },
- updateFolderSort: function(folderSort) {
- this.needsFolderSort = folderSort;
- this.onSorterEndUpdate();
- },
- getSortFn: function() {
- return this._sortFn || (this._sortFn = this.createSortFn());
- },
- createSortFn: function() {
- var me = this,
- sortersSortFn = this.sorters.getSortFn();
- return function(node1, node2) {
- var node1FolderOrder, node2FolderOrder,
- result = 0;
- if (me.needsFolderSort) {
-
- node1FolderOrder = node1.data.leaf ? 1 : 0;
- node2FolderOrder = node2.data.leaf ? 1 : 0;
- result = node1FolderOrder - node2FolderOrder;
- }
- if (me.needsIndexSort && result === 0) {
- result = node1.data.index - node2.data.index;
- }
- return result || sortersSortFn(node1, node2);
- };
- },
- getTotalCount: function() {
- return this.getCount();
- },
- afterEdit: function(node, modifiedFieldNames) {
- var me = this,
- parentNode = node.parentNode,
- rootVisible = me.getRootVisible(),
- isHiddenRoot = !parentNode && !rootVisible,
- prevVisibleNodeIndex,
- isVisible = node.get('visible'),
- toAdd, removeStart;
-
-
-
- if (!isHiddenRoot && isVisible !== me.contains(node)) {
-
-
-
- if (isVisible) {
- if (!parentNode || me.isVisible(node)) {
- toAdd = [
- node
- ];
-
- if (node.isExpanded()) {
- me.handleNodeExpand(node, node.childNodes, toAdd);
- }
- prevVisibleNodeIndex = node.previousSibling ? me.indexOfPreviousVisibleNode(node.previousSibling) : (parentNode ? me.indexOf(parentNode) : -1);
- me.insert(prevVisibleNodeIndex + 1, toAdd);
- }
- } else
- {
- removeStart = me.indexOf(node);
- me.removeAt(removeStart, me.indexOfNextVisibleNode(node) - removeStart);
- }
- }
-
-
-
-
- else if (me.getRoot() && me.needsLocalFilter()) {
- me.onFilterEndUpdate(me.getFilters());
- }
- me.callParent([
- node,
- modifiedFieldNames
- ]);
- },
- afterReject: function(record) {
- var me = this;
-
-
-
-
-
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.REJECT, null);
- me.fireEvent('update', me, record, Ext.data.Model.REJECT, null);
- }
- },
- afterCommit: function(record, modifiedFieldNames) {
- var me = this;
- if (!modifiedFieldNames) {
- modifiedFieldNames = null;
- }
- if (me.contains(record)) {
- me.onUpdate(record, Ext.data.Model.COMMIT, modifiedFieldNames);
- me.fireEvent('update', me, record, Ext.data.Model.COMMIT, modifiedFieldNames);
- }
- },
- updateRootVisible: function(rootVisible) {
- var rootNode = this.getRoot(),
- data;
- if (rootNode) {
- data = this.getData();
- if (rootVisible) {
- data.insert(0, rootNode);
- } else {
- data.remove(rootNode);
- }
- }
- },
- updateTrackRemoved: function(trackRemoved) {
- this.callParent(arguments);
- this.removedNodes = this.removed;
- this.removed = null;
- },
- onDestroyRecords: function(records, operation, success) {
- if (success) {
- this.removedNodes.length = 0;
- }
- },
- updateProxy: function(proxy) {
- var reader;
-
-
-
- if (proxy) {
- if (proxy.setIdParam) {
- proxy.setIdParam(this.getNodeParam());
- }
-
- reader = proxy.getReader();
- if (Ext.isEmpty(reader.getRootProperty())) {
- reader.setRootProperty(this.getDefaultRootProperty());
- }
- }
- },
- setProxy: function(proxy) {
- this.changingProxy = true;
- this.callParent([
- proxy
- ]);
- this.changingProxy = false;
- },
- updateModel: function(model) {
- if (model) {
- var isNode = model.prototype.isNode;
-
- Ext.data.NodeInterface.decorate(model);
-
-
- if (!isNode && !this.changingProxy) {
- this.getProxy().getReader().buildExtractors(true);
- }
- }
- },
- onCollectionFilter: Ext.emptyFn,
-
-
- onFilterEndUpdate: function(filters) {
- var me = this,
- length = filters.length,
- root = me.getRoot(),
- childNodes, childNode, filteredNodes, i;
- if (!me.getRemoteFilter()) {
- if (length) {
- me.doFilter(root);
- } else {
- root.cascade({
- after: function(node) {
-
-
- node.set('visible', true, me._silentOptions);
- }
- });
- }
- if (length) {
- filteredNodes = [];
- childNodes = root.childNodes;
- for (i = 0 , length = childNodes.length; i < length; i++) {
- childNode = childNodes[i];
- if (childNode.get('visible')) {
- filteredNodes.push(childNode);
- }
- }
- } else {
- filteredNodes = root.childNodes;
- }
- me.onNodeFilter(root, filteredNodes);
- root.fireEvent('filterchange', root, filteredNodes);
-
-
- me.suppressNextFilter = true;
- me.callParent([
- filters
- ]);
- me.suppressNextFilter = false;
- } else {
- me.callParent([
- filters
- ]);
- }
- },
-
- onNodeFilter: function(root, childNodes) {
- var me = this,
- data = me.getData(),
- toAdd = [];
-
- if (me.getRootVisible() && root.get('visible')) {
- toAdd.push(root);
- }
- me.handleNodeExpand(root, childNodes, toAdd);
-
-
- me.suspendEvents();
- data.splice(0, data.getCount(), toAdd);
- me.resumeEvents();
- if (!me.suppressNextFilter) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- },
-
- onBeforeNodeExpand: function(node, callback, scope, args) {
- var me = this,
- storeReader, nodeProxy, nodeReader, reader, children, callbackArgs;
-
-
- if (node.isLoaded()) {
- callbackArgs = [
- node.childNodes
- ];
- if (args) {
- callbackArgs.push.apply(callbackArgs, args);
- }
- Ext.callback(callback, scope || node, callbackArgs);
- }
-
- else if (node.isLoading()) {
- me.on('load', function() {
- callbackArgs = [
- node.childNodes
- ];
- if (args) {
- callbackArgs.push.apply(callbackArgs, args);
- }
- Ext.callback(callback, scope || node, callbackArgs);
- }, me, {
- single: true,
- priority: 1001
- });
- } else
- {
-
-
-
- storeReader = me.getProxy().getReader();
- nodeProxy = node.getProxy();
- nodeReader = nodeProxy ? nodeProxy.getReader() : null;
-
- reader = nodeReader && nodeReader.initialConfig.rootProperty ? nodeReader : storeReader;
-
-
-
- children = reader.getRoot(node.raw || node.data);
-
-
- if (children || (node.phantom && !node.isRoot())) {
-
-
- me.fillNode(node, reader.extractData(children || [], {
- model: node.childType,
- recordCreator: me.recordCreator
- }));
- callbackArgs = [
- node.childNodes
- ];
- if (args) {
- callbackArgs.push.apply(callbackArgs, args);
- }
- Ext.callback(callback, scope || node, callbackArgs);
- } else
- {
- me.read({
- node: node,
-
-
- onChildNodesAvailable: function() {
-
-
- delete me.lastOptions.onChildNodesAvailable;
- callbackArgs = [
- node.childNodes
- ];
- if (args) {
- callbackArgs.push.apply(callbackArgs, args);
- }
- Ext.callback(callback, scope || node, callbackArgs);
- }
- });
-
- me.flushLoad();
- }
- }
- },
-
-
- onNodeExpand: function(parent, records) {
- var me = this,
- insertIndex = me.indexOf(parent) + 1,
- toAdd = [];
- me.handleNodeExpand(parent, records, toAdd);
-
- if (!me.refreshCounter && parent.isRoot() && !parent.get('visible')) {
- me.loadRecords(toAdd);
- } else
-
-
-
-
- {
- ++me.loadCount;
- me.insert(insertIndex, toAdd);
- }
- },
-
-
- handleNodeExpand: function(parent, records, toAdd) {
- var me = this,
- ln = records ? records.length : 0,
- i, record;
-
- if (parent !== this.getRoot() && !me.isVisible(parent)) {
- return;
- }
- if (ln) {
-
-
- for (i = 0; i < ln; i++) {
- record = records[i];
-
- if (record.get('visible')) {
-
-
-
- toAdd.push(record);
- if (record.isExpanded()) {
- if (record.isLoaded()) {
-
- me.handleNodeExpand(record, record.childNodes, toAdd);
- } else {
-
-
-
- record.set('expanded', false, {
- silent: true
- });
- record.expand();
- }
- }
- }
- }
- }
- },
-
- onNodeCollapse: function(parent, records, callback, scope) {
- var me = this,
- collapseIndex = me.indexOf(parent) + 1,
- lastNodeIndexPlus;
-
- if (me.needsLocalFilter()) {
- records = Ext.Array.filter(records, me.filterVisible);
- }
-
-
-
-
- if (records.length && me.isVisible(parent)) {
-
- lastNodeIndexPlus = me.indexOfNextVisibleNode(parent);
-
- me.removeAt(collapseIndex, lastNodeIndexPlus - collapseIndex);
- }
- Ext.callback(callback, scope);
- },
-
- indexOfNextVisibleNode: function(node) {
- var result;
- while (node.parentNode) {
-
- for (result = node.nextSibling; result && !result.get('visible'); result = result.nextSibling) {}
-
-
- if (result) {
- return this.indexOf(result);
- }
-
- node = node.parentNode;
- }
-
- return this.getCount();
- },
-
- indexOfPreviousVisibleNode: function(node) {
- var result;
-
- for (result = node; result && !result.get('visible'); result = result.previousSibling) {}
-
-
- if (result) {
- if (result.isExpanded() && result.lastChild) {
- return this.indexOfPreviousVisibleNode(result.lastChild);
- }
- } else
-
- {
- result = node.parentNode;
- }
- return this.indexOf(result);
- },
-
- filterNew: function(item) {
-
-
- return !item.get('root') && this.callParent([
- item
- ]);
- },
-
- filterRejects: function(item) {
-
-
- return !item.get('root') && this.callParent([
- item
- ]);
- },
- getNewRecords: function() {
- return Ext.Array.filter(Ext.Object.getValues(this.byIdMap), this.filterNew, this);
- },
- getRejectRecords: function() {
- return Ext.Array.filter(Ext.Object.getValues(this.byIdMap), this.filterRejects, this);
- },
- getUpdatedRecords: function() {
- return Ext.Array.filter(Ext.Object.getValues(this.byIdMap), this.filterUpdated);
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- beforeNodeRemove: function(parentNode, childNodes, isMove, removeRange) {
- if (!Ext.isArray(childNodes)) {
- childNodes = [
- childNodes
- ];
- }
- var me = this,
- len = childNodes.length,
-
-
-
-
- removed = me.removedNodes,
- i, startNode;
-
- for (i = 0; !startNode && i < len; i++) {
- if (childNodes[i].get('visible')) {
- startNode = childNodes[i];
- }
- }
-
-
- if (startNode) {
- removeRange[0] = me.indexOf(childNodes[0]);
- removeRange[1] = me.indexOfNextVisibleNode(childNodes[childNodes.length - 1]) - removeRange[0];
- } else {
- removeRange[0] = -1;
- removeRange[1] = 0;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- for (i = 0; i < len; i++) {
- childNodes[i].cascade(function(node) {
-
- me.unregisterNode(node, true);
-
-
-
- if (removed && !isMove) {
-
-
- if (!node.phantom && !node.erasing && !me.loading) {
-
-
- node.removedFrom = me.indexOf(node);
- removed.push(node);
-
-
- me.needsSync = true;
- }
- }
- });
- }
- },
-
-
-
-
-
- afterDrop: Ext.emptyFn,
-
-
- onNodeRemove: function(parentNode, childNodes, isMove, removeRange) {
- var me = this;
-
-
- me.suspendAutoSync();
-
-
-
-
-
- if (removeRange[0] !== -1) {
- me.removeIsMove = isMove;
- me.removeAt.apply(me, removeRange);
- me.removeIsMove = false;
- }
- me.resumeAutoSync();
- },
-
- onNodeAppend: function(parent, node, index) {
- this.onNodeInsert(parent, node, index);
- },
-
- onNodeInsert: function(parent, node, index) {
- var me = this,
- data = node.raw || node.data,
-
-
-
-
- removed = me.removedNodes,
- storeReader, nodeProxy, nodeReader, reader, dataRoot, storeInsertionPoint;
- if (parent && me.needsLocalFilter()) {
- me.doFilter(parent);
- }
- me.beginUpdate();
-
- if (me.isVisible(node)) {
-
-
- if (index === 0 || !node.previousSibling) {
- storeInsertionPoint = me.indexOf(parent);
- } else
-
- {
- storeInsertionPoint = me.indexOfPreviousVisibleNode(node.previousSibling);
- }
-
- me.insert(storeInsertionPoint + 1, node);
- if (!node.isLeaf() && node.isExpanded()) {
- if (node.isLoaded()) {
-
- me.onNodeExpand(node, node.childNodes);
- } else if (!me.fillCount) {
-
-
-
-
- node.set('expanded', false);
- node.expand();
- }
- }
- }
-
- Ext.Array.remove(removed, node);
-
- me.needsSync = me.needsSync || node.phantom || node.dirty;
- if (!node.isLeaf() && !node.isLoaded() && !me.lazyFill) {
-
-
-
- storeReader = me.getProxy().getReader();
- nodeProxy = node.getProxy();
- nodeReader = nodeProxy ? nodeProxy.getReader() : null;
-
- reader = nodeReader && nodeReader.initialConfig.rootProperty ? nodeReader : storeReader;
- dataRoot = reader.getRoot(data);
- if (dataRoot) {
- me.fillNode(node, reader.extractData(dataRoot, {
- model: node.childType,
- recordCreator: me.recordCreator
- }));
- }
- }
- me.endUpdate();
- },
-
- registerNode: function(node, includeChildren) {
- var me = this,
- was = me.byIdMap[node.id],
- children, length, i;
-
- me.byIdMap[node.id] = node;
-
-
- if (node.onRegisterTreeNode && node !== was) {
- node.onRegisterTreeNode(me);
- }
-
-
-
- if (node.onUnregisterTreeNode) {
- me.nodesToUnregister++;
- }
- if (includeChildren === true) {
- children = node.childNodes;
- length = children.length;
- for (i = 0; i < length; i++) {
- me.registerNode(children[i], true);
- }
- }
- },
-
- unregisterNode: function(node, includeChildren) {
- var me = this,
- was = me.byIdMap[node.id],
- children, length, i;
- delete me.byIdMap[node.id];
- if (includeChildren === true) {
- children = node.childNodes;
- length = children.length;
- for (i = 0; i < length; i++) {
- me.unregisterNode(children[i], true);
- }
- }
-
-
- if (node.onUnregisterTreeNode && node === was) {
- node.onUnregisterTreeNode(me);
- me.nodesToUnregister--;
- }
- },
- onNodeSort: function(node, childNodes) {
- var me = this;
-
-
- me.suspendAutoSync();
-
-
- if ((me.indexOf(node) !== -1 && node.isExpanded()) || (node === me.getRoot() && !me.getRootVisible())) {
- Ext.suspendLayouts();
- me.onNodeCollapse(node, childNodes);
- me.onNodeExpand(node, childNodes);
- Ext.resumeLayouts(true);
- }
-
-
- me.resumeAutoSync(me.autoSync);
- },
- applyRoot: function(newRoot) {
- var me = this,
- Model = me.getModel(),
- idProperty = Model.prototype.idProperty,
- defaultRootId = me.getDefaultRootId();
-
-
-
- if (newRoot && !newRoot.isNode) {
-
- newRoot = Ext.apply({
- text: me.getDefaultRootText(),
- root: true,
- isFirst: true,
- isLast: true,
- depth: 0,
- index: 0,
- parentId: null,
- allowDrag: false
- }, newRoot);
-
- if (defaultRootId && newRoot[idProperty] === undefined) {
- newRoot[idProperty] = defaultRootId;
- }
-
- newRoot = new Model(newRoot);
- }
- return newRoot;
- },
- updateRoot: function(newRoot, oldRoot) {
- var me = this,
- oldOwner,
- initial = !oldRoot,
- toRemove,
- removeRange = [];
-
- me.getTrackRemoved();
-
-
- me.suspendEvent('add', 'remove');
- if (initial) {
- me.suspendEvent('refresh', 'datachanged');
- }
-
-
- if (oldRoot && oldRoot.isModel) {
-
- if (me.getRootVisible()) {
- toRemove = [
- oldRoot
- ];
- } else {
- toRemove = oldRoot.childNodes;
- }
- me.beforeNodeRemove(null, toRemove, false, removeRange);
- oldRoot.set('root', false);
- me.onNodeRemove(null, toRemove, false, removeRange);
- oldRoot.fireEvent('remove', null, oldRoot, false);
- oldRoot.fireEvent('rootchange', null);
- oldRoot.clearListeners();
- oldRoot.store = oldRoot.treeStore = null;
-
-
-
- me.unregisterNode(oldRoot);
- }
- me.getData().clear();
-
-
- if (newRoot) {
-
- if (newRoot.fireEventArgs('beforeappend', [
- null,
- newRoot
- ]) === false) {
- newRoot = null;
- } else {
-
- oldOwner = newRoot.parentNode;
- if (oldOwner) {
-
-
-
-
- if (!oldOwner.removeChild(newRoot, false, false, oldOwner.getTreeStore() === me)) {
- return;
- }
- }
-
- else if ((oldOwner = newRoot.getTreeStore()) && oldOwner !== me && newRoot === oldOwner.getRoot()) {
- oldOwner.setRoot(null);
- }
-
-
-
- newRoot.store = newRoot.treeStore = me;
- newRoot.set('root', true);
-
- newRoot.updateInfo(true, {
- isFirst: true,
- isLast: true,
- depth: 0,
- index: 0,
- parentId: null
- });
-
-
- me.registerNode(newRoot, true);
-
- newRoot.fireEvent('append', null, newRoot, false);
- newRoot.fireEvent('rootchange', newRoot);
-
- me.onNodeAppend(null, newRoot, 0);
-
-
-
- newRoot.phantom = true;
- }
- }
- if (!initial) {
- me.fireEvent('rootchange', newRoot, oldRoot);
- }
-
- if (newRoot && (me.getAutoLoad() || newRoot.isExpanded())) {
-
- if (newRoot.isLoaded()) {
- me.onNodeExpand(newRoot, newRoot.childNodes);
- if (!initial) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- } else
- {
- newRoot.data.expanded = false;
- newRoot.expand(false);
-
-
-
- if (newRoot.isLoaded && !me.getProxy().isSynchronous && !initial) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- }
- } else if (!initial) {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
-
- me.resumeEvent('add', 'remove');
- if (initial) {
- me.resumeEvent('refresh', 'datachanged');
- }
- },
- doDestroy: function() {
- var me = this,
- root = me.getRoot();
-
-
-
- if (root && me.nodesToUnregister) {
- root.cascade(function(node) {
- if (node.onUnregisterTreeNode) {
- node.onUnregisterTreeNode(me);
- }
- });
- }
- me.callParent();
- },
-
-
- each: function(fn, scope, includeOptions) {
- var i = 0,
- filtered = includeOptions,
- includeCollapsed;
- if (includeOptions && typeof includeOptions === 'object') {
- includeCollapsed = includeOptions.collapsed;
- filtered = includeOptions.filtered;
- }
- if (includeCollapsed) {
- this.getRoot().cascade(function(node) {
- if (filtered === true || node.get('visible')) {
- return fn.call(scope || node, node, i++);
- }
- });
- } else {
- return this.callParent([
- fn,
- scope,
- filtered
- ]);
- }
- },
-
- collect: function(dataIndex, options, filtered) {
- var includeCollapsed,
- map = {},
- result = [],
- allowNull = options,
- strValue, value;
- if (options && typeof options === 'object') {
- includeCollapsed = options.collapsed;
- filtered = options.filtered;
- allowNull = options.allowNull;
- }
- if (includeCollapsed || filtered) {
- this.getRoot().cascade(function(node) {
- if (filtered === true || node.get('visible')) {
- value = node.get(dataIndex);
- strValue = String(value);
- if ((allowNull || !Ext.isEmpty(value)) && !map[strValue]) {
- map[strValue] = 1;
- result.push(value);
- }
- }
-
-
- if (!includeCollapsed && !node.isExpanded()) {
- return false;
- }
- });
- } else {
- result = this.callParent([
- dataIndex,
- allowNull,
- filtered
- ]);
- }
- return result;
- },
-
- getNodeById: function(id) {
- return this.byIdMap[id] || null;
- },
-
- findNode: function(fieldName, value, startsWith, endsWith, ignoreCase) {
- if (Ext.isEmpty(value, false)) {
- return null;
- }
-
- if (fieldName === this.model.idProperty && arguments.length < 3) {
- return this.byIdMap[value];
- }
- var regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase),
- result = null;
- Ext.Object.eachValue(this.byIdMap, function(node) {
- if (node && regex.test(node.get(fieldName))) {
- result = node;
- return false;
- }
- });
- return result;
- },
-
- load: function(options) {
- var node = options && options.node;
-
-
- if (!node && !(node = this.getRoot())) {
- node = this.setRoot({
- expanded: true,
- autoRoot: true
- });
- return;
- }
-
- if (node.isLoading()) {
- return;
- }
- return this.callParent([
- options
- ]);
- },
-
- reload: function(options) {
- var o = Ext.apply({}, options, this.lastOptions);
-
- o.node = this.getRoot();
- return this.load(o);
- },
-
- flushLoad: function() {
- var me = this,
- options = me.pendingLoadOptions,
- node, callback, scope,
- clearOnLoad = me.getClearOnLoad(),
- isRootLoad, operation, doClear;
-
- me.clearLoadTask();
- if (!options) {
- return;
- }
- node = options.node || me.getRoot();
-
-
-
-
- isRootLoad = node && node.isRoot();
- callback = options.callback;
- scope = options.scope;
- options.params = options.params || {};
-
-
- if (node.data.expanded && !isRootLoad) {
- node.data.loaded = false;
-
-
- if (clearOnLoad) {
- node.data.expanded = false;
- }
- options.callback = function(loadedNodes, operation, success) {
-
-
-
- if (!clearOnLoad) {
- node.collapse();
- }
- node.expand();
-
- Ext.callback(callback, scope, [
- loadedNodes,
- operation,
- success
- ]);
- };
- }
-
-
- options.id = node.getId();
-
- me.setLoadOptions(options);
- if (me.getRemoteSort() && options.sorters) {
- me.fireEvent('beforesort', me, options.sorters);
- }
- options = Ext.apply({
- node: options.node || node,
- internalScope: me,
- internalCallback: me.onProxyLoad
- }, options);
- me.lastOptions = Ext.apply({}, options);
-
- options.isRootLoad = isRootLoad;
- operation = me.createOperation('read', options);
- if (me.fireEvent('beforeload', me, operation) !== false) {
-
-
- me.loading = true;
-
- if (isRootLoad) {
- if (me.getClearRemovedOnLoad()) {
- me.removedNodes.length = 0;
- }
- if (clearOnLoad) {
-
-
- me.unregisterNode(node, true);
- node.clear(false, true);
- me.registerNode(node);
- doClear = true;
- }
- } else
- {
- if (me.loading) {
-
- node.data.loaded = false;
- }
- if (me.getTrackRemoved() && me.getClearRemovedOnLoad()) {
-
- me.clearRemoved(node);
- }
- if (clearOnLoad) {
- node.removeAll(false);
- }
- }
-
-
- if (me.loading && node) {
- node.set('loading', true, {
- silent: !(me.contains(node) || node === me.getRoot())
- });
- }
- if (doClear) {
- me.clearData(true);
-
- if (me.getRootVisible()) {
- me.suspendEvents();
- me.add(node);
- me.resumeEvents();
- }
- }
- operation.execute();
- }
- return me;
- },
- onProxyLoad: function(operation) {
- var me = this,
- options = operation.initialConfig,
- successful = operation.wasSuccessful(),
- records = operation.getRecords(),
- node = options.node,
- isRootLoad = options.isRootLoad,
- scope = operation.getScope() || me,
- args = [
- records,
- operation,
- successful
- ];
- if (me.destroyed) {
- return;
- }
- me.loading = false;
- node.set('loading', false);
- if (successful) {
- ++me.loadCount;
- if (!me.getClearOnLoad()) {
- records = me.cleanRecords(node, records);
- }
-
- if (me.getParentIdProperty()) {
- records = me.treeify(node, records);
- }
- if (isRootLoad) {
- me.suspendEvent('add', 'update');
- }
- records = me.fillNode(node, records);
- }
-
-
-
- Ext.callback(options.onChildNodesAvailable, scope, args);
- if (isRootLoad) {
- me.resumeEvent('add', 'update');
- me.callObservers('BeforePopulate');
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- me.callObservers('AfterPopulate');
- }
- me.fireEvent('load', me, records, successful, operation, node);
- },
-
- clearRemoved: function(node) {
- var me = this,
- removed = me.removedNodes,
- id = node.getId(),
- removedLength = removed.length,
- i = removedLength,
- recordsToClear = {},
- newRemoved = [],
- removedHash = {},
- removedNode, targetNode, targetId;
- if (node === me.getRoot()) {
-
- me.removedNodes.length = 0;
- return;
- }
-
- for (; i--; ) {
- removedNode = removed[i];
- removedHash[removedNode.getId()] = removedNode;
- }
- for (i = removedLength; i--; ) {
- removedNode = removed[i];
- targetNode = removedNode;
- while (targetNode && targetNode.getId() !== id) {
-
-
- targetId = targetNode.get('parentId') || targetNode.get('lastParentId');
- targetNode = targetNode.parentNode || me.getNodeById(targetId) || removedHash[targetId];
- }
- if (targetNode) {
-
- recordsToClear[removedNode.getId()] = removedNode;
- }
- }
-
- for (i = 0; i < removedLength; i++) {
- removedNode = removed[i];
- if (!recordsToClear[removedNode.getId()]) {
- newRemoved.push(removedNode);
- }
- }
- me.removedNodes = newRemoved;
- },
-
- fillNode: function(node, newNodes) {
- var me = this,
- newNodeCount = newNodes ? newNodes.length : 0;
-
- if (++me.bulkUpdate === 1) {
- me.suspendEvent('datachanged');
- }
- if (newNodeCount) {
- me.setupNodes(newNodes);
- node.appendChild(newNodes, undefined, true);
- } else
-
-
- {
- if (me.bulkUpdate === 1) {
- node.set('loaded', true);
- } else {
- node.data.loaded = true;
- }
- }
- if (!--me.bulkUpdate) {
- me.resumeEvent('datachanged');
- }
-
- return newNodes;
- },
- setupNodes: function(newNodes) {
- var me = this,
- sorters = me.getSorters(),
- needsIndexSort = false,
- newNodeCount = newNodes.length,
- performLocalSort = me.sortOnLoad && newNodeCount > 1 && !me.getRemoteSort() && me.getFolderSort() || sorters.length,
- performLocalFilter = me.needsLocalFilter(),
- node1, node2, i;
-
- if (performLocalFilter) {
- me.doFilter(newNodes[0]);
- }
-
- for (i = 1; i < newNodeCount; i++) {
- node1 = newNodes[i];
- node2 = newNodes[i - 1];
-
- if (performLocalFilter) {
- me.doFilter(node1);
- }
- needsIndexSort = node1.data.index !== node2.data.index;
- }
-
- if (performLocalSort) {
-
- me.needsIndexSort = true;
- Ext.Array.sort(newNodes, me.getSortFn());
- me.needsIndexSort = false;
- } else if (needsIndexSort) {
- Ext.Array.sort(newNodes, me.sortByIndex);
- }
- },
-
- beginFill: function() {
- var me = this;
- if (!me.fillCount++) {
-
- me.beginUpdate();
- me.suspendEvent('add', 'update');
- me.suspendAutoSync();
- me.fillArray = [];
- }
- },
-
- endFill: function(parent, nodes) {
- var me = this,
- fillArray = me.fillArray,
- i, len, index;
-
- fillArray.push(nodes);
- if (!--me.fillCount) {
- me.resumeAutoSync();
- me.resumeEvent('add', 'update');
-
-
-
- for (i = 0 , len = fillArray.length; i < len; i++) {
- index = me.indexOf(fillArray[i][0]);
-
- if (index !== -1) {
- me.fireEvent('add', me, fillArray[i], index);
- }
- }
- me.fillArray = null;
- me.endUpdate();
- }
- },
-
- sortByIndex: function(node1, node2) {
- return node1.data.index - node2.data.index;
- },
- onIdChanged: function(node, oldId, newId) {
- var childNodes = node.childNodes,
- len = childNodes && childNodes.length,
- i;
- this.callParent(arguments);
- delete this.byIdMap[oldId];
- this.byIdMap[newId] = node;
-
- for (i = 0; i < len; i++) {
- childNodes[i].set('parentId', newId);
- }
- },
-
- treeify: function(parentNode, records) {
- var me = this,
- loadParentNodeId = parentNode.getId(),
- parentIdProperty = me.getParentIdProperty(),
- len = records.length,
- result = [],
- nodeMap = {},
- i, node, parentId, parent, id, children;
-
- for (i = 0; i < len; i++) {
- node = records[i];
- node.data.depth = 1;
- nodeMap[node.id] = node;
- }
-
- for (i = 0; i < len; i++) {
- node = records[i];
- parentId = node.data[parentIdProperty];
- if (!(parentId || parentId === 0) || parentId === loadParentNodeId) {
- result.push(node);
- } else {
-
- if (!nodeMap[parentId]) {
- Ext.raise('Ext.data.TreeStore, Invalid parentId "' + parentId + '"');
- }
-
- parent = nodeMap[parentId];
- parent.$children = parent.$children || [];
- parent.$children.push(node);
- node.data.depth = parent.data.depth + 1;
- }
- }
- for (id in nodeMap) {
- node = nodeMap[id];
- children = node.$children;
- if (children) {
- delete node.$children;
- me.setupNodes(children);
- node.appendChild(children);
- }
- me.registerNode(node);
- }
- me.setupNodes(result);
- return result;
- },
- cleanRecords: function(node, records) {
- var nodeHash = {},
- childNodes = node.childNodes,
- i = 0,
- len = childNodes.length,
- out = [],
- rec;
-
- for (; i < len; ++i) {
- nodeHash[childNodes[i].getId()] = true;
- }
- for (i = 0 , len = records.length; i < len; ++i) {
- rec = records[i];
- if (!nodeHash[rec.getId()]) {
- out.push(rec);
- }
- }
- return out;
- },
- removeAll: function() {
- this.suspendEvents();
- this.setRoot(null);
- this.resumeEvents();
- this.callParent();
- },
- doSort: function(sorterFn) {
- var me = this;
- if (me.getRemoteSort()) {
-
- me.load();
- } else {
- me.tree.sort(sorterFn, true);
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- me.fireEvent('sort', me, me.sorters.getRange());
- },
- filterVisible: function(node) {
- return node.get('visible');
- },
-
- isVisible: function(node) {
- var parentNode = node.parentNode,
- visible = node.data.visible,
- root = this.getRoot();
- while (visible && parentNode) {
- visible = parentNode.data.expanded && parentNode.data.visible;
- parentNode = parentNode.parentNode;
- }
-
-
- return visible && !(node === root && !this.getRootVisible());
- },
- commitChanges: function() {
- var removed = this.removedNodes;
- if (removed) {
- removed.length = 0;
- }
- this.callParent();
- },
-
- getRootNode: function() {
- return this.getRoot();
- },
-
- setRootNode: function(root) {
- this.setRoot(root);
- return this.getRoot();
- },
- privates: {
- fireChangeEvent: function(record) {
- return !!this.byIdMap[record.id];
- },
-
- getRawRemovedRecords: function() {
- return this.removedNodes;
- },
- createOperation: function(type, options) {
-
-
- var me = this,
- node = options.node,
- proxy;
-
-
- if (me.useModelProxy && node && node !== me.getRootNode()) {
- proxy = node.getProxy();
- }
-
-
- if (proxy && proxy !== me.getProxy()) {
- return proxy.createOperation(type, options);
- } else {
- return me.callParent([
- type,
- options
- ]);
- }
- },
-
- recordCreator: function(data, Model) {
- return new Model(data);
- },
- doFilter: function(node) {
- this.filterNodes(node, this.getFilters().getFilterFn(), true);
- },
-
- filterNodes: function(node, filterFn, parentVisible) {
- var me = this,
- bottomUpFiltering = me.filterer === 'bottomup',
-
-
- match = filterFn(node) && parentVisible || (node.isRoot() && !me.getRootVisible()),
- childNodes = node.childNodes,
- len = childNodes && childNodes.length,
- i, matchingChildren;
- if (len) {
- for (i = 0; i < len; ++i) {
-
- matchingChildren = me.filterNodes(childNodes[i], filterFn, match || bottomUpFiltering) || matchingChildren;
- }
- if (bottomUpFiltering) {
- match = matchingChildren || match;
- }
- }
- node.set("visible", match, me._silentOptions);
- return match;
- },
- needsLocalFilter: function() {
- return !this.getRemoteFilter() && this.getFilters().length;
- },
- onRemoteFilterSet: function(filters, remoteFilter) {
-
-
-
-
- var data = this.getData();
- data.setFilters(null);
- if (filters) {
- filters.on('endupdate', this.onFilterEndUpdate, this);
- }
- },
- onRemoteSortSet: function(sorters, remoteSort) {
-
-
-
-
- var data = this.getData();
- data.setSorters(null);
- if (sorters) {
- sorters.on('endupdate', this.onSorterEndUpdate, this);
- }
- }
- },
- deprecated: {
- 5: {
- properties: {
- tree: null
- }
- }
- }
- });
- Ext.define('Ext.data.Types', {
- singleton: true
- }, function(Types) {
- var SortTypes = Ext.data.SortTypes;
- Ext.apply(Types, {
-
- stripRe: /[\$,%]/g,
-
- AUTO: {
- sortType: SortTypes.none,
- type: 'auto'
- },
-
- STRING: {
- convert: function(v) {
- var defaultValue = this.getAllowNull() ? null : '';
- return (v === undefined || v === null) ? defaultValue : String(v);
- },
- sortType: SortTypes.asUCString,
- type: 'string'
- },
-
- INT: {
- convert: function(v) {
-
-
-
- if (typeof v === 'number') {
- return parseInt(v, 10);
- }
- return v !== undefined && v !== null && v !== '' ? parseInt(String(v).replace(Types.stripRe, ''), 10) : (this.getAllowNull() ? null : 0);
- },
- sortType: SortTypes.none,
- type: 'int'
- },
-
- FLOAT: {
- convert: function(v) {
- if (typeof v === 'number') {
- return v;
- }
- return v !== undefined && v !== null && v !== '' ? parseFloat(String(v).replace(Types.stripRe, ''), 10) : (this.getAllowNull() ? null : 0);
- },
- sortType: SortTypes.none,
- type: 'float'
- },
-
- BOOL: {
- convert: function(v) {
- if (typeof v === 'boolean') {
- return v;
- }
- if (this.getAllowNull() && (v === undefined || v === null || v === '')) {
- return null;
- }
- return v === 'true' || v == 1;
- },
- sortType: SortTypes.none,
- type: 'bool'
- },
-
- DATE: {
- convert: function(v) {
- var df = this.getDateReadFormat() || this.getDateFormat(),
- parsed;
- if (!v) {
- return null;
- }
-
- if (v instanceof Date) {
- return v;
- }
- if (df) {
- return Ext.Date.parse(v, df);
- }
- parsed = Date.parse(v);
- return parsed ? new Date(parsed) : null;
- },
- sortType: SortTypes.asDate,
- type: 'date'
- }
- });
-
- Types.BOOLEAN = Types.BOOL;
-
- Types.INTEGER = Types.INT;
-
- Types.NUMBER = Types.FLOAT;
- });
- Ext.define('Ext.data.Validation', {
- extend: Ext.data.Model,
- isValidation: true,
-
- syncGeneration: 0,
-
-
- attach: function(record) {
-
- this.record = record;
- this.isBase = record.self === Ext.data.Model;
-
-
- delete this.data.id;
- },
- getValidation: function() {
- return null;
- },
-
- isValid: function() {
- var me = this;
- if (me.syncGeneration !== me.record.generation) {
- me.refresh();
- }
- return !me.dirty;
- },
-
- refresh: function(force) {
-
-
- if (this.isBase) {
- return;
- }
- var me = this,
- data = me.data,
- record = me.record,
- fields = record.fields,
- generation = record.generation,
- recordData = record.data,
- sep = record.validationSeparator,
- values = null,
- defaultMessage, currentValue, error, field, item, i, j, jLen, len, msg, val, name;
- if (force || me.syncGeneration !== generation) {
- me.syncGeneration = generation;
- for (i = 0 , len = fields.length; i < len; ++i) {
- field = fields[i];
- name = field.name;
- val = recordData[name];
- defaultMessage = field.defaultInvalidMessage;
- error = 0;
- if (!(name in data)) {
-
-
-
- data[name] = currentValue = true;
- } else
- {
- currentValue = data[name];
- }
- if (field.validate !== Ext.emptyFn) {
- msg = field.validate(val, sep, null, record);
- if (msg !== true) {
- error = msg || defaultMessage;
- }
- }
- if (!error) {
- error = true;
- }
-
- if (error !== currentValue) {
- (values || (values = {}))[name] = error;
- }
- }
- if (values) {
-
- me.set(values);
- }
- }
- }
- });
- Ext.define('Ext.dom.Helper', function() {
- var afterbegin = 'afterbegin',
- afterend = 'afterend',
- beforebegin = 'beforebegin',
- beforeend = 'beforeend',
- bbValues = [
- 'BeforeBegin',
- 'previousSibling'
- ],
- aeValues = [
- 'AfterEnd',
- 'nextSibling'
- ],
- bb_ae_PositionHash = {
- beforebegin: bbValues,
- afterend: aeValues
- },
- fullPositionHash = {
- beforebegin: bbValues,
- afterend: aeValues,
- afterbegin: [
- 'AfterBegin',
- 'firstChild'
- ],
- beforeend: [
- 'BeforeEnd',
- 'lastChild'
- ]
- };
- return {
- singleton: true,
- alternateClassName: [
- 'Ext.DomHelper',
- 'Ext.core.DomHelper'
- ],
- emptyTags: /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
- confRe: /^(?:tag|children|cn|html|tpl|tplData)$/i,
- endRe: /end/i,
-
- attributeTransform: {
- cls: 'class',
- htmlFor: 'for'
- },
- closeTags: {},
- detachedDiv: document.createElement('div'),
- decamelizeName: function() {
- var camelCaseRe = /([a-z])([A-Z])/g,
- cache = {};
- function decamel(match, p1, p2) {
- return p1 + '-' + p2.toLowerCase();
- }
- return function(s) {
- return cache[s] || (cache[s] = s.replace(camelCaseRe, decamel));
- };
- }(),
- generateMarkup: function(spec, buffer) {
- var me = this,
- specType = typeof spec,
- attr, val, tag, i, closeTags;
- if (specType === "string" || specType === "number") {
- buffer.push(spec);
- } else if (Ext.isArray(spec)) {
- for (i = 0; i < spec.length; i++) {
- if (spec[i]) {
- me.generateMarkup(spec[i], buffer);
- }
- }
- } else {
- tag = spec.tag || 'div';
- buffer.push('<', tag);
- for (attr in spec) {
- if (spec.hasOwnProperty(attr)) {
- val = spec[attr];
- if (val !== undefined && !me.confRe.test(attr)) {
- if (val && val.join) {
- val = val.join(' ');
- }
- if (typeof val === "object") {
- buffer.push(' ', attr, '="');
- me.generateStyles(val, buffer, true).push('"');
- } else {
- buffer.push(' ', me.attributeTransform[attr] || attr, '="', val, '"');
- }
- }
- }
- }
-
- if (me.emptyTags.test(tag)) {
- buffer.push('/>');
- } else {
- buffer.push('>');
-
- if ((val = spec.tpl)) {
- val.applyOut(spec.tplData, buffer);
- }
- if ((val = spec.html)) {
- buffer.push(val);
- }
- if ((val = spec.cn || spec.children)) {
- me.generateMarkup(val, buffer);
- }
-
- closeTags = me.closeTags;
- buffer.push(closeTags[tag] || (closeTags[tag] = '</' + tag + '>'));
- }
- }
- return buffer;
- },
-
- generateStyles: function(styles, buffer, encode) {
- var a = buffer || [],
- name, val;
- for (name in styles) {
- if (styles.hasOwnProperty(name)) {
- val = styles[name];
-
-
-
- name = this.decamelizeName(name);
- if (encode && Ext.String.hasHtmlCharacters(val)) {
- val = Ext.String.htmlEncode(val);
- }
- a.push(name, ':', val, ';');
- }
- }
- return buffer || a.join('');
- },
-
- markup: function(spec) {
- if (typeof spec === "string") {
- return spec;
- }
- var buf = this.generateMarkup(spec, []);
- return buf.join('');
- },
-
- applyStyles: function(el, styles) {
- Ext.fly(el).applyStyles(styles);
- },
-
- createContextualFragment: function(html) {
- var div = this.detachedDiv,
- fragment = document.createDocumentFragment(),
- length, childNodes;
- div.innerHTML = html;
- childNodes = div.childNodes;
- length = childNodes.length;
-
- while (length--) {
- fragment.appendChild(childNodes[0]);
- }
- return fragment;
- },
-
- createDom: function(o) {
- var me = this,
- markup = me.markup(o),
- div = me.detachedDiv,
- child;
- div.innerHTML = markup;
- child = div.firstChild;
-
-
-
-
-
-
-
-
-
- return Ext.supports.ChildContentClearedWhenSettingInnerHTML ? child.cloneNode(true) : child;
- },
-
- insertHtml: function(where, el, html) {
- var me = this,
- hashVal, range, rangeEl, setStart, frag;
- where = where.toLowerCase();
-
- if (el.insertAdjacentHTML) {
- if (me.ieInsertHtml) {
-
- frag = me.ieInsertHtml(where, el, html);
- if (frag) {
- return frag;
- }
- }
- hashVal = fullPositionHash[where];
- if (hashVal) {
- el.insertAdjacentHTML(hashVal[0], html);
- return el[hashVal[1]];
- }
- } else
- {
-
- if (el.nodeType === 3) {
- where = where === afterbegin ? beforebegin : where;
- where = where === beforeend ? afterend : where;
- }
- range = Ext.supports.CreateContextualFragment ? el.ownerDocument.createRange() : undefined;
- setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
- if (bb_ae_PositionHash[where]) {
- if (range) {
- range[setStart](el);
- frag = range.createContextualFragment(html);
- } else {
- frag = this.createContextualFragment(html);
- }
- el.parentNode.insertBefore(frag, where === beforebegin ? el : el.nextSibling);
- return el[(where === beforebegin ? 'previous' : 'next') + 'Sibling'];
- } else {
- rangeEl = (where === afterbegin ? 'first' : 'last') + 'Child';
- if (el.firstChild) {
- if (range) {
-
-
-
- try {
- range[setStart](el[rangeEl]);
- frag = range.createContextualFragment(html);
- } catch (e) {
- frag = this.createContextualFragment(html);
- }
- } else {
- frag = this.createContextualFragment(html);
- }
- if (where === afterbegin) {
- el.insertBefore(frag, el.firstChild);
- } else {
- el.appendChild(frag);
- }
- } else {
- el.innerHTML = html;
- }
- return el[rangeEl];
- }
- }
-
- Ext.raise({
- sourceClass: 'Ext.DomHelper',
- sourceMethod: 'insertHtml',
- htmlToInsert: html,
- targetElement: el,
- msg: 'Illegal insertion point reached: "' + where + '"'
- });
- },
-
-
- insertBefore: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, beforebegin);
- },
-
- insertAfter: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, afterend);
- },
-
- insertFirst: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, afterbegin);
- },
-
- append: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, beforeend);
- },
-
- overwrite: function(el, html, returnElement) {
- var me = this,
- newNode;
- el = Ext.getDom(el);
- html = me.markup(html);
- if (me.ieOverwrite) {
-
- newNode = me.ieOverwrite(el, html);
- }
- if (!newNode) {
- el.innerHTML = html;
- newNode = el.firstChild;
- }
- return returnElement ? Ext.get(newNode) : newNode;
- },
- doInsert: function(el, o, returnElement, where) {
- var me = this,
- newNode;
- el = el.dom || Ext.getDom(el);
- if ('innerHTML' in el) {
-
-
-
-
- newNode = me.insertHtml(where, el, me.markup(o));
- } else {
-
- newNode = me.createDom(o, null);
-
- if (el.nodeType === 3) {
- where = where === afterbegin ? beforebegin : where;
- where = where === beforeend ? afterend : where;
- }
- if (bb_ae_PositionHash[where]) {
- el.parentNode.insertBefore(newNode, where === beforebegin ? el : el.nextSibling);
- } else if (el.firstChild && where === afterbegin) {
- el.insertBefore(newNode, el.firstChild);
- } else {
- el.appendChild(newNode);
- }
- }
- return returnElement ? Ext.get(newNode) : newNode;
- },
-
- createTemplate: function(o) {
- var html = this.markup(o);
- return new Ext.Template(html);
- },
-
- createHtml: function(spec) {
- return this.markup(spec);
- }
- };
- });
- Ext.define('Ext.dom.Query', function() {
- var DQ,
- doc = document,
- cache, simpleCache, valueCache,
- useClassList = !!doc.documentElement.classList,
- useElementPointer = !!doc.documentElement.firstElementChild,
- useChildrenCollection = (function() {
- var d = doc.createElement('div');
- d.innerHTML = '<!-- -->text<!-- -->';
- return d.children && (d.children.length === 0);
- })(),
- nonSpace = /\S/,
- trimRe = /^\s+|\s+$/g,
- tplRe = /\{(\d+)\}/g,
- modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
- tagTokenRe = /^(#)?([\w\-\*\|\\]+)/,
- nthRe = /(\d*)n\+?(\d*)/,
- nthRe2 = /\D/,
- startIdRe = /^\s*#/,
-
-
-
- isIE = window.ActiveXObject ? true : false,
- key = 30803,
- longHex = /\\([0-9a-fA-F]{6})/g,
- shortHex = /\\([0-9a-fA-F]{1,6})\s{0,1}/g,
- nonHex = /\\([^0-9a-fA-F]{1})/g,
- escapes = /\\/g,
- num, hasEscapes,
-
-
- supportsColonNsSeparator = (function() {
- var xmlDoc,
- xmlString = '<r><a:b xmlns:a="n"></a:b></r>';
- if (window.DOMParser) {
- xmlDoc = (new DOMParser()).parseFromString(xmlString, "application/xml");
- } else {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.loadXML(xmlString);
- }
- return !!xmlDoc.getElementsByTagName('a:b').length;
- })(),
-
-
- longHexToChar = function($0, $1) {
- return String.fromCharCode(parseInt($1, 16));
- },
-
- shortToLongHex = function($0, $1) {
- while ($1.length < 6) {
- $1 = '0' + $1;
- }
- return '\\' + $1;
- },
-
- charToLongHex = function($0, $1) {
- num = $1.charCodeAt(0).toString(16);
- if (num.length === 1) {
- num = '0' + num;
- }
- return '\\0000' + num;
- },
-
-
-
- unescapeCssSelector = function(selector) {
- return (hasEscapes) ? selector.replace(longHex, longHexToChar) : selector;
- },
-
- setupEscapes = function(path) {
- hasEscapes = (path.indexOf('\\') > -1);
- if (hasEscapes) {
- path = path.replace(shortHex, shortToLongHex).replace(nonHex, charToLongHex).replace(escapes, '\\\\');
- }
-
- return path;
- };
-
-
- eval("var batch = 30803, child, next, prev, byClassName;");
-
-
- child = useChildrenCollection ? function child(parent, index) {
- return parent.children[index];
- } : function child(parent, index) {
- var i = 0,
- n = parent.firstChild;
- while (n) {
- if (n.nodeType == 1) {
- if (++i == index) {
- return n;
- }
- }
- n = n.nextSibling;
- }
- return null;
- };
-
- next = useElementPointer ? function(n) {
- return n.nextElementSibling;
- } : function(n) {
- while ((n = n.nextSibling) && n.nodeType != 1){}
- return n;
- };
-
- prev = useElementPointer ? function(n) {
- return n.previousElementSibling;
- } : function(n) {
- while ((n = n.previousSibling) && n.nodeType != 1){}
- return n;
- };
-
-
- function children(parent) {
- var n = parent.firstChild,
- nodeIndex = -1,
- nextNode;
- while (n) {
- nextNode = n.nextSibling;
-
- if (n.nodeType == 3 && !nonSpace.test(n.nodeValue)) {
- parent.removeChild(n);
- } else {
-
- n.nodeIndex = ++nodeIndex;
- }
- n = nextNode;
- }
- return this;
- }
-
-
- byClassName = useClassList ?
- function(nodeSet, cls) {
- cls = unescapeCssSelector(cls);
- if (!cls) {
- return nodeSet;
- }
- var result = [],
- ri = -1,
- i, ci, classList;
- for (i = 0; ci = nodeSet[i]; i++) {
- classList = ci.classList;
- if (classList) {
- if (classList.contains(cls)) {
- result[++ri] = ci;
- }
- } else if ((' ' + ci.className + ' ').indexOf(cls) !== -1) {
-
-
- result[++ri] = ci;
- }
- }
- return result;
- } : function(nodeSet, cls) {
- cls = unescapeCssSelector(cls);
- if (!cls) {
- return nodeSet;
- }
- var result = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = nodeSet[i]; i++) {
- if ((' ' + ci.className + ' ').indexOf(cls) !== -1) {
- result[++ri] = ci;
- }
- }
- return result;
- };
- function attrValue(n, attr) {
-
- if (!n.tagName && typeof n.length != "undefined") {
- n = n[0];
- }
- if (!n) {
- return null;
- }
- if (attr == "for") {
- return n.htmlFor;
- }
- if (attr == "class" || attr == "className") {
- return n.className;
- }
- return n.getAttribute(attr) || n[attr];
- }
-
-
-
- function getNodes(ns, mode, tagName) {
- var result = [],
- ri = -1,
- cs, i, ni, j, ci, cn, utag, n, cj;
- if (!ns) {
- return result;
- }
- tagName = tagName.replace('|', ':') || "*";
-
- if (typeof ns.getElementsByTagName != "undefined") {
- ns = [
- ns
- ];
- }
-
-
- if (!mode) {
- tagName = unescapeCssSelector(tagName);
- if (!supportsColonNsSeparator && DQ.isXml(ns[0]) && tagName.indexOf(':') !== -1) {
-
-
-
-
-
-
- for (i = 0; ni = ns[i]; i++) {
- cs = ni.getElementsByTagName(tagName.split(':').pop());
- for (j = 0; ci = cs[j]; j++) {
- if (ci.tagName === tagName) {
- result[++ri] = ci;
- }
- }
- }
- } else {
- for (i = 0; ni = ns[i]; i++) {
- cs = ni.getElementsByTagName(tagName);
- for (j = 0; ci = cs[j]; j++) {
- result[++ri] = ci;
- }
- }
- }
- }
-
-
- else if (mode == "/" || mode == ">") {
- utag = tagName.toUpperCase();
- for (i = 0; ni = ns[i]; i++) {
- cn = ni.childNodes;
- for (j = 0; cj = cn[j]; j++) {
- if (cj.nodeName == utag || cj.nodeName == tagName || tagName == '*') {
- result[++ri] = cj;
- }
- }
- }
- }
-
-
- else if (mode == "+") {
- utag = tagName.toUpperCase();
- for (i = 0; n = ns[i]; i++) {
- while ((n = n.nextSibling) && n.nodeType != 1){}
- if (n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')) {
- result[++ri] = n;
- }
- }
- }
-
-
- else if (mode == "~") {
- utag = tagName.toUpperCase();
- for (i = 0; n = ns[i]; i++) {
- while ((n = n.nextSibling)) {
- if (n.nodeName == utag || n.nodeName == tagName || tagName == '*') {
- result[++ri] = n;
- }
- }
- }
- }
- return result;
- }
- function concat(a, b) {
- a.push.apply(a, b);
- return a;
- }
- function byTag(cs, tagName) {
- if (cs.tagName || cs === doc) {
- cs = [
- cs
- ];
- }
- if (!tagName) {
- return cs;
- }
- var result = [],
- ri = -1,
- i, ci;
- tagName = tagName.toLowerCase();
- for (i = 0; ci = cs[i]; i++) {
- if (ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName) {
- result[++ri] = ci;
- }
- }
- return result;
- }
- function byId(cs, id) {
- id = unescapeCssSelector(id);
- if (cs.tagName || cs === doc) {
- cs = [
- cs
- ];
- }
- if (!id) {
- return cs;
- }
- var result = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = cs[i]; i++) {
- if (ci && ci.id == id) {
- result[++ri] = ci;
- return result;
- }
- }
- return result;
- }
-
-
- function byAttribute(cs, attr, value, op, custom) {
- var result = [],
- ri = -1,
- useGetStyle = custom == "{",
- fn = DQ.operators[op],
- a, xml, hasXml, i, ci;
- value = unescapeCssSelector(value);
- for (i = 0; ci = cs[i]; i++) {
-
- if (ci.nodeType === 1) {
-
- if (!hasXml) {
- xml = DQ.isXml(ci);
- hasXml = true;
- }
-
- if (!xml) {
- if (useGetStyle) {
- a = DQ.getStyle(ci, attr);
- } else if (attr == "class" || attr == "className") {
- a = ci.className;
- } else if (attr == "for") {
- a = ci.htmlFor;
- } else if (attr == "href") {
-
-
- a = ci.getAttribute("href", 2);
- } else {
- a = ci.getAttribute(attr);
- }
- } else {
- a = ci.getAttribute(attr);
- }
- if ((fn && fn(a, value)) || (!fn && a)) {
- result[++ri] = ci;
- }
- }
- }
- return result;
- }
- function byPseudo(cs, name, value) {
- value = unescapeCssSelector(value);
- return DQ.pseudos[name](cs, value);
- }
- function nodupIEXml(cs) {
- var d = ++key,
- r, i, len, c;
- cs[0].setAttribute("_nodup", d);
- r = [
- cs[0]
- ];
- for (i = 1 , len = cs.length; i < len; i++) {
- c = cs[i];
- if (!c.getAttribute("_nodup") != d) {
- c.setAttribute("_nodup", d);
- r[r.length] = c;
- }
- }
- for (i = 0 , len = cs.length; i < len; i++) {
- cs[i].removeAttribute("_nodup");
- }
- return r;
- }
- function nodup(cs) {
- if (!cs) {
- return [];
- }
- var len = cs.length,
- c, i,
- r = cs,
- cj,
- ri = -1,
- d, j;
- if (!len || typeof cs.nodeType != "undefined" || len == 1) {
- return cs;
- }
- if (isIE && typeof cs[0].selectSingleNode != "undefined") {
- return nodupIEXml(cs);
- }
- d = ++key;
- cs[0]._nodup = d;
- for (i = 1; c = cs[i]; i++) {
- if (c._nodup != d) {
- c._nodup = d;
- } else {
- r = [];
- for (j = 0; j < i; j++) {
- r[++ri] = cs[j];
- }
- for (j = i + 1; cj = cs[j]; j++) {
- if (cj._nodup != d) {
- cj._nodup = d;
- r[++ri] = cj;
- }
- }
- return r;
- }
- }
- return r;
- }
- function quickDiffIEXml(c1, c2) {
- var d = ++key,
- r = [],
- i, len;
- for (i = 0 , len = c1.length; i < len; i++) {
- c1[i].setAttribute("_qdiff", d);
- }
- for (i = 0 , len = c2.length; i < len; i++) {
- if (c2[i].getAttribute("_qdiff") != d) {
- r[r.length] = c2[i];
- }
- }
- for (i = 0 , len = c1.length; i < len; i++) {
- c1[i].removeAttribute("_qdiff");
- }
- return r;
- }
- function quickDiff(c1, c2) {
- var len1 = c1.length,
- d = ++key,
- r = [],
- i, len;
- if (!len1) {
- return c2;
- }
- if (isIE && typeof c1[0].selectSingleNode != "undefined") {
- return quickDiffIEXml(c1, c2);
- }
- for (i = 0; i < len1; i++) {
- c1[i]._qdiff = d;
- }
- for (i = 0 , len = c2.length; i < len; i++) {
- if (c2[i]._qdiff != d) {
- r[r.length] = c2[i];
- }
- }
- return r;
- }
- function quickId(ns, mode, root, id) {
- if (ns == root) {
- id = unescapeCssSelector(id);
- var d = root.ownerDocument || root;
- return d.getElementById(id);
- }
- ns = getNodes(ns, mode, "*");
- return byId(ns, id);
- }
- return {
- singleton: true,
- alternateClassName: [
- 'Ext.core.DomQuery',
- 'Ext.DomQuery'
- ],
- _init: function() {
- DQ = this;
- DQ.operators = Ext.Object.chain(Ext.util.Operators);
-
- DQ._cache = cache = new Ext.util.LruCache({
- maxSize: 200
- });
- DQ._valueCache = valueCache = new Ext.util.LruCache({
- maxSize: 200
- });
- DQ._simpleCache = simpleCache = new Ext.util.LruCache({
- maxSize: 200
- });
- },
- clearCache: function() {
- cache.clear();
- valueCache.clear();
- simpleCache.clear();
- },
- getStyle: function(el, name) {
- return Ext.fly(el, '_DomQuery').getStyle(name);
- },
-
- compile: function(path, type) {
- type = type || "select";
-
- var fn = [
- "var f = function(root) {\n var mode; ++batch; var n = root || document;\n"
- ],
- lastPath,
- matchers = DQ.matchers,
- matchersLn = matchers.length,
- modeMatch,
-
- lmode = path.match(modeRe),
- tokenMatch, matched, j, t, m;
- path = setupEscapes(path);
- if (lmode && lmode[1]) {
- fn[fn.length] = 'mode="' + lmode[1].replace(trimRe, "") + '";';
- path = path.replace(lmode[1], "");
- }
-
- while (path.substr(0, 1) == "/") {
- path = path.substr(1);
- }
- while (path && lastPath != path) {
- lastPath = path;
- tokenMatch = path.match(tagTokenRe);
- if (type == "select") {
- if (tokenMatch) {
-
- if (tokenMatch[1] == "#") {
- fn[fn.length] = 'n = quickId(n, mode, root, "' + tokenMatch[2] + '");';
- } else {
- fn[fn.length] = 'n = getNodes(n, mode, "' + tokenMatch[2] + '");';
- }
- path = path.replace(tokenMatch[0], "");
- } else if (path.substr(0, 1) != '@') {
- fn[fn.length] = 'n = getNodes(n, mode, "*");';
- }
- } else
- {
- if (tokenMatch) {
- if (tokenMatch[1] == "#") {
- fn[fn.length] = 'n = byId(n, "' + tokenMatch[2] + '");';
- } else {
- fn[fn.length] = 'n = byTag(n, "' + tokenMatch[2] + '");';
- }
- path = path.replace(tokenMatch[0], "");
- }
- }
- while (!(modeMatch = path.match(modeRe))) {
- matched = false;
- for (j = 0; j < matchersLn; j++) {
- t = matchers[j];
- m = path.match(t.re);
- if (m) {
- fn[fn.length] = t.select.replace(tplRe, function(x, i) {
- return m[i];
- });
- path = path.replace(m[0], "");
- matched = true;
- break;
- }
- }
-
- if (!matched) {
- Ext.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'compile',
- msg: 'Error parsing selector. Parsing failed at "' + path + '"'
- });
- }
- }
- if (modeMatch[1]) {
- fn[fn.length] = 'mode="' + modeMatch[1].replace(trimRe, "") + '";';
- path = path.replace(modeMatch[1], "");
- }
- }
-
- fn[fn.length] = "return nodup(n);\n}";
-
- eval(fn.join(""));
- return f;
- },
-
- jsSelect: function(path, root, type) {
-
- root = root || doc;
- if (typeof root == "string") {
- root = doc.getElementById(root);
- }
- var paths = Ext.splitAndUnescape(path, ","),
- results = [],
- query, i, len, subPath, result;
-
- for (i = 0 , len = paths.length; i < len; i++) {
- subPath = paths[i].replace(trimRe, "");
-
- query = cache.get(subPath);
- if (!query) {
-
- query = DQ.compile(subPath, type);
- if (!query) {
- Ext.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'jsSelect',
- msg: subPath + ' is not a valid selector'
- });
- }
- cache.add(subPath, query);
- } else {
-
-
- setupEscapes(subPath);
- }
- result = query(root);
- if (result && result !== doc) {
- results = results.concat(result);
- }
- }
-
-
- if (paths.length > 1) {
- return nodup(results);
- }
- return results;
- },
- isXml: function(el) {
- var docEl = (el ? el.ownerDocument || el : 0).documentElement;
- return docEl ? docEl.nodeName !== "HTML" : false;
- },
-
- select: doc.querySelectorAll ? function(path, root, type, single) {
- root = root || doc;
- if (!DQ.isXml(root)) {
- try {
-
- if (root.parentNode && (root.nodeType !== 9) && path.indexOf(',') === -1 && !startIdRe.test(path)) {
- path = Ext.makeIdSelector(Ext.id(root)) + ' ' + path;
- root = root.parentNode;
- }
- return single ? [
- root.querySelector(path)
- ] : Ext.Array.toArray(root.querySelectorAll(path));
- } catch (e) {}
- }
- return DQ.jsSelect.call(this, path, root, type);
- } : function(path, root, type) {
- return DQ.jsSelect.call(this, path, root, type);
- },
-
- selectNode: function(path, root) {
- return Ext.DomQuery.select(path, root, null, true)[0];
- },
-
- selectValue: function(path, root, defaultValue) {
- path = path.replace(trimRe, "");
- var query = valueCache.get(path),
- n, v;
- if (!query) {
- query = DQ.compile(path, "select");
- valueCache.add(path, query);
- } else {
- setupEscapes(path);
- }
- n = query(root);
- return DQ.getNodeValue(n[0] || n, defaultValue);
- },
-
- getNodeValue: function(node, defaultValue) {
-
-
-
-
- if (typeof node.normalize == 'function') {
- node.normalize();
- }
- var firstChild = node && node.firstChild,
- v = firstChild ? firstChild.nodeValue : null;
-
-
-
- if (defaultValue !== undefined && (v == null || v === '')) {
- v = defaultValue;
- }
- return v;
- },
-
- selectNumber: function(path, root, defaultValue) {
- var v = DQ.selectValue(path, root, defaultValue || 0);
- return parseFloat(v);
- },
-
- is: function(el, ss) {
- if (typeof el == "string") {
- el = doc.getElementById(el);
- }
- var isArray = Ext.isArray(el),
- result = DQ.filter(isArray ? el : [
- el
- ], ss);
- return isArray ? (result.length == el.length) : (result.length > 0);
- },
-
- filter: function(els, ss, nonMatches) {
- ss = ss.replace(trimRe, "");
- var query = simpleCache.get(ss),
- result;
- if (!query) {
- query = DQ.compile(ss, "simple");
- simpleCache.add(ss, query);
- } else {
- setupEscapes(ss);
- }
- result = query(els);
- return nonMatches ? quickDiff(result, els) : result;
- },
-
- matchers: [
- {
- re: /^\.([\w\-\\]+)/,
- select: useClassList ? 'n = byClassName(n, "{1}");' : 'n = byClassName(n, " {1} ");'
- },
- {
- re: /^\:([\w\-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
- select: 'n = byPseudo(n, "{1}", "{2}");'
- },
- {
- re: /^(?:([\[\{])(?:@)?([\w\-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
- select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
- },
- {
- re: /^#([\w\-\\]+)/,
- select: 'n = byId(n, "{1}");'
- },
- {
- re: /^@([\w\-\.]+)/,
- select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
- }
- ],
-
-
- pseudos: {
- "first-child": function(c) {
- var r = [],
- ri = -1,
- n, i, ci;
- for (i = 0; (ci = n = c[i]); i++) {
- while ((n = n.previousSibling) && n.nodeType != 1){}
- if (!n) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "last-child": function(c) {
- var r = [],
- ri = -1,
- n, i, ci;
- for (i = 0; (ci = n = c[i]); i++) {
- while ((n = n.nextSibling) && n.nodeType != 1){}
- if (!n) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "nth-child": function(c, a) {
- var r = [],
- ri = -1,
- m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
- f = (m[1] || 1) - 0,
- l = m[2] - 0,
- i, n, j, cn, pn;
- for (i = 0; n = c[i]; i++) {
- pn = n.parentNode;
- if (batch != pn._batch) {
- j = 0;
- for (cn = pn.firstChild; cn; cn = cn.nextSibling) {
- if (cn.nodeType == 1) {
- cn.nodeIndex = ++j;
- }
- }
- pn._batch = batch;
- }
- if (f == 1) {
- if (l === 0 || n.nodeIndex == l) {
- r[++ri] = n;
- }
- } else if ((n.nodeIndex + l) % f === 0) {
- r[++ri] = n;
- }
- }
- return r;
- },
- "only-child": function(c) {
- var r = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if (!prev(ci) && !next(ci)) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "empty": function(c) {
- var r = [],
- ri = -1,
- i, ci, cns, j, cn, empty;
- for (i = 0; ci = c[i]; i++) {
- cns = ci.childNodes;
- j = 0;
- empty = true;
- while (cn = cns[j]) {
- ++j;
- if (cn.nodeType == 1 || cn.nodeType == 3) {
- empty = false;
- break;
- }
- }
- if (empty) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "contains": function(c, v) {
- var r = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if ((ci.textContent || ci.innerText || ci.text || '').indexOf(v) != -1) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "nodeValue": function(c, v) {
- var r = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if (ci.firstChild && ci.firstChild.nodeValue == v) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "checked": function(c) {
- var r = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if (ci.checked === true) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "not": function(c, ss) {
- return DQ.filter(c, ss, true);
- },
- "any": function(c, selectors) {
- var ss = selectors.split('|'),
- r = [],
- ri = -1,
- s, i, ci, j;
- for (i = 0; ci = c[i]; i++) {
- for (j = 0; s = ss[j]; j++) {
- if (DQ.is(ci, s)) {
- r[++ri] = ci;
- break;
- }
- }
- }
- return r;
- },
- "odd": function(c) {
- return this["nth-child"](c, "odd");
- },
- "even": function(c) {
- return this["nth-child"](c, "even");
- },
- "nth": function(c, a) {
- return c[a - 1] || [];
- },
- "first": function(c) {
- return c[0] || [];
- },
- "last": function(c) {
- return c[c.length - 1] || [];
- },
- "has": function(c, ss) {
- var s = DQ.select,
- r = [],
- ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if (s(ss, ci).length > 0) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "next": function(c, ss) {
- var is = DQ.is,
- r = [],
- ri = -1,
- i, ci, n;
- for (i = 0; ci = c[i]; i++) {
- n = next(ci);
- if (n && is(n, ss)) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- "prev": function(c, ss) {
- var is = DQ.is,
- r = [],
- ri = -1,
- i, ci, n;
- for (i = 0; ci = c[i]; i++) {
- n = prev(ci);
- if (n && is(n, ss)) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- focusable: function(candidates) {
- var len = candidates.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = candidates[i];
- if (Ext.fly(c, '_DomQuery').isFocusable()) {
- results.push(c);
- }
- }
- return results;
- },
- visible: function(candidates, deep) {
- var len = candidates.length,
- results = [],
- i = 0,
- c;
- for (; i < len; i++) {
- c = candidates[i];
- if (Ext.fly(c, '_DomQuery').isVisible(deep)) {
- results.push(c);
- }
- }
- return results;
- },
- isScrolled: function(c) {
- var r = [],
- ri = -1,
- i, ci, s;
- for (i = 0; ci = c[i]; i++) {
- s = Ext.fly(ci, '_DomQuery').getScroll();
- if (s.top > 0 || s.left > 0) {
- r[++ri] = ci;
- }
- }
- return r;
- }
- }
- };
- }, function() {
- this._init();
- });
- Ext.define('Ext.data.reader.Xml', {
- extend: Ext.data.reader.Reader,
- alternateClassName: 'Ext.data.XmlReader',
- alias: 'reader.xml',
- config: {
-
- record: '',
-
- namespace: ''
- },
-
- responseType: 'document',
-
- createAccessor: function(expr) {
- if (Ext.isEmpty(expr)) {
- return Ext.emptyFn;
- }
- if (Ext.isFunction(expr)) {
- return expr;
- }
- return function(root) {
- return this.getNodeValue(Ext.DomQuery.selectNode(expr, root));
- };
- },
- getNodeValue: function(node) {
- if (node) {
-
-
-
- if (typeof node.normalize === 'function') {
- node.normalize();
- }
- node = node.firstChild;
- if (node) {
- return node.nodeValue;
- }
- }
- return undefined;
- },
- getResponseData: function(response) {
- var xml = response.responseXML,
- error = 'XML data not found in the response';
- if (!xml) {
- Ext.Logger.warn(error);
- return this.createReadError(error);
- }
- return xml;
- },
-
- getData: function(data) {
- return data.documentElement || data;
- },
-
- getRoot: function(data) {
- return this.getRootValue(data, this.getRootProperty());
- },
-
- extractData: function(root, readOptions) {
- var recordName = this.getRecord();
-
- if (!recordName) {
- Ext.raise('Record is a required parameter');
- }
-
- if (recordName !== root.nodeName) {
- root = Ext.DomQuery.select(recordName, root);
- } else {
- root = [
- root
- ];
- }
- return this.callParent([
- root,
- readOptions
- ]);
- },
-
- readRecords: function(doc, readOptions, internalReadOptions) {
-
-
- if (Ext.isArray(doc)) {
- doc = doc[0];
- }
- return this.callParent([
- doc,
- readOptions,
- internalReadOptions
- ]);
- },
-
- createFieldAccessor: function(field) {
- var namespace = this.getNamespace(),
- selector, autoMapping, result;
- if (field.mapping) {
- selector = field.mapping;
- } else {
- selector = (namespace ? namespace + '|' : '') + field.name;
- autoMapping = true;
- }
- if (typeof selector === 'function') {
- result = function(raw, self) {
- return field.mapping(raw, self);
- };
- } else {
-
-
-
-
-
- if (autoMapping && !namespace && Ext.supports.XmlQuerySelector) {
- result = function(raw, self) {
- return self.getNodeValue(raw.querySelector(selector));
- };
- }
- if (!result) {
- result = function(raw, self) {
- return self.getNodeValue(Ext.DomQuery.selectNode(selector, raw));
- };
- }
- }
- return result;
- },
- privates: {
- getGroupRoot: function(data) {
- return this.getRootValue(data, this.getGroupRootProperty());
- },
- getRootValue: function(data, prop) {
- var nodeName = data.nodeName;
- if (!prop || (nodeName && nodeName == prop)) {
- return data;
- } else if (typeof prop === 'function') {
- return prop(data);
- } else if (Ext.DomQuery.isXml(data)) {
-
-
-
- return Ext.DomQuery.selectNode(prop, data);
- }
- },
- getSummaryRoot: function(data) {
- return this.getRootValue(data, this.getSummaryRootProperty());
- }
- },
- deprecated: {
- '5.1.1': {
- properties: {
-
- xmlData: null
- }
- }
- }
- });
- Ext.define('Ext.data.writer.Xml', {
-
- extend: Ext.data.writer.Writer,
- alternateClassName: 'Ext.data.XmlWriter',
- alias: 'writer.xml',
-
- config: {
-
- documentRoot: 'xmlData',
-
- defaultDocumentRoot: 'xmlData',
-
- header: '',
-
- record: 'record'
- },
-
- selectorRe: /[^>\s]+/g,
- writeRecords: function(request, data) {
- var me = this,
- xml = [],
- i = 0,
- len = data.length,
- root = me.getDocumentRoot(),
- recordName = me.getRecord(),
-
- record = recordName.match(this.selectorRe),
- recLen = record.length,
-
-
- needsRoot = data.length !== 1 && recLen === 1,
- transform;
- transform = this.getTransform();
- if (transform) {
- data = transform(data, request);
- }
-
- xml.push(me.getHeader() || '');
- if (!root && needsRoot) {
- root = me.getDefaultDocumentRoot();
- }
-
- if (root) {
- xml.push('<', root, '>');
- }
-
- for (i = 0; i < recLen - 1; i++) {
- xml.push('<', record[i], '>');
- }
- recordName = record[i];
- for (i = 0; i < len; ++i) {
- this.objectToElement(recordName, data[i], xml);
- }
-
- for (i = recLen - 2; i > -1; i--) {
- xml.push('</', record[i], '>');
- }
- if (root) {
- xml.push('</', root, '>');
- }
- request.setXmlData(xml.join(''));
- return request;
- },
-
- objectToElement: function(name, o, output) {
- var key, datum,
- subOutput = [],
- subKeys, subKeyLen, i, subObject, subObjects, lastObject, lastKey;
- if (!output) {
- output = [];
- }
-
-
- output.push('<', name);
- for (key in o) {
- datum = o[key];
-
- if (key[0] === '@') {
- output.push(' ', key.substr(1), '="', datum, '"');
- } else
- {
-
- if (typeof datum === 'object') {
- this.objectToElement(key, datum, subOutput);
- } else {
-
- subKeys = key.match(this.selectorRe);
-
-
- if ((subKeyLen = subKeys.length) > 1) {
- subObjects = subObjects || {};
- for (subObject = subObjects , i = 0; i < subKeyLen; i++) {
- lastObject = subObject;
- lastKey = subKeys[i];
- subObject = subObject[lastKey] || (subObject[lastKey] = {});
- }
-
- lastObject[lastKey] = datum;
- } else {
- subOutput.push('<', key, '>', datum, '</', key, '>');
- }
- }
- }
- }
- output.push('>');
- output.push.apply(output, subOutput);
-
- if (subObjects) {
- for (key in subObjects) {
- datum = subObjects[key];
- this.objectToElement(key, datum, output);
- }
- }
-
- output.push('</', name, '>');
- return output;
- }
- });
- Ext.define('Ext.data.XmlStore', {
- extend: Ext.data.Store,
- alias: 'store.xml',
- constructor: function(config) {
- config = Ext.apply({
- proxy: {
- type: 'ajax',
- reader: 'xml',
- writer: 'xml'
- }
- }, config);
- this.callParent([
- config
- ]);
- }
- });
- Ext.define('Ext.data.identifier.Negative', {
- extend: Ext.data.identifier.Sequential,
- alias: 'data.identifier.negative',
- config: {
- increment: -1,
- seed: -1
- }
- });
- Ext.define('Ext.data.identifier.Uuid', {
- extend: Ext.data.identifier.Generator,
- alias: 'data.identifier.uuid',
-
- isUnique: true,
- config: {
-
- id: null
- },
-
-
-
-
- constructor: function(config) {
- this.callParent([
- config
- ]);
- this.reconfigure(config);
- },
-
- reconfigure: function(config) {
- var cls = this.self;
- this.generate = (config && config.version === 1) ? cls.createSequential(config.salt, config.timestamp, config.clockSeq) : cls.createRandom();
- },
- clone: null,
- statics: {
- createRandom: function() {
- var pattern = 'xxxxxxxx-xxxx-4xxx-Rxxx-xMxxxxxxxxxx'.split(''),
- hex = '0123456789abcdef'.split(''),
- length = pattern.length,
- parts = [];
- return function() {
- for (var r, c,
- i = 0; i < length; ++i) {
- c = pattern[i];
- if (c !== '-' && c !== '4') {
- r = Math.random() * 16;
- r = (c === 'R') ? (r & 3 | 8) : (r | ((c === 'M') ? 1 : 0));
- c = hex[r];
- }
-
- parts[i] = c;
- }
- return parts.join('');
- };
- },
- createSequential: function(salt, time, clockSeq) {
- var parts = [],
- twoPow32 = Math.pow(2, 32),
- saltLo = salt.lo,
- saltHi = salt.hi,
- timeLo = time.lo,
- timeHi = time.hi,
- toHex = function(value, length) {
- var ret = value.toString(16).toLowerCase();
- if (ret.length > length) {
- ret = ret.substring(ret.length - length);
- }
-
- else if (ret.length < length) {
- ret = Ext.String.leftPad(ret, length, '0');
- }
- return ret;
- };
- if (typeof salt === 'number') {
- saltHi = Math.floor(salt / twoPow32);
- saltLo = Math.floor(salt - saltHi * twoPow32);
- }
- if (typeof time === 'number') {
- timeHi = Math.floor(time / twoPow32);
- timeLo = Math.floor(time - timeHi * twoPow32);
- }
-
-
- saltHi |= 256;
- parts[3] = toHex(128 | ((clockSeq >>> 8) & 63), 2) + toHex(clockSeq & 255, 2);
- parts[4] = toHex(saltHi, 4) + toHex(saltLo, 8);
-
- return function() {
- parts[0] = toHex(timeLo, 8);
- parts[1] = toHex(timeHi & 65535, 4);
- parts[2] = toHex(((timeHi >>> 16) & 4095) | (1 << 12), 4);
-
- ++timeLo;
- if (timeLo >= twoPow32) {
-
- timeLo = 0;
- ++timeHi;
- }
- return parts.join('-');
- };
- }
- }
- }, function() {
- this.Global = new this({
- id: 'uuid'
- });
- });
- Ext.define('Ext.data.proxy.WebStorage', {
- extend: Ext.data.proxy.Client,
- alternateClassName: 'Ext.data.WebStorageProxy',
- config: {
-
- id: undefined
- },
-
-
-
- constructor: function(config) {
- this.callParent(arguments);
-
- this.cache = {};
-
- if (this.getStorageObject() === undefined) {
- Ext.raise("Local Storage is not supported in this browser, please use another type of data proxy");
- }
-
-
- if (this.getId() === undefined) {
- Ext.raise("No unique id was provided to the local storage proxy. See Ext.data.proxy.LocalStorage documentation for details");
- }
-
- this.initialize();
- },
-
- create: function(operation) {
- var me = this,
- records = operation.getRecords(),
- length = records.length,
- ids = me.getIds(),
- id, record, i, identifier;
- if (me.isHierarchical === undefined) {
-
-
-
-
- me.isHierarchical = !!records[0].isNode;
- if (me.isHierarchical) {
- me.getStorageObject().setItem(me.getTreeKey(), true);
- }
- }
- for (i = 0; i < length; i++) {
- record = records[i];
- if (record.phantom) {
- identifier = record.identifier;
- if (identifier && identifier.isUnique) {
- id = record.getId();
- } else {
- id = me.getNextId();
- }
- } else {
- id = record.getId();
- }
- me.setRecord(record, id);
- record.commit();
- ids.push(id);
- }
- me.setIds(ids);
- operation.setSuccessful(true);
- },
-
- read: function(operation) {
- var me = this,
- allRecords,
- records = [],
- success = true,
- Model = me.getModel(),
- validCount = 0,
- recordCreator = operation.getRecordCreator(),
- filters, sorters, limit, filterLen, valid, record, ids, length, data, id, i, j;
- if (me.isHierarchical) {
- records = me.getTreeData();
- } else {
- ids = me.getIds();
- length = ids.length;
- id = operation.getId();
-
- if (id) {
- data = me.getRecord(id);
- if (data !== null) {
- record = recordCreator ? recordCreator(data, Model) : new Model(data);
- }
- if (record) {
- records.push(record);
- } else {
- success = false;
- }
- } else {
- sorters = operation.getSorters();
- filters = operation.getFilters();
- limit = operation.getLimit();
- allRecords = [];
-
-
-
- for (i = 0; i < length; i++) {
- data = me.getRecord(ids[i]);
- record = recordCreator ? recordCreator(data, Model) : new Model(data);
- allRecords.push(record);
- }
- if (sorters) {
- Ext.Array.sort(allRecords, Ext.util.Sorter.createComparator(sorters));
- }
- for (i = operation.getStart() || 0; i < length; i++) {
- record = allRecords[i];
- valid = true;
- if (filters) {
- for (j = 0 , filterLen = filters.length; j < filterLen; j++) {
- valid = filters[j].filter(record);
- }
- }
- if (valid) {
- records.push(record);
- validCount++;
- }
- if (limit && validCount === limit) {
- break;
- }
- }
- }
- }
- if (success) {
- operation.setResultSet(new Ext.data.ResultSet({
- records: records,
- total: records.length,
- loaded: true
- }));
- operation.setSuccessful(true);
- } else {
- operation.setException('Unable to load records');
- }
- },
-
- update: function(operation) {
- var records = operation.getRecords(),
- length = records.length,
- ids = this.getIds(),
- record, id, i;
- for (i = 0; i < length; i++) {
- record = records[i];
- this.setRecord(record);
- record.commit();
-
-
-
- id = record.getId();
- if (id !== undefined && Ext.Array.indexOf(ids, id) === -1) {
- ids.push(id);
- }
- }
- this.setIds(ids);
- operation.setSuccessful(true);
- },
-
- erase: function(operation) {
- var me = this,
- records = operation.getRecords(),
- ids = me.getIds(),
- idLength = ids.length,
- newIds = [],
- removedHash = {},
- i = records.length,
- id;
- for (; i--; ) {
- Ext.apply(removedHash, me.removeRecord(records[i]));
- }
- for (i = 0; i < idLength; i++) {
- id = ids[i];
- if (!removedHash[id]) {
- newIds.push(id);
- }
- }
- me.setIds(newIds);
- operation.setSuccessful(true);
- },
-
- getRecord: function(id) {
- var me = this,
- cache = me.cache,
- data = !cache[id] ? Ext.decode(me.getStorageObject().getItem(me.getRecordKey(id))) : cache[id];
- if (!data) {
- return null;
- }
- cache[id] = data;
- data[me.getModel().prototype.idProperty] = id;
-
-
- return Ext.merge({}, data);
- },
-
- setRecord: function(record, id) {
- if (id) {
- record.set('id', id, {
- commit: true
- });
- } else {
- id = record.getId();
- }
- var me = this,
- rawData = record.getData(),
- data = {},
- model = me.getModel(),
- fields = model.getFields(),
- length = fields.length,
- i = 0,
- field, name, obj, key, value;
- for (; i < length; i++) {
- field = fields[i];
- name = field.name;
- if (field.persist) {
- value = rawData[name];
- if (field.isDateField && field.dateFormat && Ext.isDate(value)) {
- value = Ext.Date.format(value, field.dateFormat);
- } else if (field.serialize) {
- value = field.serialize(value, record);
- }
- data[name] = value;
- }
- }
-
- delete data[model.prototype.idProperty];
-
- if (record.isNode && record.get('depth') === 1) {
- delete data.parentId;
- }
- obj = me.getStorageObject();
- key = me.getRecordKey(id);
-
- me.cache[id] = data;
-
- obj.removeItem(key);
- obj.setItem(key, Ext.encode(data));
- },
-
- removeRecord: function(record) {
- var me = this,
- id = record.getId(),
- records = {},
- i, childNodes;
- records[id] = record;
- me.getStorageObject().removeItem(me.getRecordKey(id));
- delete me.cache[id];
- if (record.childNodes) {
- childNodes = record.childNodes;
- for (i = childNodes.length; i--; ) {
- Ext.apply(records, me.removeRecord(childNodes[i]));
- }
- }
- return records;
- },
-
- getRecordKey: function(id) {
- if (id.isModel) {
- id = id.getId();
- }
- return Ext.String.format("{0}-{1}", this.getId(), id);
- },
-
- getRecordCounterKey: function() {
- return Ext.String.format("{0}-counter", this.getId());
- },
-
- getTreeKey: function() {
- return Ext.String.format("{0}-tree", this.getId());
- },
-
- getIds: function() {
- var me = this,
- ids = (me.getStorageObject().getItem(me.getId()) || "").split(","),
- length = ids.length,
- isString = this.getIdField().isStringField,
- i;
- if (length === 1 && ids[0] === "") {
- ids = [];
- } else {
- for (i = 0; i < length; i++) {
- ids[i] = isString ? ids[i] : +ids[i];
- }
- }
- return ids;
- },
- getIdField: function() {
- return this.getModel().prototype.idField;
- },
-
- setIds: function(ids) {
- var obj = this.getStorageObject(),
- str = ids.join(","),
- id = this.getId();
- obj.removeItem(id);
- if (!Ext.isEmpty(str)) {
- obj.setItem(id, str);
- }
- },
-
- getNextId: function() {
- var me = this,
- obj = me.getStorageObject(),
- key = me.getRecordCounterKey(),
- isString = me.getIdField().isStringField,
- id;
- id = me.idGenerator.generate();
- obj.setItem(key, id);
- if (isString) {
- id = id + '';
- }
- return id;
- },
-
- getTreeData: function() {
- var me = this,
- ids = me.getIds(),
- length = ids.length,
- records = [],
- recordHash = {},
- root = [],
- i = 0,
- Model = me.getModel(),
- idProperty = Model.prototype.idProperty,
- rootLength, record, parent, parentId, children, id;
- for (; i < length; i++) {
- id = ids[i];
-
- record = me.getRecord(id);
-
- records.push(record);
-
- recordHash[id] = record;
- if (!record.parentId) {
-
- root.push(record);
- }
- }
- rootLength = root.length;
-
- Ext.Array.sort(records, me.sortByParentId);
-
- for (i = rootLength; i < length; i++) {
- record = records[i];
- parentId = record.parentId;
- if (!parent || parent[idProperty] !== parentId) {
-
- parent = recordHash[parentId];
- parent.children = children = [];
- }
-
- children.push(record);
- }
- for (i = length; i--; ) {
- record = records[i];
- if (!record.children && !record.leaf) {
-
- record.loaded = true;
- }
- }
-
- for (i = rootLength; i--; ) {
- record = root[i];
- root[i] = new Model(record);
- }
- return root;
- },
-
- sortByParentId: function(node1, node2) {
- return (node1.parentId || 0) - (node2.parentId || 0);
- },
-
- initialize: function() {
- var me = this,
- storageObject = me.getStorageObject(),
- lastId = +storageObject.getItem(me.getRecordCounterKey()),
- id = me.getId();
- storageObject.setItem(id, storageObject.getItem(id) || "");
- if (storageObject.getItem(me.getTreeKey())) {
- me.isHierarchical = true;
- }
- me.idGenerator = new Ext.data.identifier.Sequential({
- seed: lastId ? lastId + 1 : 1
- });
- },
-
- clear: function() {
- var me = this,
- obj = me.getStorageObject(),
- ids = me.getIds(),
- len = ids.length,
- i;
-
- for (i = 0; i < len; i++) {
- obj.removeItem(me.getRecordKey(ids[i]));
- }
-
- obj.removeItem(me.getRecordCounterKey());
- obj.removeItem(me.getTreeKey());
- obj.removeItem(me.getId());
-
- me.cache = {};
- },
-
- getStorageObject: function() {
-
- Ext.raise("The getStorageObject function has not been defined in your Ext.data.proxy.WebStorage subclass");
- }
- });
- Ext.define('Ext.data.proxy.LocalStorage', {
- extend: Ext.data.proxy.WebStorage,
- alias: 'proxy.localstorage',
- alternateClassName: 'Ext.data.LocalStorageProxy',
- getStorageObject: function() {
- return window.localStorage;
- }
- });
- Ext.define('Ext.data.proxy.Rest', {
- extend: Ext.data.proxy.Ajax,
- alternateClassName: 'Ext.data.RestProxy',
- alias: 'proxy.rest',
-
- defaultActionMethods: {
- create: 'POST',
- read: 'GET',
- update: 'PUT',
- destroy: 'DELETE'
- },
- slashRe: /\/$/,
- periodRe: /\.$/,
- config: {
-
- appendId: true,
-
- format: null,
-
- batchActions: false,
-
- actionMethods: {
- create: 'POST',
- read: 'GET',
- update: 'PUT',
- destroy: 'DELETE'
- }
- },
-
- buildUrl: function(request) {
- var me = this,
- operation = request.getOperation(),
- records = operation.getRecords(),
- record = records ? records[0] : null,
- format = me.getFormat(),
- url = me.getUrl(request),
- id, params;
- if (record && !record.phantom) {
- id = record.getId();
- } else {
- id = operation.getId();
- }
- if (me.getAppendId() && me.isValidId(id)) {
- if (!url.match(me.slashRe)) {
- url += '/';
- }
- url += encodeURIComponent(id);
- params = request.getParams();
- if (params) {
- delete params[me.getIdParam()];
- }
- }
- if (format) {
- if (!url.match(me.periodRe)) {
- url += '.';
- }
- url += format;
- }
- request.setUrl(url);
- return me.callParent([
- request
- ]);
- },
- isValidId: function(id) {
- return id || id === 0;
- }
- });
- Ext.define('Ext.data.proxy.SessionStorage', {
- extend: Ext.data.proxy.WebStorage,
- alias: 'proxy.sessionstorage',
- alternateClassName: 'Ext.data.SessionStorageProxy',
- getStorageObject: function() {
- return window.sessionStorage;
- }
- });
- Ext.define('Ext.data.summary.Base', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'data.summary.base',
-
- isAggregator: true,
- factoryConfig: {
- defaultType: 'base',
- cacheable: true
- },
- constructor: function(config) {
- var calculate = config && config.calculate;
- if (calculate) {
- config = Ext.apply({}, config);
- delete config.calculate;
- this.calculate = calculate;
- }
- this.initConfig(config);
- },
-
-
- extractValue: function(record, property, root) {
- var ret;
- if (record) {
- if (root) {
- record = record[root];
- }
- ret = record[property];
- }
- return ret;
- }
- }, function() {
- Ext.Factory.on('dataSummary', function(factory, config) {
- if (typeof config === 'function') {
- return factory({
- calculate: config
- });
- }
- });
- });
- Ext.define('Ext.data.summary.Sum', {
- extend: Ext.data.summary.Base,
- alias: 'data.summary.sum',
- calculate: function(records, property, root, begin, end) {
- var n = end - begin,
- i, sum, v;
- for (i = 0; i < n; ++i) {
- v = this.extractValue(records[begin + i], property, root);
- sum = i ? sum + v : v;
- }
- return sum;
- }
- });
- Ext.define('Ext.data.summary.Average', {
- extend: Ext.data.summary.Sum,
- alias: 'data.summary.average',
- calculate: function(records, property, root, begin, end) {
- var len = end - begin,
- value;
- if (len > 0) {
- value = this.callParent([
- records,
- property,
- root,
- begin,
- end
- ]) / len;
- }
- return value;
- }
- });
- Ext.define('Ext.data.summary.Count', {
- extend: Ext.data.summary.Base,
- alias: 'data.summary.count',
- calculate: function(records, property, root, begin, end) {
- return end - begin;
- }
- });
- Ext.define('Ext.data.summary.Max', {
- extend: Ext.data.summary.Base,
- alias: 'data.summary.max',
- calculate: function(records, property, root, begin, end) {
- var max = this.extractValue(records[begin], property, root),
- i, v;
- for (i = begin; i < end; ++i) {
- v = this.extractValue(records[i], property, root);
- if (v > max) {
- max = v;
- }
- }
- return max;
- }
- });
- Ext.define('Ext.data.summary.Min', {
- extend: Ext.data.summary.Base,
- alias: 'data.summary.min',
- calculate: function(records, property, root, begin, end) {
- var min = this.extractValue(records[begin], property, root),
- i, v;
- for (i = begin; i < end; ++i) {
- v = this.extractValue(records[i], property, root);
- if (v < min) {
- min = v;
- }
- }
- return min;
- }
- });
- Ext.define('Ext.data.validator.AbstractDate', {
- extend: Ext.data.validator.Validator,
- config: {
-
- message: null,
-
- format: ''
- },
- applyFormat: function(format) {
- if (!format) {
- format = this.getDefaultFormat();
- }
- if (!Ext.isArray(format)) {
- format = [
- format
- ];
- }
- return format;
- },
- parse: function(value) {
- if (Ext.isDate(value)) {
- return value;
- }
- var me = this,
- format = me.getFormat(),
- len = format.length,
- ret = null,
- i;
- for (i = 0; i < len && !ret; ++i) {
- ret = Ext.Date.parse(value, format[i], true);
- }
- return ret;
- },
- validate: function(value) {
- return this.parse(value) ? true : this.getMessage();
- }
- });
- Ext.define('Ext.data.validator.Bound', {
- extend: Ext.data.validator.Validator,
- alias: 'data.validator.bound',
- type: 'bound',
- config: {
-
- min: undefined,
-
- max: undefined,
-
- emptyMessage: 'Must be present',
-
- minOnlyMessage: 'Value must be greater than {0}',
-
- maxOnlyMessage: 'Value must be less than {0}',
-
- bothMessage: 'Value must be between {0} and {1}'
- },
- resetMessages: function() {
- this._bothMsg = this._minMsg = this._maxMsg = null;
- },
- updateMin: function() {
- this.resetMessages();
- },
- updateMax: function() {
- this.resetMessages();
- },
- updateMinOnlyMessage: function() {
- this.resetMessages();
- },
- updateMaxOnlyMessage: function() {
- this.resetMessages();
- },
- updateBothMessage: function() {
- this.resetMessages();
- },
- validate: function(value) {
- var me = this,
- min = me.getMin(),
- max = me.getMax(),
- hasMin = (min != null),
- hasMax = (max != null),
- msg = this.validateValue(value);
- if (msg !== true) {
- return msg;
- }
- value = me.getValue(value);
- if (hasMin && hasMax) {
- if (value < min || value > max) {
- msg = me._bothMsg || (me._bothMsg = Ext.String.format(me.getBothMessage(), min, max));
- }
- } else if (hasMin) {
- if (value < min) {
- msg = me._minMsg || (me._minMsg = Ext.String.format(me.getMinOnlyMessage(), min));
- }
- } else if (hasMax) {
- if (value > max) {
- msg = me._maxMsg || (me._maxMsg = Ext.String.format(me.getMaxOnlyMessage(), max));
- }
- }
- return msg;
- },
- validateValue: function(value) {
- if (value === undefined || value === null) {
- return this.getEmptyMessage();
- }
- return true;
- },
- getValue: Ext.identityFn
- });
- Ext.define('Ext.data.validator.Format', {
- extend: Ext.data.validator.Validator,
- alias: 'data.validator.format',
- type: 'format',
- config: {
-
- message: 'Is in the wrong format',
-
- matcher: undefined
- },
-
- constructor: function() {
- this.callParent(arguments);
- if (!this.getMatcher()) {
- Ext.raise('validator.Format must be configured with a matcher');
- }
- },
-
- validate: function(value) {
- var matcher = this.getMatcher(),
- result = matcher && matcher.test(value);
- return result ? result : this.getMessage();
- }
- });
- Ext.define('Ext.data.validator.CIDRv4', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.cidrv4',
- type: 'cidrv4',
-
-
- message: 'Is not a valid CIDR block',
-
-
- matcher: /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/
- });
- Ext.define('Ext.data.validator.CIDRv6', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.cidrv6',
- type: 'cidrv6',
-
-
- message: 'Is not a valid CIDR block',
-
-
- matcher: /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/
- });
- Ext.define('Ext.data.validator.Number', {
- extend: Ext.data.validator.Validator,
- alias: 'data.validator.number',
- type: 'number',
- config: {
-
- decimalSeparator: undefined,
-
- message: 'Is not a valid number',
-
- thousandSeparator: undefined
- },
- constructor: function(config) {
- this.callParent([
- config
- ]);
- this.rebuildMatcher();
- },
- applyDecimalSeparator: function(v) {
- return v === undefined ? Ext.util.Format.decimalSeparator : v;
- },
- updateDecimalSeparator: function() {
- this.rebuildMatcher();
- },
- applyThousandSeparator: function(v) {
- return v === undefined ? Ext.util.Format.thousandSeparator : v;
- },
- updateThousandSeparator: function() {
- this.rebuildMatcher();
- },
- parse: function(v) {
- var sep = this.getDecimalSeparator(),
- N = Ext.Number;
- if (typeof v === 'string') {
- if (!this.matcher.test(v)) {
- return null;
- }
- v = this.parseValue(v);
- }
- return sep ? N.parseFloat(v) : N.parseInt(v);
- },
- validate: function(value) {
- return this.parse(value) === null ? this.getMessage() : true;
- },
- privates: {
- getMatcherText: function(preventSign) {
- var t = this.getThousandSeparator(),
- d = this.getDecimalSeparator(),
- s = '(?:';
- if (t) {
- t = Ext.String.escapeRegex(t);
- s += '(?:\\d{1,3}(' + t + '\\d{3})*)|';
- }
- s += '\\d*)';
- if (d) {
- d = Ext.String.escapeRegex(d);
- s += '(?:' + d + '\\d*)?';
- }
- if (!preventSign) {
- s = this.getSignPart() + s;
- }
- return s;
- },
- getSignPart: function() {
- return '(\\+|\\-)?';
- },
- parseValue: function(v) {
- var thousandMatcher = this.thousandMatcher,
- decimal;
- if (thousandMatcher) {
- v = v.replace(thousandMatcher, '');
- }
- decimal = this.getDecimalSeparator();
- if (decimal && decimal !== '.') {
- v = v.replace(decimal, '.');
- }
- return v;
- },
- rebuildMatcher: function() {
- var me = this,
- sep;
- if (!me.isConfiguring) {
- sep = me.getThousandSeparator();
- me.matcher = new RegExp('^' + me.getMatcherText() + '$');
- if (sep) {
- me.thousandMatcher = sep ? new RegExp(Ext.String.escapeRegex(sep), 'g') : null;
- }
- }
- }
- }
- });
- Ext.define('Ext.data.validator.Currency', {
- extend: Ext.data.validator.Number,
- alias: 'data.validator.currency',
- type: 'currency',
- config: {
-
- symbolAtEnd: undefined,
-
- spacer: undefined,
-
- symbol: undefined
- },
-
- message: 'Is not a valid currency amount',
- applySymbolAtEnd: function(value) {
- return value === undefined ? Ext.util.Format.currencyAtEnd : value;
- },
- updateSymbolAtEnd: function() {
- this.rebuildMatcher();
- },
- applySpacer: function(value) {
- return value === undefined ? Ext.util.Format.currencySpacer : value;
- },
- updateSpacer: function() {
- this.rebuildMatcher();
- },
- applySymbol: function(value) {
- return value === undefined ? Ext.util.Format.currencySign : value;
- },
- updateSymbol: function() {
- this.rebuildMatcher();
- },
- privates: {
- getMatcherText: function() {
- var me = this,
- ret = me.callParent([
- true
- ]),
- symbolPart = me.getSymbolMatcher();
- if (me.getSymbolAtEnd()) {
- ret += symbolPart;
- } else {
- ret = symbolPart + ret;
- }
- return me.getSignPart() + ret;
- },
- getSymbolMatcher: function() {
- var symbol = Ext.String.escapeRegex(this.getSymbol()),
- spacer = Ext.String.escapeRegex(this.getSpacer() || ''),
- s = this.getSymbolAtEnd() ? (spacer + symbol) : (symbol + spacer);
- return '(?:' + s + ')?';
- },
- parseValue: function(v) {
-
- v = v.replace(this.currencyMatcher, this.atEnd ? '' : '$1');
- return this.callParent([
- v
- ]);
- },
- rebuildMatcher: function() {
- var me = this,
- symbolPart, atEnd, sign;
- me.callParent();
- if (!me.isConfiguring) {
- atEnd = me.getSymbolAtEnd();
- symbolPart = me.getSymbolMatcher();
- sign = me.getSignPart();
- me.atEnd = atEnd;
- me.currencyMatcher = new RegExp(atEnd ? (symbolPart + '$') : ('^' + sign + symbolPart));
- }
- }
- }
- });
- Ext.define('Ext.data.validator.CurrencyUS', {
- extend: Ext.data.validator.Currency,
- alias: 'data.validator.currency-us',
- type: 'currency-us',
- thousandSeparator: ',',
- decimalSeparator: '.',
- symbol: '$',
- spacer: '',
- symbolAtEnd: false
- });
- Ext.define('Ext.data.validator.Date', {
- extend: Ext.data.validator.AbstractDate,
- alias: 'data.validator.date',
- type: 'date',
- isDateValidator: true,
-
- message: 'Is not a valid date',
-
- privates: {
- getDefaultFormat: function() {
- return [
- Ext.Date.defaultFormat,
- 'm/d/Y',
- 'n/j/Y',
- 'n/j/y',
- 'm/j/y',
- 'n/d/y',
- 'm/j/Y',
- 'n/d/Y',
- 'm-d-y',
- 'n-d-y',
- 'm-d-Y',
- 'mdy',
- 'mdY',
- 'Y-m-d'
- ];
- }
- }
- });
- Ext.define('Ext.data.validator.DateTime', {
- extend: Ext.data.validator.AbstractDate,
- alias: 'data.validator.datetime',
- type: 'datetime',
- isDateTimeValidator: true,
-
- message: 'Is not a valid date and time',
-
- privates: {
- getDefaultFormat: function() {
- var D = Ext.Date;
- return D.defaultFormat + ' ' + D.defaultTimeFormat;
- }
- }
- });
- Ext.define('Ext.data.validator.Email', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.email',
- type: 'email',
-
- message: 'Is not a valid email address',
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- matcher: /^(")?(?:[^\."])(?:(?:[\.])?(?:[\w\-!#$%&'*+\/=?\^_`{|}~]))*\1@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/
- });
- Ext.define('Ext.data.validator.List', {
- extend: Ext.data.validator.Validator,
- alias: 'data.validator.list',
- type: 'list',
- config: {
-
- list: null,
- message: null
- },
- inclusion: null,
- validate: function(value) {
- var contains = Ext.Array.contains(this.getList(), value),
- inclusion = this.inclusion,
- exclusion = !inclusion,
- result;
- result = (inclusion && contains) || (exclusion && !contains);
- return result || this.getMessage();
- }
- });
- Ext.define('Ext.data.validator.Exclusion', {
- extend: Ext.data.validator.List,
- alias: 'data.validator.exclusion',
- type: 'exclusion',
-
- message: 'Is a value that has been excluded',
-
- constructor: function() {
- this.callParent(arguments);
- if (!this.getList()) {
- Ext.raise('validator.Exclusion requires a list');
- }
- },
-
- inclusion: false
- });
- Ext.define('Ext.data.validator.IPAddress', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.ipaddress',
- type: 'ipaddress',
-
- message: 'Is not a valid IP address',
-
-
- matcher: new RegExp('^(' +
- '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' + '|' +
- '((([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])))' + ')$')
- });
- Ext.define('Ext.data.validator.Inclusion', {
- extend: Ext.data.validator.List,
- alias: 'data.validator.inclusion',
- type: 'inclusion',
-
- message: 'Is not in the list of acceptable values',
-
- constructor: function() {
- this.callParent(arguments);
- if (!this.getList()) {
- Ext.raise('validator.Inclusion requires a list');
- }
- },
-
- inclusion: true
- });
- Ext.define('Ext.data.validator.Length', {
- extend: Ext.data.validator.Bound,
- alias: 'data.validator.length',
- type: 'length',
-
-
-
- minOnlyMessage: 'Length must be at least {0}',
-
- maxOnlyMessage: 'Length must be no more than {0}',
-
- bothMessage: 'Length must be between {0} and {1}',
- getValue: function(v) {
- return String(v).length;
- }
- });
- Ext.define('Ext.data.validator.Presence', {
- extend: Ext.data.validator.Validator,
- alias: 'data.validator.presence',
- type: 'presence',
- isPresence: true,
- config: {
-
- message: 'Must be present',
-
- allowEmpty: false
- },
- validate: function(value) {
- var valid = !(value === undefined || value === null);
- if (valid && !this.getAllowEmpty()) {
- valid = value !== '';
- }
- return valid ? true : this.getMessage();
- }
- });
- Ext.define('Ext.data.validator.NotNull', {
- extend: Ext.data.validator.Presence,
- alias: 'data.validator.notnull',
- type: 'notnull',
- allowEmpty: true
- });
- Ext.define('Ext.data.validator.Phone', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.phone',
- type: 'phone',
-
-
-
- message: 'Is not a valid phone number',
-
- matcher: new RegExp('^ *' +
- '(?:' + '\\+?' +
- '(\\d{1,3})' +
- '[- .]?' + ')?' +
- '(?:' + '(?:' + '(\\d{3})' +
- '|' + '\\((\\d{3})\\)' +
- ')?' +
- '[- .]?' + ')' +
- '(?:' + '([2-9]\\d{2})' +
- '[- .]?' + ')' +
- '(\\d{4})' +
- '(?: *(?:e?xt?) *(\\d*))?' + ' *$')
- });
- Ext.define('Ext.data.validator.Range', {
- extend: Ext.data.validator.Bound,
- alias: 'data.validator.range',
- type: 'range',
-
-
-
- minOnlyMessage: 'Must be at least {0}',
-
- maxOnlyMessage: 'Must be no more than than {0}',
-
- bothMessage: 'Must be between {0} and {1}',
- config: {
-
- nanMessage: 'Must be numeric'
- },
- validateValue: function(value) {
- var msg = this.callParent([
- value
- ]);
- if (msg === true && isNaN(value)) {
- msg = this.getNanMessage();
- }
- return msg;
- }
- });
- Ext.define('Ext.data.validator.Time', {
- extend: Ext.data.validator.AbstractDate,
- alias: 'data.validator.time',
- type: 'time',
- isTimeValidator: true,
-
- message: 'Is not a valid time',
-
- privates: {
- getDefaultFormat: function() {
- return Ext.Date.defaultTimeFormat;
- }
- }
- });
- Ext.define('Ext.data.validator.Url', {
- extend: Ext.data.validator.Format,
- alias: 'data.validator.url',
- type: 'url',
-
- message: 'Is not a valid URL',
-
-
-
-
-
-
-
- matcher: /^(http:\/\/|https:\/\/|ftp:\/\/|\/\/)([-a-zA-Z0-9@:%_\+.~#?&//=])+$/
- });
- Ext.define('Ext.data.virtual.Group', {
- isVirtualGroup: true,
- firstRecords: null,
- id: '',
- summaryRecord: null,
- constructor: function(key) {
- this.id = key;
- this.firstRecords = [];
- },
- first: function() {
- return this.firstRecords[0] || null;
- },
- getGroupKey: function() {
- return this.id;
- },
- getSummaryRecord: function() {
- return this.summaryRecord;
- }
- });
- Ext.define('Ext.data.virtual.Page', {
- isVirtualPage: true,
-
- begin: 0,
-
- end: 0,
-
- error: null,
-
- locked: null,
-
- number: 0,
-
- operation: null,
-
- pageMap: null,
-
- records: null,
-
- state: null,
- constructor: function(config) {
- var me = this,
- pageSize;
- Ext.apply(me, config);
- pageSize = me.pageMap.store.getPageSize();
- me.begin = me.number * pageSize;
- me.end = me.begin + pageSize;
- me.locks = {
- active: 0,
- prefetch: 0
- };
- },
- destroy: function() {
- var me = this,
- operation = me.operation;
- me.state = 'destroyed';
- if (operation) {
- operation.abort();
- }
- me.callParent();
- },
-
- adjustLock: function(kind, delta) {
- var me = this,
- locks = me.locks,
- pageMap = me.pageMap,
- locked = null,
- lockedWas = me.locked;
-
- if (!(kind in locks)) {
- Ext.raise('Bad lock type (expected "active" or "prefetch"): "' + kind + '"');
- }
- if (delta !== 1 && delta !== -1) {
- Ext.raise('Invalid lock count delta (should be 1 or -1): ' + delta);
- }
-
- locks[kind] += delta;
- if (locks.active) {
- locked = 'active';
- } else if (locks.prefetch) {
- locked = 'prefetch';
- }
- if (locked !== lockedWas) {
- me.locked = locked;
- if (pageMap) {
- pageMap.onPageLockChange(me, locked, lockedWas);
- }
- }
- },
- clearRecords: function(out, by) {
- var me = this,
- begin = me.begin,
- records = me.records,
- i, n;
-
- if (records) {
- n = records.length;
- if (by) {
- for (i = 0; i < n; ++i) {
- delete out[records[i][by]];
- }
- } else {
- for (i = 0; i < n; ++i) {
- delete out[begin + i];
- }
- }
- }
- },
- fillRecords: function(out, by, withIndex) {
- var me = this,
- records = me.records,
- begin = me.begin,
- i, n, record;
- if (records) {
-
-
- n = records.length;
- if (by) {
- for (i = 0; i < n; ++i) {
- record = records[i];
- out[record[by]] = withIndex ? begin + i : record;
- }
- } else {
- for (i = 0; i < n; ++i) {
- out[begin + i] = records[i];
- }
- }
- }
- },
- isInitial: function() {
- return this.state === null;
- },
- isLoaded: function() {
- return this.state === 'loaded';
- },
- isLoading: function() {
- return this.state === 'loading';
- },
- load: function() {
- var me = this,
- operation;
- me.state = 'loading';
- operation = me.pageMap.store.loadVirtualPage(me, me.onLoad, me);
-
- if (me.state === 'loading') {
- me.operation = operation;
- }
- },
- privates: {
- onLoad: function(operation) {
- var me = this;
- me.operation = null;
- if (!me.destroyed) {
- if (!(me.error = operation.getError())) {
- me.records = operation.getRecords();
- me.state = 'loaded';
- } else {
- me.state = 'error';
- }
-
- me.pageMap.onPageLoad(me);
- }
- }
- }
- });
- Ext.define('Ext.data.virtual.PageMap', {
- isVirtualPageMap: true,
- config: {
-
- cacheSize: 10,
-
- concurrentLoading: 1,
-
- pageCount: null
- },
- generation: 0,
- store: null,
- constructor: function(config) {
- var me = this;
- me.prefetchSortFn = me.prefetchSortFn.bind(me);
- me.initConfig(config);
- me.clear();
- },
- destroy: function() {
- this.clear(true);
- this.callParent();
- },
- canSatisfy: function(range) {
- var end = this.getPageIndex(range.end),
- pageCount = this.getPageCount();
- return pageCount === null || end < pageCount;
- },
- clear: function(destroy) {
- var me = this,
- alive = !destroy || null,
- pages = me.pages,
- pg;
- ++me.generation;
-
- me.byId = alive && {};
-
- me.byInternalId = alive && {};
-
- me.cache = alive && [];
-
- me.indexMap = alive && {};
-
- me.pages = alive && {};
-
- me.loading = alive && [];
-
- me.loadQueues = alive && {
- active: [],
- prefetch: []
- };
- if (pages) {
- for (pg in pages) {
- me.destroyPage(pages[pg]);
- }
- }
- },
- getPage: function(number, autoCreate) {
- var me = this,
- pageCount = me.getPageCount(),
- pages = me.pages,
- page;
- if (pageCount === null || number < pageCount) {
- page = pages[number];
- if (!page && autoCreate !== false) {
- pages[number] = page = new Ext.data.virtual.Page({
- pageMap: me,
- number: number
- });
- }
- } else
- {
- Ext.raise('Invalid page number ' + number + ' when limit is ' + pageCount);
- }
-
- return page || null;
- },
- getPageIndex: function(index) {
- if (index.isEntity) {
- index = this.indexOf(index);
- }
- return Math.floor(index / this.store.getPageSize());
- },
- getPageOf: function(index, autoCreate) {
- var pageSize = this.store.getPageSize(),
- n = Math.floor(index / pageSize);
- return this.getPage(n, autoCreate);
- },
- getPages: function(begin, end) {
- var pageSize = this.store.getPageSize(),
-
- first = Math.floor(begin / pageSize),
- last = Math.ceil(end / pageSize),
- ret = {},
- n;
- for (n = first; n < last; ++n) {
- ret[n] = this.getPage(n);
- }
- return ret;
- },
- flushNextLoad: function() {
- var me = this,
- queueTimer = me.queueTimer;
- if (queueTimer) {
- Ext.unasap(queueTimer);
- }
- me.loadNext();
- },
- indexOf: function(record) {
- var ret = this.indexMap[record.internalId];
- return (ret || ret === 0) ? ret : -1;
- },
- getByInternalId: function(internalId) {
- var index = this.indexMap[internalId],
- page;
- if (index || index === 0) {
- page = this.pages[Math.floor(index / this.store.getPageSize())];
- if (page) {
- return page.records[index - page.begin];
- }
- }
- },
- updatePageCount: function(pageCount, oldPageCount) {
- var pages = this.pages,
- pageNumber, page;
- if (oldPageCount === null || pageCount < oldPageCount) {
-
- for (pageNumber in pages) {
- page = pages[pageNumber];
- if (page.number >= pageCount) {
- this.clearPage(page);
- this.destroyPage(page);
- }
- }
- }
- },
- privates: {
- queueTimer: null,
- clearPage: function(page, fromCache) {
- var me = this,
- A = Ext.Array,
- loadQueues = me.loadQueues;
- delete me.pages[page.number];
- page.clearRecords(me.byId, 'id');
- page.clearRecords(me.byInternalId, 'internalId');
- page.clearRecords(me.indexMap, 'internalId');
- A.remove(loadQueues.active, page);
- A.remove(loadQueues.prefetch, page);
- if (!fromCache) {
- Ext.Array.remove(me.cache, page);
- }
- },
- destroyPage: function(page) {
- this.store.onPageDestroy(page);
- page.destroy();
- },
- loadNext: function() {
- var me = this,
- concurrency = me.getConcurrentLoading(),
- loading = me.loading,
- loadQueues = me.loadQueues,
- page;
- me.queueTimer = null;
-
-
- while (loading.length < concurrency) {
- if (!(page = loadQueues.active.shift() || loadQueues.prefetch.shift())) {
- break;
- }
- loading.push(page);
- page.load();
- }
- },
- onPageLoad: function(page) {
- var me = this,
- store = me.store,
- activeRanges = store.activeRanges,
- n = activeRanges.length,
- i;
- Ext.Array.remove(me.loading, page);
- if (!page.error) {
- page.fillRecords(me.byId, 'id');
- page.fillRecords(me.byInternalId, 'internalId');
- page.fillRecords(me.indexMap, 'internalId', true);
- store.onPageDataAcquired(page);
- for (i = 0; i < n; ++i) {
- activeRanges[i].onPageLoad(page);
- }
- }
- me.flushNextLoad();
- },
- onPageLockChange: function(page, state, oldState) {
- var me = this,
- cache = me.cache,
- loadQueues = me.loadQueues,
- store = me.store,
- cacheSize, concurrency;
-
-
-
-
- if (page.isInitial()) {
- if (oldState) {
- Ext.Array.remove(loadQueues[oldState], page);
- }
- if (state) {
- loadQueues[state].push(page);
- concurrency = me.getConcurrentLoading();
-
-
- if (!me.queueTimer && me.loading.length < concurrency) {
- me.queueTimer = Ext.asap(me.loadNext, me);
- }
- }
- }
- if (state) {
- if (!oldState) {
-
-
-
- Ext.Array.remove(cache, page);
- }
- } else {
- cache.push(page);
-
- for (cacheSize = me.getCacheSize(); cache.length > cacheSize; ) {
- page = cache.shift();
- me.clearPage(page, true);
-
- store.onPageEvicted(page);
- me.destroyPage(page);
- }
- }
- },
- prefetchSortFn: function(a, b) {
- a = a.number;
- b = b.number;
- var M = Math,
- firstPage = this.sortFirstPage,
- lastPage = this.sortLastPage,
- direction = this.sortDirection,
- aDir = a < firstPage,
- bDir = b < firstPage,
- ret;
- a = aDir ? M.abs(firstPage - a) : M.abs(lastPage - a);
- b = bDir ? M.abs(firstPage - b) : M.abs(lastPage - b);
- if (a === b) {
- ret = aDir ? direction : -direction;
- } else {
- ret = a - b;
- }
- return ret;
- },
- prioritizePrefetch: function(direction, firstPage, lastPage) {
- var me = this;
- me.sortDirection = direction;
- me.sortFirstPage = firstPage;
- me.sortLastPage = lastPage;
- me.loadQueues.prefetch.sort(me.prefetchSortFn);
- }
- }
- });
- Ext.define('Ext.data.virtual.Range', {
- extend: Ext.data.Range,
- isVirtualRange: true,
-
- callback: null,
-
-
- prefetch: false,
-
- scope: null,
-
-
- direction: 1,
- constructor: function(config) {
- this.adjustingPages = [];
- this.callParent([
- config
- ]);
- },
- reset: function() {
- var me = this;
- me.records = {};
- me.activePages = me.prefetchPages = null;
- },
- privates: {
- adjustPageLocks: function(kind, adjustment) {
- var me = this,
- pages = me.adjustingPages,
- n = pages.length,
- i;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (n > 1) {
-
-
-
- pages.sort(me.direction < 0 ? me.pageSortBackFn : me.pageSortFwdFn);
- }
- for (i = 0; i < n; ++i) {
- pages[i].adjustLock(kind, adjustment);
- }
- pages.length = 0;
- },
- doGoto: function() {
- var me = this,
- begin = me.begin,
- end = me.end,
- prefetch = me.prefetch,
- records = me.records,
- store = me.store,
- pageMap = store.pageMap,
- limit = store.totalCount,
- beginWas = me.lastBegin,
- endWas = me.lastEnd,
- activePagesWas = me.activePages,
- prefetchPagesWas = me.prefetchPages,
- beginBufferZone = me.trailingBufferZone,
- endBufferZone = me.leadingBufferZone,
- adjustingPages = me.adjustingPages,
- activePages, page, pg, direction, prefetchBegin, prefetchEnd, prefetchPages;
- adjustingPages.length = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if ((begin > beginWas && end < endWas) || (begin < beginWas && end > endWas)) {
- direction = me.direction;
- } else {
- direction = (begin < beginWas) ? -1 : ((begin > beginWas) ? 1 : me.direction);
- }
- if (direction < 0) {
-
- pg = beginBufferZone;
- beginBufferZone = endBufferZone;
- endBufferZone = pg;
- }
- me.direction = direction;
- me.activePages = activePages = pageMap.getPages(begin, end);
- if (prefetch) {
- me.prefetchBegin = prefetchBegin = Math.max(0, begin - beginBufferZone);
-
- if (limit === null) {
- limit = Number.MAX_VALUE;
- }
- me.prefetchEnd = prefetchEnd = Math.min(limit, end + endBufferZone);
- me.prefetchPages = prefetchPages = pageMap.getPages(prefetchBegin, prefetchEnd);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- for (pg in activePages) {
- page = activePages[pg];
-
-
- if (prefetchPages) {
- delete prefetchPages[pg];
- }
- if (activePagesWas && pg in activePagesWas) {
-
-
- delete activePagesWas[pg];
- } else {
-
- page.adjustLock('active', 1);
- page.fillRecords(records);
- }
- }
- if (prefetchPages) {
- for (pg in prefetchPages) {
- if (prefetchPagesWas && pg in prefetchPagesWas) {
-
-
- delete prefetchPagesWas[pg];
- } else {
- prefetchPages[pg].adjustLock('prefetch', 1);
- }
- }
- }
-
-
-
-
-
- if (prefetchPagesWas) {
- for (pg in prefetchPagesWas) {
- adjustingPages.push(prefetchPagesWas[pg]);
- }
- if (adjustingPages.length) {
- me.adjustPageLocks('prefetch', -1);
- }
- }
- if (activePagesWas) {
- for (pg in activePagesWas) {
- adjustingPages.push(page = activePagesWas[pg]);
- page.clearRecords(records);
- }
- if (adjustingPages.length) {
- me.adjustPageLocks('active', -1);
- }
- }
- if (prefetchPages) {
- pageMap.prioritizePrefetch(direction, pageMap.getPageIndex(begin), pageMap.getPageIndex(end - 1));
- }
- me.lastBegin = begin;
- me.lastEnd = end;
- },
- onPageDestroy: function(page) {
- var n = page.number,
- activePages = this.activePages,
- prefetchPages = this.prefetchPages;
- if (activePages) {
- delete activePages[n];
- }
- if (prefetchPages) {
- delete prefetchPages[n];
- }
- },
- onPageLoad: function(page) {
- var me = this,
- callback = me.callback,
- first, last;
- if (me.activePages[page.number]) {
- page.fillRecords(me.records);
- if (callback) {
-
-
- first = Math.max(me.begin, page.begin);
- last = Math.min(me.end, page.end);
- Ext.callback(callback, me.scope, [
- me,
- first,
- last
- ]);
- }
- }
- },
- pageSortBackFn: function(page1, page2) {
- return page2.number - page1.number;
- },
- pageSortFwdFn: function(page1, page2) {
- return page1.number - page2.number;
- },
- refresh: function() {
-
- this.records = this.records || {};
- },
- reload: function() {
- var me = this,
- begin = me.begin,
- end = me.end;
- me.begin = me.end = 0;
- me.direction = 1;
- me.prefetchPages = me.activePages = null;
- me.goto(begin, end);
- }
- }
- });
- Ext.define('Ext.data.virtual.Store', {
- extend: Ext.data.ProxyStore,
- alias: 'store.virtual',
- isVirtualStore: true,
- config: {
- data: null,
- totalCount: null,
-
- leadingBufferZone: 200,
-
- trailingBufferZone: 50
- },
-
- remoteSort: true,
-
- remoteFilter: true,
-
- sortOnLoad: false,
-
- trackRemoved: false,
- constructor: function(config) {
- var me = this;
- me.sortByPage = me.sortByPage.bind(me);
- me.activeRanges = [];
- me.pageMap = new Ext.data.virtual.PageMap({
- store: me
- });
- me.callParent([
- config
- ]);
- },
- doDestroy: function() {
- this.pageMap.destroy();
- this.callParent();
- },
- applyGrouper: function(grouper) {
- this.group(grouper);
- return this.grouper;
- },
-
-
- contains: function(record) {
- return this.indexOf(record) > -1;
- },
-
- createActiveRange: function(config) {
- var range = Ext.apply({
- leadingBufferZone: this.getLeadingBufferZone(),
- trailingBufferZone: this.getTrailingBufferZone(),
- store: this
- }, config);
- return new Ext.data.virtual.Range(range);
- },
-
- getAt: function(index) {
- var page = this.pageMap.getPageOf(index,
- false),
- ret;
- if (page && page.records) {
-
- ret = page.records[index - page.begin];
- }
- return ret || null;
- },
-
- getById: function(id) {
- return this.pageMap.byId[id] || null;
- },
- getCount: function() {
- return this.totalCount || 0;
- },
- getGrouper: function() {
- return this.grouper;
- },
- getGroups: function() {
- var me = this,
- groups = me.groupCollection;
- if (!groups) {
- me.groupCollection = groups = new Ext.util.Collection();
- }
- return groups;
- },
- getSummaryRecord: function() {
- return this.summaryRecord || null;
- },
- isGrouped: function() {
- return !!this.grouper;
- },
- group: function(grouper, direction) {
- var me = this;
- grouper = grouper || null;
- if (grouper) {
- if (typeof grouper === 'string') {
- grouper = {
- property: grouper,
- direction: direction || 'ASC'
- };
- }
- if (!grouper.isGrouper) {
- grouper = new Ext.util.Grouper(grouper);
- }
- grouper.setRoot('data');
- me.getGroups().getSorters().splice(0, 1, {
- property: 'id',
- direction: grouper.getDirection()
- });
- }
- me.grouper = grouper;
- if (!me.isConfiguring) {
- me.reload();
- me.fireEvent('groupchange', me, grouper);
- }
- },
- getByInternalId: function(internalId) {
- return this.pageMap.getByInternalId(internalId);
- },
-
- indexOf: function(record) {
- return this.pageMap.indexOf(record);
- },
-
- indexOfId: function(id) {
- var rec = this.getById(id);
- return rec ? this.indexOf(rec) : -1;
- },
- load: function(options) {
- if (typeof options === 'function') {
- options = {
- callback: options
- };
- }
- var me = this,
- page = (options && options.page) || 1,
- pageSize = me.getPageSize(),
- operation = me.createOperation('read', Ext.apply({
- start: (page - 1) * pageSize,
- limit: pageSize,
- page: page,
- filters: me.getFilters().items,
- sorters: me.getSorters().items,
- grouper: me.getGrouper()
- }, options));
- operation.execute();
- return operation;
- },
- reload: function(options) {
- if (typeof options === 'function') {
- options = {
- callback: options
- };
- }
- var me = this;
- if (me.fireEvent('beforereload') === false) {
- return null;
- }
- options = Ext.apply({
- internalScope: me,
- internalCallback: me.handleReload,
- page: 1
- }, options);
- me.pageMap.clear();
- me.getGroups().clear();
- return me.load(options);
- },
-
-
- removeAll: function() {
- var activeRanges = this.activeRanges,
- i;
- this.pageMap.clear();
- for (i = activeRanges.length; i-- > 0; ) {
- activeRanges[i].reset();
- }
- },
-
- applyProxy: function(proxy) {
- proxy = this.callParent([
- proxy
- ]);
-
-
- if (proxy && proxy.setEnablePaging) {
- proxy.setEnablePaging(true);
- }
- return proxy;
- },
-
-
-
-
-
-
-
- createFiltersCollection: function() {
- return new Ext.util.FilterCollection();
- },
- createSortersCollection: function() {
- return new Ext.util.SorterCollection();
- },
- onFilterEndUpdate: function() {
- var me = this,
- filters = me.getFilters(false);
-
- if (!me.isConfiguring) {
- me.reload();
- me.fireEvent('filterchange', me, filters.getRange());
- }
- },
- onSorterEndUpdate: function() {
- var me = this,
- sorters = me.getSorters().getRange(),
- fire = !me.isConfiguring;
- if (fire) {
- me.fireEvent('beforesort', me, sorters);
- }
- if (fire) {
- me.reload();
- me.fireEvent('sort', me, sorters);
- }
- },
- updatePageSize: function(pageSize) {
- var totalCount = this.totalCount;
- if (totalCount !== null) {
- this.pageMap.setPageCount(Math.ceil(totalCount / pageSize));
- }
- },
- updateTotalCount: function(totalCount, oldTotalCount) {
- var me = this,
- pageMap = me.pageMap;
- me.totalCount = totalCount;
- pageMap.setPageCount(Math.ceil(totalCount / me.getPageSize()));
- me.fireEvent('totalcountchange', me, totalCount, oldTotalCount);
- },
-
-
-
- add: function() {
- Ext.raise('Virtual stores do not support the add() method');
- },
- insert: function() {
- Ext.raise('Virtual stores do not support the insert() method');
- },
- filter: function() {
- if (!this.getRemoteFilter()) {
- Ext.raise('Virtual stores do not support local filtering');
- }
-
- this.callParent(arguments);
- },
- filterBy: function() {
- Ext.raise('Virtual stores do not support local filtering');
- },
- loadData: function() {
- Ext.raise('Virtual stores do not support the loadData() method');
- },
- applyData: function() {
- Ext.raise('Virtual stores do not support direct data loading');
- },
- updateRemoteFilter: function(remoteFilter, oldRemoteFilter) {
- if (remoteFilter === false) {
- Ext.raise('Virtual stores are always remotely filtered.');
- }
- this.callParent([
- remoteFilter,
- oldRemoteFilter
- ]);
- },
- updateRemoteSort: function(remoteSort, oldRemoteSort) {
- if (remoteSort === false) {
- Ext.raise('Virtual stores are always remotely sorted.');
- }
- this.callParent([
- remoteSort,
- oldRemoteSort
- ]);
- },
- updateTrackRemoved: function(value) {
- if (value !== false) {
- Ext.raise('Virtual stores do not support trackRemoved.');
- }
- this.callParent(arguments);
- },
-
- privates: {
- attachSummaryData: function(resultSet) {
- var me = this,
- summary = resultSet.getSummaryData(),
- grouper, len, i, data, rec;
- if (summary) {
- me.summaryRecord = summary;
- }
- summary = resultSet.getGroupData();
- if (summary) {
- grouper = me.getGrouper();
- if (grouper) {
- me.groupSummaryData = data = {};
- for (i = 0 , len = summary.length; i < len; ++i) {
- rec = summary[i];
- data[grouper.getGroupString(rec)] = rec;
- }
- }
- }
- },
- handleReload: function(op) {
- var me = this,
- activeRanges = me.activeRanges,
- len = activeRanges.length,
- pageMap = me.pageMap,
- i, range;
- if (op.wasSuccessful()) {
- me.readTotalCount(op.getResultSet());
- me.fireEvent('reload', me, op);
- for (i = 0; i < len; ++i) {
- range = activeRanges[i];
- if (pageMap.canSatisfy(range)) {
- range.reload();
- }
- }
- }
- },
- loadVirtualPage: function(page, callback, scope) {
- var me = this,
- pageMapGeneration = me.pageMap.generation;
- return me.load({
- page: page.number + 1,
-
- internalCallback: function(op) {
- var resultSet = op.getResultSet();
- if (pageMapGeneration === me.pageMap.generation) {
- if (op.wasSuccessful()) {
- me.readTotalCount(resultSet);
- me.attachSummaryData(resultSet);
- }
- callback.call(scope || page, op);
- me.groupSummaryData = null;
- }
- }
- });
- },
- lockGroups: function(grouper, page) {
- var groups = this.getGroups(),
- groupInfo = page.groupInfo = {},
- records = page.records,
- len = records.length,
- groupSummaryData = this.groupSummaryData,
- pageMap = this.pageMap,
- n = page.number,
- group, i, groupKey, summaryRec, rec, firstRecords, first;
- for (i = 0; i < len; ++i) {
- rec = records[i];
- groupKey = grouper.getGroupString(rec);
- if (!groupInfo[groupKey]) {
- groupInfo[groupKey] = rec;
- group = groups.get(groupKey);
- if (!group) {
- group = new Ext.data.virtual.Group(groupKey);
- groups.add(group);
- }
-
-
-
-
- firstRecords = group.firstRecords;
- first = firstRecords[0];
- if (first && n < pageMap.getPageIndex(first)) {
- firstRecords.unshift(rec);
- } else {
- firstRecords.push(rec);
- }
- summaryRec = groupSummaryData && groupSummaryData[groupKey];
- if (summaryRec) {
- group.summaryRecord = summaryRec;
- }
- }
- }
- },
- onPageDataAcquired: function(page) {
- var grouper = this.getGrouper();
- if (grouper) {
- this.lockGroups(grouper, page);
- }
- },
- onPageDestroy: function(page) {
- var ranges = this.activeRanges,
- len = ranges.length,
- i;
- for (i = 0; i < len; ++i) {
- ranges[i].onPageDestroy(page);
- }
- },
- onPageEvicted: function(page) {
- var grouper = this.getGrouper();
- if (grouper) {
- this.releaseGroups(grouper, page);
- }
- },
- readTotalCount: function(resultSet) {
- var total = resultSet.getRemoteTotal();
- if (!isNaN(total)) {
- this.setTotalCount(total);
- }
- },
- releaseGroups: function(grouper, page) {
- var groups = this.getGroups(),
- groupInfo = page.groupInfo,
- first, firstRecords, key, group;
- for (key in groupInfo) {
- first = groupInfo[key];
- group = groups.get(key);
- firstRecords = group.firstRecords;
-
-
- if (firstRecords.length === 1) {
- groups.remove(group);
- } else if (firstRecords[0] === first) {
- firstRecords.shift();
- firstRecords.sort(this.sortByPage);
- } else {
- Ext.Array.remove(firstRecords, first);
- }
- }
- },
- sortByPage: function(rec1, rec2) {
-
- var map = this.pageMap;
- return map.getPageIndex(rec1) - map.getPageIndex(rec2);
- }
- }
- });
- Ext.define('Ext.direct.Event', {
- alias: 'direct.event',
- status: true,
-
- constructor: function(config) {
- Ext.apply(this, config);
- },
-
- getName: function() {
- return this.name;
- },
-
- getData: function() {
- return this.data;
- }
- });
- Ext.define('Ext.direct.RemotingEvent', {
- extend: Ext.direct.Event,
- alias: 'direct.rpc',
-
- getTransaction: function() {
- var me = this;
- return me.transaction || Ext.direct.Manager.getTransaction(me.tid);
- }
- });
- Ext.define('Ext.direct.ExceptionEvent', {
- extend: Ext.direct.RemotingEvent,
- alias: 'direct.exception',
- status: false
- });
- Ext.define('Ext.direct.JsonProvider', {
- extend: Ext.direct.Provider,
- alias: 'direct.jsonprovider',
-
- parseResponse: function(response) {
- var text = response && response.responseText;
-
- if (text != null) {
- if (Ext.isObject(text) || Ext.isArray(text)) {
- return text;
- }
- return Ext.decode(text);
- }
- return null;
- },
-
- createEvents: function(response) {
- var me = this,
- data = null,
- events = [],
- event, i, len;
- try {
- data = me.parseResponse(response);
- } catch (e) {
- event = new Ext.direct.ExceptionEvent({
- parsingError: true,
- data: e,
- xhr: response,
- code: Ext.direct.Manager.exceptions.PARSE,
- message: 'Error parsing json response: \n\n ' + e
- });
- return [
- event
- ];
- }
- if (Ext.isArray(data)) {
- for (i = 0 , len = data.length; i < len; ++i) {
- events.push(me.createEvent(data[i]));
- }
- } else if (Ext.isObject(data)) {
- events.push(me.createEvent(data));
- }
- return events;
- },
-
- createEvent: function(response) {
- if (typeof response !== 'object' || !('type' in response)) {
- return new Ext.direct.ExceptionEvent({
- data: response,
- code: Ext.direct.Manager.exceptions.DATA,
- message: 'Invalid data: event type is not specified'
- });
- }
- return Ext.create('direct.' + response.type, response);
- }
- });
- Ext.define('Ext.util.TaskRunner', {
-
-
- fireIdleEvent: null,
-
- interval: 10,
-
- timerId: null,
- constructor: function(interval) {
- var me = this;
- if (typeof interval === 'number') {
- me.interval = interval;
- } else if (interval) {
- Ext.apply(me, interval);
- }
- me.tasks = [];
- me.timerFn = me.onTick.bind(me);
- },
-
- newTask: function(config) {
- var task = new Ext.util.TaskRunner.Task(config);
- task.manager = this;
-
- if (Ext.Timer.track) {
- task.creator = new Error().stack;
- }
-
- return task;
- },
-
- start: function(task) {
- var me = this,
- now = Ext.Date.now();
- if (!task.pending) {
- me.tasks.push(task);
- task.pending = true;
- }
-
- task.stopped = false;
-
- task.taskStartTime = now;
- task.taskRunTime = task.fireOnStart !== false ? 0 : task.taskStartTime;
- task.taskRunCount = 0;
- if (!me.firing) {
- if (task.fireOnStart !== false) {
- me.startTimer(0, now);
- } else {
- me.startTimer(task.interval, now);
- }
- }
- return task;
- },
-
- stop: function(task, andRemove) {
- var me = this,
- tasks = me.tasks,
- pendingCount = 0,
- i;
-
-
-
- if (!task.stopped) {
- task.stopped = true;
- task.pending = false;
- if (task.onStop) {
- task.onStop.call(task.scope || task, task);
- }
- }
- if (andRemove) {
- Ext.Array.remove(tasks, task);
- }
-
-
- for (i = 0; !pendingCount && i < tasks.length; i++) {
- if (!tasks[i].stopped) {
- pendingCount++;
- }
- }
- if (!pendingCount) {
- Ext.undefer(me.timerId);
- me.timerId = null;
- }
- return task;
- },
-
- stopAll: function(andRemove) {
- var me = this;
-
-
- Ext.each(this.tasks, function(task) {
- me.stop(task, andRemove);
- }, null, true);
- },
-
- firing: false,
- nextExpires: 1.0E99,
-
- onTick: function() {
- var me = this,
- tasks = me.tasks,
- fireIdleEvent = me.fireIdleEvent,
-
- now = Ext.Date.now(),
- nextExpires = 1.0E99,
- len = tasks.length,
- expires, newTasks, i, task, rt, remove, args;
-
- var timer = Ext.Timer.get(me.timerId);
- if (timer) {
- timer.tasks = [];
- }
-
- me.timerId = null;
- me.firing = true;
-
-
-
-
-
- for (i = 0; i < len || i < (len = tasks.length); ++i) {
- task = tasks[i];
- if (!(remove = task.stopped)) {
- expires = task.taskRunTime + task.interval;
- if (expires <= now) {
- rt = 1;
-
-
- if (fireIdleEvent === null && task.fireIdleEvent !== false) {
- fireIdleEvent = true;
- }
- task.taskRunCount++;
- if (task.args) {
- args = task.addCountToArgs ? task.args.concat([
- task.taskRunCount
- ]) : task.args;
- } else {
- args = [
- task.taskRunCount
- ];
- }
-
-
- if (timer) {
- timer.tasks.push(task);
- }
- if (me.disableTryCatch) {
- rt = task.run.apply(task.scope || task, args);
- } else {
-
- try {
- rt = task.run.apply(task.scope || task, args);
- } catch (taskError) {
- try {
-
- Ext.log({
- fn: task.run,
- prefix: 'Error while running task',
- stack: taskError.stack,
- msg: taskError,
- level: 'error'
- });
-
- if (task.onError) {
- rt = task.onError.call(task.scope || task, task, taskError);
- }
- } catch (ignore) {}
- }
- }
-
-
- task.taskRunTime = now;
- if (rt === false || task.taskRunCount === task.repeat) {
- me.stop(task);
- remove = true;
- } else {
- remove = task.stopped;
-
- expires = now + task.interval;
- }
- }
- if (!remove && task.duration && task.duration <= (now - task.taskStartTime)) {
- me.stop(task);
- remove = true;
- }
- }
- if (remove) {
- task.pending = false;
-
-
-
-
-
-
- if (!newTasks) {
- newTasks = tasks.slice(0, i);
- }
- } else
-
-
- {
- if (newTasks) {
- newTasks.push(task);
- }
-
- if (nextExpires > expires) {
- nextExpires = expires;
- }
- }
- }
-
- if (newTasks) {
-
-
- me.tasks = newTasks;
- }
- me.firing = false;
-
- if (me.tasks.length) {
-
-
-
- me.startTimer(nextExpires - now, Ext.Date.now());
- }
-
-
-
-
- if (fireIdleEvent === null) {
- fireIdleEvent = false;
- }
- Ext._suppressIdle = !fireIdleEvent;
- },
-
- startTimer: function(timeout, now) {
- var me = this,
- expires = now + timeout,
- timerId = me.timerId;
-
-
- if (timerId && me.nextExpires - expires > me.interval) {
- timerId = Ext.undefer(timerId);
- }
- if (!timerId) {
- if (timeout < me.interval) {
- timeout = me.interval;
- }
- me.timerId = Ext.defer(me.timerFn, timeout);
- me.nextExpires = expires;
-
- var timer = Ext.Timer.get(me.timerId);
- if (timer) {
- timer.runner = me;
- }
- }
- }
- },
- function() {
- var me = this,
- proto = me.prototype;
-
- proto.destroy = proto.stopAll;
-
- me.Task = new Ext.Class({
- isTask: true,
-
- stopped: true,
-
- fireOnStart: false,
- constructor: function(config) {
- Ext.apply(this, config);
- },
-
- restart: function(interval) {
- if (interval !== undefined) {
- this.interval = interval;
- }
- this.manager.start(this);
- },
-
- start: function(interval) {
- if (this.stopped) {
- this.restart(interval);
- }
- },
-
- stop: function(andRemove) {
- this.manager.stop(this, andRemove);
- },
- destroy: function() {
- this.stop(true);
- }
- });
- proto = me.Task.prototype;
-
- proto.destroy = proto.stop;
- });
- Ext.define('Ext.direct.PollingProvider', {
- extend: Ext.direct.JsonProvider,
- alias: 'direct.pollingprovider',
- type: 'polling',
-
- interval: 3000,
-
-
-
-
-
-
- constructor: function(config) {
- var me = this;
- me.callParent([
- config
- ]);
- me.pollTask = Ext.TaskManager.newTask({
- run: me.runPoll,
- interval: me.interval,
- scope: me
- });
- },
- destroy: function() {
- this.pollTask.stop(true);
- this.callParent();
- },
- doConnect: function() {
- var me = this,
- url = me.url,
- pollFn = me.pollFn;
-
-
-
-
- if (pollFn && Ext.isString(pollFn)) {
-
- var fnName = pollFn;
-
- me.pollFn = pollFn = Ext.direct.Manager.parseMethod(pollFn);
-
- if (!Ext.isFunction(pollFn)) {
- Ext.raise("Cannot resolve Ext Direct API method " + fnName + " for PollingProvider");
- }
- }
-
- else if (Ext.isFunction(url)) {
-
- Ext.log.warn('Using a function for url is deprecated, use pollFn instead.');
-
- me.pollFn = pollFn = url;
- me.url = url = null;
- }
- if (url || pollFn) {
- me.setInterval(me.interval);
- me.pollTask.start();
- }
- },
- doDisconnect: function() {
- if (this.pollTask) {
- this.pollTask.stop();
- }
- },
- getInterval: function() {
- return this.pollTask && this.pollTask.interval;
- },
- setInterval: function(interval) {
- var me = this,
- pollTask = me.pollTask;
-
- if (interval < 100) {
- Ext.raise("Attempting to configure PollProvider " + me.id + " with interval that is less than 100ms.");
- }
-
- me.interval = pollTask.interval = interval;
- if (me.isConnected()) {
- pollTask.restart(interval);
- }
- },
-
- runPoll: function() {
- var me = this,
- url = me.url,
- pollFn = me.pollFn,
- baseParams = me.baseParams,
- args, request;
- if (me.fireEvent('beforepoll', me) !== false) {
- if (pollFn) {
- args = pollFn.directCfg.method.getArgs({
- params: baseParams !== undefined ? baseParams : {},
- callback: me.onPollFn,
- scope: me
- });
- pollFn.apply(window, args);
- } else {
- request = {
- url: url,
- callback: me.onData,
- scope: me,
- params: baseParams,
- headers: me.getHeaders()
- };
- if (me.timeout != null) {
- request.timeout = me.timeout;
- }
- me.sendAjaxRequest(request);
- }
- me.fireEvent('poll', me);
- }
- },
-
- onData: function(opt, success, response) {
- var me = this,
- i, len, events, event;
- if (success) {
- events = me.createEvents(response);
- for (i = 0 , len = events.length; i < len; ++i) {
- event = events[i];
- me.fireEvent('data', me, event);
- if (!event.status) {
- me.fireEvent('exception', me, event);
- }
- }
- } else {
- event = new Ext.direct.ExceptionEvent({
- data: null,
- code: Ext.direct.Manager.exceptions.TRANSPORT,
- message: 'Unable to connect to the server.',
- xhr: response
- });
- me.fireEvent('data', me, event);
- me.fireEvent('exception', me, event);
- }
- me.callParent([
- opt,
- success,
- response
- ]);
- },
-
- onPollFn: function(result, event, success, options) {
- this.onData(null, success, {
- responseText: result
- });
- },
- inheritableStatics: {
-
- checkConfig: function(config) {
-
- return config && config.type === 'polling' && (config.url || config.pollFn);
- }
- }
- });
- Ext.define('Ext.direct.RemotingMethod', {
- constructor: function(config) {
- var me = this,
- params = config.params,
- len = config.len,
- metadataCfg = config.metadata,
- metadata = {},
- name, pLen, p, param;
- me.name = config.name;
- me.disableBatching = config.batched != null ? !config.batched : false;
- if (config.formHandler) {
- me.formHandler = config.formHandler;
- } else if (Ext.isNumeric(len)) {
-
- me.len = len;
- me.ordered = true;
- } else {
-
- me.named = true;
- me.strict = config.strict !== undefined ? config.strict : true;
- me.params = {};
-
-
- pLen = params && params.length;
- for (p = 0; p < pLen; p++) {
- param = params[p];
- name = Ext.isObject(param) ? param.name : param;
- me.params[name] = true;
- }
- }
- if (metadataCfg) {
- params = metadataCfg.params;
- len = metadataCfg.len;
- if (Ext.isNumeric(len)) {
-
- if (len === 0) {
- Ext.raise('metadata.len cannot be 0 ' + 'for Ext Direct method ' + me.name);
- }
-
- metadata.ordered = true;
- metadata.len = len;
- } else if (Ext.isArray(params)) {
- metadata.named = true;
- metadata.params = {};
- for (p = 0 , pLen = params.length; p < pLen; p++) {
- param = params[p];
- metadata.params[param] = true;
- }
- metadata.strict = metadataCfg.strict !== undefined ? metadataCfg.strict : true;
- } else
- {
- Ext.raise('metadata is neither named nor ordered ' + 'for Ext Direct method ' + me.name);
- }
-
- me.metadata = metadata;
- }
- },
-
- getArgs: function(config) {
- var me = this,
- params = config.params,
- paramOrder = config.paramOrder,
- paramsAsArray = config.paramsAsArray,
- metadata = config.metadata,
- options = config.options,
- args = [],
- flatten, i, len;
- if (me.ordered) {
- if (me.len > 0) {
-
- if (paramOrder) {
-
-
-
- flatten = config.paramsAsArray && me.len === 1 && (paramOrder.length > 1 || Ext.isArray(params));
- if (flatten) {
- if (Ext.isArray(params)) {
- for (i = 0 , len = params.length; i < len; i++) {
- args.push(me.convertParams(params[i], paramOrder, paramOrder.length, true));
- }
- } else {
- args = me.convertParams(params, paramOrder, paramOrder.length, true);
- }
- if (!params.allowSingle || args.length > 1) {
- args = [
- args
- ];
- }
- } else {
-
-
- args = me.convertParams(params, paramOrder, me.len, false);
- }
- } else {
- args.push(params);
- }
- }
- } else {
- args.push(params);
- }
- args.push(config.callback, config.scope || window);
- if (options || metadata) {
- options = Ext.apply({}, options);
- if (metadata) {
-
-
- options.metadata = metadata;
- }
- args.push(options);
- }
- return args;
- },
- convertParams: function(params, paramOrder, count, flatten) {
- var ret = [],
- paramName, i, len;
- for (i = 0 , len = count; i < len; i++) {
- paramName = paramOrder[i];
- ret.push(params[paramName]);
- }
- if (flatten) {
- return ret.length === 0 ? undefined : ret.length === 1 ? ret[0] : ret;
- } else {
- return ret;
- }
- },
-
- getCallData: function(args) {
- var me = this,
- data = null,
- len = me.len,
- params = me.params,
- strict = me.strict,
- form, callback, scope, name, options, metadata;
-
-
-
- if (me.ordered) {
- callback = args[len];
- scope = args[len + 1];
- options = args[len + 2];
- if (len !== 0) {
- data = args.slice(0, len);
- }
- } else if (me.formHandler) {
- form = args[0];
- callback = args[1];
- scope = args[2];
- options = args[3];
- } else {
- data = Ext.apply({}, args[0]);
- callback = args[1];
- scope = args[2];
- options = args[3];
-
- if (strict) {
- for (name in data) {
- if (data.hasOwnProperty(name) && !params[name]) {
- delete data[name];
- }
- }
- }
- }
- if (me.metadata && options && options.metadata) {
- if (me.metadata.ordered) {
-
- if (!Ext.isArray(options.metadata)) {
- Ext.raise('options.metadata is not an Array ' + 'for Ext Direct method ' + me.name);
- } else if (options.metadata.length < me.metadata.len) {
- Ext.raise('Not enough parameters in options.metadata ' + 'for Ext Direct method ' + me.name);
- }
-
- metadata = options.metadata.slice(0, me.metadata.len);
- } else {
-
- if (!Ext.isObject(options.metadata)) {
- Ext.raise('options.metadata is not an Object ' + 'for Ext Direct method ' + me.name);
- }
-
- metadata = Ext.apply({}, options.metadata);
- if (me.metadata.strict) {
- for (name in metadata) {
- if (metadata.hasOwnProperty(name) && !me.metadata.params[name]) {
- delete metadata[name];
- }
- }
- }
-
- for (name in me.metadata.params) {
- if (!metadata.hasOwnProperty(name)) {
- Ext.raise('Named parameter ' + name + ' is missing ' + 'in options.metadata for Ext Direct method ' + me.name);
- }
- }
- }
-
- delete options.metadata;
- }
- return {
- form: form,
- data: data,
- metadata: metadata,
- callback: callback,
- scope: scope,
- options: options
- };
- }
- });
- Ext.define('Ext.direct.Transaction', {
- alias: 'direct.transaction',
- statics: {
- TRANSACTION_ID: 0
- },
-
-
- constructor: function(config) {
- var me = this;
- Ext.apply(me, config);
- me.id = me.tid = ++me.self.TRANSACTION_ID;
- me.retryCount = 0;
- },
- send: function() {
- var me = this;
- me.provider.queueTransaction(me);
- },
- retry: function() {
- var me = this;
- me.retryCount++;
- me.send();
- },
- getProvider: function() {
- return this.provider;
- }
- });
- Ext.define('Ext.direct.RemotingProvider', {
- extend: Ext.direct.JsonProvider,
- alias: 'direct.remotingprovider',
- type: 'remoting',
-
-
-
-
-
-
- enableBuffer: 10,
-
- bufferLimit: Number.MAX_VALUE,
-
- maxRetries: 1,
-
-
-
-
- constructor: function(config) {
- var me = this;
- me.callParent([
- config
- ]);
- me.namespace = (Ext.isString(me.namespace)) ? Ext.ns(me.namespace) : me.namespace || Ext.global;
- me.callBuffer = [];
- },
- destroy: function() {
- if (this.callTask) {
- this.callTask.cancel();
- }
- this.callParent();
- },
-
- connect: function() {
- var me = this;
-
- if (!me.url) {
- Ext.raise('Error initializing RemotingProvider "' + me.id + '", no url configured.');
- }
-
- me.callParent();
- },
- doConnect: function() {
- if (!this.apiCreated) {
- this.initAPI();
- this.apiCreated = true;
- }
- },
-
- getNamespace: function(root, action) {
- var parts, ns, i, len;
- root = root || Ext.global;
- parts = action.toString().split('.');
- for (i = 0 , len = parts.length; i < len; i++) {
- ns = parts[i];
- root = root[ns];
- if (typeof root === 'undefined') {
- return root;
- }
- }
- return root;
- },
-
- createNamespaces: function(root, action) {
- var parts, ns, i, len;
- root = root || Ext.global;
- parts = action.toString().split('.');
- for (i = 0 , len = parts.length; i < len; i++) {
- ns = parts[i];
- root[ns] = root[ns] || {};
- root = root[ns];
- }
- return root;
- },
-
- initAPI: function() {
- var me = this,
- actions = me.actions,
- namespace = me.namespace,
- Manager = Ext.direct.Manager,
- action, cls, methods, i, len, method, handler;
- for (action in actions) {
- if (actions.hasOwnProperty(action)) {
- if (me.disableNestedActions) {
- cls = namespace[action];
- if (!cls) {
- cls = namespace[action] = {};
- }
- } else {
- cls = me.getNamespace(namespace, action);
- if (!cls) {
- cls = me.createNamespaces(namespace, action);
- }
- }
- methods = actions[action];
- for (i = 0 , len = methods.length; i < len; ++i) {
- method = new Ext.direct.RemotingMethod(methods[i]);
- cls[method.name] = handler = me.createHandler(action, method);
- Manager.registerMethod(handler.$name, handler);
- }
- }
- }
- },
-
- createHandler: function(action, method) {
- var me = this,
- handler;
- handler = function() {
- me.invokeFunction(action, method, Array.prototype.slice.call(arguments, 0));
- };
- handler.name = handler.$name = action + '.' + method.name;
- handler.$directFn = true;
- handler.directCfg = handler.$directCfg = {
- action: action,
- method: method
- };
- return handler;
- },
-
- invokeFunction: function(action, method, args) {
- var me = this,
- transaction, form, isUpload, postParams;
- transaction = me.configureTransaction(action, method, args);
- if (me.fireEvent('beforecall', me, transaction, method) !== false) {
- Ext.direct.Manager.addTransaction(transaction);
- if (transaction.isForm) {
- form = transaction.form;
- isUpload = String(form.getAttribute("enctype")).toLowerCase() === 'multipart/form-data';
- postParams = {
- extTID: transaction.id,
- extAction: action,
- extMethod: method.name,
- extType: 'rpc',
- extUpload: String(isUpload)
- };
- if (transaction.metadata) {
- postParams.extMetadata = Ext.JSON.encode(transaction.metadata);
- }
- Ext.apply(transaction, {
- form: form,
- isUpload: isUpload,
- params: postParams
- });
- }
- me.queueTransaction(transaction);
- me.fireEvent('call', me, transaction, method);
- }
- },
-
- configureTransaction: function(action, method, args, isForm) {
- var data, cb, scope, options, params;
- data = method.getCallData(args);
- cb = data.callback;
- scope = data.scope;
- options = data.options;
-
- if (cb && !Ext.isFunction(cb)) {
- Ext.raise("Callback argument is not a function " + "for Ext Direct method " + action + "." + method.name);
- }
-
-
-
- cb = cb && scope ? cb.bind(scope) : cb;
- params = Ext.apply({}, {
- provider: this,
- args: args,
- action: action,
- method: method.name,
- form: data.form,
- data: data.data,
- metadata: data.metadata,
- callbackOptions: options,
- callback: cb,
- isForm: !!method.formHandler,
- disableBatching: method.disableBatching
- });
- if (options && options.timeout != null) {
- params.timeout = options.timeout;
- }
- return new Ext.direct.Transaction(params);
- },
-
- queueTransaction: function(transaction) {
- var me = this,
- callBuffer = me.callBuffer,
- enableBuffer = me.enableBuffer;
- if (transaction.isForm || enableBuffer === false || transaction.disableBatching || transaction.timeout != null) {
- me.sendTransaction(transaction);
- return;
- }
- callBuffer.push(transaction);
- if (enableBuffer && callBuffer.length < me.bufferLimit) {
- if (!me.callTask) {
- me.callTask = new Ext.util.DelayedTask(me.combineAndSend, me);
- }
- me.callTask.delay(Ext.isNumber(enableBuffer) ? enableBuffer : 10);
- } else {
- me.combineAndSend();
- }
- },
-
- combineAndSend: function() {
- var me = this,
- buffer = me.callBuffer,
- len = buffer.length;
- if (len > 0) {
- me.sendTransaction(len === 1 ? buffer[0] : buffer);
- me.callBuffer = [];
- }
- },
-
- sendTransaction: function(transaction) {
- var me = this,
- request, callData, params,
- enableUrlEncode = me.enableUrlEncode,
- payload, i, len;
- request = {
- url: me.url,
- callback: me.onData,
- scope: me,
- transaction: transaction,
- headers: me.getHeaders()
- };
-
- if (transaction.timeout != null) {
- request.timeout = transaction.timeout;
- } else if (me.timeout != null) {
- request.timeout = me.timeout;
- }
- if (transaction.isForm) {
- Ext.apply(request, {
- params: transaction.params,
- form: transaction.form,
- isUpload: transaction.isUpload
- });
- } else {
- if (Ext.isArray(transaction)) {
- callData = [];
- for (i = 0 , len = transaction.length; i < len; ++i) {
- payload = me.getPayload(transaction[i]);
- callData.push(payload);
- }
- } else {
- callData = me.getPayload(transaction);
- }
- if (enableUrlEncode) {
- params = {};
- params[Ext.isString(enableUrlEncode) ? enableUrlEncode : 'data'] = Ext.encode(callData);
- request.params = params;
- } else {
- request.jsonData = callData;
- }
- }
- return me.sendAjaxRequest(request);
- },
-
- getPayload: function(transaction) {
- var result = {
- action: transaction.action,
- method: transaction.method,
- data: transaction.data,
- type: 'rpc',
- tid: transaction.id
- };
- if (transaction.metadata) {
- result.metadata = transaction.metadata;
- }
- return result;
- },
-
- onData: function(options, success, response) {
- var me = this,
- i, len, events, event, transaction, transactions;
- if (me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
-
- events = success && me.createEvents(response);
-
-
- success = events && events.length && !events[0].parsingError;
- if (success) {
- for (i = 0 , len = events.length; i < len; ++i) {
- event = events[i];
- me.fireEvent('data', me, event);
- transaction = me.getTransaction(event);
- if (transaction) {
- if (me.fireEvent('beforecallback', me, event, transaction) !== false) {
- me.runCallback(transaction, event, true);
- }
- Ext.direct.Manager.removeTransaction(transaction);
- }
- }
- } else {
- transactions = [].concat(options.transaction);
- event = events[0] || new Ext.direct.ExceptionEvent({
- data: null,
- transaction: transaction,
- code: Ext.direct.Manager.exceptions.TRANSPORT,
- message: 'Unable to connect to the server.',
- xhr: response
- });
- for (i = 0 , len = transactions.length; i < len; ++i) {
- transaction = me.getTransaction(transactions[i]);
- if (transaction && transaction.retryCount < me.maxRetries) {
- transaction.retry();
- } else {
- me.fireEvent('data', me, event);
- me.fireEvent('exception', me, event);
- if (transaction && me.fireEvent('beforecallback', me, event, transaction) !== false) {
- me.runCallback(transaction, event, false);
- }
- Ext.direct.Manager.removeTransaction(transaction);
- }
- }
- }
- me.callParent([
- options,
- success,
- response
- ]);
- },
-
- getTransaction: function(options) {
- return options && options.tid ? Ext.direct.Manager.getTransaction(options.tid) : null;
- },
-
- runCallback: function(transaction, event) {
- var success = !!event.status,
- funcName = success ? 'success' : 'failure',
- callback, options, result;
- if (transaction && transaction.callback) {
- callback = transaction.callback;
- options = transaction.callbackOptions;
- result = typeof event.result !== 'undefined' ? event.result : event.data;
- if (Ext.isFunction(callback)) {
- callback(result, event, success, options);
- } else {
- Ext.callback(callback[funcName], callback.scope, [
- result,
- event,
- success,
- options
- ]);
- Ext.callback(callback.callback, callback.scope, [
- result,
- event,
- success,
- options
- ]);
- }
- }
- },
- inheritableStatics: {
-
- checkConfig: function(config) {
-
-
- return config && config.type === 'remoting' && config.url && Ext.isArray(config.actions);
- }
- }
- });
- Ext.define('Ext.dom.Fly', {
- extend: Ext.dom.Element,
- alternateClassName: 'Ext.dom.Element.Fly',
-
-
-
-
- validNodeTypes: {
- 1: 1,
-
- 9: 1,
-
- 11: 1
- },
-
-
- isFly: true,
- constructor: function(dom) {
- this.dom = dom;
-
-
-
- this.el = this;
- },
- attach: function(dom) {
- var me = this,
- data;
- if (!dom) {
- return me.detach();
- }
-
- me.dom = Ext.getDom(dom);
-
-
- if (!Ext.cache[dom.id]) {
- data = me.peekData();
- if (data) {
- data.isSynchronized = false;
- }
- }
- return me;
- },
- detach: function() {
- return (this.dom = null);
- },
- addListener:
- function() {
- Ext.raise("Cannot use addListener() on Ext.dom.Fly instances. " + "Please use Ext.get() to retrieve an Ext.dom.Element instance instead.");
- } ||
- null,
- removeListener:
- function() {
- Ext.raise("Cannot use removeListener() on Ext.dom.Fly instances. " + "Please use Ext.get() to retrieve an Ext.dom.Element instance instead.");
- } ||
- null
- }, function(Fly) {
- var flyweights = {},
- detachedBodyEl;
-
- Fly.cache = flyweights;
-
- Ext.fly = function(dom, named) {
- var fly = null,
- fn = Ext.fly,
- nodeType, data;
-
- named = named || (fn.caller && (fn.caller.$name || fn.caller.name)) || '_global';
- dom = Ext.getDom(dom);
- if (dom) {
- nodeType = dom.nodeType;
-
-
-
-
-
-
- if (Fly.prototype.validNodeTypes[nodeType] || (!nodeType && (dom.window == dom))) {
- fly = Ext.cache[dom.id];
-
- if (!fly || fly.dom !== dom) {
-
-
-
-
- if (named === 'constructor') {
- named = '$constructor';
- }
- fly = flyweights[named] || (flyweights[named] = new Fly());
- fly.dom = dom;
- data = fly.peekData();
- if (data) {
- data.isSynchronized = false;
- }
- }
- }
- }
- return fly;
- };
-
- Ext.getDetachedBody = function() {
- if (!detachedBodyEl) {
- Ext.detachedBodyEl = detachedBodyEl = new Fly(document.createElement('div'));
- detachedBodyEl.isDetachedBody = true;
- }
- return detachedBodyEl;
- };
- });
- Ext.define('Ext.dom.CompositeElementLite', {
- alternateClassName: [
- 'Ext.CompositeElementLite'
- ],
-
- isComposite: true,
-
- isLite: true,
-
-
-
-
-
-
-
- statics: {
-
-
-
-
- importElementMethods: function() {
- var Element = Ext.dom.Element,
- prototype = this.prototype;
- Ext.Object.each(Element.prototype, function(name, member) {
- if (typeof member === 'function' && !prototype[name]) {
- prototype[name] = function() {
- return this.invoke(name, arguments);
- };
- }
- });
- }
- },
- constructor: function(elements, skipValidation) {
-
- if (skipValidation) {
-
-
-
-
- this.elements = elements || [];
- } else {
- this.elements = [];
- this.add(elements);
- }
- },
-
- getElement: function(el) {
-
- var fly = this._fly || (this._fly = new Ext.dom.Fly());
- return fly.attach(el);
- },
-
- transformElement: function(el) {
- return Ext.getDom(el);
- },
-
- getCount: function() {
- return this.elements.length;
- },
-
- add: function(els, root) {
- var elements = this.elements,
- i, ln;
- if (!els) {
- return this;
- }
- if (typeof els == "string") {
- els = Ext.fly(root || document).query(els);
- } else if (els.isComposite) {
- els = els.elements;
- } else if (!Ext.isIterable(els)) {
- els = [
- els
- ];
- }
- for (i = 0 , ln = els.length; i < ln; ++i) {
- elements.push(this.transformElement(els[i]));
- }
- return this;
- },
- invoke: function(fn, args) {
- var me = this,
- elements = me.elements,
- ln = elements.length,
- prototype, element, i;
- if (i !== 0) {
-
-
- prototype = (me.isLite ? Ext.dom.Fly : Ext.dom.Element).prototype;
- for (i = 0; i < ln; i++) {
- element = elements[i];
- if (element) {
- prototype[fn].apply(me.getElement(element), args);
- }
- }
- }
- return me;
- },
-
- item: function(index) {
- var el = this.elements[index],
- out = null;
- if (el) {
- out = this.getElement(el);
- }
- return out;
- },
-
- slice: function(start, end) {
- return Ext.Array.slice(this.elements, start, end);
- },
-
- each: function(fn, scope) {
- var me = this,
- els = me.elements,
- len = els.length,
- i, e;
- for (i = 0; i < len; i++) {
- e = els[i];
- if (e) {
- e = this.getElement(e);
- if (fn.call(scope || e, e, me, i) === false) {
- break;
- }
- }
- }
- return me;
- },
-
- fill: function(els) {
- var me = this;
- me.elements = [];
- me.add(els);
- return me;
- },
- insert: function(index, nodes) {
- Ext.Array.insert(this.elements, index, nodes);
- },
-
- filter: function(selector) {
- var me = this,
- els = me.elements,
- len = els.length,
- out = [],
- i = 0,
- isFunc = typeof selector == 'function',
- add, el;
- for (; i < len; i++) {
- el = els[i];
- add = false;
- if (el) {
- el = me.getElement(el);
- if (isFunc) {
- add = selector.call(el, el, me, i) !== false;
- } else {
- add = el.is(selector);
- }
- if (add) {
- out.push(me.transformElement(el));
- }
- }
- }
- me.elements = out;
- return me;
- },
-
- indexOf: function(el) {
- return Ext.Array.indexOf(this.elements, this.transformElement(el));
- },
-
- replaceElement: function(el, replacement, domReplace) {
- var index = !isNaN(el) ? el : this.indexOf(el),
- d;
- if (index > -1) {
- replacement = Ext.getDom(replacement);
- if (domReplace) {
- d = this.elements[index];
- d.parentNode.insertBefore(replacement, d);
- Ext.removeNode(d);
- }
- Ext.Array.splice(this.elements, index, 1, replacement);
- }
- return this;
- },
-
- clear: function(removeDom) {
- var me = this,
- els = me.elements,
- i = els.length - 1;
- if (removeDom) {
- for (; i >= 0; i--) {
- Ext.removeNode(els[i]);
- }
- }
- this.elements = [];
- },
- addElements: function(els, root) {
- if (!els) {
- return this;
- }
- if (typeof els === "string") {
- els = Ext.dom.Element.selectorFunction(els, root);
- }
- var yels = this.elements,
- eLen = els.length,
- e;
- for (e = 0; e < eLen; e++) {
- yels.push(Ext.get(els[e]));
- }
- return this;
- },
-
- first: function() {
- return this.item(0);
- },
-
- last: function() {
- return this.item(this.getCount() - 1);
- },
-
- contains: function(el) {
- return this.indexOf(el) != -1;
- },
-
- removeElement: function(keys, removeDom) {
- keys = [].concat(keys);
- var me = this,
- elements = me.elements,
- kLen = keys.length,
- val, el, k;
- for (k = 0; k < kLen; k++) {
- val = keys[k];
- if ((el = (elements[val] || elements[val = me.indexOf(val)]))) {
- if (removeDom) {
- if (el.dom) {
- el.destroy();
- } else {
- Ext.removeNode(el);
- }
- }
- Ext.Array.erase(elements, val, 1);
- }
- }
- return me;
- },
- destroy: function() {
- this.invoke('destroy', arguments);
- this.callParent();
- }
- }, function(CompositeElementLite) {
- var prototype = CompositeElementLite.prototype;
- CompositeElementLite.importElementMethods();
- prototype.on = prototype.addListener;
- });
- Ext.define('Ext.dom.CompositeElement', {
- alternateClassName: 'Ext.CompositeElement',
- extend: Ext.dom.CompositeElementLite,
- isLite: false,
-
- getElement: function(el) {
-
- return el;
- },
-
- transformElement: function(el) {
- return Ext.get(el);
- }
- });
- Ext.define('Ext.dom.GarbageCollector', {
- singleton: true,
-
- interval: 30000,
- constructor: function() {
- var me = this;
- me.lastTime = Ext.now();
- me.onTick = me.onTick.bind(me);
-
- me.onTick.$skipTimerCheck = true;
-
- me.resume();
- },
-
- collect: function() {
- var me = this,
- cache = Ext.cache,
- eid, dom, el, t, isGarbage, tagName;
-
- var collectedIds = [];
-
- for (eid in cache) {
- if (!cache.hasOwnProperty(eid)) {
-
- continue;
- }
- el = cache[eid];
- if (el.skipGarbageCollection) {
-
- continue;
- }
- dom = el.dom;
-
-
- if (!dom) {
- Ext.raise('Missing DOM node in element garbage collection: ' + eid);
- }
-
- try {
-
-
-
-
-
- isGarbage = Ext.isGarbage(dom);
- } catch (e) {
-
-
-
-
- delete cache[eid];
-
- collectedIds.push('#' + el.id);
-
-
- continue;
- }
- if (isGarbage) {
- isGarbage = false;
- if (el && el.dom) {
-
- tagName = el.dom.tagName;
-
- el.collect();
-
- collectedIds.push((tagName ? tagName : '') + '#' + el.id);
- }
- }
- }
-
-
-
- if (Ext.isIE9m) {
- t = {};
- for (eid in cache) {
- if (cache.hasOwnProperty(eid)) {
- t[eid] = cache[eid];
- }
- }
- Ext.cache = Ext.dom.Element.cache = t;
- }
-
- me.lastTime = Ext.now();
-
- return collectedIds;
- },
-
- onTick: function() {
- this.timerId = null;
- if (Ext.enableGarbageCollector) {
- this.collect();
- }
- this.resume();
- },
-
- pause: function() {
- var timerId = this.timerId;
- if (timerId) {
- this.timerId = null;
- Ext.undefer(timerId);
- }
- },
-
- resume: function() {
- var me = this,
- lastTime = me.lastTime;
- if (Ext.enableGarbageCollector && (Ext.now() - lastTime) > me.interval) {
- me.collect();
- }
- if (!me.timerId) {
- me.timerId = Ext.defer(me.onTick, me.interval);
- }
- }
- });
- Ext.define('Ext.dom.TouchAction', {
- singleton: true,
- lastTouchStartTime: 0,
-
- minMoveDistance: 8,
- spaceRe: /\s+/,
- preventSingle: null,
- preventMulti: null,
- disabledOverflowDom: null,
- panXCls: Ext.baseCSSPrefix + 'touch-action-pan-x',
- panYCls: Ext.baseCSSPrefix + 'touch-action-pan-y',
- cssValues: [
- 'none',
- 'pan-x',
- 'pan-y',
- 'pan-x pan-y',
- 'pinch-zoom',
- 'pan-x pinch-zoom',
- 'pan-y pinch-zoom',
- 'pan-x pan-y pinch-zoom',
- 'double-tap-zoom',
- 'pan-x double-tap-zoom',
- 'pan-y double-tap-zoom',
- 'pan-x pan-y double-tap-zoom',
- 'pinch-zoom double-tap-zoom',
- 'pan-x pinch-zoom double-tap-zoom',
- 'pan-y pinch-zoom double-tap-zoom',
- ''
- ],
- objectValues: [
- {
- panX: false,
- panY: false,
- pinchZoom: false,
- doubleTapZoom: false
- },
- {
- panX: true,
- panY: false,
- pinchZoom: false,
- doubleTapZoom: false
- },
- {
- panX: false,
- panY: true,
- pinchZoom: false,
- doubleTapZoom: false
- },
- {
- panX: true,
- panY: true,
- pinchZoom: false,
- doubleTapZoom: false
- },
- {
- panX: false,
- panY: false,
- pinchZoom: true,
- doubleTapZoom: false
- },
- {
- panX: true,
- panY: false,
- pinchZoom: true,
- doubleTapZoom: false
- },
- {
- panX: false,
- panY: true,
- pinchZoom: true,
- doubleTapZoom: false
- },
- {
- panX: true,
- panY: true,
- pinchZoom: true,
- doubleTapZoom: false
- },
- {
- panX: false,
- panY: false,
- pinchZoom: false,
- doubleTapZoom: true
- },
- {
- panX: true,
- panY: false,
- pinchZoom: false,
- doubleTapZoom: true
- },
- {
- panX: false,
- panY: true,
- pinchZoom: false,
- doubleTapZoom: true
- },
- {
- panX: true,
- panY: true,
- pinchZoom: false,
- doubleTapZoom: true
- },
- {
- panX: false,
- panY: false,
- pinchZoom: true,
- doubleTapZoom: true
- },
- {
- panX: true,
- panY: false,
- pinchZoom: true,
- doubleTapZoom: true
- },
- {
- panX: false,
- panY: true,
- pinchZoom: true,
- doubleTapZoom: true
- },
- {
- panX: true,
- panY: true,
- pinchZoom: true,
- doubleTapZoom: true
- }
- ],
- attributeName: 'data-extTouchAction',
- constructor: function() {
- var me = this,
- supports = Ext.supports;
- if (supports.TouchAction) {
- me.cssProp = 'touch-action';
- } else if (supports.MSPointerEvents) {
- me.cssProp = '-ms-touch-action';
- }
- if (supports.TouchEvents) {
- Ext.getWin().on({
- touchstart: 'onTouchStart',
- touchmove: 'onTouchMove',
- touchend: 'onTouchEnd',
- scope: me,
- delegated: false,
- translate: false,
- capture: true,
- priority: 5000
- });
- Ext.on({
- scroll: 'onScroll',
- scope: me,
- destroyable: true
- });
- }
-
- if (Ext.isFunction(Object.freeze)) {
- var objectValues = me.objectValues;
- for (var i = 0,
- ln = objectValues.length; i < ln; i++) {
- Object.freeze(objectValues[i]);
- }
- }
- },
-
-
- containsTargets: function(dom, e) {
- var contains = true,
- event = e.browserEvent,
- touches = e.type === 'touchend' ? event.changedTouches : event.touches,
- i, ln;
- for (i = 0 , ln = touches.length; i < ln; i++) {
- if (!dom.contains(touches[i].target)) {
- contains = false;
- break;
- }
- }
- return contains;
- },
-
- disableOverflow: function(dom, vertical) {
- var me = this,
- overflowName = vertical ? 'overflow-y' : 'overflow-x',
- overflowStyle, cls;
- if (!me.disabledOverflowDom && !Ext.isiOS && !Ext.getScrollbarSize().width) {
- me.disabledOverflowDom = dom;
- cls = vertical ? me.panXCls : me.panYCls;
- while (dom) {
- overflowStyle = Ext.fly(dom).getStyle(overflowName);
- if (overflowStyle === 'auto' || overflowStyle === 'scroll') {
- Ext.fly(dom).addCls(cls);
- }
- dom = dom.parentNode;
- }
- }
- },
-
- get: function(dom) {
- var flags = dom.getAttribute(this.attributeName),
- ret = null;
- if (flags != null) {
- ret = this.objectValues[flags];
- }
- return ret;
- },
-
- getFlags: function(touchAction) {
- var flags;
- if (typeof touchAction === 'number') {
- flags = touchAction;
- } else {
- flags = 0;
- if (touchAction.panX !== false) {
- flags |= 1;
- }
- if (touchAction.panY !== false) {
- flags |= 2;
- }
- if (touchAction.pinchZoom !== false) {
- flags |= 4;
- }
- if (touchAction.doubleTapZoom !== false) {
- flags |= 8;
- }
- }
- return flags;
- },
- isScrollable: function(el, vertical, forward) {
- var overflowStyle = Ext.fly(el).getStyle(vertical ? 'overflow-y' : 'overflow-x'),
- isScrollable = (overflowStyle === 'auto' || overflowStyle === 'scroll');
- if (isScrollable) {
- if (vertical) {
- isScrollable = forward ? (el.scrollTop + el.clientHeight) < el.scrollHeight : el.scrollTop > 0;
- } else {
- isScrollable = forward ? (el.scrollLeft + el.clientWidth) < el.scrollWidth : el.scrollLeft > 0;
- }
- }
- return isScrollable;
- },
- lookupFlags: function(dom) {
- return parseInt((dom.getAttribute && dom.getAttribute(this.attributeName)) || 15, 10);
- },
- onScroll: function() {
-
- this.scrollOccurred = true;
-
-
- this.isDoubleTap = false;
- },
- onTouchEnd: function(e) {
- var me = this,
- dom = e.target,
- touchCount, flags, doubleTapZoom;
- touchCount = e.browserEvent.touches.length;
- if (touchCount === 0) {
- if (me.isDoubleTap) {
- while (dom) {
- flags = me.lookupFlags(dom);
- if (flags != null) {
- doubleTapZoom = flags & 8;
- if (!doubleTapZoom) {
- e.preventDefault();
- }
- }
- dom = dom.parentNode;
- }
- }
- me.isDoubleTap = false;
- me.preventSingle = null;
- me.preventMulti = null;
- me.resetOverflow();
- }
- },
- onTouchMove: function(e) {
- var me = this,
- prevent = null,
- dom = e.target,
- flags, touchCount, panX, panY, point, startPoint, isVertical, scale, distance, deltaX, deltaY, preventSingle, preventMulti;
- preventSingle = me.preventSingle;
- preventMulti = me.preventMulti;
- touchCount = e.browserEvent.touches.length;
-
-
-
-
-
- if ((touchCount === 1 && (preventSingle === false)) || (preventMulti === false)) {
- return;
- }
- if ((touchCount > 1 && (preventMulti === true)) || (touchCount === 1 && (preventSingle === true))) {
- prevent = true;
- } else {
- if (touchCount === 1) {
- point = e.getPoint();
- startPoint = me.startPoint;
- scale = Ext.Element.getViewportScale();
-
- distance = point.getDistanceTo(me.startPoint) * scale;
- deltaX = point.x - startPoint.x;
- deltaY = point.y - startPoint.y;
- isVertical = Math.abs(deltaY) >= Math.abs(deltaX);
- }
- while (dom && (dom.nodeType === 1)) {
- flags = me.lookupFlags(dom);
- if (flags & 0) {
-
- prevent = true;
- } else if (touchCount === 1) {
- panX = !!(flags & 1);
- panY = !!(flags & 2);
- if (panX && panY) {
- prevent = false;
- } else if (!panX && !panY) {
- prevent = true;
- } else if (distance >= me.minMoveDistance) {
- prevent = !!((panX && isVertical) || (panY && !isVertical));
- }
-
-
-
- if (!prevent && me.isScrollable(dom, isVertical, (isVertical ? deltaY : deltaX) < 0)) {
- break;
- }
- } else if (me.containsTargets(dom, e)) {
-
- prevent = !(flags & 4);
- } else {
-
- prevent = false;
- }
- if (prevent) {
- break;
- }
- dom = dom.parentNode;
- }
- }
-
-
-
-
-
-
-
- if (touchCount === 1) {
- me.preventSingle = prevent;
- } else if (touchCount > 1) {
- me.preventMulti = prevent;
- }
- if (prevent) {
- e.preventDefault();
- }
- },
- onTouchStart: function(e) {
- var me = this,
- time, flags, dom, panX, panY;
- if (e.browserEvent.touches.length === 1) {
- time = e.time;
-
-
-
-
-
- if (!me.scrollOccurred && ((time - me.lastTouchStartTime) <= 500)) {
- me.isDoubleTap = true;
- }
- me.lastTouchStartTime = time;
- me.scrollOccurred = false;
- me.startPoint = e.getPoint();
- dom = e.target;
- while (dom) {
- flags = me.lookupFlags(dom);
- if (flags != null) {
- panX = !!(flags & 1);
- panY = !!(flags & 2);
- if (panX !== panY) {
- me.disableOverflow(dom, panX);
- break;
- }
- }
- dom = dom.parentNode;
- }
- } else {
-
- me.isDoubleTap = false;
- }
- },
-
- resetOverflow: function() {
- var me = this,
- dom = me.disabledOverflowDom;
- while (dom) {
- Ext.fly(dom).removeCls([
- me.panXCls,
- me.panYCls
- ]);
- dom = dom.parentNode;
- }
- me.disabledOverflowDom = null;
- },
-
- set: function(dom, value) {
- var me = this,
- cssProp = me.cssProp,
- flags = me.getFlags(value),
-
-
- supportedFlags = (flags & Ext.supports.TouchAction),
- attributeName = me.attributeName;
- if (cssProp) {
- Ext.fly(dom).setStyle(cssProp, me.cssValues[supportedFlags]);
- }
- if (flags === 15) {
- dom.removeAttribute(attributeName);
- } else {
- dom.setAttribute(attributeName, flags);
- }
- }
- });
- Ext.define('Ext.drag.Constraint', {
- alias: 'drag.constraint.base',
- mixins: [
- Ext.mixin.Factoryable
- ],
- factoryConfig: {
- defaultType: 'base',
- type: 'drag.constraint'
- },
- config: {
-
- element: null,
-
- horizontal: null,
-
- region: null,
-
- snap: null,
-
- source: null,
-
- vertical: null,
-
- x: null,
-
- y: null
- },
- constructor: function(config) {
- this.initConfig(config);
- },
- applyElement: function(element) {
- if (element && typeof element !== 'boolean') {
- element = Ext.get(element);
- }
- return element || null;
- },
- applySnap: function(snap) {
- if (typeof snap === 'number') {
- snap = {
- x: snap,
- y: snap
- };
- }
- return snap;
- },
-
- constrain: function(xy, info) {
- var me = this,
- x = xy[0],
- y = xy[1],
- constrainInfo = me.constrainInfo,
- initial = constrainInfo.initial,
- constrainX = constrainInfo.x,
- constrainY = constrainInfo.y,
- snap = constrainInfo.snap,
- min, max;
- if (!constrainInfo.vertical) {
- if (snap && snap.x) {
- if (snap.xFn) {
- x = snap.x.call(me, info, x);
- } else {
- x = me.doSnap(x, initial.x, snap.x);
- }
- }
- if (constrainX) {
- min = constrainX[0];
- max = constrainX[1];
- if (min !== null && x < min) {
- x = min;
- }
- if (max !== null && x > max) {
- x = max;
- }
- }
- } else {
- x = initial.x;
- }
- if (!constrainInfo.horizontal) {
- if (snap && snap.y) {
- if (snap.yFn) {
- y = snap.y.call(me, info, y);
- } else {
- y = me.doSnap(y, initial.y, snap.y);
- }
- }
- if (constrainY) {
- min = constrainY[0];
- max = constrainY[1];
- if (min !== null && y < min) {
- y = min;
- }
- if (max !== null && y > max) {
- y = max;
- }
- }
- } else {
- y = initial.y;
- }
- return [
- x,
- y
- ];
- },
- destroy: function() {
- this.setSource(null);
- this.setElement(null);
- this.callParent();
- },
- privates: {
-
- constrainValue: function(a, b, resolver) {
- var val = null,
- aNull = a === null,
- bNull = b === null;
- if (!(aNull && bNull)) {
- if (aNull) {
- val = b;
- } else if (bNull) {
- val = a;
- } else {
- val = resolver(a, b);
- }
- }
- return val;
- },
-
- doSnap: function(position, initial, snap) {
- if (!snap) {
- return position;
- }
- var ratio = (position - initial) / snap,
- floor = Math.floor(ratio);
-
-
- if (ratio - floor <= 0.5) {
- ratio = floor;
- } else {
- ratio = floor + 1;
- }
- return initial + (snap * ratio);
- },
-
- onDragStart: function(info) {
- var me = this,
- snap = me.getSnap(),
- vertical = !!me.getVertical(),
- horizontal = !!me.getHorizontal(),
- element = me.getElement(),
- region = me.getRegion(),
- proxy = info.proxy,
- proxyEl = proxy.element,
- x = me.getX(),
- y = me.getY(),
- minX = null,
- maxX = null,
- minY = null,
- maxY = null,
- rminX = null,
- rmaxX = null,
- rminY = null,
- rmaxY = null,
- pos, size;
- if (element) {
- if (typeof element === 'boolean') {
- element = me.getSource().getElement().parent();
- }
- if (info.local) {
- pos = element.getStyle('position');
- if (pos === 'relative' || pos === 'absolute') {
- size = element.getSize();
- region = new Ext.util.Region(0, size.width, size.height, 0);
- } else {
- region = element.getRegion(true, true);
- }
- } else {
- region = element.getRegion(true);
- }
- }
- if (region) {
- if (!vertical) {
- rminX = region.left;
- rmaxX = region.right - (proxyEl ? proxy.width : 0);
- }
- if (!horizontal) {
- rminY = region.top;
- rmaxY = region.bottom - (proxyEl ? proxy.height : 0);
- }
- }
-
-
-
-
-
-
-
- if (!vertical && (region || x)) {
- if (x) {
- minX = x[0];
- maxX = x[1];
- }
- if (minX !== null || maxX !== null || rminX !== null || rmaxX !== null) {
- minX = me.constrainValue(minX, rminX, Math.max);
- maxX = me.constrainValue(maxX, rmaxX, Math.min);
- x = [
- minX,
- maxX
- ];
- }
- }
- if (!horizontal && (region || y)) {
- if (y) {
- minY = y[0];
- maxY = y[1];
- }
- if (minY !== null || maxY !== null || rminY !== null || rmaxY !== null) {
- minY = me.constrainValue(minY, rminY, Math.max);
- maxY = me.constrainValue(maxY, rmaxY, Math.min);
- y = [
- minY,
- maxY
- ];
- }
- }
- if (snap) {
- snap = {
- x: snap.x,
- xFn: typeof snap.x === 'function',
- y: snap.y,
- yFn: typeof snap.y === 'function'
- };
- }
- me.constrainInfo = {
- initial: info.element.initial,
- vertical: vertical,
- horizontal: horizontal,
- x: x,
- y: y,
- snap: snap
- };
- }
- }
- });
- Ext.define('Ext.drag.Info', {
- constructor: function(source, e) {
-
- if (!source) {
- return;
- }
- var me = this,
- local = source.getLocal(),
- el, proxyEl, proxy, x, xy, y, pageXY, elPageXY;
- me.source = source;
- me.local = local;
- xy = me.getEventXY(e);
- pageXY = e.getXY();
- el = source.getElement();
- elPageXY = el.getXY();
- xy = local ? el.getLocalXY() : elPageXY;
- x = xy[0];
- y = xy[1];
- me.initialEvent = e;
- me.eventTarget = e.target;
- me.cursor = {
- current: {
- x: x,
- y: y
- },
- delta: {
- x: 0,
- y: 0
- },
- initial: {
- x: pageXY[0],
- y: pageXY[1]
- },
- offset: {
- x: pageXY[0] - elPageXY[0],
- y: pageXY[1] - elPageXY[1]
- }
- };
- me.element = {
- current: {
- x: x,
- y: y
- },
- delta: {
- x: 0,
- y: 0
- },
- initial: {
- x: x,
- y: y
- }
- };
- me.proxy = {
- instance: source.getProxy(),
- current: {
- x: x,
- y: y
- },
- delta: {
- x: 0,
- y: 0
- },
- initial: {
- x: x,
- y: y
- },
- element: el,
- isUnderCursor: false,
- isElement: true
- };
- me.types = [];
- me.data = {};
- source.describe(me);
- proxy = me.proxy;
- proxyEl = proxy.instance.setupElement(me);
- proxy.isElement = proxyEl === source.getElement();
- proxy.element = proxyEl;
- if (proxyEl) {
- proxy.width = proxyEl.getWidth();
- proxy.height = proxyEl.getHeight();
- }
- if (proxy.isElement) {
-
- el = me.element;
- el.current = proxy.current;
- el.delta = proxy.delta;
- }
- me.needsCursorCheck = proxy.element && source.manager && source.manager.pointerBug;
- },
-
- cursor: null,
-
- element: null,
-
- eventTarget: null,
-
- files: null,
-
- isNative: false,
-
- proxy: null,
-
- source: null,
-
- target: null,
-
- types: null,
-
- valid: false,
-
- clearData: function(type) {
- Ext.Array.remove(this.types, type);
- delete this.data[type];
- },
-
- clone: function() {
- var me = this,
- ret = new Ext.drag.Info();
- ret.cursor = Ext.merge({}, me.cursor);
- ret.data = Ext.apply({}, me.data);
- ret.element = Ext.merge({}, me.element);
- ret.eventTarget = me.eventTarget;
- ret.proxy = Ext.merge({}, me.proxy);
- ret.source = me.source;
- ret.target = me.target;
- ret.types = Ext.Array.clone(me.types);
- ret.valid = me.valid;
- return ret;
- },
-
- getData: function(type) {
- var me = this,
- data = me.data,
- dt = me.dataTransfer,
- ret;
- if (dt) {
- ret = dt.getData(type);
- } else {
-
- if (!me.finalized) {
- Ext.raise('Unable to call getData until the drop is complete');
- }
-
- ret = data[type];
- if (typeof ret === 'function') {
- data[type] = ret = ret.call(me.source, me);
- }
- if (!ret && ret !== 0) {
- ret = '';
- }
- }
- return Ext.Promise.resolve(ret);
- },
-
- setData: function(type, value) {
- Ext.Array.include(this.types, type);
- this.data[type] = value;
- },
- destroy: function() {
- var me = this;
- me.eventTarget = me.data = me.proxy = me.targetMap = me.targetMap = me.types = me.elementMap = me.possibleTargets = me.target = null;
- me.callParent();
- },
- privates: {
-
- data: null,
-
- dataTransfer: null,
-
- elementMap: null,
-
- possibleTargets: null,
-
- targetMap: null,
- copyNativeData: function(target, e) {
- var dt = e.browserEvent.dataTransfer;
- this.target = target;
- this.dataTransfer = dt;
- this.files = dt.files;
- },
-
- finalize: function() {
- var me = this,
- target = me.target;
- me.finalized = true;
- if (target) {
- target.info = null;
- target.handleDrop(me);
- }
- },
-
- getAlignXY: function(x, y) {
- var me = this,
- source = me.source,
- cursorOffset = me.cursor.offset,
- proxy = source.getProxy(),
- proxyEl = me.proxy.element,
- constrain = source.getConstrain(),
- xy = [
- x,
- y
- ];
- if (proxyEl) {
- if (me.proxy.isElement) {
- xy[0] -= cursorOffset.x;
- xy[1] -= cursorOffset.y;
- } else {
- xy = proxy.adjustCursorOffset(me, xy);
- }
- if (constrain) {
- xy = constrain.constrain(xy, me);
- }
- }
- return xy;
- },
- getEventXY: function(e) {
- var xy = e.getXY(),
-
- source = this.source;
- if (this.local) {
- xy = source.convertToLocalXY(xy);
- }
- return xy;
- },
- onNativeDragEnter: function(target, e) {
- var me = this;
- me.valid = target.accepts(me);
- target.info = me;
- me.copyNativeData(target, e);
- },
- onNativeDragLeave: function(target, e) {
- var me = this;
-
-
-
- if (me.target === target) {
- target.info = null;
- me.valid = false;
- me.target = me.dataTransfer = me.files = null;
- }
- },
- onNativeDragMove: function(target, e) {
- this.copyNativeData(target, e);
- },
- onNativeDrop: function(target, e) {
- this.copyNativeData(target, e);
- target.info = null;
- },
-
- setActive: function(target) {
- var me = this,
- source = me.source,
- current = me.target,
- changed = current !== target;
- if (current && changed) {
- current.handleDragLeave(me);
- current.info = null;
- }
- me.target = target;
- if (target) {
- if (changed) {
- me.valid = !!me.possibleTargets[target.getId()] && target.accepts(me) !== false;
- target.handleDragEnter(me);
- target.info = me;
- }
- target.handleDragMove(me);
- } else {
- me.valid = false;
- }
- if (changed) {
- source.getProxy().update(me);
- }
- },
-
- update: function(event, beforeStart) {
- var me = this,
- xy = me.getEventXY(event),
- x = xy[0],
- y = xy[1],
- alignXY = me.getAlignXY(x, y),
- alignX = alignXY[0],
- alignY = alignXY[1],
- proxyData = me.proxy,
- cursor = me.cursor,
- current = cursor.current,
- delta = cursor.delta,
- initial = cursor.initial,
- proxy = proxyData.instance;
- current.x = x;
- current.y = y;
- delta.x = x - initial.x;
- delta.y = y - initial.y;
- current = proxyData.current;
- delta = proxyData.delta;
- initial = proxyData.initial;
- current.x = alignX;
- current.y = alignY;
- delta.x = alignX - initial.x;
- delta.y = alignY - initial.y;
- if (me.needsCursorCheck) {
- proxyData.isUnderCursor = !(x < alignX || y < alignY || x > proxyData.width + alignX || y > proxyData.height + alignY);
- }
- if (!beforeStart && proxy) {
- proxy.setXY(me, alignXY);
- }
- }
- }
- });
- Ext.define('Ext.drag.Item', {
- mixins: [
- Ext.mixin.Observable,
- Ext.mixin.Identifiable
- ],
- config: {
-
- autoDestroy: true,
-
- component: null,
-
- element: null,
-
- groups: null
- },
- constructor: function(config) {
- this.mixins.observable.constructor.call(this, config);
- },
-
- isDisabled: function() {
- return this.disabled;
- },
-
- disable: function() {
- this.disabled = true;
- },
-
- enable: function() {
- this.disabled = false;
- },
- updateComponent: function(comp, was) {
- var el;
- if (comp) {
- el = comp.el;
- } else if (was && was.el === this.getElement()) {
- el = null;
- } else {
- return;
- }
- this.setElement(el);
- },
- applyElement: function(element) {
- return element ? Ext.get(element) : null;
- },
- updateElement: function() {
- this.setupListeners();
- },
- applyGroups: function(group) {
- if (typeof group === 'string') {
- group = [
- group
- ];
- }
- return group;
- },
- destroy: function() {
- var me = this,
- el = me.getElement();
- me.destroying = true;
- me.setElement(null);
- if (el && me.getAutoDestroy()) {
- el.destroy();
- }
- me.callParent();
- me.destroying = false;
- },
- privates: {
-
- disabled: false,
- convertToLocalXY: function(xy) {
- var c = this.getComponent();
- if (c) {
- xy = c.convertToLocalXY(xy);
- } else {
- xy = this.getElement().translateXY(xy[0], xy[1]);
- xy = [
- xy.x,
- xy.y
- ];
- }
- return xy;
- },
-
- getElListeners: Ext.privateFn,
-
- setupListeners: function(element) {
- var me = this,
- elListeners = me.elListeners;
- element = element || me.getElement();
- if (elListeners) {
- elListeners.destroy();
- me.elListeners = null;
- }
- if (element) {
- me.elListeners = element.on(Ext.apply({
- scope: me,
- destroyable: true
- }, me.getElListeners()));
- }
- }
- }
- });
- Ext.define('Ext.drag.Manager', {
- singleton: true,
-
- dragCls: Ext.baseCSSPrefix + 'drag-body',
-
-
-
-
-
-
- pointerBug: Ext.isTouch || (!Ext.supports.CSSPointerEvents || Ext.isIE10m || Ext.isOpera),
- constructor: function() {
- this.targets = {};
- this.nativeTargets = [];
- Ext.onReady(this.init, this);
- },
- init: function() {
-
-
-
-
-
-
-
-
-
- Ext.getDoc().on({
- scope: this,
- dragenter: {
- capture: true,
- fn: 'onNativeDragEnter'
- },
- dragleave: 'onNativeDragLeave',
- dragover: 'onNativeDragOver',
- drop: 'onNativeDrop'
- });
- },
- destroy: function() {
- var me = this,
- targets = me.targets,
- key;
- me.destroying = true;
- for (key in targets) {
- targets[key].destroy();
- }
- me.targets = null;
- me.callParent();
- me.destroying = false;
- },
- privates: {
-
- elementFromPoint: function(x, y) {
- if (Ext.rootInheritedState.rtl) {
- x = Ext.Element.getViewportWidth() - x;
- }
- return Ext.dom.Element.fromPagePoint(x, y, true);
- },
-
- getAtPoint: function(info) {
- var current = info.cursor.current,
- elementMap = info.elementMap,
- isUnderCursor = info.proxy.isUnderCursor,
- proxyEl = this.pointerBug && isUnderCursor ? info.proxy.element.dom : null,
- target, el;
- if (proxyEl) {
- proxyEl.style.visibility = 'hidden';
- }
- el = this.elementFromPoint(current.x, current.y);
- if (proxyEl) {
- proxyEl.style.visibility = 'visible';
- }
- while (el) {
- target = elementMap[el.id];
- if (target) {
- return target;
- }
- el = el.parentNode;
- }
- return null;
- },
-
- getNativeDragInfo: function(e) {
- var info = this.nativeDragInfo;
- if (!info) {
- this.nativeDragInfo = info = new Ext.drag.Info();
- info.isNative = true;
- }
- return info;
- },
-
- onDragCancel: function() {
- Ext.getBody().removeCls(this.dragCls);
- },
-
- onDragEnd: function(info, e) {
- info.finalize();
- Ext.getBody().removeCls(this.dragCls);
- },
-
- onDragMove: function(info, e) {
- this.processDrag(info);
- },
-
- onDragStart: function(info, e) {
- var me = this,
- source = info.source,
- targets = me.targets,
- groups = source.getGroups(),
- targetMap = {},
- possibleTargets = {},
- elementMap = {},
- id, target, targetGroups, groupMap, groupOk, len, i;
- elementMap = {};
- possibleTargets = {};
- if (groups) {
- groupMap = Ext.Array.toMap(groups);
- }
-
-
-
- for (id in targets) {
- target = targets[id];
- if (!target.isDisabled()) {
- groupOk = false;
- targetGroups = target.getGroups();
-
-
-
-
- if (!groupMap && !targetGroups) {
- groupOk = true;
- } else if (groupMap && targetGroups) {
- for (i = 0 , len = targetGroups.length; i < len; ++i) {
- if (groupMap[targetGroups[i]]) {
- groupOk = true;
- break;
- }
- }
- }
- if (groupOk) {
- possibleTargets[id] = target;
- }
- }
- targetMap[id] = target;
- elementMap[target.getElement().id] = target;
- }
- info.possibleTargets = possibleTargets;
- info.targetMap = targetMap;
- info.elementMap = elementMap;
- Ext.getBody().addCls(me.dragCls);
- me.processDrag(info);
- },
-
- onNativeDragEnter: function(e) {
- var nativeTargets = this.nativeTargets,
- target = e.target;
-
- e.preventDefault();
- if (nativeTargets[nativeTargets.length - 1] !== target) {
- nativeTargets.push(target);
- }
- },
-
- onNativeDragLeave: function(e) {
- var nativeTargets = this.nativeTargets;
- Ext.Array.remove(nativeTargets, e.target);
- if (nativeTargets.length === 0) {
- this.nativeDragInfo = null;
- }
- },
-
- onNativeDragOver: function(e) {
-
- e.preventDefault();
- },
-
- onNativeDrop: function(e) {
-
- e.preventDefault();
- this.nativeTargets.length = 0;
- this.nativeDragInfo = null;
- },
-
- processDrag: function(info) {
- info.setActive(this.getAtPoint(info));
- },
-
- register: function(target) {
- this.targets[target.getId()] = target;
- },
-
- unregister: function(target) {
- if (this.destroying) {
- return;
- }
- delete this.targets[target.getId()];
- }
- }
- });
- Ext.define('Ext.drag.Source', {
- extend: Ext.drag.Item,
- defaultIdPrefix: 'source-',
- config: {
-
- activateOnLongPress: false,
-
- activeCls: null,
-
- constrain: null,
-
- handle: null,
- local: null,
-
-
- proxy: 'original',
-
- revert: false
- },
-
-
-
-
-
-
-
- dragging: false,
- constructor: function(config) {
- var describe = config && config.describe;
- if (describe) {
- this.describe = describe;
-
-
-
- config = Ext.apply({}, config);
- delete config.describe;
- }
- this.callParent([
- config
- ]);
-
-
-
- this.manager = Ext.drag['Manager'];
- },
-
- describe: Ext.emptyFn,
-
- isDragging: function() {
- return this.dragging;
- },
-
- beforeDragStart: Ext.emptyFn,
-
- onDragCancel: Ext.emptyFn,
-
- onDragEnd: Ext.emptyFn,
-
- onDragMove: Ext.emptyFn,
-
- onDragStart: Ext.emptyFn,
- applyActivateOnLongPress: function(activateOnLongPress) {
- if (typeof activateOnLongPress === 'string') {
- activateOnLongPress = [
- activateOnLongPress
- ];
- }
- return activateOnLongPress;
- },
- updateActivateOnLongPress: function(activateOnLongPress) {
- if (!this.isConfiguring) {
- this.setupListeners();
- }
- },
- updateActiveCls: function(cls, oldCls) {
- if (this.dragging) {
- var el = this.getElement();
- el.replaceCls(oldCls, cls);
- }
- },
- applyConstrain: function(constrain) {
- if (constrain && !constrain.$isClass) {
- if (constrain.isRegion) {
- constrain = {
- region: constrain
- };
- } else if (constrain.isElement || !Ext.isObject(constrain)) {
- constrain = {
- element: constrain
- };
- }
- constrain = Ext.apply({
- source: this
- }, constrain);
- constrain = Ext.Factory.dragConstraint(constrain);
- }
- return constrain;
- },
- updateElement: function(element, oldElement) {
-
-
- if (oldElement && !oldElement.destroyed) {
- oldElement.un('dragstart', 'stopNativeDrag', this);
- }
- if (element && !this.getHandle()) {
- element.setTouchAction({
- panX: false,
- panY: false
- });
-
-
-
- element.on('dragstart', 'stopNativeDrag', this, {
- translate: false,
- delegated: false
- });
- }
- this.callParent([
- element,
- oldElement
- ]);
- },
- updateHandle: function() {
- if (!this.isConfiguring) {
- this.setupListeners();
- }
- },
- applyProxy: function(proxy) {
- if (proxy) {
- proxy = Ext.Factory.dragproxy(proxy);
- }
- return proxy;
- },
- updateProxy: function(proxy, oldProxy) {
- if (oldProxy) {
- oldProxy.destroy();
- }
- if (proxy) {
- proxy.setSource(this);
- }
- },
- resolveListenerScope: function() {
- var ownerCmp = this.ownerCmp,
- a = arguments;
- if (ownerCmp) {
- return ownerCmp.resolveListenerScope.apply(ownerCmp, a);
- }
- return this.callParent(a);
- },
- destroy: function() {
- var me = this;
- me.manager = me.initialEvent = null;
- me.setConstrain(null);
- me.setProxy(null);
- me.callParent();
- },
- privates: {
-
- draggingCls: Ext.baseCSSPrefix + 'drag-dragging',
-
- info: null,
-
- revertCls: Ext.baseCSSPrefix + 'drag-revert',
- canActivateOnLongPress: function(e) {
- var activate = this.getActivateOnLongPress();
- return !!(activate && (activate === true || Ext.Array.contains(activate, e.pointerType)));
- },
-
- dragCleanup: function(info) {
- var me = this,
- cls = me.getActiveCls(),
- proxy = me.getProxy(),
- el = me.getElement(),
- proxyEl = info ? info.proxy.element : null;
- if (cls) {
- el.removeCls(cls);
- }
- if (proxyEl) {
- proxyEl.removeCls(me.draggingCls);
- }
- proxy.cleanup(info);
- me.dragging = false;
- me.initialEvent = me.info = null;
- },
-
- getElListeners: function() {
- var o = {
- touchstart: 'handleTouchStart',
- dragstart: 'handleDragStart',
- drag: 'handleDragMove',
- dragend: 'handleDragEnd',
- dragcancel: 'handleDragCancel'
- },
- handle = this.getHandle();
- if (handle) {
- o.dragstart = {
- fn: o.dragstart,
- delegate: handle
- };
- }
- if (this.getActivateOnLongPress()) {
- o.longpress = 'handleLongPress';
- }
- return o;
- },
-
- handleDragCancel: function(e) {
- var me = this,
- info = me.info,
- manager = me.manager;
- if (manager) {
- manager.onDragCancel(info, e);
- }
- me.onDragCancel(info);
- if (me.hasListeners.dragcancel) {
- me.fireEvent('dragcancel', me, info, e);
- }
- Ext.fireEvent('dragcancel', me, info, e);
- me.dragCleanup(info);
- },
-
- handleDragEnd: function(e) {
- if (!this.dragging) {
- return;
- }
- var me = this,
- manager = me.manager,
- revert = me.getRevert(),
- info = me.info,
- proxy = info.proxy;
- info.update(e);
- if (manager) {
- manager.onDragEnd(info, e);
- }
- me.onDragEnd(info);
- if (me.hasListeners.dragend) {
- me.fireEvent('dragend', me, info, e);
- }
- Ext.fireEvent('dragend', me, info, e);
- proxy = proxy.instance;
- if (revert && proxy) {
- proxy.dragRevert(info, me.revertCls, revert, function() {
- me.dragCleanup(info);
- });
- } else {
- me.dragCleanup(info);
- }
- },
-
- handleDragMove: function(e) {
- var me = this,
- info = me.info,
- manager = me.manager;
- if (!me.dragging) {
- return;
- }
- e.stopPropagation();
- e.claimGesture();
- info.update(e);
- if (manager) {
- manager.onDragMove(info, e);
- }
- me.onDragMove(info);
- if (me.hasListeners.dragmove) {
- me.fireEvent('dragmove', me, info, e);
- }
- },
-
- handleDragStart: function(e) {
- var me = this,
- hasListeners = me.hasListeners,
- manager = me.manager,
- constrain = me.getConstrain(),
- initialEvent = me.initialEvent,
- el, cls, info, cancel, proxyEl;
- if (me.preventStart(e)) {
- return false;
- }
- if (hasListeners.initdragconstraints) {
-
-
- me.fireEvent('initdragconstraints', me, e);
- }
- me.info = info = new Ext.drag.Info(me, initialEvent);
- me.setup(info);
- if (constrain) {
- constrain.onDragStart(info);
- }
- info.update(e, true);
- cancel = me.beforeDragStart(info) === false;
- if (!cancel && hasListeners.beforedragstart) {
- cancel = me.fireEvent('beforedragstart', me, info, e) === false;
- }
- if (cancel) {
- me.dragCleanup();
- return false;
- }
- e.claimGesture();
- me.dragging = true;
- cls = me.getActiveCls();
- el = me.getElement();
- if (cls) {
- el.addCls(cls);
- }
- proxyEl = info.proxy.element;
- if (proxyEl) {
- proxyEl.addCls(me.draggingCls);
- }
- info.update(e);
- if (manager) {
- manager.onDragStart(info, e);
- }
- me.onDragStart(info);
- if (hasListeners.dragstart) {
- me.fireEvent('dragstart', me, info, e);
- }
- Ext.fireEvent('dragstart', me, info, e);
- },
-
- handleLongPress: function(e) {
- if (!this.isDisabled() && this.canActivateOnLongPress(e)) {
- this.initialEvent = e;
- e.startDrag();
- }
- },
-
- handleTouchStart: function(e) {
- if (!this.isDisabled()) {
- this.initialEvent = e;
- }
- },
- preventStart: function(e) {
- return this.isDisabled() || (!e.longpress && this.canActivateOnLongPress(e));
- },
-
- setup: Ext.privateFn,
- stopNativeDrag: function(e) {
- e.preventDefault();
- }
- }
- });
- Ext.define('Ext.drag.Target', {
- extend: Ext.drag.Item,
- defaultIdPrefix: 'target-',
- config: {
-
- invalidCls: '',
-
- validCls: ''
- },
-
-
-
-
-
-
- constructor: function(config) {
- var me = this,
- accepts = config && config.accepts;
- if (accepts) {
- me.accepts = accepts;
-
-
-
- config = Ext.apply({}, config);
- delete config.accepts;
- }
- me.callParent([
- config
- ]);
- Ext.drag.Manager.register(me);
- },
-
- accepts: function(info) {
- return true;
- },
-
- disable: function() {
- this.callParent();
- this.setupListeners(null);
- },
-
- enable: function() {
- this.callParent();
- this.setupListeners();
- },
-
- beforeDrop: Ext.emptyFn,
-
- onDrop: Ext.emptyFn,
-
- onDragEnter: Ext.emptyFn,
-
- onDragLeave: Ext.emptyFn,
-
- onDragMove: Ext.emptyFn,
- updateInvalidCls: function(invalidCls, oldInvalidCls) {
- var info = this.info;
- this.doUpdateCls(info && !info.valid, invalidCls, oldInvalidCls);
- },
- updateValidCls: function(validCls, oldValidCls) {
- var info = this.info;
- this.doUpdateCls(info && info.valid, validCls, oldValidCls);
- },
- destroy: function() {
- Ext.drag.Manager.unregister(this);
- this.callParent();
- },
- privates: {
-
- doUpdateCls: function(needsAdd, cls, oldCls) {
- var el = this.getElement();
- if (oldCls) {
- el.removeCls(oldCls);
- }
- if (cls && needsAdd) {
- el.addCls(cls);
- }
- },
-
- getElListeners: function() {
- return {
- dragenter: 'handleNativeDragEnter',
- dragleave: 'handleNativeDragLeave',
- dragover: 'handleNativeDragMove',
- drop: 'handleNativeDrop'
- };
- },
-
- handleDrop: function(info) {
- var me = this,
- hasListeners = me.hasListeners,
- valid = info.valid;
- me.getElement().removeCls([
- me.getInvalidCls(),
- me.getValidCls()
- ]);
- if (valid && me.beforeDrop(info) !== false) {
- if (hasListeners.beforedrop && me.fireEvent('beforedrop', me, info) === false) {
- return false;
- }
- me.onDrop(info);
- if (hasListeners.drop) {
- me.fireEvent('drop', me, info);
- }
- } else {
- return false;
- }
- },
-
- handleDragEnter: function(info) {
- var me = this,
- cls = info.valid ? me.getValidCls() : me.getInvalidCls();
- if (cls) {
- me.getElement().addCls(cls);
- }
- me.onDragEnter(info);
- if (me.hasListeners.dragenter) {
- me.fireEvent('dragenter', me, info);
- }
- },
-
- handleDragLeave: function(info) {
- var me = this;
- me.getElement().removeCls([
- me.getInvalidCls(),
- me.getValidCls()
- ]);
- me.onDragLeave(info);
- if (me.hasListeners.dragleave) {
- me.fireEvent('dragleave', me, info);
- }
- },
-
- handleDragMove: function(info) {
- var me = this;
- me.onDragMove(info);
- if (me.hasListeners.dragmove) {
- me.fireEvent('dragmove', me, info);
- }
- },
-
- handleNativeDragEnter: function(e) {
- var me = this,
- info = Ext.drag.Manager.getNativeDragInfo(e);
- info.onNativeDragEnter(me, e);
- if (me.hasListeners.dragenter) {
- me.fireEvent('dragenter', me, info);
- }
- },
-
- handleNativeDragLeave: function(e) {
- var me = this,
- info = Ext.drag.Manager.getNativeDragInfo(e);
- info.onNativeDragLeave(me, e);
- if (me.hasListeners.dragleave) {
- me.fireEvent('dragleave', me, info);
- }
- },
-
- handleNativeDragMove: function(e) {
- var me = this,
- info = Ext.drag.Manager.getNativeDragInfo(e);
- info.onNativeDragMove(me, e);
- if (me.hasListeners.dragmove) {
- me.fireEvent('dragmove', me, info);
- }
- },
-
- handleNativeDrop: function(e) {
- var me = this,
- hasListeners = me.hasListeners,
- info = Ext.drag.Manager.getNativeDragInfo(e),
- valid = info.valid;
- info.onNativeDrop(me, e);
- if (valid) {
- if (hasListeners.beforedrop && me.fireEvent('beforedrop', me, info) === false) {
- return;
- }
- if (hasListeners.drop) {
- me.fireEvent('drop', me, info);
- }
- }
- }
- }
- });
- Ext.define('Ext.drag.proxy.None', {
- mixins: [
- Ext.mixin.Factoryable
- ],
- alias: 'drag.proxy.none',
- factoryConfig: {
- aliasPrefix: 'drag.proxy.',
- type: 'dragproxy'
- },
- config: {
- source: null
- },
- constructor: function(config) {
- var getElement = config && config.getElement;
- if (getElement) {
-
-
-
- this.getElement = getElement;
- config = Ext.apply({}, config);
- delete config.getElement;
- }
- this.initConfig(config);
- },
-
- cleanup: Ext.emptyFn,
- dragRevert: function(info, revertCls, options, callback) {
- var positionable = this.getPositionable(info),
- initial = info.proxy.initial;
- positionable.addCls(revertCls);
- positionable.setXY([
- initial.x,
- initial.y
- ], Ext.apply({
- callback: function() {
- positionable.removeCls(revertCls);
- callback();
- }
- }, options));
- },
-
- getElement: function() {
- return null;
- },
- getPositionable: function() {
- return this.element;
- },
- setXY: function(info, xy, animation) {
- var positionable = this.getPositionable(info);
- if (positionable) {
- positionable.setXY(xy, animation);
- }
- },
-
- update: Ext.emptyFn,
- privates: {
- setupElement: function(info) {
- return (this.element = this.getElement(info));
- },
-
- adjustCursorOffset: function(info, pos) {
- return pos;
- }
- }
- });
- Ext.define('Ext.drag.proxy.Original', {
- extend: Ext.drag.proxy.None,
- alias: 'drag.proxy.original',
- getElement: function(info) {
- return info.source.getElement();
- },
- getPositionable: function(info) {
- var source = info.source;
- return source.getComponent() || source.getElement();
- }
- });
- Ext.define('Ext.drag.proxy.Placeholder', {
- extend: Ext.drag.proxy.None,
- alias: 'drag.proxy.placeholder',
- config: {
-
- cls: '',
-
- cursorOffset: [
- 12,
- 20
- ],
-
- html: null,
-
- invalidCls: '',
-
- validCls: ''
- },
- placeholderCls: Ext.baseCSSPrefix + 'drag-proxy-placeholder',
-
- cleanup: function() {
- this.element = Ext.destroy(this.element);
- },
-
- getElement: function() {
- var el = Ext.getBody().createChild({
- cls: this.getCls(),
- html: this.getHtml()
- });
- el.addCls(this.placeholderCls);
- el.setTouchAction({
- panX: false,
- panY: false
- });
- return el;
- },
-
- update: function(info) {
- var el = this.element,
- invalidCls = this.getInvalidCls(),
- validCls = this.getValidCls(),
- valid = info.valid;
- if (info.target) {
-
-
- el.replaceCls(valid ? invalidCls : validCls, valid ? validCls : invalidCls);
- } else {
- el.removeCls([
- invalidCls,
- validCls
- ]);
- }
- },
- updateCls: function(cls, oldCls) {
- var el = this.element;
- if (el) {
- if (oldCls) {
- el.removeCls(oldCls);
- }
- if (cls) {
- el.addCls(cls);
- }
- }
- },
- updateHtml: function(html) {
- var el = this.element;
- if (el) {
- el.setHtml(html || '');
- }
- },
- updateInvalidCls: function(invalidCls, oldInvalidCls) {
- this.doUpdateCls(invalidCls, oldInvalidCls);
- },
- updateValidCls: function(validCls, oldValidCls) {
- this.doUpdateCls(validCls, oldValidCls);
- },
- destroy: function() {
- this.element = Ext.destroy(this.element);
- this.callParent();
- },
- privates: {
-
- adjustCursorOffset: function(info, xy) {
- var offset = this.getCursorOffset();
- if (offset) {
- xy[0] += (offset[0] || 0);
- xy[1] += (offset[1] || 0);
- }
- return xy;
- },
-
- doUpdateCls: function(cls, oldCls) {
- var el = this.element,
- hasCls;
- if (el) {
- if (oldCls) {
- hasCls = cls && el.hasCls(oldCls);
- el.removeCls(oldCls);
- }
- if (cls && hasCls) {
- el.addCls(cls);
- }
- }
- }
- }
- });
- Ext.define('Ext.event.gesture.Recognizer', {
- mixins: [
- Ext.mixin.Identifiable
- ],
-
- priority: 0,
- handledEvents: [],
- isStarted: false,
- config: {
- onRecognized: Ext.emptyFn,
- callbackScope: null
- },
- constructor: function(config) {
- this.initConfig(config);
- Ext.event.publisher.Gesture.instance.registerRecognizer(this);
- },
- onStart: Ext.emptyFn,
- onEnd: Ext.emptyFn,
- onTouchStart: Ext.emptyFn,
- onTouchMove: Ext.emptyFn,
- onTouchEnd: function() {
- return this.reset();
- },
- onTouchCancel: function(e) {
- return this.cancel(e);
- },
- fire: function(eventName, e, info, isCancel) {
- this.getOnRecognized().call(this.getCallbackScope(), this, eventName, e, info, isCancel);
- },
- cancel: function(e) {
- if (this.isStarted) {
-
-
-
- this.onCancel(e);
- }
- return this.reset();
- },
- onCancel: Ext.emptyFn,
- reset: function() {
- this.isStarted = false;
- return false;
- }
- });
- Ext.define('Ext.event.gesture.SingleTouch', {
- extend: Ext.event.gesture.Recognizer,
- isSingleTouch: true,
- onTouchStart: function(e) {
- if (e.touches.length > 1) {
- return this.cancel(e);
- }
- }
- });
- Ext.define('Ext.event.gesture.DoubleTap', {
- extend: Ext.event.gesture.SingleTouch,
- priority: 300,
- config: {
-
- moveDistance: 8,
-
- tapDistance: 24,
- maxDuration: 300
- },
- handledEvents: [
- 'singletap',
- 'doubletap'
- ],
-
-
- singleTapTimer: null,
- startTime: 0,
- lastTapTime: 0,
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]),
- lastStartPoint;
- if (ret !== false) {
- me.isStarted = true;
-
- lastStartPoint = me.lastStartPoint = e.changedTouches[0].point;
-
- me.startPoint = me.startPoint || lastStartPoint;
- me.startTime = e.time;
- Ext.undefer(me.singleTapTimer);
- }
- return ret;
- },
- onTouchMove: function(e) {
- var me = this,
- point = e.changedTouches[0].point,
- scale = Ext.Element.getViewportScale(),
-
- distance = Math.round(Math.abs(point.getDistanceTo(me.lastStartPoint) * scale));
- if (distance >= me.getMoveDistance()) {
- return me.cancel(e);
- }
- },
- onTouchEnd: function(e) {
- var me = this,
- maxDuration = me.getMaxDuration(),
- time = e.time,
- target = e.target,
- lastTapTime = me.lastTapTime,
- lastTarget = me.lastTarget,
- point = e.changedTouches[0].point,
- duration, scale, distance;
- me.lastTapTime = time;
- me.lastTarget = target;
- if (lastTapTime) {
- duration = time - lastTapTime;
- if (duration <= maxDuration) {
- scale = Ext.Element.getViewportScale();
-
- distance = Math.round(Math.abs(point.getDistanceTo(me.startPoint) * scale));
- if (distance <= me.getTapDistance()) {
- if (target !== lastTarget) {
- return me.cancel(e);
- }
- me.lastTarget = null;
- me.lastTapTime = 0;
- me.fire('doubletap', e, {
- touch: e.changedTouches[0],
- duration: duration
- });
- return me.callParent([
- e
- ]);
- }
- }
- }
- if (time - me.startTime > maxDuration) {
- me.fire('singletap', e);
- me.reset();
- } else {
- me.setSingleTapTimer(e);
- }
- },
- setSingleTapTimer: function(e) {
- var me = this;
- me.singleTapTimer = Ext.defer(function() {
- me.fire('singletap', e);
- me.reset();
- }, me.getMaxDuration());
- },
- reset: function() {
- var me = this;
- Ext.undefer(me.singleTapTimer);
- me.startTime = me.lastTapTime = 0;
- me.lastStartPoint = me.startPoint = me.singleTapTimer = null;
- return me.callParent();
- }
- }, function(DoubleTap) {
- var gestures = Ext.manifest.gestures;
- DoubleTap.instance = new DoubleTap(gestures && gestures.doubleTap);
- });
- Ext.define('Ext.event.gesture.Drag', {
- extend: Ext.event.gesture.SingleTouch,
- priority: 100,
- startPoint: null,
- previousPoint: null,
- lastPoint: null,
- handledEvents: [
- 'dragstart',
- 'drag',
- 'dragend',
- 'dragcancel'
- ],
- config: {
-
- minDistance: 8
- },
- constructor: function() {
- this.callParent(arguments);
- this.initInfo();
- },
- initInfo: function() {
- this.info = {
- touch: null,
- previous: {
- x: 0,
- y: 0
- },
- x: 0,
- y: 0,
- delta: {
- x: 0,
- y: 0
- },
- absDelta: {
- x: 0,
- y: 0
- },
- flick: {
- velocity: {
- x: 0,
- y: 0
- }
- },
- direction: {
- x: 0,
- y: 0
- },
- time: 0,
- previousTime: {
- x: 0,
- y: 0
- },
- longpress: false
- };
- },
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]);
- if (ret !== false) {
- me.startTime = e.time;
- me.startPoint = e.changedTouches[0].point;
- }
- return ret;
- },
- tryDragStart: function(e) {
- var me = this,
- point = e.changedTouches[0].point,
- minDistance = me.getMinDistance(),
- scale = Ext.Element.getViewportScale(),
-
- distance = Math.round(Math.abs(point.getDistanceTo(me.startPoint) * scale));
- if (distance >= minDistance) {
- me.doDragStart(e);
- }
- },
- doDragStart: function(e, isLongPress) {
- var me = this,
- touch = e.changedTouches[0],
- point = touch.point,
- info = me.info,
- time;
- if (isLongPress) {
- time = Ext.now();
- me.startTime = time;
- me.startPoint = point;
- info.longpress = true;
- } else {
- time = e.time;
- }
- me.isStarted = true;
- me.previousPoint = me.lastPoint = point;
- me.resetInfo('x', e, touch);
- me.resetInfo('y', e, touch);
- info.time = time;
- me.fire('dragstart', e, info);
- },
- onTouchMove: function(e) {
- var me = this,
- touch, point;
- if (!me.startPoint) {
- return;
- }
- if (!me.isStarted) {
- me.tryDragStart(e);
- }
- if (!me.isStarted) {
- return;
- }
- touch = e.changedTouches[0];
- point = touch.point;
- if (me.lastPoint) {
- me.previousPoint = me.lastPoint;
- }
- me.lastPoint = point;
- me.lastMoveEvent = e;
- me.updateInfo('x', e, touch);
- me.updateInfo('y', e, touch);
- me.info.time = e.time;
- me.fire('drag', e, me.info);
- },
- onAxisDragEnd: function(axis, info) {
- var duration = info.time - info.previousTime[axis];
- if (duration > 0) {
- info.flick.velocity[axis] = (info[axis] - info.previous[axis]) / duration;
- }
- },
- resetInfo: function(axis, e, touch) {
- var me = this,
- value = me.lastPoint[axis],
- startValue = me.startPoint[axis],
- delta = value - startValue,
- capAxis = axis.toUpperCase(),
- info = me.info;
- info.touch = touch;
- info.delta[axis] = delta;
- info.absDelta[axis] = Math.abs(delta);
- info.previousTime[axis] = me.startTime;
- info.previous[axis] = startValue;
- info[axis] = value;
- info.direction[axis] = 0;
- info['start' + capAxis] = me.startPoint[axis];
- info['previous' + capAxis] = info.previous[axis];
- info['page' + capAxis] = info[axis];
- info['delta' + capAxis] = info.delta[axis];
- info['absDelta' + capAxis] = info.absDelta[axis];
- info['previousDelta' + capAxis] = 0;
- info.startTime = me.startTime;
- },
- updateInfo: function(axis, e, touch) {
- var me = this,
- value = me.lastPoint[axis],
- previousValue = me.previousPoint[axis],
- startValue = me.startPoint[axis],
- delta = value - startValue,
- info = me.info,
- direction = info.direction,
- capAxis = axis.toUpperCase(),
- previousFlick = info.previous[axis];
- info.touch = touch;
- info.delta[axis] = delta;
- info.absDelta[axis] = Math.abs(delta);
- if (value !== previousFlick && value !== info[axis]) {
- info.previous[axis] = info[axis];
- info.previousTime[axis] = info.time;
- }
- info[axis] = value;
- if (value > previousValue) {
- direction[axis] = 1;
- } else if (value < previousValue) {
- direction[axis] = -1;
- }
- info['start' + capAxis] = startValue;
- info['previous' + capAxis] = info.previous[axis];
- info['page' + capAxis] = info[axis];
- info['delta' + capAxis] = info.delta[axis];
- info['absDelta' + capAxis] = info.absDelta[axis];
- info['previousDelta' + capAxis] = info.previous[axis] - startValue;
- info.startTime = me.startTime;
- },
- onTouchEnd: function(e) {
- var me = this,
- touch, point, info;
- if (me.isStarted) {
- touch = e.changedTouches[0];
- point = touch.point;
- info = me.info;
- me.lastPoint = point;
- me.updateInfo('x', e, touch);
- me.updateInfo('y', e, touch);
- info.time = e.time;
- me.onAxisDragEnd('x', info);
- me.onAxisDragEnd('y', info);
- me.fire('dragend', e, info);
- }
- return this.callParent([
- e
- ]);
- },
- onCancel: function(e) {
- var me = this,
- touch = e.changedTouches[0],
- info = me.info;
-
-
-
-
-
- if (!e.touches.length) {
- me.lastPoint = touch.point;
- }
- me.updateInfo('x', e, touch);
- me.updateInfo('y', e, touch);
- info.time = e.time;
- me.fire('dragcancel', e, info, true);
- },
- reset: function() {
- var me = this;
- me.lastPoint = me.startPoint = me.previousPoint = me.lastPoint = me.lastMoveEvent = null;
- me.initInfo();
- return me.callParent();
- }
- }, function(Drag) {
- var gestures = Ext.manifest.gestures;
- Drag.instance = new Drag(gestures && gestures.drag);
- });
- Ext.define('Ext.event.gesture.Swipe', {
- extend: Ext.event.gesture.SingleTouch,
- priority: 600,
- handledEvents: [
- 'swipestart',
- 'swipe',
- 'swipecancel'
- ],
-
-
-
- config: {
- minDistance: 80,
- maxOffset: 35,
- maxDuration: 1000
- },
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]),
- touch;
- if (ret !== false) {
- touch = e.changedTouches[0];
- me.startTime = e.time;
- me.isHorizontal = true;
- me.isVertical = true;
- me.startX = touch.pageX;
- me.startY = touch.pageY;
- }
- return ret;
- },
- onTouchMove: function(e) {
- var me = this,
- touch = e.changedTouches[0],
- x = touch.pageX,
- y = touch.pageY,
- deltaX = x - me.startX,
- deltaY = y - me.startY,
- absDeltaX = Math.abs(x - me.startX),
- absDeltaY = Math.abs(y - me.startY),
- duration = e.time - me.startTime,
- minDistance, direction, distance;
-
- if ((absDeltaX === 0 && absDeltaY === 0) || (duration > me.getMaxDuration())) {
- return me.cancel(e);
- }
- if (me.isHorizontal && absDeltaY > me.getMaxOffset()) {
- me.isHorizontal = false;
- }
- if (me.isVertical && absDeltaX > me.getMaxOffset()) {
- me.isVertical = false;
- }
- if (!me.isVertical || !me.isHorizontal) {
- minDistance = me.getMinDistance();
- if (me.isHorizontal && absDeltaX < minDistance) {
- direction = (deltaX < 0) ? 'left' : 'right';
- distance = absDeltaX;
- } else if (me.isVertical && absDeltaY < minDistance) {
- direction = (deltaY < 0) ? 'up' : 'down';
- distance = absDeltaY;
- }
- }
- if (!me.isHorizontal && !me.isVertical) {
- return me.cancel(e);
- }
- if (direction && !me.isStarted) {
- me.isStarted = true;
- me.fire('swipestart', e, {
- touch: touch,
- direction: direction,
- distance: distance,
- duration: duration
- });
- }
- },
- onTouchEnd: function(e) {
- var me = this,
- touch, x, y, deltaX, deltaY, absDeltaX, absDeltaY, minDistance, duration, direction, distance;
- if (me.onTouchMove(e) !== false) {
- touch = e.changedTouches[0];
- x = touch.pageX;
- y = touch.pageY;
- deltaX = x - me.startX;
- deltaY = y - me.startY;
- absDeltaX = Math.abs(deltaX);
- absDeltaY = Math.abs(deltaY);
- minDistance = me.getMinDistance();
- duration = e.time - me.startTime;
- if (me.isVertical && absDeltaY < minDistance) {
- me.isVertical = false;
- }
- if (me.isHorizontal && absDeltaX < minDistance) {
- me.isHorizontal = false;
- }
- if (me.isHorizontal) {
- direction = (deltaX < 0) ? 'left' : 'right';
- distance = absDeltaX;
- } else if (me.isVertical) {
- direction = (deltaY < 0) ? 'up' : 'down';
- distance = absDeltaY;
- }
- me.fire('swipe', e, {
- touch: touch,
- direction: direction,
- distance: distance,
- duration: duration
- });
- }
- return this.callParent([
- e
- ]);
- },
- onCancel: function(e) {
- this.fire('swipecancel', e, null, true);
- },
- reset: function() {
- var me = this;
- me.startTime = me.isHorizontal = me.isVertical = me.startX = me.startY = null;
- return me.callParent();
- }
- }, function(Swipe) {
- var gestures = Ext.manifest.gestures;
- Swipe.instance = new Swipe(gestures && gestures.swipe);
- });
- Ext.define('Ext.event.gesture.EdgeSwipe', {
- extend: Ext.event.gesture.Swipe,
- priority: 500,
- handledEvents: [
- 'edgeswipe',
- 'edgeswipestart',
- 'edgeswipeend',
- 'edgeswipecancel'
- ],
- config: {
- minDistance: 60
- },
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]),
- touch;
- if (ret !== false) {
- touch = e.changedTouches[0];
- me.direction = null;
- me.isHorizontal = true;
- me.isVertical = true;
- me.startX = touch.pageX;
- me.startY = touch.pageY;
- }
- return ret;
- },
- onTouchMove: function(e) {
- var me = this,
- touch = e.changedTouches[0],
- x = touch.pageX,
- y = touch.pageY,
- deltaX = x - me.startX,
- deltaY = y - me.startY,
- absDeltaY = Math.abs(y - me.startY),
- absDeltaX = Math.abs(x - me.startX),
- minDistance = me.getMinDistance(),
- maxOffset = me.getMaxOffset(),
- duration = e.time - me.startTime,
- elementWidth = Ext.Viewport && Ext.Element.getViewportWidth(),
- elementHeight = Ext.Viewport && Ext.Element.getViewportHeight(),
- direction, distance;
-
- if (me.isVertical && absDeltaX > maxOffset) {
- me.isVertical = false;
- }
-
- if (me.isHorizontal && absDeltaY > maxOffset) {
- me.isHorizontal = false;
- }
-
- if (me.isVertical && me.isHorizontal) {
- if (absDeltaY > absDeltaX) {
- me.isHorizontal = false;
- } else {
- me.isVertical = false;
- }
- }
-
- if (me.isHorizontal) {
- direction = (deltaX < 0) ? 'left' : 'right';
- distance = deltaX;
- } else if (me.isVertical) {
- direction = (deltaY < 0) ? 'up' : 'down';
- distance = deltaY;
- }
- direction = me.direction || (me.direction = direction);
-
- if (direction === 'up') {
- distance = deltaY * -1;
- } else if (direction === 'left') {
- distance = deltaX * -1;
- }
- me.distance = distance;
- if (!distance) {
- return me.cancel(e);
- }
- if (!me.isStarted) {
- if ((direction === 'right' && me.startX > minDistance) || (direction === 'down' && me.startY > minDistance) || (direction === 'left' && (elementWidth - me.startX) > minDistance) || (direction === 'up' && (elementHeight - me.startY) > minDistance)) {
- return me.cancel(e);
- }
- me.isStarted = true;
- me.startTime = e.time;
- me.fire('edgeswipestart', e, {
- touch: touch,
- direction: direction,
- distance: distance,
- duration: duration
- });
- } else {
- me.fire('edgeswipe', e, {
- touch: touch,
- direction: direction,
- distance: distance,
- duration: duration
- });
- }
- },
- onTouchEnd: function(e) {
- var me = this,
- duration;
- if (me.onTouchMove(e) !== false) {
- duration = e.time - me.startTime;
- me.fire('edgeswipeend', e, {
- touch: e.changedTouches[0],
- direction: me.direction,
- distance: me.distance,
- duration: duration
- });
- }
- return this.reset();
- },
- onCancel: function(e) {
- this.fire('edgeswipecancel', e, {
- touch: e.changedTouches[0]
- }, true);
- },
- reset: function() {
- var me = this;
- me.direction = me.isHorizontal = me.isVertical = me.startX = me.startY = me.startTime = me.distance = null;
- return me.callParent();
- }
- }, function(EdgeSwipe) {
- var gestures = Ext.manifest.gestures;
- EdgeSwipe.instance = new EdgeSwipe(gestures && gestures.edgeSwipe);
- });
- Ext.define('Ext.event.gesture.LongPress', {
- extend: Ext.event.gesture.SingleTouch,
- priority: 400,
- config: {
- moveDistance: 8,
- minDuration: 1000
- },
- handledEvents: [
- 'longpress',
- 'taphold'
- ],
-
-
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]);
- if (ret !== false) {
- me.startPoint = e.changedTouches[0].point;
- me.setLongPressTimer(e);
- }
- return ret;
- },
- setLongPressTimer: function(e) {
- var me = this;
- Ext.undefer(me.timer);
- me.timer = Ext.defer(me.fireLongPress, me.getMinDuration(), me, [
- e
- ]);
- },
- onTouchMove: function(e) {
- var me = this,
- point = e.changedTouches[0].point,
- scale = Ext.Element.getViewportScale(),
-
- distance = Math.round(Math.abs(point.getDistanceTo(me.startPoint) * scale));
- if (distance >= me.getMoveDistance()) {
- return me.cancel(e);
- }
- },
- reset: function() {
- var me = this;
- me.timer = me.startPoint = Ext.undefer(me.timer);
- return me.callParent();
- },
- fireLongPress: function(e) {
- var me = this,
- info = {
- touch: e.changedTouches[0],
- duration: me.getMinDuration(),
- startDrag: me.startDrag
- };
- this.fire('taphold', e, info);
- this.fire('longpress', e, info);
- this.reset();
- },
-
- startDrag: function() {
-
-
- var dragRecognizer = Ext.event.gesture.Drag.instance,
- touchStartEvent = this.parentEvent;
- dragRecognizer.doDragStart(touchStartEvent, true);
- Ext.event.publisher.Gesture.instance.claimRecognizer(dragRecognizer, touchStartEvent);
- }
- }, function(LongPress) {
- var gestures = Ext.manifest.gestures;
- LongPress.instance = new LongPress(gestures && gestures.longPress);
- });
- Ext.define('Ext.event.gesture.MultiTouch', {
- extend: Ext.event.gesture.Recognizer,
- requiredTouchesCount: 2,
- isTracking: false,
- isMultiTouch: true,
- onTouchStart: function(e) {
- var me = this,
- requiredTouchesCount = me.requiredTouchesCount,
- touches = e.touches,
- touchesCount = touches.length;
- if (touchesCount === requiredTouchesCount) {
- me.isTracking = true;
- } else if (touchesCount > requiredTouchesCount) {
- return me.cancel(e);
- }
- },
- reset: function() {
- this.isTracking = false;
- return this.callParent();
- }
- });
- Ext.define('Ext.event.gesture.Pinch', {
- extend: Ext.event.gesture.MultiTouch,
- priority: 700,
- handledEvents: [
- 'pinchstart',
- 'pinch',
- 'pinchend',
- 'pinchcancel'
- ],
-
-
-
-
- startDistance: 0,
- lastTouches: null,
- onTouchMove: function(e) {
- var me = this,
- touches, firstPoint, secondPoint, distance;
- if (me.isTracking) {
- touches = e.touches;
- firstPoint = touches[0].point;
- secondPoint = touches[1].point;
- distance = firstPoint.getDistanceTo(secondPoint);
- if (distance === 0) {
- return;
- }
- if (!me.isStarted) {
- me.isStarted = true;
- me.startDistance = distance;
- me.fire('pinchstart', e, {
- touches: touches,
- distance: distance,
- scale: 1
- });
- } else {
- me.fire('pinch', e, {
- touches: touches,
- distance: distance,
- scale: distance / me.startDistance
- });
- }
- }
- },
- onTouchEnd: function(e) {
- if (this.isStarted) {
- this.fire('pinchend', e);
- }
- return this.callParent([
- e
- ]);
- },
- onCancel: function(e) {
- this.fire('pinchcancel', e, null, true);
- },
- reset: function() {
- this.lastTouches = null;
- this.startDistance = 0;
- return this.callParent();
- }
- }, function(Pinch) {
- var gestures = Ext.manifest.gestures;
- Pinch.instance = new Pinch(gestures && gestures.pinch);
- });
- Ext.define('Ext.event.gesture.Rotate', {
- extend: Ext.event.gesture.MultiTouch,
- priority: 800,
- handledEvents: [
- 'rotatestart',
- 'rotate',
- 'rotateend',
- 'rotatecancel'
- ],
-
-
-
-
-
- startAngle: 0,
- lastTouches: null,
- lastAngle: null,
- onTouchMove: function(e) {
- var me = this,
- touches, lastAngle, firstPoint, secondPoint, angle, nextAngle, previousAngle, diff;
- if (me.isTracking) {
- touches = e.touches;
- lastAngle = me.lastAngle;
- firstPoint = touches[0].point;
- secondPoint = touches[1].point;
- angle = firstPoint.getAngleTo(secondPoint);
- if (lastAngle !== null) {
- diff = Math.abs(lastAngle - angle);
- nextAngle = angle + 360;
- previousAngle = angle - 360;
- if (Math.abs(nextAngle - lastAngle) < diff) {
- angle = nextAngle;
- } else if (Math.abs(previousAngle - lastAngle) < diff) {
- angle = previousAngle;
- }
- }
- me.lastAngle = angle;
- if (!me.isStarted) {
- me.isStarted = true;
- me.startAngle = angle;
- me.fire('rotatestart', e, {
- touches: touches,
- angle: angle,
- rotation: 0
- });
- } else {
- me.fire('rotate', e, {
- touches: touches,
- angle: angle,
- rotation: angle - me.startAngle
- });
- }
- me.lastTouches = Ext.Array.clone(touches);
- }
- },
- onTouchEnd: function(e) {
- if (this.isStarted) {
- this.fire('rotateend', e);
- }
- return this.callParent([
- e
- ]);
- },
- onCancel: function(e) {
- this.fire('rotatecancel', e, null, true);
- },
- reset: function() {
- var me = this;
- me.lastTouches = me.lastAngle = me.startAngle = null;
- return this.callParent();
- }
- }, function(Rotate) {
- var gestures = Ext.manifest.gestures;
- Rotate.instance = new Rotate(gestures && gestures.rotate);
- });
- Ext.define('Ext.event.gesture.Tap', {
- extend: Ext.event.gesture.SingleTouch,
- priority: 200,
- handledEvents: [
- 'tap',
- 'tapcancel'
- ],
- config: {
-
- moveDistance: 8
- },
- onTouchStart: function(e) {
- var me = this,
- ret = me.callParent([
- e
- ]);
- if (ret !== false) {
- me.isStarted = true;
- me.startPoint = e.changedTouches[0].point;
- }
- return ret;
- },
- onTouchMove: function(e) {
- var me = this,
- point = e.changedTouches[0].point,
- scale = Ext.Element.getViewportScale(),
-
- distance = Math.round(Math.abs(point.getDistanceTo(me.startPoint) * scale));
- if (distance >= me.getMoveDistance()) {
- return me.cancel(e);
- }
- },
- onTouchEnd: function(e) {
- this.fire('tap', e, {
- touch: e.changedTouches[0]
- });
- return this.callParent([
- e
- ]);
- },
- onCancel: function(e) {
- this.fire('tapcancel', e, {
- touch: e.changedTouches[0]
- }, true);
- },
- reset: function() {
- this.startPoint = null;
- return this.callParent();
- }
- }, function(Tap) {
- var gestures = Ext.manifest.gestures;
- Tap.instance = new Tap(gestures && gestures.tap);
- });
- Ext.define('Ext.event.publisher.Focus', {
- extend: Ext.event.publisher.Dom,
- type: 'focus',
- handledEvents: [
- 'focusenter',
- 'focusleave',
- 'focusmove'
- ],
-
-
-
- handledDomEvents: [
- 'focusin',
- 'focusout'
- ],
- publishDelegatedDomEvent: function(e) {
- var me = this,
- relatedTarget = e.relatedTarget;
-
- if (me.$suppressEvents) {
- return;
- }
-
- if (e.type === 'focusout') {
-
-
- if (relatedTarget == null) {
- me.processFocusIn(e, e.target, document.body);
- }
- } else {
-
-
- if (relatedTarget == null || !relatedTarget.tagName) {
- relatedTarget = document.body;
- }
- me.processFocusIn(e, relatedTarget, e.target);
- }
- },
- processFocusIn: function(e, fromElement, toElement) {
- var me = this,
- commonAncestor, node,
- targets = [],
- focusFly = me.focusFly,
- backwards, event, focusEnterEvent;
-
-
- if ((fromElement && focusFly.attach(fromElement).isFocusSuspended()) || (toElement && focusFly.attach(toElement).isFocusSuspended())) {
- return;
- }
- if (toElement.compareDocumentPosition) {
-
- backwards = !!(toElement.compareDocumentPosition(fromElement) & 4);
- }
-
- for (node = fromElement , commonAncestor = Ext.dom.Element.getCommonAncestor(toElement, fromElement, true); node && node !== commonAncestor; node = node.parentNode) {
- targets.push(node);
- }
-
- if (targets.length) {
- event = me.createSyntheticEvent('focusleave', e, fromElement, toElement, fromElement, toElement, backwards);
- me.publish(event, targets);
- if (event.stopped) {
- return;
- }
- }
-
- targets.length = 0;
- for (node = toElement; node && node !== commonAncestor; node = node.parentNode) {
- targets.push(node);
- }
-
- focusEnterEvent = me.createSyntheticEvent('focusenter', e, toElement, fromElement, fromElement, toElement, backwards);
-
- if (targets.length) {
- me.publish(focusEnterEvent, targets);
- if (focusEnterEvent.stopped) {
- return;
- }
- }
-
- targets = me.getPropagatingTargets(commonAncestor);
-
- if (targets.length) {
- event = me.createSyntheticEvent('focusmove', e, toElement, fromElement, fromElement, toElement, backwards);
- me.publish(event, targets);
- if (event.stopped) {
- return;
- }
- }
- if (Ext.GlobalEvents.hasListeners.focus) {
- Ext.GlobalEvents.fireEvent('focus', {
- event: focusEnterEvent,
- toElement: toElement,
- fromElement: fromElement,
- backwards: backwards
- });
- }
- },
- createSyntheticEvent: function(eventName, browserEvent, target, relatedTarget, fromElement, toElement, backwards) {
- var event = new Ext.event.Event(browserEvent);
- event.type = eventName;
- event.relatedTarget = relatedTarget;
- event.target = target;
- event.fromElement = fromElement;
- event.toElement = toElement;
- event.backwards = backwards;
- return event;
- }
- }, function(Focus) {
- var focusTimeout;
- Focus.prototype.focusFly = new Ext.dom.Fly();
- Focus.instance = new Focus();
-
-
- if (!Ext.supports.FocusinFocusoutEvents) {
-
-
- this.override({
- handledDomEvents: [
- 'focus',
- 'blur'
- ],
- publishDelegatedDomEvent: function(e) {
- var me = this,
- targetIsElement;
- me.callSuper([
- e
- ]);
-
- targetIsElement = e.target !== window && e.target !== document;
-
-
- if (e.type === 'blur') {
- if (!targetIsElement) {
-
-
-
-
-
-
- if (e.explicitOriginalTarget === Focus.previousActiveElement) {
-
-
- if (e.target === window) {
- Ext.undefer(focusTimeout);
- focusTimeout = 0;
- me.processFocusIn(e, Focus.previousActiveElement, document.body);
- Focus.previousActiveElement = null;
- }
- }
- } else {
-
-
-
-
- focusTimeout = Ext.defer(function() {
- focusTimeout = 0;
- me.processFocusIn(e, e.target, document.body);
- Focus.previousActiveElement = null;
- }, 1);
-
-
- if (targetIsElement && Ext.cache[e.target.id]) {
- Ext.cache[e.target.id].focusinTimeout = focusTimeout;
- }
- }
- Focus.previousActiveElement = targetIsElement ? e.target : null;
- } else {
- Ext.undefer(focusTimeout);
- focusTimeout = 0;
- me.processFocusIn(e, Focus.previousActiveElement || document.body, targetIsElement ? e.target : document.body);
- }
- }
- });
- Ext.define(null, {
- override: 'Ext.dom.Element',
- destroy: function() {
- if (this.focusinTimeout) {
- Ext.undefer(this.focusinTimeout);
- this.focusinTimeout = null;
- }
- this.callParent();
- }
- });
- }
- });
- Ext.define('Ext.field.InputMask', function(InputMask) {
- return {
- cachedConfig: {
- blank: '_',
- characters: {
- '*': '[A-Za-z0-9]',
- 'a': '[a-z]',
- 'A': '[A-Z]',
- '0': '[0-9]',
- '9': '[0-9]'
- },
- ignoreCase: true
- },
- config: {
-
- pattern: null
- },
- _cached: false,
- _lastEditablePos: null,
- _mask: null,
- statics: {
- active: {},
- from: function(value, existing) {
- var active = InputMask.active,
- ret;
- if (value === null) {
- ret = null;
- } else if (typeof value !== 'string') {
- if (existing && !existing._cached) {
- ret = existing;
- ret.setConfig(value);
- } else {
- ret = new InputMask(value);
- }
- } else if (!(ret = active[value])) {
-
-
-
- if (!(ret = InputMask.cache.remove(value))) {
- ret = new InputMask({
- pattern: value
- });
- }
- active[value] = ret;
- ret._cached = 1;
- } else
- {
-
-
- ++ret._cached;
- }
- return ret;
- }
- },
- constructor: function(config) {
- this.initConfig(config);
- },
- release: function() {
- var me = this,
- cache = InputMask.cache,
- key;
- if (me._cached && !--me._cached) {
- key = me.getPattern();
-
- if (InputMask.active[key] !== me) {
- Ext.raise('Invalid call to InputMask#release (not active)');
- }
- if (cache.map[key]) {
- Ext.raise('Invalid call to InputMask#release (already cached)');
- }
-
- delete InputMask.active[key];
- cache.add(key, me);
- cache.trim(cache.maxSize);
- }
-
- else if (me._cached === 0) {
- Ext.raise('Invalid call to InputMask#release (already released)');
- }
- },
-
- clearRange: function(value, start, len) {
- var me = this,
- blank = me.getBlank(),
- end = start + len,
- n = value.length,
- s = '',
- i, mask, prefixLen;
- if (!blank) {
- prefixLen = me._prefix.length;
- for (i = 0; i < n; ++i) {
- if (i < prefixLen || i < start || i >= end) {
- s += value[i];
- }
- }
- s = me.formatValue(s);
- } else {
- mask = me.getPattern();
- for (i = 0; i < n; ++i) {
- if (i < start || i >= end) {
- s += value[i];
- } else if (me.isFixedChar(i)) {
- s += mask[i];
- } else {
- s += blank;
- }
- }
- }
- return s;
- },
- formatValue: function(value) {
- var me = this,
- blank = me.getBlank(),
- i, length, mask, prefix, s;
- if (!blank) {
- prefix = me._prefix;
- length = prefix.length;
- s = this.insertRange('', value, 0);
- for (i = s.length; i > length && me.isFixedChar(i - 1); ) {
- --i;
- }
- s = (i < length) ? prefix : s.slice(0, i - 1);
- } else if (value) {
- s = me.formatValue('');
- s = me.insertRange(s, value, 0);
- } else {
- mask = me.getPattern();
- s = '';
- for (i = 0 , length = mask.length; i < length; ++i) {
- if (me.isFixedChar(i)) {
- s += mask[i];
- } else {
- s += blank;
- }
- }
- }
- return s;
- },
- getEditPosLeft: function(pos) {
- for (var i = pos; i >= 0; --i) {
- if (!this.isFixedChar(i)) {
- return i;
- }
- }
- return null;
- },
- getEditPosRight: function(pos) {
- var mask = this._mask,
- len = mask.length,
- i;
- for (i = pos; i < len; ++i) {
- if (!this.isFixedChar(i)) {
- return i;
- }
- }
- return null;
- },
- getFilledLength: function(value) {
- var me = this,
- blank = me.getBlank(),
- c, i;
- if (!blank) {
- return value.length;
- }
- for (i = value && value.length; i-- > 0; ) {
- c = value[i];
- if (!me.isFixedChar(i) && me.isAllowedChar(c, i)) {
- break;
- }
- }
- return ++i || me._prefix.length;
- },
- getSubLength: function(value, substr, pos) {
- var me = this,
- mask = me.getPattern(),
- k = 0,
- maskLen = mask.length,
- substrLen = substr.length,
- i;
- for (i = pos; i < maskLen && k < substrLen; ) {
- if (!me.isFixedChar(i) || mask[i] === substr[k]) {
- if (me.isAllowedChar(substr[k++], i, true)) {
- ++i;
- }
- } else {
- ++i;
- }
- }
- return i - pos;
- },
- insertRange: function(value, substr, pos) {
- var me = this,
- mask = me.getPattern(),
- blank = me.getBlank(),
- filled = me.isFilled(value),
- prefixLen = me._prefix.length,
- maskLen = mask.length,
- substrLen = substr.length,
- s = value,
- ch, fixed, i, k;
- if (!blank && pos > s.length) {
- s += mask.slice(s.length, pos);
- }
- for (i = pos , k = 0; i < maskLen && k < substrLen; ) {
- fixed = me.isFixedChar(i);
- if (!fixed || mask[i] === substr[k]) {
- ch = substr[k++];
- if (me.isAllowedChar(ch, i, true)) {
- if (i < s.length) {
- if (blank || filled || i < prefixLen) {
- s = s.slice(0, i) + ch + s.slice(i + 1);
- } else {
- s = me.formatValue(s.substr(0, i) + ch + s.substr(i));
- }
- } else if (!blank) {
- s += ch;
- }
- ++i;
- }
- } else {
- if (!blank && i >= s.length) {
- s += mask[i];
- } else if (blank && fixed && substr[k] === blank) {
- ++k;
- }
- ++i;
- }
- }
- return s;
- },
- isAllowedChar: function(character, pos, allowBlankChar) {
- var me = this,
- mask = me.getPattern(),
- c, characters, rule;
- if (me.isFixedChar(pos)) {
- return mask[pos] === character;
- }
- c = mask[pos];
- characters = me.getCharacters();
- rule = characters[c];
- return !rule || rule.test(character || '') || (allowBlankChar && character === me.getBlank());
- },
- isEmpty: function(value) {
- for (var i = 0,
- len = value.length; i < len; ++i) {
- if (!this.isFixedChar(i) && this.isAllowedChar(value[i], i)) {
- return false;
- }
- }
- return true;
- },
-
-
- isFilled: function(value) {
- return this.getFilledLength(value) === this._mask.length;
- },
- isFixedChar: function(pos) {
- return Ext.Array.indexOf(this._fixedCharPositions, pos) > -1;
- },
- setCaretToEnd: function(field, value) {
- var filledLen = this.getFilledLength(value),
- pos = this.getEditPosRight(filledLen);
- if (pos !== null) {
-
-
-
-
- Ext.raf(function() {
- if (!field.destroyed) {
- field.setCaretPos(pos);
- Ext.raf(function() {
- if (!field.destroyed) {
- field.setCaretPos(pos);
- }
- });
- }
- });
- }
- },
-
-
- onBlur: function(field, value) {
- if (field.getAutoHideInputMask() !== false) {
- if (this.isEmpty(value)) {
- field.maskProcessed = true;
- field.setValue('');
- }
- }
- },
- onFocus: function(field, value) {
-
-
- if (field.getAutoHideInputMask() !== false) {
- if (!value) {
- field.maskProcessed = true;
- field.setValue(this._mask);
- }
- }
- this.setCaretToEnd(field, value);
- },
- onChange: function(field, value, oldValue) {
- var me = this,
- s;
- if (field.maskProcessed || value === oldValue) {
- field.maskProcessed = false;
- return true;
- }
- if (value) {
- s = me.formatValue(value);
- field.maskProcessed = true;
- field.setValue(s);
- }
- },
- processAutocomplete: function(field, value) {
- var me = this,
- s;
- if (value) {
- if (value.length > me._mask.length) {
- value = value.substr(0, me._mask.length);
- }
- s = me.formatValue(value);
- field.maskProcessed = true;
- field.inputElement.dom.value = s;
-
- field.setValue(s);
- this.setCaretToEnd(field, value);
- }
- },
-
- showEmptyMask: function(field, adjustCaret) {
- var s = this.formatValue();
- field.maskProcessed = true;
- field.setValue(s);
- if (adjustCaret) {
- this.setCaretToEnd(field);
- }
- },
- onKeyDown: function(field, value, event) {
- if (event.ctrlKey || event.metaKey) {
- return;
- }
- var me = this,
-
- key = event.keyCode === event.DELETE,
- del = key === 'Delete',
- handled = del || (event.keyCode === event.BACKSPACE),
- s = value,
- caret, editPos, len, prefixLen, textSelection, start;
- if (handled) {
- caret = field.getCaretPos();
- prefixLen = me._prefix.length;
- textSelection = field.getTextSelection();
- start = textSelection[0];
- len = textSelection[1] - start;
- if (len) {
- s = me.clearRange(value, start, len);
- } else if (caret < prefixLen || (!del && caret === prefixLen)) {
- caret = prefixLen;
- } else {
- editPos = del ? me.getEditPosRight(caret) : me.getEditPosLeft(caret - 1);
- if (editPos !== null) {
- s = me.clearRange(value, editPos, 1);
- caret = editPos;
- }
- }
- if (s !== value) {
- field.maskProcessed = true;
- field.setValue(s);
- }
- event.preventDefault();
- field.setCaretPos(caret);
- }
- },
- onKeyPress: function(field, value, event) {
- var me = this,
- key = event.keyCode,
- ch = event.getChar(),
- mask = me.getPattern(),
- prefixLen = me._prefix.length,
- s = value,
- caretPos, pos, start, textSelection;
- if (key === event.ENTER || key === event.TAB || event.ctrlKey || event.metaKey) {
- return;
- }
-
- caretPos = field.getCaretPos();
- textSelection = field.getTextSelection();
- if (me.isFixedChar(caretPos) && mask[caretPos] === ch) {
- s = me.insertRange(s, ch, caretPos);
- ++caretPos;
- } else {
- pos = me.getEditPosRight(caretPos);
- if (pos !== null && me.isAllowedChar(ch, pos)) {
- start = textSelection[0];
- s = me.clearRange(s, start, textSelection[1] - start);
- s = me.insertRange(s, ch, pos);
- caretPos = pos + 1;
- }
- }
- if (s !== value) {
- field.maskProcessed = true;
- field.setValue(s);
- }
- event.preventDefault();
- if (caretPos < me._lastEditablePos && caretPos > prefixLen) {
- caretPos = me.getEditPosRight(caretPos);
- }
- field.setCaretPos(caretPos);
- },
- onPaste: function(field, value, event) {
-
-
- var text,
- clipdData = event.browserEvent.clipboardData;
- if (clipdData && clipdData.getData) {
- text = clipdData.getData('text/plain');
- } else if (Ext.global.clipboardData && Ext.global.clipboardData.getData) {
- text = Ext.global.clipboardData.getData('Text');
- }
-
- if (text) {
- this.paste(field, value, text, field.getTextSelection());
- }
- event.preventDefault();
- },
- paste: function(field, value, text, selection) {
- var me = this,
- caretPos = selection[0],
- len = selection[1] - caretPos,
- s = len ? me.clearRange(value, caretPos, len) : value,
- textLen = me.getSubLength(s, text, caretPos);
- s = me.insertRange(s, text, caretPos);
- caretPos += textLen;
- caretPos = me.getEditPosRight(caretPos) || caretPos;
- if (s !== value) {
- field.maskProcessed = true;
- field.setValue(s);
- }
- field.setCaretPos(caretPos);
- },
- syncPattern: function(field) {
- var fieldValue = field.getValue(),
- s;
- if (field.getAutoHideInputMask() === false) {
-
- if (!fieldValue) {
- this.showEmptyMask(field);
- } else {
-
- s = this.formatValue(fieldValue);
- field.maskProcessed = true;
- field.setValue(s);
- }
- } else {
-
-
- if (fieldValue) {
- s = this.formatValue(fieldValue);
- field.maskProcessed = true;
- field.setValue(s);
- }
- }
- },
-
-
- applyCharacters: function(map) {
- var ret = {},
- flags = this.getIgnoreCase() ? 'i' : '',
- c, v;
- for (c in map) {
- v = map[c];
- if (typeof v === 'string') {
- v = new RegExp(v, flags);
- }
- ret[c] = v;
- }
- return ret;
- },
- updatePattern: function(mask) {
- var me = this,
- characters = me.getCharacters(),
- lastEditablePos = 0,
- n = mask && mask.length,
- blank = me.getBlank(),
- fixedPosArr = [],
- prefix = '',
- str = '',
- c, i;
- for (i = 0; i < n; ++i) {
- c = mask[i];
- if (!characters[c]) {
- fixedPosArr.push(str.length);
- str += c;
- } else {
- lastEditablePos = str.length + 1;
- str += blank;
- }
- }
- me._lastEditablePos = lastEditablePos;
- me._mask = str;
- me._fixedCharPositions = fixedPosArr;
-
- for (i = 0; i < str.length && me.isFixedChar(i); ++i) {
- prefix += str[i];
- }
- me._prefix = prefix;
- }
- };
- }, function(InputMask) {
- InputMask.cache = new Ext.util.LRU();
- InputMask.cache.maxSize = 100;
- });
- Ext.define('Ext.fx.runner.Css', {
- extend: Ext.Evented,
- prefixedProperties: {
- 'transform': true,
- 'transform-origin': true,
- 'perspective': true,
- 'transform-style': true,
- 'transition': true,
- 'transition-property': true,
- 'transition-duration': true,
- 'transition-timing-function': true,
- 'transition-delay': true,
- 'animation': true,
- 'animation-name': true,
- 'animation-duration': true,
- 'animation-iteration-count': true,
- 'animation-direction': true,
- 'animation-timing-function': true,
- 'animation-delay': true
- },
- lengthProperties: {
- 'top': true,
- 'right': true,
- 'bottom': true,
- 'left': true,
- 'width': true,
- 'height': true,
- 'max-height': true,
- 'max-width': true,
- 'min-height': true,
- 'min-width': true,
- 'margin-bottom': true,
- 'margin-left': true,
- 'margin-right': true,
- 'margin-top': true,
- 'padding-bottom': true,
- 'padding-left': true,
- 'padding-right': true,
- 'padding-top': true,
- 'border-bottom-width': true,
- 'border-left-width': true,
- 'border-right-width': true,
- 'border-spacing': true,
- 'border-top-width': true,
- 'border-width': true,
- 'outline-width': true,
- 'letter-spacing': true,
- 'line-height': true,
- 'text-indent': true,
- 'word-spacing': true,
- 'font-size': true,
- 'translate': true,
- 'translateX': true,
- 'translateY': true,
- 'translateZ': true,
- 'translate3d': true,
- 'x': true,
- 'y': true
- },
- durationProperties: {
- 'transition-duration': true,
- 'transition-delay': true,
- 'animation-duration': true,
- 'animation-delay': true
- },
- angleProperties: {
- rotate: true,
- rotateX: true,
- rotateY: true,
- rotateZ: true,
- skew: true,
- skewX: true,
- skewY: true
- },
- DEFAULT_UNIT_LENGTH: 'px',
- DEFAULT_UNIT_ANGLE: 'deg',
- DEFAULT_UNIT_DURATION: 'ms',
- customProperties: {
- x: true,
- y: true
- },
- formattedNameCache: {
- 'x': 'left',
- 'y': 'top'
- },
- transformMethods3d: [
- 'translateX',
- 'translateY',
- 'translateZ',
- 'rotate',
- 'rotateX',
- 'rotateY',
- 'rotateZ',
- 'skewX',
- 'skewY',
- 'scaleX',
- 'scaleY',
- 'scaleZ'
- ],
- transformMethodsNo3d: [
- 'translateX',
- 'translateY',
- 'rotate',
- 'skewX',
- 'skewY',
- 'scaleX',
- 'scaleY'
- ],
- constructor: function() {
- var me = this;
- me.transformMethods = Ext.feature.has.Css3dTransforms ? me.transformMethods3d : me.transformMethodsNo3d;
- me.vendorPrefix = Ext.browser.getStyleDashPrefix();
- me.ruleStylesCache = {};
- me.callParent();
- },
- getStyleSheet: function() {
- var styleSheet = this.styleSheet,
- styleElement, styleSheets;
- if (!styleSheet) {
- styleElement = document.createElement('style');
- styleElement.type = 'text/css';
- (document.head || document.getElementsByTagName('head')[0]).appendChild(styleElement);
- styleSheets = document.styleSheets;
- this.styleSheet = styleSheet = styleSheets[styleSheets.length - 1];
- }
- return styleSheet;
- },
- applyRules: function(selectors) {
- var styleSheet = this.getStyleSheet(),
- ruleStylesCache = this.ruleStylesCache,
- rules = styleSheet.cssRules,
- selector, properties, ruleStyle, ruleStyleCache, rulesLength, name, value;
- for (selector in selectors) {
- properties = selectors[selector];
- ruleStyle = ruleStylesCache[selector];
- if (ruleStyle === undefined) {
- rulesLength = rules.length;
- styleSheet.insertRule(selector + '{}', rulesLength);
- ruleStyle = ruleStylesCache[selector] = rules.item(rulesLength).style;
- }
- ruleStyleCache = ruleStyle.$cache;
- if (!ruleStyleCache) {
- ruleStyleCache = ruleStyle.$cache = {};
- }
- for (name in properties) {
- value = this.formatValue(properties[name], name);
- name = this.formatName(name);
- if (ruleStyleCache[name] !== value) {
- ruleStyleCache[name] = value;
- if (value === null) {
- ruleStyle.removeProperty(name);
- } else {
- ruleStyle.setProperty(name, value);
- }
- }
- }
- }
- return this;
- },
- applyStyles: function(styles) {
- var id, element, elementStyle, properties, name, value;
- for (id in styles) {
- if (styles.hasOwnProperty(id)) {
- this.activeElement = element = document.getElementById(id);
- if (!element) {
-
- continue;
- }
- elementStyle = element.style;
- properties = styles[id];
- for (name in properties) {
- if (properties.hasOwnProperty(name)) {
- value = this.formatValue(properties[name], name);
- name = this.formatName(name);
- if (value === null) {
- elementStyle.removeProperty(name);
- } else {
- elementStyle.setProperty(name, value);
- }
- }
- }
- }
- }
- this.activeElement = null;
- return this;
- },
- formatName: function(name) {
- var cache = this.formattedNameCache,
- formattedName = cache[name];
- if (!formattedName) {
- if ((Ext.os.is.Tizen || !Ext.feature.has.CssTransformNoPrefix) && this.prefixedProperties[name]) {
- formattedName = this.vendorPrefix + name;
- } else {
- formattedName = name;
- }
- cache[name] = formattedName;
- }
- return formattedName;
- },
- formatValue: function(value, name) {
- var type = typeof value,
- defaultLengthUnit = this.DEFAULT_UNIT_LENGTH,
- isCustom = this.customProperties[name],
- transformMethods, method, i, ln, transformValues, values;
- if (value === null) {
- return '';
- }
- if (type === 'string') {
- if (this.lengthProperties[name]) {
- if (!Ext.dom.Element.hasUnit(value)) {
- value = value + defaultLengthUnit;
- if (isCustom) {
- value = this.getCustomValue(value, name);
- }
- }
- }
- return value;
- } else if (type === 'number') {
- if (value === 0) {
- return '0';
- }
- if (this.lengthProperties[name]) {
- value = value + defaultLengthUnit;
- if (isCustom) {
- value = this.getCustomValue(value, name);
- }
- return value;
- }
- if (this.angleProperties[name]) {
- return value + this.DEFAULT_UNIT_ANGLE;
- }
- if (this.durationProperties[name]) {
- return value + this.DEFAULT_UNIT_DURATION;
- }
- } else if (name === 'transform') {
- transformMethods = this.transformMethods;
- transformValues = [];
- for (i = 0 , ln = transformMethods.length; i < ln; i++) {
- method = transformMethods[i];
- transformValues.push(method + '(' + this.formatValue(value[method], method) + ')');
- }
- return transformValues.join(' ');
- } else if (Ext.isArray(value)) {
- values = [];
- for (i = 0 , ln = value.length; i < ln; i++) {
- values.push(this.formatValue(value[i], name));
- }
- return (values.length > 0) ? values.join(', ') : 'none';
- }
- return value;
- },
- getCustomValue: function(value, name) {
- var el = Ext.fly(this.activeElement);
- if (name === 'x') {
- value = el.translateXY(parseInt(value, 10)).x;
- } else if (name === 'y') {
- value = el.translateXY(null, parseInt(value, 10)).y;
- }
- return value + this.DEFAULT_UNIT_LENGTH;
- }
- });
- Ext.define('Ext.fx.runner.CssTransition', {
- extend: Ext.fx.runner.Css,
- alternateClassName: 'Ext.Animator',
- singleton: true,
- listenersAttached: false,
- constructor: function() {
- this.runningAnimationsData = {};
-
-
- this.transitionQueue = {
- toData: {},
- transitionData: {}
- };
- return this.callParent(arguments);
- },
- attachListeners: function() {
- this.listenersAttached = true;
- Ext.getWin().on('transitionend', 'onTransitionEnd', this);
- },
- onTransitionEnd: function(e) {
- var target = e.target,
- id = target.id;
- if (id && this.runningAnimationsData.hasOwnProperty(id)) {
- this.refreshRunningAnimationsData(Ext.get(target), [
- e.browserEvent.propertyName
- ]);
- }
- },
- getElementId: function(element) {
-
- return element.getId ? element.getId() : element.id;
- },
- onAnimationEnd: function(element, data, animation, isInterrupted, isReplaced) {
- var id = this.getElementId(element),
- runningData = this.runningAnimationsData[id],
- endRules = {},
- endData = {},
- runningNameMap, toPropertyNames, i, ln, name;
- animation.un('stop', 'onAnimationStop', this);
- if (runningData) {
- runningNameMap = runningData.nameMap;
- }
- endRules[id] = endData;
- if (data.onBeforeEnd) {
- data.onBeforeEnd.call(data.scope || this, element, isInterrupted);
- }
- animation.fireEvent('animationbeforeend', animation, element, isInterrupted);
- this.fireEvent('animationbeforeend', this, animation, element, isInterrupted);
- if (isReplaced || (!isInterrupted && !data.preserveEndState)) {
- toPropertyNames = data.toPropertyNames;
- for (i = 0 , ln = toPropertyNames.length; i < ln; i++) {
- name = toPropertyNames[i];
- if (runningNameMap && !runningNameMap.hasOwnProperty(name)) {
- endData[name] = null;
- }
- }
- }
- if (data.after) {
- Ext.merge(endData, data.after);
- }
- this.applyStyles(endRules);
- if (data.onEnd) {
- data.onEnd.call(data.scope || this, element, isInterrupted);
- }
- animation.fireEvent('animationend', animation, element, isInterrupted);
- this.fireEvent('animationend', this, animation, element, isInterrupted);
- Ext.AnimationQueue.stop(Ext.emptyFn, animation);
- },
- onAllAnimationsEnd: function(element) {
- var id = this.getElementId(element),
- transitionQueue = this.transitionQueue,
- endRules = {};
- delete this.runningAnimationsData[id];
- endRules[id] = {
- 'transition-property': null,
- 'transition-duration': null,
- 'transition-timing-function': null,
- 'transition-delay': null
- };
- delete transitionQueue.toData[id];
- delete transitionQueue.transitionData[id];
- this.applyStyles(endRules);
- this.fireEvent('animationallend', this, element);
- },
- hasRunningAnimations: function(element) {
- var id = this.getElementId(element),
- runningAnimationsData = this.runningAnimationsData;
- return runningAnimationsData.hasOwnProperty(id) && runningAnimationsData[id].sessions.length > 0;
- },
- refreshRunningAnimationsData: function(element, propertyNames, interrupt, replace) {
- var id = this.getElementId(element),
- runningAnimationsData = this.runningAnimationsData,
- runningData = runningAnimationsData[id];
- if (!runningData) {
- return;
- }
- var nameMap = runningData.nameMap,
- nameList = runningData.nameList,
- sessions = runningData.sessions,
- ln, j, subLn, name, i, session, map, list,
- hasCompletedSession = false;
- interrupt = Boolean(interrupt);
- replace = Boolean(replace);
- if (!sessions) {
- return this;
- }
- ln = sessions.length;
- if (ln === 0) {
- return this;
- }
- if (replace) {
- runningData.nameMap = {};
- nameList.length = 0;
- for (i = 0; i < ln; i++) {
- session = sessions[i];
- this.onAnimationEnd(element, session.data, session.animation, interrupt, replace);
- }
- sessions.length = 0;
- } else {
- for (i = 0; i < ln; i++) {
- session = sessions[i];
- map = session.map;
- list = session.list;
- for (j = 0 , subLn = propertyNames.length; j < subLn; j++) {
- name = propertyNames[j];
- if (map[name]) {
- delete map[name];
- Ext.Array.remove(list, name);
- session.length--;
- if (--nameMap[name] == 0) {
- delete nameMap[name];
- Ext.Array.remove(nameList, name);
- }
- }
- }
- if (session.length == 0) {
- sessions.splice(i, 1);
- i--;
- ln--;
- hasCompletedSession = true;
- this.onAnimationEnd(element, session.data, session.animation, interrupt);
- }
- }
- }
- if (!replace && !interrupt && sessions.length == 0 && hasCompletedSession) {
- this.onAllAnimationsEnd(element);
- }
- },
- getRunningData: function(id) {
- var runningAnimationsData = this.runningAnimationsData;
- if (!runningAnimationsData.hasOwnProperty(id)) {
- runningAnimationsData[id] = {
- nameMap: {},
- nameList: [],
- sessions: []
- };
- }
- return runningAnimationsData[id];
- },
- getTestElement: function() {
- var me = this,
- testElement = me.testElement,
- iframe = me.iframe,
- iframeDocument, iframeStyle;
- if (testElement) {
-
-
-
- if (testElement.ownerDocument.defaultView !== iframe.contentWindow) {
- iframeDocument = iframe.contentDocument;
- iframeDocument.body.appendChild(testElement);
- me.testElementComputedStyle = iframeDocument.defaultView.getComputedStyle(testElement);
- }
- } else {
- iframe = me.iframe = document.createElement('iframe');
-
-
-
- iframe.setAttribute('data-sticky', true);
-
- iframe.setAttribute('tabIndex', -1);
- iframeStyle = iframe.style;
- iframeStyle.setProperty('visibility', 'hidden', 'important');
- iframeStyle.setProperty('width', '0px', 'important');
- iframeStyle.setProperty('height', '0px', 'important');
- iframeStyle.setProperty('position', 'absolute', 'important');
- iframeStyle.setProperty('border', '0px', 'important');
- iframeStyle.setProperty('zIndex', '-1000', 'important');
- document.body.appendChild(iframe);
- iframeDocument = iframe.contentDocument;
- iframeDocument.open();
- iframeDocument.writeln('</body>');
- iframeDocument.close();
- me.testElement = testElement = iframeDocument.createElement('div');
- testElement.style.setProperty('position', 'absolute', 'important');
- iframeDocument.body.appendChild(testElement);
- me.testElementComputedStyle = iframeDocument.defaultView.getComputedStyle(testElement);
- }
- return testElement;
- },
- getCssStyleValue: function(name, value) {
- var testElement = this.getTestElement(),
- computedStyle = this.testElementComputedStyle,
- style = testElement.style;
- style.setProperty(name, value);
- if (Ext.browser.is.Firefox) {
-
- testElement.offsetHeight;
- }
- value = computedStyle.getPropertyValue(name);
- style.removeProperty(name);
- return value;
- },
- run: function(animations) {
- var me = this,
- ret = [],
- isLengthPropertyMap = me.lengthProperties,
- fromData = {},
- toData = me.transitionQueue.toData,
- data = {},
- transitionData = me.transitionQueue.transitionData,
- element, elementId, from, to, before, fromPropertyNames, toPropertyNames, doApplyTo, message, runningData, elementData, i, j, ln, animation, propertiesLength, sessionNameMap, computedStyle, formattedName, name, toFormattedValue, computedValue, fromFormattedValue, isLengthProperty, runningNameMap, runningNameList, runningSessions, runningSession, messageTimerFn, onBeforeStart;
- if (!me.listenersAttached) {
- me.attachListeners();
- }
- animations = Ext.Array.from(animations);
- for (i = 0 , ln = animations.length; i < ln; i++) {
- animation = animations[i];
- animation = Ext.factory(animation, Ext.fx.Animation);
- ret.push(animation);
- me.activeElement = element = animation.getElement();
-
- Ext.AnimationQueue.start(Ext.emptyFn, animation);
- computedStyle = window.getComputedStyle(element.dom);
- elementId = me.getElementId(element);
- data[elementId] = data = Ext.merge({}, animation.getData());
- onBeforeStart = animation.getOnBeforeStart();
- if (onBeforeStart) {
- onBeforeStart.call(animation.scope || me, element);
- }
-
- animation.fireEvent('animationstart', animation, data);
- me.fireEvent('animationstart', me, animation, data);
- before = data.before;
- from = data.from;
- to = data.to;
- data.fromPropertyNames = fromPropertyNames = [];
- data.toPropertyNames = toPropertyNames = [];
- for (name in to) {
- if (to.hasOwnProperty(name)) {
- to[name] = toFormattedValue = me.formatValue(to[name], name);
- formattedName = me.formatName(name);
- isLengthProperty = isLengthPropertyMap.hasOwnProperty(name);
- if (!isLengthProperty) {
- toFormattedValue = me.getCssStyleValue(formattedName, toFormattedValue);
- }
- if (from.hasOwnProperty(name)) {
- from[name] = fromFormattedValue = me.formatValue(from[name], name);
- if (!isLengthProperty) {
- fromFormattedValue = me.getCssStyleValue(formattedName, fromFormattedValue);
- }
- if (toFormattedValue !== fromFormattedValue) {
- fromPropertyNames.push(formattedName);
- toPropertyNames.push(formattedName);
- }
- } else {
- computedValue = computedStyle.getPropertyValue(formattedName);
- if (toFormattedValue !== computedValue) {
- toPropertyNames.push(formattedName);
- }
- }
- }
- }
- propertiesLength = toPropertyNames.length;
- if (propertiesLength === 0) {
- me.onAnimationEnd(element, data, animation);
-
- continue;
- }
- runningData = me.getRunningData(elementId);
- runningSessions = runningData.sessions;
- if (runningSessions.length > 0) {
- me.refreshRunningAnimationsData(element, Ext.Array.merge(fromPropertyNames, toPropertyNames), true, data.replacePrevious);
- }
- runningNameMap = runningData.nameMap;
- runningNameList = runningData.nameList;
- sessionNameMap = {};
- for (j = 0; j < propertiesLength; j++) {
- name = toPropertyNames[j];
- sessionNameMap[name] = true;
- if (!runningNameMap.hasOwnProperty(name)) {
- runningNameMap[name] = 1;
- runningNameList.push(name);
- } else {
- runningNameMap[name]++;
- }
- }
- runningSession = {
- element: element,
- map: sessionNameMap,
- list: toPropertyNames.slice(),
- length: propertiesLength,
- data: data,
- animation: animation
- };
- runningSessions.push(runningSession);
- animation.on('stop', 'onAnimationStop', me);
- elementData = Ext.apply({}, before);
- Ext.apply(elementData, from);
- if (runningNameList.length > 0) {
- fromPropertyNames = Ext.Array.difference(runningNameList, fromPropertyNames);
- toPropertyNames = Ext.Array.merge(fromPropertyNames, toPropertyNames);
- elementData['transition-property'] = fromPropertyNames;
- }
- fromData[elementId] = elementData;
- toData[elementId] = Ext.apply({}, to);
- transitionData[elementId] = {
- 'transition-property': toPropertyNames,
- 'transition-duration': data.duration,
- 'transition-timing-function': data.easing,
- 'transition-delay': data.delay
- };
- animation.startTime = Date.now();
- }
- me.activeElement = null;
- message = me.$className;
- me.applyStyles(fromData);
- doApplyTo = function(e) {
- if (e.data === message && e.source === window) {
- window.removeEventListener('message', doApplyTo, false);
- me.applyStyles(me.transitionQueue.toData);
- }
- };
- if (!me.messageTimerId) {
- messageTimerFn = function() {
- var messageFollowupFn;
- me.messageTimerId = null;
- if (Ext.isIE) {
-
-
-
-
-
-
- me.applyStyles(me.transitionQueue.transitionData);
- if (!me.messageFollowupId) {
- messageFollowupFn = function() {
- me.messageFollowupId = null;
- window.addEventListener('message', doApplyTo, false);
- window.postMessage(message, '*');
- };
-
- messageFollowupFn.$skipTimerCheck = true;
-
- me.messageFollowupId = Ext.raf(messageFollowupFn);
- }
- } else {
-
-
- Ext.merge(me.transitionQueue.toData, me.transitionQueue.transitionData);
- window.addEventListener('message', doApplyTo, false);
- window.postMessage(message, '*');
- }
- };
-
- messageTimerFn.$skipTimerCheck = true;
-
- me.messageTimerId = Ext.raf(messageTimerFn);
- }
-
-
-
- return ret;
- },
- onAnimationStop: function(animation) {
- var me = this,
- runningAnimationsData = me.runningAnimationsData,
- activeAnimations = 0,
- stoppedAnimations = 0,
- id, runningData, sessions, i, ln, session;
- for (id in runningAnimationsData) {
- if (runningAnimationsData.hasOwnProperty(id)) {
- runningData = runningAnimationsData[id];
- sessions = runningData.sessions;
- activeAnimations++;
- for (i = 0 , ln = sessions.length; i < ln; i++) {
- session = sessions[i];
- if (session.animation === animation) {
- me.refreshRunningAnimationsData(session.element, session.list.slice(), false);
- if (animation.destroying) {
- stoppedAnimations++;
- }
- }
- }
- }
- }
- if (activeAnimations === stoppedAnimations) {
- if (me.messageFollowupId) {
- Ext.unraf(me.messageFollowupId);
- me.messageFollowupId = null;
- }
- if (me.messageTimerId) {
- Ext.unraf(me.messageTimerId);
- me.messageTimerId = null;
- }
- Ext.apply(me.transitionQueue, {
- toData: {},
- transitionData: {}
- });
- }
- }
- });
- Ext.define('Ext.fx.Runner', {
-
- constructor: function() {
- return new Ext.fx.runner.CssTransition();
- }
- });
- Ext.define('Ext.fx.animation.Cube', {
- extend: Ext.fx.animation.Abstract,
- alias: 'animation.cube',
- config: {
-
- before: {},
-
- after: {},
-
- direction: 'right',
- out: false
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getData: function() {
- var to = this.getTo(),
- from = this.getFrom(),
- before = this.getBefore(),
- after = this.getAfter(),
- out = this.getOut(),
- direction = this.getDirection(),
- el = this.getElement(),
- elW = el.getWidth(),
- elH = el.getHeight(),
- origin = out ? '100% 100%' : '0% 0%',
- fromOpacity = 1,
- toOpacity = 1,
- transformFrom = {
- rotateY: 0,
- translateZ: 0
- },
- transformTo = {
- rotateY: 0,
- translateZ: 0
- };
- if (direction == "left" || direction == "right") {
- if (out) {
- toOpacity = 0.5;
- transformTo.translateZ = elW;
- transformTo.rotateY = -90;
- } else {
- fromOpacity = 0.5;
- transformFrom.translateZ = elW;
- transformFrom.rotateY = 90;
- }
- }
- before['transform-origin'] = origin;
- after['transform-origin'] = null;
- to.set('transform', transformTo);
- from.set('transform', transformFrom);
- from.set('opacity', fromOpacity);
- to.set('opacity', toOpacity);
- return this.callParent(arguments);
- }
- });
- Ext.define('Ext.fx.animation.Wipe', {
- extend: Ext.fx.Animation,
- alternateClassName: 'Ext.fx.animation.WipeIn',
- config: {
-
- easing: 'ease-out',
-
- direction: 'right',
-
- out: false
- },
- refresh: function() {
- var me = this,
- el = me.getElement(),
- elBox = el.dom.getBoundingClientRect(),
- elWidth = elBox.width,
- elHeight = elBox.height,
- from = me.getFrom(),
- to = me.getTo(),
- out = me.getOut(),
- direction = me.getDirection(),
- maskFromX = 0,
- maskFromY = 0,
- maskToX = 0,
- maskToY = 0,
- mask, tmp;
- switch (direction) {
- case 'up':
- if (out) {
- mask = '-webkit-gradient(linear, left top, left bottom, from(#000), to(transparent), color-stop(33%, #000), color-stop(66%, transparent))';
- maskFromY = elHeight * 3 + 'px';
- maskToY = elHeight + 'px';
- } else {
- mask = '-webkit-gradient(linear, left top, left bottom, from(transparent), to(#000), color-stop(66%, #000), color-stop(33%, transparent))';
- maskFromY = -elHeight * 2 + 'px';
- maskToY = 0;
- };
- break;
- case 'down':
- if (out) {
- mask = '-webkit-gradient(linear, left top, left bottom, from(transparent), to(#000), color-stop(66%, #000), color-stop(33%, transparent))';
- maskFromY = -elHeight * 2 + 'px';
- maskToY = 0;
- } else {
- mask = '-webkit-gradient(linear, left top, left bottom, from(#000), to(transparent), color-stop(33%, #000), color-stop(66%, transparent))';
- maskFromY = elHeight * 3 + 'px';
- maskToY = elHeight + 'px';
- };
- break;
- case 'right':
- if (out) {
- mask = '-webkit-gradient(linear, right top, left top, from(#000), to(transparent), color-stop(33%, #000), color-stop(66%, transparent))';
- maskFromX = -elWidth * 2 + 'px';
- maskToX = 0;
- } else {
- mask = '-webkit-gradient(linear, right top, left top, from(transparent), to(#000), color-stop(66%, #000), color-stop(33%, transparent))';
- maskToX = -elWidth * 2 + 'px';
- };
- break;
- case 'left':
- if (out) {
- mask = '-webkit-gradient(linear, right top, left top, from(transparent), to(#000), color-stop(66%, #000), color-stop(33%, transparent))';
- maskToX = -elWidth * 2 + 'px';
- } else {
- mask = '-webkit-gradient(linear, right top, left top, from(#000), to(transparent), color-stop(33%, #000), color-stop(66%, transparent))';
- maskFromX = -elWidth * 2 + 'px';
- maskToX = 0;
- };
- break;
- }
- if (!out) {
- tmp = maskFromY;
- maskFromY = maskToY;
- maskToY = tmp;
- tmp = maskFromX;
- maskFromX = maskToX;
- maskToX = tmp;
- }
- from.set('mask-image', mask);
- from.set('mask-size', elWidth * 3 + 'px ' + elHeight * 3 + 'px');
- from.set('mask-position-x', maskFromX);
- from.set('mask-position-y', maskFromY);
- to.set('mask-position-x', maskToX);
- to.set('mask-position-y', maskToY);
- }
- });
- Ext.define('Ext.fx.animation.WipeOut', {
- extend: Ext.fx.animation.Wipe,
- config: {
-
- out: true
- }
- });
- Ext.define('Ext.fx.easing.Bounce', {
- extend: Ext.fx.easing.Abstract,
- config: {
- springTension: 0.3,
- acceleration: 30,
- startVelocity: 0
- },
- getValue: function() {
- var deltaTime = Ext.Date.now() - this.getStartTime(),
- theta = (deltaTime / this.getAcceleration()),
- powTime = theta * Math.pow(Math.E, -this.getSpringTension() * theta);
- return this.getStartValue() + (this.getStartVelocity() * powTime);
- }
- });
- Ext.define('Ext.fx.easing.Momentum', {
- extend: Ext.fx.easing.Abstract,
- config: {
- acceleration: 30,
- friction: 0,
- startVelocity: 0
- },
- alpha: 0,
- updateFriction: function(friction) {
- var theta = Math.log(1 - (friction / 10));
- this.theta = theta;
- this.alpha = theta / this.getAcceleration();
- },
- updateStartVelocity: function(velocity) {
- this.velocity = velocity * this.getAcceleration();
- },
- updateAcceleration: function(acceleration) {
- this.velocity = this.getStartVelocity() * acceleration;
- this.alpha = this.theta / acceleration;
- },
- getValue: function() {
- return this.getStartValue() - this.velocity * (1 - this.getFrictionFactor()) / this.theta;
- },
- getFrictionFactor: function() {
- var deltaTime = Ext.Date.now() - this.getStartTime();
- return Math.exp(deltaTime * this.alpha);
- },
- getVelocity: function() {
- return this.getFrictionFactor() * this.velocity;
- }
- });
- Ext.define('Ext.fx.easing.BoundMomentum', {
- extend: Ext.fx.easing.Abstract,
- config: {
-
- momentum: null,
-
- bounce: null,
- minMomentumValue: 0,
- maxMomentumValue: 0,
-
- minVelocity: 0.01,
-
- startVelocity: 0
- },
- applyMomentum: function(config, currentEasing) {
- return Ext.factory(config, Ext.fx.easing.Momentum, currentEasing);
- },
- applyBounce: function(config, currentEasing) {
- return Ext.factory(config, Ext.fx.easing.Bounce, currentEasing);
- },
- updateStartTime: function(startTime) {
- this.getMomentum().setStartTime(startTime);
- this.callParent(arguments);
- },
- updateStartVelocity: function(startVelocity) {
- this.getMomentum().setStartVelocity(startVelocity);
- },
- updateStartValue: function(startValue) {
- this.getMomentum().setStartValue(startValue);
- },
- reset: function() {
- this.lastValue = null;
- this.isBouncingBack = false;
- this.isOutOfBound = false;
- return this.callParent(arguments);
- },
- getValue: function() {
- var momentum = this.getMomentum(),
- bounce = this.getBounce(),
- startVelocity = momentum.getStartVelocity(),
- direction = startVelocity > 0 ? 1 : -1,
- minValue = this.getMinMomentumValue(),
- maxValue = this.getMaxMomentumValue(),
- boundedValue = (direction == 1) ? maxValue : minValue,
- lastValue = this.lastValue,
- value, velocity;
- if (startVelocity === 0) {
- return this.getStartValue();
- }
- if (!this.isOutOfBound) {
- value = momentum.getValue();
- velocity = momentum.getVelocity();
- if (Math.abs(velocity) < this.getMinVelocity()) {
- this.isEnded = true;
- }
- if (value >= minValue && value <= maxValue) {
- return value;
- }
- this.isOutOfBound = true;
- bounce.setStartTime(Ext.Date.now()).setStartVelocity(velocity).setStartValue(boundedValue);
- }
- value = bounce.getValue();
- if (!this.isEnded) {
- if (!this.isBouncingBack) {
- if (lastValue !== null) {
- if ((direction == 1 && value < lastValue) || (direction == -1 && value > lastValue)) {
- this.isBouncingBack = true;
- }
- }
- } else {
- if (Math.round(value) == boundedValue) {
- this.isEnded = true;
- }
- }
- }
- this.lastValue = value;
- return value;
- }
- });
- Ext.define('Ext.fx.easing.EaseIn', {
- extend: Ext.fx.easing.Linear,
- alias: 'easing.ease-in',
- config: {
- exponent: 4,
- duration: 1500
- },
- getValue: function() {
- var deltaTime = Ext.Date.now() - this.getStartTime(),
- duration = this.getDuration(),
- startValue = this.getStartValue(),
- endValue = this.getEndValue(),
- distance = this.distance,
- theta = deltaTime / duration,
- thetaEnd = Math.pow(theta, this.getExponent()),
- currentValue = startValue + (thetaEnd * distance);
- if (deltaTime >= duration) {
- this.isEnded = true;
- return endValue;
- }
- return currentValue;
- }
- });
- Ext.define('Ext.fx.easing.EaseOut', {
- extend: Ext.fx.easing.Linear,
- alias: 'easing.ease-out',
- config: {
- exponent: 4,
- duration: 1500
- },
- getValue: function() {
- var deltaTime = Ext.Date.now() - this.getStartTime(),
- duration = this.getDuration(),
- startValue = this.getStartValue(),
- endValue = this.getEndValue(),
- distance = this.distance,
- theta = deltaTime / duration,
- thetaC = 1 - theta,
- thetaEnd = 1 - Math.pow(thetaC, this.getExponent()),
- currentValue = startValue + (thetaEnd * distance);
- if (deltaTime >= duration) {
- this.isEnded = true;
- return endValue;
- }
- return currentValue;
- }
- });
- Ext.define('Ext.fx.easing.Easing', {
- constructor: function(easing) {
- return Ext.factory(easing, Ext.fx.easing.Linear, null, 'easing');
- }
- });
- Ext.define('Ext.fx.runner.CssAnimation', {
- extend: Ext.fx.runner.Css,
- constructor: function() {
- this.runningAnimationsMap = {};
- this.elementEndStates = {};
- this.animationElementMap = {};
- this.keyframesRulesCache = {};
- this.uniqueId = 0;
- return this.callParent(arguments);
- },
- attachListeners: function() {
- this.listenersAttached = true;
- Ext.getWin().on({
- animationstart: 'onAnimationStart',
- animationend: 'onAnimationEnd',
- scope: this
- });
- },
- onAnimationStart: function(e) {
- var name = e.browserEvent.animationName,
- elementId = this.animationElementMap[name],
- animation = this.runningAnimationsMap[elementId][name],
- elementEndStates = this.elementEndStates,
- elementEndState = elementEndStates[elementId],
- data = {};
-
- if (elementEndState) {
- delete elementEndStates[elementId];
- data[elementId] = elementEndState;
- this.applyStyles(data);
- }
- if (animation.before) {
- data[elementId] = animation.before;
- this.applyStyles(data);
- }
- },
- onAnimationEnd: function(e) {
- var element = e.target,
- name = e.browserEvent.animationName,
- animationElementMap = this.animationElementMap,
- elementId = animationElementMap[name],
- runningAnimationsMap = this.runningAnimationsMap,
- runningAnimations = runningAnimationsMap[elementId],
- animation = runningAnimations[name];
-
- if (animation.onBeforeEnd) {
- animation.onBeforeEnd.call(animation.scope || this, element);
- }
- if (animation.onEnd) {
- animation.onEnd.call(animation.scope || this, element);
- }
- delete animationElementMap[name];
- delete runningAnimations[name];
- this.removeKeyframesRule(name);
- },
- generateAnimationId: function() {
- return 'animation-' + (++this.uniqueId);
- },
- run: function(animations) {
- var data = {},
- elementEndStates = this.elementEndStates,
- animationElementMap = this.animationElementMap,
- runningAnimationsMap = this.runningAnimationsMap,
- runningAnimations, states, elementId, animationId, i, ln, animation, name, runningAnimation, names, durations, easings, delays, directions, iterations;
- if (!this.listenersAttached) {
- this.attachListeners();
- }
- animations = Ext.Array.from(animations);
- for (i = 0 , ln = animations.length; i < ln; i++) {
- animation = animations[i];
- animation = Ext.factory(animation, Ext.fx.Animation);
- elementId = animation.getElement().getId();
- animationId = animation.getName() || this.generateAnimationId();
- animationElementMap[animationId] = elementId;
- animation = animation.getData();
- states = animation.states;
- this.addKeyframesRule(animationId, states);
- runningAnimations = runningAnimationsMap[elementId];
- if (!runningAnimations) {
- runningAnimations = runningAnimationsMap[elementId] = {};
- }
- runningAnimations[animationId] = animation;
- names = [];
- durations = [];
- easings = [];
- delays = [];
- directions = [];
- iterations = [];
- for (name in runningAnimations) {
- if (runningAnimations.hasOwnProperty(name)) {
- runningAnimation = runningAnimations[name];
- names.push(name);
- durations.push(runningAnimation.duration);
- easings.push(runningAnimation.easing);
- delays.push(runningAnimation.delay);
- directions.push(runningAnimation.direction);
- iterations.push(runningAnimation.iteration);
- }
- }
- data[elementId] = {
- 'animation-name': names,
- 'animation-duration': durations,
- 'animation-timing-function': easings,
- 'animation-delay': delays,
- 'animation-direction': directions,
- 'animation-iteration-count': iterations
- };
-
- if (animation.preserveEndState) {
- elementEndStates[elementId] = states['100%'];
- }
- }
- this.applyStyles(data);
- },
- addKeyframesRule: function(name, keyframes) {
- var percentage, properties, keyframesRule, styleSheet, rules, styles, rulesLength, key, value;
- styleSheet = this.getStyleSheet();
- rules = styleSheet.cssRules;
- rulesLength = rules.length;
- styleSheet.insertRule('@' + this.vendorPrefix + 'keyframes ' + name + '{}', rulesLength);
- keyframesRule = rules[rulesLength];
- for (percentage in keyframes) {
- properties = keyframes[percentage];
- rules = keyframesRule.cssRules;
- rulesLength = rules.length;
- styles = [];
- for (key in properties) {
- value = this.formatValue(properties[key], key);
- key = this.formatName(key);
- styles.push(key + ':' + value);
- }
- keyframesRule.insertRule(percentage + '{' + styles.join(';') + '}', rulesLength);
- }
- return this;
- },
- removeKeyframesRule: function(name) {
- var styleSheet = this.getStyleSheet(),
- rules = styleSheet.cssRules,
- i, ln, rule;
- for (i = 0 , ln = rules.length; i < ln; i++) {
- rule = rules[i];
- if (rule.name === name) {
- styleSheet.removeRule(i);
- break;
- }
- }
- return this;
- }
- });
- Ext.define('Ext.list.AbstractTreeItem', {
- extend: Ext.Widget,
- isTreeListItem: true,
-
-
-
-
-
-
-
-
-
- cachedConfig: {
-
- expandable: false,
-
- expanded: false,
-
- iconCls: '',
-
- leaf: true,
-
- loading: false,
-
- selected: false,
-
- selectedParent: false
- },
- config: {
-
- iconClsProperty: 'iconCls',
- indent: null,
-
- owner: null,
-
- node: null,
-
- over: null,
-
- parentItem: null,
-
- text: {
- lazy: true,
- $value: ''
- },
-
- textProperty: 'text'
- },
- updateNode: function(node) {
- if (node) {
- var me = this,
- map = me.itemMap,
- childNodes, owner, len, i, item, child;
- me.element.dom.setAttribute('data-recordId', node.internalId);
- if (!map) {
- childNodes = node.childNodes;
- owner = me.getOwner();
- me.itemMap = map = {};
- for (i = 0 , len = childNodes.length; i < len; ++i) {
- child = childNodes[i];
- if (child.data.visible) {
- item = owner.createItem(child, me);
- map[child.internalId] = item;
- me.insertItem(item, null);
- }
- }
- }
- me.setExpanded(node.isExpanded());
- me.doNodeUpdate(node);
- }
- },
- updateSelected: function(selected) {
- if (!this.isConfiguring) {
- var parent = this.getParentItem();
- while (parent && !parent.isRootListItem) {
- parent.setSelectedParent(selected);
- parent = parent.getParentItem();
- }
- }
- },
-
- collapse: function() {
- this.getNode().collapse();
- },
-
- expand: function() {
- this.getNode().expand();
- },
-
- getToolElement: Ext.emptyFn,
-
- insertItem: Ext.emptyFn,
-
- isExpanded: function() {
- return this.getExpanded();
- },
-
- isSelectionEvent: Ext.emptyFn,
-
- isToggleEvent: Ext.emptyFn,
-
- nodeCollapse: function(node, collapsingForExpand) {
- var me = this,
- owner = me.getOwner(),
- animation = me.preventAnimation ? null : owner.getAnimation();
- me.nodeCollapseBegin(animation, collapsingForExpand);
- if (!animation) {
- me.nodeCollapseEnd(collapsingForExpand);
- }
- },
- nodeCollapseBegin: function(animation, collapsingForExpand) {
- var me = this,
- owner = me.getOwner();
- me.setExpanded(false);
- owner.fireEvent('itemcollapse', owner, me);
- },
- nodeCollapseEnd: function(collapsingForExpand) {
- if (!collapsingForExpand && !this.destroying) {
- this.getOwner().updateLayout();
- }
- },
-
- nodeExpand: function(node) {
- var me = this,
- owner = me.getOwner(),
- floated = me.getFloated(),
- animation = !floated && owner.getAnimation();
- me.nodeExpandBegin(animation);
- if (!animation) {
- me.nodeExpandEnd();
- }
- },
- nodeExpandBegin: function(animation) {
- var me = this,
- owner = me.getOwner();
- me.setExpanded(true);
- owner.fireEvent('itemexpand', owner, me);
- },
- nodeExpandEnd: function() {
- if (!this.destroying) {
- this.getOwner().updateLayout();
- }
- },
-
- nodeInsert: function(node, refNode) {
- var me = this,
- owner = me.getOwner(),
- map = me.itemMap,
- id = node.internalId,
- item = owner.getItem(node),
- refItem = null,
- oldParent;
- if (item) {
- oldParent = item.getParentItem();
-
- oldParent.removeItem(item);
- if (oldParent !== me) {
- oldParent.doUpdateExpandable();
- item.setParentItem(me);
- }
- } else {
- item = me.getOwner().createItem(node, me);
- }
- map[id] = item;
- if (refNode) {
- refItem = map[refNode.internalId];
- }
- me.insertItem(item, refItem);
- me.doUpdateExpandable();
- owner.fireEvent('iteminsert', owner, me, item, refItem);
- owner.updateLayout();
- },
-
- nodeRemove: function(node) {
- var me = this,
- map = me.itemMap,
- owner = me.getOwner(),
- id = node.internalId,
- item = map[id];
- if (item) {
- delete map[id];
- me.removeItem(item);
- item.destroy();
- me.doUpdateExpandable();
- owner.fireEvent('itemremove', owner, me, item);
- owner.updateLayout();
- }
- },
-
- nodeUpdate: function(node, modifiedFieldNames) {
- this.doNodeUpdate(node);
- },
-
- onClick: function(e) {
- var me = this,
- owner = me.getOwner(),
- node = me.getNode(),
- info = {
- event: e,
- item: me,
- node: node,
- tree: owner,
- select: node.get('selectable') !== false && me.isSelectionEvent(e),
- toggle: me.isToggleEvent(e)
- };
-
- if (owner.fireEvent('itemclick', owner, info) !== false) {
- if (info.toggle) {
- me.toggleExpanded();
- e.preventDefault();
- }
- if (info.select) {
- owner.setSelection(me.getNode());
- }
- }
- },
-
- removeItem: Ext.emptyFn,
-
- destroy: function() {
- var me = this,
- map = me.itemMap,
- owner = me.getOwner(),
- key;
- if (map) {
- for (key in map) {
- map[key].destroy();
- }
- me.itemMap = null;
- }
- if (owner) {
- owner.removeItem(me.getNode());
- }
- me.setNode(null);
- me.setParentItem(null);
- me.setOwner(null);
- me.callParent();
- },
- privates: {
-
- doNodeUpdate: function(node, modifiedFieldNames) {
- var me = this,
- textProperty = this.getTextProperty(),
- iconClsProperty = this.getIconClsProperty();
- if (textProperty) {
- me.setText(node.data[textProperty]);
- }
- if (iconClsProperty) {
- me.setIconCls(node.data[iconClsProperty]);
- }
- me.setLoading(node.isLoading());
- me.setLeaf(node.isLeaf());
- me.doUpdateExpandable();
- },
- doUpdateExpandable: function() {
- var node = this.getNode();
- this.setExpandable(node.isExpandable());
- },
- toggleExpanded: function() {
- if (this.isExpanded()) {
- this.collapse();
- } else {
- this.expand();
- }
- },
- updateIndent: function(value) {
- var items = this.itemMap,
- id;
- for (id in items) {
- items[id].setIndent(value);
- }
- },
-
- updateOwner: function(owner) {
- this.parent = owner;
- }
- }
- });
- Ext.define('Ext.list.RootTreeItem', {
- extend: Ext.list.AbstractTreeItem,
-
- isRootListItem: true,
- element: {
- reference: 'element',
- tag: 'ul',
- cls: Ext.baseCSSPrefix + 'treelist-root-container'
- },
- insertItem: function(item, refItem) {
- if (refItem) {
- item.element.insertBefore(refItem.element);
- } else {
- this.element.appendChild(item.element);
- }
- },
- isToggleEvent: function(e) {
- return false;
- }
- });
- Ext.define('Ext.mixin.ItemRippler', {
- mixinId: 'itemrippler',
- config: {
-
- itemRipple: null
- },
- shouldRippleItem: function(item, e) {
- var itemRipple, ripple;
- if (e.getTarget(this.noItemRippleSelector, this.element)) {
- return false;
- }
- itemRipple = item && this.getItemRipple();
- if (itemRipple && item.isWidget) {
- ripple = item.shouldRipple(e);
- if (ripple) {
- itemRipple = Ext.apply({}, itemRipple, ripple);
- }
- }
- return itemRipple;
- },
- rippleItem: function(item, e) {
- if (!item) {
- return;
- }
- var me = this,
- start = e.type.match(me.rippleStateRe),
- itemRipple = me.shouldRippleItem(item, e),
- release = itemRipple && itemRipple.release,
- isRelease = release === true,
- el = item.isWidget ? item.el : item,
- pos, delta, rs, rippledItems;
-
-
- if (itemRipple && start && isRelease) {
- me.$rippleStart = e.getXY();
- }
-
-
-
-
- if (itemRipple && el && ((!start && isRelease) || (start && release !== true))) {
- rippledItems = me.$rippledItems || (me.$rippledItems = []);
- rs = me.$rippleStart;
- if (rs) {
- pos = e.getXY();
-
- delta = Math.sqrt(Math.pow((pos[0] - rs[0]), 2) + Math.pow((pos[1] - rs[1]), 2));
- if (delta <= 8) {
- el.ripple(e, itemRipple);
- rippledItems.push(el);
- }
- } else {
- el.ripple(e, itemRipple);
- rippledItems.push(el);
- }
- me.$rippleStart = null;
- }
- },
- destroyAllRipples: function() {
- for (var items = this.$rippledItems; items && items.length; ) {
- items.pop().destroyAllRipples();
- }
- },
- privates: {
- noItemRippleSelector: '.' + Ext.baseCSSPrefix + 'item-no-ripple, ' + '.' + Ext.baseCSSPrefix + 'item-no-tap',
- rippleStateRe: /start|down/
- }
- });
- Ext.define('Ext.list.TreeItem', {
- extend: Ext.list.AbstractTreeItem,
- xtype: 'treelistitem',
- collapsedCls: Ext.baseCSSPrefix + 'treelist-item-collapsed',
- expandedCls: Ext.baseCSSPrefix + 'treelist-item-expanded',
- floatedToolCls: Ext.baseCSSPrefix + 'treelist-item-tool-floated',
- leafCls: Ext.baseCSSPrefix + 'treelist-item-leaf',
- expandableCls: Ext.baseCSSPrefix + 'treelist-item-expandable',
- hideIconCls: Ext.baseCSSPrefix + 'treelist-item-hide-icon',
- loadingCls: Ext.baseCSSPrefix + 'treelist-item-loading',
- selectedCls: Ext.baseCSSPrefix + 'treelist-item-selected',
- selectedParentCls: Ext.baseCSSPrefix + 'treelist-item-selected-parent',
- withIconCls: Ext.baseCSSPrefix + 'treelist-item-with-icon',
- hoverCls: Ext.baseCSSPrefix + 'treelist-item-over',
- rowHoverCls: Ext.baseCSSPrefix + 'treelist-row-over',
-
- isTreeListItem: true,
- config: {
-
- rowCls: null
- },
-
- rowClsProperty: 'rowCls',
- element: {
- reference: 'element',
- tag: 'li',
- cls: Ext.baseCSSPrefix + 'treelist-item',
- children: [
- {
- reference: 'rowElement',
- cls: Ext.baseCSSPrefix + 'treelist-row',
- children: [
- {
- reference: 'wrapElement',
- cls: Ext.baseCSSPrefix + 'treelist-item-wrap',
- children: [
- {
- reference: 'iconElement',
- cls: Ext.baseCSSPrefix + 'treelist-item-icon'
- },
- {
- reference: 'textElement',
- cls: Ext.baseCSSPrefix + 'treelist-item-text'
- },
- {
- reference: 'expanderElement',
- cls: Ext.baseCSSPrefix + 'treelist-item-expander'
- }
- ]
- }
- ]
- },
- {
- reference: 'itemContainer',
- tag: 'ul',
- cls: Ext.baseCSSPrefix + 'treelist-container'
- },
- {
- reference: 'toolElement',
- cls: Ext.baseCSSPrefix + 'treelist-item-tool'
- }
- ]
- },
- constructor: function(config) {
- this.callParent([
- config
- ]);
- var toolDom = this.toolElement.dom;
-
-
- toolDom.parentNode.removeChild(toolDom);
- },
- getToolElement: function() {
- return this.toolElement;
- },
- insertItem: function(item, refItem) {
- if (refItem) {
- item.element.insertBefore(refItem.element);
- } else {
- this.itemContainer.appendChild(item.element);
- }
- },
- isSelectionEvent: function(e) {
- var owner = this.getOwner();
- return (!this.isToggleEvent(e) || !owner.getExpanderOnly() || owner.getSelectOnExpander());
- },
- isToggleEvent: function(e) {
- var isExpand = false;
- if (this.getOwner().getExpanderOnly()) {
- isExpand = e.target === this.expanderElement.dom;
- } else {
-
- isExpand = !this.itemContainer.contains(e.target);
- }
- return isExpand;
- },
- nodeCollapseBegin: function(animation, collapsingForExpand) {
- var me = this,
- itemContainer = me.itemContainer,
- height;
- if (me.expanding) {
- me.stopAnimation(me.expanding);
- }
-
-
-
- height = animation && itemContainer.getHeight();
- me.callParent([
- animation,
- collapsingForExpand
- ]);
- if (animation) {
-
- itemContainer.dom.style.display = 'block';
- me.collapsingForExpand = collapsingForExpand;
- me.collapsing = this.runAnimation(Ext.merge({
- from: {
- height: height
- },
- to: {
- height: 0
- },
- callback: me.nodeCollapseDone,
- scope: me
- }, animation));
- }
- },
- nodeCollapseDone: function(animation) {
- var me = this,
- itemContainer = me.itemContainer;
-
-
- if (!me.destroying && !me.destroyed) {
- me.collapsing = null;
- itemContainer.dom.style.display = '';
- itemContainer.setHeight(null);
- me.nodeCollapseEnd(me.collapsingForExpand);
- }
- },
- nodeExpandBegin: function(animation) {
- var me = this,
- itemContainer = me.itemContainer,
- height;
- if (me.collapsing) {
- me.stopAnimation(me.collapsing);
- }
- me.callParent([
- animation
- ]);
- if (animation) {
-
- height = itemContainer.getHeight();
- itemContainer.setHeight(0);
- me.expanding = me.runAnimation(Ext.merge({
- to: {
- height: height
- },
- callback: me.nodeExpandDone,
- scope: me
- }, animation));
- }
- },
- nodeExpandDone: function() {
- this.expanding = null;
- this.itemContainer.setHeight(null);
- this.nodeExpandEnd();
- },
- removeItem: function(item) {
- this.itemContainer.removeChild(item.element);
- },
-
-
- updateNode: function(node, oldNode) {
- this.syncIndent();
- this.callParent([
- node,
- oldNode
- ]);
- },
- updateExpandable: function(expandable) {
- var node = this.getNode();
- this.updateExpandCls();
- if (node) {
- node.set('expandable', expandable);
- }
- },
- updateExpanded: function(expanded) {
- var node = this.getNode();
- this.updateExpandCls();
- if (node) {
- node.set('expanded', expanded);
- }
- },
- updateIconCls: function(iconCls, oldIconCls) {
- var me = this,
- el = me.element;
- me.doIconCls(me.iconElement, iconCls, oldIconCls);
- me.doIconCls(me.toolElement, iconCls, oldIconCls);
- el.toggleCls(me.withIconCls, !!iconCls);
-
- el.toggleCls(me.hideIconCls, iconCls === null);
- },
- updateLeaf: function(leaf) {
- this.element.toggleCls(this.leafCls, leaf);
- },
- updateLoading: function(loading) {
- this.element.toggleCls(this.loadingCls, loading);
- },
- updateOver: function(over) {
- var me = this;
- me.element.toggleCls(me.hoverCls, !!over);
-
- me.rowElement.toggleCls(me.rowHoverCls, over > 1);
- },
-
- updateRowCls: function(value, oldValue) {
- this.rowElement.replaceCls(oldValue, value);
- },
- updateSelected: function(selected, oldSelected) {
- var me = this,
- cls = me.selectedCls,
- tool = me.getToolElement();
- me.callParent([
- selected,
- oldSelected
- ]);
- me.element.toggleCls(cls, selected);
- if (tool) {
- tool.toggleCls(cls, selected);
- }
- },
- updateSelectedParent: function(selectedParent) {
- var me = this;
- me.element.toggleCls(me.selectedParentCls, selectedParent);
- var tool = me.getToolElement();
- if (tool) {
- tool.toggleCls(me.selectedCls, selectedParent);
- }
- },
- updateText: function(text) {
- this.textElement.update(text);
- },
-
-
- privates: {
- doNodeUpdate: function(node) {
- this.callParent([
- node
- ]);
- this.setRowCls(node && node.data[this.rowClsProperty]);
- },
- doIconCls: function(element, iconCls, oldIconCls) {
- if (oldIconCls) {
- element.removeCls(oldIconCls);
- }
- if (iconCls) {
- element.addCls(iconCls);
- }
- },
- syncIndent: function() {
- var me = this,
- indent = me.getIndent(),
- node = me.getNode(),
- depth;
- if (node) {
- depth = node.data.depth - 1;
- me.wrapElement.dom.style.marginLeft = (depth * indent) + 'px';
- }
- },
- updateExpandCls: function() {
- if (!this.updatingExpandCls) {
- var me = this,
- expandable = me.getExpandable(),
- element = me.element,
- expanded = me.getExpanded(),
- expandedCls = me.expandedCls,
- collapsedCls = me.collapsedCls;
- me.updatingExpandCls = true;
- element.toggleCls(me.expandableCls, expandable);
- if (expandable) {
- element.toggleCls(expandedCls, expanded);
- element.toggleCls(collapsedCls, !expanded);
- } else {
- element.removeCls([
- expandedCls,
- collapsedCls
- ]);
- }
- me.updatingExpandCls = false;
- }
- },
- updateIndent: function(value, oldValue) {
- this.syncIndent();
- this.callParent([
- value,
- oldValue
- ]);
- }
- }
- }, function(TreeItem) {
- TreeItem.prototype.floatedCls = [
- Ext.Widget.prototype.floatedCls,
- Ext.baseCSSPrefix + 'treelist-item-floated'
- ];
- });
- Ext.define('Ext.list.Tree', {
- extend: Ext.Gadget,
- xtype: 'treelist',
- mixins: [
- Ext.mixin.ItemRippler
- ],
- expanderFirstCls: Ext.baseCSSPrefix + 'treelist-expander-first',
- expanderOnlyCls: Ext.baseCSSPrefix + 'treelist-expander-only',
- highlightPathCls: Ext.baseCSSPrefix + 'treelist-highlight-path',
- microCls: Ext.baseCSSPrefix + 'treelist-micro',
- uiPrefix: Ext.baseCSSPrefix + 'treelist-',
-
- element: {
- reference: 'element',
- cls: Ext.baseCSSPrefix + 'treelist ' + Ext.baseCSSPrefix + 'unselectable',
- listeners: {
- click: 'onClick',
- touchstart: 'onTouchStart',
- touchend: 'onTouchEnd',
- mouseenter: 'onMouseEnter',
- mouseleave: 'onMouseLeave',
- mouseover: 'onMouseOver'
- },
- children: [
- {
- reference: 'toolsElement',
- cls: Ext.baseCSSPrefix + 'treelist-toolstrip',
- listeners: {
- click: 'onToolStripClick',
- mouseover: 'onToolStripMouseOver'
- }
- }
- ]
- },
- cachedConfig: {
- animation: {
- duration: 500,
- easing: 'ease'
- },
-
- expanderFirst: true,
-
- expanderOnly: true
- },
- config: {
-
- floatLeafItems: false,
-
- defaults: {
- xtype: 'treelistitem'
- },
-
- highlightPath: null,
- iconSize: null,
- indent: null,
-
- micro: false,
- overItem: null,
-
- selection: null,
-
- selectOnExpander: false,
-
- singleExpand: null,
-
- store: null,
-
- ui: null
- },
-
-
- twoWayBindable: {
- selection: 1
- },
-
- publishes: {
- selection: 1
- },
-
- defaultBindProperty: 'store',
- constructor: function(config) {
- this.callParent([
- config
- ]);
-
-
- this.publishState('selection', this.getSelection());
- },
- destroy: function() {
- var me = this;
- me.unfloatAll();
- me.activeFloater = null;
- me.setSelection(null);
- me.setStore(null);
- me.callParent();
- },
- updateOverItem: function(over, wasOver) {
- var map = {},
- state = 2,
- c, node;
-
-
-
- for (c = over; c; c = this.getItem(node.parentNode)) {
- node = c.getNode();
- map[node.internalId] = true;
- c.setOver(state);
- state = 1;
- }
-
-
-
- if (wasOver && !wasOver.destroyed) {
-
-
-
-
- for (c = wasOver; c; c = this.getItem(node.parentNode)) {
- node = c.getNode();
- if (map[node.internalId]) {
- break;
- }
- c.setOver(0);
- }
- }
- },
- applyMicro: function(micro) {
- return Boolean(micro);
- },
- applySelection: function(selection, oldSelection) {
- var store = this.getStore();
- if (!store) {
- selection = null;
- }
- if (store && selection !== null && !(selection instanceof Ext.data.Model)) {
- selection = store.getNodeById(selection);
- }
- if (selection && selection.get('selectable') === false) {
- selection = oldSelection;
- }
- return selection;
- },
- updateSelection: function(selection, oldSelection) {
- var me = this,
- item, parent;
- if (!me.destroying) {
-
-
- item = me.getItem(oldSelection);
- if (item) {
- item.setSelected(false);
- }
- item = me.getItem(selection);
- if (item) {
- item.setSelected(true);
- while (parent = item.getParentItem()) {
- parent.setExpanded(true);
- item = parent;
- }
- }
- me.fireEvent('selectionchange', me, selection);
- }
- },
- applyStore: function(store) {
- return store && Ext.StoreManager.lookup(store, 'tree');
- },
- updateStore: function(store, oldStore) {
- var me = this,
- root;
- if (oldStore) {
-
- if (!oldStore.destroyed) {
- if (oldStore.getAutoDestroy()) {
- oldStore.destroy();
- } else {
- me.storeListeners.destroy();
- }
- }
- me.removeRoot();
- me.storeListeners = null;
- }
- if (store) {
- me.storeListeners = store.on({
- destroyable: true,
- scope: me,
- filterchange: 'onFilterChange',
- nodeappend: 'onNodeAppend',
- nodecollapse: 'onNodeCollapse',
- nodeexpand: 'onNodeExpand',
- nodeinsert: 'onNodeInsert',
- noderemove: 'onNodeRemove',
- rootchange: 'onRootChange',
- update: 'onNodeUpdate'
- });
- root = store.getRoot();
- if (root) {
- me.createRootItem(root);
- }
- }
- if (!me.destroying) {
- me.updateLayout();
- }
- },
- updateExpanderFirst: function(expanderFirst) {
- this.element.toggleCls(this.expanderFirstCls, expanderFirst);
- },
- updateExpanderOnly: function(value) {
- this.element.toggleCls(this.expanderOnlyCls, !value);
- },
- updateHighlightPath: function(updatePath) {
- this.element.toggleCls(this.highlightPathCls, updatePath);
- },
- updateMicro: function(micro) {
- var me = this;
- if (!micro) {
- me.unfloatAll();
- me.activeFloater = null;
- }
- me.element.toggleCls(me.microCls, micro);
- },
- updateUi: function(ui, oldValue) {
- var me = this,
- el = me.element,
- uiPrefix = me.uiPrefix;
- if (oldValue) {
- el.removeCls(uiPrefix + oldValue);
- }
- if (ui) {
- el.addCls(uiPrefix + ui);
- }
-
- delete me.iconSize;
- me.syncIconSize();
- },
-
- getItem: function(node) {
- var map = this.itemMap,
- ret;
- if (node && map) {
- ret = map[node.internalId];
- }
- return ret || null;
- },
-
- getItemConfig: function(node, parent) {
- return Ext.apply({
- parentItem: parent.isRootListItem ? null : parent,
- owner: this,
- node: node,
- indent: this.getIndent()
- }, this.getDefaults());
- },
- privates: {
- checkForOutsideClick: function(e) {
- var floater = this.activeFloater;
- if (!floater.element.contains(e.target)) {
- this.unfloatAll();
- }
- },
- collapsingForExpand: false,
-
- createItem: function(node, parent) {
- var me = this,
- item = Ext.create(me.getItemConfig(node, parent)),
- toolsElement = me.toolsElement,
- toolEl, previousSibling;
- if (parent.isRootListItem) {
- toolEl = item.getToolElement();
- if (toolEl) {
- previousSibling = me.findVisiblePreviousSibling(node);
- if (!previousSibling) {
- toolsElement.insertFirst(toolEl);
- } else {
- previousSibling = me.getItem(previousSibling);
- toolEl.insertAfter(previousSibling.getToolElement());
- }
- toolEl.dom.setAttribute('data-recordId', node.internalId);
- toolEl.isTool = true;
- }
- }
- me.itemMap[node.internalId] = item;
- return item;
- },
-
- createRootItem: function(root) {
- var me = this,
- item;
- me.itemMap = {};
- me.rootItem = item = new Ext.list.RootTreeItem({
- indent: me.getIndent(),
- node: root,
- owner: me
- });
- me.element.appendChild(item.element);
- me.itemMap[root.internalId] = item;
- },
- findVisiblePreviousSibling: function(node) {
- var sibling = node.previousSibling;
- while (sibling) {
- if (sibling.data.visible) {
- return sibling;
- }
- sibling = sibling.previousSibling;
- }
- return null;
- },
- floatItem: function(item, byHover) {
- var me = this,
- floater;
- if (item.getFloated()) {
- return;
- }
-
- if (me.toolMouseListeners) {
- me.toolMouseListeners.destroy();
- me.floaterMouseListeners.destroy();
- me.floaterMouseListeners = me.toolMouseListeners = null;
- }
- me.unfloatAll();
- if (!byHover && !me.getFloatLeafItems() && item.getNode().isLeaf()) {
- return;
- }
- me.activeFloater = floater = item;
- me.floatedByHover = byHover;
- item.setFloated(true);
- if (byHover) {
-
- me.toolMouseListeners = item.getToolElement().monitorMouseLeave(300, me.checkForMouseLeave, me);
- me.floaterMouseListeners = (item.floater || item).el.monitorMouseLeave(300, me.checkForMouseLeave, me);
- floater.element.on('mouseover', 'onMouseOver', me);
- } else {
- Ext.on('mousedown', 'checkForOutsideClick', me);
- }
- },
- shouldRippleItem: function(item, e) {
- if (item && item.getSelected()) {
- return false;
- }
- return this.mixins.itemrippler.shouldRippleItem.call(this, item, e);
- },
- onTouchStart: function(e) {
- this.doItemRipple(e);
- },
- onTouchEnd: function(e) {
- this.doItemRipple(e);
- },
- doItemRipple: function(e) {
- var me = this,
- item = e.getTarget('[data-recordId]'),
- id;
- if (item) {
- id = item.getAttribute('data-recordId');
- item = me.itemMap[id];
- if (item && me.shouldRippleItem(item, e)) {
- this.rippleItem(item, e);
- }
- }
- },
-
- onClick: function(e) {
- var item = e.getTarget('[data-recordId]'),
- id;
- if (item) {
- id = item.getAttribute('data-recordId');
- item = this.itemMap[id];
- if (item) {
- item.onClick(e);
- }
- }
- },
- onMouseEnter: function(e) {
- this.onMouseOver(e);
- },
- onMouseLeave: function() {
- this.setOverItem(null);
- },
- onMouseOver: function(e) {
- var comp = Ext.Component.from(e);
- this.setOverItem(comp && comp.isTreeListItem && comp);
- },
- checkForMouseLeave: function(e) {
- var floater = this.activeFloater,
- relatedTarget = e.getRelatedTarget();
- if (floater) {
- if (relatedTarget !== floater.getToolElement().dom && !floater.element.contains(relatedTarget)) {
- this.unfloatAll();
- }
- }
- },
- onFilterChange: function(store) {
-
-
- this.onRootChange(store.getRoot());
- },
-
- onNodeAppend: function(parentNode, node) {
-
- if (parentNode) {
- var item = this.itemMap[parentNode.internalId];
- if (item) {
- item.nodeInsert(node, null);
- }
- }
- },
-
- onNodeCollapse: function(node) {
- var item = this.itemMap[node.internalId];
- if (item) {
- item.nodeCollapse(node, this.collapsingForExpand);
- }
- },
-
- onNodeExpand: function(node) {
- var me = this,
- item = me.itemMap[node.internalId],
- childNodes, len, i, parentNode, child;
- if (item) {
- if (!item.isRootItem && me.getSingleExpand()) {
- me.collapsingForExpand = true;
- parentNode = (item.getParentItem() || me.rootItem).getNode();
- childNodes = parentNode.childNodes;
- for (i = 0 , len = childNodes.length; i < len; ++i) {
- child = childNodes[i];
- if (child !== node) {
- child.collapse();
- }
- }
- me.collapsing = false;
- }
- item.nodeExpand(node);
- }
- },
-
- onNodeInsert: function(parentNode, node, refNode) {
- var item = this.itemMap[parentNode.internalId];
- if (item) {
- item.nodeInsert(node, refNode);
- }
- },
-
- onNodeRemove: function(parentNode, node, isMove) {
-
-
-
- if (parentNode && !isMove) {
- var item = this.itemMap[parentNode.internalId];
- if (item) {
- item.nodeRemove(node);
- }
- }
- },
-
- onNodeUpdate: function(store, node, type, modifiedFieldNames) {
- var item = this.itemMap[node.internalId];
- if (item) {
- item.nodeUpdate(node, modifiedFieldNames);
- }
- },
-
- onRootChange: function(root) {
- var me = this;
- me.removeRoot();
- if (root) {
- me.createRootItem(root);
- }
- me.updateLayout();
- me.fireEvent('refresh', me);
- },
-
- removeItem: function(node) {
- var map = this.itemMap,
- id = node.internalId,
- item, toolEl;
- if (map) {
- item = map[id];
-
- if (item.getParentItem() === null) {
- toolEl = item.getToolElement();
- if (toolEl) {
- this.toolsElement.removeChild(toolEl);
- }
- }
- delete map[id];
- }
- },
- removeRoot: function() {
- var me = this,
- rootItem = me.rootItem;
- if (rootItem) {
- me.element.removeChild(rootItem.element);
- me.rootItem = me.itemMap = Ext.destroy(rootItem);
- }
- },
-
- onToolStripClick: function(e) {
- var item = e.getTarget('[data-recordId]'),
- id;
- if (item) {
- id = item.getAttribute('data-recordId');
- item = this.itemMap[id];
- if (item) {
- if (item === this.activeFloater) {
- this.unfloatAll();
- } else {
- this.floatItem(item, false);
- }
- }
- }
- },
-
- onToolStripMouseOver: function(e) {
- var item = e.getTarget('[data-recordId]'),
- id;
- if (item) {
- id = item.getAttribute('data-recordId');
- item = this.itemMap[id];
- if (item) {
- this.floatItem(item, true);
- }
- }
- },
- syncIconSize: function() {
- var me = this,
- size = me.iconSize || (me.iconSize = parseInt(me.element.getStyle('background-position'), 10));
- me.setIconSize(size);
- },
- unfloatAll: function() {
- var me = this,
- floater = me.activeFloater;
- if (floater) {
- floater.setFloated(false);
- me.activeFloater = null;
- if (me.floatedByHover) {
- if (me.toolMouseListeners) {
- me.toolMouseListeners.destroy();
- me.floaterMouseListeners.destroy();
- me.floaterMouseListeners = me.toolMouseListeners = null;
- }
- floater.element.un('mouseover', 'onMouseOver', me);
- } else {
- Ext.un('mousedown', 'checkForOutsideClick', me);
- }
- }
- },
- defaultIconSize: 22,
- updateIconSize: function(value) {
- this.setIndent(value || this.defaultIconSize);
- },
- updateIndent: function(value) {
- var rootItem = this.rootItem;
- if (rootItem) {
- rootItem.setIndent(value);
- }
- }
- }
- });
- Ext.define('Ext.mixin.ConfigProxy', function(ConfigProxy) {
- return {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'configproxy',
- extended: function(baseClass, derivedClass, classBody) {
- var proxyConfig = classBody.proxyConfig;
- derivedClass.$configProxies = Ext.apply({}, derivedClass.superclass.self.$configProxies);
- if (proxyConfig) {
- delete classBody.proxyConfig;
- ConfigProxy.processClass(derivedClass, proxyConfig);
- }
- }
- },
- onClassMixedIn: function(targetClass) {
- var prototype = targetClass.prototype,
- proxyConfig = prototype.proxyConfig,
- initConfig = prototype.initConfig;
- prototype.$proxiedConfigs = null;
-
- targetClass.$configProxies = {};
-
- prototype.initConfig = function(config) {
- initConfig.apply(this, arguments);
-
- this.$proxiedConfigs = null;
- return this;
- };
- if (proxyConfig) {
- delete prototype.proxyConfig;
- ConfigProxy.processClass(targetClass, proxyConfig);
- }
- },
-
- getProxiedConfigs: function(name) {
- var me = this,
- configs = me.config,
-
- configProxies = me.self.$configProxies[name],
- i = configProxies && configProxies.length,
- cfg, proxiedConfigs, ret, s, v;
- if (i && me.isConfiguring) {
-
-
- proxiedConfigs = me.$proxiedConfigs || (me.$proxiedConfigs = {});
- while (i-- > 0) {
- cfg = configProxies[i];
- proxiedConfigs[s = cfg.name] = cfg;
- if ((v = configs[s]) !== undefined) {
- (ret || (ret = {}))[s] = v;
- }
- }
- }
- return ret;
- },
-
- mergeProxiedConfigs: function(name, itemConfig, alwaysClone) {
- var me = this,
- ret = itemConfig,
- proxied = me.getProxiedConfigs(name),
- configurator;
- if (proxied) {
- if (!itemConfig) {
- ret = proxied;
- } else if (itemConfig.constructor === Object) {
- configurator = me.self.getConfigurator();
-
- ret = configurator.merge(me, Ext.clone(itemConfig), proxied);
- }
- }
- if (alwaysClone && ret === itemConfig) {
- ret = Ext.clone(ret);
- }
- return ret;
- },
- statics: {
- processClass: function(targetClass, proxyConfig) {
- var ExtConfig = Ext.Config,
- targetProto = targetClass.prototype,
- add = {},
- proxies = targetClass.$configProxies,
- cfg, configs, itemGetter, i, item, methods, n, name, proxiedConfigs, s;
- for (item in proxyConfig) {
- itemGetter = ExtConfig.get(item).names.get;
- configs = proxyConfig[item];
- if (Ext.isArray(configs)) {
- methods = null;
- } else {
- methods = configs.methods;
- configs = configs.configs;
- }
- if (!(proxiedConfigs = proxies[item])) {
- proxies[item] = proxiedConfigs = [];
- } else {
-
- proxies[item] = proxiedConfigs = proxiedConfigs.slice();
- }
- for (i = 0 , n = methods && methods.length; i < n; ++i) {
- if (!targetProto[name = methods[i]]) {
- targetProto[name] = ConfigProxy.wrapFn(itemGetter, name);
- } else
- {
- Ext.raise('Cannot proxy method "' + name + '"');
- }
- }
-
- for (i = 0 , n = configs && configs.length; i < n; ++i) {
- cfg = ExtConfig.get(s = configs[i]);
-
- if (s in add) {
- Ext.raise('Duplicate proxy config definitions for "' + s + '"');
- }
- if (s in targetProto.config) {
- Ext.raise('Config "' + s + '" already defined for class ' + targetProto.$className);
- }
-
- add[s] = undefined;
-
- proxiedConfigs.push(cfg);
- if (!targetProto[name = cfg.names.get]) {
- targetProto[name] = ConfigProxy.wrapGet(itemGetter, name);
- } else
- {
- Ext.raise('Cannot proxy "' + s + '" config getter');
- }
-
- if (!targetProto[name = cfg.names.set]) {
- targetProto[name] = ConfigProxy.wrapSet(itemGetter, name, s);
- } else
- {
- Ext.raise('Cannot proxy "' + s + '" config setter');
- }
- }
- }
-
- targetClass.addConfig(add);
- },
- wrapFn: function(itemGetter, name) {
- return function() {
- var item = this[itemGetter]();
- return item && item[name].apply(item, arguments);
- };
- },
- wrapGet: function(itemGetter, configGetter) {
- return function() {
- var item = this[itemGetter]();
- return item && item[configGetter]();
- };
- },
- wrapSet: function(itemGetter, configSetter, itemName) {
- return function(value) {
- var me = this,
- item, proxiedConfigs;
-
-
- if (!me.isConfiguring || value !== undefined) {
-
-
-
- item = me[itemGetter]();
- proxiedConfigs = me.$proxiedConfigs;
-
- if (proxiedConfigs && proxiedConfigs[itemName]) {
- delete proxiedConfigs[itemName];
-
- item = null;
- }
- if (item) {
- item[configSetter](value);
- }
- }
- return me;
- };
- }
- }
- };
- });
- Ext.define('Ext.mixin.ConfigState', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'configstate'
- },
- alternateStateConfig: '',
- toggleConfigState: function(isAlternate) {
- var me = this,
- state = me.capturedConfigState,
- cfg = me.getConfig(me.alternateStateConfig),
- key;
- if (!cfg) {
- return;
- }
- if (isAlternate) {
- state = {};
- for (key in cfg) {
- state[key] = me.getConfig(key);
- }
- me.capturedConfigState = state;
- me.setConfig(cfg);
- }
-
- else if (!me.isConfiguring && state) {
- me.setConfig(state);
- delete me.capturedConfigState;
- }
- }
- });
- Ext.define('Ext.mixin.Mashup', function(Mashup) {
- return {
- extend: 'Ext.Mixin',
- mixinConfig: {
- id: 'mashup',
- extended: function(baseClass, derivedClass) {
- Mashup.process(derivedClass);
- }
- },
-
-
- statics: {
- process: function(targetClass) {
- var body = targetClass.prototype,
- requiredScripts = body.requiredScripts,
- hooks = targetClass._classHooks,
- onCreated = hooks.onCreated,
- xtypes = targetClass.prototype.xtypes,
- mashup = Ext.manifest.mashup || {},
- options = body.mashupConfig,
- i, script;
- if (requiredScripts) {
- delete body.requiredScripts;
- hooks.onCreated = function() {
- var me = this,
- scripts = [],
- args = Ext.Array.slice(arguments),
- redirect = mashup.redirect || {};
- requiredScripts = scripts.concat(requiredScripts);
- options = options && mashup[options.key];
- if (xtypes) {
- for (i = 0; !options && i < xtypes.length; ++i) {
- options = mashup[xtypes[i]];
- }
- }
- for (i = 0; i < requiredScripts.length; i++) {
- script = requiredScripts[i];
- if (redirect[script] === false) {
-
- continue;
- }
- script = redirect[script] || script;
- if (script.indexOf('{') > -1) {
- if (options) {
- script = new Ext.Template(script).apply(options);
- } else
- {
- Ext.log.error('Missing mashup options for ' + body.$className + ' script "' + script + '"');
- }
- }
-
- scripts.push(script);
- }
- if (!scripts.length) {
- hooks.onCreated = onCreated;
- hooks.onCreated.call(me, args);
- return;
- }
- Ext.Loader.loadScripts({
- url: scripts,
- cache: true,
-
- onError: function(opts, error) {
- targetClass.scriptError = targetClass.prototype.scriptError = error;
- hooks.onCreated = onCreated;
- hooks.onCreated.call(me, args);
- },
- onLoad: function() {
- hooks.onCreated = onCreated;
- hooks.onCreated.call(me, args);
- }
- });
- };
- }
- }
- },
- onClassMixedIn: function(targetClass) {
- Mashup.process(targetClass);
- }
- };
- });
- Ext.define('Ext.mixin.Responsive', function(Responsive) {
- return {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'responsive',
- after: {
- destroy: 'destroy'
- }
- },
- config: {
-
- responsiveConfig: {
- $value: undefined,
- merge: function(newValue, oldValue, target, mixinClass) {
- if (!newValue) {
- return oldValue;
- }
- var ret = oldValue ? Ext.Object.chain(oldValue) : {},
- rule;
- for (rule in newValue) {
- if (!mixinClass || !(rule in ret)) {
- ret[rule] = {
- fn: null,
-
- config: newValue[rule]
- };
- }
- }
- return ret;
- }
- },
-
- responsiveFormulas: {
- $value: 0,
- merge: function(newValue, oldValue, target, mixinClass) {
- return this.mergeNew(newValue, oldValue, target, mixinClass);
- }
- }
- },
-
- destroy: function() {
- Responsive.unregister(this);
- },
-
- privates: {
- statics: {
-
- active: false,
-
- all: {},
-
- context: Ext.Object.chain(Ext.platformTags),
-
- count: 0,
-
- nextId: 0,
-
- activate: function() {
- Responsive.active = true;
- Responsive.updateContext();
- Ext.on('resize', Responsive.onResize, Responsive);
- },
-
- deactivate: function() {
- Responsive.active = false;
- Ext.un('resize', Responsive.onResize, Responsive);
- },
-
- notify: function() {
- var all = Responsive.all,
- context = Responsive.context,
- globalEvents = Ext.GlobalEvents,
- timer = Responsive.timer,
- id;
- if (timer) {
- Responsive.timer = Ext.unasap(timer);
- }
- Responsive.updateContext();
- Ext.suspendLayouts();
- globalEvents.fireEvent('beforeresponsiveupdate', context);
- for (id in all) {
- all[id].setupResponsiveContext();
- }
- globalEvents.fireEvent('beginresponsiveupdate', context);
- for (id in all) {
- all[id].updateResponsiveState();
- }
- globalEvents.fireEvent('responsiveupdate', context);
- Ext.resumeLayouts(true);
- },
-
- onResize: function() {
- if (!Responsive.timer) {
- Responsive.timer = Ext.asap(Responsive.onTimer);
- }
- },
-
- onTimer: function() {
- Responsive.timer = null;
- Responsive.notify();
- },
-
- processConfig: function(instance, instanceConfig, name) {
- var value = instanceConfig && instanceConfig[name],
- config = instance.config,
- cfg, configurator;
-
-
- if (value) {
- configurator = instance.self.getConfigurator();
- cfg = configurator.configs[name];
-
-
- config[name] = cfg.merge(value, config[name], instance);
- }
- },
- register: function(responder) {
- var id = responder.$responsiveId;
- if (!id) {
- responder.$responsiveId = id = ++Responsive.nextId;
- Responsive.all[id] = responder;
- if (++Responsive.count === 1) {
- Responsive.activate();
- }
- }
- },
- unregister: function(responder) {
- var id = responder.$responsiveId;
- if (id in Responsive.all) {
- responder.$responsiveId = null;
- delete Responsive.all[id];
- if (--Responsive.count === 0) {
- Responsive.deactivate();
- }
- }
- },
-
- updateContext: function() {
- var El = Ext.Element,
- width = El.getViewportWidth(),
- height = El.getViewportHeight(),
- context = Responsive.context;
- context.width = width;
- context.height = height;
- context.tall = width < height;
- context.wide = !context.tall;
- context.landscape = context.portrait = false;
- if (!context.platform) {
- context.platform = Ext.platformTags;
- }
- context[Ext.dom.Element.getOrientation()] = true;
- }
- },
-
-
-
- afterClassMixedIn: function(targetClass) {
- var proto = targetClass.prototype,
- responsiveConfig = proto.responsiveConfig,
- responsiveFormulas = proto.responsiveFormulas,
- config;
- if (responsiveConfig || responsiveFormulas) {
- config = {};
- if (responsiveConfig) {
- delete proto.responsiveConfig;
- config.responsiveConfig = responsiveConfig;
- }
- if (responsiveFormulas) {
- delete proto.responsiveFormulas;
- config.responsiveFormulas = responsiveFormulas;
- }
- targetClass.getConfigurator().add(config);
- }
- },
-
-
-
-
- applyResponsiveConfig: function(rules) {
- for (var rule in rules) {
- rules[rule].fn = Ext.createRuleFn(rule);
- }
- return rules;
- },
- applyResponsiveFormulas: function(formulas) {
- var ret = {},
- fn, name;
- if (formulas) {
- for (name in formulas) {
- if (Ext.isString(fn = formulas[name])) {
- fn = Ext.createRuleFn(fn);
- }
- ret[name] = fn;
- }
- }
- return ret;
- },
-
- getResponsiveState: function() {
- var context = Responsive.context,
- rules = this.getResponsiveConfig(),
- ret = {},
- entry, rule;
- if (rules) {
- for (rule in rules) {
- entry = rules[rule];
- if (entry.fn.call(this, context)) {
- Ext.merge(ret, entry.config);
- }
- }
- }
- return ret;
- },
- setupResponsiveContext: function() {
- var formulas = this.getResponsiveFormulas(),
- context = Responsive.context,
- name;
- if (formulas) {
- for (name in formulas) {
- context[name] = formulas[name].call(this, context);
- }
- }
- },
-
- transformInstanceConfig: function(instanceConfig) {
- var me = this,
- ret;
- Responsive.register(me);
-
-
-
-
- if (instanceConfig) {
- Responsive.processConfig(me, instanceConfig, 'responsiveConfig');
- Responsive.processConfig(me, instanceConfig, 'responsiveFormulas');
- }
-
-
- me.setupResponsiveContext();
-
-
- ret = me.getResponsiveState();
- if (instanceConfig) {
- ret = Ext.merge({}, instanceConfig, ret);
-
- delete ret.responsiveConfig;
- delete ret.responsiveFormulas;
- }
- return ret;
- },
-
- updateResponsiveState: function() {
- var config = this.getResponsiveState();
- this.setConfig(config);
- }
- }
- };
- });
- Ext.define('Ext.mixin.Selectable', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'selectable',
- after: {
- updateStore: 'updateStore'
- }
- },
-
- config: {
-
- disableSelection: null,
-
- mode: 'SINGLE',
-
- allowDeselect: false,
-
- lastSelected: null,
-
- lastFocused: null,
-
- deselectOnContainerClick: true,
-
- selected: true,
-
- pruneRemoved: true,
-
- selection: null,
-
- twoWayBindable: {
- selection: 1
- },
-
- publishes: {
- selection: 1
- }
- },
- modes: {
- SINGLE: true,
- SIMPLE: true,
- MULTI: true
- },
- onNavigate: function(event) {},
- selectableEventHooks: {
- add: 'onSelectionStoreAdd',
- remove: 'onSelectionStoreRemove',
- update: 'onSelectionStoreUpdate',
- clear: {
- fn: 'onSelectionStoreClear',
- priority: 1000
- },
- load: 'refreshSelection',
- refresh: 'refreshSelection'
- },
- initSelectable: function() {
- this.publishState('selection', this.getSelection());
- },
- applySelected: function(selected) {
- if (!selected.isCollection) {
- selected = new Ext.util.Collection(selected);
- }
-
-
- selected.addObserver(this);
- return selected;
- },
-
- applyMode: function(mode) {
- mode = mode ? mode.toUpperCase() : 'SINGLE';
-
-
- return this.modes[mode] ? mode : 'SINGLE';
- },
-
- updateStore: function(newStore, oldStore) {
- var me = this,
- bindEvents = Ext.apply({}, me.selectableEventHooks, {
- scope: me
- });
- if (oldStore && Ext.isObject(oldStore) && oldStore.isStore) {
- if (oldStore.autoDestroy) {
- oldStore.destroy();
- } else {
- oldStore.un(bindEvents);
- }
- }
- if (newStore) {
- newStore.on(bindEvents);
- me.refreshSelection();
- }
- },
-
- selectAll: function(silent) {
- var me = this,
- selections = me.getStore().getRange();
- me.select(selections, true, silent);
- },
-
- deselectAll: function(supress) {
- var me = this;
- me.deselect(me.getSelected().getRange(), supress);
- me.setLastSelected(null);
- me.setLastFocused(null);
- },
- updateSelection: function(selection) {
- if (this.changingSelection) {
- return;
- }
- if (selection) {
- this.select(selection);
- } else {
- this.deselectAll();
- }
- },
-
-
- selectWithEvent: function(record) {
- var me = this,
- isSelected = me.isSelected(record);
- switch (me.getMode()) {
- case 'MULTI':
- case 'SIMPLE':
- if (isSelected) {
- me.deselect(record);
- } else {
- me.select(record, true);
- };
- break;
- case 'SINGLE':
- if (me.getAllowDeselect() && isSelected) {
-
- me.deselect(record);
- } else {
-
- me.select(record, false);
- };
- break;
- }
- },
-
- selectRange: function(startRecord, endRecord, keepExisting) {
- var me = this,
- store = me.getStore(),
- records = [],
- tmp, i;
- if (me.getDisableSelection()) {
- return;
- }
-
- if (startRecord > endRecord) {
- tmp = endRecord;
- endRecord = startRecord;
- startRecord = tmp;
- }
- for (i = startRecord; i <= endRecord; i++) {
- records.push(store.getAt(i));
- }
- this.doMultiSelect(records, keepExisting);
- },
-
- select: function(records, keepExisting, suppressEvent) {
- var me = this,
- record;
- if (me.getDisableSelection()) {
- return;
- }
- if (typeof records === "number") {
- records = [
- me.getStore().getAt(records)
- ];
- }
- if (!records) {
- return;
- }
- if (me.getMode() == "SINGLE" && records) {
- record = records.length ? records[0] : records;
- me.doSingleSelect(record, suppressEvent);
- } else {
- me.doMultiSelect(records, keepExisting, suppressEvent);
- }
- },
-
- doSingleSelect: function(record, suppressEvent) {
- this.doMultiSelect([
- record
- ], false, suppressEvent);
- },
-
- doMultiSelect: function(records, keepExisting, suppressEvent) {
- if (records === null || this.getDisableSelection()) {
- return;
- }
- records = !Ext.isArray(records) ? [
- records
- ] : records;
- var me = this,
- selected = me.getSelected(),
- selectionCount = selected.getCount(),
- toRemove = [],
- ln = records.length,
- change = false,
- i = 0,
- record;
- if (!keepExisting && selectionCount) {
- toRemove = selected.getRange();
- }
-
- for (i = 0; i < ln; i++) {
- record = records[i];
- if (typeof record === 'number') {
- records[i] = store.getAt(record);
- }
- }
-
-
-
- selected.suppressEvent = suppressEvent;
- selected.splice(selectionCount, toRemove, records);
- selected.suppressEvent = false;
- },
-
- deselect: function(records, suppressEvent) {
- var me = this;
- if (me.getDisableSelection()) {
- return;
- }
- records = Ext.isArray(records) ? records : [
- records
- ];
- var selected = me.getSelected(),
- store = me.getStore(),
- len = records.length,
- i, record;
-
- for (i = 0; i < len; i++) {
- record = records[i];
- if (typeof record === 'number') {
- records[i] = store.getAt(record);
- }
- }
-
-
-
- selected.suppressEvent = suppressEvent;
- selected.remove(records);
- selected.suppressEvent = false;
- },
-
- onCollectionRemove: function(selectedCollection, chunk) {
- var me = this,
- lastSelected = me.getLastSelected(),
- records = chunk.items;
-
- if (lastSelected && !selectedCollection.contains(lastSelected)) {
- me.setLastSelected(selectedCollection.last());
- }
- me.onItemDeselect(records, selectedCollection.suppressEvent);
- if (!selectedCollection.suppressEvent) {
- me.fireSelectionChange(records);
- }
- },
-
- onCollectionAdd: function(selectedCollection, adds) {
- var me = this,
- records = adds.items;
-
- me.setLastSelected(selectedCollection.last());
- me.onItemSelect(records, selectedCollection.suppressEvent);
- if (!selectedCollection.suppressEvent) {
- me.fireSelectionChange(records);
- }
- },
-
-
- updateLastFocused: function(newRecord, oldRecord) {
- this.onLastFocusChanged(oldRecord, newRecord);
- },
- fireSelectionChange: function(records) {
- var me = this;
- me.changingSelection = true;
- me.setSelection(me.getLastSelected() || null);
- me.changingSelection = false;
- me.fireAction('selectionchange', [
- me,
- records
- ], 'getSelections');
- },
-
- getSelections: function() {
- return this.getSelected().getRange();
- },
-
- isSelected: function(record) {
- record = Ext.isNumber(record) ? this.getStore().getAt(record) : record;
- return this.getSelected().indexOf(record) !== -1;
- },
-
- hasSelection: function() {
- return this.getSelected().getCount() > 0;
- },
-
- refreshSelection: function() {
- var me = this,
- selected = me.getSelected(),
- selections = selected.getRange(),
- selectionLength = selections.length,
- storeCollection = me.getStore().getData(),
- toDeselect = [],
- toReselect = [],
- i, rec, matchingSelection;
-
- if (me.getPruneRemoved()) {
-
-
-
- storeCollection = storeCollection.getSource() || storeCollection;
- for (i = 0; i < selectionLength; i++) {
- rec = selections[i];
- matchingSelection = storeCollection.get(storeCollection.getKey(rec));
- if (matchingSelection) {
- if (matchingSelection !== rec) {
- toDeselect.push(rec);
- toReselect.push(matchingSelection);
- }
- } else {
- toDeselect.push(rec);
- }
- }
- }
-
-
-
-
-
- selected.suppressEvent = true;
- selected.splice(selected.getCount(), toDeselect, toReselect);
- selected.suppressEvent = false;
- },
-
-
-
- onSelectionStoreRemove: function(store, records) {
- var me = this,
- selected = me.getSelected(),
- ln = records.length,
- removed, record, i;
- if (me.getDisableSelection()) {
- return;
- }
- for (i = 0; i < ln; i++) {
- record = records[i];
- if (selected.remove(record)) {
- if (me.getLastSelected() == record) {
- me.setLastSelected(null);
- }
- if (me.getLastFocused() == record) {
- me.setLastFocused(null);
- }
- removed = removed || [];
- removed.push(record);
- }
- }
- if (removed) {
- me.fireSelectionChange([
- removed
- ]);
- }
- },
- onSelectionStoreClear: function(store) {
- var records = store.getData().items;
- this.onSelectionStoreRemove(store, records);
- },
-
- getSelectionCount: function() {
- return this.getSelected().getCount();
- },
- onSelectionStoreAdd: Ext.emptyFn,
- onSelectionStoreUpdate: Ext.emptyFn,
- onItemSelect: Ext.emptyFn,
- onItemDeselect: Ext.emptyFn,
- onLastFocusChanged: Ext.emptyFn,
- onEditorKey: Ext.emptyFn
- }, function() {});
- Ext.define('Ext.mixin.StoreWatcher', {
- mixinId: 'storewatcher',
- config: {
- dataSource: null,
-
- owner: null,
-
- ownerListeners: {
- destroyable: true,
- storechange: 'onStoreChange'
- },
-
- sourceListeners: null,
- store: null,
-
- storeListeners: null
- },
- afterClassMixedIn: function(targetClass) {
- var configurator = this.getConfigurator(),
- prototype = targetClass.prototype,
- config = {},
- prop;
- for (prop in configurator.configs) {
-
-
-
- if (prototype.hasOwnProperty(prop)) {
- config[prop] = prototype[prop];
- delete prototype[prop];
- }
- }
- targetClass.addConfig(config);
- },
- onFilterChange: function(store) {
- var source;
- if (!store) {
- source = null;
- } else if (store.getDataSource) {
- source = store.getDataSource();
- } else {
- source = store.getData();
- }
- this.setDataSource(source);
- },
- onStoreChange: function(comp, store) {
- this.setStore(store);
- },
-
-
- updateDataSource: function(source) {
- this.syncListeners(source, '$sourceListeners', 'getSourceListeners');
- },
-
- updateOwner: function(owner) {
- this.syncListeners(owner, '$ownerListeners', 'getOwnerListeners');
- this.setStore(owner ? owner.getStore() : null);
- },
-
- applyStore: function(store) {
- return (store && !store.isEmptyStore) ? store : null;
- },
- updateStore: function(store) {
- this.syncListeners(store, '$storeListeners', 'getStoreListeners');
- this.onFilterChange(store);
- },
- privates: {
- syncListeners: function(instance, token, listeners) {
- var me = this,
- old = me[token];
- if (old) {
- me[token] = null;
- old.destroy();
- }
- if (instance) {
- listeners = me[listeners]();
- listeners = Ext.applyIf({
- destroyable: true,
- scope: me
- }, listeners);
- me[token] = instance.on(listeners);
- }
- }
- }
- });
- Ext.define('Ext.mixin.StyleCacher', {
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'stylecacher'
- },
- getCachedStyle: function(el, style) {
- var cache = this.$styleCache;
- if (!cache) {
- cache = this.$styleCache = {};
- }
- if (!(style in cache)) {
- cache[style] = Ext.fly(el).getStyle(style);
- }
- return cache[style];
- }
- });
- Ext.define('Ext.perf.Accumulator', function() {
- var currentFrame = null,
- khrome = Ext.global['chrome'],
-
- formatTpl,
-
-
- getTimestamp = function() {
- getTimestamp = Ext.now;
- var interval, toolbox;
-
- if (Ext.isChrome && khrome && khrome.Interval) {
- interval = new khrome.Interval();
- interval.start();
- getTimestamp = function() {
- return interval.microseconds() / 1000;
- };
- } else if (window.ActiveXObject) {
- try {
-
- toolbox = new ActiveXObject('SenchaToolbox.Toolbox');
-
- Ext.senchaToolbox = toolbox;
-
- getTimestamp = function() {
- return toolbox.milliseconds;
- };
- } catch (e) {}
- }
-
- Ext.perf.getTimestamp = Ext.perf.Accumulator.getTimestamp = getTimestamp;
- return getTimestamp();
- };
- function adjustSet(set, time) {
- set.sum += time;
- set.min = Math.min(set.min, time);
- set.max = Math.max(set.max, time);
- }
- function leaveFrame(time) {
- var totalTime = time ? time : (getTimestamp() - this.time),
-
- me = this,
-
- accum = me.accum;
- ++accum.count;
- if (!--accum.depth) {
- adjustSet(accum.total, totalTime);
- }
- adjustSet(accum.pure, totalTime - me.childTime);
- currentFrame = me.parent;
- if (currentFrame) {
- ++currentFrame.accum.childCount;
- currentFrame.childTime += totalTime;
- }
- }
- function makeSet() {
- return {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- }
- function makeTap(me, fn) {
- return function() {
- var frame = me.enter(),
- ret = fn.apply(this, arguments);
- frame.leave();
- return ret;
- };
- }
- function setToJSON(count, childCount, calibration, set) {
- var data = {
- avg: 0,
- min: set.min,
- max: set.max,
- sum: 0
- };
- if (count) {
- calibration = calibration || 0;
- data.sum = set.sum - childCount * calibration;
- data.avg = data.sum / count;
- }
-
-
- return data;
- }
- return {
- constructor: function(name) {
- var me = this;
- me.count = me.childCount = me.depth = me.maxDepth = 0;
- me.pure = makeSet();
- me.total = makeSet();
- me.name = name;
- },
- statics: {
- getTimestamp: getTimestamp
- },
- format: function(calibration) {
- if (!formatTpl) {
- formatTpl = new Ext.XTemplate([
- '{name} - {count} call(s)',
- '<tpl if="count">',
- '<tpl if="childCount">',
- ' ({childCount} children)',
- '</tpl>',
- '<tpl if="depth - 1">',
- ' ({depth} deep)',
- '</tpl>',
- '<tpl for="times">',
- ', {type}: {[this.time(values.sum)]} msec (',
-
- 'avg={[this.time(values.sum / parent.count)]}',
-
- ')',
- '</tpl>',
- '</tpl>'
- ].join(''), {
- time: function(t) {
- return Math.round(t * 100) / 100;
- }
- });
- }
- var data = this.getData(calibration);
- data.name = this.name;
- data.pure.type = 'Pure';
- data.total.type = 'Total';
- data.times = [
- data.pure,
- data.total
- ];
- return formatTpl.apply(data);
- },
- getData: function(calibration) {
- var me = this;
- return {
- count: me.count,
- childCount: me.childCount,
- depth: me.maxDepth,
- pure: setToJSON(me.count, me.childCount, calibration, me.pure),
- total: setToJSON(me.count, me.childCount, calibration, me.total)
- };
- },
- enter: function() {
- var me = this,
- frame = {
- accum: me,
- leave: leaveFrame,
- childTime: 0,
- parent: currentFrame
- };
- ++me.depth;
- if (me.maxDepth < me.depth) {
- me.maxDepth = me.depth;
- }
- currentFrame = frame;
- frame.time = getTimestamp();
-
- return frame;
- },
- monitor: function(fn, scope, args) {
- var frame = this.enter();
- if (args) {
- fn.apply(scope, args);
- } else {
- fn.call(scope);
- }
- frame.leave();
- },
- report: function() {
- Ext.log(this.format());
- },
- tap: function(className, methodName) {
- var me = this,
- methods = typeof methodName === 'string' ? [
- methodName
- ] : methodName,
- klass, statik, i, parts, length, name, src, tapFunc;
- tapFunc = function() {
- if (typeof className === 'string') {
- klass = Ext.global;
- parts = className.split('.');
- for (i = 0 , length = parts.length; i < length; ++i) {
- klass = klass[parts[i]];
- }
- } else {
- klass = className;
- }
- for (i = 0 , length = methods.length; i < length; ++i) {
- name = methods[i];
- statik = name.charAt(0) === '!';
- if (statik) {
- name = name.substring(1);
- } else {
- statik = !(name in klass.prototype);
- }
- src = statik ? klass : klass.prototype;
- src[name] = makeTap(me, src[name]);
- }
- };
- Ext.ClassManager.onCreated(tapFunc, me, className);
- return me;
- }
- };
- }, function() {
- Ext.perf.getTimestamp = this.getTimestamp;
- });
- Ext.define('Ext.perf.Monitor', {
- singleton: true,
- alternateClassName: 'Ext.Perf',
- constructor: function() {
- this.accumulators = [];
- this.accumulatorsByName = {};
- },
- calibrate: function() {
- var accum = new Ext.perf.Accumulator('$'),
- total = accum.total,
- getTimestamp = Ext.perf.Accumulator.getTimestamp,
- count = 0,
- frame, endTime, startTime;
- startTime = getTimestamp();
- do {
- frame = accum.enter();
- frame.leave();
- ++count;
- } while (total.sum < 100);
- endTime = getTimestamp();
- return (endTime - startTime) / count;
- },
- get: function(name) {
- var me = this,
- accum = me.accumulatorsByName[name];
- if (!accum) {
- me.accumulatorsByName[name] = accum = new Ext.perf.Accumulator(name);
- me.accumulators.push(accum);
- }
- return accum;
- },
- enter: function(name) {
- return this.get(name).enter();
- },
- monitor: function(name, fn, scope) {
- this.get(name).monitor(fn, scope);
- },
- report: function() {
- var me = this,
- accumulators = me.accumulators,
- calibration = me.calibrate();
- accumulators.sort(function(a, b) {
- return (a.name < b.name) ? -1 : ((b.name < a.name) ? 1 : 0);
- });
- me.updateGC();
- Ext.log('Calibration: ' + Math.round(calibration * 100) / 100 + ' msec/sample');
- Ext.each(accumulators, function(accum) {
- Ext.log(accum.format(calibration));
- });
- },
- getData: function(all) {
- var ret = {},
- accumulators = this.accumulators;
- Ext.each(accumulators, function(accum) {
- if (all || accum.count) {
- ret[accum.name] = accum.getData();
- }
- });
- return ret;
- },
- reset: function() {
- Ext.each(this.accumulators, function(accum) {
- var me = accum;
- me.count = me.childCount = me.depth = me.maxDepth = 0;
- me.pure = {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- me.total = {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- });
- },
- updateGC: function() {
- var accumGC = this.accumulatorsByName.GC,
- toolbox = Ext.senchaToolbox,
- bucket;
- if (accumGC) {
- accumGC.count = toolbox.garbageCollectionCounter || 0;
- if (accumGC.count) {
- bucket = accumGC.pure;
- accumGC.total.sum = bucket.sum = toolbox.garbageCollectionMilliseconds;
- bucket.min = bucket.max = bucket.sum / accumGC.count;
- bucket = accumGC.total;
- bucket.min = bucket.max = bucket.sum / accumGC.count;
- }
- }
- },
- watchGC: function() {
- Ext.perf.getTimestamp();
-
- var toolbox = Ext.senchaToolbox;
- if (toolbox) {
- this.get("GC");
- toolbox.watchGarbageCollector(false);
- }
- },
-
- setup: function(config) {
- if (!config) {
- config = {
-
-
-
-
-
-
-
-
- render: {
- 'Ext.Component': 'render'
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- layout: {
- 'Ext.layout.Context': 'run'
- }
- };
- }
- this.currentConfig = config;
- var key, prop, accum, className, methods;
- for (key in config) {
- if (config.hasOwnProperty(key)) {
- prop = config[key];
- accum = Ext.Perf.get(key);
- for (className in prop) {
- if (prop.hasOwnProperty(className)) {
- methods = prop[className];
- accum.tap(className, methods);
- }
- }
- }
- }
- this.watchGC();
- },
-
- setupLog: function(config) {
- var className, cls, methods, method, override;
- for (className in config) {
- if (config.hasOwnProperty(className)) {
- cls = Ext.ClassManager.get(className);
- if (cls) {
- methods = config[className];
- override = {};
- for (method in methods) {
- override[method] = (function(methodName, idProp) {
- return function() {
- var before, diff, id, idHolder, ret;
- before = +Date.now();
- ret = this.callParent(arguments);
- diff = +Date.now() - before;
- if (window.console && diff > 0) {
- idHolder = idProp === 'this' ? this : typeof idProp === 'string' ? this[idProp] : typeof idProp === 'number' ? arguments[idProp] : null;
- if (idHolder) {
- id = idHolder.id;
- }
- if (id != null) {
- console.log(methodName + ' for ' + id + ': ' + diff + 'ms');
- } else {
- console.log(methodName + ' for unknown: ' + diff + 'ms');
- }
- if (console.trace) {
- console.trace();
- }
- }
- return ret;
- };
- })(method, methods[method]);
- }
- Ext.override(cls, override);
- }
- }
- }
- }
- });
- Ext.define('Ext.plugin.AbstractClipboard', {
- extend: Ext.plugin.Abstract,
- cachedConfig: {
-
- formats: {
- text: {
- get: 'getTextData',
- put: 'putTextData'
- }
- }
- },
- config: {
-
- memory: null,
-
- source: 'system',
-
- system: 'text',
- gridListeners: null
- },
- destroy: function() {
- var me = this,
- keyMap = me.keyMap,
- shared = me.shared;
- Ext.destroy(me.destroyListener);
- if (keyMap) {
-
-
- me.keyMap = Ext.destroy(keyMap);
- if (!--shared.counter) {
- shared.textArea = Ext.destroy(shared.textArea);
- }
- } else {
-
-
- me.renderListener = Ext.destroy(me.renderListener);
- }
- me.callParent();
- },
- init: function(comp) {
- var me = this,
- listeners = me.getGridListeners();
- if (comp.rendered) {
- me.finishInit(comp);
- } else if (listeners) {
- me.renderListener = comp.on(Ext.apply({
- scope: me,
- destroyable: true,
- single: true
- }, listeners));
- }
- },
- onCmpReady: function() {
- this.renderListener = null;
- this.finishInit(this.getCmp());
- },
-
- getTarget: function(comp) {
- return comp.el;
- },
-
-
- privates: {
-
- shared: {
- counter: 0,
- data: null,
- textArea: null
- },
- applyMemory: function(value) {
-
- value = this.applySource(value);
-
- if (value) {
- for (var i = value.length; i-- > 0; ) {
- if (value[i] === 'system') {
- Ext.raise('Invalid clipboard format "' + value[i] + '"');
- }
- }
- }
-
- return value;
- },
- applySource: function(value) {
-
- if (value) {
- if (Ext.isString(value)) {
- value = [
- value
- ];
- } else if (value.length === 0) {
- value = null;
- }
- }
-
- if (value) {
- var formats = this.getFormats();
- for (var i = value.length; i-- > 0; ) {
- if (value[i] !== 'system' && !formats[value[i]]) {
- Ext.raise('Invalid clipboard format "' + value[i] + '"');
- }
- }
- }
-
- return value || null;
- },
-
- applySystem: function(value) {
- var formats = this.getFormats();
- if (!formats[value]) {
- Ext.raise('Invalid clipboard format "' + value + '"');
- }
- return value;
- },
-
- doCutCopy: function(event, erase) {
- var me = this,
- formats = me.allFormats || me.syncFormats(),
- data = me.getData(erase, formats),
- memory = me.getMemory(),
- system = me.getSystem(),
- sys;
- if (me.validateAction(event) === false) {
- return;
- }
- me.shared.data = memory && data;
- if (system) {
- sys = data[system];
- if (formats[system] < 3) {
- delete data[system];
- }
- me.setClipboardData(sys);
- }
- },
- doPaste: function(format, data) {
- var formats = this.getFormats();
- this[formats[format].put](data, format);
- },
- finishInit: function(comp) {
- var me = this;
- me.keyMap = new Ext.util.KeyMap({
- target: me.getTarget(comp),
- ignoreInputFields: true,
- binding: [
- {
- ctrl: true,
- key: 'x',
- fn: me.onCut,
- scope: me
- },
- {
- ctrl: true,
- key: 'c',
- fn: me.onCopy,
- scope: me
- },
- {
- ctrl: true,
- key: 'v',
- fn: me.onPaste,
- scope: me
- }
- ]
- });
- ++me.shared.counter;
- me.destroyListener = comp.on({
- destroyable: true,
- destroy: 'destroy',
- scope: me
- });
- },
- getData: function(erase, format) {
- var me = this,
- formats = me.getFormats(),
- data, i, name, names;
- if (Ext.isString(format)) {
-
- if (!formats[format]) {
- Ext.raise('Invalid clipboard format "' + format + '"');
- }
-
- data = me[formats[format].get](format, erase);
- } else {
- data = {};
- names = [];
- if (format) {
- for (name in format) {
-
- if (!formats[name]) {
- Ext.raise('Invalid clipboard format "' + name + '"');
- }
-
- names.push(name);
- }
- } else {
- names = Ext.Object.getAllKeys(formats);
- }
- for (i = names.length; i-- > 0; ) {
- data[name] = me[formats[name].get](name, erase && !i);
- }
- }
- return data;
- },
-
- getHiddenTextArea: function() {
- var shared = this.shared,
- el;
- el = shared.textArea;
- if (!el) {
- el = shared.textArea = Ext.getBody().createChild({
- tag: 'textarea',
- tabIndex: -1,
-
- style: {
- position: 'absolute',
- top: '-1000px',
- width: '1px',
- height: '1px'
- }
- });
-
- el.suspendFocusEvents();
- }
- return el;
- },
- onCopy: function(keyCode, event) {
- this.doCutCopy(event, false);
- },
- onCut: function(keyCode, event) {
- this.doCutCopy(event, true);
- },
- onPaste: function(keyCode, event) {
- var me = this,
- sharedData = me.shared.data,
- source = me.getSource(),
- i, n, s;
- if (me.validateAction(event) === false) {
- return;
- }
- if (source) {
- for (i = 0 , n = source.length; i < n; ++i) {
- s = source[i];
- if (s === 'system') {
-
- s = me.getSystem();
- me.pasteClipboardData(s);
- break;
- } else if (sharedData && (s in sharedData)) {
- me.doPaste(s, sharedData[s]);
- break;
- }
- }
- }
- },
- pasteClipboardData: function(format) {
- var me = this,
- clippy = window.clipboardData,
- area, focusEl;
- if (clippy && clippy.getData) {
- me.doPaste(format, clippy.getData("text"));
- } else {
- focusEl = Ext.Element.getActiveElement(true);
- area = me.getHiddenTextArea().dom;
- area.value = '';
-
- if (focusEl) {
- focusEl.suspendFocusEvents();
- }
- area.focus();
-
-
-
- Ext.defer(function() {
-
- if (focusEl) {
- focusEl.focus();
-
- focusEl.resumeFocusEvents();
- }
- me.doPaste(format, area.value);
- area.value = '';
- }, 100, me);
- }
- },
- setClipboardData: function(data) {
- var clippy = window.clipboardData;
- if (clippy && clippy.setData) {
- clippy.setData("text", data);
- } else {
- var me = this,
- area = me.getHiddenTextArea().dom,
- focusEl = Ext.Element.getActiveElement(true);
- area.value = data;
-
- if (focusEl) {
- focusEl.suspendFocusEvents();
- }
- area.focus();
- area.select();
-
-
-
- Ext.defer(function() {
- area.value = '';
- if (focusEl) {
- focusEl.focus();
-
- focusEl.resumeFocusEvents();
- }
- }, 50);
- }
- },
- syncFormats: function() {
- var me = this,
- map = {},
- memory = me.getMemory(),
- system = me.getSystem(),
- i, s;
- if (system) {
- map[system] = 1;
- }
- if (memory) {
- for (i = memory.length; i-- > 0; ) {
- s = memory[i];
- map[s] = map[s] ? 3 : 2;
- }
- }
-
-
-
- return me.allFormats = map;
- },
-
- updateMemory: function() {
- this.allFormats = null;
- },
- updateSystem: function() {
- this.allFormats = null;
- },
- validateAction: Ext.privateFn
- }
- });
- Ext.define('Ext.plugin.MouseEnter', {
- extend: Ext.plugin.Abstract,
- alias: 'plugin.mouseenter',
-
- element: 'el',
-
-
-
-
-
- init: function(component) {
-
- if (!this.delegate) {
- Ext.raise('mouseenter plugin must be configured with a delegate selector');
- }
- if (!this.handler) {
- Ext.raise('mouseenter plugin must be configured with handler callback');
- }
-
- var me = this,
- listeners = {
- mouseover: 'onMouseEvent',
- scope: me,
- destroyable: true
- },
- element = me.element;
-
-
- if (me.leaveHandler || me.delay) {
- listeners.mouseout = 'onMouseEvent';
- }
-
- if (typeof element === 'string') {
- element = component[me.element];
- }
-
-
- if (element) {
- me.mouseListener = Ext.get(element).on(listeners);
- } else
-
-
- {
- component.on({
- render: function() {
- me.mouseListener = component[me.element].on(listeners);
- },
- single: true
- });
- }
- },
- onMouseEvent: function(e) {
- var me = this,
- delegate = e.getTarget(me.delegate);
-
- if (delegate && delegate !== e.getRelatedTarget(me.delegate)) {
- if (me.delay) {
- Ext.undefer(me.mouseEventTimer);
- me.mouseEventTimer = Ext.defer(me.handleMouseEvent, me.delay, me, [
- e,
- delegate
- ]);
- } else {
- me.handleMouseEvent(e, delegate);
- }
- }
- },
- handleMouseEvent: function(e, delegate) {
- var me = this;
- if (e.type === 'mouseover') {
- Ext.callback(me.handler, null, [
- e,
- delegate
- ], 0, me.cmp, me.scope);
- } else if (me.leaveHandler) {
- Ext.callback(me.leaveHandler, null, [
- e,
- delegate
- ], 0, me.cmp, me.scope);
- }
- },
- destroy: function() {
- Ext.destroy(this.mouseListener);
- this.callParent();
- }
- });
- Ext.define('Ext.sparkline.Shape', {
- constructor: function(target, id, type, args) {
- var me = this;
- me.target = target;
- me.id = id;
- me.type = type;
- me.args = args;
- },
- append: function() {
- this.target.appendShape(this);
- return this;
- }
- });
- Ext.define('Ext.sparkline.CanvasBase', {
- shapeCount: 0,
- _pxregex: /(\d+)(px)?\s*$/i,
- constructor: function(ownerSparkLine) {
- this.owner = ownerSparkLine;
- this.rtl = this.owner.getInherited().rtl;
- },
- setWidth: function(width) {
- this.pixelWidth = width;
- },
- setHeight: function(height) {
- this.pixelHeight = height;
- },
- drawLine: function(x1, y1, x2, y2, lineColor, lineWidth) {
- return this.drawShape([
- [
- x1,
- y1
- ],
- [
- x2,
- y2
- ]
- ], lineColor, lineWidth);
- },
- drawShape: function(path, lineColor, fillColor, lineWidth) {
- return this._genShape('Shape', [
- path,
- lineColor,
- fillColor,
- lineWidth
- ]);
- },
- drawCircle: function(x, y, radius, lineColor, fillColor, lineWidth) {
- return this._genShape('Circle', [
- x,
- y,
- radius,
- lineColor,
- fillColor,
- lineWidth
- ]);
- },
- drawPieSlice: function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
- return this._genShape('PieSlice', [
- x,
- y,
- radius,
- startAngle,
- endAngle,
- lineColor,
- fillColor
- ]);
- },
- drawRect: function(x, y, width, height, lineColor, fillColor) {
- return this._genShape('Rect', [
- x,
- y,
- width,
- height,
- lineColor,
- fillColor
- ]);
- },
- getElement: function() {
- return this.el;
- },
-
- getLastShapeId: function() {
- return this.lastShapeId;
- },
-
- reset: function() {
-
- Ext.raise('reset not implemented');
- },
-
-
- _genShape: function(shapetype, shapeargs) {
- var id = this.shapeCount++;
- shapeargs.unshift(id);
- return new Ext.sparkline.Shape(this, id, shapetype, shapeargs);
- },
-
- appendShape: function(shape) {
-
- Ext.raise('appendShape not implemented');
- },
-
-
- replaceWithShape: function(shapeid, shape) {
-
- Ext.raise('replaceWithShape not implemented');
- },
-
-
- insertAfterShape: function(shapeid, shape) {
-
- Ext.raise('insertAfterShape not implemented');
- },
-
-
- removeShapeId: function(shapeid) {
-
- Ext.raise('removeShapeId not implemented');
- },
-
-
- getShapeAt: function(x, y) {
-
- Ext.raise('getShapeAt not implemented');
- },
-
-
- render: function() {
-
- Ext.raise('render not implemented');
- }
- });
- Ext.define('Ext.sparkline.CanvasCanvas', {
- extend: Ext.sparkline.CanvasBase,
- statics: {
- contextOverrides: (function() {
- var ratio = window.devicePixelRatio || 1;
- return {
- moveTo: function(x, y) {
-
- if (this.rtl) {
- x = this.canvas.width - x - 1;
- }
- this.$moveTo(x * ratio, y * ratio);
- },
- lineTo: function(x, y) {
-
- if (this.rtl) {
- x = this.canvas.width - x - 1;
- }
- this.$lineTo(x * ratio, y * ratio);
- },
- arc: function(x, y, radius, startAngle, endAngle, counterclockwise) {
-
- if (this.rtl) {
- x = this.canvas.width - x - 1;
- }
- this.$arc(x * ratio, y * ratio, radius * ratio, startAngle, endAngle, counterclockwise);
- },
- clearRect: function(x, y, width, height) {
-
- if (this.rtl) {
- x = this.canvas.width - x - width;
- }
- this.$clearRect(x * ratio, y * ratio, width * ratio, height * ratio);
- }
- };
- })()
- },
- setWidth: function(width) {
- this.callParent(arguments);
- this.owner.element.dom.width = width * (window.devicePixelRatio || 1);
- },
- setHeight: function(height) {
- this.callParent(arguments);
- this.owner.element.dom.height = height * (window.devicePixelRatio || 1);
- },
- onOwnerUpdate: function() {
- var me = this;
- me.el = me.owner.element;
- me.interact = !me.owner.initialConfig.disableInteraction;
- me.shapes = {};
- me.shapeseq = [];
- me.currentTargetShapeId = me.lastShapeId = null;
- },
- _getContext: function(lineColor, fillColor, lineWidth) {
- var context = this.context,
- overrides, name;
- if (!context) {
- this.context = context = this.el.dom.getContext('2d');
- overrides = Ext.sparkline.CanvasCanvas.contextOverrides;
- for (name in overrides) {
- context['$' + name] = context[name];
- }
- Ext.apply(context, overrides);
- context.rtl = this.rtl;
- }
- if (lineColor != null) {
- context.strokeStyle = lineColor;
- }
- context.lineWidth = lineWidth || 1;
- if (fillColor != null) {
- context.fillStyle = fillColor;
- }
- return context;
- },
- reset: function() {
- var context = this._getContext();
- context.clearRect(0, 0, this.pixelWidth, this.pixelHeight);
- this.shapes = {};
- this.shapeseq = [];
- this.currentTargetShapeId = this.lastShapeId = null;
- },
- _drawShape: function(shapeid, path, lineColor, fillColor, lineWidth) {
- var context = this._getContext(lineColor, fillColor, lineWidth),
- xIncr = this.rtl ? -0.5 : 0.5,
- i, plen;
- context.beginPath();
- context.moveTo(path[0][0] + xIncr, path[0][1] + 0.5);
- for (i = 1 , plen = path.length; i < plen; i++) {
- context.lineTo(path[i][0] + xIncr, path[i][1] + 0.5);
- }
-
- if (lineColor != null) {
- context.stroke();
- }
- if (fillColor != null) {
- context.fill();
- }
- if (this.targetX != null && this.targetY != null && context.isPointInPath(this.targetX, this.targetY)) {
- this.currentTargetShapeId = shapeid;
- }
- },
- _drawCircle: function(shapeid, x, y, radius, lineColor, fillColor, lineWidth) {
- var context = this._getContext(lineColor, fillColor, lineWidth);
- context.beginPath();
- context.arc(x, y, radius, 0, 2 * Math.PI, false);
- if (this.targetX != null && this.targetY != null && context.isPointInPath(this.targetX, this.targetY)) {
- this.currentTargetShapeId = shapeid;
- }
- if (lineColor != null) {
- context.stroke();
- }
- if (fillColor != null) {
- context.fill();
- }
- },
- _drawPieSlice: function(shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {
- var context = this._getContext(lineColor, fillColor);
- context.beginPath();
- context.moveTo(x, y);
- context.arc(x, y, radius, startAngle, endAngle, false);
- context.lineTo(x, y);
- context.closePath();
- if (lineColor != null) {
- context.stroke();
- }
- if (fillColor) {
- context.fill();
- }
- if (this.targetX !== undefined && this.targetY !== undefined && context.isPointInPath(this.targetX, this.targetY)) {
- this.currentTargetShapeId = shapeid;
- }
- },
- _drawRect: function(shapeid, x, y, width, height, lineColor, fillColor) {
- return this._drawShape(shapeid, [
- [
- x,
- y
- ],
- [
- x + width,
- y
- ],
- [
- x + width,
- y + height
- ],
- [
- x,
- y + height
- ],
- [
- x,
- y
- ]
- ], lineColor, fillColor);
- },
- appendShape: function(shape) {
- this.shapes[shape.id] = shape;
- this.shapeseq.push(shape.id);
- this.lastShapeId = shape.id;
- return shape.id;
- },
- replaceWithShape: function(shapeid, shape) {
- var shapeseq = this.shapeseq,
- i;
- this.shapes[shape.id] = shape;
- for (i = shapeseq.length; i--; ) {
- if (shapeseq[i] === shapeid) {
- shapeseq[i] = shape.id;
- }
- }
- delete this.shapes[shapeid];
- },
- replaceWithShapes: function(shapeids, shapes) {
- var shapeseq = this.shapeseq,
- shapemap = {},
- sid, i, first;
- for (i = shapeids.length; i--; ) {
- shapemap[shapeids[i]] = true;
- }
- for (i = shapeseq.length; i--; ) {
- sid = shapeseq[i];
- if (shapemap[sid]) {
- shapeseq.splice(i, 1);
- delete this.shapes[sid];
- first = i;
- }
- }
- for (i = shapes.length; i--; ) {
- shapeseq.splice(first, 0, shapes[i].id);
- this.shapes[shapes[i].id] = shapes[i];
- }
- },
- insertAfterShape: function(shapeid, shape) {
- var shapeseq = this.shapeseq,
- i;
- for (i = shapeseq.length; i--; ) {
- if (shapeseq[i] === shapeid) {
- shapeseq.splice(i + 1, 0, shape.id);
- this.shapes[shape.id] = shape;
- return;
- }
- }
- },
- removeShapeId: function(shapeid) {
- var shapeseq = this.shapeseq,
- i;
- for (i = shapeseq.length; i--; ) {
- if (shapeseq[i] === shapeid) {
- shapeseq.splice(i, 1);
- break;
- }
- }
- delete this.shapes[shapeid];
- },
- getShapeAt: function(x, y) {
-
- if (this.rtl) {
- x = this.el.dom.width - x - 1;
- }
- this.targetX = x;
- this.targetY = y;
- this.render();
- return this.currentTargetShapeId;
- },
- render: function() {
- var shapeseq = this.shapeseq,
- shapes = this.shapes,
- shapeCount = shapeseq.length,
- context = this._getContext(),
- shapeid, shape, i;
- context.clearRect(0, 0, this.pixelWidth, this.pixelHeight);
- for (i = 0; i < shapeCount; i++) {
- shapeid = shapeseq[i];
- shape = shapes[shapeid];
- this['_draw' + shape.type].apply(this, shape.args);
- }
- if (!this.interact) {
-
- this.shapes = {};
- this.shapeseq = [];
- }
- }
- });
- Ext.define('Ext.sparkline.VmlCanvas', {
- extend: Ext.sparkline.CanvasBase,
- setWidth: function(width) {
- var me = this;
- me.callParent(arguments);
- me.owner.groupEl.dom.coordsize = me.width + ' ' + (me.height || 0);
- me.owner.groupEl.dom.style.width = width + 'px';
- },
- setHeight: function(height) {
- var me = this;
- me.callParent(arguments);
- me.owner.groupEl.dom.coordsize = (me.width || 0) + ' ' + me.height;
- me.owner.groupEl.dom.style.height = height + 'px';
- },
- onOwnerUpdate: function() {
- var me = this;
- me.group = me.owner.groupEl;
- me.el = me.owner.element;
- me.prerender = [];
- },
- _drawShape: function(shapeid, path, lineColor, fillColor, lineWidth) {
- var vpath = [],
- initial, stroke, fill, closed, plen, i;
- for (i = 0 , plen = path.length; i < plen; i++) {
- vpath[i] = (path[i][0]) + ',' + (path[i][1]);
- }
- initial = vpath.splice(0, 1);
- lineWidth = lineWidth == null ? 1 : lineWidth;
- stroke = lineColor == null ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + 'px" strokeColor="' + lineColor + '" ';
- fill = fillColor == null ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
- closed = vpath[0] === vpath[vpath.length - 1] ? 'x ' : '';
- return [
- '<svml:shape coordorigin="0 0" coordsize="',
- this.pixelWidth,
- ' ',
- this.pixelHeight,
- '" id="jqsshape',
- shapeid,
- '" ',
- stroke,
- fill,
- ' style="position:absolute;height:',
- this.pixelHeight,
- 'px;width:',
- this.pixelWidth,
- 'px" ',
- ' path="m ',
- initial,
- ' l ',
- vpath.join(', '),
- ' ',
- closed,
- 'e"></svml:shape>'
- ].join('');
- },
- _drawCircle: function(shapeid, x, y, radius, lineColor, fillColor, lineWidth) {
- var circumference = radius * 2,
- stroke, fill;
- x -= radius;
- y -= radius;
- stroke = lineColor == null ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + 'px" strokeColor="' + lineColor + '" ';
- fill = fillColor == null ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
- return [
- '<svml:oval id="jqsshape',
- shapeid,
- '" ',
- stroke,
- fill,
- ' style="position:absolute;top:',
- y,
- 'px; left:',
- x,
- 'px;width:',
- circumference,
- 'px;height:',
- circumference,
- 'px"></svml:oval>'
- ].join('');
- },
- _drawPieSlice: function(shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {
- var vpath,
- width = this.pixelWidth,
- height = this.pixelHeight,
- startx, starty, endx, endy,
- stroke = lineColor == null ? ' stroked="false" ' : ' strokeWeight="1px" strokeColor="' + lineColor + '" ',
- fill = fillColor == null ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
-
- if (startAngle === endAngle) {
- return '';
- }
- if ((endAngle - startAngle) === (2 * Math.PI)) {
- startAngle = 0;
-
- endAngle = (2 * Math.PI);
- }
- startx = x + Math.round(Math.cos(startAngle) * radius);
- starty = y + Math.round(Math.sin(startAngle) * radius);
- endx = x + Math.round(Math.cos(endAngle) * radius);
- endy = y + Math.round(Math.sin(endAngle) * radius);
- if (startx === endx && starty === endy) {
- if ((endAngle - startAngle) < Math.PI) {
-
- return '';
- }
-
- startx = endx = x + radius;
- starty = endy = y;
- }
- if (startx === endx && starty === endy && (endAngle - startAngle) < Math.PI) {
- return '';
- }
- vpath = [
- x - radius,
- y - radius,
- x + radius,
- y + radius,
- startx,
- starty,
- endx,
- endy
- ];
- return [
- '<svml:shape coordorigin="0 0" coordsize="',
- width,
- ' ',
- height,
- '" id="jqsshape',
- shapeid,
- '" ',
- stroke,
- fill,
- ' style="position:absolute;height:',
- height,
- 'px;width:',
- width,
- 'px" path="m ',
- x,
- ',',
- y,
- ' wa ',
- vpath.join(', '),
- ' x e"></svml:shape>'
- ].join('');
- },
- _drawRect: function(shapeid, x, y, width, height, lineColor, fillColor) {
- return this._drawShape(shapeid, [
- [
- x,
- y
- ],
- [
- x,
- y + height
- ],
- [
- x + width,
- y + height
- ],
- [
- x + width,
- y
- ],
- [
- x,
- y
- ]
- ], lineColor, fillColor);
- },
- reset: function() {
- Ext.fly(this.group).empty();
- },
- appendShape: function(shape) {
- this.prerender.push(this['_draw' + shape.type].apply(this, shape.args));
- this.lastShapeId = shape.id;
- return shape.id;
- },
- replaceWithShape: function(shapeid, shape) {
- var existing = this.el.getById('jqsshape' + shapeid, true),
- vel = this['_draw' + shape.type].apply(this, shape.args);
- existing.outerHTML = vel;
- },
- replaceWithShapes: function(shapeids, shapes) {
-
- var existing = this.el.getById('jqsshape' + shapeids[0], true),
- replace = '',
- slen = shapes.length,
- i;
- for (i = 0; i < slen; i++) {
- replace += this['_draw' + shapes[i].type].apply(this, shapes[i].args);
- }
- existing.outerHTML = replace;
- for (i = 1; i < shapeids.length; i++) {
- this.el.getById('jqsshape' + shapeids[i]).destroy();
- }
- },
- insertAfterShape: function(shapeid, shape) {
- var existing = this.el.getById('jqsshape' + shapeid, true),
- vel = this['_draw' + shape.type].apply(this, shape.args);
- existing.insertAdjacentHTML('afterEnd', vel);
- },
- removeShapeId: function(shapeid) {
- var existing = this.el.getById('jqsshape' + shapeid, true);
- this.group.removeChild(existing);
- },
- getShapeAt: function(x, y) {
- var shapeid = this.el.id.substr(8);
- return shapeid;
- },
- render: function() {
- this.group.dom.innerHTML = this.prerender.join('');
- }
- }, function() {
- Ext.onInternalReady(function() {
- var doc = document;
- if (doc.namespaces && !doc.namespaces.svml) {
- doc.namespaces.add("svml", "urn:schemas-microsoft-com:vml", '#default#VML');
- }
- });
- });
- Ext.define('Ext.util.Color', {
- alternateClassName: 'Ext.draw.Color',
- statics: {
- colorToHexRe: /(.*?)rgb\((\d+),\s*(\d+),\s*(\d+)\)/,
- rgbToHexRe: /\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/,
- rgbaToHexRe: /\s*rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\.\d]+)\)/,
- hexRe: /\s*#([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/,
-
-
-
- NONE: 'none',
- RGBA_NONE: 'rgba(0, 0, 0, 0)'
- },
- isColor: true,
-
- lightnessFactor: 0.2,
-
- constructor: function(red, green, blue, alpha) {
- this.setRGB(red, green, blue, alpha);
- },
- clone: function() {
- var me = this;
- return new this.self(me.r, me.g, me.b, me.a);
- },
- setRGB: function(red, green, blue, alpha) {
- var me = this;
- me.r = Math.min(255, Math.max(0, red));
- me.g = Math.min(255, Math.max(0, green));
- me.b = Math.min(255, Math.max(0, blue));
- if (alpha === undefined) {
- me.a = 1;
- } else {
- me.a = Math.min(1, Math.max(0, alpha));
- }
- },
-
- getBrightness: function() {
- var r = this.r / 255 * 100,
- g = this.g / 255 * 100,
- b = this.b / 255 * 100;
- return ((r * 299) + (g * 587) + (b * 114)) / 1000;
- },
-
- getGrayscale: function() {
-
- return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;
- },
-
- getHSL: function() {
- var me = this,
- r = me.r / 255,
- g = me.g / 255,
- b = me.b / 255,
- max = Math.max(r, g, b),
- min = Math.min(r, g, b),
- delta = max - min,
- h,
- s = 0,
- l = 0.5 * (max + min);
-
- if (min !== max) {
- s = (l <= 0.5) ? delta / (max + min) : delta / (2 - max - min);
- if (r === max) {
- h = 60 * (g - b) / delta;
- } else if (g === max) {
- h = 120 + 60 * (b - r) / delta;
- } else {
- h = 240 + 60 * (r - g) / delta;
- }
- if (h < 0) {
- h += 360;
- }
- if (h >= 360) {
- h -= 360;
- }
- }
- return [
- h,
- s,
- l
- ];
- },
-
- getHSV: function() {
- var me = this,
- r = me.r / 255,
- g = me.g / 255,
- b = me.b / 255,
- max = Math.max(r, g, b),
- min = Math.min(r, g, b),
- C = max - min,
- h,
- s = 0,
- v = max;
-
- if (min != max) {
- s = v ? C / v : 0;
- if (r === max) {
- h = 60 * (g - b) / C;
- } else if (g === max) {
- h = 60 * (b - r) / C + 120;
- } else {
- h = 60 * (r - g) / C + 240;
- }
- if (h < 0) {
- h += 360;
- }
- if (h >= 360) {
- h -= 360;
- }
- }
- return [
- h,
- s,
- v
- ];
- },
-
- setHSL: function(h, s, l) {
- var me = this,
- abs = Math.abs,
- c, x, m;
- h = (h % 360 + 360) % 360;
- s = s > 1 ? 1 : s < 0 ? 0 : s;
- l = l > 1 ? 1 : l < 0 ? 0 : l;
- if (s === 0 || h === null) {
- l *= 255;
- me.setRGB(l, l, l);
- } else {
-
- h /= 60;
- c = s * (1 - abs(2 * l - 1));
-
- x = c * (1 - abs(h % 2 - 1));
-
- m = l - c / 2;
-
- m *= 255;
- c *= 255;
- x *= 255;
- switch (Math.floor(h)) {
- case 0:
- me.setRGB(c + m, x + m, m);
- break;
- case 1:
- me.setRGB(x + m, c + m, m);
- break;
- case 2:
- me.setRGB(m, c + m, x + m);
- break;
- case 3:
- me.setRGB(m, x + m, c + m);
- break;
- case 4:
- me.setRGB(x + m, m, c + m);
- break;
- case 5:
- me.setRGB(c + m, m, x + m);
- break;
- }
- }
- return me;
- },
-
- setHSV: function(h, s, v) {
- var me = this,
- c, x, m;
- h = (h % 360 + 360) % 360;
- s = s > 1 ? 1 : s < 0 ? 0 : s;
- v = v > 1 ? 1 : v < 0 ? 0 : v;
- if (s === 0 || h === null) {
- v *= 255;
- me.setRGB(v, v, v);
- } else {
-
- h /= 60;
- c = v * s;
-
- x = c * (1 - Math.abs(h % 2 - 1));
-
- m = v - c;
-
- m *= 255;
- c *= 255;
- x *= 255;
- switch (Math.floor(h)) {
- case 0:
- me.setRGB(c + m, x + m, m);
- break;
- case 1:
- me.setRGB(x + m, c + m, m);
- break;
- case 2:
- me.setRGB(m, c + m, x + m);
- break;
- case 3:
- me.setRGB(m, x + m, c + m);
- break;
- case 4:
- me.setRGB(x + m, m, c + m);
- break;
- case 5:
- me.setRGB(c + m, m, x + m);
- break;
- }
- }
- return me;
- },
-
- createLighter: function(factor) {
- var color = this.clone();
- color.lighten(factor);
- return color;
- },
-
- lighten: function(factor) {
- if (!factor && factor !== 0) {
- factor = this.lightnessFactor;
- }
- var hsl = this.getHSL();
- this.setHSL(hsl[0], hsl[1], Ext.Number.constrain(hsl[2] + factor, 0, 1));
- },
-
- createDarker: function(factor) {
- var color = this.clone();
- color.darken(factor);
- return color;
- },
-
- darken: function(factor) {
- if (!factor && factor !== 0) {
- factor = this.lightnessFactor;
- }
- return this.lighten(-factor);
- },
-
- toString: function() {
- var me = this,
- round = Math.round;
- if (me.a === 1) {
- var r = round(me.r).toString(16),
- g = round(me.g).toString(16),
- b = round(me.b).toString(16);
- r = (r.length === 1) ? '0' + r : r;
- g = (g.length === 1) ? '0' + g : g;
- b = (b.length === 1) ? '0' + b : b;
- return [
- '#',
- r,
- g,
- b
- ].join('');
- } else {
- return 'rgba(' + [
- round(me.r),
- round(me.g),
- round(me.b),
- me.a === 0 ? 0 : me.a.toFixed(15)
- ].join(', ') + ')';
- }
- },
-
-
-
-
-
-
- toHex: function(color) {
- var r = this.r,
- g = this.g,
- b = this.b,
- rgb = b | (g << 8) | (r << 16);
- return '#' + ('000000' + rgb.toString(16)).slice(-6);
- },
-
- setFromString: function(str) {
- var values, r, g, b,
- a = 1,
- parse = parseInt;
- if (str === Ext.util.Color.NONE) {
- this.r = this.g = this.b = this.a = 0;
- return this;
- }
- if ((str.length === 4 || str.length === 7) && str.substr(0, 1) === '#') {
- values = str.match(Ext.util.Color.hexRe);
- if (values) {
- r = parse(values[1], 16) >> 0;
- g = parse(values[2], 16) >> 0;
- b = parse(values[3], 16) >> 0;
- if (str.length === 4) {
- r += (r * 16);
- g += (g * 16);
- b += (b * 16);
- }
- }
- } else if ((values = str.match(Ext.util.Color.rgbToHexRe))) {
- r = +values[1];
- g = +values[2];
- b = +values[3];
- } else if ((values = str.match(Ext.util.Color.rgbaToHexRe))) {
- r = +values[1];
- g = +values[2];
- b = +values[3];
- a = +values[4];
- } else {
- if (Ext.util.Color.ColorList.hasOwnProperty(str.toLowerCase())) {
- return this.setFromString(Ext.util.Color.ColorList[str.toLowerCase()]);
- }
- }
- if (typeof r === 'undefined') {
- return this;
- }
- this.r = r;
- this.g = g;
- this.b = b;
- this.a = a;
- return this;
- }
- }, function() {
- var flyColor = new this();
- this.addStatics({
-
- fly: function(red, green, blue, alpha) {
- switch (arguments.length) {
- case 1:
- flyColor.setFromString(red);
- break;
- case 3:
- case 4:
- flyColor.setRGB(red, green, blue, alpha);
- break;
- default:
- return null;
- }
- return flyColor;
- },
- ColorList: {
- aliceblue: '#f0f8ff',
- antiquewhite: '#faebd7',
- aqua: '#00ffff',
- aquamarine: '#7fffd4',
- azure: '#f0ffff',
- beige: '#f5f5dc',
- bisque: '#ffe4c4',
- black: '#000000',
- blanchedalmond: '#ffebcd',
- blue: '#0000ff',
- blueviolet: '#8a2be2',
- brown: '#a52a2a',
- burlywood: '#deb887',
- cadetblue: '#5f9ea0',
- chartreuse: '#7fff00',
- chocolate: '#d2691e',
- coral: '#ff7f50',
- cornflowerblue: '#6495ed',
- cornsilk: '#fff8dc',
- crimson: '#dc143c',
- cyan: '#00ffff',
- darkblue: '#00008b',
- darkcyan: '#008b8b',
- darkgoldenrod: '#b8860b',
- darkgray: '#a9a9a9',
- darkgreen: '#006400',
- darkkhaki: '#bdb76b',
- darkmagenta: '#8b008b',
- darkolivegreen: '#556b2f',
- darkorange: '#ff8c00',
- darkorchid: '#9932cc',
- darkred: '#8b0000',
- darksalmon: '#e9967a',
- darkseagreen: '#8fbc8f',
- darkslateblue: '#483d8b',
- darkslategray: '#2f4f4f',
- darkturquoise: '#00ced1',
- darkviolet: '#9400d3',
- deeppink: '#ff1493',
- deepskyblue: '#00bfff',
- dimgray: '#696969',
- dodgerblue: '#1e90ff',
- firebrick: '#b22222',
- floralwhite: '#fffaf0',
- forestgreen: '#228b22',
- fuchsia: '#ff00ff',
- gainsboro: '#dcdcdc',
- ghostwhite: '#f8f8ff',
- gold: '#ffd700',
- goldenrod: '#daa520',
- gray: '#808080',
- green: '#008000',
- greenyellow: '#adff2f',
- honeydew: '#f0fff0',
- hotpink: '#ff69b4',
- indianred: '#cd5c5c',
- indigo: '#4b0082',
- ivory: '#fffff0',
- khaki: '#f0e68c',
- lavender: '#e6e6fa',
- lavenderblush: '#fff0f5',
- lawngreen: '#7cfc00',
- lemonchiffon: '#fffacd',
- lightblue: '#add8e6',
- lightcoral: '#f08080',
- lightcyan: '#e0ffff',
- lightgoldenrodyellow: '#fafad2',
- lightgray: '#d3d3d3',
- lightgrey: '#d3d3d3',
- lightgreen: '#90ee90',
- lightpink: '#ffb6c1',
- lightsalmon: '#ffa07a',
- lightseagreen: '#20b2aa',
- lightskyblue: '#87cefa',
- lightslategray: '#778899',
- lightsteelblue: '#b0c4de',
- lightyellow: '#ffffe0',
- lime: '#00ff00',
- limegreen: '#32cd32',
- linen: '#faf0e6',
- magenta: '#ff00ff',
- maroon: '#800000',
- mediumaquamarine: '#66cdaa',
- mediumblue: '#0000cd',
- mediumorchid: '#ba55d3',
- mediumpurple: '#9370d8',
- mediumseagreen: '#3cb371',
- mediumslateblue: '#7b68ee',
- mediumspringgreen: '#00fa9a',
- mediumturquoise: '#48d1cc',
- mediumvioletred: '#c71585',
- midnightblue: '#191970',
- mintcream: '#f5fffa',
- mistyrose: '#ffe4e1',
- moccasin: '#ffe4b5',
- navajowhite: '#ffdead',
- navy: '#000080',
- oldlace: '#fdf5e6',
- olive: '#808000',
- olivedrab: '#6b8e23',
- orange: '#ffa500',
- orangered: '#ff4500',
- orchid: '#da70d6',
- palegoldenrod: '#eee8aa',
- palegreen: '#98fb98',
- paleturquoise: '#afeeee',
- palevioletred: '#d87093',
- papayawhip: '#ffefd5',
- peachpuff: '#ffdab9',
- peru: '#cd853f',
- pink: '#ffc0cb',
- plum: '#dda0dd',
- powderblue: '#b0e0e6',
- purple: '#800080',
- red: '#ff0000',
- rosybrown: '#bc8f8f',
- royalblue: '#4169e1',
- saddlebrown: '#8b4513',
- salmon: '#fa8072',
- sandybrown: '#f4a460',
- seagreen: '#2e8b57',
- seashell: '#fff5ee',
- sienna: '#a0522d',
- silver: '#c0c0c0',
- skyblue: '#87ceeb',
- slateblue: '#6a5acd',
- slategray: '#708090',
- snow: '#fffafa',
- springgreen: '#00ff7f',
- steelblue: '#4682b4',
- tan: '#d2b48c',
- teal: '#008080',
- thistle: '#d8bfd8',
- tomato: '#ff6347',
- turquoise: '#40e0d0',
- violet: '#ee82ee',
- wheat: '#f5deb3',
- white: '#ffffff',
- whitesmoke: '#f5f5f5',
- yellow: '#ffff00',
- yellowgreen: '#9acd32'
- },
-
- fromHSL: function(h, s, l) {
- return (new this(0, 0, 0, 0)).setHSL(h, s, l);
- },
-
- fromHSV: function(h, s, v) {
- return (new this(0, 0, 0, 0)).setHSL(h, s, v);
- },
-
- fromString: function(color) {
- return (new this(0, 0, 0, 0)).setFromString(color);
- },
-
- create: function(arg) {
- if (arg instanceof this) {
- return arg;
- } else if (Ext.isArray(arg)) {
- return new Ext.util.Color(arg[0], arg[1], arg[2], arg[3]);
- } else if (Ext.isString(arg)) {
- return Ext.util.Color.fromString(arg);
- } else if (arguments.length > 2) {
- return new Ext.util.Color(arguments[0], arguments[1], arguments[2], arguments[3]);
- } else {
- return new Ext.util.Color(0, 0, 0, 0);
- }
- }
- });
- });
- Ext.define('Ext.sparkline.Base', {
- extend: Ext.Gadget,
- xtype: 'sparkline',
- cachedConfig: {
-
- lineColor: '#157fcc',
- defaultPixelsPerValue: 3,
- tagValuesAttribute: 'values',
- enableTagOptions: false,
- enableHighlight: true,
-
- highlightColor: null,
-
- highlightLighten: 0.1,
-
- tooltipSkipNull: true,
-
- tooltipPrefix: '',
-
- tooltipSuffix: '',
-
- disableTooltips: false,
- disableInteraction: false,
-
- tipTpl: null
- },
- config: {
-
- values: null
- },
- baseCls: Ext.baseCSSPrefix + 'sparkline',
- element: {
- tag: 'canvas',
- reference: 'element',
- style: {
- display: 'inline-block',
- verticalAlign: 'top'
- },
- listeners: {
- mouseenter: 'onMouseEnter',
- mouseleave: 'onMouseLeave',
- mousemove: 'onMouseMove'
- },
-
-
- width: 0,
- height: 0
- },
- defaultBindProperty: 'values',
-
-
- redrawQueue: {},
- inheritableStatics: {
-
- onClassCreated: function(cls) {
- var configUpdater = cls.prototype.updateConfigChange,
- proto = cls.prototype,
- configs = cls.getConfigurator().configs,
- config, updaterName;
-
- for (config in configs) {
-
- if (config !== 'tipTpl') {
- updaterName = Ext.Config.get(config).names.update;
- if (proto[updaterName]) {
- proto[updaterName] = Ext.Function.createSequence(proto[updaterName], configUpdater);
- } else {
- proto[updaterName] = configUpdater;
- }
- }
- }
- }
- },
- constructor: function(config) {
- var me = this,
- ns = Ext.sparkline;
-
- me.canvas = Ext.supports.Canvas ? new ns.CanvasCanvas(me) : new ns.VmlCanvas(me);
- me.callParent([
- config
- ]);
- },
-
-
- all: function(val, arr, ignoreNull) {
- var i;
- for (i = arr.length; i--; ) {
- if (ignoreNull && arr[i] === null) {
-
- continue;
- }
- if (arr[i] !== val) {
- return false;
- }
- }
- return true;
- },
-
-
-
- updateConfigChange: function(newValue) {
- var me = this;
-
-
- if (me.bufferRedraw || !me.height || !me.width) {
- me.redrawQueue[me.getId()] = me;
-
- if (!me.redrawTimer) {
- Ext.sparkline.Base.prototype.redrawTimer = Ext.raf(me.processRedrawQueue);
- }
- } else {
- me.redraw();
- }
- return newValue;
- },
-
-
- applyTipTpl: function(tipTpl) {
- if (tipTpl && !tipTpl.isTemplate) {
- tipTpl = new Ext.XTemplate(tipTpl);
- }
- return tipTpl;
- },
- normalizeValue: function(val) {
- var nf;
- switch (val) {
- case 'undefined':
- val = undefined;
- break;
- case 'null':
- val = null;
- break;
- case 'true':
- val = true;
- break;
- case 'false':
- val = false;
- break;
- default:
- nf = parseFloat(val);
- if (val == nf) {
- val = nf;
- };
- }
- return val;
- },
- normalizeValues: function(vals) {
- var i,
- result = [];
- for (i = vals.length; i--; ) {
- result[i] = this.normalizeValue(vals[i]);
- }
- return result;
- },
- updateWidth: function(width, oldWidth) {
- var me = this,
- dom = me.element.dom,
- measurer = me.measurer;
- me.callParent([
- width,
- oldWidth
- ]);
- me.canvas.setWidth(width);
- me.width = width;
- if (me.height == null && measurer) {
- me.setHeight(parseInt(measurer.getCachedStyle(dom.parentNode, 'line-height'), 10));
- }
- },
- updateHeight: function(height, oldHeight) {
- var me = this;
- me.callParent([
- height,
- oldHeight
- ]);
- me.canvas.setHeight(height);
- me.height = height;
- },
- setValues: function(values) {
- var me = this,
- oldValues = me.getValues();
-
- values = values == null ? [] : Ext.Array.from(values);
- me.values = values;
- me.callParent([
- values
- ]);
-
-
-
-
-
- if (values === oldValues) {
- me.updateValues([
- values,
- oldValues
- ]);
- }
- },
- redraw: function() {
- var me = this;
- if (!me.destroyed) {
- me.canvas.onOwnerUpdate();
- me.canvas.reset();
- if (me.getValues()) {
- me.onUpdate();
- me.renderGraph();
- }
- }
- },
- onUpdate: Ext.emptyFn,
-
- renderGraph: function() {
- var ret = true;
- if (this.disabled) {
- this.canvas.reset();
- ret = false;
- }
- return ret;
- },
- onMouseEnter: function(e) {
- this.onMouseMove(e);
- },
- onMouseMove: function(e) {
- var me = this;
-
-
-
- me.canvasRegion = me.canvasRegion || me.canvas.el.getRegion();
- me.currentPageXY = e.getPoint();
- me.redraw();
- },
- onMouseLeave: function() {
- var me = this;
-
- me.canvasRegion = me.currentPageXY = me.targetX = me.targetY = null;
- me.redraw();
- me.hideTip();
- },
- updateDisplay: function() {
- var me = this,
- values = me.getValues(),
- tipHtml, region;
-
-
-
- if (values && values.length && me.currentPageXY && me.canvasRegion.contains(me.currentPageXY)) {
- region = me.getRegion(me.currentPageXY[0] - me.canvasRegion.left, (me.canvasRegion.bottom - 1) - me.currentPageXY[1]);
- if (region != null && me.isValidRegion(region, values)) {
- if (!me.disableHighlight) {
- me.renderHighlight(region);
- }
- if (!me.getDisableTooltips()) {
- tipHtml = me.getRegionTooltip(region);
- }
- }
- if (me.hasListeners.sparklineregionchange) {
- me.fireEvent('sparklineregionchange', me);
- }
- if (tipHtml) {
- me.getSharedTooltip().setHtml(tipHtml);
- me.showTip();
- }
- }
-
- if (!tipHtml) {
- me.hideTip();
- }
- },
-
- getRegion: Ext.emptyFn,
-
- getRegionTooltip: function(region) {
- var me = this,
- entries = [],
- tipTpl = me.getTipTpl(),
- fields, showFields, showFieldsKey, newFields, fv, formatter, fieldlen, i, j;
- fields = me.getRegionFields(region);
- formatter = me.tooltipFormatter;
- if (formatter) {
- return formatter(me, me, fields);
- }
- if (!tipTpl) {
- return '';
- }
- if (!Ext.isArray(fields)) {
- fields = [
- fields
- ];
- }
- showFields = me.tooltipFormatFieldlist;
- showFieldsKey = me.tooltipFormatFieldlistKey;
- if (showFields && showFieldsKey) {
-
- newFields = [];
- for (i = fields.length; i--; ) {
- fv = fields[i][showFieldsKey];
- if ((j = Ext.Array.indexOf(fv, showFields)) !== -1) {
- newFields[j] = fields[i];
- }
- }
- fields = newFields;
- }
- fieldlen = fields.length;
- for (j = 0; j < fieldlen; j++) {
- if (!fields[j].isNull || !me.getTooltipSkipNull()) {
- Ext.apply(fields[j], {
- prefix: me.getTooltipPrefix(),
- suffix: me.getTooltipSuffix()
- });
- entries.push(tipTpl.apply(fields[j]));
- }
- }
- if (entries.length) {
- return entries.join('<br>');
- }
- return '';
- },
- getRegionFields: Ext.emptyFn,
- calcHighlightColor: function(color) {
- var me = this,
- highlightColor = me.getHighlightColor(),
- lighten = me.getHighlightLighten(),
- o;
- if (highlightColor) {
- return highlightColor;
- }
- if (lighten) {
- o = Ext.util.Color.fromString(color);
- if (o) {
- o.lighten(lighten);
- color = o.toHex();
- }
- }
- return color;
- },
- destroy: function() {
- delete this.redrawQueue[this.getId()];
- this.callParent();
- },
- privates: {
- hideTip: Ext.privateFn,
- isValidRegion: function(region, values) {
- return region < values.length;
- },
- showTip: Ext.privateFn
- }
- }, function(SparklineBase) {
- var proto = SparklineBase.prototype;
- proto.getSharedTooltip = function() {
- var me = this,
- tooltip = me.tooltip;
- if (!tooltip) {
- proto.tooltip = tooltip = SparklineBase.constructTip();
- }
- return tooltip;
- };
- SparklineBase.onClassCreated(SparklineBase);
- proto.processRedrawQueue = function() {
- var redrawQueue = proto.redrawQueue,
- id;
- for (id in redrawQueue) {
- redrawQueue[id].redraw();
- }
- proto.redrawQueue = {};
- proto.redrawTimer = 0;
- };
- });
- Ext.define('Ext.sparkline.BarBase', {
- extend: Ext.sparkline.Base,
- renderHighlight: function(region) {
- this.renderRegion(region, true);
- },
- renderGraph: function() {
- var me = this,
- values = me.values,
- canvas = me.canvas,
- regionShapes = me.regionShapes || (me.regionShapes = {}),
- shapes, ids, i, j;
- if (!me.callParent()) {
- return;
- }
- for (i = values.length; i--; ) {
- shapes = me.renderRegion(i);
- if (shapes) {
- if (Ext.isArray(shapes)) {
- ids = [];
- for (j = shapes.length; j--; ) {
- shapes[j].append();
- ids.push(shapes[j].id);
- }
- regionShapes[i] = ids;
- } else {
- shapes.append();
- regionShapes[i] = shapes.id;
- }
- } else
- {
-
- regionShapes[i] = null;
- }
- }
-
- if (me.currentPageXY) {
- me.currentRegion = null;
- me.updateDisplay();
- }
- canvas.render();
- }
- });
- Ext.define('Ext.sparkline.RangeMap', {
- constructor: function(map) {
- var key, range,
- rangelist = [];
- for (key in map) {
- if (map.hasOwnProperty(key) && typeof key === 'string' && key.indexOf(':') > -1) {
- range = key.split(':');
- range[0] = range[0].length === 0 ? -Infinity : parseFloat(range[0]);
- range[1] = range[1].length === 0 ? Infinity : parseFloat(range[1]);
- range[2] = map[key];
- rangelist.push(range);
- }
- }
- this.map = map;
- this.rangelist = rangelist || false;
- },
- get: function(value) {
- var rangelist = this.rangelist,
- i, range, result;
- if ((result = this.map[value]) !== undefined) {
- return result;
- }
- if (rangelist) {
- for (i = rangelist.length; i--; ) {
- range = rangelist[i];
- if (range[0] <= value && range[1] >= value) {
- return range[2];
- }
- }
- }
- }
- });
- Ext.define('Ext.sparkline.Bar', {
- extend: Ext.sparkline.BarBase,
- alias: 'widget.sparklinebar',
- config: {
-
- barColor: '#3366cc',
-
- negBarColor: '#f44',
-
- stackedBarColor: [
- '#3366cc',
- '#dc3912',
- '#ff9900',
- '#109618',
- '#66aa00',
- '#dd4477',
- '#0099c6',
- '#990099'
- ],
-
- zeroColor: null,
-
- nullColor: null,
-
- zeroAxis: true,
-
- barWidth: 4,
-
- barSpacing: 1,
-
- chartRangeMin: null,
-
- chartRangeMax: null,
-
- chartRangeClip: false,
-
- colorMap: null
- },
-
- tipTpl: '● {prefix}{value}{suffix}',
- remove: function(vals, filter) {
- var i, vl,
- result = [];
- for (i = 0 , vl = vals.length; i < vl; i++) {
- if (vals[i] !== filter) {
- result.push(vals[i]);
- }
- }
- return result;
- },
-
-
- all: function(arr, val, ignoreNull) {
- var i;
- for (i = arr.length; i--; ) {
- if (ignoreNull && arr[i] === null) {
-
- continue;
- }
- if (arr[i] !== val) {
- return false;
- }
- }
- return true;
- },
- applyColorMap: function(colorMap) {
- var me = this;
- if (Ext.isArray(colorMap)) {
- me.colorMapByIndex = colorMap;
- me.colorMapByValue = null;
- } else {
- me.colorMapByIndex = null;
- me.colorMapByValue = colorMap;
- if (me.colorMapByValue && me.colorMapByValue.get == null) {
- me.colorMapByValue = new Ext.sparkline.RangeMap(colorMap);
- }
- }
- me.updateConfigChange();
- return colorMap;
- },
- onUpdate: function() {
- var me = this,
- values = me.values,
- barWidth = me.getBarWidth(),
- barSpacing = me.getBarSpacing(),
- chartRangeMin = me.getChartRangeMin(),
- chartRangeMax = me.getChartRangeMax(),
- chartRangeClip = me.getChartRangeClip(),
- stackMin = Infinity,
- stackMax = -Infinity,
- isStackString, groupMin, groupMax, stackRanges, numValues, i, vlen, range,
- zeroAxis = me.getZeroAxis(),
- xAxisOffset, min, max, clipMin, clipMax, stacked, vlist, j, slen, svals, val, yoffset, yMaxCalc,
- stackTotals = [],
- stackRangesNeg = [];
-
- for (i = 0 , vlen = values.length; i < vlen; i++) {
- val = values[i];
- isStackString = typeof (val) === 'string' && val.indexOf(':') > -1;
- if (isStackString || Ext.isArray(val)) {
- stacked = true;
- if (isStackString) {
- val = values[i] = me.normalizeValues(val.split(':'));
- }
- val = me.remove(val, null);
-
- groupMin = Math.min.apply(Math, val);
- groupMax = Math.max.apply(Math, val);
- if (groupMin < stackMin) {
- stackMin = groupMin;
- }
- if (groupMax > stackMax) {
- stackMax = groupMax;
- }
- }
- }
- me.stacked = stacked;
- me.regionShapes = {};
- me.totalBarWidth = barWidth + barSpacing;
-
- if (values.length) {
- me.width = (values.length * barWidth) + ((values.length - 1) * barSpacing);
- }
- if (chartRangeClip) {
- clipMin = chartRangeMin == null ? -Infinity : chartRangeMin;
- clipMax = chartRangeMax == null ? Infinity : chartRangeMax;
- }
- numValues = [];
- stackRanges = stacked ? [] : numValues;
- for (i = 0 , vlen = values.length; i < vlen; i++) {
- if (stacked) {
- vlist = values[i];
- values[i] = svals = [];
- stackTotals[i] = 0;
- stackRanges[i] = stackRangesNeg[i] = 0;
- for (j = 0 , slen = vlist.length; j < slen; j++) {
- val = svals[j] = chartRangeClip ? Ext.Number.constrain(vlist[j], clipMin, clipMax) : vlist[j];
- if (val !== null) {
- if (val > 0) {
- stackTotals[i] += val;
- }
- if (stackMin < 0 && stackMax > 0) {
- if (val < 0) {
- stackRangesNeg[i] += Math.abs(val);
- } else {
- stackRanges[i] += val;
- }
- } else {
- stackRanges[i] += Math.abs(val - (val < 0 ? stackMax : stackMin));
- }
- numValues.push(val);
- }
- }
- } else {
- val = chartRangeClip ? Ext.Number.constrain(values[i], clipMin, clipMax) : values[i];
- val = values[i] = me.normalizeValue(val);
- if (val !== null) {
- numValues.push(val);
- }
- }
- }
- me.max = max = Math.max.apply(Math, numValues);
- me.min = min = Math.min.apply(Math, numValues);
- me.stackMax = stackMax = stacked ? Math.max.apply(Math, stackTotals) : max;
- me.stackMin = stackMin = stacked ? Math.min.apply(Math, numValues) : min;
- if (chartRangeMin != null && (chartRangeClip || chartRangeMin < min)) {
- min = chartRangeMin;
- }
- if (chartRangeMax != null && (chartRangeClip || chartRangeMax > max)) {
- max = chartRangeMax;
- }
- if (min <= 0 && max >= 0 && zeroAxis) {
- xAxisOffset = 0;
- } else if (!zeroAxis) {
- xAxisOffset = min;
- } else if (min > 0) {
- xAxisOffset = min;
- } else {
- xAxisOffset = max;
- }
- me.xAxisOffset = xAxisOffset;
- range = stacked ? (Math.max.apply(Math, stackRanges) + Math.max.apply(Math, stackRangesNeg)) : max - min;
-
-
- me.canvasHeightEf = (zeroAxis && min < 0) ? me.getHeight() - 2 : me.getHeight() - 1;
- if (min < xAxisOffset) {
- yMaxCalc = (stacked && max >= 0) ? stackMax : max;
- yoffset = (yMaxCalc - xAxisOffset) / range * me.getHeight();
- if (yoffset !== Math.ceil(yoffset)) {
- me.canvasHeightEf -= 2;
- yoffset = Math.ceil(yoffset);
- }
- } else {
- yoffset = me.getHeight();
- }
- me.yoffset = yoffset;
- me.range = range;
- },
- getRegion: function(x, y) {
- var result = Math.floor(x / this.totalBarWidth);
- return (result < 0 || result >= this.values.length) ? undefined : result;
- },
- getRegionFields: function(region) {
- var values = Ext.Array.from(this.values[region]),
- result = [],
- value, i;
- for (i = values.length; i--; ) {
- value = values[i];
- result.push({
- isNull: value === null,
- value: value,
- color: this.calcColor(i, value, region),
- offset: region
- });
- }
- return result;
- },
- calcColor: function(stacknum, value, valuenum) {
- var me = this,
- colorMapByIndex = me.colorMapByIndex,
- colorMapByValue = me.colorMapByValue,
- color, newColor,
- zeroColor = me.getZeroColor();
- if (this.stacked) {
- color = me.getStackedBarColor();
- } else {
- color = (value < 0) ? me.getNegBarColor() : me.getBarColor();
- }
- if (value === 0 && zeroColor != null) {
- color = zeroColor;
- }
- if (colorMapByValue && (newColor = colorMapByValue.get(value))) {
- color = newColor;
- } else if (colorMapByIndex && colorMapByIndex.length > valuenum) {
- color = colorMapByIndex[valuenum];
- }
- return Ext.isArray(color) ? color[stacknum % color.length] : color;
- },
-
- renderRegion: function(valuenum, highlight) {
- var me = this,
- vals = me.values[valuenum],
- xaxisOffset = me.xAxisOffset,
- range = me.range,
- stacked = me.stacked,
- canvas = me.canvas,
- barWidth = me.getBarWidth(),
- x = valuenum * me.totalBarWidth,
- canvasHeightEf = me.canvasHeightEf,
- yoffset = me.yoffset,
- y, height, color, isNull, yoffsetNeg, i, valcount, val, minPlotted, allMin,
- nullColor = me.getNullColor();
- vals = Ext.isArray(vals) ? vals : [
- vals
- ];
- valcount = vals.length;
- val = vals[0];
- isNull = me.all(vals, null);
- allMin = me.all(vals, xaxisOffset, true);
- if (isNull) {
- if (nullColor) {
- color = highlight ? nullColor : me.calcHighlightColor(nullColor, me);
- y = (yoffset > 0) ? yoffset - 1 : yoffset;
- canvas.drawRect(x, y, barWidth - 1, 0, color, color).append();
- }
- return;
- }
- yoffsetNeg = yoffset;
- for (i = 0; i < valcount; i++) {
- val = vals[i];
- if (stacked && val === xaxisOffset) {
- if (!allMin || minPlotted) {
-
- continue;
- }
- minPlotted = true;
- }
- if (range > 0) {
- height = Math.floor(canvasHeightEf * ((Math.abs(val - xaxisOffset) / range))) + 1;
- } else {
- height = 1;
- }
- if (val < xaxisOffset || (val === xaxisOffset && yoffset === 0)) {
- y = yoffsetNeg;
- yoffsetNeg += height;
- } else {
- y = yoffset - height;
- yoffset -= height;
- }
- color = me.calcColor(i, val, valuenum);
- if (highlight) {
- color = me.calcHighlightColor(color, me);
- }
- canvas.drawRect(x, y, barWidth - 1, height - 1, color, color).append();
- }
- }
- }, function(cls) {
- cls.onClassCreated(cls);
- });
- Ext.define('Ext.sparkline.Box', {
- extend: Ext.sparkline.Base,
- alias: 'widget.sparklinebox',
- config: {
-
- raw: false,
-
- boxLineColor: '#000',
-
- boxFillColor: '#cdf',
-
- whiskerColor: '#000',
-
- outlierLineColor: '#333',
-
- outlierFillColor: '#fff',
-
- medianColor: '#f00',
-
- showOutliers: true,
-
- outlierIQR: 1.5,
-
- spotRadius: 1.5,
-
- target: null,
-
- targetColor: '#4a2',
-
- chartRangeMin: null,
-
- chartRangeMax: null
- },
- tipTpl: [
- '{field:this.fields}: {value}',
- {
- fields: function(v) {
- var fields = {
- lq: 'Lower Quartile',
- med: 'Median',
- uq: 'Upper Quartile',
- lo: 'Left Outlier',
- ro: 'Right Outlier',
- lw: 'Left Whisker',
- rw: 'Right Whisker'
- };
- return fields[v];
- }
- }
- ],
- tooltipFormatFieldlistKey: 'field',
- quartile: function(values, q) {
- var vl;
- if (q === 2) {
- vl = Math.floor(values.length / 2);
- return values.length % 2 ? values[vl] : (values[vl - 1] + values[vl]) / 2;
- } else {
- if (values.length % 2) {
-
- vl = (values.length * q + q) / 4;
- return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl - 1];
- } else {
-
- vl = (values.length * q + 2) / 4;
- return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl - 1];
- }
- }
- },
-
- applyValues: function(newValues) {
- newValues = Ext.Array.map(Ext.Array.from(newValues), Number);
-
- if (!this.raw) {
- newValues.sort(function(a, b) {
- return a - b;
- });
- }
- this.disabled = !(newValues && newValues.length);
- this.updateConfigChange();
- return newValues;
- },
-
- getRegion: function() {
- return 1;
- },
- getRegionFields: function() {
- var result = [
- {
- field: 'lq',
- value: this.quartiles[0]
- },
- {
- field: 'med',
- value: this.quartiles[1]
- },
- {
- field: 'uq',
- value: this.quartiles[2]
- }
- ];
- if (this.loutlier !== undefined) {
- result.push({
- field: 'lo',
- value: this.loutlier
- });
- }
- if (this.routlier !== undefined) {
- result.push({
- field: 'ro',
- value: this.routlier
- });
- }
- if (this.lwhisker !== undefined) {
- result.push({
- field: 'lw',
- value: this.lwhisker
- });
- }
- if (this.rwhisker !== undefined) {
- result.push({
- field: 'rw',
- value: this.rwhisker
- });
- }
- return result;
- },
- renderHighlight: Ext.emptyFn,
- renderGraph: function() {
- var me = this,
- canvas = me.canvas,
- values = me.values,
- vlen = values.length,
- canvasWidth = me.getWidth(),
- canvasHeight = me.getHeight(),
- chartRangeMin = me.getChartRangeMin(),
- chartRangeMax = me.getChartRangeMax(),
- minValue = chartRangeMin == null ? Math.min.apply(Math, values) : chartRangeMin,
- maxValue = chartRangeMax == null ? Math.max.apply(Math, values) : chartRangeMax,
- canvasLeft = 0,
- lwhisker, loutlier, iqr, q1, q2, q3, rwhisker, routlier, i, size, unitSize,
- spotRadius = me.getSpotRadius(),
- outlierLineColor = me.getOutlierLineColor(),
- outlierFillColor = me.getOutlierFillColor(),
- showOutliers = me.getShowOutliers(),
- outlierIQR = me.getOutlierIQR(),
- lineColor = me.getLineColor(),
- whiskerColor = me.getWhiskerColor(),
- targetColor = me.getTargetColor();
- if (!me.callParent()) {
- return;
- }
- if (me.raw) {
- if (showOutliers && values.length > 5) {
- loutlier = values[0];
- lwhisker = values[1];
- q1 = values[2];
- q2 = values[3];
- q3 = values[4];
- rwhisker = values[5];
- routlier = values[6];
- } else {
- lwhisker = values[0];
- q1 = values[1];
- q2 = values[2];
- q3 = values[3];
- rwhisker = values[4];
- }
- } else {
- q1 = me.quartile(values, 1);
- q2 = me.quartile(values, 2);
- q3 = me.quartile(values, 3);
- iqr = q3 - q1;
- if (showOutliers) {
- lwhisker = rwhisker = null;
- for (i = 0; i < vlen; i++) {
- if (lwhisker == null && values[i] > q1 - (iqr * outlierIQR)) {
- lwhisker = values[i];
- }
- if (values[i] < q3 + (iqr * outlierIQR)) {
- rwhisker = values[i];
- }
- }
- loutlier = values[0];
- routlier = values[vlen - 1];
- } else {
- lwhisker = values[0];
- rwhisker = values[vlen - 1];
- }
- }
- me.quartiles = [
- q1,
- q2,
- q3
- ];
- me.lwhisker = lwhisker;
- me.rwhisker = rwhisker;
- me.loutlier = loutlier;
- me.routlier = routlier;
- unitSize = canvasWidth / (maxValue - minValue + 1);
- if (showOutliers) {
- canvasLeft = Math.ceil(spotRadius);
- canvasWidth -= 2 * Math.ceil(spotRadius);
- unitSize = canvasWidth / (maxValue - minValue + 1);
- if (loutlier < lwhisker) {
- canvas.drawCircle((loutlier - minValue) * unitSize + canvasLeft, canvasHeight / 2, spotRadius, outlierLineColor, outlierFillColor).append();
- }
- if (routlier > rwhisker) {
- canvas.drawCircle((routlier - minValue) * unitSize + canvasLeft, canvasHeight / 2, spotRadius, outlierLineColor, outlierFillColor).append();
- }
- }
-
- canvas.drawRect(Math.round((q1 - minValue) * unitSize + canvasLeft), Math.round(canvasHeight * 0.1), Math.round((q3 - q1) * unitSize), Math.round(canvasHeight * 0.8), me.getBoxLineColor(), me.getBoxFillColor()).append();
-
- canvas.drawLine(Math.round((lwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 2), Math.round((q1 - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 2), lineColor).append();
- canvas.drawLine(Math.round((lwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 4), Math.round((lwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight - canvasHeight / 4), whiskerColor).append();
-
- canvas.drawLine(Math.round((rwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 2), Math.round((q3 - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 2), lineColor).append();
- canvas.drawLine(Math.round((rwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight / 4), Math.round((rwhisker - minValue) * unitSize + canvasLeft), Math.round(canvasHeight - canvasHeight / 4), whiskerColor).append();
-
- canvas.drawLine(Math.round((q2 - minValue) * unitSize + canvasLeft), Math.round(canvasHeight * 0.1), Math.round((q2 - minValue) * unitSize + canvasLeft), Math.round(canvasHeight * 0.9), me.getMedianColor()).append();
- if (me.target) {
- size = Math.ceil(me.spotRadius);
- canvas.drawLine(Math.round((me.target - minValue) * unitSize + canvasLeft), Math.round((canvasHeight / 2) - size), Math.round((me.target - minValue) * unitSize + canvasLeft), Math.round((canvasHeight / 2) + size), targetColor).append();
- canvas.drawLine(Math.round((me.target - minValue) * unitSize + canvasLeft - size), Math.round(canvasHeight / 2), Math.round((me.target - minValue) * unitSize + canvasLeft + size), Math.round(canvasHeight / 2), targetColor).append();
- }
-
- if (me.currentPageXY && me.canvasRegion.contains(me.currentPageXY)) {
- me.currentRegion = null;
- me.updateDisplay();
- }
- canvas.render();
- }
- });
- Ext.define('Ext.sparkline.Bullet', {
- extend: Ext.sparkline.Base,
- alias: 'widget.sparklinebullet',
- config: {
-
- targetColor: '#f33',
-
- targetWidth: 3,
-
- performanceColor: '#33f',
-
- rangeColors: [
- '#d3dafe',
- '#a8b6ff',
- '#7f94ff'
- ],
-
- base: null
- },
- tipTpl: [
- '{fieldkey:this.fields} - {value}',
- {
- fields: function(v) {
- if (v === 'r') {
- return 'Range';
- }
- if (v === 'p') {
- return 'Performance';
- }
- if (v === 't') {
- return 'Target';
- }
- }
- }
- ],
-
- applyValues: function(newValues) {
- newValues = Ext.Array.map(Ext.Array.from(newValues), this.normalizeValue);
- this.disabled = !(newValues && newValues.length);
- this.updateConfigChange();
- return newValues;
- },
- onUpdate: function() {
- var me = this,
- values = me.values,
- min, max, vals,
- base = me.getBase();
- me.callParent(arguments);
-
- vals = values.slice();
- vals[0] = vals[0] === null ? vals[2] : vals[0];
- vals[1] = values[1] === null ? vals[2] : vals[1];
- min = Math.min.apply(Math, values);
- max = Math.max.apply(Math, values);
- if (base == null) {
- min = min < 0 ? min : 0;
- } else {
- min = base;
- }
- me.min = min;
- me.max = max;
- me.range = max - min;
- me.shapes = {};
- me.valueShapes = {};
- me.regiondata = {};
- if (!values.length) {
- me.disabled = true;
- }
- },
- getRegion: function(x, y) {
- var shapeid = this.canvas.getShapeAt(x, y);
- return (shapeid !== undefined && this.shapes[shapeid] !== undefined) ? this.shapes[shapeid] : undefined;
- },
- getRegionFields: function(region) {
- return {
- fieldkey: region.substr(0, 1),
- value: this.values[parseInt(region.substr(1), 10)],
- region: region
- };
- },
- renderHighlight: function(region) {
- var me = this,
- valueShapes = me.valueShapes,
- shapes = me.shapes,
- shapeId = valueShapes[region],
- shape;
- delete shapes[shapeId];
- switch (region.substr(0, 1)) {
- case 'r':
- shape = me.renderRange(parseInt(region.substr(1), 10), true);
- break;
- case 'p':
- shape = me.renderPerformance(true);
- break;
- case 't':
- shape = me.renderTarget(true);
- break;
- }
- valueShapes[region] = shape.id;
- shapes[shape.id] = region;
- me.canvas.replaceWithShape(shapeId, shape);
- },
- renderRange: function(region, highlight) {
- var me = this,
- rangeval = me.values[region],
- rangewidth = Math.round(me.getWidth() * ((rangeval - me.min) / me.range)),
- colors = me.getRangeColors(),
- color = colors[Math.min(region - 2, colors.length - 1)];
- if (highlight) {
- color = me.calcHighlightColor(color);
- }
- return me.canvas.drawRect(0, 0, rangewidth - 1, me.getHeight() - 1, color, color);
- },
- renderPerformance: function(highlight) {
- var perfval = this.values[1],
- perfwidth = Math.round(this.getWidth() * ((perfval - this.min) / this.range)),
- color = this.getPerformanceColor();
- if (highlight) {
- color = this.calcHighlightColor(color);
- }
- return this.canvas.drawRect(0, Math.round(this.getHeight() * 0.3), perfwidth - 1, Math.round(this.getHeight() * 0.4) - 1, color, color);
- },
- renderTarget: function(highlight) {
- var targetval = this.values[0],
- targetWidth = this.getTargetWidth(),
- x = Math.round(this.getWidth() * ((targetval - this.min) / this.range) - (targetWidth / 2)),
- targettop = Math.round(this.getHeight() * 0.1),
- targetheight = this.getHeight() - (targettop * 2),
- color = this.getTargetColor();
- if (highlight) {
- color = this.calcHighlightColor(color);
- }
- return this.canvas.drawRect(x, targettop, targetWidth - 1, targetheight - 1, color, color);
- },
- renderGraph: function() {
- var me = this,
- vlen = me.values.length,
- canvas = me.canvas,
- i, shape,
- shapes = me.shapes || (me.shapes = {}),
- valueShapes = me.valueShapes || (me.valueShapes = {});
- if (!me.callParent()) {
- return;
- }
- for (i = 2; i < vlen; i++) {
- shape = me.renderRange(i).append();
- shapes[shape.id] = 'r' + i;
- valueShapes['r' + i] = shape.id;
- }
- if (me.values[1] !== null) {
- shape = me.renderPerformance().append();
- shapes[shape.id] = 'p1';
- valueShapes.p1 = shape.id;
- }
- if (me.values[0] !== null) {
- shape = this.renderTarget().append();
- shapes[shape.id] = 't0';
- valueShapes.t0 = shape.id;
- }
-
- if (me.currentPageXY && me.canvasRegion.contains(me.currentPageXY)) {
- me.updateDisplay();
- }
- canvas.render();
- },
- privates: {
- isValidRegion: function(region, values) {
- return parseInt(region.substr(1), 10) < values.length;
- }
- }
- });
- Ext.define('Ext.sparkline.Discrete', {
- extend: Ext.sparkline.BarBase,
- alias: 'widget.sparklinediscrete',
- config: {
-
- lineHeight: 'auto',
-
- thresholdColor: null,
-
- thresholdValue: 0,
-
- chartRangeMax: null,
-
- chartRangeMin: null,
-
- chartRangeClip: false
- },
- tipTpl: '{prefix}{value}{suffix}',
-
- applyValues: function(newValues) {
- newValues = Ext.Array.map(Ext.Array.from(newValues), Number);
- this.disabled = !(newValues && newValues.length);
- this.updateConfigChange();
- return newValues;
- },
- onUpdate: function() {
- var me = this,
- values = me.values,
- chartRangeMin = me.getChartRangeMin(),
- chartRangeMax = me.getChartRangeMax(),
- chartRangeClip = me.getChartRangeClip();
- me.callParent(arguments);
- me.regionShapes = {};
- me.min = Math.min.apply(Math, values);
- me.max = Math.max.apply(Math, values);
- me.range = me.max - me.min;
- me.width = me.getWidth();
- me.interval = Math.floor(me.width / values.length);
- me.itemWidth = me.width / values.length;
- if (chartRangeMin != null && (chartRangeClip || chartRangeMin < me.min)) {
- me.min = chartRangeMin;
- }
- if (chartRangeMax != null && (chartRangeClip || chartRangeMax > me.max)) {
- me.max = chartRangeMax;
- }
- if (me.canvas) {
- if (me.getLineHeight() === 'auto') {
- me.setLineHeight(Math.round(me.getHeight() * 0.3));
- }
- }
- },
- getRegion: function(x, y) {
- return Math.floor(x / this.itemWidth);
- },
- getRegionFields: function(region) {
- return {
- isNull: this.values[region] === undefined,
- value: this.values[region],
- offset: region
- };
- },
- renderRegion: function(valuenum, highlight) {
- var me = this,
- values = me.values,
- min = me.min,
- max = me.max,
- range = me.range,
- interval = me.interval,
- canvas = me.canvas,
- canvasHeight = me.getHeight(),
- lineHeight = me.getLineHeight(),
- pheight = canvasHeight - lineHeight,
- ytop, val, color, x,
- thresholdColor = me.getThresholdColor();
- val = Ext.Number.constrain(values[valuenum], min, max);
- x = valuenum * interval;
- ytop = Math.round(pheight - pheight * ((val - min) / range));
- color = (thresholdColor && val < me.getThresholdValue()) ? thresholdColor : me.getLineColor();
- if (highlight) {
- color = me.calcHighlightColor(color);
- }
- canvas.drawLine(x, ytop, x, ytop + lineHeight, color).append();
- }
- });
- Ext.define('Ext.sparkline.Line', {
- extend: Ext.sparkline.Base,
- alias: 'widget.sparklineline',
- config: {
-
- fillColor: '#def',
-
- spotColor: '#f80',
-
- highlightSpotColor: '#5f5',
-
- highlightLineColor: '#f22',
-
- spotRadius: 1.5,
-
- minSpotColor: '#f80',
-
- maxSpotColor: '#f80',
-
- lineWidth: 1,
-
- normalRangeMin: null,
-
- normalRangeMax: null,
-
- normalRangeColor: '#ccc',
-
- drawNormalOnTop: false,
-
- chartRangeMin: null,
-
- chartRangeMax: null,
-
- chartRangeMinX: null,
-
- chartRangeMaxX: null,
-
- valueSpots: null
- },
- tipTpl: '● {prefix}{y}{suffix}',
- applyValueSpots: function(valueSpots) {
- if (valueSpots && !valueSpots.get) {
- valueSpots = new Ext.sparkline.RangeMap(valueSpots);
- }
- this.updateConfigChange();
- return valueSpots;
- },
- onUpdate: function() {
- this.vertices = [];
- this.regionMap = [];
- this.xvalues = [];
- this.yvalues = [];
- this.yminmax = [];
- },
- getRegion: function(x, y) {
- var i,
- regionMap = this.regionMap;
-
- for (i = regionMap.length; i--; ) {
- if (regionMap[i] !== null && x >= regionMap[i][0] && x <= regionMap[i][1]) {
- return regionMap[i][2];
- }
- }
- return undefined;
- },
- getRegionFields: function(region) {
- return {
- isNull: this.yvalues[region] === null,
- x: this.xvalues[region],
- y: this.yvalues[region],
- color: this.getLineColor(),
- fillColor: this.getFillColor(),
- offset: region
- };
- },
- renderHighlight: function(region) {
- var me = this,
- canvas = me.canvas,
- vertex = me.vertices[region],
- spotRadius = me.getSpotRadius(),
- highlightSpotColor = me.getHighlightSpotColor(),
- highlightLineColor = me.getHighlightLineColor();
- if (!vertex) {
- return;
- }
- if (spotRadius && highlightSpotColor) {
- canvas.drawCircle(vertex[0], vertex[1], spotRadius, null, highlightSpotColor).append();
- }
- if (highlightLineColor) {
- canvas.drawLine(vertex[0], me.canvasTop, vertex[0], me.canvasTop + me.getHeight(), highlightLineColor).append();
- }
- },
- scanValues: function() {
- var me = this,
- values = me.values,
- valcount = values.length,
- xvalues = me.xvalues,
- yvalues = me.yvalues,
- yminmax = me.yminmax,
- i, val;
- for (i = 0; i < valcount; i++) {
- val = values[i];
- if (typeof val === 'string') {
- val = val.split(':');
- }
-
- if (val && val.length === 2) {
- xvalues.push(Number(val[0]));
- yvalues.push(val = Number(val[1]));
- yminmax.push(val);
- } else
- {
- xvalues.push(i);
- if (val == null || val === 'null') {
- yvalues.push(null);
- } else {
- yvalues.push(val = Number(val));
- yminmax.push(val);
- }
- }
- }
- if (me.xvalues) {
- xvalues = me.xvalues;
- }
- me.maxy = me.maxyorg = Math.max.apply(Math, yminmax);
- me.miny = me.minyorg = Math.min.apply(Math, yminmax);
- me.maxx = Math.max.apply(Math, xvalues);
- me.minx = Math.min.apply(Math, xvalues);
- me.xvalues = xvalues;
- me.yvalues = yvalues;
- me.yminmax = yminmax;
- },
- processRangeOptions: function() {
- var me = this,
- normalRangeMin = me.getNormalRangeMin(),
- normalRangeMax = me.getNormalRangeMax(),
- chartRangeMin = me.getChartRangeMin(),
- chartRangeMinX = me.getChartRangeMinX(),
- chartRangeMax = me.getChartRangeMax(),
- chartRangeMaxX = me.getChartRangeMaxX();
- if (normalRangeMin != null) {
- if (normalRangeMin < me.miny) {
- me.miny = normalRangeMin;
- }
- if (normalRangeMax > me.maxy) {
- me.maxy = normalRangeMax;
- }
- }
- if (chartRangeMin != null && (me.chartRangeClip || chartRangeMin < me.miny)) {
- me.miny = chartRangeMin;
- }
- if (chartRangeMax != null && (me.chartRangeClip || chartRangeMax > me.maxy)) {
- this.maxy = chartRangeMax;
- }
- if (chartRangeMinX != null && (me.chartRangeClipX || chartRangeMinX < me.minx)) {
- me.minx = chartRangeMinX;
- }
- if (chartRangeMaxX != null && (me.chartRangeClipX || chartRangeMaxX > me.maxx)) {
- me.maxx = chartRangeMaxX;
- }
- },
- drawNormalRange: function(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey) {
- var normalRangeMin = this.getNormalRangeMin(),
- normalRangeMax = this.getNormalRangeMax(),
- ytop = canvasTop + Math.round(canvasHeight - (canvasHeight * ((normalRangeMax - this.miny) / rangey))),
- height = Math.round((canvasHeight * (normalRangeMax - normalRangeMin)) / rangey);
- this.canvas.drawRect(canvasLeft, ytop, canvasWidth, height, undefined, this.normalRangeColor).append();
- },
- renderGraph: function() {
- var me = this,
- canvas = me.canvas,
- canvasWidth = me.getWidth(),
- canvasHeight = me.getHeight(),
- vertices = me.vertices,
- spotRadius = me.getSpotRadius(),
- regionMap = me.regionMap,
- rangeX, Y, yvallast, canvasTop, canvasLeft, vertex, path, paths, x, y, xNext, xPos, xPosNext, last, next, yValCount, lineShapes, fillShapes, plen,
- valueSpots = me.getValueSpots(),
- hlSpotsEnabled, color, xValues, yValues, i,
- spotColor = me.getSpotColor(),
- minSpotColor = me.getMinSpotColor(),
- maxSpotColor = me.getMaxSpotColor(),
- normalRangeMin = me.getNormalRangeMin(),
- drawNormalOnTop = me.getDrawNormalOnTop();
- if (!me.callParent()) {
- return;
- }
- me.scanValues();
- me.processRangeOptions();
- xValues = me.xvalues;
- yValues = me.yvalues;
- if (!me.yminmax.length || me.yvalues.length < 2) {
-
- return;
- }
- canvasTop = canvasLeft = 0;
- rangeX = me.maxx - me.minx === 0 ? 1 : me.maxx - me.minx;
- Y = me.maxy - me.miny === 0 ? 1 : me.maxy - me.miny;
- yvallast = me.yvalues.length - 1;
- if (spotRadius && (canvasWidth < (spotRadius * 4) || canvasHeight < (spotRadius * 4))) {
- spotRadius = 0;
- }
- if (spotRadius) {
-
- hlSpotsEnabled = me.getHighlightSpotColor() && !me.disableInteraction;
- if (hlSpotsEnabled || minSpotColor || (spotColor && yValues[yvallast] === me.miny)) {
- canvasHeight -= Math.ceil(spotRadius);
- }
- if (hlSpotsEnabled || maxSpotColor || (spotColor && yValues[yvallast] === me.maxy)) {
- canvasHeight -= Math.ceil(spotRadius);
- canvasTop += Math.ceil(spotRadius);
- }
- if (hlSpotsEnabled || ((minSpotColor || maxSpotColor) && (yValues[0] === me.miny || yValues[0] === me.maxy))) {
- canvasLeft += Math.ceil(spotRadius);
- canvasWidth -= Math.ceil(spotRadius);
- }
- if (hlSpotsEnabled || spotColor || (minSpotColor || maxSpotColor && (yValues[yvallast] === me.miny || yValues[yvallast] === me.maxy))) {
- canvasWidth -= Math.ceil(spotRadius);
- }
- }
- canvasHeight--;
- if (normalRangeMin != null && !drawNormalOnTop) {
- me.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, Y);
- }
- path = [];
- paths = [
- path
- ];
- last = next = null;
- yValCount = yValues.length;
- for (i = 0; i < yValCount; i++) {
- x = xValues[i];
- xNext = xValues[i + 1];
- y = yValues[i];
- xPos = canvasLeft + Math.round((x - me.minx) * (canvasWidth / rangeX));
- xPosNext = i < yValCount - 1 ? canvasLeft + Math.round((xNext - me.minx) * (canvasWidth / rangeX)) : canvasWidth;
- next = xPos + ((xPosNext - xPos) / 2);
- regionMap[i] = [
- last || 0,
- next,
- i
- ];
- last = next;
- if (y === null) {
- if (i) {
- if (yValues[i - 1] !== null) {
- path = [];
- paths.push(path);
- }
- vertices.push(null);
- }
- } else {
- if (y < me.miny) {
- y = me.miny;
- }
- if (y > me.maxy) {
- y = me.maxy;
- }
- if (!path.length) {
-
- path.push([
- xPos,
- canvasTop + canvasHeight
- ]);
- }
- vertex = [
- xPos,
- canvasTop + Math.round(canvasHeight - (canvasHeight * ((y - this.miny) / Y)))
- ];
- path.push(vertex);
- vertices.push(vertex);
- }
- }
- lineShapes = [];
- fillShapes = [];
- plen = paths.length;
- for (i = 0; i < plen; i++) {
- path = paths[i];
- if (path.length) {
- if (me.fillColor) {
- path.push([
- path[path.length - 1][0],
- (canvasTop + canvasHeight)
- ]);
- fillShapes.push(path.slice(0));
- path.pop();
- }
-
-
- if (path.length > 2) {
-
- path[0] = [
- path[0][0],
- path[1][1]
- ];
- }
- lineShapes.push(path);
- }
- }
-
- plen = fillShapes.length;
- for (i = 0; i < plen; i++) {
- canvas.drawShape(fillShapes[i], me.fillColor, me.fillColor).append();
- }
- if (normalRangeMin != null && drawNormalOnTop) {
- me.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, Y);
- }
- plen = lineShapes.length;
- for (i = 0; i < plen; i++) {
- canvas.drawShape(lineShapes[i], me.getLineColor(), null, me.getLineWidth()).append();
- }
- if (spotRadius && valueSpots) {
- if (valueSpots.get == null) {
- valueSpots = new Ext.sparkline.RangeMap(valueSpots);
- }
- for (i = 0; i < yValCount; i++) {
- color = valueSpots.get(yValues[i]);
- if (color) {
- canvas.drawCircle(canvasLeft + Math.round((xValues[i] - me.minx) * (canvasWidth / rangeX)), canvasTop + Math.round(canvasHeight - (canvasHeight * ((yValues[i] - me.miny) / Y))), spotRadius, null, color).append();
- }
- }
- }
- if (spotRadius && spotColor && yValues[yvallast] != null) {
- canvas.drawCircle(canvasLeft + Math.round((xValues[xValues.length - 1] - me.minx) * (canvasWidth / rangeX)), canvasTop + Math.round(canvasHeight - (canvasHeight * ((yValues[yvallast] - me.miny) / Y))), spotRadius, null, spotColor).append();
- }
- if (me.maxy !== me.minyorg) {
- if (spotRadius && minSpotColor) {
- x = xValues[Ext.Array.indexOf(yValues, me.minyorg)];
- canvas.drawCircle(canvasLeft + Math.round((x - me.minx) * (canvasWidth / rangeX)), canvasTop + Math.round(canvasHeight - (canvasHeight * ((me.minyorg - me.miny) / Y))), spotRadius, null, minSpotColor).append();
- }
- if (spotRadius && maxSpotColor) {
- x = xValues[Ext.Array.indexOf(yValues, me.maxyorg)];
- canvas.drawCircle(canvasLeft + Math.round((x - me.minx) * (canvasWidth / rangeX)), canvasTop + Math.round(canvasHeight - (canvasHeight * ((me.maxyorg - me.miny) / Y))), spotRadius, null, maxSpotColor).append();
- }
- }
- me.canvasTop = canvasTop;
-
- if (me.currentPageXY && me.canvasRegion.contains(me.currentPageXY)) {
- me.updateDisplay();
- }
- canvas.render();
- }
- });
- Ext.define('Ext.sparkline.Pie', {
- extend: Ext.sparkline.Base,
- alias: 'widget.sparklinepie',
- config: {
-
- offset: 0,
-
- sliceColors: [
- '#3366cc',
- '#dc3912',
- '#ff9900',
- '#109618',
- '#66aa00',
- '#dd4477',
- '#0099c6',
- '#990099'
- ],
-
- borderWidth: 0,
-
- borderColor: '#000'
- },
- tipTpl: '● {value} ({percent:number("0.0")}%)',
-
- applyValues: function(newValues) {
- newValues = Ext.Array.map(Ext.Array.from(newValues), Number);
- this.disabled = !(newValues && newValues.length);
- this.updateConfigChange();
- return newValues;
- },
- onUpdate: function() {
- var me = this,
- values = me.values,
- total = 0,
- i;
- me.callParent(arguments);
- me.shapes = {};
-
- me.valueShapes = {};
-
- if (values.length > 0) {
- for (i = values.length; i--; ) {
- total += values[i];
- }
- }
- me.total = total;
- me.radius = Math.floor(Math.min(me.getWidth(), me.getHeight()) / 2);
- },
- getRegion: function(x, y) {
- var ratio = window.devicePixelRatio || 1,
- shapeid = this.canvas.getShapeAt(x * ratio, y * ratio);
- return (shapeid != null && this.shapes[shapeid] != null) ? this.shapes[shapeid] : null;
- },
- getRegionFields: function(region) {
- var sliceColors = this.getSliceColors();
- return {
- isNull: this.values[region] == null,
- value: this.values[region],
- percent: this.values[region] / this.total * 100,
- color: sliceColors[region % sliceColors.length],
- offset: region
- };
- },
- renderHighlight: function(region) {
- this.renderSlice(region, true).append();
- },
- renderSlice: function(valuenum, highlight) {
- var me = this,
- canvas = me.canvas,
- radius = me.radius,
- borderWidth = me.getBorderWidth(),
- offset = me.getOffset(),
- circle = 2 * Math.PI,
- values = me.values,
- total = me.total,
- next = offset ? (2 * Math.PI) * (offset / 360) : 0,
- start, end, i, vlen, color,
- sliceColors = this.getSliceColors();
- vlen = values.length;
- for (i = 0; i < vlen; i++) {
- start = next;
- end = next;
- if (total > 0) {
-
- end = next + (circle * (values[i] / total));
- }
- if (valuenum === i) {
- color = sliceColors[i % sliceColors.length];
- if (highlight) {
- color = me.calcHighlightColor(color);
- }
- return canvas.drawPieSlice(radius, radius, radius - borderWidth, start, end, null, color);
- }
- next = end;
- }
- },
- renderGraph: function() {
- var me = this,
- canvas = me.canvas,
- values = me.values,
- radius = me.radius,
- borderWidth = me.getBorderWidth(),
- shape, i,
- shapes = me.shapes || (me.shapes = {}),
- valueShapes = me.valueShapes || (me.valueShapes = {});
- if (!me.callParent()) {
- return;
- }
- if (borderWidth) {
- canvas.drawCircle(radius, radius, Math.floor(radius - (borderWidth / 2)), me.getBorderColor(), null, borderWidth).append();
- }
- for (i = values.length; i--; ) {
- if (values[i]) {
-
- shape = me.renderSlice(i).append();
- valueShapes[i] = shape.id;
-
- shapes[shape.id] = i;
- }
- }
-
- if (me.currentPageXY && me.canvasRegion.contains(me.currentPageXY)) {
- me.currentRegion = null;
- me.updateDisplay();
- }
- canvas.render();
- }
- });
- Ext.define('Ext.sparkline.TriState', {
- extend: Ext.sparkline.BarBase,
- alias: 'widget.sparklinetristate',
- config: {
-
- barWidth: 4,
-
- barSpacing: 1,
-
- posBarColor: '#6f6',
-
- negBarColor: '#f44',
-
- zeroBarColor: '#999',
-
- colorMap: {}
- },
- tipTpl: [
- '● {value:this.states}',
- {
- states: function(v) {
- var value = Number(v);
- if (value === -1) {
- return 'Loss';
- }
- if (value === 0) {
- return 'Draw';
- }
- if (value === 1) {
- return 'Win';
- }
- return v;
- }
- }
- ],
- applyColorMap: function(colorMap) {
- var me = this;
- if (Ext.isArray(colorMap)) {
- me.colorMapByIndex = colorMap;
- me.colorMapByValue = null;
- } else {
- me.colorMapByIndex = null;
- me.colorMapByValue = colorMap;
- if (me.colorMapByValue && me.colorMapByValue.get == null) {
- me.colorMapByValue = new Ext.sparkline.RangeMap(colorMap);
- }
- }
- me.updateConfigChange();
- return colorMap;
- },
-
- applyValues: function(newValues) {
- newValues = Ext.Array.map(Ext.Array.from(newValues), Number);
- this.disabled = !(newValues && newValues.length);
- this.updateConfigChange();
- return newValues;
- },
- onUpdate: function() {
- this.totalBarWidth = this.getBarWidth() + this.getBarSpacing();
- },
- getBarWidth: function() {
- var values = this.values;
- return this._barWidth || (this.getWidth() - (values.length - 1) * this.getBarSpacing()) / values.length;
- },
- getRegion: function(x, y) {
- return Math.floor(x / this.totalBarWidth);
- },
- getRegionFields: function(region) {
- return {
- isNull: this.values[region] == null,
- value: this.values[region],
- color: this.calcColor(this.values[region], region),
- offset: region
- };
- },
- calcColor: function(value, valuenum) {
- var me = this,
- values = me.values,
- colorMapByIndex = me.colorMapByIndex,
- colorMapByValue = me.colorMapByValue,
- color, newColor;
- if (colorMapByValue && (newColor = colorMapByValue.get(value))) {
- color = newColor;
- } else if (colorMapByIndex && colorMapByIndex.length > valuenum) {
- color = colorMapByIndex[valuenum];
- } else if (values[valuenum] < 0) {
- color = me.getNegBarColor();
- } else if (values[valuenum] > 0) {
- color = me.getPosBarColor();
- } else {
- color = me.getZeroBarColor();
- }
- return color;
- },
- renderRegion: function(valuenum, highlight) {
- var me = this,
- values = me.values,
- canvas = me.canvas,
- canvasHeight, height, halfHeight, x, y, color;
- canvasHeight = canvas.pixelHeight;
- halfHeight = Math.round(canvasHeight / 2);
- x = valuenum * me.totalBarWidth;
- if (values[valuenum] < 0) {
- y = halfHeight;
- height = halfHeight - 1;
- } else if (values[valuenum] > 0) {
- y = 0;
- height = halfHeight - 1;
- } else {
- y = halfHeight - 1;
- height = 2;
- }
- color = me.calcColor(values[valuenum], valuenum);
- if (color == null) {
- return;
- }
- if (highlight) {
- color = me.calcHighlightColor(color);
- }
- canvas.drawRect(x, y, me.getBarWidth() - 1, height - 1, color, color).append();
- }
- });
- Ext.define('Ext.util.Base64', {
- singleton: true,
-
- _str: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
-
- encode: function(input) {
- var me = this;
- var output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0;
- input = me._utf8_encode(input);
- var len = input.length;
- while (i < len) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output + me._str.charAt(enc1) + me._str.charAt(enc2) + me._str.charAt(enc3) + me._str.charAt(enc4);
- }
- return output;
- },
-
- decode: function(input) {
- var me = this;
- var output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- var len = input.length;
- while (i < len) {
- enc1 = me._str.indexOf(input.charAt(i++));
- enc2 = me._str.indexOf(input.charAt(i++));
- enc3 = me._str.indexOf(input.charAt(i++));
- enc4 = me._str.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 !== 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 !== 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = me._utf8_decode(output);
- return output;
- },
-
- _utf8_encode: function(string) {
- string = string.replace(/\r\n/g, "\n");
- var utftext = '',
- n = 0,
- len = string.length;
- for (; n < len; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- }
- return utftext;
- },
-
- _utf8_decode: function(utftext) {
- var string = '',
- i = 0,
- c = 0,
- c3 = 0,
- c2 = 0,
- len = utftext.length;
- while (i < len) {
- c = utftext.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if ((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i + 1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i + 1);
- c3 = utftext.charCodeAt(i + 2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
- });
- Ext.define('Ext.util.DelimitedValue', {
-
- dateFormat: 'C',
-
- delimiter: '\t',
-
- lineBreak: '\n',
-
- quote: '"',
- lineBreakRe: /\r?\n/g,
-
- lastLineBreakRe: /(\r?\n|\r)$/,
- constructor: function(config) {
- if (config) {
- Ext.apply(this, config);
- }
- this.parseREs = {};
- this.quoteREs = {};
- },
-
- decode: function(input, delimiter, quoteChar) {
- if (!input) {
- return [];
- }
- var me = this,
-
-
- delim = delimiter || me.delimiter,
- row = [],
- result = [
- row
- ],
- quote = quoteChar !== undefined ? quoteChar : me.quote,
- quoteREs = me.quoteREs,
- parseREs = me.parseREs,
- parseRE, dblQuoteRE, arrMatches, strMatchedDelimiter, strMatchedValue;
-
-
- parseRE = quote === me.quote ? parseREs[delim] : null;
- parseRE = parseRE || new RegExp(
- "(\\" + delim + "|\\r?\\n|\\r|^)" +
- "(?:" + (quote === null ? '()' : "\\" + quote + "([^\\" + quote + "]*(?:\\" + quote + "\\" + quote + "[^\\" + quote + "]*)*)\\" + quote + "|") +
- "([^" + (quote === null ? '' : quote) + delim + "\\r\\n]*))", "gi");
- dblQuoteRE = quote === me.quote ? quoteREs[quote] : null;
- dblQuoteRE = dblQuoteRE || new RegExp('\\' + quote + '\\' + quote, 'g');
- input = input.replace(me.lastLineBreakRe, '');
-
-
- while ((arrMatches = parseRE.exec(input))) {
- strMatchedDelimiter = arrMatches[1];
-
-
-
-
- if (strMatchedDelimiter.length && strMatchedDelimiter !== delim) {
-
-
- result.push(row = []);
- }
-
- if (!arrMatches.index && arrMatches[0].charAt(0) === delim) {
- row.push('');
- }
-
-
-
- if (arrMatches[2]) {
-
-
- strMatchedValue = arrMatches[2].replace(dblQuoteRE, quote);
- } else {
-
- strMatchedValue = arrMatches[3];
- }
- row.push(strMatchedValue);
- }
- return result;
- },
-
- encode: function(input, delimiter, quoteChar) {
- var me = this,
- delim = delimiter || me.delimiter,
- dateFormat = me.dateFormat,
- quote = quoteChar !== undefined ? quoteChar : me.quote,
- twoQuotes = quote + quote,
- rowIndex = input.length,
- lineBreakRe = me.lineBreakRe,
- result = [],
- outputRow = [],
- col, columnIndex, inputRow;
- while (rowIndex-- > 0) {
- inputRow = input[rowIndex];
- outputRow.length = columnIndex = inputRow.length;
- while (columnIndex-- > 0) {
- col = inputRow[columnIndex];
- if (col == null) {
-
- col = '';
- } else if (typeof col === 'string') {
- if (col && quote !== null) {
-
- if (col.indexOf(quote) > -1) {
- col = quote + col.split(quote).join(twoQuotes) + quote;
- } else if (col.indexOf(delim) > -1 || lineBreakRe.test(col)) {
- col = quote + col + quote;
- }
- }
- } else if (Ext.isDate(col)) {
- col = Ext.Date.format(col, dateFormat);
- }
-
- else if (col && (isNaN(col) || Ext.isArray(col))) {
- Ext.raise('Cannot serialize ' + Ext.typeOf(col) + ' into CSV');
- }
-
- outputRow[columnIndex] = col;
- }
- result[rowIndex] = outputRow.join(delim);
- }
- return result.join(me.lineBreak);
- }
- });
- Ext.define('Ext.util.CSV', {
- extend: Ext.util.DelimitedValue,
- singleton: true,
- delimiter: ','
- });
- Ext.define('Ext.util.ClickRepeater', {
- alternateClassName: 'Ext.util.TapRepeater',
- mixins: [
- Ext.mixin.Observable
- ],
-
-
-
- config: {
-
- el: null,
-
- target: null,
- disabled: null
- },
-
-
-
-
- interval: 20,
-
- delay: 250,
-
- preventDefault: true,
-
- stopDefault: false,
- timer: 0,
-
- handler: null,
-
- scope: null,
-
- constructor: function(config) {
- var me = this;
-
- if (arguments.length === 2) {
- me.setEl(config);
- config = arguments[1];
- }
- me.mixins.observable.constructor.call(this, config);
- },
- destroy: function() {
- this.setEl(null);
- this.callParent();
- },
- privates: {
- fireClick: function(e) {
- var me = this;
- me.fireEvent("click", me, e);
- Ext.callback(me.handler, me.scope, [
- me,
- e
- ], 0, me.getTarget());
- },
- updateDisabled: function(disabled) {
- var me = this;
- if (disabled) {
- me.savedEl = me.getEl();
- me.setEl(null);
- } else if (me.savedEl) {
- me.setEl(me.savedEl);
- }
- },
- updateTarget: function(target) {
- this.setEl(target.el);
- },
- updateEl: function(newEl, oldEl) {
- var me = this,
- elListeners;
- if (oldEl) {
- oldEl.selectable();
- Ext.undefer(me.timer);
- if (me.pressedCls) {
- oldEl.removeCls(me.pressedCls);
- }
- Ext.getDoc().un('mouseup', me.handleMouseUp, me);
- me.elListeners = Ext.destroy(me.elListeners);
- }
- if (newEl) {
- newEl.unselectable();
- elListeners = {
- mousedown: me.handleMouseDown,
- scope: me,
- destroyable: true
- };
- if (me.preventDefault || me.stopDefault) {
- elListeners.click = me.eventOptions;
- }
- me.elListeners = newEl.on(elListeners);
- }
- },
- eventOptions: function(e) {
- if (this.preventDefault) {
- e.preventDefault();
- }
- if (this.stopDefault) {
- e.stopEvent();
- }
- },
- handleMouseDown: function(e) {
- var me = this,
- el = me.getEl();
- Ext.undefer(me.timer);
- if (me.pressedCls) {
- el.addCls(me.pressedCls);
- }
- me.mousedownTime = Ext.now();
- if (e.pointerType === 'mouse') {
- el.on("mouseout", me.handleMouseOut, me);
- }
- Ext.getDoc().on("mouseup", me.handleMouseUp, me);
- me.fireEvent("mousedown", me, e);
- me.fireClick(e);
-
- if (me.accelerate) {
- me.delay = 400;
- }
- me.timer = Ext.defer(me.click, me.delay || me.interval, me, [
- e
- ]);
- if (me.mousedownPreventDefault) {
- e.preventDefault();
- }
- if (me.mousedownStopEvent) {
- e.stopEvent();
- }
- },
- click: function(e) {
- var me = this;
- me.fireClick(e);
- me.timer = Ext.defer(me.click, me.accelerate ? me.easeOutExpo(Ext.now() - me.mousedownTime, 400, -390, 12000) : me.interval, me, [
- e
- ]);
- },
- easeOutExpo: function(t, b, c, d) {
- return (t === d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
- },
- handleMouseOut: function() {
- var me = this,
- el = me.getEl();
- Ext.undefer(me.timer);
- if (me.pressedCls) {
- el.removeCls(me.pressedCls);
- }
- el.on("mouseover", me.handleMouseReturn, me);
- },
- handleMouseReturn: function(e) {
- var me = this,
- el = me.getEl();
- el.un("mouseover", me.handleMouseReturn, me);
- if (me.pressedCls) {
- el.addCls(me.pressedCls);
- }
- me.click(e);
- },
- handleMouseUp: function(e) {
- var me = this,
- el = me.getEl();
- Ext.undefer(me.timer);
- el.un("mouseover", me.handleMouseReturn, me);
- el.un("mouseout", me.handleMouseOut, me);
- Ext.getDoc().un("mouseup", me.handleMouseUp, me);
- if (me.pressedCls) {
- el.removeCls(me.pressedCls);
- }
- me.fireEvent("mouseup", me, e);
- }
- }
- });
- Ext.define('Ext.util.Cookies', {
- singleton: true,
-
- set: function(name, value) {
- var argv = arguments,
- argc = argv.length,
- expires = (argc > 2) ? argv[2] : null,
- path = (argc > 3) ? argv[3] : '/',
- domain = (argc > 4) ? argv[4] : null,
- secure = (argc > 5) ? argv[5] : false;
- document.cookie = name + "=" + escape(value) + ((expires === null) ? "" : ("; expires=" + expires.toUTCString())) + ((path === null) ? "" : ("; path=" + path)) + ((domain === null) ? "" : ("; domain=" + domain)) + ((secure === true) ? "; secure" : "");
- },
-
- get: function(name) {
- var parts = document.cookie.split('; '),
- len = parts.length,
- item, i, ret;
-
-
-
-
-
- for (i = 0; i < len; ++i) {
- item = parts[i].split('=');
- if (item[0] === name) {
- ret = item[1];
- return ret ? unescape(ret) : '';
- }
- }
- return null;
- },
-
- clear: function(name, path) {
- if (this.get(name)) {
- path = path || '/';
- document.cookie = name + '=' + '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=' + path;
- }
- }
- });
- Ext.define('Ext.util.LocalStorage', {
-
- id: null,
-
- destroyed: false,
-
- lazyKeys: true,
-
- prefix: '',
-
- session: false,
-
- _keys: null,
-
- _store: null,
-
- _users: 0,
- statics: {
- cache: {},
-
- get: function(id) {
- var me = this,
- cache = me.cache,
- config = {
- _users: 1
- },
-
- instance;
- if (Ext.isString(id)) {
- config.id = id;
- } else {
- Ext.apply(config, id);
- }
- if (!(instance = cache[config.id])) {
- instance = new me(config);
- } else {
-
- if (instance === true) {
- Ext.raise('Creating a shared instance of private local store "' + me.id + '".');
- }
-
- ++instance._users;
- }
- return instance;
- },
-
- supported: true
- },
- constructor: function(config) {
- var me = this;
- Ext.apply(me, config);
-
- if (!me.hasOwnProperty('id')) {
- Ext.raise("No id was provided to the local store.");
- }
-
- if (me._users) {
-
-
-
- Ext.util.LocalStorage.cache[me.id] = me;
- } else
- {
-
-
- if (Ext.util.LocalStorage.cache[me.id]) {
- Ext.raise('Cannot create duplicate instance of local store "' + me.id + '". Use Ext.util.LocalStorage.get() to share instances.');
- }
-
-
- Ext.util.LocalStorage.cache[me.id] = true;
- }
-
- me.init();
- },
-
- init: function() {
- var me = this,
- id = me.id;
- if (!me.prefix && id) {
- me.prefix = id + '-';
- }
- me._store = (me.session ? window.sessionStorage : window.localStorage);
- },
-
- destroy: function() {
- var me = this;
-
- if (me._users) {
- Ext.log.warn('LocalStorage(id=' + me.id + ') destroyed while in use');
- }
-
- delete Ext.util.LocalStorage.cache[me.id];
- me._store = me._keys = null;
- me.callParent();
- },
-
- getKeys: function() {
- var me = this,
- store = me._store,
- prefix = me.prefix,
- keys = me._keys,
- n = prefix.length,
- i, key;
- if (!keys) {
- me._keys = keys = [];
- for (i = store.length; i--; ) {
- key = store.key(i);
- if (key.length > n) {
- if (prefix === key.substring(0, n)) {
- keys.push(key.substring(n));
- }
- }
- }
- }
- return keys;
- },
-
- release: function() {
- if (!--this._users) {
- this.destroy();
- }
- },
-
- save: Ext.emptyFn,
-
- clear: function() {
- var me = this,
- store = me._store,
- prefix = me.prefix,
- keys = me._keys || me.getKeys(),
- i;
- for (i = keys.length; i--; ) {
- store.removeItem(prefix + keys[i]);
- }
- keys.length = 0;
- },
-
- key: function(index) {
- var keys = this._keys || this.getKeys();
- return (0 <= index && index < keys.length) ? keys[index] : null;
- },
-
- getItem: function(key) {
- var k = this.prefix + key;
- return this._store.getItem(k);
- },
-
- removeItem: function(key) {
- var me = this,
- k = me.prefix + key,
- store = me._store,
- keys = me._keys,
- length = store.length;
- store.removeItem(k);
- if (keys && length !== store.length) {
- if (me.lazyKeys) {
- me._keys = null;
- } else {
- Ext.Array.remove(keys, key);
- }
- }
- },
-
- setItem: function(key, value) {
- var me = this,
- k = me.prefix + key,
- store = me._store,
- length = store.length,
- keys = me._keys;
- store.setItem(k, value);
- if (keys && length !== store.length) {
-
- keys.push(key);
- }
- }
- }, function() {
- var LocalStorage = this;
- if ('localStorage' in window) {
- return;
- }
- if (!Ext.isIE) {
- LocalStorage.supported = false;
-
- LocalStorage.prototype.init = function() {
- Ext.raise("Local storage is not supported on this browser");
- };
-
- return;
- }
-
-
-
-
- LocalStorage.override({
-
- data: null,
-
-
- flushDelay: 1,
- init: function() {
- var me = this,
- data = me.data,
- el;
- me.el = el = document.createElement('div');
- el.id = (me.id || (me.id = 'extjs-localstore'));
- el.addBehavior('#default#userdata');
-
- Ext.getHead().dom.appendChild(el);
- el.load(me.id);
- data = el.getAttribute('xdata');
- me.data = data = (data ? Ext.decode(data) : {});
- me._flushFn = function() {
- me._timer = null;
- me.save(0);
- };
- },
- destroy: function() {
- var me = this,
- el = me.el;
- if (el) {
-
- if (me._timer) {
- me.save();
- }
- el.parentNode.removeChild(el);
- me.data = me.el = null;
- me.callParent();
- }
- },
- getKeys: function() {
- var me = this,
- keys = me._keys;
- if (!keys) {
- me._keys = keys = Ext.Object.getKeys(me.data);
- }
- return keys;
- },
-
- save: function(delay) {
- var me = this;
- if (!delay) {
- me._timer = Ext.undefer(me._timer);
- me.el.setAttribute('xdata', Ext.encode(me.data));
- me.el.save(me.id);
- } else if (!me._timer) {
- me._timer = Ext.defer(me._flushFn, delay);
- }
- },
- clear: function() {
- var me = this;
- me.data = {};
- me._keys = null;
- me.save(me.flushDelay);
- },
- getItem: function(key) {
- var data = this.data;
- return (key in data) ? data[key] : null;
- },
- removeItem: function(key) {
- var me = this,
- keys = me._keys,
- data = me.data;
- if (key in data) {
- delete data[key];
- if (keys) {
- if (me.lazyKeys) {
- me._keys = null;
- } else {
- Ext.Array.remove(keys, key);
- }
- }
- me.save(me.flushDelay);
- }
- },
- setItem: function(key, value) {
- var me = this,
- data = me.data,
- keys = me._keys;
- if (keys && !(key in data)) {
- keys.push(key);
- }
- data[key] = value;
- me.save(me.flushDelay);
- }
- });
- });
- Ext.define('Ext.util.Spans', {
- isSpans: true,
- constructor: function() {
- this.spans = this.spans || [];
- },
-
- clear: function() {
- this.spans.length = 0;
- return this;
- },
-
- add: function(begin, end) {
- if (end === undefined) {
- if (typeof begin === 'number') {
- end = begin + 1;
- } else {
- end = begin[1];
- begin = begin[0];
- }
- }
- var me = this,
- spans = me.spans,
- b, e, first, last, span;
- first = me.bisect(begin);
- if (first) {
-
- span = spans[first - 1];
- b = span[0];
- e = span[1];
- if (begin <= e) {
-
-
- if (end <= e) {
- return false;
- }
-
-
-
- begin = b;
- spans.splice(--first, 1);
- }
- }
-
-
- last = me.bisect(end);
- if (last > first) {
-
-
- span = spans[last - 1];
- end = Math.max(end, span[1]);
- }
- if (last < spans.length) {
- span = spans[last];
-
-
-
-
- if (end === span[0]) {
- end = span[1];
- ++last;
- }
- }
- spans.splice(first, last - first, [
- begin,
- end
- ]);
- return true;
- },
-
- contains: function(begin, end) {
- if (end === undefined) {
- if (typeof begin === 'number') {
- end = begin + 1;
- } else {
- end = begin[1];
- begin = begin[0];
- }
- }
- var spans = this.spans,
- index = this.bisect(begin),
- ret = false,
- e, span;
- if (index && begin < (e = spans[index - 1][1])) {
- ret = end <= e;
- } else if (index < spans.length) {
- span = spans[index];
- ret = span[0] <= begin && end <= span[1];
- }
- return ret;
- },
-
- each: function(fn, scope) {
- var spans = this.spans,
- len = spans.length,
- i, span, j;
- for (i = 0; i < len; i++) {
- span = spans[i];
- for (j = span[0]; j < span[1]; j++) {
- if (fn.call(scope || this, i) === false) {
- return;
- }
- }
- }
- },
-
- intersects: function(begin, end) {
- if (end === undefined) {
- if (typeof begin === 'number') {
- end = begin + 1;
- } else {
- end = begin[1];
- begin = begin[0];
- }
- }
- var spans = this.spans,
- index = this.bisect(begin),
- ret = false;
- if (index && begin < spans[index - 1][1]) {
- ret = true;
- } else if (index < spans.length) {
- ret = spans[index][0] < end;
- }
- return ret;
- },
-
- remove: function(begin, end) {
- if (end === undefined) {
- if (typeof begin === 'number') {
- end = begin + 1;
- } else {
- end = begin[1];
- begin = begin[0];
- }
- }
- var me = this,
- spans = me.spans,
- first = me.bisect(begin),
- ret = false,
- last, span, tmp;
- if (first) {
- span = spans[first - 1];
- tmp = span[1];
- if (begin < tmp) {
- span[1] = begin;
- if (end < tmp) {
- spans.splice(first, 0, [
- end,
- tmp
- ]);
- return true;
- }
- ret = true;
- }
- }
- last = me.bisect(end);
- if (first < last) {
- ret = true;
- span = spans[last - 1];
- if (end < span[1]) {
- span[0] = end;
- --last;
- }
- last -= first;
- if (last) {
- spans.splice(first, last);
- }
- }
- return ret;
- },
-
- stash: function() {
- return this.spans.slice();
- },
-
- unstash: function(pickle) {
- this.spans = pickle;
- return this;
- },
-
- getCount: function() {
- var spans = this.spans,
- len = spans.length,
- result = 0,
- i, span;
- for (i = 0; i < len; i++) {
- span = spans[i];
- result += span[1] - span[0];
- }
- return result;
- },
- privates: {
- bisect: function(value) {
- return Ext.Number.bisectTuples(this.spans, value, 0);
- }
- }
- });
- Ext.define('Ext.util.TsvDecoder', {
- extend: Ext.util.DelimitedValue,
- alternateClassName: 'Ext.util.TSV',
- delimiter: '\t'
- }, function(TSVClass) {
-
- Ext.util.TSV = new TSVClass();
- });
- Ext.define('Ext.util.TaskManager', {
- extend: Ext.util.TaskRunner,
- alternateClassName: [
- 'Ext.TaskManager'
- ],
- singleton: true
- });
- Ext.define('Ext.util.TextMetrics', {
- statics: {
- shared: null,
-
- measure: function(el, text, fixedWidth) {
- var me = this,
- shared = me.shared || (me.shared = new me(el, fixedWidth));
- shared.bind(el);
- shared.setFixedWidth(fixedWidth || 'auto');
- return shared.getSize(text);
- },
-
- destroy: function() {
- this.shared = Ext.destroy(this.shared);
- }
- },
-
- constructor: function(bindTo, fixedWidth) {
- var me = this,
- measure = me.measure = Ext.getBody().createChild({
-
-
- 'data-sticky': true,
-
- role: 'presentation',
- cls: Ext.baseCSSPrefix + 'textmetrics',
- style: {
- position: 'absolute',
- left: '-1000px',
- top: '-1000px',
- visibility: 'hidden'
- }
- });
- if (bindTo) {
- me.bind(bindTo);
- }
- if (fixedWidth) {
- measure.setWidth(fixedWidth);
- }
- },
-
- getSize: function(text) {
- var measure = this.measure,
- size;
- measure.setHtml(text);
- size = measure.getSize();
- measure.setHtml('');
- return size;
- },
-
- bind: function(el) {
- this.measure.setStyle(
-
- (this.el || (this.self.prototype.el = new Ext.dom.Fly())).attach(el).getStyle([
- 'font-size',
- 'font-size-adjust',
- 'font-style',
- 'font-weight',
- 'font-family',
- 'font-kerning',
- 'font-stretch',
- 'line-height',
- 'text-transform',
- 'text-decoration',
- 'letter-spacing',
- 'word-break'
- ]));
- },
-
- setFixedWidth: function(width) {
- this.measure.setWidth(width);
- },
-
- getWidth: function(text) {
- this.measure.dom.style.width = 'auto';
- return this.getSize(text).width;
- },
-
- getHeight: function(text) {
- return this.getSize(text).height;
- },
-
- destroy: function() {
- var me = this;
- me.el = me.measure = Ext.destroy(me.measure);
- me.callParent();
- }
- }, function() {
- Ext.Element.override({
-
- getTextWidth: function(text, min, max) {
- return Ext.Number.constrain(Ext.util.TextMetrics.measure(this.dom, Ext.valueFrom(text, this.dom.innerHTML, true)).width, min || 0, max || 1000000);
- }
- });
- });
- Ext.define('Ext.util.paintmonitor.OverflowChange', {
- extend: Ext.util.paintmonitor.Abstract,
- eventName: Ext.browser.is.Firefox ? 'overflow' : 'overflowchanged',
- monitorClass: 'overflowchange',
- onElementPainted: function(e) {
- this.getCallback().apply(this.getScope(), this.getArgs());
- }
- });
- Ext.define('Ext.util.sizemonitor.OverflowChange', {
- extend: Ext.util.sizemonitor.Abstract,
- constructor: function(config) {
- this.onExpand = this.onExpand.bind(this);
- this.onShrink = this.onShrink.bind(this);
- this.callParent(arguments);
- },
- getElementConfig: function() {
- return {
- reference: 'detectorsContainer',
- classList: [
- Ext.baseCSSPrefix + 'size-monitors',
- 'overflowchanged'
- ],
- children: [
- {
- reference: 'expandMonitor',
- className: 'expand',
- children: [
- {
- reference: 'expandHelper'
- }
- ]
- },
- {
- reference: 'shrinkMonitor',
- className: 'shrink',
- children: [
- {
- reference: 'shrinkHelper'
- }
- ]
- }
- ]
- };
- },
- bindListeners: function(bind) {
- var method = bind ? 'addEventListener' : 'removeEventListener';
- this.expandMonitor[method](Ext.browser.is.Firefox ? 'underflow' : 'overflowchanged', this.onExpand, true);
- this.shrinkMonitor[method](Ext.browser.is.Firefox ? 'overflow' : 'overflowchanged', this.onShrink, true);
- },
- onExpand: function(e) {
- if (!(this.destroyed || (Ext.browser.is.Webkit && e.horizontalOverflow && e.verticalOverflow))) {
- Ext.TaskQueue.requestRead('refresh', this);
- }
- },
- onShrink: function(e) {
- if (!(this.destroyed || (Ext.browser.is.Webkit && !e.horizontalOverflow && !e.verticalOverflow))) {
- Ext.TaskQueue.requestRead('refresh', this);
- }
- },
- refreshMonitors: function() {
- if (this.destroying || this.destroyed) {
- return;
- }
- var expandHelper = this.expandHelper,
- shrinkHelper = this.shrinkHelper,
- contentBounds = this.getContentBounds(),
- width = contentBounds.width,
- height = contentBounds.height,
- style;
- if (expandHelper && !expandHelper.destroyed) {
- style = expandHelper.style;
- style.width = (width + 1) + 'px';
- style.height = (height + 1) + 'px';
- }
- if (shrinkHelper && !shrinkHelper.destroyed) {
- style = shrinkHelper.style;
- style.width = width + 'px';
- style.height = height + 'px';
- }
- Ext.TaskQueue.requestRead('refresh', this);
- },
- destroy: function() {
-
- this.onExpand = this.onShrink = null;
- this.callParent();
- }
- });
- Ext.define('Ext.util.translatable.ScrollParent', {
- extend: Ext.util.translatable.Dom,
- alias: 'translatable.scrollparent',
-
- isScrollParent: true,
- applyElement: function(element) {
- var el = Ext.get(element);
- if (el) {
- this.parent = el.parent();
- }
- return el;
- },
- doTranslate: function(x, y) {
- var parent = this.parent;
- parent.setScrollLeft(Math.round(-x));
- parent.setScrollTop(Math.round(-y));
- this.callParent([
- x,
- y
- ]);
- },
- getPosition: function() {
- var me = this,
- position = me.position,
- parent = me.parent;
- position.x = parent.getScrollLeft();
- position.y = parent.getScrollTop();
- return position;
- }
- });
- Ext.ClassManager.addNameAlternateMappings({
- "Ext.AbstractComponent": [],
- "Ext.AbstractManager": [],
- "Ext.ActionSheet": [],
- "Ext.Ajax": [],
- "Ext.Anim": [],
- "Ext.AnimationQueue": [],
- "Ext.Audio": [],
- "Ext.Button": [],
- "Ext.Component": [
- "Ext.lib.Component",
- "Ext.Gadget"
- ],
- "Ext.ComponentManager": [
- "Ext.ComponentMgr"
- ],
- "Ext.ComponentQuery": [],
- "Ext.Container": [
- "Ext.lib.Container",
- "Ext.container.Container"
- ],
- "Ext.Decorator": [],
- "Ext.Deferred": [],
- "Ext.Dialog": [
- "Ext.Window",
- "Ext.window.Window"
- ],
- "Ext.Editor": [],
- "Ext.Evented": [
- "Ext.EventedBase"
- ],
- "Ext.GlobalEvents": [
- "Ext.globalEvents"
- ],
- "Ext.Glyph": [],
- "Ext.Img": [
- "Ext.Image"
- ],
- "Ext.Indicator": [],
- "Ext.Label": [],
- "Ext.LoadMask": [],
- "Ext.Mask": [],
- "Ext.Media": [],
- "Ext.MessageBox": [],
- "Ext.Mixin": [],
- "Ext.Panel": [
- "Ext.panel.Panel"
- ],
- "Ext.Progress": [
- "Ext.ProgressBarWidget"
- ],
- "Ext.ProgressBase": [],
- "Ext.Promise": [],
- "Ext.SegmentedButton": [
- "Ext.button.Segmented"
- ],
- "Ext.Sheet": [],
- "Ext.Spacer": [],
- "Ext.SplitButton": [],
- "Ext.TaskQueue": [],
- "Ext.Template": [],
- "Ext.Title": [],
- "Ext.TitleBar": [],
- "Ext.Toast": [],
- "Ext.Tool": [
- "Ext.panel.Tool"
- ],
- "Ext.Toolbar": [],
- "Ext.Video": [],
- "Ext.Widget": [
- "Ext.Gadget"
- ],
- "Ext.XTemplate": [],
- "Ext.app.Application": [],
- "Ext.app.BaseController": [],
- "Ext.app.Controller": [],
- "Ext.app.EventBus": [],
- "Ext.app.EventDomain": [],
- "Ext.app.Profile": [],
- "Ext.app.Util": [],
- "Ext.app.ViewController": [],
- "Ext.app.ViewModel": [],
- "Ext.app.bind.AbstractStub": [],
- "Ext.app.bind.BaseBinding": [],
- "Ext.app.bind.Binding": [],
- "Ext.app.bind.Formula": [],
- "Ext.app.bind.LinkStub": [],
- "Ext.app.bind.Multi": [],
- "Ext.app.bind.Parser": [],
- "Ext.app.bind.RootStub": [],
- "Ext.app.bind.Stub": [],
- "Ext.app.bind.Template": [],
- "Ext.app.bind.TemplateBinding": [],
- "Ext.app.domain.Component": [],
- "Ext.app.domain.Controller": [],
- "Ext.app.domain.Direct": [],
- "Ext.app.domain.Global": [],
- "Ext.app.domain.Store": [],
- "Ext.app.domain.View": [],
- "Ext.behavior.Behavior": [],
- "Ext.carousel.Carousel": [
- "Ext.Carousel"
- ],
- "Ext.carousel.Infinite": [],
- "Ext.carousel.Item": [],
- "Ext.data.AbstractStore": [],
- "Ext.data.ArrayStore": [
- "Ext.data.SimpleStore"
- ],
- "Ext.data.Batch": [],
- "Ext.data.BufferedStore": [],
- "Ext.data.ChainedStore": [],
- "Ext.data.Connection": [],
- "Ext.data.DirectStore": [],
- "Ext.data.Error": [],
- "Ext.data.ErrorCollection": [
- "Ext.data.Errors"
- ],
- "Ext.data.Group": [],
- "Ext.data.JsonP": [],
- "Ext.data.JsonPStore": [],
- "Ext.data.JsonStore": [],
- "Ext.data.LocalStore": [],
- "Ext.data.Model": [
- "Ext.data.Record"
- ],
- "Ext.data.ModelManager": [
- "Ext.ModelMgr"
- ],
- "Ext.data.NodeInterface": [],
- "Ext.data.NodeStore": [],
- "Ext.data.PageMap": [],
- "Ext.data.ProxyStore": [],
- "Ext.data.Range": [],
- "Ext.data.Request": [],
- "Ext.data.ResultSet": [],
- "Ext.data.Session": [],
- "Ext.data.SortTypes": [],
- "Ext.data.Store": [],
- "Ext.data.StoreManager": [
- "Ext.StoreMgr",
- "Ext.data.StoreMgr",
- "Ext.StoreManager"
- ],
- "Ext.data.TreeModel": [],
- "Ext.data.TreeStore": [],
- "Ext.data.Types": [],
- "Ext.data.Validation": [],
- "Ext.data.XmlStore": [],
- "Ext.data.field.Boolean": [],
- "Ext.data.field.Date": [],
- "Ext.data.field.Field": [
- "Ext.data.Field"
- ],
- "Ext.data.field.Integer": [],
- "Ext.data.field.Number": [],
- "Ext.data.field.String": [],
- "Ext.data.flash.BinaryXhr": [],
- "Ext.data.identifier.Generator": [],
- "Ext.data.identifier.Negative": [],
- "Ext.data.identifier.Sequential": [],
- "Ext.data.identifier.Uuid": [],
- "Ext.data.matrix.Matrix": [],
- "Ext.data.matrix.Side": [],
- "Ext.data.matrix.Slice": [],
- "Ext.data.operation.Create": [],
- "Ext.data.operation.Destroy": [],
- "Ext.data.operation.Operation": [
- "Ext.data.Operation"
- ],
- "Ext.data.operation.Read": [],
- "Ext.data.operation.Update": [],
- "Ext.data.proxy.Ajax": [
- "Ext.data.HttpProxy",
- "Ext.data.AjaxProxy"
- ],
- "Ext.data.proxy.Client": [
- "Ext.data.ClientProxy"
- ],
- "Ext.data.proxy.Direct": [
- "Ext.data.DirectProxy"
- ],
- "Ext.data.proxy.JsonP": [
- "Ext.data.ScriptTagProxy"
- ],
- "Ext.data.proxy.LocalStorage": [
- "Ext.data.LocalStorageProxy"
- ],
- "Ext.data.proxy.Memory": [
- "Ext.data.MemoryProxy"
- ],
- "Ext.data.proxy.Proxy": [
- "Ext.data.DataProxy",
- "Ext.data.Proxy"
- ],
- "Ext.data.proxy.Rest": [
- "Ext.data.RestProxy"
- ],
- "Ext.data.proxy.Server": [
- "Ext.data.ServerProxy"
- ],
- "Ext.data.proxy.SessionStorage": [
- "Ext.data.SessionStorageProxy"
- ],
- "Ext.data.proxy.WebStorage": [
- "Ext.data.WebStorageProxy"
- ],
- "Ext.data.reader.Array": [
- "Ext.data.ArrayReader"
- ],
- "Ext.data.reader.Json": [
- "Ext.data.JsonReader"
- ],
- "Ext.data.reader.Reader": [
- "Ext.data.Reader",
- "Ext.data.DataReader"
- ],
- "Ext.data.reader.Xml": [
- "Ext.data.XmlReader"
- ],
- "Ext.data.request.Ajax": [],
- "Ext.data.request.Base": [],
- "Ext.data.request.Form": [],
- "Ext.data.schema.Association": [],
- "Ext.data.schema.ManyToMany": [],
- "Ext.data.schema.ManyToOne": [],
- "Ext.data.schema.Namer": [],
- "Ext.data.schema.OneToOne": [],
- "Ext.data.schema.Role": [],
- "Ext.data.schema.Schema": [],
- "Ext.data.session.BatchVisitor": [],
- "Ext.data.session.ChangesVisitor": [],
- "Ext.data.session.ChildChangesVisitor": [],
- "Ext.data.summary.Average": [],
- "Ext.data.summary.Base": [],
- "Ext.data.summary.Count": [],
- "Ext.data.summary.Max": [],
- "Ext.data.summary.Min": [],
- "Ext.data.summary.Sum": [],
- "Ext.data.validator.AbstractDate": [],
- "Ext.data.validator.Bound": [],
- "Ext.data.validator.CIDRv4": [],
- "Ext.data.validator.CIDRv6": [],
- "Ext.data.validator.Currency": [],
- "Ext.data.validator.CurrencyUS": [],
- "Ext.data.validator.Date": [],
- "Ext.data.validator.DateTime": [],
- "Ext.data.validator.Email": [],
- "Ext.data.validator.Exclusion": [],
- "Ext.data.validator.Format": [],
- "Ext.data.validator.IPAddress": [],
- "Ext.data.validator.Inclusion": [],
- "Ext.data.validator.Length": [],
- "Ext.data.validator.List": [],
- "Ext.data.validator.NotNull": [],
- "Ext.data.validator.Number": [],
- "Ext.data.validator.Phone": [],
- "Ext.data.validator.Presence": [],
- "Ext.data.validator.Range": [],
- "Ext.data.validator.Time": [],
- "Ext.data.validator.Url": [],
- "Ext.data.validator.Validator": [],
- "Ext.data.virtual.Group": [],
- "Ext.data.virtual.Page": [],
- "Ext.data.virtual.PageMap": [],
- "Ext.data.virtual.Range": [],
- "Ext.data.virtual.Store": [],
- "Ext.data.writer.Json": [
- "Ext.data.JsonWriter"
- ],
- "Ext.data.writer.Writer": [
- "Ext.data.DataWriter",
- "Ext.data.Writer"
- ],
- "Ext.data.writer.Xml": [
- "Ext.data.XmlWriter"
- ],
- "Ext.dataview.Abstract": [],
- "Ext.dataview.BoundList": [],
- "Ext.dataview.BoundListLocation": [],
- "Ext.dataview.BoundListNavigationModel": [],
- "Ext.dataview.Component": [],
- "Ext.dataview.DataItem": [
- "Ext.dataview.component.DataItem"
- ],
- "Ext.dataview.DataView": [
- "Ext.DataView"
- ],
- "Ext.dataview.Disclosable": [],
- "Ext.dataview.EmptyText": [],
- "Ext.dataview.GenericItem": [],
- "Ext.dataview.IndexBar": [
- "Ext.IndexBar"
- ],
- "Ext.dataview.ItemHeader": [],
- "Ext.dataview.List": [
- "Ext.List"
- ],
- "Ext.dataview.ListItem": [
- "Ext.dataview.component.ListItem"
- ],
- "Ext.dataview.Location": [],
- "Ext.dataview.NavigationModel": [],
- "Ext.dataview.NestedList": [
- "Ext.NestedList"
- ],
- "Ext.dataview.Pinnable": [],
- "Ext.dataview.SimpleListItem": [
- "Ext.dataview.component.SimpleListItem"
- ],
- "Ext.dataview.listswiper.Accordion": [],
- "Ext.dataview.listswiper.Item": [],
- "Ext.dataview.listswiper.ListSwiper": [],
- "Ext.dataview.listswiper.Stepper": [],
- "Ext.dataview.plugin.ItemTip": [],
- "Ext.dataview.plugin.ListPaging": [
- "Ext.plugin.ListPaging"
- ],
- "Ext.dataview.plugin.SortableList": [
- "Ext.plugin.SortableList"
- ],
- "Ext.dataview.pullrefresh.Bar": [],
- "Ext.dataview.pullrefresh.Item": [],
- "Ext.dataview.pullrefresh.PullRefresh": [
- "Ext.plugin.PullRefresh"
- ],
- "Ext.dataview.pullrefresh.Spinner": [],
- "Ext.dataview.selection.Model": [],
- "Ext.dataview.selection.Records": [],
- "Ext.dataview.selection.Rows": [],
- "Ext.dataview.selection.Selection": [],
- "Ext.direct.Event": [],
- "Ext.direct.ExceptionEvent": [],
- "Ext.direct.JsonProvider": [],
- "Ext.direct.Manager": [],
- "Ext.direct.PollingProvider": [],
- "Ext.direct.Provider": [],
- "Ext.direct.RemotingEvent": [],
- "Ext.direct.RemotingMethod": [],
- "Ext.direct.RemotingProvider": [],
- "Ext.direct.Transaction": [],
- "Ext.dom.CompositeElement": [
- "Ext.CompositeElement"
- ],
- "Ext.dom.CompositeElementLite": [
- "Ext.CompositeElementLite"
- ],
- "Ext.dom.Element": [
- "Ext.Element"
- ],
- "Ext.dom.ElementEvent": [],
- "Ext.dom.Fly": [
- "Ext.dom.Element.Fly"
- ],
- "Ext.dom.GarbageCollector": [],
- "Ext.dom.Helper": [
- "Ext.DomHelper",
- "Ext.core.DomHelper"
- ],
- "Ext.dom.Query": [
- "Ext.core.DomQuery",
- "Ext.DomQuery"
- ],
- "Ext.dom.Shadow": [
- "Ext.Shadow"
- ],
- "Ext.dom.Shim": [],
- "Ext.dom.TouchAction": [],
- "Ext.dom.Underlay": [],
- "Ext.dom.UnderlayPool": [],
- "Ext.drag.Constraint": [],
- "Ext.drag.Info": [],
- "Ext.drag.Item": [],
- "Ext.drag.Manager": [],
- "Ext.drag.Source": [],
- "Ext.drag.Target": [],
- "Ext.drag.proxy.None": [],
- "Ext.drag.proxy.Original": [],
- "Ext.drag.proxy.Placeholder": [],
- "Ext.event.Event": [
- "Ext.EventObjectImpl"
- ],
- "Ext.event.gesture.DoubleTap": [],
- "Ext.event.gesture.Drag": [],
- "Ext.event.gesture.EdgeSwipe": [],
- "Ext.event.gesture.LongPress": [],
- "Ext.event.gesture.MultiTouch": [],
- "Ext.event.gesture.Pinch": [],
- "Ext.event.gesture.Recognizer": [],
- "Ext.event.gesture.Rotate": [],
- "Ext.event.gesture.SingleTouch": [],
- "Ext.event.gesture.Swipe": [],
- "Ext.event.gesture.Tap": [],
- "Ext.event.publisher.Dom": [],
- "Ext.event.publisher.ElementPaint": [],
- "Ext.event.publisher.ElementSize": [],
- "Ext.event.publisher.Focus": [],
- "Ext.event.publisher.Gesture": [],
- "Ext.event.publisher.Publisher": [],
- "Ext.field.BoxLabelable": [],
- "Ext.field.Checkbox": [
- "Ext.form.Checkbox"
- ],
- "Ext.field.ComboBox": [
- "Ext.form.field.ComboBox"
- ],
- "Ext.field.Container": [],
- "Ext.field.Date": [
- "Ext.form.DatePicker",
- "Ext.field.DatePicker"
- ],
- "Ext.field.DatePickerNative": [
- "Ext.form.DatePickerNative"
- ],
- "Ext.field.Display": [
- "Ext.form.Display"
- ],
- "Ext.field.Email": [
- "Ext.form.Email"
- ],
- "Ext.field.Field": [
- "Ext.form.Field"
- ],
- "Ext.field.File": [],
- "Ext.field.FileButton": [],
- "Ext.field.Hidden": [
- "Ext.form.Hidden"
- ],
- "Ext.field.Input": [],
- "Ext.field.InputMask": [],
- "Ext.field.Manager": [],
- "Ext.field.Number": [
- "Ext.form.Number"
- ],
- "Ext.field.Panel": [],
- "Ext.field.Password": [
- "Ext.form.Password"
- ],
- "Ext.field.Picker": [],
- "Ext.field.Radio": [
- "Ext.form.Radio"
- ],
- "Ext.field.Search": [
- "Ext.form.Search"
- ],
- "Ext.field.Select": [
- "Ext.form.Select"
- ],
- "Ext.field.SingleSlider": [],
- "Ext.field.Slider": [
- "Ext.form.Slider"
- ],
- "Ext.field.Spinner": [
- "Ext.form.Spinner"
- ],
- "Ext.field.Text": [
- "Ext.form.Text"
- ],
- "Ext.field.TextArea": [
- "Ext.form.TextArea"
- ],
- "Ext.field.Time": [],
- "Ext.field.Toggle": [
- "Ext.form.Toggle"
- ],
- "Ext.field.Url": [
- "Ext.form.Url"
- ],
- "Ext.field.trigger.Base": [],
- "Ext.field.trigger.Clear": [],
- "Ext.field.trigger.Component": [],
- "Ext.field.trigger.Date": [],
- "Ext.field.trigger.Expand": [],
- "Ext.field.trigger.File": [],
- "Ext.field.trigger.Menu": [],
- "Ext.field.trigger.Reveal": [],
- "Ext.field.trigger.Search": [],
- "Ext.field.trigger.SpinDown": [],
- "Ext.field.trigger.SpinUp": [],
- "Ext.field.trigger.Time": [],
- "Ext.field.trigger.Trigger": [],
- "Ext.form.Borders": [],
- "Ext.form.FieldSet": [],
- "Ext.form.Panel": [
- "Ext.form.FormPanel"
- ],
- "Ext.fx.Animation": [],
- "Ext.fx.Runner": [],
- "Ext.fx.State": [],
- "Ext.fx.animation.Abstract": [],
- "Ext.fx.animation.Cube": [],
- "Ext.fx.animation.Fade": [
- "Ext.fx.animation.FadeIn"
- ],
- "Ext.fx.animation.FadeOut": [],
- "Ext.fx.animation.Flip": [],
- "Ext.fx.animation.Pop": [
- "Ext.fx.animation.PopIn"
- ],
- "Ext.fx.animation.PopOut": [],
- "Ext.fx.animation.Slide": [
- "Ext.fx.animation.SlideIn"
- ],
- "Ext.fx.animation.SlideOut": [],
- "Ext.fx.animation.Wipe": [
- "Ext.fx.animation.WipeIn"
- ],
- "Ext.fx.animation.WipeOut": [],
- "Ext.fx.easing.Abstract": [],
- "Ext.fx.easing.Bounce": [],
- "Ext.fx.easing.BoundMomentum": [],
- "Ext.fx.easing.EaseIn": [],
- "Ext.fx.easing.EaseOut": [],
- "Ext.fx.easing.Easing": [],
- "Ext.fx.easing.Linear": [],
- "Ext.fx.easing.Momentum": [],
- "Ext.fx.runner.Css": [],
- "Ext.fx.runner.CssAnimation": [],
- "Ext.fx.runner.CssTransition": [
- "Ext.Animator"
- ],
- "Ext.grid.CellEditor": [],
- "Ext.grid.Grid": [],
- "Ext.grid.HeaderContainer": [],
- "Ext.grid.Location": [],
- "Ext.grid.NavigationModel": [],
- "Ext.grid.PagingToolbar": [],
- "Ext.grid.Row": [],
- "Ext.grid.RowBody": [],
- "Ext.grid.RowHeader": [],
- "Ext.grid.SummaryRow": [],
- "Ext.grid.Tree": [
- "Ext.tree.Tree"
- ],
- "Ext.grid.cell.Base": [],
- "Ext.grid.cell.Boolean": [],
- "Ext.grid.cell.Cell": [],
- "Ext.grid.cell.Check": [],
- "Ext.grid.cell.Date": [],
- "Ext.grid.cell.Expander": [],
- "Ext.grid.cell.Number": [],
- "Ext.grid.cell.RowNumberer": [],
- "Ext.grid.cell.Text": [],
- "Ext.grid.cell.Tree": [],
- "Ext.grid.cell.Widget": [],
- "Ext.grid.column.Boolean": [],
- "Ext.grid.column.Check": [],
- "Ext.grid.column.Column": [
- "Ext.grid.column.Template"
- ],
- "Ext.grid.column.Date": [],
- "Ext.grid.column.Number": [],
- "Ext.grid.column.RowNumberer": [],
- "Ext.grid.column.Selection": [],
- "Ext.grid.column.Text": [],
- "Ext.grid.column.Tree": [],
- "Ext.grid.menu.Columns": [],
- "Ext.grid.menu.GroupByThis": [],
- "Ext.grid.menu.ShowInGroups": [],
- "Ext.grid.menu.SortAsc": [],
- "Ext.grid.menu.SortDesc": [],
- "Ext.grid.plugin.CellEditing": [],
- "Ext.grid.plugin.Clipboard": [],
- "Ext.grid.plugin.ColumnResizing": [],
- "Ext.grid.plugin.Editable": [],
- "Ext.grid.plugin.PagingToolbar": [],
- "Ext.grid.plugin.RowExpander": [],
- "Ext.grid.plugin.RowOperations": [
- "Ext.grid.plugin.MultiSelection"
- ],
- "Ext.grid.plugin.Summary": [
- "Ext.grid.plugin.SummaryRow"
- ],
- "Ext.grid.plugin.ViewOptions": [],
- "Ext.grid.plugin.ViewOptionsListItem": [],
- "Ext.grid.selection.Cells": [],
- "Ext.grid.selection.Columns": [],
- "Ext.grid.selection.Model": [],
- "Ext.grid.selection.Replicator": [],
- "Ext.grid.selection.SelectionExtender": [],
- "Ext.layout.Auto": [
- "Ext.layout.Default"
- ],
- "Ext.layout.Box": [],
- "Ext.layout.Card": [],
- "Ext.layout.Carousel": [],
- "Ext.layout.Center": [],
- "Ext.layout.Fit": [],
- "Ext.layout.Float": [],
- "Ext.layout.Form": [],
- "Ext.layout.HBox": [],
- "Ext.layout.VBox": [],
- "Ext.layout.card.fx.Abstract": [],
- "Ext.layout.card.fx.Cover": [],
- "Ext.layout.card.fx.Cube": [],
- "Ext.layout.card.fx.Fade": [],
- "Ext.layout.card.fx.Flip": [],
- "Ext.layout.card.fx.Pop": [],
- "Ext.layout.card.fx.Reveal": [],
- "Ext.layout.card.fx.Scroll": [],
- "Ext.layout.card.fx.ScrollCover": [],
- "Ext.layout.card.fx.ScrollReveal": [],
- "Ext.layout.card.fx.Serial": [],
- "Ext.layout.card.fx.Slide": [],
- "Ext.layout.card.fx.Style": [],
- "Ext.layout.overflow.Scroller": [],
- "Ext.layout.wrapper.BoxDock": [],
- "Ext.layout.wrapper.Inner": [],
- "Ext.list.AbstractTreeItem": [],
- "Ext.list.Location": [],
- "Ext.list.RootTreeItem": [],
- "Ext.list.Tree": [],
- "Ext.list.TreeItem": [],
- "Ext.menu.CheckItem": [],
- "Ext.menu.Item": [
- "Ext.menu.TextItem"
- ],
- "Ext.menu.Manager": [
- "Ext.menu.MenuMgr"
- ],
- "Ext.menu.Menu": [],
- "Ext.menu.RadioItem": [],
- "Ext.menu.Separator": [],
- "Ext.mixin.Accessible": [],
- "Ext.mixin.Bindable": [],
- "Ext.mixin.Bufferable": [],
- "Ext.mixin.ComponentDelegation": [],
- "Ext.mixin.ConfigProxy": [],
- "Ext.mixin.ConfigState": [],
- "Ext.mixin.Container": [],
- "Ext.mixin.Dirty": [],
- "Ext.mixin.Factoryable": [],
- "Ext.mixin.Focusable": [],
- "Ext.mixin.FocusableContainer": [],
- "Ext.mixin.Hookable": [],
- "Ext.mixin.Inheritable": [],
- "Ext.mixin.ItemRippler": [],
- "Ext.mixin.Keyboard": [],
- "Ext.mixin.Mashup": [],
- "Ext.mixin.Pluggable": [],
- "Ext.mixin.Progressable": [],
- "Ext.mixin.Queryable": [],
- "Ext.mixin.Responsive": [],
- "Ext.mixin.Selectable": [],
- "Ext.mixin.StoreWatcher": [],
- "Ext.mixin.StyleCacher": [],
- "Ext.mixin.Templatable": [],
- "Ext.mixin.Toolable": [],
- "Ext.mixin.Traversable": [],
- "Ext.navigation.Bar": [],
- "Ext.navigation.View": [
- "Ext.NavigationView"
- ],
- "Ext.override.sparkline.Base": [],
- "Ext.overrides.Progress": [],
- "Ext.overrides.Widget": [],
- "Ext.overrides.app.Application": [],
- "Ext.overrides.dom.Element": [],
- "Ext.overrides.drag.proxy.Placeholder": [],
- "Ext.overrides.list.Tree": [],
- "Ext.overrides.list.TreeItem": [],
- "Ext.panel.Collapser": [],
- "Ext.panel.Collapsible": [],
- "Ext.panel.Date": [],
- "Ext.panel.DateTitle": [],
- "Ext.panel.DateView": [],
- "Ext.panel.Header": [],
- "Ext.panel.Resizable": [],
- "Ext.panel.Resizer": [],
- "Ext.panel.Time": [],
- "Ext.panel.TimeHeader": [],
- "Ext.panel.TimeView": [],
- "Ext.panel.Title": [],
- "Ext.panel.YearPicker": [],
- "Ext.parse.Parser": [],
- "Ext.parse.Symbol": [],
- "Ext.parse.Tokenizer": [],
- "Ext.parse.symbol.Constant": [],
- "Ext.parse.symbol.Infix": [],
- "Ext.parse.symbol.InfixRight": [],
- "Ext.parse.symbol.Paren": [],
- "Ext.parse.symbol.Prefix": [],
- "Ext.perf.Accumulator": [],
- "Ext.perf.Monitor": [
- "Ext.Perf"
- ],
- "Ext.picker.Date": [
- "Ext.DatePicker"
- ],
- "Ext.picker.Picker": [
- "Ext.Picker"
- ],
- "Ext.picker.Slot": [],
- "Ext.picker.Tablet": [],
- "Ext.plugin.Abstract": [
- "Ext.AbstractPlugin"
- ],
- "Ext.plugin.AbstractClipboard": [],
- "Ext.plugin.MouseEnter": [],
- "Ext.plugin.Responsive": [],
- "Ext.plugin.TabGuard": [],
- "Ext.promise.Consequence": [],
- "Ext.promise.Deferred": [],
- "Ext.promise.Promise": [],
- "Ext.route.Action": [],
- "Ext.route.Handler": [],
- "Ext.route.Mixin": [],
- "Ext.route.Route": [],
- "Ext.route.Router": [],
- "Ext.scroll.Scroller": [],
- "Ext.slider.Slider": [],
- "Ext.slider.Thumb": [],
- "Ext.slider.Toggle": [],
- "Ext.sparkline.Bar": [],
- "Ext.sparkline.BarBase": [],
- "Ext.sparkline.Base": [],
- "Ext.sparkline.Box": [],
- "Ext.sparkline.Bullet": [],
- "Ext.sparkline.CanvasBase": [],
- "Ext.sparkline.CanvasCanvas": [],
- "Ext.sparkline.Discrete": [],
- "Ext.sparkline.Line": [],
- "Ext.sparkline.Pie": [],
- "Ext.sparkline.RangeMap": [],
- "Ext.sparkline.Shape": [],
- "Ext.sparkline.TriState": [],
- "Ext.sparkline.VmlCanvas": [],
- "Ext.tab.Bar": [
- "Ext.TabBar"
- ],
- "Ext.tab.Panel": [
- "Ext.TabPanel"
- ],
- "Ext.tab.Tab": [
- "Ext.Tab"
- ],
- "Ext.tip.Manager": [],
- "Ext.tip.ToolTip": [],
- "Ext.util.AbstractMixedCollection": [],
- "Ext.util.Audio": [],
- "Ext.util.Bag": [],
- "Ext.util.Base64": [],
- "Ext.util.BufferedCollection": [],
- "Ext.util.CSS": [],
- "Ext.util.CSV": [],
- "Ext.util.ClickRepeater": [
- "Ext.util.TapRepeater"
- ],
- "Ext.util.Collection": [],
- "Ext.util.CollectionKey": [],
- "Ext.util.Color": [
- "Ext.draw.Color"
- ],
- "Ext.util.Cookies": [],
- "Ext.util.DelimitedValue": [],
- "Ext.util.Draggable": [],
- "Ext.util.Filter": [],
- "Ext.util.FilterCollection": [],
- "Ext.util.Fly": [],
- "Ext.util.Format": [],
- "Ext.util.Geolocation": [
- "Ext.util.GeoLocation"
- ],
- "Ext.util.Group": [],
- "Ext.util.GroupCollection": [],
- "Ext.util.Grouper": [],
- "Ext.util.HashMap": [],
- "Ext.util.History": [
- "Ext.History"
- ],
- "Ext.util.Inflector": [],
- "Ext.util.InputBlocker": [],
- "Ext.util.ItemCollection": [
- "Ext.ItemCollection"
- ],
- "Ext.util.KeyMap": [
- "Ext.KeyMap"
- ],
- "Ext.util.KeyNav": [
- "Ext.KeyNav"
- ],
- "Ext.util.LineSegment": [],
- "Ext.util.LocalStorage": [],
- "Ext.util.LruCache": [],
- "Ext.util.MixedCollection": [],
- "Ext.util.ObjectTemplate": [],
- "Ext.util.Observable": [],
- "Ext.util.Offset": [],
- "Ext.util.PaintMonitor": [],
- "Ext.util.Point": [],
- "Ext.util.PositionMap": [],
- "Ext.util.Positionable": [],
- "Ext.util.Region": [],
- "Ext.util.Schedulable": [],
- "Ext.util.Scheduler": [],
- "Ext.util.SizeMonitor": [],
- "Ext.util.Sortable": [],
- "Ext.util.Sorter": [],
- "Ext.util.SorterCollection": [],
- "Ext.util.Spans": [],
- "Ext.util.TextMetrics": [],
- "Ext.util.TranslatableGroup": [],
- "Ext.util.TranslatableList": [],
- "Ext.util.TsvDecoder": [
- "Ext.util.TSV"
- ],
- "Ext.util.Wrapper": [],
- "Ext.util.XTemplateCompiler": [],
- "Ext.util.XTemplateParser": [],
- "Ext.util.paintmonitor.Abstract": [],
- "Ext.util.paintmonitor.CssAnimation": [],
- "Ext.util.paintmonitor.OverflowChange": [],
- "Ext.util.sizemonitor.Abstract": [],
- "Ext.util.sizemonitor.OverflowChange": [],
- "Ext.util.sizemonitor.Scroll": [],
- "Ext.util.translatable.Abstract": [],
- "Ext.util.translatable.Component": [],
- "Ext.util.translatable.CssPosition": [],
- "Ext.util.translatable.CssTransform": [],
- "Ext.util.translatable.Dom": [],
- "Ext.util.translatable.ScrollParent": [],
- "Ext.util.translatable.ScrollPosition": [],
- "Ext.viewport.Android": [],
- "Ext.viewport.Default": [],
- "Ext.viewport.Ios": [],
- "Ext.viewport.Viewport": [],
- "Ext.viewport.WindowsPhone": [
- "Ext.viewport.WP"
- ]
- });
- Ext.ClassManager.addNameAliasMappings({
- "Ext.AbstractComponent": [],
- "Ext.AbstractManager": [],
- "Ext.ActionSheet": [
- "widget.actionsheet"
- ],
- "Ext.Ajax": [],
- "Ext.Anim": [],
- "Ext.AnimationQueue": [],
- "Ext.Audio": [
- "widget.audio"
- ],
- "Ext.Button": [
- "widget.button"
- ],
- "Ext.Component": [
- "widget.component"
- ],
- "Ext.ComponentManager": [],
- "Ext.ComponentQuery": [],
- "Ext.Container": [
- "widget.container"
- ],
- "Ext.Decorator": [],
- "Ext.Deferred": [],
- "Ext.Dialog": [
- "widget.dialog",
- "widget.window"
- ],
- "Ext.Editor": [
- "widget.editor"
- ],
- "Ext.Evented": [],
- "Ext.GlobalEvents": [],
- "Ext.Glyph": [],
- "Ext.Img": [
- "widget.image",
- "widget.img"
- ],
- "Ext.Indicator": [
- "widget.indicator"
- ],
- "Ext.Label": [
- "widget.label"
- ],
- "Ext.LoadMask": [
- "widget.loadmask"
- ],
- "Ext.Mask": [
- "widget.mask"
- ],
- "Ext.Media": [
- "widget.media"
- ],
- "Ext.MessageBox": [
- "widget.messagebox"
- ],
- "Ext.Mixin": [],
- "Ext.Panel": [
- "widget.panel"
- ],
- "Ext.Progress": [
- "widget.progress",
- "widget.progressbarwidget"
- ],
- "Ext.ProgressBase": [],
- "Ext.Promise": [],
- "Ext.SegmentedButton": [
- "widget.segmentedbutton"
- ],
- "Ext.Sheet": [
- "widget.sheet"
- ],
- "Ext.Spacer": [
- "widget.spacer"
- ],
- "Ext.SplitButton": [
- "widget.splitbutton"
- ],
- "Ext.TaskQueue": [],
- "Ext.Template": [],
- "Ext.Title": [
- "widget.title"
- ],
- "Ext.TitleBar": [
- "widget.titlebar"
- ],
- "Ext.Toast": [],
- "Ext.Tool": [
- "widget.paneltool",
- "widget.tool"
- ],
- "Ext.Toolbar": [
- "widget.toolbar"
- ],
- "Ext.Video": [
- "widget.video"
- ],
- "Ext.Widget": [
- "widget.widget"
- ],
- "Ext.XTemplate": [],
- "Ext.app.Application": [],
- "Ext.app.BaseController": [],
- "Ext.app.Controller": [],
- "Ext.app.EventBus": [],
- "Ext.app.EventDomain": [],
- "Ext.app.Profile": [],
- "Ext.app.Util": [],
- "Ext.app.ViewController": [
- "controller.controller"
- ],
- "Ext.app.ViewModel": [
- "viewmodel.default"
- ],
- "Ext.app.bind.AbstractStub": [],
- "Ext.app.bind.BaseBinding": [],
- "Ext.app.bind.Binding": [],
- "Ext.app.bind.Formula": [],
- "Ext.app.bind.LinkStub": [],
- "Ext.app.bind.Multi": [],
- "Ext.app.bind.Parser": [],
- "Ext.app.bind.RootStub": [],
- "Ext.app.bind.Stub": [],
- "Ext.app.bind.Template": [],
- "Ext.app.bind.TemplateBinding": [],
- "Ext.app.domain.Component": [],
- "Ext.app.domain.Controller": [],
- "Ext.app.domain.Direct": [],
- "Ext.app.domain.Global": [],
- "Ext.app.domain.Store": [],
- "Ext.app.domain.View": [],
- "Ext.behavior.Behavior": [],
- "Ext.carousel.Carousel": [
- "widget.carousel"
- ],
- "Ext.carousel.Infinite": [],
- "Ext.carousel.Item": [],
- "Ext.data.AbstractStore": [],
- "Ext.data.ArrayStore": [
- "store.array"
- ],
- "Ext.data.Batch": [],
- "Ext.data.BufferedStore": [
- "store.buffered"
- ],
- "Ext.data.ChainedStore": [
- "store.chained"
- ],
- "Ext.data.Connection": [],
- "Ext.data.DirectStore": [
- "store.direct"
- ],
- "Ext.data.Error": [],
- "Ext.data.ErrorCollection": [],
- "Ext.data.Group": [],
- "Ext.data.JsonP": [],
- "Ext.data.JsonPStore": [
- "store.jsonp"
- ],
- "Ext.data.JsonStore": [
- "store.json"
- ],
- "Ext.data.LocalStore": [],
- "Ext.data.Model": [],
- "Ext.data.ModelManager": [],
- "Ext.data.NodeInterface": [],
- "Ext.data.NodeStore": [
- "store.node"
- ],
- "Ext.data.PageMap": [],
- "Ext.data.ProxyStore": [],
- "Ext.data.Range": [],
- "Ext.data.Request": [],
- "Ext.data.ResultSet": [],
- "Ext.data.Session": [],
- "Ext.data.SortTypes": [],
- "Ext.data.Store": [
- "store.store"
- ],
- "Ext.data.StoreManager": [],
- "Ext.data.TreeModel": [],
- "Ext.data.TreeStore": [
- "store.tree"
- ],
- "Ext.data.Types": [],
- "Ext.data.Validation": [],
- "Ext.data.XmlStore": [
- "store.xml"
- ],
- "Ext.data.field.Boolean": [
- "data.field.bool",
- "data.field.boolean"
- ],
- "Ext.data.field.Date": [
- "data.field.date"
- ],
- "Ext.data.field.Field": [
- "data.field.auto"
- ],
- "Ext.data.field.Integer": [
- "data.field.int",
- "data.field.integer"
- ],
- "Ext.data.field.Number": [
- "data.field.float",
- "data.field.number"
- ],
- "Ext.data.field.String": [
- "data.field.string"
- ],
- "Ext.data.flash.BinaryXhr": [],
- "Ext.data.identifier.Generator": [
- "data.identifier.default"
- ],
- "Ext.data.identifier.Negative": [
- "data.identifier.negative"
- ],
- "Ext.data.identifier.Sequential": [
- "data.identifier.sequential"
- ],
- "Ext.data.identifier.Uuid": [
- "data.identifier.uuid"
- ],
- "Ext.data.matrix.Matrix": [],
- "Ext.data.matrix.Side": [],
- "Ext.data.matrix.Slice": [],
- "Ext.data.operation.Create": [
- "data.operation.create"
- ],
- "Ext.data.operation.Destroy": [
- "data.operation.destroy"
- ],
- "Ext.data.operation.Operation": [],
- "Ext.data.operation.Read": [
- "data.operation.read"
- ],
- "Ext.data.operation.Update": [
- "data.operation.update"
- ],
- "Ext.data.proxy.Ajax": [
- "proxy.ajax"
- ],
- "Ext.data.proxy.Client": [],
- "Ext.data.proxy.Direct": [
- "proxy.direct"
- ],
- "Ext.data.proxy.JsonP": [
- "proxy.jsonp",
- "proxy.scripttag"
- ],
- "Ext.data.proxy.LocalStorage": [
- "proxy.localstorage"
- ],
- "Ext.data.proxy.Memory": [
- "proxy.memory"
- ],
- "Ext.data.proxy.Proxy": [
- "proxy.proxy"
- ],
- "Ext.data.proxy.Rest": [
- "proxy.rest"
- ],
- "Ext.data.proxy.Server": [
- "proxy.server"
- ],
- "Ext.data.proxy.SessionStorage": [
- "proxy.sessionstorage"
- ],
- "Ext.data.proxy.WebStorage": [],
- "Ext.data.reader.Array": [
- "reader.array"
- ],
- "Ext.data.reader.Json": [
- "reader.json"
- ],
- "Ext.data.reader.Reader": [
- "reader.base"
- ],
- "Ext.data.reader.Xml": [
- "reader.xml"
- ],
- "Ext.data.request.Ajax": [
- "request.ajax"
- ],
- "Ext.data.request.Base": [],
- "Ext.data.request.Form": [
- "request.form"
- ],
- "Ext.data.schema.Association": [],
- "Ext.data.schema.ManyToMany": [],
- "Ext.data.schema.ManyToOne": [],
- "Ext.data.schema.Namer": [
- "namer.default"
- ],
- "Ext.data.schema.OneToOne": [],
- "Ext.data.schema.Role": [],
- "Ext.data.schema.Schema": [
- "schema.default"
- ],
- "Ext.data.session.BatchVisitor": [],
- "Ext.data.session.ChangesVisitor": [],
- "Ext.data.session.ChildChangesVisitor": [],
- "Ext.data.summary.Average": [
- "data.summary.average"
- ],
- "Ext.data.summary.Base": [
- "data.summary.base"
- ],
- "Ext.data.summary.Count": [
- "data.summary.count"
- ],
- "Ext.data.summary.Max": [
- "data.summary.max"
- ],
- "Ext.data.summary.Min": [
- "data.summary.min"
- ],
- "Ext.data.summary.Sum": [
- "data.summary.sum"
- ],
- "Ext.data.validator.AbstractDate": [],
- "Ext.data.validator.Bound": [
- "data.validator.bound"
- ],
- "Ext.data.validator.CIDRv4": [
- "data.validator.cidrv4"
- ],
- "Ext.data.validator.CIDRv6": [
- "data.validator.cidrv6"
- ],
- "Ext.data.validator.Currency": [
- "data.validator.currency"
- ],
- "Ext.data.validator.CurrencyUS": [
- "data.validator.currency-us"
- ],
- "Ext.data.validator.Date": [
- "data.validator.date"
- ],
- "Ext.data.validator.DateTime": [
- "data.validator.datetime"
- ],
- "Ext.data.validator.Email": [
- "data.validator.email"
- ],
- "Ext.data.validator.Exclusion": [
- "data.validator.exclusion"
- ],
- "Ext.data.validator.Format": [
- "data.validator.format"
- ],
- "Ext.data.validator.IPAddress": [
- "data.validator.ipaddress"
- ],
- "Ext.data.validator.Inclusion": [
- "data.validator.inclusion"
- ],
- "Ext.data.validator.Length": [
- "data.validator.length"
- ],
- "Ext.data.validator.List": [
- "data.validator.list"
- ],
- "Ext.data.validator.NotNull": [
- "data.validator.notnull"
- ],
- "Ext.data.validator.Number": [
- "data.validator.number"
- ],
- "Ext.data.validator.Phone": [
- "data.validator.phone"
- ],
- "Ext.data.validator.Presence": [
- "data.validator.presence"
- ],
- "Ext.data.validator.Range": [
- "data.validator.range"
- ],
- "Ext.data.validator.Time": [
- "data.validator.time"
- ],
- "Ext.data.validator.Url": [
- "data.validator.url"
- ],
- "Ext.data.validator.Validator": [
- "data.validator.base"
- ],
- "Ext.data.virtual.Group": [],
- "Ext.data.virtual.Page": [],
- "Ext.data.virtual.PageMap": [],
- "Ext.data.virtual.Range": [],
- "Ext.data.virtual.Store": [
- "store.virtual"
- ],
- "Ext.data.writer.Json": [
- "writer.json"
- ],
- "Ext.data.writer.Writer": [
- "writer.base"
- ],
- "Ext.data.writer.Xml": [
- "writer.xml"
- ],
- "Ext.dataview.Abstract": [],
- "Ext.dataview.BoundList": [
- "widget.boundlist"
- ],
- "Ext.dataview.BoundListLocation": [],
- "Ext.dataview.BoundListNavigationModel": [
- "navmodel.boundlist"
- ],
- "Ext.dataview.Component": [
- "widget.componentdataview"
- ],
- "Ext.dataview.DataItem": [
- "widget.dataitem"
- ],
- "Ext.dataview.DataView": [
- "widget.dataview"
- ],
- "Ext.dataview.Disclosable": [],
- "Ext.dataview.EmptyText": [
- "widget.emptytext"
- ],
- "Ext.dataview.GenericItem": [],
- "Ext.dataview.IndexBar": [
- "widget.indexbar"
- ],
- "Ext.dataview.ItemHeader": [
- "widget.itemheader"
- ],
- "Ext.dataview.List": [
- "widget.list"
- ],
- "Ext.dataview.ListItem": [
- "widget.listitem"
- ],
- "Ext.dataview.Location": [],
- "Ext.dataview.NavigationModel": [
- "navmodel.dataview"
- ],
- "Ext.dataview.NestedList": [
- "widget.nestedlist"
- ],
- "Ext.dataview.Pinnable": [],
- "Ext.dataview.SimpleListItem": [
- "widget.simplelistitem"
- ],
- "Ext.dataview.listswiper.Accordion": [
- "widget.listswiperaccordion"
- ],
- "Ext.dataview.listswiper.Item": [
- "widget.listswiperitem"
- ],
- "Ext.dataview.listswiper.ListSwiper": [
- "plugin.listswiper"
- ],
- "Ext.dataview.listswiper.Stepper": [
- "widget.listswiperstepper"
- ],
- "Ext.dataview.plugin.ItemTip": [
- "plugin.dataviewtip"
- ],
- "Ext.dataview.plugin.ListPaging": [
- "plugin.listpaging"
- ],
- "Ext.dataview.plugin.SortableList": [
- "plugin.sortablelist"
- ],
- "Ext.dataview.pullrefresh.Bar": [
- "widget.pullrefreshbar"
- ],
- "Ext.dataview.pullrefresh.Item": [],
- "Ext.dataview.pullrefresh.PullRefresh": [
- "plugin.pullrefresh"
- ],
- "Ext.dataview.pullrefresh.Spinner": [
- "widget.pullrefreshspinner"
- ],
- "Ext.dataview.selection.Model": [
- "selmodel.dataview"
- ],
- "Ext.dataview.selection.Records": [
- "selection.records"
- ],
- "Ext.dataview.selection.Rows": [
- "selection.rows"
- ],
- "Ext.dataview.selection.Selection": [],
- "Ext.direct.Event": [
- "direct.event"
- ],
- "Ext.direct.ExceptionEvent": [
- "direct.exception"
- ],
- "Ext.direct.JsonProvider": [
- "direct.jsonprovider"
- ],
- "Ext.direct.Manager": [],
- "Ext.direct.PollingProvider": [
- "direct.pollingprovider"
- ],
- "Ext.direct.Provider": [
- "direct.provider"
- ],
- "Ext.direct.RemotingEvent": [
- "direct.rpc"
- ],
- "Ext.direct.RemotingMethod": [],
- "Ext.direct.RemotingProvider": [
- "direct.remotingprovider"
- ],
- "Ext.direct.Transaction": [
- "direct.transaction"
- ],
- "Ext.dom.CompositeElement": [],
- "Ext.dom.CompositeElementLite": [],
- "Ext.dom.Element": [],
- "Ext.dom.ElementEvent": [],
- "Ext.dom.Fly": [],
- "Ext.dom.GarbageCollector": [],
- "Ext.dom.Helper": [],
- "Ext.dom.Query": [],
- "Ext.dom.Shadow": [],
- "Ext.dom.Shim": [],
- "Ext.dom.TouchAction": [],
- "Ext.dom.Underlay": [],
- "Ext.dom.UnderlayPool": [],
- "Ext.drag.Constraint": [
- "drag.constraint.base"
- ],
- "Ext.drag.Info": [],
- "Ext.drag.Item": [],
- "Ext.drag.Manager": [],
- "Ext.drag.Source": [],
- "Ext.drag.Target": [],
- "Ext.drag.proxy.None": [
- "drag.proxy.none"
- ],
- "Ext.drag.proxy.Original": [
- "drag.proxy.original"
- ],
- "Ext.drag.proxy.Placeholder": [
- "drag.proxy.placeholder"
- ],
- "Ext.event.Event": [],
- "Ext.event.gesture.DoubleTap": [],
- "Ext.event.gesture.Drag": [],
- "Ext.event.gesture.EdgeSwipe": [],
- "Ext.event.gesture.LongPress": [],
- "Ext.event.gesture.MultiTouch": [],
- "Ext.event.gesture.Pinch": [],
- "Ext.event.gesture.Recognizer": [],
- "Ext.event.gesture.Rotate": [],
- "Ext.event.gesture.SingleTouch": [],
- "Ext.event.gesture.Swipe": [],
- "Ext.event.gesture.Tap": [],
- "Ext.event.publisher.Dom": [],
- "Ext.event.publisher.ElementPaint": [],
- "Ext.event.publisher.ElementSize": [],
- "Ext.event.publisher.Focus": [],
- "Ext.event.publisher.Gesture": [],
- "Ext.event.publisher.Publisher": [],
- "Ext.field.BoxLabelable": [],
- "Ext.field.Checkbox": [
- "widget.checkbox",
- "widget.checkboxfield"
- ],
- "Ext.field.ComboBox": [
- "widget.combobox",
- "widget.comboboxfield"
- ],
- "Ext.field.Container": [
- "widget.containerfield",
- "widget.fieldcontainer"
- ],
- "Ext.field.Date": [
- "widget.datefield",
- "widget.datepickerfield"
- ],
- "Ext.field.DatePickerNative": [
- "widget.datepickernativefield"
- ],
- "Ext.field.Display": [
- "widget.displayfield"
- ],
- "Ext.field.Email": [
- "widget.emailfield"
- ],
- "Ext.field.Field": [
- "widget.field"
- ],
- "Ext.field.File": [
- "widget.filefield"
- ],
- "Ext.field.FileButton": [
- "widget.filebutton"
- ],
- "Ext.field.Hidden": [
- "widget.hiddenfield"
- ],
- "Ext.field.Input": [
- "widget.inputfield"
- ],
- "Ext.field.InputMask": [],
- "Ext.field.Manager": [],
- "Ext.field.Number": [
- "widget.numberfield"
- ],
- "Ext.field.Panel": [
- "widget.fieldpanel"
- ],
- "Ext.field.Password": [
- "widget.passwordfield"
- ],
- "Ext.field.Picker": [
- "widget.pickerfield"
- ],
- "Ext.field.Radio": [
- "widget.radio",
- "widget.radiofield"
- ],
- "Ext.field.Search": [
- "widget.searchfield"
- ],
- "Ext.field.Select": [
- "widget.selectfield"
- ],
- "Ext.field.SingleSlider": [
- "widget.singlesliderfield"
- ],
- "Ext.field.Slider": [
- "widget.sliderfield"
- ],
- "Ext.field.Spinner": [
- "widget.spinnerfield"
- ],
- "Ext.field.Text": [
- "widget.textfield"
- ],
- "Ext.field.TextArea": [
- "widget.textareafield"
- ],
- "Ext.field.Time": [
- "widget.timefield"
- ],
- "Ext.field.Toggle": [
- "widget.togglefield"
- ],
- "Ext.field.Url": [
- "widget.urlfield"
- ],
- "Ext.field.trigger.Base": [
- "trigger.base"
- ],
- "Ext.field.trigger.Clear": [
- "trigger.clear",
- "widget.cleartrigger"
- ],
- "Ext.field.trigger.Component": [
- "trigger.component"
- ],
- "Ext.field.trigger.Date": [
- "trigger.date",
- "widget.datetrigger"
- ],
- "Ext.field.trigger.Expand": [
- "trigger.expand",
- "widget.expandtrigger"
- ],
- "Ext.field.trigger.File": [
- "trigger.file"
- ],
- "Ext.field.trigger.Menu": [
- "trigger.menu",
- "widget.menutrigger"
- ],
- "Ext.field.trigger.Reveal": [
- "trigger.reveal",
- "widget.revealtrigger"
- ],
- "Ext.field.trigger.Search": [
- "trigger.search",
- "widget.searchtrigger"
- ],
- "Ext.field.trigger.SpinDown": [
- "trigger.spindown",
- "widget.spindowntrigger"
- ],
- "Ext.field.trigger.SpinUp": [
- "trigger.spinup",
- "widget.spinuptrigger"
- ],
- "Ext.field.trigger.Time": [
- "trigger.time",
- "widget.timetrigger"
- ],
- "Ext.field.trigger.Trigger": [
- "trigger.trigger",
- "widget.trigger"
- ],
- "Ext.form.Borders": [],
- "Ext.form.FieldSet": [
- "widget.fieldset"
- ],
- "Ext.form.Panel": [
- "widget.formpanel"
- ],
- "Ext.fx.Animation": [],
- "Ext.fx.Runner": [],
- "Ext.fx.State": [],
- "Ext.fx.animation.Abstract": [],
- "Ext.fx.animation.Cube": [
- "animation.cube"
- ],
- "Ext.fx.animation.Fade": [
- "animation.fade",
- "animation.fadeIn"
- ],
- "Ext.fx.animation.FadeOut": [
- "animation.fadeOut"
- ],
- "Ext.fx.animation.Flip": [
- "animation.flip"
- ],
- "Ext.fx.animation.Pop": [
- "animation.pop",
- "animation.popIn"
- ],
- "Ext.fx.animation.PopOut": [
- "animation.popOut"
- ],
- "Ext.fx.animation.Slide": [
- "animation.slide",
- "animation.slideIn"
- ],
- "Ext.fx.animation.SlideOut": [
- "animation.slideOut"
- ],
- "Ext.fx.animation.Wipe": [],
- "Ext.fx.animation.WipeOut": [],
- "Ext.fx.easing.Abstract": [],
- "Ext.fx.easing.Bounce": [],
- "Ext.fx.easing.BoundMomentum": [],
- "Ext.fx.easing.EaseIn": [
- "easing.ease-in"
- ],
- "Ext.fx.easing.EaseOut": [
- "easing.ease-out"
- ],
- "Ext.fx.easing.Easing": [],
- "Ext.fx.easing.Linear": [
- "easing.linear"
- ],
- "Ext.fx.easing.Momentum": [],
- "Ext.fx.runner.Css": [],
- "Ext.fx.runner.CssAnimation": [],
- "Ext.fx.runner.CssTransition": [],
- "Ext.grid.CellEditor": [
- "widget.celleditor"
- ],
- "Ext.grid.Grid": [
- "widget.grid"
- ],
- "Ext.grid.HeaderContainer": [
- "widget.headercontainer"
- ],
- "Ext.grid.Location": [],
- "Ext.grid.NavigationModel": [
- "navmodel.grid"
- ],
- "Ext.grid.PagingToolbar": [
- "widget.pagingtoolbar"
- ],
- "Ext.grid.Row": [
- "widget.gridrow"
- ],
- "Ext.grid.RowBody": [
- "widget.rowbody"
- ],
- "Ext.grid.RowHeader": [
- "widget.rowheader"
- ],
- "Ext.grid.SummaryRow": [
- "widget.gridsummaryrow"
- ],
- "Ext.grid.Tree": [
- "widget.tree"
- ],
- "Ext.grid.cell.Base": [
- "widget.gridcellbase"
- ],
- "Ext.grid.cell.Boolean": [
- "widget.booleancell"
- ],
- "Ext.grid.cell.Cell": [
- "widget.gridcell"
- ],
- "Ext.grid.cell.Check": [
- "widget.checkcell"
- ],
- "Ext.grid.cell.Date": [
- "widget.datecell"
- ],
- "Ext.grid.cell.Expander": [
- "widget.expandercell"
- ],
- "Ext.grid.cell.Number": [
- "widget.numbercell"
- ],
- "Ext.grid.cell.RowNumberer": [
- "widget.rownumberercell"
- ],
- "Ext.grid.cell.Text": [
- "widget.textcell"
- ],
- "Ext.grid.cell.Tree": [
- "widget.treecell"
- ],
- "Ext.grid.cell.Widget": [
- "widget.widgetcell"
- ],
- "Ext.grid.column.Boolean": [
- "widget.booleancolumn"
- ],
- "Ext.grid.column.Check": [
- "widget.checkcolumn"
- ],
- "Ext.grid.column.Column": [
- "widget.column",
- "widget.gridcolumn",
- "widget.templatecolumn"
- ],
- "Ext.grid.column.Date": [
- "widget.datecolumn"
- ],
- "Ext.grid.column.Number": [
- "widget.numbercolumn"
- ],
- "Ext.grid.column.RowNumberer": [
- "widget.rownumberer"
- ],
- "Ext.grid.column.Selection": [
- "widget.selectioncolumn"
- ],
- "Ext.grid.column.Text": [
- "widget.textcolumn"
- ],
- "Ext.grid.column.Tree": [
- "widget.treecolumn"
- ],
- "Ext.grid.menu.Columns": [
- "widget.gridcolumnsmenu"
- ],
- "Ext.grid.menu.GroupByThis": [
- "widget.gridgroupbythismenuitem"
- ],
- "Ext.grid.menu.ShowInGroups": [
- "widget.gridshowingroupsmenuitem"
- ],
- "Ext.grid.menu.SortAsc": [
- "widget.gridsortascmenuitem"
- ],
- "Ext.grid.menu.SortDesc": [
- "widget.gridsortdescmenuitem"
- ],
- "Ext.grid.plugin.CellEditing": [
- "plugin.cellediting",
- "plugin.gridcellediting"
- ],
- "Ext.grid.plugin.Clipboard": [
- "plugin.clipboard"
- ],
- "Ext.grid.plugin.ColumnResizing": [
- "plugin.columnresizing",
- "plugin.gridcolumnresizing"
- ],
- "Ext.grid.plugin.Editable": [
- "plugin.grideditable"
- ],
- "Ext.grid.plugin.PagingToolbar": [
- "plugin.gridpagingtoolbar",
- "plugin.pagingtoolbar"
- ],
- "Ext.grid.plugin.RowExpander": [
- "plugin.rowexpander"
- ],
- "Ext.grid.plugin.RowOperations": [
- "plugin.gridmultiselection",
- "plugin.multiselection",
- "plugin.rowoperations"
- ],
- "Ext.grid.plugin.Summary": [
- "plugin.gridsummary",
- "plugin.gridsummaryrow",
- "plugin.summaryrow"
- ],
- "Ext.grid.plugin.ViewOptions": [
- "plugin.gridviewoptions"
- ],
- "Ext.grid.plugin.ViewOptionsListItem": [
- "widget.viewoptionslistitem"
- ],
- "Ext.grid.selection.Cells": [
- "selection.cells"
- ],
- "Ext.grid.selection.Columns": [
- "selection.columns"
- ],
- "Ext.grid.selection.Model": [
- "selmodel.grid"
- ],
- "Ext.grid.selection.Replicator": [
- "plugin.selectionreplicator"
- ],
- "Ext.grid.selection.SelectionExtender": [],
- "Ext.layout.Auto": [
- "layout.auto",
- "layout.default"
- ],
- "Ext.layout.Box": [
- "layout.box"
- ],
- "Ext.layout.Card": [
- "layout.card"
- ],
- "Ext.layout.Carousel": [
- "layout.carousel"
- ],
- "Ext.layout.Center": [
- "layout.center"
- ],
- "Ext.layout.Fit": [
- "layout.fit"
- ],
- "Ext.layout.Float": [
- "layout.float"
- ],
- "Ext.layout.Form": [
- "layout.form"
- ],
- "Ext.layout.HBox": [
- "layout.hbox"
- ],
- "Ext.layout.VBox": [
- "layout.vbox"
- ],
- "Ext.layout.card.fx.Abstract": [
- "layout.card.fx.abstract"
- ],
- "Ext.layout.card.fx.Cover": [
- "layout.card.fx.cover"
- ],
- "Ext.layout.card.fx.Cube": [
- "layout.card.fx.cube"
- ],
- "Ext.layout.card.fx.Fade": [
- "layout.card.fx.fade"
- ],
- "Ext.layout.card.fx.Flip": [
- "layout.card.fx.flip"
- ],
- "Ext.layout.card.fx.Pop": [
- "layout.card.fx.pop"
- ],
- "Ext.layout.card.fx.Reveal": [
- "layout.card.fx.reveal"
- ],
- "Ext.layout.card.fx.Scroll": [
- "layout.card.fx.scroll"
- ],
- "Ext.layout.card.fx.ScrollCover": [
- "layout.card.fx.scrollcover"
- ],
- "Ext.layout.card.fx.ScrollReveal": [
- "layout.card.fx.scrollreveal"
- ],
- "Ext.layout.card.fx.Serial": [],
- "Ext.layout.card.fx.Slide": [
- "layout.card.fx.slide"
- ],
- "Ext.layout.card.fx.Style": [],
- "Ext.layout.overflow.Scroller": [
- "layout.overflow.scroller"
- ],
- "Ext.layout.wrapper.BoxDock": [],
- "Ext.layout.wrapper.Inner": [],
- "Ext.list.AbstractTreeItem": [],
- "Ext.list.Location": [],
- "Ext.list.RootTreeItem": [],
- "Ext.list.Tree": [
- "widget.treelist"
- ],
- "Ext.list.TreeItem": [
- "widget.treelistitem"
- ],
- "Ext.menu.CheckItem": [
- "widget.menucheckitem"
- ],
- "Ext.menu.Item": [
- "widget.menuitem"
- ],
- "Ext.menu.Manager": [],
- "Ext.menu.Menu": [
- "widget.menu"
- ],
- "Ext.menu.RadioItem": [
- "widget.menuradioitem"
- ],
- "Ext.menu.Separator": [
- "widget.menuseparator"
- ],
- "Ext.mixin.Accessible": [],
- "Ext.mixin.Bindable": [],
- "Ext.mixin.Bufferable": [],
- "Ext.mixin.ComponentDelegation": [],
- "Ext.mixin.ConfigProxy": [],
- "Ext.mixin.ConfigState": [],
- "Ext.mixin.Container": [],
- "Ext.mixin.Dirty": [],
- "Ext.mixin.Factoryable": [],
- "Ext.mixin.Focusable": [],
- "Ext.mixin.FocusableContainer": [],
- "Ext.mixin.Hookable": [],
- "Ext.mixin.Inheritable": [],
- "Ext.mixin.ItemRippler": [],
- "Ext.mixin.Keyboard": [],
- "Ext.mixin.Mashup": [],
- "Ext.mixin.Pluggable": [],
- "Ext.mixin.Progressable": [],
- "Ext.mixin.Queryable": [],
- "Ext.mixin.Responsive": [],
- "Ext.mixin.Selectable": [],
- "Ext.mixin.StoreWatcher": [],
- "Ext.mixin.StyleCacher": [],
- "Ext.mixin.Templatable": [],
- "Ext.mixin.Toolable": [],
- "Ext.mixin.Traversable": [],
- "Ext.navigation.Bar": [],
- "Ext.navigation.View": [
- "widget.navigationview"
- ],
- "Ext.override.sparkline.Base": [],
- "Ext.overrides.Progress": [],
- "Ext.overrides.Widget": [],
- "Ext.overrides.app.Application": [],
- "Ext.overrides.dom.Element": [],
- "Ext.overrides.drag.proxy.Placeholder": [],
- "Ext.overrides.list.Tree": [],
- "Ext.overrides.list.TreeItem": [],
- "Ext.panel.Collapser": [],
- "Ext.panel.Collapsible": [],
- "Ext.panel.Date": [
- "widget.datepanel"
- ],
- "Ext.panel.DateTitle": [
- "widget.datetitle"
- ],
- "Ext.panel.DateView": [
- "widget.dateview"
- ],
- "Ext.panel.Header": [
- "widget.panelheader"
- ],
- "Ext.panel.Resizable": [],
- "Ext.panel.Resizer": [],
- "Ext.panel.Time": [
- "widget.timepanel"
- ],
- "Ext.panel.TimeHeader": [
- "widget.analogtimeheader"
- ],
- "Ext.panel.TimeView": [
- "widget.analogtime"
- ],
- "Ext.panel.Title": [
- "widget.paneltitle"
- ],
- "Ext.panel.YearPicker": [
- "widget.yearpicker"
- ],
- "Ext.parse.Parser": [],
- "Ext.parse.Symbol": [],
- "Ext.parse.Tokenizer": [],
- "Ext.parse.symbol.Constant": [],
- "Ext.parse.symbol.Infix": [],
- "Ext.parse.symbol.InfixRight": [],
- "Ext.parse.symbol.Paren": [],
- "Ext.parse.symbol.Prefix": [],
- "Ext.perf.Accumulator": [],
- "Ext.perf.Monitor": [],
- "Ext.picker.Date": [
- "widget.datepicker"
- ],
- "Ext.picker.Picker": [
- "widget.picker"
- ],
- "Ext.picker.Slot": [
- "widget.pickerslot"
- ],
- "Ext.picker.Tablet": [
- "widget.tabletpicker"
- ],
- "Ext.plugin.Abstract": [],
- "Ext.plugin.AbstractClipboard": [],
- "Ext.plugin.MouseEnter": [
- "plugin.mouseenter"
- ],
- "Ext.plugin.Responsive": [
- "plugin.responsive"
- ],
- "Ext.plugin.TabGuard": [
- "plugin.tabguard"
- ],
- "Ext.promise.Consequence": [],
- "Ext.promise.Deferred": [],
- "Ext.promise.Promise": [],
- "Ext.route.Action": [],
- "Ext.route.Handler": [],
- "Ext.route.Mixin": [],
- "Ext.route.Route": [],
- "Ext.route.Router": [],
- "Ext.scroll.Scroller": [
- "scroller.scroller"
- ],
- "Ext.slider.Slider": [
- "widget.slider"
- ],
- "Ext.slider.Thumb": [
- "widget.thumb"
- ],
- "Ext.slider.Toggle": [
- "widget.toggleslider"
- ],
- "Ext.sparkline.Bar": [
- "widget.sparklinebar"
- ],
- "Ext.sparkline.BarBase": [],
- "Ext.sparkline.Base": [
- "widget.sparkline"
- ],
- "Ext.sparkline.Box": [
- "widget.sparklinebox"
- ],
- "Ext.sparkline.Bullet": [
- "widget.sparklinebullet"
- ],
- "Ext.sparkline.CanvasBase": [],
- "Ext.sparkline.CanvasCanvas": [],
- "Ext.sparkline.Discrete": [
- "widget.sparklinediscrete"
- ],
- "Ext.sparkline.Line": [
- "widget.sparklineline"
- ],
- "Ext.sparkline.Pie": [
- "widget.sparklinepie"
- ],
- "Ext.sparkline.RangeMap": [],
- "Ext.sparkline.Shape": [],
- "Ext.sparkline.TriState": [
- "widget.sparklinetristate"
- ],
- "Ext.sparkline.VmlCanvas": [],
- "Ext.tab.Bar": [
- "widget.tabbar"
- ],
- "Ext.tab.Panel": [
- "widget.tabpanel"
- ],
- "Ext.tab.Tab": [
- "widget.tab"
- ],
- "Ext.tip.Manager": [],
- "Ext.tip.ToolTip": [
- "widget.tooltip"
- ],
- "Ext.util.AbstractMixedCollection": [],
- "Ext.util.Audio": [],
- "Ext.util.Bag": [],
- "Ext.util.Base64": [],
- "Ext.util.BufferedCollection": [],
- "Ext.util.CSS": [],
- "Ext.util.CSV": [],
- "Ext.util.ClickRepeater": [],
- "Ext.util.Collection": [],
- "Ext.util.CollectionKey": [],
- "Ext.util.Color": [],
- "Ext.util.Cookies": [],
- "Ext.util.DelimitedValue": [],
- "Ext.util.Draggable": [],
- "Ext.util.Filter": [],
- "Ext.util.FilterCollection": [],
- "Ext.util.Fly": [],
- "Ext.util.Format": [],
- "Ext.util.Geolocation": [],
- "Ext.util.Group": [],
- "Ext.util.GroupCollection": [],
- "Ext.util.Grouper": [],
- "Ext.util.HashMap": [],
- "Ext.util.History": [],
- "Ext.util.Inflector": [],
- "Ext.util.InputBlocker": [],
- "Ext.util.ItemCollection": [],
- "Ext.util.KeyMap": [],
- "Ext.util.KeyNav": [],
- "Ext.util.LineSegment": [],
- "Ext.util.LocalStorage": [],
- "Ext.util.LruCache": [],
- "Ext.util.MixedCollection": [],
- "Ext.util.ObjectTemplate": [],
- "Ext.util.Observable": [],
- "Ext.util.Offset": [],
- "Ext.util.PaintMonitor": [],
- "Ext.util.Point": [],
- "Ext.util.PositionMap": [],
- "Ext.util.Positionable": [],
- "Ext.util.Region": [],
- "Ext.util.Schedulable": [],
- "Ext.util.Scheduler": [],
- "Ext.util.SizeMonitor": [],
- "Ext.util.Sortable": [],
- "Ext.util.Sorter": [],
- "Ext.util.SorterCollection": [],
- "Ext.util.Spans": [],
- "Ext.util.TextMetrics": [],
- "Ext.util.TranslatableGroup": [],
- "Ext.util.TranslatableList": [],
- "Ext.util.TsvDecoder": [],
- "Ext.util.Wrapper": [],
- "Ext.util.XTemplateCompiler": [],
- "Ext.util.XTemplateParser": [],
- "Ext.util.paintmonitor.Abstract": [],
- "Ext.util.paintmonitor.CssAnimation": [],
- "Ext.util.paintmonitor.OverflowChange": [],
- "Ext.util.sizemonitor.Abstract": [],
- "Ext.util.sizemonitor.OverflowChange": [],
- "Ext.util.sizemonitor.Scroll": [],
- "Ext.util.translatable.Abstract": [],
- "Ext.util.translatable.Component": [
- "translatable.component"
- ],
- "Ext.util.translatable.CssPosition": [
- "translatable.cssposition"
- ],
- "Ext.util.translatable.CssTransform": [
- "translatable.csstransform"
- ],
- "Ext.util.translatable.Dom": [
- "translatable.dom"
- ],
- "Ext.util.translatable.ScrollParent": [
- "translatable.scrollparent"
- ],
- "Ext.util.translatable.ScrollPosition": [
- "translatable.scrollposition"
- ],
- "Ext.viewport.Android": [],
- "Ext.viewport.Default": [
- "widget.viewport"
- ],
- "Ext.viewport.Ios": [],
- "Ext.viewport.Viewport": [],
- "Ext.viewport.WindowsPhone": []
- });
|