12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613 |
- /*
- This file is part of Ext JS 7.0.0.168
- Copyright (c) 2011-2020 Sencha Inc
- Contact: http://www.sencha.com/contact
- GNU General Public License Usage
- This file may be used under the terms of the GNU General Public License version 3.0 as
- published by the Free Software Foundation and appearing in the file LICENSE included in the
- packaging of this file.
- Please review the following information to ensure the GNU General Public License version 3.0
- requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- If you are unsure which license is appropriate for your use, please contact the sales department
- at http://www.sencha.com/contact.
- Version: 7.0.0.168 Build date: 2020-01-14 07:07:49 (513838d69a96c96beec9d0851e67aa660b7f288d)
- */
- // @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 = navigator.appVersion.indexOf('MSIE 10') !== -1;
- 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 || {},
- iterableRe = /\[object\s*(?:Array|Arguments|\w*Collection|\w*List|HTML\s+document\.all\s+class)\]/,
- MSDateRe = /^\\?\/Date\(([-+])?(\d+)(?:[+-]\d{4})?\)\\?\/$/,
-
- elevateArgs, elevateFn, elevateRet, elevateScope, i;
- 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) {
- var i, j, k;
- if (object) {
- if (defaults) {
- Ext.apply(object, defaults);
- }
- if (config && typeof config === 'object') {
- 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) {
- var property;
- if (object && config && typeof config === 'object') {
- for (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],
- timer = timers && timers[id];
- if (timer) {
- timer.cancelled = true;
- timers[id] = null;
- 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;
- Ext.Timer.all[this.kind][this.id] = null;
- 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];
- }
- return value;
- }
- });
- 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) {
- var error = new Error();
- if (Ext.isString(config)) {
- config = {
- msg: config
- };
- }
- Ext.apply(error, config);
- error.message = error.message || error.msg;
-
-
- error.toString = toString;
- return error;
- };
- Ext.apply(Ext.Error, {
-
- ignore: false,
-
- raise: function(err) {
- var me = this,
- method = me.raise.caller,
- msg, name;
- err = err || {};
- if (Ext.isString(err)) {
- err = {
- msg: err
- };
- }
- 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) {
- var i, ln;
- array = ExtArray.from(array);
- 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 (0 <= index && index < len) {
- beforeCheck = index > 0 ? comparatorFn(item, items[index - 1]) : 0;
- afterCheck = (index < len) ? comparatorFn(item, items[index]) : 0;
- if (0 <= beforeCheck && 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) {
- var i, ln;
- for (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) {
- var array = [],
- i;
- if (!iterable || !iterable.length) {
- return array;
- }
- if (typeof iterable === 'string') {
- iterable = iterable.split('');
- }
- if (supportsSliceOnNodeList) {
- return slice.call(iterable, start || 0, end || iterable.length);
- }
- 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) {
- var i, ln;
-
- Ext.Assert.isFunction(fn, 'Ext.Array.every must have a callback function passed as second argument.');
-
- for (i = 0 , ln = array.length; 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) {
- var i, ln;
-
- Ext.Assert.isFunction(fn, 'Ext.Array.some must have a callback function passed as second argument.');
-
- for (i = 0 , ln = array.length; 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, ln, item;
- for (i = 0 , ln = array.length; i < ln; i++) {
- item = array[i];
- if (!Ext.isEmpty(item)) {
- results.push(item);
- }
- }
- return results;
- },
-
- unique: function(array) {
- var clone = [],
- i, ln, item;
- for (i = 0 , ln = array.length; 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) {
- var results = [],
- i, ln;
-
- Ext.Assert.isFunction(fn, 'Ext.Array.filter must have a filter function passed as second argument.');
-
- for (i = 0 , ln = array.length; i < ln; i++) {
- if (fn.call(scope, array[i], i, array)) {
- results.push(array[i]);
- }
- }
- return results;
- },
-
- findBy: function(array, fn, scope) {
- var i, len;
- for (i = 0 , len = array.length; i < len; i++) {
- if (fn.call(scope || array, array[i], i)) {
- return array[i];
- }
- }
- return null;
- },
-
- from: function(value, newReference) {
- var type;
- if (value === undefined || value === null) {
- return [];
- }
- if (Ext.isArray(value)) {
- return (newReference) ? slice.call(value) : value;
- }
- 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) {
- var map, i;
- if (!strings) {
- return null;
- }
- 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) {
- var b;
- Ext.Assert.truthy(object);
- 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) {
- var b;
- Ext.Assert.truthy(object);
- 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() {
- var name, kind;
- 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 (name in Ext) {
- if (name.substring(0, 2) === "is" && Ext.isFunction(Ext[name])) {
- 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) {
- var len;
- if (!s) {
- return value;
- }
- if (!value) {
- return s;
- }
- 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) {
- var vs, index;
- if (value && value.length > length) {
- if (word) {
- 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) {
- var buf = [],
- i;
- if (count < 1) {
- count = 0;
- }
- for (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})?\\)\\/'),
- datePartsRe = /^(?:(\d{1,4})|(\w{3,}))[/\-.\\\s](?:(\d{1,2})|(\w{3,}))[/\-.\\\s](\d{1,4})$/,
- pad = Ext.String.leftPad,
- dayInfo = {
- d: true,
- j: true
- },
- 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 = [],
- l = c.length,
- i, 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) {
- var dt;
-
- hour = hour || 0;
- minute = minute || 0;
- second = second || 0;
- millisecond = millisecond || 0;
-
-
- 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;
- if (!format) {
- return utilDate.flexParse(input);
- }
- 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() {
- var a = [],
- i;
-
- for (i = 0; i < 7; i++) {
- a.push(utilDate.getShortDayName(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() {
- var a = [],
- i;
-
- for (i = 0; i < 12; i++) {
- a.push(utilDate.getShortMonthName(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+)"
- }
- },
-
-
- compare: function(d1, d2, includeTime) {
- var s1, s2;
- if (typeof d1 === 'string') {
- d1 = Ext.Date.parse(d1);
- }
- if (typeof d2 === 'string') {
- d2 = Ext.Date.parse(d2);
- }
- s1 = Ext.Date.format(d1, 'C');
- s2 = Ext.Date.format(d2, 'C');
- if (!includeTime) {
- s1 = s1.substr(0, 10);
-
- s2 = s2.substr(0, 10);
- }
- return (s1 < s2) ? -1 : ((s2 < s1) ? 1 : 0);
- },
-
-
- dateFormat: function(date, format) {
- return utilDate.format(date, format);
- },
-
- isEqual: function(date1, date2) {
-
- if (date1 && date2) {
- return +date1 === +date2;
- }
-
- 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) {
- var d, hr, c;
-
- if (isNaN(date.getTime())) {
- return date;
- }
- if (clone) {
- return utilDate.clearTime(utilDate.clone(date));
- }
-
- d = date.getDate();
-
- 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 === false) {
- d.setTime(d.getTime() + value * 24 * 60 * 60 * 1000);
- } else {
- d.setDate(d.getDate() + value);
- };
- 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 diff = +max - min,
- est;
- 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;
- }
- },
- flexParse: function(inDate, defaultFormat) {
- var parts = datePartsRe.exec(inDate),
- firstFormatToken, day, month, year, result;
-
- if (!parts) {
- return Ext.Date.parse(inDate, 'C');
- }
-
-
- if (!defaultFormat) {
- defaultFormat = Ext.Date.defaultFormat;
- }
-
-
-
-
-
-
-
-
-
-
-
-
- if (!(parts[2] || parts[4])) {
- firstFormatToken = defaultFormat[0];
-
-
-
- if (!yearInfo[firstFormatToken] && (dayInfo[firstFormatToken] || (parts[1] > 12 && parts[3] < 13))) {
- day = parseInt(parts[1]);
- month = parseInt(parts[3]) - 1;
- year = parseInt(parts[5]);
- } else if (!yearInfo[firstFormatToken] && (monthInfo[firstFormatToken] || (parts[3] > 12 && parts[1] < 13))) {
-
-
- month = parseInt(parts[1]) - 1;
- day = parseInt(parts[3]);
- year = parseInt(parts[5]);
- } else {
-
- year = parseInt(parts[1]);
- month = parseInt(parts[3]) - 1;
- day = parseInt(parts[5]);
- }
- } else {
-
-
- if (parts[2] && parts[4]) {
- return null;
- }
-
- if (parts[2]) {
- month = utilDate.monthNumbers[Ext.String.capitalize(parts[2].substr(0, 3))];
- day = parseInt(parts[3]);
- year = parseInt(parts[5]);
- } else {
-
- day = parseInt(parts[1]);
- month = utilDate.monthNumbers[Ext.String.capitalize(parts[4].substr(0, 3))];
- year = parseInt(parts[5]);
- }
- }
-
- if (isNaN(month) || (month < 0 || month > 11)) {
- return null;
- }
-
- if (year < utilDate.y2kYear) {
- year += 2000;
- }
-
- result = new Date(year, month, 1, 0, 0, 0);
-
- if (day < 1 || day > Ext.Date.getDaysInMonth(result)) {
- return null;
- }
- result.setDate(day);
- return result;
- }
- };
- 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) {
- var middle, midVal;
- if (begin === undefined) {
- begin = 0;
- }
- if (end === undefined) {
- end = array.length;
- }
- --end;
- 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) {
- var middle, midVal;
- if (begin === undefined) {
- begin = 0;
- }
- if (end === undefined) {
- end = array.length;
- }
- --end;
- 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) {
- var defaultValue = 0,
-
- wrap, begin, end, i;
- options = options || ClipDefault;
- wrap = options.wrap;
- 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) {
- var pow;
- precision = precision || 0;
- 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;
-
-
-
-
- ExtObject = Ext.Object = {
-
- chain: Object.create || function(object) {
- var result;
- TemplateClass.prototype = object;
- result = new TemplateClass();
- TemplateClass.prototype = null;
- return result;
- },
-
- clear: function(object) {
- var key;
-
- for (key in object) {
- delete object[key];
- }
- return object;
- },
-
- freeze: Object.freeze ? function(obj, deep) {
- var name;
- if (obj && typeof obj === 'object' && !Object.isFrozen(obj)) {
- Object.freeze(obj);
- if (deep) {
- for (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) {
- var property;
- for (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) {
- var key;
- for (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, key, value;
- objectClass = function() {
- var property, i, ln;
- for (i = 0 , ln = objectProperties.length; i < ln; i++) {
- property = objectProperties[i];
- this[property] = new propertyClassesMap[property]();
- }
- };
- 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
- },
-
-
- up: {
- isUp: 1
- },
-
-
- self: {
- isSelf: 1
- },
- 'self.controller': {
- isSelf: 1,
- isController: 1
- }
- },
- scrollbar: {
- _size: null,
-
- size: function(force) {
- var scrollbar = Ext.scrollbar,
- size = scrollbar._size;
-
- if (!Ext.isDomReady) {
- Ext.raise("Ext.scrollbar.size() called before DomReady");
- }
-
- if (force || !size) {
-
- 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);
-
-
- scrollbar._size = size = {
- width: w = div.offsetWidth - div.clientWidth,
- height: h = div.offsetHeight - div.clientHeight
- };
- size.reservedWidth = w ? 'calc(100% - ' + w + 'px)' : '';
- size.reservedHeight = h ? 'calc(100% - ' + h + 'px)' : '';
- db.removeChild(div);
- }
- return size;
- },
- height: function(force) {
- return Ext.scrollbar.size(force).height;
- },
- width: function(force) {
- return Ext.scrollbar.size(force).width;
- }
- },
- 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);
- };
- }()),
- lookUpFn: function(from, fn) {
-
- if (!from || !Ext.isFunction(from.up)) {
- Ext.raise('Callback "up" syntax requires a caller with "up" method');
- }
-
-
- var controller, scope;
- for (scope = from.up(); scope && !scope[fn]; scope = scope.up()) {
- controller = scope.controller;
- if (controller && controller[fn]) {
- scope = controller;
- break;
- }
- }
-
- if (!scope || !Ext.isFunction(scope[fn])) {
- Ext.raise('No such method "' + fn + '" found up() from ' + (from.getId ? from.getId() : from.id));
- }
-
- return scope;
- },
-
- callback: function(callback, scope, args, delay, caller, defaultScope) {
- if (!callback) {
- return;
- }
-
- var namedScope = (scope in Ext._namedScopes),
- ret;
- 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');
- }
-
- scope = Ext.lookUpFn(caller, callback = callback.substr(3));
- } else if (caller) {
- if (namedScope && namedScope.isUp) {
- scope = Ext.lookUpFn(caller, callback);
- } else if (!scope || namedScope) {
- 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;
- }
- 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) {
- var name, i, n;
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (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) {
- var name, i, n;
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (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) {
- var name, i, n;
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (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) {
- var name, i, n;
- if (typeof names === 'string') {
- names = names.split(Ext.propertyNameSplitRe);
- }
- for (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() {},
- superclassProto = superclass.prototype,
- subclassProto;
- 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) {
- return Ext.scrollbar.size(force);
- },
-
- 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;
- },
- sortByWeight: function(items) {
- if (items) {
- Ext.Array.sort(items, Ext.weightSortFn);
- }
- },
-
- 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', '7.0.0.168');
- Ext.setVersion('core', '7.0.0.168');
- }
- })(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,
-
-
-
-
- combine: function(value, baseValue, instance, clone) {
- var cfg = this;
- if (cfg.merge) {
- value = cfg.merge(clone ? Ext.clone(value) : value, baseValue, instance);
- } else if (value && value.constructor === Object && baseValue && baseValue.constructor === Object) {
- value = Ext.merge({}, baseValue, value);
- } else if (clone && value) {
- value = Ext.clone(value);
- }
- return value;
- },
- equals: function(value1, value2) {
- return value1 === value2;
- },
- 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],
- watch;
-
- 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);
- }
- watch = me.$configWatch;
- if (watch && !me.isConfiguring) {
-
-
- watch.fire(name, [
- me,
- name,
- me[internalName],
- 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);
- }
-
- var watch = me.$configWatch;
- if (watch) {
-
- watch.fire(name, [
- me,
- name,
- 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 = Ext.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, transforms;
- 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 (!(transforms = instance.self.$configTransforms)) {
- instance.self.$configTransforms = transforms = [];
- ln = instance.$configTransforms;
- for (name in ln) {
- transforms.push([
- name,
- ln[name]
- ]);
- }
- ln = transforms.length;
- if (ln > 1) {
- transforms.sort(me.transformSorter);
- for (i = 0; i < ln; ++i) {
- transforms[i] = transforms[i][0];
- }
- } else if (ln) {
- transforms[0] = transforms[0][0];
- }
- }
- for (i = 0; i < transforms.length; ++i) {
- name = transforms[i];
- if (instance[name]) {
- instanceConfig = instance[name](instanceConfig, me);
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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();
- }
- valuesKey = values[name];
- if (cfg.merge) {
- value = cfg.merge(value, valuesKey, instance);
- } else if (value && value.constructor === Object) {
- if (valuesKey && valuesKey.constructor === Object) {
- value = Ext.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;
- },
-
- hoistConfigs: function(instance, instanceConfig, names) {
- var config = instance.config,
- configs = this.configs,
- initListMap = this.initListMap,
- ret = false,
- cfg, i, name;
- for (i = 0; i < names.length; ++i) {
- name = names[i];
- if (instanceConfig && name in instanceConfig) {
- cfg = configs[name];
-
- config[name] = cfg.combine(instanceConfig[name], config[name], instance);
- if (!initListMap[name]) {
- instance[cfg.names.get] = cfg.initGetter || cfg.getInitGetter();
- }
- }
-
-
- if (config[name] != null) {
- ret = true;
- }
- }
- return ret;
- },
-
- merge: function(instance, baseConfig, config, clone) {
-
-
- var configs = this.configs,
- name, value, baseValue, cfg;
- if (clone) {
- baseConfig = Ext.clone(baseConfig,
- false);
- }
- for (name in config) {
- value = config[name];
- cfg = configs[name];
- if (cfg) {
- baseValue = baseConfig[name];
- if (cfg.merge) {
- value = cfg.merge(value, baseValue, instance);
- } else if (value && value.constructor === Object) {
- if (baseValue && baseValue.constructor === Object) {
- value = Ext.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;
- },
- transformSorter: function(a, b) {
- return a[1] - b[1];
- }
- };
- }());
- 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
- });
- }
- },
-
- getOwnObject = function(proto, name) {
- if (!proto.hasOwnProperty(name)) {
- proto[name] = Ext.Object.chain(getOwnObject(proto.superclass, name));
- }
- return proto[name];
- },
- 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)));
- },
- addConfigTransform: function(methodName, priority) {
- var transforms = getOwnObject(this.prototype, '$configTransforms');
-
- if (this.$configTransforms) {
- Ext.raise('Config transforms cannot be added after instances are created');
- }
-
- transforms[methodName] = priority;
- },
-
- 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() {
-
- if (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, privacy) {
- oneMember[name] = member;
- this.addMembers(oneMember, false, privacy);
- delete oneMember[name];
- return this;
- },
- hookMember: function(name, member) {
- var existing = this.prototype[name];
- return this.addMember(name, member, existing && existing.$privacy);
- },
-
- borrow: function(fromClass, members) {
-
- if (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',
-
- $configTransforms: {},
-
- 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;
- },
- getConfigWatcher: function() {
- return this.$configWatch || (this.$configWatch = new Ext.mixin.Watchable());
- },
-
- watchConfig: function(name, fn, scope) {
- var watcher = this.getConfigWatcher();
- return watcher.on.apply(watcher, arguments);
- },
- $configWatch: null,
-
- 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,
- keepers = me.$noClearOnDestroy,
- props, prop, val, t, i, len;
-
-
- props = Ext.Object.getKeys(me);
- for (i = 0 , len = props.length; i < len; i++) {
- prop = props[i];
- val = me[prop];
-
- if (val && !(keepers && keepers[prop])) {
- t = typeof val;
-
-
-
-
- if (t === 'object' || (t === 'function' && !val.$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(),
- 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) {
- var head, ent;
- scope = scope || this;
- for (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) {
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, '>> Ext.Class#onBeforeCreated', arguments);
- }
-
- Class.addMembers(data);
- hooks.onCreated.call(Class, Class);
-
- if (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) {
- var Base = Ext.Base,
- basePrototype = Base.prototype,
- extend = data.extend,
- Parent, parentPrototype, i;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#extendPreProcessor', arguments);
- }
-
- 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) {
- var privates = data.privates,
- statics = privates.statics,
- privacy = privates.privacy || true;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#privatePreprocessor', arguments);
- }
-
- delete data.privates;
- delete privates.statics;
-
-
-
- Class.addMembers(privates, false, privacy);
- if (statics) {
- Class.addMembers(statics, true, privacy);
- }
- });
-
-
- ExtClass.registerPreprocessor('statics', function(Class, data) {
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#staticsPreprocessor', arguments);
- }
-
- Class.addStatics(data.statics);
- delete data.statics;
- });
-
-
-
- ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
-
- if (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) {
- var mixins = data.mixins,
- onCreated = hooks.onCreated;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#mixinsPreprocessor', arguments);
- }
-
- delete data.mixins;
- hooks.onCreated = function() {
-
-
- if (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) {
- var cls, m;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#extend-backwards-compatible', arguments);
- }
-
- if (arguments.length === 2 && Ext.isObject(Parent)) {
- members = Parent;
- Parent = Class;
- Class = null;
- }
- 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 (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, prefix, j, jlen;
-
-
-
- while (length-- > 0) {
- items = prefixes[length];
- if (items) {
- currChar = className.charAt(length);
- if (currChar !== '.') {
-
- continue;
- }
- 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) {
- var i;
- 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 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) {
- var name;
- for (name in namespaces) {
- namespaceCache[name] = {
- name: name,
- value: namespaces[name]
- };
- }
- },
-
- clearNamespaceCache: function() {
- var name;
- nameLookupStack.length = 0;
- for (name in namespaceCache) {
- if (!namespaceCache[name].value) {
- delete namespaceCache[name];
- }
- }
- },
-
- getNamespaceEntry: function(namespace) {
- var entry, i;
- if (typeof namespace !== 'string') {
- return namespace;
- }
-
- entry = namespaceCache[namespace];
- 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) {
- var ctor;
-
- if (className != null && typeof className !== 'string') {
- throw new Error("[Ext.define] Invalid class name '" + className + "' specified, must be a non-empty string");
- }
-
- 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) {
-
- if (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;
- 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, args, i;
- 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) {
-
- if (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) {
-
- if (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) {
- var alternates = data.alternateClassName,
- i, ln, alternate;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(name, 'Ext.ClassManager#alternateClassNamePostprocessor', arguments);
- }
-
- 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) {
- var target;
-
- if (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);
- }
-
-
- target = Class.isInstance ? Class.self : Class;
- delete target.prototype.debugHooks;
- });
-
- Manager.registerPostprocessor('deprecated', function(name, Class, data) {
- var target;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(Class, 'Ext.Class#deprecated', arguments);
- }
-
-
- 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.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) {
-
- if (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) {
- var classes = Manager.classes;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(className, 'Ext.ClassManager#undefine', arguments);
- }
-
-
- 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;
- }
-
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(cls, 'Ext.ClassManager#classNamePreprocessor', arguments);
- }
- },
- true, 'first');
- Class.registerPreprocessor('alias', function(cls, data) {
-
- if (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;
-
- if (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.define('Ext.mixin.Watchable', {
- on: function(name, fn, scope) {
- return this._watchUpdate(false, '_watchAdd', name, fn, scope);
- },
- fire: function(event, args) {
- var me = this,
- watching = me.watching,
- watchers = watching && watching[event],
- fn, i, r, scope;
- if (watchers) {
- ++watchers.$firing;
- for (i = 0; i < watchers.length; ++i) {
- scope = watchers[i][0];
- fn = watchers[i][1];
- if (fn.charAt) {
- r = args ? scope[fn].apply(scope, args) : scope[fn]();
- } else {
- r = args ? fn.apply(scope, args) : fn.call(scope);
- }
- if (r === false) {
- return r;
- }
- }
- --watchers.$firing;
- }
- },
- fireEvent: function() {
- var args = Ext.Array.slice(arguments),
- event = args.shift();
- return this.fire(event, args);
- },
- un: function(name, fn, scope) {
- return this._watchUpdate(true, '_watchRemove', name, fn, scope);
- },
- privates: {
- watching: null,
- $watchOptions: {
- destroyable: 1,
- scope: 1
- },
- _watchAdd: function(watching, name, fn, scope, destroyable) {
-
- if (typeof fn === 'string' && !scope[fn]) {
- Ext.raise('No such method "' + fn + '" on ' + scope.$className);
- }
-
-
- var watchers = watching[name],
- entry = [
- scope,
- fn
- ],
- i, ent;
- if (!watchers) {
- watching[name] = watchers = [];
- watchers.$firing = 0;
- } else {
-
- for (i = watchers.length; i-- > 0; )
- {
- ent = watchers[i];
- if (fn === ent[1]) {
- if (scope ? ent[0] === scope : !ent[0]) {
- return;
- }
- }
- }
- if (watchers.$firing) {
- watching[name] = watchers = watchers.slice();
- watchers.$firing = 0;
- }
- }
- watchers.push(entry);
- if (destroyable) {
- entry.push(name);
- destroyable.items.push(entry);
- }
- },
- _watchRemove: function(watching, name, fn, scope) {
- var watchers = watching[name],
- i;
- if (watchers) {
- if (watchers.$firing) {
- watching[name] = watchers = watchers.slice();
- watchers.$firing = 0;
- }
- for (i = watchers.length; i-- > 0; )
- {
- if (watchers[i][0] === scope && watchers[i][1] === fn) {
- watchers.splice(i, 1);
- }
- }
- }
- },
- _watchUpdate: function(remove, process, name, fn, scope) {
- var me = this,
- watch = name,
- watching = me.watching,
- destroyable;
- if (!watching) {
- if (remove) {
- return;
- }
- me.watching = watching = {};
- }
- if (typeof name === 'string') {
- me[process](watching, name, fn, scope);
- } else {
- destroyable = watch.destroyable ? {
- owner: me,
- items: [],
- destroy: me._watcherDestroyer
- } : null;
- scope = watch.scope;
- for (name in watch) {
- if (!me.$watchOptions[name]) {
- me[process](watching, name, watch[name], scope, destroyable);
- }
- }
- }
- return destroyable;
- },
- _watcherDestroyer: function() {
- var me = this.owner,
- watching = me.watching,
- items = this.items,
- entry, i;
- for (i = 0; i < items.length; ++i) {
- entry = items[i];
- me._watchRemove(watching, entry[2], entry[1], entry[0]);
- }
- }
- }
- });
- (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() {
- var pointerEvent = window.PointerEvent,
- nav = window.navigator,
- pointerEnabled = !!(pointerEvent && (nav.pointerEnabled || !Ext.isIE));
- return pointerEnabled && !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() {
- var xhr;
- if (window.XMLHttpRequest && !Ext.browser.is.AndroidStock) {
- 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;
- }
- },
- {
- name: 'inputEventData',
- ready: false,
- fn: function() {
- return !!(window.InputEvent && 'data' in new InputEvent('input'));
- }
- },
-
-
- 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() {
- var doc = document,
- topContext;
- if (Ready.bound) {
- return;
- }
-
- 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, 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) {
- var delegated = delegatedConfigs[name];
- if (name === 'paths') {
- Loader.setPath(value);
- } else {
- _config[name] = value;
- 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) {
- var name;
- for (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) {
- var classNames;
- if (excludes) {
- return Loader.exclude(excludes).require(expressions, fn, scope);
- }
- classNames = Manager.getNamesByExpression(expressions);
- return Loader.load(classNames, fn, scope);
- },
- syncRequire: function() {
- var wasEnabled = Loader.syncModeEnabled,
- ret;
- Loader.syncModeEnabled = true;
- 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,
- ret;
- Loader.syncModeEnabled = true;
- 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,
- 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() {
- var missingQueue = Loader.missingQueue,
- missingClasses = [],
- missingPaths = [],
- missingClassName;
- if (!Loader.syncModeEnabled && !Loader.scriptsLoading && Loader.isLoading && !Loader.hasFileLoadError) {
- for (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) {
- var listener;
- if (withDomReady) {
- Ready.on(fn, scope, options);
- } else {
- 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 = {},
- missing = 0,
- name;
- 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() {
- var name;
- if (!Loader.scriptsLoading && Loader.missingCount) {
- Ext.log.error('[Loader] The following classes failed to load:');
- for (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) {
-
- if (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) {
- var requires = _requiresMap[cls],
- dep, i, ln;
- deadlockPath.push(cls);
- 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() {
- var i, ln, j, subLn, k;
- 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 (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) {
- var uses = data.uses,
- classNames;
-
- if (Ext.classSystemMonitor) {
- Ext.classSystemMonitor(cls, 'Ext.Loader#usesPostprocessor', arguments);
- }
-
- 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,
- afterClassMixedIn = data.afterClassMixedIn,
- afters, befores, configs, extended, mixed, parentMixinConfig;
- 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');
- }
-
- afters = mixinConfig.after;
- befores = mixinConfig.before;
- configs = mixinConfig.configs;
- extended = mixinConfig.extended;
- hooks = mixinConfig.on;
- mixed = mixinConfig.mixed;
- }
- if (afters || befores || hooks || extended) {
-
- data.onClassMixedIn = function(targetClass) {
- var mixin = this.prototype,
- targetProto = targetClass.prototype,
- key;
- if (befores) {
- Ext.Object.each(befores, function(key, value) {
- targetClass.hookMember(key, function() {
- if (mixin[value].apply(this, arguments) !== false) {
- return this.callParent(arguments);
- }
- });
- });
- }
- if (afters) {
- Ext.Object.each(afters, function(key, value) {
- targetClass.hookMember(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);
- }
- };
- }
- if (configs || mixed) {
- data.afterClassMixedIn = function(targetClass) {
- if (configs) {
-
- var proto = targetClass.prototype,
- hoistable = this.$config.configs,
- cfg, name, hoist;
- for (name in proto) {
- cfg = hoistable[name];
- if (cfg && cfg.isConfig && proto.hasOwnProperty(name)) {
- (hoist || (hoist = {}))[name] = proto[name];
- delete proto[name];
- }
- }
- if (hoist) {
- targetClass.$config.add(hoist);
- }
- }
- if (afterClassMixedIn) {
- afterClassMixedIn.apply(this, arguments);
- }
- if (mixed) {
- mixed.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)) {
- if (args) {
- fn.apply(scope, args);
- } else {
- 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() {
- var was;
- if (me.id) {
- me.cancel();
-
-
- 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,
- namedScopes = Ext._namedScopes,
- namedScope = 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 (listener.lateBound && fn[2] === '.') {
-
- if (fn.substr(0, 2) !== 'up') {
- Ext.raise('Invalid listener method: ' + fn);
- }
-
- listener.defaultScope = null;
- listener.namedScope = namedScopes[listener.scope = scope = 'up'];
- listener.fn = handler = fn.substr(3);
- }
-
-
-
- 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, origin;
-
-
- if (!fromWrapped && listener.wrapped) {
- fireArgs.fn = fireFn;
- return fireArgs;
- }
- fn = fromWrapped ? listener.fn : fireFn;
-
- var name = fn;
-
-
- if (listener.lateBound) {
-
- origin = listener.caller || observable;
- if (namedScope && namedScope.isUp) {
- scope = Ext.lookUpFn(origin, fn);
- } else if (!scope || namedScope) {
-
-
-
-
- scope = origin.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() {
- var fireInfo;
- if (o.target === arguments[0]) {
- 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() {
- var fireInfo;
-
-
-
- if (listener.task) {
-
- if (Ext._unitTesting) {
- 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._unitTesting) {
- 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', function(Identifiable) {
- return {
-
-
- isIdentifiable: true,
- mixinId: 'identifiable',
-
- getId: function() {
- var me = this,
- id = me.id,
- cfg;
- if (!(id || id === 0)) {
- cfg = me.initialConfig;
-
-
- if (cfg && cfg.id) {
- id = cfg.id;
- } else {
- id = me.generateAutoId();
- me.autoGenId = true;
- }
- me.setId(id);
- }
- me.getId = Identifiable._getId;
- return id;
- },
- setId: function(id) {
-
-
-
-
- this.id = this.id = id;
- },
- privates: {
- statics: {
- _idCleanRe: /\.|[^\w-]/g,
- uniqueIds: {},
- _getId: function() {
- return this.id;
- }
- },
- defaultIdPrefix: 'ext-',
- defaultIdSeparator: '-',
- id: null,
-
- autoGenId: false,
- generateAutoId: function() {
- var me = this,
- prototype = me.self.prototype,
- sep = me.defaultIdSeparator,
- uniqueIds = Identifiable.uniqueIds,
- cleanRe, defaultIdPrefix, prefix, xtype;
- if (!prototype.hasOwnProperty('identifiablePrefix')) {
- cleanRe = Identifiable._idCleanRe;
- defaultIdPrefix = me.defaultIdPrefix;
- xtype = me.xtype;
- if (xtype) {
- prefix = defaultIdPrefix + xtype.replace(cleanRe, sep) + sep;
- } else if (!(prefix = prototype.$className)) {
- prefix = defaultIdPrefix + 'anonymous' + sep;
- } else {
- prefix = prefix.replace(cleanRe, sep).toLowerCase() + sep;
- }
- prototype.identifiablePrefix = prefix;
- }
- prefix = me.identifiablePrefix;
- if (!uniqueIds.hasOwnProperty(prefix)) {
- uniqueIds[prefix] = 0;
- }
- return prefix + (++uniqueIds[prefix]);
- }
- }
- };
- });
- 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,
- 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,
- config, passedOptions;
- me.managedListeners = me.managedListeners || [];
- 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) {
- var me = this,
-
- events = me.events,
- ret = true,
- event;
- eventName = Ext.canonicalEventName(eventName);
- event = events && events[eventName];
-
-
- 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,
- 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) {
- var proto = T.prototype;
- if (!T.HasListeners) {
-
-
- proto.$observableMixedIn = 1;
-
- Observable.prepareClass(T, this);
-
-
- T.onExtended(function(U, data) {
-
- if (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) {
- var deferred = new Deferred(),
- len = promises.length,
- i;
-
- if (!Ext.isArray(promises)) {
- Ext.raise('Invalid parameter: expected an Array.');
- }
-
- 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) {
- var args;
- if (scope == null) {
- scope = null;
- }
- 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) {
- var initialValueSpecified;
-
- 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.');
- }
-
- 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) {
- var args;
- if (scope == null) {
- scope = null;
- }
- 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",
- xiSwfUrlStr = "playerProductInstall.swf",
- flashvars = {},
- params = {},
- attributes = {};
- params.quality = "high";
- params.bgcolor = "#ffffff";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- 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) {
- var me = this;
-
- if (!Ext.data.flash.BinaryXhr.flashPluginInjected) {
- Ext.data.flash.BinaryXhr.injectFlashPlugin();
- }
- 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, isAsync, user, password) {
- var me = this;
- me.method = method;
- me.url = url;
- me.async = isAsync !== 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;
- 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
- };
- 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, success, isException;
- 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') && response.response) {
- len = 0;
- } else if ((type === 'text' || type === '' || !type) && response.responseText) {
- len = response.responseText.length;
- }
- }
-
- status = status === 1223 ? 204 : status;
- isException = false;
-
- success = (status >= 200 && status < 300) || status === 304 || (status === 0 && Ext.isNumber(len));
- 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;
- xhr = me.xhr = me.openRequest(options, requestOptions, me.async, me.username, me.password);
-
- if (!isXdr) {
- 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, isAsync, username, password) {
- var me = this,
- xhr = me.newRequest(options);
- if (username) {
- xhr.open(requestOptions.method, requestOptions.url, isAsync, username, password);
- } else {
- if (me.isXdr) {
- xhr.open(requestOptions.method, requestOptions.url);
- } else {
- xhr.open(requestOptions.method, requestOptions.url, isAsync);
- }
- }
- 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;
- 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) {
- var me = this,
- requestOptions, request;
- options = options || {};
- 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,
- queue = me.runningQueue,
- now, item, element, i, ln;
-
- me.animationFrameId = null;
- if (!me.isRunning) {
- return;
- }
- now = Ext.now();
- 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,
- queue = me.queue,
- ln = queue.length,
- i, item;
- if (!me.isRunning) {
- return;
- }
- 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() {
- var listeners = this.idleQueue,
- listener;
- delete this.idleQueueTimer;
- if (!this.isIdle) {
- return;
- }
- 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() {
- var listeners = this.taskQueue,
- listener;
- delete this.taskQueueTimer;
- 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',
- after: {
- destroy: 'cancelAllCalls'
- },
- before: {
-
- $reap: '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) {
- if (target.destroying) {
- return;
- }
-
- 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,
- fixReferencesTimer: null,
- referenceRepairs: 0,
- typeName: 'xtype',
- bufferableMethods: {
- handleDocumentMouseDown: 'asap'
- },
-
- constructor: function(config) {
- var me = this;
- Ext.apply(me, config);
- me.all = {};
- me.byInstanceId = {};
- me.holders = {};
- 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.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,
- id = component.getId();
- if (id in holders) {
-
-
-
- holders[id] = null;
- delete holders[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,
- holder, id;
- if (!Ext.referencesDirty) {
-
- for (id in holders) {
- holder = holders[id];
- holder.refs = holder.nameRefs = null;
- if (holder.invalidateChildDirty) {
- holder.invalidateChildDirty();
- }
- }
- Ext.referencesDirty = true;
- me.fixReferencesTimer = Ext.asap(function() {
- me.fixReferencesTimer = null;
- me.fixReferences();
- });
- }
- },
- fixReferences: function() {
- var me = this,
- all = me.all,
- holders = me.holders,
- holder, id;
- if (Ext.referencesDirty) {
- me.fixReferencesTimer = Ext.unasap(me.fixReferencesTimer);
-
- Ext.referencesDirty = 0;
- ++me.referenceRepairs;
- for (id in holders) {
- holder = holders[id];
- if (holder.beginSyncChildDirty) {
- holder.beginSyncChildDirty();
- }
- }
- for (id in all) {
- all[id]._fixReference();
- }
- for (id in holders) {
- holder = holders[id];
- if (holder.finishSyncChildDirty) {
- holder.finishSyncChildDirty();
- }
- }
- Ext.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(info) {
- var me = this,
- event = info.event.chain(),
- infoCopy = Ext.applyIf({
- event: event
- }, info),
- to, from, ancestor, target;
- to = event.toComponent = infoCopy.toComponent = Ext.Component.from(info.toElement);
- from = event.fromComponent = infoCopy.fromComponent = Ext.Component.from(info.fromElement);
- ancestor = me.getCommonAncestor(from, to);
-
- if (to !== from) {
- if (from && !from.destroyed && !from.isDestructing()) {
- if (from.handleBlurEvent) {
- from.handleBlurEvent(infoCopy);
- }
-
- for (target = from; target && target !== ancestor; target = target.getRefOwner()) {
- if (!(target.destroyed || target.destroying)) {
- event.type = 'focusleave';
- target.onFocusLeave(event);
- }
- }
- }
- if (to && !to.destroyed && !to.isDestructing()) {
- if (to.handleFocusEvent) {
- to.handleFocusEvent(infoCopy);
- }
-
- for (target = to; target && target !== ancestor; target = target.getRefOwner()) {
- event.type = 'focusenter';
- target.onFocusEnter(event);
- }
- }
- }
- for (target = ancestor; target; target = target.getRefOwner()) {
- if (!(target.destroying || target.destroyed)) {
- target.onFocusMove(infoCopy);
- }
- }
- },
- 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() {
- var me = this;
- me.all = {};
- me.byInstanceId = {};
- me.holders = {};
- me.onAvailableCallbacks = {};
- },
-
- from: function(el, limit, selector) {
- var cache = this.all,
- depth = 0,
- target, topmost, cmpId, cmp;
- if (el && el.isEvent) {
- el = el.target;
- }
- target = Ext.getDom(el);
- 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(ComponentManager) {
-
- ComponentManager.fromElement = ComponentManager.from;
-
-
- Ext.referencesDirty = false;
- Ext.fixReferences = function() {
- ComponentManager.fixReferences();
- };
- Ext.markReferencesDirty = function() {
- ComponentManager.markReferencesDirty();
- };
-
- 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 = [],
- length = items.length,
- mustBeOwnProperty, presenceOnly, candidate, propValue, config, i, j, propLen;
-
-
- if (property.charAt(0) === '@') {
- mustBeOwnProperty = true;
- property = property.substr(1);
- }
- if (property.charAt(0) === '?') {
- mustBeOwnProperty = true;
- presenceOnly = true;
- property = property.substr(1);
- }
- for (i = 0; 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, f, i, len, n, nodeIndex;
- 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;
-
- 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) {
- var len = cmps.length,
- results = [],
- i = 0,
- c;
- deep = deep === 'true';
- 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) {
- var query;
- if (!selector) {
- return true;
- }
- if (typeof selector === 'function') {
- return selector(component);
- } else {
- 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) {
- var factor;
- if (!isNaN(to)) {
- 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) {
- var d;
- if (!Ext.isObject(axis)) {
- if (axis === 'x') {
- return this.getOutOfBoundOffsetX(p);
- } else {
- return this.getOutOfBoundOffsetY(p);
- }
- } else {
- p = axis;
- 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) {
- var newP;
- if (Ext.isObject(axis)) {
- 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) {
- var me = this;
- if (x.length) {
- y = x[1];
- x = x[0];
- } else if (arguments.length === 1) {
- y = x.y;
- x = x.x;
- }
- 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
- },
-
- wheelEvents: {
- wheel: 1,
- mousewheel: 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.ticks();
- 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);
- if (self.wheelEvents[type]) {
- me.getWheelDeltas();
- }
- },
-
-
- chain: function(props) {
- var e = Ext.Object.chain(this);
- e.parentEvent = this;
-
- return Ext.apply(e, props);
- },
-
- correctWheelDelta: function(delta) {
- var me = this,
-
-
-
- deltaMode = me.browserEvent.deltaMode,
- correctedDelta = delta;
- if (deltaMode === 0) {
- correctedDelta = delta * me.WHEEL_PIXEL_SIZE;
- } else if (deltaMode === 1) {
- correctedDelta = delta * me.WHEEL_LINE_SIZE;
- } else if (deltaMode === 2) {
- correctedDelta = delta * me.WHEEL_PAGE_SIZE;
- }
- return Math.round(correctedDelta);
- },
- 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,
- wheelDeltas = me.wheelDeltas,
- browserEvent, deltaX, deltaY;
- if (!wheelDeltas) {
- browserEvent = me.browserEvent;
- deltaX = me.correctWheelDelta(browserEvent.deltaX || 0);
- deltaY = browserEvent.deltaY;
- deltaY = me.correctWheelDelta(deltaY == null ? -browserEvent.wheelDelta : deltaY);
-
- me.deltaX = deltaX;
-
- me.deltaY = deltaY;
- me.wheelDeltas = wheelDeltas = {
- x: deltaX,
- y: deltaY
- };
- }
- return wheelDeltas;
- },
-
- 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;
- },
-
- getLocalXY: function(clip) {
-
- var pageXY = this.getXY(),
- targetXY = Ext.fly(this.currentTarget).getXY(),
- localX = pageXY[0] - targetXY[0],
- localY = pageXY[1] - targetXY[1],
- size;
- if (clip) {
- size = Ext.fly(this.currentTarget).getSize();
- localX = Math.max(0, Math.min(localX, size.width));
- localY = Math.max(0, Math.min(localY, size.height));
- }
- return [
- localX,
- localY
- ];
- },
-
- 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_PIXEL_SIZE: 1,
-
- WHEEL_LINE_SIZE: 20,
-
- WHEEL_PAGE_SIZE: 600
- },
- keyCodes = {},
- gestureEvents = Event.gestureEvents,
- prototype = Event.prototype,
- i, keyName, keyCode, keys;
- 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.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 && window.self !== window.top) || 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,
- commonTargets = [],
- i = 1,
- target, targets, j;
- if (ln === 1) {
- return firstTargetGroup;
- }
- 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 = Math.round(touchSource.pageX);
- y = Math.round(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) {
- var i;
- for (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) {
- var el, monitor, i, len;
- elements = Ext.Array.from(elements);
- for (i = 0 , len = elements.length; 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 result = '',
- prop;
- 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;
- if (!(id = dom.id)) {
- dom.id = id = me.generateAutoId();
- }
- me.id = id;
-
-
-
- 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, namespace) {
- 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 || 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' && name !== 'namespace') {
- 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, ns));
- }
- };
- 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 (el === DOC) {
- el.id = id = documentId;
- }
-
- else if (el == WIN) {
-
- el.id = id = windowId;
- }
- 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();
- }
- }
- 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) {
- var type, parts, ln;
- box = box || 0;
- type = typeof box;
- 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),
- styleSides = [],
- len = sidesArr.length,
- side, i;
- 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.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) {
- var me = this,
- dom = me.dom,
- offsets, clientWidth, clientHeight;
- align = align || empty;
- 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, i, len;
- className = Ext.isArray(className) ? className : [
- className
- ];
- for (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(cls, state) {
- var me = this,
- off, on;
- if (!cls) {
- cls = Ext.baseCSSPrefix + 'repaint';
- on = !(off = false);
- } else if (state != null) {
-
- on = state;
- off = !state;
- }
- me.toggleCls(cls, on);
- if (!me.repaintTimer) {
- me.repaintTimer = Ext.defer(function() {
- me.repaintTimer = null;
- if (me.dom) {
-
- me.toggleCls(cls, off);
- }
- }, 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,
- dom = me.dom,
- 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) {
- list = list.join(' ');
- if (!Ext.isIE8 && dom instanceof SVGElement) {
-
-
-
- dom.setAttribute('class', list);
- } else {
- dom.className = list;
- }
- }
- }
- 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;
- },
- getText: function() {
- return this.dom.textContent;
- },
-
- 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.isSafari) {
- if (Ext.browser.version.isLessThan(11)) {
- bodyCls.push(Ext.baseCSSPrefix + 'safari10m');
- }
- if (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.hasListeners = GlobalEvents.hasListeners;
-
- 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) {
- if (glyph) {
- this.setGlyph(glyph);
- }
- },
-
- setGlyph: function(glyph) {
- var glyphParts;
- this.glyphConfig = glyph;
- if (typeof glyph === 'string') {
- glyphParts = glyph.split('@');
- glyph = isNaN(glyphParts[0]) ? parseInt('0' + glyphParts[0], 16) : parseInt(glyphParts[0], 10);
-
-
-
-
- if (isNaN(glyph) || !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) {
- var target;
- for (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: {
-
- _fixReference: function() {
- var me = this,
- holder;
- if (me.name && me.nameable) {
- holder = me.lookupNameHolder();
- if (holder && !holder.destroyed) {
- holder.attachNameRef(me);
- }
- }
- if (me.reference) {
- holder = me.lookupReferenceHolder();
- if (holder && !holder.destroyed) {
- holder.attachReference(me);
- }
- }
- },
-
- onInheritedAdd: function(parent, instanced) {
- var me = this;
-
-
-
- if (me.inheritedState && instanced) {
- me.invalidateInheritedState();
- }
- Ext.ComponentManager.markReferencesDirty();
- },
-
- onInheritedRemove: function(destroying) {
- var me = this;
- 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: {
-
- applyBind: function(binds, currentBindings) {
- if (!binds) {
- return currentBindings;
- }
-
- var me = this,
- viewModel = me.lookupViewModel(),
- twoWayable = me.getTwoWayBindable(),
- getBindTemplateScope = me._getBindTemplateScope,
- b, watch, property, descriptor;
-
- if (!viewModel) {
- Ext.raise('Cannot use bind config without a viewModel');
- }
-
- if (typeof binds === 'string') {
-
- 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 && currentBindings[property];
- if (b) {
- b.destroy();
- delete currentBindings[property];
- }
- if (descriptor) {
- if (!b && twoWayable && twoWayable[property]) {
- (watch || (watch = {}))[property] = '_onConfigPropChange';
- }
- 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.');
- }
-
- (currentBindings || (currentBindings = {}))[property] = b;
- }
- }
- if (watch) {
- watch.scope = me;
- me.watchConfig(watch);
- }
- me.$bindings = currentBindings;
- 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,
- property, watch;
- if (all && me.lookupViewModel()) {
- for (property in all) {
- if (all[property]) {
- (watch || (watch = {}))[property] = '_onConfigPropChange';
- }
- }
- if (watch) {
- watch.scope = me;
- me.watchConfig(watch);
- }
- }
- return all;
- },
-
- applySession: function(session) {
- var parentSession, config;
- if (!session) {
- return null;
- }
- if (!session.isSession) {
- 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();
- },
- 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;
- },
- 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;
- },
- _onConfigPropChange: function(me, name, value) {
- me.publishState(name, value);
- },
- removeBindings: function() {
- var me = this,
- bindings = me.$bindings,
- b, key;
- if (bindings) {
- for (key in bindings) {
- b = bindings[key];
- if (b) {
- b.destroy();
- b._config = b.getTemplateScope = null;
- bindings[key] = 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',
- mixins: [
- Ext.mixin.Identifiable
- ],
-
- isPlugin: true,
-
-
-
- constructor: function(config) {
- if (config) {
- this.cmp = config.cmp;
- this.pluginConfig = config;
- this.initConfig(config);
- }
- },
-
- init: Ext.emptyFn,
-
- destroy: function() {
- var me = this;
- me.destroy = Ext.emptyFn;
- me.destroying = true;
- me.cmp = me.pluginConfig = null;
- me.doDestroy();
- me.callParent();
- },
-
-
- doDestroy: Ext.emptyFn,
-
- clonePlugin: function(overrideCfg) {
- return new this.self(Ext.apply({}, overrideCfg, this.pluginConfig));
- },
-
-
- getCmp: function() {
- return this.cmp;
- },
-
- setCmp: function(host) {
- this.cmp = host;
- },
- getStatefulOwner: function() {
- return [
- this.cmp,
- 'plugins'
- ];
- },
- 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;
- Ext.apply(entry, value);
- plugins.push(entry);
- }
- Ext.sortByWeight(plugins);
- }
- }
-
- 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 {
- mixinId: 'pluggable',
- 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) {
- var ret;
- if (typeof config === 'string') {
- config = {
- type: config
- };
- }
- 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) {
- var ret, key, ucKey, v, vs;
-
- if (value === null) {
- return value;
- }
-
-
-
-
-
- ret = (baseValue && !cls.isInstance) ? Ext.Object.chain(baseValue) : {};
- 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),
- result = [],
- entry, len, i;
- 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;
- me.lastKeyMapEvent = e;
- 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() {
- var c;
- for (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,
- wasFocusable = me.focusable,
- el;
-
-
-
- if (!wasFocusable && !(me.forceTabIndex || newTabIndex == null)) {
- return;
- }
- me.tabIndex = newTabIndex;
-
-
- if (me.destroying || me.destroyed || (me.isDisabled() && !focusableIfDisabled)) {
- return;
- }
-
-
-
- me.focusable = true;
- el = focusEl || me.getFocusEl();
- me.focusable = wasFocusable;
- 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(info) {
- var me = this,
- event;
- if (!me.focusable || me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
-
-
- if (me.isFocusing(info)) {
- event = new Ext.event.Event(info.event);
- event.type = 'focus';
- event.relatedTarget = info.fromElement;
- event.target = info.toElement;
- me.onFocus(event);
- }
- },
-
- handleBlurEvent: function(info) {
- var me = this,
- event;
- if (!me.focusable || me.destroying || me.destroyed) {
- return;
- }
-
-
-
-
- if (info.toElement === document.body || me.isBlurring(info)) {
- event = new Ext.event.Event(info.event);
- event.type = 'blur';
- event.target = info.fromElement;
- event.relatedTarget = info.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) {
- var type;
- if (!Ext.enableKeyboardMode) {
- return;
- }
- 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;
- 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,
-
- margin: 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);
- }
- me.syncUiCls();
- Ext.ComponentManager.register(me);
- controller = me.getController();
- if (controller) {
- controller.init(me);
- }
- if (renderTo) {
- me.setRenderTo(renderTo);
- }
- },
- 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.destroy = Ext.emptyFn;
- me.doDestroy();
-
-
- me.clearListeners();
-
-
-
-
- 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,
- ev, ret;
- ret = me.mixins.observable.doFireEvent.call(me, eventName, args, bubbles);
-
- if (ret !== false && !me.destroyed) {
- ev = me.events[eventName];
-
- if (!ev || !ev.suspended) {
- 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);
- }
- }
- }
- },
- updateMargin: function(margin) {
- this.element.setMargin(margin);
- },
- 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 null;
- }
-
-
-
- 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
- },
- offsetX: 0,
- offsetY: 0
- },
-
-
-
-
- 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);
- },
- updateOffsetX: function() {
- var me = this;
- if (!me.isConfiguring && !me.isAnimating) {
- me.translateXY(me.x, me.y);
- }
- },
- updateOffsetY: function() {
- var me = this;
- if (!me.isConfiguring && !me.isAnimating) {
- me.translateXY(me.x, me.y);
- }
- },
- translate: function(x, y, animation) {
- var me = this;
- if (animation) {
- return me.translateAnimated(x, y, animation);
- }
- if (me.isAnimating) {
- me.stopAnimation();
- }
- if (!isNaN(x) && typeof x === 'number') {
- me.x = x;
- } else {
- x = me.x;
- }
- if (!isNaN(y) && typeof y === 'number') {
- me.y = y;
- } else {
- y = me.y;
- }
- me.translateXY(x, y);
- },
- translateXY: function(x, y) {
- var me = this;
- if (!me.destroyed) {
- me.doTranslate(x + me.getOffsetX(), y + me.getOffsetY());
- if (me.hasListeners.translate) {
- me.fireEvent('translate', me, 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.translateXY(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.destroyed = true;
- }
- });
- 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.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) {
- var ret;
- if (Ext.isNumber(value)) {
- 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) {
- var formatFn;
- if (!formatString) {
- return v;
- }
- if (isNaN(v)) {
- return '';
- }
- 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) {
- var result, name;
- if (typeof attributes === 'object') {
- result = [];
- 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,
- L = me.level,
- up = L - 1,
- s, 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();
- },
- translateXY: function(x, y) {
- var element = this.getElement();
- if (element && !element.destroyed) {
- this.callParent([
- x,
- y
- ]);
- }
- }
- });
- 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';
- }
- },
- 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) {
- this.getElement().translate(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.mixin.Responsive', function(Responsive) {
- return {
-
- extend: Ext.Mixin,
- mixinConfig: {
- id: 'responsive',
- after: {
- destroy: 'destroy'
- }
- },
- config: {
-
- responsiveConfig: {
- $value: undefined,
- merge: function(newValue, oldValue, target, mixinClass) {
- var marker, entry, ret, rule;
- if (!newValue) {
- return oldValue;
- }
- ret = oldValue ? Ext.Object.chain(oldValue) : {};
- marker = Responsive.context;
- for (rule in newValue) {
- if (!mixinClass || !(rule in ret)) {
- entry = newValue[rule];
-
-
- if (entry.fn !== marker) {
- entry = {
- fn: marker,
-
- config: entry
- };
- }
- ret[rule] = entry;
- }
- }
- return ret;
- }
- },
-
- responsiveFormulas: {
- $value: null,
- merge: function(newValue, oldValue, target, mixinClass) {
- return this.mergeNew(newValue, oldValue, target, mixinClass);
- }
- }
- },
-
- destroy: function() {
- Responsive.unregister(this);
- },
-
- privates: {
- statics: {
-
- active: false,
-
- all: {},
- _configNames: [
- 'responsiveConfig',
- 'responsiveFormulas'
- ],
-
- 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,
- timer = Responsive.timer,
- id;
- if (timer) {
- Responsive.timer = Ext.unasap(timer);
- }
- Responsive.updateContext();
- Ext.suspendLayouts();
- Ext.fireEvent('beforeresponsiveupdate', context);
- for (id in all) {
- all[id].setupResponsiveContext();
- }
- Ext.fireEvent('beginresponsiveupdate', context);
- for (id in all) {
- all[id].updateResponsiveState();
- }
- Ext.fireEvent('responsiveupdate', context);
- Ext.resumeLayouts(true);
- },
-
- onResize: function() {
- if (!Responsive.timer) {
- Responsive.timer = Ext.asap(Responsive.onTimer);
- }
- },
-
- onTimer: function() {
- Responsive.timer = null;
- Responsive.notify();
- },
- 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);
- }
- targetClass.addConfigTransform('transformResponsiveConfig', 10);
- },
-
-
-
-
- applyResponsiveConfig: function(rules) {
- var rule;
- for (rule in rules) {
- rules[rule].fn = Ext.createRuleFn(rule);
- }
- return rules;
- },
- applyResponsiveFormulas: function(formulas) {
- var fn, name, ret;
- if (formulas) {
- ret = {};
- 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(),
- entry, ret, rule;
- if (rules) {
- ret = {};
- 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);
- }
- }
- },
-
- transformResponsiveConfig: function(instanceConfig, configurator) {
- var me = this,
- ret = instanceConfig,
- state;
-
-
-
-
-
-
- if (configurator.hoistConfigs(me, instanceConfig, Responsive._configNames)) {
- Responsive.register(me);
-
-
- me.setupResponsiveContext();
-
-
- state = me.getResponsiveState();
- if (state) {
- ret = Ext.merge({}, instanceConfig, state);
-
- delete ret.responsiveConfig;
- delete ret.responsiveFormulas;
- }
- }
- return ret;
- },
-
- updateResponsiveState: function() {
- var config = this.getResponsiveState();
- this.setConfig(config);
- }
- }
- };
- });
- 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, handler, matches, urlParams, i;
- 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,
- 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 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.BasicFilter', {
- isFilter: true,
- config: {
-
- id: null,
-
- disabled: false,
-
- serializer: null
- },
-
- generation: 0,
-
- constructor: function(config) {
- this.initConfig(config);
- },
- updateDisabled: function() {
-
-
- if (!this.isConfiguring) {
- ++this.generation;
- }
- }
- });
- Ext.define('Ext.util.Filter', {
- extend: Ext.util.BasicFilter,
- config: {
-
- property: null,
-
- root: null,
-
- value: null,
-
- filterFn: null,
-
- anyMatch: false,
-
- exactMatch: false,
-
- caseSensitive: false,
-
- disableOnEmpty: false,
-
- operator: null,
-
- convert: null
- },
-
- scope: null,
-
-
- $configStrict: false,
- 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;
- }
- if (Ext.isArray(filter1) && Ext.isArray(filter2)) {
- return Ext.Array.equals(filter1, filter2);
- }
- 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.callParent([
- 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 me = this,
- id = me._id;
- if (!id) {
- id = me.getProperty();
- if (!id) {
- id = Ext.id(null, 'ext-filter-');
- }
- me._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;
- },
- serializeTo: function(out) {
- var me = this,
- primitive, serialized;
-
-
-
-
- me.getFilterFn();
- if (me.generatedFilterFn) {
- out.push(serialized = me.serialize());
- primitive = me.primitiveRe.test(typeof serialized);
- }
- return !primitive;
- },
- 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: {
- primitiveRe: /string|number|boolean/,
- 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(Filter) {
- var prototype = Filter.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) {
- var er;
- if (!value.exec) {
-
- 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;
- 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, key;
- if (map) {
- if (me.getUnique() && length < collection.length / 2) {
- for (i = 0; i < length; ++i) {
- key = me.getKey(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 = item.$collapsedGroupPlaceholder ? item.$groupKey : this._groupFn(item);
- return (group != null) ? String(group) : '';
- },
- sortFn: function(item1, item2) {
- var me = this,
- lhs = me.getGroupString(item1),
- rhs = me.getGroupString(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(Ext.applyIf({
- source: null
- }, 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) {
- var regex, root;
- if (Ext.isEmpty(value, false)) {
- return null;
- }
- 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) {
- var key;
- if (!item) {
- return -1;
- }
- 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) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --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, defaultIndex) {
- 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 defaultIndex;
- },
-
-
-
- onCollectionAdd: function(source, details) {
- var me = this,
- atItem = details.atItem,
- items = me.transformItems(details.items),
- requestedIndex = me.requestedIndex,
- filtered, index, copy, i, item, n;
-
-
- if (requestedIndex !== undefined) {
- index = requestedIndex;
- } else {
-
- item = atItem || source.items[1];
- index = item ? me.indexOf(item) : -1;
- if (index > -1) {
-
-
-
- if (atItem) {
- ++index;
- }
- }
-
-
-
-
- else if (!me.sorted) {
- index = me.findInsertIndex(items[0], details.at ? me.length : 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) {
- var me = this;
-
- me.onCollectionUpdateKey = null;
-
-
- if (!me.sourceUpdating) {
- me.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 = me.transformItems(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) {
- var value, max, min, i;
- for (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) {
- var value, sum, i;
- for (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(
- {
- id: this.getId() + '-filters' + (this.generation || '')
- });
-
- 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(
- {
- id: this.getId() + '-sorters' + (this.generation || '')
- });
-
- 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({
-
- id: me.getId() + '-groups' + (me.generation || ''),
-
- 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]
- ]);
- }
- },
- transformItems: Ext.identityFn,
- 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 me = this,
- auto = me.autoSource;
- if (oldSource) {
- if (!oldSource.destroyed) {
- oldSource.removeObserver(me);
- }
- if (oldSource === auto) {
- auto.destroy();
- me.autoSource = null;
- }
- }
- if (newSource) {
- newSource.addObserver(me);
- if (newSource.length || me.length) {
- me.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) {
- var v, i;
- for (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,
-
- 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, 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 singular,
- 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'
- };
- 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) {
- var parts, index;
- if (name.indexOf('.') < 0) {
- return name;
- }
- 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) {
- var end;
- if (namespace) {
- 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('|'),
- after;
-
- delete associations[matrixName];
- me.addMatrix(entityType, matrixName, relation, left, right);
- 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) {
- var name;
- if (Ext.isString(assoc)) {
- assoc = {
- type: assoc
- };
- } else {
- assoc = Ext.apply({}, assoc);
- }
- if (assoc.model) {
- assoc.type = assoc.model;
-
- delete assoc.model;
- }
- 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 me = this,
- result = me.callParent();
- if (!result && autoCreate !== false) {
- me.setFilters([]);
- result = me.callParent();
- }
- return result;
- },
- applyFilters: function(filters, filtersCollection) {
- var me = this,
- created;
- if (!filtersCollection) {
- filtersCollection = me.createFiltersCollection();
- created = true;
- }
- filtersCollection.add(filters);
- if (created) {
- me.onRemoteFilterSet(filtersCollection, me.getRemoteFilter());
- }
- return filtersCollection;
- },
-
- getSorters: function(autoCreate) {
- var me = this,
- result = me.callParent();
- if (!result && autoCreate !== false) {
-
- me.setSorters([]);
- result = me.callParent();
- }
- return result;
- },
- applySorters: function(sorters, sortersCollection) {
- var me = this,
- created;
- if (!sortersCollection) {
- sortersCollection = me.createSortersCollection();
- created = true;
- }
- sortersCollection.add(sorters);
- if (created) {
- me.onRemoteSortSet(sortersCollection, me.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.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: function() {
- me.fireGroupChange();
- }
- });
- }
- } else
- {
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- me.fireGroupChange();
- }
- } else
-
- {
- me.fireGroupChange();
- }
- },
- fireGroupChange: function(grouper) {
- var me = this;
- if (!me.isConfiguring && !me.destroying && !me.destroyed) {
- me.fireGroupChangeEvent(grouper || me.getGrouper());
- }
- },
- fireGroupChangeEvent: function(grouper) {
- this.fireEvent('groupchange', this, grouper);
- },
-
- 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, 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);
- }
-
- callback = me.getCallback();
- if (callback) {
-
- 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,
- alias = data.alias;
- if (alias) {
- if (typeof alias !== 'string') {
- alias = alias[0];
- }
- if (alias) {
- proto.type = alias.substr(alias.lastIndexOf('.') + 1);
- }
- }
- 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) {
- var all, length, i, item, validator, presence;
- if (validators) {
- if (!(validators instanceof Array)) {
- validators = [
- validators
- ];
- }
- all = this._validators;
-
- for (i = 0 , length = validators.length; 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, skipStoreAddition) {
- 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 && !skipStoreAddition) {
- 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 = [],
- idProperty = me.idProperty,
- i = 0,
- field, myData, sourceData, 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) {
- var me = this;
- 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.');
- }
-
- 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', {
- alias: 'writer.base',
- alternateClassName: [
- 'Ext.data.DataWriter',
- 'Ext.data.Writer'
- ],
- mixins: [
- Ext.mixin.Factoryable
- ],
- factoryConfig: {
- defaultType: null
- },
-
- isWriter: true,
- config: {
-
- clientIdProperty: null,
-
- allDataOptions: {
- persist: true
- },
-
- partialDataOptions: {
- changes: true,
- critical: true
- },
-
- writeAllFields: false,
-
- dateFormat: null,
-
- nameProperty: 'name',
-
- writeRecordId: true,
-
- transform: null
- },
-
- 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 ? (idField[nameProperty] || idField.name) : 'id',
- value = record.id,
- writeAll = me.getWriteAllFields(),
- ret, dateFormat, phantom, options, clientIdProperty, fieldsMap, data, field;
- if (idField && 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) {
- var reader;
- if (model) {
- 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) {
- var me = this,
- model;
- if (reader) {
- 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();
-
-
-
- meta = resultSet.getMetadata();
- if (meta) {
- 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();
- } else {
- if (me.getAsynchronousLoad()) {
- operation.abort();
- }
- operation.setCompleted();
- }
- },
-
- 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,
- isGroup: true,
- config: {
- groupKey: null
- },
-
-
-
-
- $endUpdatePriority: 2001,
- manageSorters: false
- });
- Ext.define('Ext.data.Group', {
- extend: Ext.util.Group,
- isDataGroup: true,
- 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',
- after: {
- fireGroupChangeEvent: 'onGrouperChange'
- }
- },
- 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({
-
- id: this.getId() + '-data',
-
- 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();
- },
- onGrouperChange: function(grouper) {
- this.callObservers('GrouperChange', [
- grouper
- ]);
- },
- 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: {}
- },
-
-
-
- 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,
- encode, i;
- for (i = 0; i < length; i++) {
- encode |= filters[i].serializeTo(out);
- }
-
-
- return encode ? 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.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;
-
- 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;
- 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.setRoot && !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
- ], false).entries;
- entries[0].group = itemGroupKeys['oldKey' in details ? details.oldKey : source.getKey(item)];
- } else {
- entries = me.createEntries(source, details.items, false).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.sortItems();
- } else {
- 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, createGroups) {
-
- 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, createGroups);
- 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, createGroups) {
- var me = this,
- group = me.get(key),
- autoSort = me.getAutoSort();
- if (group) {
- group.setSorters(source.getSorters());
- } else if (createGroups !== false) {
- group = me.emptyGroups[key] || Ext.create(Ext.apply({
- xclass: 'Ext.util.Group',
-
- id: me.getId() + '-group-' + key,
-
- 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) {
- data.setRootProperty('data');
- dataCollection = data;
- dataCollection.addObserver(this);
-
- if (data.getCount()) {
- me.afterLoadRecords(data.items);
-
-
-
- if (me.hasListeners.load) {
- me.fireEvent('load', me, data.items, true);
- }
- }
- } 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, records, success;
-
- 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,
- data = me.getData(),
- addRecords, 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);
- }
- me.afterLoadRecords(records);
- },
- afterLoadRecords: function(records) {
- var me = this,
- length = records.length,
- i;
- 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) {
- var operation;
- options = Ext.apply({}, options);
- this.setLoadOptions(options);
- 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() {
- var i, s;
- for (i = 0; (s = arguments[i]); i++) {
- this.add(s);
- }
- },
-
- unregister: function() {
- var i, s;
- for (i = 0; (s = arguments[i]); i++) {
- this.remove(this.lookup(s));
- }
- },
-
- lookup: function(store, defaultType) {
- var first, data, arrays, fields, i, len;
-
- if (Ext.isArray(store)) {
- first = store[0];
- data = store;
- 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.ignoreLeaked = true;
-
- 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, className, namespace, match;
- namespaceRe = cls.prototype.isProfile ? Controller.profileRegex : Controller.controllerRegex;
-
- 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, namespace;
-
-
- 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() {
- if (Ext.referencesDirty) {
- Ext.fixReferences();
- }
- return this.nameRefs || null;
- },
-
- getReferences: function() {
- if (Ext.referencesDirty) {
- Ext.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) {
-
-
-
- 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.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,
- 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, 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) {
- var parent;
- for (parent = this; parent = parent.parent; ) {
-
- if (parent === item) {
- return true;
- }
- }
- return false;
- },
- isAvailable: function() {
- return true;
- },
- isLoading: function() {
- return false;
- },
- onSchedule: function() {
- var i, len, binding, bindings, p;
-
-
-
-
- for (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;
- 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() {
- var bindings = this.bindings,
- n = bindings.length;
- for (; n-- > 0; ) {
- if (bindings[n].isLoading()) {
- return true;
- }
- }
- return false;
- },
- isAvailable: function() {
- var bindings = this.bindings,
- n = bindings.length;
- for (; 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,
- 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,
- type: 'boolean'
- },
- ERROR = {
- error: true
- },
- IDENT = {
- ident: true
- },
- LITERAL = {
- literal: true
- },
- NULL = {
- literal: true,
- nil: true
- },
- NUMBER = {
- literal: true,
- number: true,
- type: 'number'
- },
- STRING = {
- literal: true,
- string: true,
- type: 'string'
- };
-
- 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',
- '!': 'not',
- ',': 'comma',
- ':': 'colon',
- '[': 'arrayOpen',
- ']': 'arrayClose',
- '{': 'curlyOpen',
- '}': 'curlyClose',
- '(': 'parenOpen',
- ')': 'parenClose'
- },
- patterns: null
- },
-
- error: null,
-
- index: -1,
- constructor: function(config) {
- this.operators = {};
- this.patterns = [];
- 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',
- name: name,
- value: op,
- is: {
- operator: true
- }
- };
- def.is[name] = true;
- } else {
- block.token = null;
- }
- }
- },
- applyPatterns: function(pat) {
- var patterns = this.patterns,
- def, extract, name, re;
- for (name in pat) {
- def = pat[name];
- extract = def.extract;
- re = def.re;
- delete def.extract;
- delete def.re;
- patterns.push({
- name: name,
- re: re,
- extract: extract,
- token: def
- });
- }
- },
-
- 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,
- patterns = me.patterns,
- i, match, pat, ret;
-
- if (c === '.' && me.pos + 1 < length) {
- if (digitRe.test(text.charAt(me.pos + 1))) {
- ret = me.parseNumber();
- }
- }
- if (!ret) {
- for (i = 0; i < patterns.length; ++i) {
- pat = patterns[i];
- pat.re.lastIndex = me.pos;
- match = pat.re.exec(text);
- if (match && match.index === me.pos) {
- ret = Ext.apply({
- value: pat.extract ? pat.extract(match) : match[0]
- }, pat.token);
- me.pos += match[0].length;
- break;
- }
- }
- }
- 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) {
- break;
- }
- ++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: {
- '===': 40,
- '!==': 40,
- '==': 40,
- '!=': 40,
- '<': 40,
- '<=': 40,
- '>': 40,
- '>=': 40,
- '+': 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, name, 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 + '"');
- }
- name = token.name;
- } 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.is = is;
- symbol.value = value;
- if (!symbol.arity) {
- symbol.arity = token.type;
- }
- if (name) {
- symbol.name = name;
- }
- 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) {
- var id;
- for (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;
- }
- }
- },
- 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 me = this,
- fn;
-
- try {
-
- fn = me.parseSlot({
- arity: 'formatter',
- fmt: me.parseFmt(),
- operand: {
- arity: 'ident',
- value: 'dummy'
- }
- });
- me.expect('(end)');
- }
- catch (e) {
- Ext.raise('Invalid format expression: "' + me.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, lastEscaped, c, prev, key;
-
- for (key in me._initters) {
- delete me[key];
- }
- me.tokens = [];
- me.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',
- mixins: [
- Ext.data.LocalStore
- ],
-
- isChainedStore: true,
- config: {
-
- source: null,
- remoteFilter: false,
- remoteSort: false
- },
- syncSourceGrouping: false,
-
- 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.syncSourceGrouping) {
- me.setGrouper(source.getGrouper());
- }
- 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;
- if (me.activeRanges && info.newIndex !== info.oldIndex) {
- me.syncActiveRanges();
- }
-
-
-
- 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,
- lastCollectionRefesh: null,
- onCollectionRefresh: function(collection) {
- var me = this,
- gen = collection.generation;
- if (!me.isConfiguring && me.lastCollectionRefesh !== gen) {
- me.lastCollectionRefesh = gen;
- me.fireEvent('datachanged', me);
- me.fireEvent('refresh', me);
- }
- },
- 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() {
- var me = this;
- if (me.getData().generation === me.lastCollectionRefesh && !me.getRemoteFilter()) {
- me.suppressNextFilter = true;
- }
- me.callParent(arguments);
- me.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,
- gen = me.getData().generation;
- if (me.lastCollectionRefesh !== gen) {
- me.lastCollectionRefesh = gen;
- me.fireEvent('refresh', me);
- me.fireEvent('datachanged', me);
- }
- },
- onSourceGrouperChange: function(source, grouper) {
- if (this.syncSourceGrouping) {
- this.setGrouper(grouper);
- }
- },
- 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.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) {
- var link;
- for (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 = {};
- if (me.id == null) {
- 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(),
- pageNumber, page, i, j, 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),
- result, i, len;
- 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.ClientStore', {
- extend: Ext.data.Store,
- alias: 'store.clientstorage',
- config: {
-
- storage: 'local',
-
- storageKey: null
- },
- trackRemoved: false,
- proxy: {
- type: 'memory',
- clearOnRead: true
- },
- sync: function(options) {
- var me = this,
- key = me._getKey(),
- storage = me.getStorage(),
- source = me.getDataSource(),
- proxy = me.getProxy(),
- writer = proxy.getWriter(),
- writeAll = writer.getWriteAllFields(),
- data = [];
- try {
- me.suspendAutoSync();
- writer.setWriteAllFields(true);
- source.each(function(rec) {
- if (rec.phantom) {
- rec.setId(me.nextId());
- }
- data.push(writer.getRecordData(rec));
- rec.commit();
- });
- if (data.length) {
- data = JSON.stringify(data);
- data = storage.setItem(key, data);
- } else {
- storage.removeItem(key);
- }
- if (options && options.success) {
- Ext.callback(options.success, options.scope || proxy, [
- null,
- options
- ]);
- }
- } catch (e) {
- if (options && options.failure) {
- Ext.callback(options.failure, options.scope || proxy, [
- null,
- options
- ]);
- }
- } finally {
- me.resumeAutoSync();
- writer.setWriteAllFields(writeAll);
- }
- if (options && options.callback) {
- Ext.callback(options.callback, options.scope || proxy, [
- null,
- options
- ]);
- }
- return me;
- },
- applyStorage: function(storage) {
- var ret = Ext.global[storage + 'Storage'];
-
- if (!ret || !ret.getItem || !ret.setItem) {
- Ext.raise('Invalid storage config "' + storage + '"; ' + 'expected "local" or "session"');
- }
-
- return ret;
- },
- updateProxy: function(proxy, oldProxy) {
- var me = this,
- key = me._getKey(),
- storage = me.getStorage(),
- data;
- me.callParent([
- proxy,
- oldProxy
- ]);
- data = storage.getItem(key);
- if (data) {
- proxy.setData(JSON.parse(data));
- }
- },
- privates: {
- _getKey: function() {
- var key = this.getStorageKey();
-
- if (!key) {
- Ext.raise('ClientStore requires a storageKey');
- }
-
- return key;
- },
- nextId: function() {
- var source = this.getDataSource(),
- id = 1;
- while (source.containsKey(id)) {
- ++id;
- }
- return id;
- }
- }
- });
- 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;
- 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) {
- var proxy;
- config = Ext.apply({}, config);
- if (!config.proxy) {
- 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, childInfo, children, childCount, i;
- commit = {
- silent: true,
- commit: commit
- };
-
-
- if (info.depth != null && info.depth !== me.data.depth) {
- childInfo = {
- depth: info.depth + 1
- };
- children = me.childNodes;
- childCount = children.length;
- 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,
- treeStore = me.getTreeStore(),
- bulkUpdate = treeStore && treeStore.bulkUpdate,
- childInfo = {
- isLast: true,
- parentId: me.getId(),
- depth: (me.data.depth || 0) + 1
- },
- oldParent, previousSibling, modifiedFields, index, result, i, ln;
-
- 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;
- }
- }
-
-
-
- if (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();
-
- if (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;
-
- 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,
- treeStore = me.getTreeStore(),
- node, i, len;
-
-
-
- me.callParent();
-
- if (parentNode) {
-
-
- parentNode.removeChild(me);
- }
-
-
- else if (me.get('root')) {
- treeStore.setRoot(null);
- }
-
-
-
-
-
- if (treeStore) {
- treeStore.beginUpdate();
- }
-
-
- for (i = 0 , len = childNodes ? childNodes.length : 0; i < len; i++) {
- node = childNodes[i];
-
-
- node.clear();
-
- node.drop();
- }
-
- if (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;
- }
- }
-
-
-
-
-
- if (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,
- childNodes, length, i;
- 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) {
- childNodes = me.childNodes;
- for (i = 0 , length = childNodes.length; 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,
- i, len, n, res;
- for (i = 0 , len = cs.length; 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,
- info = {
- isFirst: true
- },
- i, n;
- 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, collapsedAncestors, i;
-
-
-
- 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,
- allNodes = me.childNodes,
- ln = allNodes.length,
- collapseNodes = [],
- node, i;
-
- 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) {
- var pieces, parts, len, i, p;
- if (state === undefined) {
- pieces = this._parseCls(this.data.cls);
- parts = this._parseCls(cls);
- for (i = 0 , len = parts.length; 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;
- if (parent === me.getNode()) {
- 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.query.Compiler', {
- compile: function() {
-
- var me = this,
- ast = me.ast,
- body, factory, vars;
- me.error = null;
- if (!ast) {
- me.fn = Ext.returnTrue;
- } else {
- body = [
- 'return function (item) {',
- '\tvar rec = item.isEntity && item;',
- '\treturn '
- ];
- vars = [];
- me.query = me;
- me.assemble(body, vars, '\t', ast);
- body.push('}');
- body = vars.concat(body).join('\n');
- try {
- factory = new Function('Ext', 'O', 'F', body);
- me.fn = factory(Ext, me.operators, me.getFunctions());
- me.fn.generation = me.generation;
- } catch (e) {
- me.error = e;
- e.message = 'Failed to compile: ' + e.message;
- throw e;
- } finally {
- me.query = null;
- }
- }
- },
- privates: {
- asmOps: {
- '>': 'gt',
- '<': 'lt',
- '==': 'eq',
- '>=': 'ge',
- '<=': 'le',
- '!=': 'ne'
- },
- assemblers: {
- binary: function(me, body, vars, indent, node, last, childIndent) {
- var op = me.operatorTypeMap[node.type][1],
- asmOp = me.asmOps[op],
- operands = node.on,
- close = '',
- i;
- if (asmOp) {
- body[last] += 'O.' + asmOp + '(';
- op = ', ';
- close = ')';
- } else {
- op = ' ' + op + ' ';
- }
- body[last] += '(';
- for (i = 0; i < operands.length; ++i) {
- if (i) {
- body.push(indent + ')' + op + '(');
- }
- body.push(childIndent);
- me.assemble(body, vars, childIndent, operands[i]);
- }
- body.push(indent + ')' + close);
- },
- between: function(me, body, vars, indent, node, last, childIndent) {
- var operands = node.on,
- i;
- body[last] += 'O.between(';
- for (i = 0; i < 3; ++i) {
- if (i) {
- last = body.length - 1;
- body[last] += ', ';
- }
- me.assemble(body, vars, childIndent, operands[i]);
- }
- body.push(indent + ')');
- },
- fn: function(me, body, vars, indent, node, last, childIndent) {
- var fn = node.fn.toLowerCase(),
- func = me.query.getFunctions(),
- exprs, i;
-
- if (!func[fn]) {
- Ext.raise('Unsupported function "' + node.fn + '"');
- }
-
- func = func[fn];
- if (func.vargs) {
- body[last] += 'F.' + fn + '.fn([';
- } else {
- body[last] += 'F.' + fn + '.fn(';
- }
- exprs = node.args;
- for (i = 0; i < exprs.length; ++i) {
- if (i) {
- last = body.length - 1;
- body[last] += ', ';
- }
- body.push(childIndent);
- me.assemble(body, vars, childIndent, exprs[i]);
- }
- if (func.vargs) {
- body.push(indent + '])');
- } else {
- body.push(indent + ')');
- }
- },
- id: function(me, body, vars, indent, node, last, childIndent) {
- var v = node.value,
- exprs = v.split('.');
- if (exprs.length === 1) {
- body[last] += 'rec ? rec.interpret(' + Ext.JSON.encode(v) + ') : item.' + v;
- } else {
- v = 'p' + vars.length;
- vars.push('var ' + v + ' = ' + Ext.JSON.encode(exprs) + ';');
- body[last] += 'O.dots(item, ' + v + ')';
- }
- },
- 'in': function(me, body, vars, indent, node, last, childIndent) {
- var operands = node.on;
- body[last] += 'O.in(';
- me.assemble(body, vars, childIndent, operands[0]);
- last = body.length - 1;
- body[last] += ', ';
- me.assemble(body, vars, childIndent, operands[1]);
- body.push(indent + ')');
- },
- like: function(me, body, vars, indent, node, last, childIndent) {
- var operands = node.on,
- rhs;
- body[last] += 'O.like(';
- me.assemble(body, vars, childIndent, operands[0]);
- last = body.length - 1;
- body[last] += ', ';
- rhs = operands[1];
- if (rhs.re) {
- rhs = {
- type: 'regexp',
- value: rhs.re,
- flags: rhs.flags
- };
- }
- me.assemble(body, vars, childIndent, rhs);
- last = body.length - 1;
- body[last] += ') ';
- },
- list: function(me, body, vars, indent, node, last, childIndent) {
- body[last] += '[';
-
- for (var i = 0,
- exprs = node.value; i < exprs.length; ++i) {
- if (i) {
- last = body.length - 1;
- body[last] += ', ';
- }
- body.push(childIndent);
- me.assemble(body, vars, childIndent, exprs[i]);
- }
- body.push(indent + ']');
- },
- string: 'regexp',
- regexp: function(me, body, vars, indent, node, last) {
- var re = 're' + vars.length;
- vars.push('var ' + re + ' = /' + (node.re || node.value) + '/' + (node.flags || '') + ';');
- body[last] += re;
- },
- unary: function(me, body, vars, indent, node, last, childIndent) {
- var op = me.operatorTypeMap[node.type][1],
- operands = node.on;
- body[last] += op + '(';
- body.push(childIndent);
- me.assemble(body, vars, childIndent, operands);
- body.push(indent + ')');
- }
- },
-
- operators: {
- between: function(val, lo, hi) {
- return lo <= val && val <= hi;
- },
- dots: function(item, names) {
- var i, ret;
- if (item.isEntity) {
- for (ret = item , i = 0; i < names.length; ++i) {
- if (!ret || !ret.interpret) {
- ret = undefined;
-
- break;
- }
- ret = ret.interpret(names[i]);
- }
- } else {
- for (ret = item , i = 0; i < names.length; ++i) {
- if (!ret) {
- ret = undefined;
- break;
- }
- ret = ret[names[i]];
- }
- }
- return ret;
- },
- 'in': function(val, values) {
- return Ext.Array.contains(values, val);
- },
- like: function(val, pat) {
- val = String(val);
- if (typeof pat === 'string') {
- return !!val && val.toLowerCase().indexOf(pat.toLowerCase()) > -1;
- }
- return pat.test(val);
- },
-
- eq: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return !Ext.Date.compare(lhs, rhs);
- }
- return lhs == rhs;
- },
-
- ge: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return Ext.Date.compare(lhs, rhs) >= 0;
- }
- return lhs >= rhs;
- },
- gt: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return Ext.Date.compare(lhs, rhs) > 0;
- }
- return lhs > rhs;
- },
- le: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return Ext.Date.compare(lhs, rhs) <= 0;
- }
- return lhs <= rhs;
- },
- lt: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return Ext.Date.compare(lhs, rhs) < 0;
- }
- return lhs < rhs;
- },
- ne: function(lhs, rhs) {
- if (lhs && rhs && (lhs instanceof Date || rhs instanceof Date)) {
- return !!Ext.Date.compare(lhs, rhs);
- }
- return lhs != rhs;
- }
- },
-
- assemble: function(body, vars, indent, node) {
- var me = this,
- assemblers = me.assemblers,
- t = typeof node,
- last = body.length - 1,
- childIndent = indent + '\t',
- type = node.type,
- arity, asm;
- if (t === 'boolean' || t === 'number') {
- body[last] += node;
- } else if (t === 'string') {
- body[last] += Ext.JSON.encode(node);
- } else {
- arity = me.operatorTypeMap[type];
- asm = assemblers[type] || (arity && assemblers[arity[0]]);
- if (typeof asm === 'string') {
- asm = assemblers[asm];
- }
- asm(me, body, vars, indent, node, body.length - 1, childIndent);
- }
- }
- }
- });
- Ext.define('Ext.data.query.Converter', {
-
- getFilters: function() {
- var me = this,
- ast = me.ast,
- exprToFilter = me.exprToFilter,
- operatorTypeMap = me.operatorTypeMap,
- fn = me.fn,
- on = ast && ast.on,
- expr, filter, filters, i, ident, n, op, ret, value, xlat;
- if (ast) {
-
-
- if (fn.hasOwnProperty('$filters')) {
- ret = fn.$filters;
- } else {
- if (ast.type === 'and' && on) {
- filters = [];
- for (i = 0 , n = on.length; i < n; ++i) {
- expr = on[i];
- ident = expr.on;
- if (!ident || ident.length !== 2) {
- break;
- }
- value = ident[1];
- ident = ident[0];
- if (ident.type !== 'id') {
- break;
- }
- if (!(xlat = exprToFilter[expr.type])) {
- op = operatorTypeMap[expr.type];
- if (!op || !(xlat = exprToFilter[op[0]])) {
- break;
- }
- }
- if (!(filter = xlat(expr, ident.value, value, op))) {
- break;
- }
- filters.push(filter);
- }
- if (i === n) {
- ret = filters;
- }
- }
- fn.$filters = ret;
- }
- } else {
- ret = null;
- }
- return ret;
- },
- setFilters: function(filters) {
- var me = this,
- ast = null,
- n = filters && filters.length,
- expr, filter, i, op, xlat;
- if (n) {
- ast = {
- type: 'and',
- on: []
- };
- for (i = 0; i < n; ++i) {
- filter = filters[i];
- if (!(xlat = me.filterToExpr[op = filter.operator])) {
- expr = {
- type: me.getOperatorType(op),
- on: [
- {
- type: 'id',
- value: filter.property
- },
- filter.value
- ]
- };
- } else {
- expr = xlat(filter);
- }
- ast.on.push(expr);
- }
- }
- me.ast = ast;
- me.refresh();
- },
- privates: {
- exprToFilter: {
- binary: function(expr, ident, value, info) {
- return Ext.isPrimitive(value) && {
- property: ident,
- operator: info[1],
- value: value
- };
- },
- 'in': function(expr, ident, value) {
- var i = 0,
- list = value.value;
- if (value.type === 'list' && Ext.isArray(list)) {
- for (i = list.length; i-- > 0; )
- {
- if (!Ext.isPrimitive(list[i])) {
- break;
- }
- }
- }
- return (i < 0) && {
- property: ident,
- operator: 'in',
- value: list
- };
- },
- like: function(expr, ident, value) {
- if (value.type === 'regexp') {
- return {
- property: ident,
- operator: '/=',
- value: value.value
- };
- }
- return (value.type === 'string') && {
- property: ident,
- operator: 'like',
- value: value.value
- };
- }
- },
- filterToExpr: {
- '/=': function(filter) {
- return {
- type: 'like',
- on: [
- {
- type: 'id',
- value: filter.property
- },
- {
- type: 'regexp',
- value: filter.value
- }
- ]
- };
- },
- 'in': function(filter) {
- return {
- type: 'in',
- on: [
- {
- type: 'id',
- value: filter.property
- },
- {
- type: 'list',
- value: filter.value
- }
- ]
- };
- },
- like: function(filter) {
- return {
- type: 'like',
- on: [
- {
- type: 'id',
- value: filter.property
- },
- {
- type: 'string',
- value: filter.value,
- re: filter.value,
- flags: 'i'
- }
- ]
- };
- }
- }
- }
- });
- Ext.define('Ext.data.query.Stringifier', {
- stringify: function(node) {
- var me = this,
- t = typeof node,
- type = node.type,
- operatorTypeMap = me.operatorTypeMap,
- priority = me.getPriority(node),
- stringifiers = me.stringifiers,
- op, stringifier;
- if (t === 'boolean' || t === 'number') {
- return String(node);
- }
- if (t === 'string') {
- return Ext.JSON.encode(node);
- }
- stringifier = stringifiers[type];
- if (!stringifier && type in operatorTypeMap) {
- op = operatorTypeMap[type];
- stringifier = stringifiers[op[0]];
- op = op[2] || op[1];
- }
- if (typeof stringifier === 'string') {
- stringifier = stringifiers[stringifier];
- }
- return stringifier(me, node, priority, op);
- },
- privates: {
- getPriority: function(node) {
- var symbols = this.symbols,
- operatorTypeMap = this.operatorTypeMap,
- type = node.type,
- ret = 1000000000,
- op;
- if (type === 'between') {
- ret = 0;
- ret = symbols[type].priority;
- } else if (type === 'and' || type === 'or' || type === 'in' || type === 'like') {
- ret = symbols[type].priority;
- } else if (type in operatorTypeMap) {
- op = operatorTypeMap[type];
- ret = symbols[op[1]].priority;
- }
- return ret;
- },
- stringifiers: {
- and: 'or',
- or: function(me, node, priority) {
- var op = (node.type === 'or') ? ' or ' : ' and ',
- s = '',
- on = node.on,
- i, lhs, parenL;
- for (i = 0; i < on.length; ++i) {
- if (s) {
- s += op;
- }
- lhs = on[i];
- parenL = me.getPriority(lhs) < priority;
- lhs = me.stringify(lhs);
- if (parenL) {
- lhs = '(' + lhs + ')';
- }
- s += lhs;
- }
- return s;
- },
- between: function(me, node, priority) {
- var on = node.on,
- lhs = on[0],
- parenL = me.getPriority(lhs) < priority,
- i, parenR, rhs, s;
- lhs = me.stringify(lhs);
- if (parenL) {
- lhs = '(' + lhs + ')';
- }
- s = lhs + ' between ';
- priority = me.symbols.and.priority;
- for (i = 0; i < 2; ++i) {
- if (i) {
- s += ' and ';
- }
- rhs = on[i + 1];
- parenR = i ? (rhs.type !== 'id' && !Ext.isPrimitive(rhs)) : (me.getPriority(rhs) < priority);
- rhs = me.stringify(rhs);
- if (parenR) {
- rhs = '(' + rhs + ')';
- }
- s += rhs;
- }
- return s;
- },
- binary: function(me, node, priority, op) {
- var on = node.on,
- lhs = on[0],
- rhs = on[1],
- parenL = me.getPriority(lhs) < priority,
- parenR = me.getPriority(rhs) < priority;
- lhs = me.stringify(lhs);
- rhs = me.stringify(rhs);
- if (parenL) {
- lhs = '(' + lhs + ')';
- }
- if (parenR) {
- rhs = '(' + rhs + ')';
- }
- return lhs + ' ' + op + ' ' + rhs;
- },
- fn: function(me, node) {
- return node.fn + '(' + me.stringifyArray(node.args) + ')';
- },
- id: function(me, node) {
- return node.value;
- },
- list: function(me, node) {
- return '(' + me.stringifyArray(node.value) + ')';
- },
- regexp: function(me, node) {
- return '/' + node.value + '/' + (node.flags || '');
- },
- string: function(me, node) {
- return Ext.JSON.encode(node.value);
- },
- unary: function(me, node, priority, op) {
- var on = node.on,
- rhs = me.stringify(on),
- t = on.type;
- if (t !== 'fn' && t !== 'id' && t !== 'unary') {
- rhs = '(' + rhs + ')';
- }
- return op + rhs;
- }
- },
- stringifyArray: function(array) {
- var s = '',
- i, expr;
- for (i = 0; i < array.length; ++i) {
- if (s) {
- s += ', ';
- }
- expr = array[i];
- expr = this.stringify(expr);
- s += expr;
- }
- return s;
- }
- }
- });
- Ext.define('Ext.data.query.Parser', function(QueryParser) {
-
- var LIST = {
- list: true,
- literal: true,
- type: 'list'
- };
- return {
- extend: Ext.parse.Parser,
- tokenizer: {
- keywords: {
- and: {
- type: 'operator',
- name: 'and',
- value: '&&',
- is: {
- operator: true
- }
- },
- or: {
- type: 'operator',
- name: 'or',
- value: '||',
- is: {
- operator: true
- }
- },
- not: {
- type: 'operator',
- name: 'not',
- value: '!',
- is: {
- operator: true
- }
- },
- between: {
- type: 'operator',
- name: 'between',
- value: 'between',
- is: {
- operator: true
- }
- },
- like: {
- type: 'operator',
- name: 'like',
- value: 'like',
- is: {
- operator: true
- }
- },
- 'in': {
- type: 'operator',
- name: 'in',
- value: 'in',
- is: {
- operator: true
- }
- }
- },
-
- operators: {
- '=': 'eq',
- '==': 'seq',
- '===': 'seq',
- '!==': 'sne',
- '!=': 'neq',
- '<>': 'neq',
- '<': 'lt',
- '<=': 'lte',
- '>': 'gt',
- '>=': 'gte',
- '&&': 'and',
- '||': 'or',
- ',': 'comma'
- },
-
- patterns: {
- regex: {
- type: 'literal',
- is: {
- literal: true,
- regexp: true,
- type: 'regexp'
- },
- re: /\/(?!\/)((?:\[.+?]|\\.|[^/\\\r\n])+)\/([gimyu]{0,5})/g,
- extract: function(match) {
- var body = match[1],
- flags = match[2];
- return flags ? [
- body,
- flags
- ] : body;
- }
- }
- }
- },
- infix: {
- '=': 40,
- '<>': 40,
- like: 40,
-
- between: {
- priority: 70,
- led: function(left) {
- var me = this,
- parser = me.parser;
- me.arity = 'between';
- me.operand = left;
- me.low = parser.parseExpression(parser.symbols.and.priority);
- parser.advance('&&');
- me.high = parser.parseExpression(80);
- return me;
- }
- },
- 'in': {
- priority: 40,
- led: function(left) {
- var me = this,
- parser = me.parser;
- parser.advance('(');
- me.arity = 'binary';
- me.lhs = left;
- me.rhs = {
- arity: 'literal',
- value: parser.parseList(),
- is: LIST
- };
- parser.advance(')');
- return me;
- }
- }
- },
- infixRight: {
- 'and': 30,
- 'or': 30
- },
- prefix: {
- not: 0
- },
- parse: function() {
- var expr = this.parseExpression();
- return this.convert(expr);
- },
- privates: {
- opCodes: {
- binary: {
- '=': 'eq',
- '>': 'gt',
- '<': 'lt',
- '>=': 'ge',
- '<=': 'le',
- '!=': 'ne',
- '<>': 'ne',
- '+': 'add',
- '/': 'div',
- '*': 'mul',
- '-': 'sub'
- },
- unary: {
- '-': 'neg',
- '!': 'not'
- }
- },
- convert: function(node) {
- var me = this,
- arity = node.arity,
- is = node.is,
- name = node.name,
- opCodes = me.opCodes,
- value = node.value,
- exprs, lhs, rhs, ret;
- switch (arity) {
- case 'between':
- ret = {
- type: 'between',
- on: [
- me.convert(node.operand),
- me.convert(node.low),
- me.convert(node.high)
- ]
- };
- break;
- case 'ident':
- ret = {
- type: 'id',
- value: value
- };
- break;
- case 'invoke':
- ret = {
- type: 'fn',
- fn: node.operand.value,
- args: me.convertArray(node.args)
- };
- break;
- case 'unary':
- ret = {
- type: opCodes.unary[value],
- on: me.convert(node.operand)
- };
- break;
- case 'binary':
- if (name === 'and' || name === 'or') {
- lhs = me.convert(node.lhs);
- rhs = me.convert(node.rhs);
- if (rhs.type === name) {
- exprs = rhs.on;
- exprs.unshift(lhs);
- } else {
- exprs = [
- lhs,
- rhs
- ];
- }
- ret = {
- type: name,
- on: exprs
- };
- } else {
- if (value === 'or') {
- value = '||';
- }
- ret = {
- type: opCodes.binary[value] || name,
- on: [
- me.convert(node.lhs),
- me.convert(node.rhs)
- ]
- };
- if (name === 'like') {
- ret.on[1] = me.likeToRe(ret.on[1], node.rhs.at);
- }
- };
- break;
- case 'literal':
- if (is.string || is.number || is.boolean) {
- ret = value;
- } else {
- ret = {
- type: is.type,
- value: value
- };
- if (is.list) {
- ret.value = me.convertArray(value);
- } else if (is.regexp && typeof value !== 'string') {
- ret.value = value[0];
- ret.flags = value[1];
- }
- };
- break;
- }
- if (ret && typeof ret === 'object' && !ret.type) {
- ret.type = arity;
- }
- return ret;
- },
- convertArray: function(array) {
- var ret = [],
- i = array.length;
- for (; i-- > 0; )
- {
- ret[i] = this.convert(array[i]);
- }
- return ret;
- },
- likeToRe: function(node, at) {
- if (typeof node === 'string') {
- node = {
- type: 'string',
- value: node
- };
- } else if (node.type === 'regexp') {
- return node;
- }
-
- var specialChars = this.specialChars || (QueryParser.prototype.specialChars = Ext.Array.toMap('.+*?^$=!|:-<>[](){}\\'.split(''))),
- like = node.value,
- n = like.length,
- re = '',
- simple = true,
- escape, c, i, start;
- outer: for (i = 0; i < n; ++i) {
- c = like[i];
- if (!escape) {
- if (c === '\\') {
- escape = c;
-
- continue;
- }
- if (c === '*' || c === '%') {
- re += '.*';
- simple = false;
-
- continue;
- }
- if (c === '?' || c === '_') {
- re += '.';
- simple = false;
-
- continue;
- }
-
- if (c === '[') {
- re += c;
- simple = false;
- start = i;
- while (++i < n) {
- c = like[i];
- if (escape) {
- re += escape + c;
- escape = 0;
- } else if (c === '\\') {
- escape = c;
- } else {
- re += c;
- if (c === ']') {
-
- continue outer;
- }
- }
- }
-
-
- this.syntaxError(start + (node.at || at || 0), 'Incomplete character set');
- }
- }
- escape = 0;
- if (specialChars[c]) {
- re += '\\';
- }
- re += c;
- }
- node.re = re || '.*';
-
-
-
-
- if (simple) {
- node.flags = 'i';
- } else {
- node.re = '^' + re + '$';
- }
- return node;
- },
- parseList: function() {
- var me = this,
- list = [];
- do {
- if (list.length) {
- me.advance();
- }
- list.push(me.parseExpression());
- } while (
- me.token.id === ',');
- return list;
- }
- }
- };
- });
- Ext.define('Ext.data.Query', {
- extend: Ext.util.BasicFilter,
- mixins: [
- Ext.mixin.Factoryable,
- Ext.data.query.Compiler,
- Ext.data.query.Converter,
- Ext.data.query.Stringifier
- ],
- alias: 'query.default',
- config: {
-
- format: 'ast',
-
- functions: {
- cached: true,
- $value: {
- abs: function(arg) {
- return Math.abs(arg);
- },
- 'avg...': function(args) {
- var count = 0,
- sum = 0,
- i = args.length,
- v;
- for (; i-- > 0; )
- {
- v = args[i];
- if (v != null) {
- sum += v;
- ++count;
- }
- }
- return count ? sum / count : 0;
- },
- date: function(arg) {
- return (arg instanceof Date) ? arg : Ext.Date.parse(arg);
- },
- lower: function(arg) {
- return (arg == null) ? '' : String(arg).toLowerCase();
- },
- 'max...': function(args) {
- var ret = null,
- i = args.length,
- v;
- for (; i-- > 0; )
- {
- v = args[i];
- if (v != null) {
- ret = (ret === null) ? v : (ret < v ? v : ret);
- }
- }
- return ret;
- },
- 'min...': function(args) {
- var ret = null,
- i = args.length,
- v;
- for (; i-- > 0; )
- {
- v = args[i];
- if (v != null) {
- ret = (ret === null) ? v : (ret < v ? ret : v);
- }
- }
- return ret;
- },
- 'sum...': function(args) {
- var ret = null,
- i = args.length,
- v;
- for (; i-- > 0; )
- {
- v = args[i];
- if (v != null) {
- ret = (ret === null) ? v : (ret + v);
- }
- }
- return ret === null ? 0 : ret;
- },
- upper: function(arg) {
- return (arg == null) ? '' : String(arg).toUpperCase();
- }
- }
- },
-
- source: ''
- },
- ast: null,
- error: null,
- generation: 0,
- constructor: function(config) {
- if (typeof config === 'string') {
- config = {
- source: config
- };
- }
-
- var parser = Ext.data.query.Parser.fly();
- this.symbols = parser.symbols;
- parser.release();
- this.callParent([
- config
- ]);
- },
- filter: function(item) {
- var me = this,
- error = me.error;
- if (error) {
- throw error;
- }
- return !!me.fn(item);
- },
-
- refresh: function() {
- ++this.generation;
- this.compile();
- },
-
- serialize: function() {
- var me = this,
- format = me.getFormat(),
- serializer = me.getSerializer(),
- ret, serialized;
- switch (format) {
- case 'ast':
- ret = me.ast;
- if (serializer) {
- ret = Ext.clone(ret);
- };
- break;
- case 'filters':
- ret = me.getFilters() || null;
- break;
- case 'query':
- ret = me.toString();
- break;
- }
- if (ret && serializer) {
- serialized = serializer.call(this, ret);
- if (serialized) {
- ret = serialized;
- }
- }
- return ret;
- },
- serializeTo: function(out) {
- var filters = this.serialize(),
- ret;
- if (filters && filters.length) {
- out.push.apply(out, filters);
- ret = true;
- }
- return ret;
- },
- sync: function() {
- var me = this,
- fn = me.fn;
- if (!fn || fn.generation !== me.generation) {
- me.compile();
- }
- },
- toString: function() {
- var ast = this.ast;
- return ast ? this.stringify(ast) : '';
- },
-
-
-
-
- validFormatsRe: /^(ast|filters|query)$/,
- applyFormat: function(format) {
- if (!this.validFormatsRe.test(format)) {
- Ext.raise('Invalid query format');
- }
- return format;
- },
-
-
- applyFunctions: function(funcs) {
- var ret = {},
- vargsRe = this.vargsRe,
- def, key, name;
- for (key in funcs) {
- def = {
- fn: funcs[name = key],
- vargs: vargsRe.test(key)
- };
- if (def.vargs) {
- name = key.substr(0, key.length - 3);
- }
-
- ret[name.toLowerCase()] = def;
- }
- return ret;
- },
-
- applySource: function(source) {
- if (source) {
- return source;
- }
- ++this.generation;
- this.ast = null;
- this.compile();
- },
-
- updateSource: function(source) {
- var me = this,
- parser = Ext.data.query.Parser.fly(source);
- ++me.generation;
- try {
- me.error = me.fn = null;
- me.ast = parser.parse();
- } catch (e) {
- me.error = e;
- e.message = 'Failed to parse: ' + e.message;
- throw e;
- } finally {
- parser.release();
- }
- me.compile();
- },
-
-
- privates: {
- operatorTypeMap: {
-
-
-
- and: [
- 'binary',
- '&&',
- 'and'
- ],
- or: [
- 'binary',
- '||',
- 'or'
- ],
- eq: [
- 'binary',
- '==',
- '='
- ],
- ge: [
- 'binary',
- '>=',
- null
- ],
- gt: [
- 'binary',
- '>',
- null
- ],
- le: [
- 'binary',
- '<=',
- null
- ],
- lt: [
- 'binary',
- '<',
- null
- ],
- ne: [
- 'binary',
- '!=',
- null
- ],
- add: [
- 'binary',
- '+',
- null
- ],
- div: [
- 'binary',
- '/',
- null
- ],
- mul: [
- 'binary',
- '*',
- null
- ],
- sub: [
- 'binary',
- '-',
- null
- ],
- 'in': [
- 'binary',
- null,
- 'in'
- ],
- like: [
- 'binary',
- null,
- 'like'
- ],
- seq: [
- 'binary',
- '===',
- '=='
- ],
- sne: [
- 'binary',
- '!==',
- null
- ],
- neg: [
- 'unary',
- '-',
- null
- ],
- not: [
- 'unary',
- '!',
- null
- ]
- },
-
-
- vargsRe: /\.\.\.$/,
- getOperatorType: function(op) {
- var map = this.operatorTypeMap,
- key;
- for (key in map) {
- if (map[key][1] === op || map[key][2] === op) {
- return key;
- }
- }
-
- Ext.raise('Unrecognized filter operator: "' + op + '"');
-
- return null;
- }
- }
- });
- 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) {
- var isNode;
- if (model) {
- 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,
- startNode, i;
-
- 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,
- removeRange = [],
- initial = me.isConfiguring,
- oldOwner, toRemove;
-
-
- 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) {
- var result = null,
- regex;
- if (Ext.isEmpty(value, false)) {
- return result;
- }
-
- if (fieldName === this.model.idProperty && arguments.length < 3) {
- return this.byIdMap[value];
- }
- regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase);
- 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,
- clearOnLoad = me.getClearOnLoad(),
- node, callback, scope, 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() {
- var me = this,
- root = me.getRoot(),
- ln = me.getData().length;
- me.suspendEvents();
- me.setRoot(null);
- me.resumeEvents();
- me.callParent();
- if (ln) {
- me.fireEvent('clear', me);
- me.fireEvent('rootchange', root, null);
- }
- },
- 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, i, 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) {
- var buf;
- if (typeof spec === "string") {
- return spec;
- }
- 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,
- r = cs,
- ri = -1,
- c, cj, i, 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) {
- var d;
- if (ns == root) {
- id = unescapeCssSelector(id);
- 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,
-
- lmode = path.match(modeRe),
- modeMatch, 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;
- 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 subOutput = [],
- key, datum, subKeys, subKeyLen, subObject, subObjects, lastObject, lastKey, i;
- 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() {
- var r, c, i;
- for (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;
- 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;
- 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.summary.None', {
- extend: Ext.data.summary.Base,
- alias: 'data.summary.none',
- config: {
-
- value: null
- },
- calculate: function() {
- return this.getValue();
- }
- });
- 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,
- store = me.pageMap.store,
- i, n, record;
- if (records) {
-
-
- n = records.length;
- if (by) {
- for (i = 0; i < n; ++i) {
- record = records[i];
- record.join(store);
- out[record[by]] = withIndex ? begin + i : record;
- }
- } else {
- for (i = 0; i < n; ++i) {
- records[i].join(store);
- 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;
-
- if (record) {
- 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;
-
- if (limit === 0) {
- return;
- }
- 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.fireGroupChange(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;
- },
-
- isLoaded: function() {
- return Ext.isNumber(this.totalCount);
- },
- 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));
- if (me.fireEvent('beforeload', me, operation) !== false) {
- me.onBeforeLoad(operation);
- operation.execute();
- } else {
- operation.setCompleted();
- }
- return operation;
- },
- reload: function(options) {
- var me = this;
- if (typeof options === 'function') {
- options = {
- callback: options
- };
- }
- 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 me = this,
- activeRanges = me.activeRanges,
- i;
- me.pageMap.clear();
- for (i = activeRanges.length; i-- > 0; ) {
- activeRanges[i].reset();
- }
- me.fireEvent('clear', me);
- },
-
- 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);
- },
-
- afterEdit: function(record, modifiedFieldNames) {
- var me = this;
- me.fireEvent('update', me, record, Ext.data.Model.EDIT, modifiedFieldNames);
- me.fireEvent('datachanged', me);
- },
- 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,
- resultSet = op.getResultSet(),
- wasSuccessful = op.wasSuccessful(),
- rsRecords = [],
- i, range;
- if (wasSuccessful) {
- me.readTotalCount(resultSet);
- me.fireEvent('reload', me, op);
- for (i = 0; i < len; ++i) {
- range = activeRanges[i];
- if (pageMap.canSatisfy(range)) {
- range.reload();
- }
- }
- }
- if (resultSet) {
- rsRecords = resultSet.records;
- }
- me.fireEvent('load', me, rsRecords, wasSuccessful, op);
- },
- 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(),
- rsRecords = [];
- if (pageMapGeneration === me.pageMap.generation) {
- if (op.wasSuccessful()) {
- me.readTotalCount(resultSet);
- me.attachSummaryData(resultSet);
- }
- callback.call(scope || page, op);
- me.groupSummaryData = null;
- if (resultSet) {
- rsRecords = resultSet.records;
- }
- me.fireEvent('load', me, rsRecords, op.wasSuccessful(), op);
- }
- }
- });
- },
- 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 (e) {}
- }
- }
-
-
-
- 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,
- 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) {
- var me = this,
- elements = me.elements,
- val, el, k, kLen;
- keys = [].concat(keys);
- for (k = 0 , kLen = keys.length; 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,
- i, ln;
- for (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.scrollbar.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();
- },
-
-
- 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();
- },
-
-
- 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) {
- var id;
- if (this.destroying) {
- return;
- }
- id = target.getId();
- this.targets[id] = null;
- delete this.targets[id];
- }
- }
- });
- 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) {
- var el;
- if (this.dragging) {
- 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 handle = this.getHandle(),
- o = {
- touchstart: 'handleTouchStart',
- dragstart: 'handleDragStart',
- drag: 'handleDragMove',
- dragend: 'handleDragEnd',
- dragcancel: 'handleDragCancel'
- };
- 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,
- focusFly = me.focusFly,
- targets = [],
- commonAncestor, node, 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) {
- var i;
- for (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) {
- var i, len;
- for (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() {
-
-
- var target = (top === window) ? Ext.getWin() : Ext.getBody();
- this.listenersAttached = true;
- target.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],
- hasCompletedSession = false,
- nameMap, nameList, sessions, name, session, map, list, i, ln, j, subLn;
- if (!runningData) {
- return;
- }
- nameMap = runningData.nameMap;
- nameList = runningData.nameList;
- sessions = runningData.sessions;
- 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(),
- 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) {
- var parent;
- if (!this.isConfiguring) {
- 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() {
- var items;
- for (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) {
- var toolDom;
- this.callParent([
- config
- ]);
- 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) {
- this.updateExpandCls();
- },
-
-
-
-
-
-
- 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,
- tool;
- me.element.toggleCls(me.selectedParentCls, selectedParent);
- 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,
- nodeappend: 'onNodeAppend',
- nodecollapse: 'onNodeCollapse',
- nodeexpand: 'onNodeExpand',
- nodeinsert: 'onNodeInsert',
- noderemove: 'onNodeRemove',
- rootchange: 'onRootChange',
- update: 'onNodeUpdate',
- refresh: 'onRefresh'
- });
- 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();
- }
- }
- },
-
- onNodeAppend: function(parentNode, node) {
- var item;
-
- if (parentNode) {
- 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) {
- var item;
-
-
-
- if (parentNode && !isMove) {
- 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);
- }
- },
-
- onRefresh: function(store) {
-
-
-
- this.onRootChange(store.getRoot());
- },
-
- 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.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(),
- store = me.getStore(),
- toRemove = [],
- record, i, len;
- if (!keepExisting && selectionCount) {
- toRemove = selected.getRange();
- }
-
- for (i = 0 , len = records.length; i < len; 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,
- selected, store, record, i, len;
- if (me.getDisableSelection()) {
- return;
- }
- records = Ext.isArray(records) ? records : [
- records
- ];
- selected = me.getSelected();
- store = me.getStore();
-
- for (i = 0 , len = records.length; 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: 'onOwnerStoreChange'
- },
-
- 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);
- },
- onOwnerStoreChange: function(comp, store) {
- this.setStore(store);
- },
-
-
- updateDataSource: function(source) {
- this.syncListeners(source, '$sourceListeners', 'getSourceListeners');
- },
-
- updateOwner: function(owner) {
- var me = this,
- ownerProperty = me.ownerProperty;
- if (ownerProperty) {
- me[ownerProperty] = owner;
- }
- me.syncListeners(owner, '$ownerListeners', 'getOwnerListeners');
- me.setStore(owner ? owner.getStore() : null);
- },
-
- applyStore: function(store) {
- return (store && !store.isEmptyStore) ? store : null;
- },
- updateStore: function(store) {
- this.syncListeners(store, '$storeListeners', 'getStoreListeners');
- this.syncDataSource();
- },
- privates: {
- syncDataSource: function() {
- var store = this.getStore(),
- source;
- if (!store) {
- source = null;
- } else if (store.getDataSource) {
- source = store.getDataSource();
- } else {
- source = store.getData();
- }
- this.setDataSource(source);
- },
- 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() {
- var interval, toolbox;
- getTimestamp = Ext.now;
-
- 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) {
- var data;
- 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;
- }
- });
- }
-
- 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() {
- var toolbox = Ext.senchaToolbox;
- Ext.perf.getTimestamp();
-
- if (toolbox) {
- this.get("GC");
- toolbox.watchGarbageCollector(false);
- }
- },
-
- setup: function(config) {
- var key, prop, accum, className, methods;
- if (!config) {
- config = {
-
-
-
-
-
-
-
-
- render: {
- 'Ext.Component': 'render'
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- layout: {
- 'Ext.layout.Context': 'run'
- }
- };
- }
- this.currentConfig = config;
- 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(),
-
- i;
- for (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 me = this,
- clippy = window.clipboardData,
- area, focusEl;
- if (clippy && clippy.setData) {
- clippy.setData("text", data);
- } else {
- 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, fill;
- 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) {
- var hsl;
- if (!factor && factor !== 0) {
- factor = this.lightnessFactor;
- }
- 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,
- r, g, b;
- if (me.a === 1) {
- 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 result = [],
- i, vl;
- 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,
- zeroAxis = me.getZeroAxis(),
- stackTotals = [],
- stackRangesNeg = [],
- isStackString, groupMin, groupMax, stackRanges, numValues, i, vlen, range, xAxisOffset, min, max, clipMin, clipMax, stacked, vlist, j, slen, svals, val, yoffset, yMaxCalc;
-
- 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,
- output = '',
- i = 0,
- chr1, chr2, chr3, enc1, enc2, enc3, enc4, len;
- input = me._utf8_encode(input);
- 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,
- output = '',
- i = 0,
- chr1, chr2, chr3, enc1, enc2, enc3, enc4, len;
- input = input.replace(/[^A-Za-z0-9+=\/]/g, "");
-
- 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) {
- var utftext = '',
- c, n, len;
- string = string.replace(/\r\n/g, "\n");
- for (n = 0 , len = string.length; n < len; n++) {
- 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.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) {
- var selectorText, selectorCount, j;
-
- if (cssRule.styleSheet) {
- return CSS.cacheStyleSheet(cssRule.styleSheet);
- }
- selectorText = cssRule.selectorText;
- 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.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,
-
-
- row = [],
- result = [
- row
- ],
- quote = quoteChar !== undefined ? quoteChar : me.quote,
- quoteREs = me.quoteREs,
- parseREs = me.parseREs,
- parseRE, dblQuoteRE, arrMatches, strMatchedDelimiter, strMatchedValue;
- delimiter = delimiter || me.delimiter;
-
-
- parseRE = parseREs[delimiter] || new RegExp(
- '(\\' + delimiter + '|\\r?\\n|\\r|^)' +
- '(?:\\' + quote + '([^\\' + quote + ']*(?:\\' + quote + '\\' + quote + '[^\\' + quote + ']*)*)\\' + quote + '|' +
- '([^\\' + delimiter + '\\r\\n]*))', 'gi');
- dblQuoteRE = quoteREs[quote] || (quoteREs[quote] = new RegExp('\\' + quote + '\\' + quote, 'g'));
-
-
- while ((arrMatches = parseRE.exec(input))) {
- strMatchedDelimiter = arrMatches[1];
-
-
-
-
- if (strMatchedDelimiter.length && strMatchedDelimiter !== delimiter) {
-
-
- result.push(row = []);
- }
-
- if (!arrMatches.index && arrMatches[0].charAt(0) === delimiter) {
- 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);
- }
- }
- });
- 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));
- },
- getPosition: function() {
- var me = this,
- position = me.position,
- parent = me.parent;
- position.x = parent.getScrollLeft();
- position.y = parent.getScrollTop();
- return position;
- }
- });
- 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.ClassManager.addNameAlternateMappings({
- "Ext.AbstractComponent": [],
- "Ext.AbstractManager": [],
- "Ext.ActionSheet": [],
- "Ext.Ajax": [],
- "Ext.Anim": [],
- "Ext.AnimationQueue": [],
- "Ext.Audio": [],
- "Ext.BreadcrumbBar": [],
- "Ext.Button": [],
- "Ext.Chip": [],
- "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.Responsive": [],
- "Ext.SegmentedButton": [
- "Ext.button.Segmented"
- ],
- "Ext.Sheet": [],
- "Ext.Spacer": [],
- "Ext.SplitButton": [],
- "Ext.Stateful": [],
- "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.ClientStore": [],
- "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.Query": [],
- "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.query.Compiler": [],
- "Ext.data.query.Converter": [],
- "Ext.data.query.Parser": [],
- "Ext.data.query.Stringifier": [],
- "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.None": [],
- "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.ChipView": [],
- "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.GroupStore": [],
- "Ext.dataview.IndexBar": [
- "Ext.IndexBar"
- ],
- "Ext.dataview.ItemHeader": [],
- "Ext.dataview.List": [
- "Ext.List"
- ],
- "Ext.dataview.ListCollapser": [],
- "Ext.dataview.ListGroup": [],
- "Ext.dataview.ListItem": [
- "Ext.dataview.component.ListItem"
- ],
- "Ext.dataview.ListItemPlaceholder": [],
- "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.dd.Manager": [],
- "Ext.dd.ScrollManager": [],
- "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.CheckboxGroup": [],
- "Ext.field.ChipViewNavigationModel": [],
- "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.Dirty": [],
- "Ext.field.Display": [
- "Ext.form.Display"
- ],
- "Ext.field.Email": [
- "Ext.form.Email"
- ],
- "Ext.field.Field": [
- "Ext.form.Field"
- ],
- "Ext.field.FieldGroupContainer": [],
- "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.RadioGroup": [],
- "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.GridDragZone": [],
- "Ext.grid.GridDropZone": [],
- "Ext.grid.HeaderContainer": [],
- "Ext.grid.HeaderDragZone": [],
- "Ext.grid.HeaderDropZone": [],
- "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.TreeDragZone": [],
- "Ext.grid.TreeDropZone": [],
- "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.Drag": [],
- "Ext.grid.column.Number": [],
- "Ext.grid.column.RowNumberer": [],
- "Ext.grid.column.Selection": [],
- "Ext.grid.column.Text": [],
- "Ext.grid.column.Tree": [],
- "Ext.grid.filters.Column": [],
- "Ext.grid.filters.Plugin": [],
- "Ext.grid.filters.menu.Base": [],
- "Ext.grid.filters.menu.Boolean": [],
- "Ext.grid.filters.menu.Date": [],
- "Ext.grid.filters.menu.Number": [],
- "Ext.grid.filters.menu.String": [],
- "Ext.grid.locked.Grid": [
- "Ext.grid.LockedGrid"
- ],
- "Ext.grid.locked.Region": [
- "Ext.grid.LockedGridRegion"
- ],
- "Ext.grid.menu.Columns": [],
- "Ext.grid.menu.GroupByThis": [],
- "Ext.grid.menu.Shared": [],
- "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.HeaderReorder": [],
- "Ext.grid.plugin.PagingToolbar": [],
- "Ext.grid.plugin.RowDragDrop": [],
- "Ext.grid.plugin.RowExpander": [],
- "Ext.grid.plugin.RowOperations": [
- "Ext.grid.plugin.MultiSelection"
- ],
- "Ext.grid.plugin.Summary": [
- "Ext.grid.plugin.SummaryRow"
- ],
- "Ext.grid.plugin.TreeDragDrop": [],
- "Ext.grid.plugin.ViewOptions": [],
- "Ext.grid.plugin.ViewOptionsListItem": [],
- "Ext.grid.rowedit.Bar": [],
- "Ext.grid.rowedit.Cell": [],
- "Ext.grid.rowedit.Editor": [],
- "Ext.grid.rowedit.Gap": [],
- "Ext.grid.rowedit.Plugin": [],
- "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.FieldDefaults": [],
- "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.mixin.Watchable": [],
- "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.Accordion": [],
- "Ext.panel.Buttons": [],
- "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.SelectPicker": [],
- "Ext.picker.Slot": [],
- "Ext.picker.Tablet": [],
- "Ext.plugin.Abstract": [
- "Ext.AbstractPlugin"
- ],
- "Ext.plugin.AbstractClipboard": [],
- "Ext.plugin.MouseEnter": [],
- "Ext.plugin.Responsive": [],
- "Ext.plugin.TabGuard": [],
- "Ext.plugin.dd.DragDrop": [],
- "Ext.plugin.dd.DragZone": [],
- "Ext.plugin.dd.DropZone": [],
- "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.NativeScroller": [],
- "Ext.scroll.Scroller": [],
- "Ext.scroll.VirtualScroller": [],
- "Ext.scroll.indicator.Bar": [],
- "Ext.scroll.indicator.Indicator": [],
- "Ext.scroll.indicator.Overlay": [],
- "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.state.Builder": [],
- "Ext.state.LocalStorage": [],
- "Ext.state.Provider": [],
- "Ext.state.Stateful": [],
- "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.BasicFilter": [],
- "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.HeightSynchronizer": [],
- "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.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.BreadcrumbBar": [
- "widget.breadcrumbbar"
- ],
- "Ext.Button": [
- "widget.button"
- ],
- "Ext.Chip": [
- "widget.chip"
- ],
- "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.Responsive": [],
- "Ext.SegmentedButton": [
- "widget.segmentedbutton"
- ],
- "Ext.Sheet": [
- "widget.sheet"
- ],
- "Ext.Spacer": [
- "widget.spacer"
- ],
- "Ext.SplitButton": [
- "widget.splitbutton"
- ],
- "Ext.Stateful": [],
- "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.ClientStore": [
- "store.clientstorage"
- ],
- "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.Query": [
- "query.default"
- ],
- "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.query.Compiler": [],
- "Ext.data.query.Converter": [],
- "Ext.data.query.Parser": [],
- "Ext.data.query.Stringifier": [],
- "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.None": [
- "data.summary.none"
- ],
- "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.ChipView": [
- "widget.chipview"
- ],
- "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.GroupStore": [],
- "Ext.dataview.IndexBar": [
- "widget.indexbar"
- ],
- "Ext.dataview.ItemHeader": [
- "widget.itemheader"
- ],
- "Ext.dataview.List": [
- "widget.list"
- ],
- "Ext.dataview.ListCollapser": [],
- "Ext.dataview.ListGroup": [],
- "Ext.dataview.ListItem": [
- "widget.listitem"
- ],
- "Ext.dataview.ListItemPlaceholder": [
- "widget.listitemplaceholder"
- ],
- "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.dd.Manager": [],
- "Ext.dd.ScrollManager": [],
- "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.CheckboxGroup": [
- "widget.checkboxgroup"
- ],
- "Ext.field.ChipViewNavigationModel": [
- "navmodel.fieldchipview"
- ],
- "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.Dirty": [],
- "Ext.field.Display": [
- "widget.displayfield"
- ],
- "Ext.field.Email": [
- "widget.emailfield"
- ],
- "Ext.field.Field": [
- "widget.field"
- ],
- "Ext.field.FieldGroupContainer": [
- "widget.groupcontainer"
- ],
- "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.RadioGroup": [
- "widget.radiogroup"
- ],
- "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.GridDragZone": [],
- "Ext.grid.GridDropZone": [],
- "Ext.grid.HeaderContainer": [
- "widget.headercontainer"
- ],
- "Ext.grid.HeaderDragZone": [],
- "Ext.grid.HeaderDropZone": [],
- "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.TreeDragZone": [],
- "Ext.grid.TreeDropZone": [],
- "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.Drag": [
- "widget.dragcolumn"
- ],
- "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.filters.Column": [],
- "Ext.grid.filters.Plugin": [
- "plugin.gridfilters"
- ],
- "Ext.grid.filters.menu.Base": [],
- "Ext.grid.filters.menu.Boolean": [
- "gridFilters.boolean"
- ],
- "Ext.grid.filters.menu.Date": [
- "gridFilters.date"
- ],
- "Ext.grid.filters.menu.Number": [
- "gridFilters.number"
- ],
- "Ext.grid.filters.menu.String": [
- "gridFilters.string"
- ],
- "Ext.grid.locked.Grid": [
- "widget.lockedgrid"
- ],
- "Ext.grid.locked.Region": [
- "widget.lockedgridregion"
- ],
- "Ext.grid.menu.Columns": [
- "widget.gridcolumnsmenu"
- ],
- "Ext.grid.menu.GroupByThis": [
- "widget.gridgroupbythismenuitem"
- ],
- "Ext.grid.menu.Shared": [],
- "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.HeaderReorder": [
- "plugin.headerreorder"
- ],
- "Ext.grid.plugin.PagingToolbar": [
- "plugin.gridpagingtoolbar",
- "plugin.pagingtoolbar"
- ],
- "Ext.grid.plugin.RowDragDrop": [
- "plugin.gridrowdragdrop"
- ],
- "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.TreeDragDrop": [
- "plugin.treedragdrop"
- ],
- "Ext.grid.plugin.ViewOptions": [
- "plugin.gridviewoptions"
- ],
- "Ext.grid.plugin.ViewOptionsListItem": [
- "widget.viewoptionslistitem"
- ],
- "Ext.grid.rowedit.Bar": [
- "widget.roweditorbar"
- ],
- "Ext.grid.rowedit.Cell": [
- "widget.roweditorcell"
- ],
- "Ext.grid.rowedit.Editor": [
- "widget.roweditor"
- ],
- "Ext.grid.rowedit.Gap": [
- "widget.roweditorgap"
- ],
- "Ext.grid.rowedit.Plugin": [
- "plugin.rowedit"
- ],
- "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.FieldDefaults": [],
- "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.mixin.Watchable": [],
- "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.Accordion": [
- "widget.accordion"
- ],
- "Ext.panel.Buttons": [],
- "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.SelectPicker": [
- "widget.selectpicker"
- ],
- "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.plugin.dd.DragDrop": [
- "plugin.viewdragdrop"
- ],
- "Ext.plugin.dd.DragZone": [],
- "Ext.plugin.dd.DropZone": [],
- "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.NativeScroller": [
- "scroller.native"
- ],
- "Ext.scroll.Scroller": [
- "scroller.scroller"
- ],
- "Ext.scroll.VirtualScroller": [
- "scroller.virtual"
- ],
- "Ext.scroll.indicator.Bar": [
- "scrollindicator.bar"
- ],
- "Ext.scroll.indicator.Indicator": [
- "scrollindicator.indicator"
- ],
- "Ext.scroll.indicator.Overlay": [
- "scrollindicator.overlay"
- ],
- "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.state.Builder": [],
- "Ext.state.LocalStorage": [],
- "Ext.state.Provider": [],
- "Ext.state.Stateful": [],
- "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.BasicFilter": [],
- "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.HeightSynchronizer": [],
- "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.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": []
- });
|