yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  10. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  11. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  12. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. };
  50. var comboGrid = {
  51. selectOnTab: true,
  52. pickerHeight: 500,
  53. pickerWidth: 850,
  54. editEnable: null,
  55. };
  56. var comboGridPicker = {
  57. xtype: 'yvgrid',
  58. layout: 'fit',
  59. selModel: {
  60. selType: 'rowmodel',
  61. mode: 'SINGLE'
  62. },
  63. };
  64. var comboGridMulti = {
  65. selectOnTab: true,
  66. pickerHeight: 500,
  67. pickerWidth: 850,
  68. editEnable: null,
  69. splitChar: ',',
  70. displayField: 'text',
  71. valueField: 'id',
  72. autoLoad: true,
  73. };
  74. var comboGridMultiPicker = {
  75. selType: 'checkboxmodel',
  76. selModel: {
  77. type: 'checkboxmodel',
  78. checkOnly: false
  79. },
  80. };
  81. var numberfield = {
  82. labelAlign: 'right',
  83. decimalPrecision: 6,
  84. labelWidth: labelWidth,
  85. };
  86. var checkbox = {
  87. labelAlign: 'right',
  88. labelWidth: labelWidth,
  89. checkedValue: true,
  90. uncheckedValue: false,
  91. };
  92. var checkboxgroup = {
  93. labelAlign: 'right',
  94. labelWidth: labelWidth,
  95. };
  96. var radio = {
  97. labelAlign: 'right',
  98. labelWidth: labelWidth,
  99. };
  100. var radiogroup = {
  101. labelAlign: 'right',
  102. labelWidth: labelWidth,
  103. simpleValue: true,
  104. layout: 'hbox',
  105. defaults: {
  106. xtype: 'radio',
  107. name: 'type',
  108. margin: '0 15 0 0'
  109. },
  110. };
  111. var form = {
  112. margin: '5 5 0 0',
  113. border: false,
  114. defaults: {
  115. margin: '0 0 5 0',
  116. border: false,
  117. },
  118. };
  119. var column = {
  120. filter: { type: 'string' },
  121. };
  122. var grid = {
  123. border: true,
  124. columnLines: true,
  125. rowLines: true,
  126. plugins: {
  127. cellediting: {
  128. clicksToEdit: 1,
  129. },
  130. gridfilters: true
  131. },
  132. multiColumnSort: true,
  133. viewConfig: {
  134. enableTextSelection: true,
  135. sortOnClick: false,
  136. emptyText: '没有数据'
  137. },
  138. selModel: {
  139. type: 'checkboxmodel',
  140. checkOnly: false
  141. },
  142. pagination: true,
  143. pageSize: 50,
  144. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  145. hideFootbar: false,
  146. hideRefresh: false,
  147. hideExport: false,
  148. hideAutoSize: false,
  149. hideClearFilter: false,
  150. hideSaveGridUIConfig: false,
  151. hideClearGridUIConfig: false,
  152. autoLoad: true,
  153. remoteSort: false,
  154. remoteFilter: false,
  155. enableLocking: true,
  156. syncRowHeight: false,
  157. enableColumnMove: true,
  158. enableColumnHide: true,
  159. enableColumnResize: true,
  160. hidden: false,
  161. disabled: false,
  162. exportExcelPageSize: 100,
  163. exportExcelCurrentPage: 1,
  164. exportExcelTotal: 0,
  165. cellTip: false,
  166. };
  167. var fieldContainer = {
  168. labelAlign: 'right',
  169. labelWidth: labelWidth,
  170. layout: 'hbox',
  171. defaults: {
  172. flex: 1,
  173. }
  174. };
  175. var tree = {
  176. autoLoad: true,
  177. hideFilter: false,
  178. hideToolbar: false,
  179. hideRefresh: false,
  180. hideExpand: false,
  181. hideCollapse: false,
  182. root: [],
  183. rootVisible: false,
  184. };
  185. var search = {
  186. labelAlign: 'right',
  187. labelWidth: labelWidth,
  188. };
  189. var text = {
  190. labelAlign: 'right',
  191. labelWidth: labelWidth,
  192. msgTarget: 'qtip',
  193. };
  194. var toolbar = {
  195. overflowHandler: 'menu',
  196. };
  197. var tbfill = {};
  198. var tbseparator = {};
  199. var button = {};
  200. var fieldSet = {
  201. margin: '5 5 0 0',
  202. border: false,
  203. defaults: {
  204. margin: '0 0 5 0',
  205. border: false,
  206. },
  207. };
  208. var storeAjax = {
  209. timeout: 60000
  210. };
  211. var panel = {};
  212. var splitter = {};
  213. var maintab = {};
  214. var rows = {};
  215. var cols = {
  216. defaults: {
  217. flex: 1
  218. },
  219. };
  220. var bpmn = {
  221. hideRefresh: false,
  222. autoLoad: true,
  223. dataSource: '',
  224. bpmnConfig: {}
  225. };
  226. //# sourceMappingURL=Defaults.js.map
  227. var Defaults = /*#__PURE__*/Object.freeze({
  228. __proto__: null,
  229. windows: windows,
  230. date: date,
  231. tagfield: tagfield,
  232. combo: combo,
  233. comboGrid: comboGrid,
  234. comboGridPicker: comboGridPicker,
  235. comboGridMulti: comboGridMulti,
  236. comboGridMultiPicker: comboGridMultiPicker,
  237. numberfield: numberfield,
  238. checkbox: checkbox,
  239. checkboxgroup: checkboxgroup,
  240. radio: radio,
  241. radiogroup: radiogroup,
  242. form: form,
  243. column: column,
  244. grid: grid,
  245. fieldContainer: fieldContainer,
  246. tree: tree,
  247. search: search,
  248. text: text,
  249. toolbar: toolbar,
  250. tbfill: tbfill,
  251. tbseparator: tbseparator,
  252. button: button,
  253. fieldSet: fieldSet,
  254. storeAjax: storeAjax,
  255. panel: panel,
  256. splitter: splitter,
  257. maintab: maintab,
  258. rows: rows,
  259. cols: cols,
  260. bpmn: bpmn
  261. });
  262. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  263. function createCommonjsModule(fn, module) {
  264. return module = { exports: {} }, fn(module, module.exports), module.exports;
  265. }
  266. var dist = createCommonjsModule(function (module, exports) {
  267. (function (global, factory) {
  268. module.exports = factory() ;
  269. }(commonjsGlobal, (function () {
  270. function createCommonjsModule(fn, module) {
  271. return module = { exports: {} }, fn(module, module.exports), module.exports;
  272. }
  273. var _global = createCommonjsModule(function (module) {
  274. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  275. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  276. ? window : typeof self != 'undefined' && self.Math == Math ? self
  277. // eslint-disable-next-line no-new-func
  278. : Function('return this')();
  279. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  280. });
  281. var _core = createCommonjsModule(function (module) {
  282. var core = module.exports = { version: '2.6.5' };
  283. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  284. });
  285. var _core_1 = _core.version;
  286. var _isObject = function (it) {
  287. return typeof it === 'object' ? it !== null : typeof it === 'function';
  288. };
  289. var _anObject = function (it) {
  290. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  291. return it;
  292. };
  293. var _fails = function (exec) {
  294. try {
  295. return !!exec();
  296. } catch (e) {
  297. return true;
  298. }
  299. };
  300. // Thank's IE8 for his funny defineProperty
  301. var _descriptors = !_fails(function () {
  302. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  303. });
  304. var document = _global.document;
  305. // typeof document.createElement is 'object' in old IE
  306. var is = _isObject(document) && _isObject(document.createElement);
  307. var _domCreate = function (it) {
  308. return is ? document.createElement(it) : {};
  309. };
  310. var _ie8DomDefine = !_descriptors && !_fails(function () {
  311. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  312. });
  313. // 7.1.1 ToPrimitive(input [, PreferredType])
  314. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  315. // and the second argument - flag - preferred type is a string
  316. var _toPrimitive = function (it, S) {
  317. if (!_isObject(it)) { return it; }
  318. var fn, val;
  319. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  320. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. throw TypeError("Can't convert object to primitive value");
  323. };
  324. var dP = Object.defineProperty;
  325. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  326. _anObject(O);
  327. P = _toPrimitive(P, true);
  328. _anObject(Attributes);
  329. if (_ie8DomDefine) { try {
  330. return dP(O, P, Attributes);
  331. } catch (e) { /* empty */ } }
  332. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  333. if ('value' in Attributes) { O[P] = Attributes.value; }
  334. return O;
  335. };
  336. var _objectDp = {
  337. f: f
  338. };
  339. var _propertyDesc = function (bitmap, value) {
  340. return {
  341. enumerable: !(bitmap & 1),
  342. configurable: !(bitmap & 2),
  343. writable: !(bitmap & 4),
  344. value: value
  345. };
  346. };
  347. var _hide = _descriptors ? function (object, key, value) {
  348. return _objectDp.f(object, key, _propertyDesc(1, value));
  349. } : function (object, key, value) {
  350. object[key] = value;
  351. return object;
  352. };
  353. var hasOwnProperty = {}.hasOwnProperty;
  354. var _has = function (it, key) {
  355. return hasOwnProperty.call(it, key);
  356. };
  357. var id = 0;
  358. var px = Math.random();
  359. var _uid = function (key) {
  360. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  361. };
  362. var _shared = createCommonjsModule(function (module) {
  363. var SHARED = '__core-js_shared__';
  364. var store = _global[SHARED] || (_global[SHARED] = {});
  365. (module.exports = function (key, value) {
  366. return store[key] || (store[key] = value !== undefined ? value : {});
  367. })('versions', []).push({
  368. version: _core.version,
  369. mode: 'global',
  370. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  371. });
  372. });
  373. var _functionToString = _shared('native-function-to-string', Function.toString);
  374. var _redefine = createCommonjsModule(function (module) {
  375. var SRC = _uid('src');
  376. var TO_STRING = 'toString';
  377. var TPL = ('' + _functionToString).split(TO_STRING);
  378. _core.inspectSource = function (it) {
  379. return _functionToString.call(it);
  380. };
  381. (module.exports = function (O, key, val, safe) {
  382. var isFunction = typeof val == 'function';
  383. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  384. if (O[key] === val) { return; }
  385. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  386. if (O === _global) {
  387. O[key] = val;
  388. } else if (!safe) {
  389. delete O[key];
  390. _hide(O, key, val);
  391. } else if (O[key]) {
  392. O[key] = val;
  393. } else {
  394. _hide(O, key, val);
  395. }
  396. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  397. })(Function.prototype, TO_STRING, function toString() {
  398. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  399. });
  400. });
  401. var _aFunction = function (it) {
  402. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  403. return it;
  404. };
  405. // optional / simple context binding
  406. var _ctx = function (fn, that, length) {
  407. _aFunction(fn);
  408. if (that === undefined) { return fn; }
  409. switch (length) {
  410. case 1: return function (a) {
  411. return fn.call(that, a);
  412. };
  413. case 2: return function (a, b) {
  414. return fn.call(that, a, b);
  415. };
  416. case 3: return function (a, b, c) {
  417. return fn.call(that, a, b, c);
  418. };
  419. }
  420. return function (/* ...args */) {
  421. return fn.apply(that, arguments);
  422. };
  423. };
  424. var PROTOTYPE = 'prototype';
  425. var $export = function (type, name, source) {
  426. var IS_FORCED = type & $export.F;
  427. var IS_GLOBAL = type & $export.G;
  428. var IS_STATIC = type & $export.S;
  429. var IS_PROTO = type & $export.P;
  430. var IS_BIND = type & $export.B;
  431. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  432. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  433. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  434. var key, own, out, exp;
  435. if (IS_GLOBAL) { source = name; }
  436. for (key in source) {
  437. // contains in native
  438. own = !IS_FORCED && target && target[key] !== undefined;
  439. // export native or passed
  440. out = (own ? target : source)[key];
  441. // bind timers to global for call from export context
  442. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  443. // extend global
  444. if (target) { _redefine(target, key, out, type & $export.U); }
  445. // export
  446. if (exports[key] != out) { _hide(exports, key, exp); }
  447. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  448. }
  449. };
  450. _global.core = _core;
  451. // type bitmap
  452. $export.F = 1; // forced
  453. $export.G = 2; // global
  454. $export.S = 4; // static
  455. $export.P = 8; // proto
  456. $export.B = 16; // bind
  457. $export.W = 32; // wrap
  458. $export.U = 64; // safe
  459. $export.R = 128; // real proto method for `library`
  460. var _export = $export;
  461. // 7.1.4 ToInteger
  462. var ceil = Math.ceil;
  463. var floor = Math.floor;
  464. var _toInteger = function (it) {
  465. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  466. };
  467. // 7.2.1 RequireObjectCoercible(argument)
  468. var _defined = function (it) {
  469. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  470. return it;
  471. };
  472. // true -> String#at
  473. // false -> String#codePointAt
  474. var _stringAt = function (TO_STRING) {
  475. return function (that, pos) {
  476. var s = String(_defined(that));
  477. var i = _toInteger(pos);
  478. var l = s.length;
  479. var a, b;
  480. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  481. a = s.charCodeAt(i);
  482. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  483. ? TO_STRING ? s.charAt(i) : a
  484. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  485. };
  486. };
  487. var $at = _stringAt(false);
  488. _export(_export.P, 'String', {
  489. // 21.1.3.3 String.prototype.codePointAt(pos)
  490. codePointAt: function codePointAt(pos) {
  491. return $at(this, pos);
  492. }
  493. });
  494. var codePointAt = _core.String.codePointAt;
  495. var max = Math.max;
  496. var min = Math.min;
  497. var _toAbsoluteIndex = function (index, length) {
  498. index = _toInteger(index);
  499. return index < 0 ? max(index + length, 0) : min(index, length);
  500. };
  501. var fromCharCode = String.fromCharCode;
  502. var $fromCodePoint = String.fromCodePoint;
  503. // length should be 1, old FF problem
  504. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  505. // 21.1.2.2 String.fromCodePoint(...codePoints)
  506. fromCodePoint: function fromCodePoint(x) {
  507. var arguments$1 = arguments;
  508. // eslint-disable-line no-unused-vars
  509. var res = [];
  510. var aLen = arguments.length;
  511. var i = 0;
  512. var code;
  513. while (aLen > i) {
  514. code = +arguments$1[i++];
  515. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  516. res.push(code < 0x10000
  517. ? fromCharCode(code)
  518. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  519. );
  520. } return res.join('');
  521. }
  522. });
  523. var fromCodePoint = _core.String.fromCodePoint;
  524. // This is a generated file. Do not edit.
  525. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  526. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  527. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  528. var unicode = {
  529. Space_Separator: Space_Separator,
  530. ID_Start: ID_Start,
  531. ID_Continue: ID_Continue
  532. };
  533. var util = {
  534. isSpaceSeparator: function isSpaceSeparator (c) {
  535. return typeof c === 'string' && unicode.Space_Separator.test(c)
  536. },
  537. isIdStartChar: function isIdStartChar (c) {
  538. return typeof c === 'string' && (
  539. (c >= 'a' && c <= 'z') ||
  540. (c >= 'A' && c <= 'Z') ||
  541. (c === '$') || (c === '_') ||
  542. unicode.ID_Start.test(c)
  543. )
  544. },
  545. isIdContinueChar: function isIdContinueChar (c) {
  546. return typeof c === 'string' && (
  547. (c >= 'a' && c <= 'z') ||
  548. (c >= 'A' && c <= 'Z') ||
  549. (c >= '0' && c <= '9') ||
  550. (c === '$') || (c === '_') ||
  551. (c === '\u200C') || (c === '\u200D') ||
  552. unicode.ID_Continue.test(c)
  553. )
  554. },
  555. isDigit: function isDigit (c) {
  556. return typeof c === 'string' && /[0-9]/.test(c)
  557. },
  558. isHexDigit: function isHexDigit (c) {
  559. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  560. },
  561. };
  562. var source;
  563. var parseState;
  564. var stack;
  565. var pos;
  566. var line;
  567. var column;
  568. var token;
  569. var key;
  570. var root;
  571. var parse = function parse (text, reviver) {
  572. source = String(text);
  573. parseState = 'start';
  574. stack = [];
  575. pos = 0;
  576. line = 1;
  577. column = 0;
  578. token = undefined;
  579. key = undefined;
  580. root = undefined;
  581. do {
  582. token = lex();
  583. // This code is unreachable.
  584. // if (!parseStates[parseState]) {
  585. // throw invalidParseState()
  586. // }
  587. parseStates[parseState]();
  588. } while (token.type !== 'eof')
  589. if (typeof reviver === 'function') {
  590. return internalize({'': root}, '', reviver)
  591. }
  592. return root
  593. };
  594. function internalize (holder, name, reviver) {
  595. var value = holder[name];
  596. if (value != null && typeof value === 'object') {
  597. for (var key in value) {
  598. var replacement = internalize(value, key, reviver);
  599. if (replacement === undefined) {
  600. delete value[key];
  601. } else {
  602. value[key] = replacement;
  603. }
  604. }
  605. }
  606. return reviver.call(holder, name, value)
  607. }
  608. var lexState;
  609. var buffer;
  610. var doubleQuote;
  611. var sign;
  612. var c;
  613. function lex () {
  614. lexState = 'default';
  615. buffer = '';
  616. doubleQuote = false;
  617. sign = 1;
  618. for (;;) {
  619. c = peek();
  620. // This code is unreachable.
  621. // if (!lexStates[lexState]) {
  622. // throw invalidLexState(lexState)
  623. // }
  624. var token = lexStates[lexState]();
  625. if (token) {
  626. return token
  627. }
  628. }
  629. }
  630. function peek () {
  631. if (source[pos]) {
  632. return String.fromCodePoint(source.codePointAt(pos))
  633. }
  634. }
  635. function read () {
  636. var c = peek();
  637. if (c === '\n') {
  638. line++;
  639. column = 0;
  640. } else if (c) {
  641. column += c.length;
  642. } else {
  643. column++;
  644. }
  645. if (c) {
  646. pos += c.length;
  647. }
  648. return c
  649. }
  650. var lexStates = {
  651. default: function default$1 () {
  652. switch (c) {
  653. case '\t':
  654. case '\v':
  655. case '\f':
  656. case ' ':
  657. case '\u00A0':
  658. case '\uFEFF':
  659. case '\n':
  660. case '\r':
  661. case '\u2028':
  662. case '\u2029':
  663. read();
  664. return
  665. case '/':
  666. read();
  667. lexState = 'comment';
  668. return
  669. case undefined:
  670. read();
  671. return newToken('eof')
  672. }
  673. if (util.isSpaceSeparator(c)) {
  674. read();
  675. return
  676. }
  677. // This code is unreachable.
  678. // if (!lexStates[parseState]) {
  679. // throw invalidLexState(parseState)
  680. // }
  681. return lexStates[parseState]()
  682. },
  683. comment: function comment () {
  684. switch (c) {
  685. case '*':
  686. read();
  687. lexState = 'multiLineComment';
  688. return
  689. case '/':
  690. read();
  691. lexState = 'singleLineComment';
  692. return
  693. }
  694. throw invalidChar(read())
  695. },
  696. multiLineComment: function multiLineComment () {
  697. switch (c) {
  698. case '*':
  699. read();
  700. lexState = 'multiLineCommentAsterisk';
  701. return
  702. case undefined:
  703. throw invalidChar(read())
  704. }
  705. read();
  706. },
  707. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  708. switch (c) {
  709. case '*':
  710. read();
  711. return
  712. case '/':
  713. read();
  714. lexState = 'default';
  715. return
  716. case undefined:
  717. throw invalidChar(read())
  718. }
  719. read();
  720. lexState = 'multiLineComment';
  721. },
  722. singleLineComment: function singleLineComment () {
  723. switch (c) {
  724. case '\n':
  725. case '\r':
  726. case '\u2028':
  727. case '\u2029':
  728. read();
  729. lexState = 'default';
  730. return
  731. case undefined:
  732. read();
  733. return newToken('eof')
  734. }
  735. read();
  736. },
  737. value: function value () {
  738. switch (c) {
  739. case '{':
  740. case '[':
  741. return newToken('punctuator', read())
  742. case 'n':
  743. read();
  744. literal('ull');
  745. return newToken('null', null)
  746. case 't':
  747. read();
  748. literal('rue');
  749. return newToken('boolean', true)
  750. case 'f':
  751. read();
  752. literal('alse');
  753. return newToken('boolean', false)
  754. case '-':
  755. case '+':
  756. if (read() === '-') {
  757. sign = -1;
  758. }
  759. lexState = 'sign';
  760. return
  761. case '.':
  762. buffer = read();
  763. lexState = 'decimalPointLeading';
  764. return
  765. case '0':
  766. buffer = read();
  767. lexState = 'zero';
  768. return
  769. case '1':
  770. case '2':
  771. case '3':
  772. case '4':
  773. case '5':
  774. case '6':
  775. case '7':
  776. case '8':
  777. case '9':
  778. buffer = read();
  779. lexState = 'decimalInteger';
  780. return
  781. case 'I':
  782. read();
  783. literal('nfinity');
  784. return newToken('numeric', Infinity)
  785. case 'N':
  786. read();
  787. literal('aN');
  788. return newToken('numeric', NaN)
  789. case '"':
  790. case "'":
  791. doubleQuote = (read() === '"');
  792. buffer = '';
  793. lexState = 'string';
  794. return
  795. }
  796. throw invalidChar(read())
  797. },
  798. identifierNameStartEscape: function identifierNameStartEscape () {
  799. if (c !== 'u') {
  800. throw invalidChar(read())
  801. }
  802. read();
  803. var u = unicodeEscape();
  804. switch (u) {
  805. case '$':
  806. case '_':
  807. break
  808. default:
  809. if (!util.isIdStartChar(u)) {
  810. throw invalidIdentifier()
  811. }
  812. break
  813. }
  814. buffer += u;
  815. lexState = 'identifierName';
  816. },
  817. identifierName: function identifierName () {
  818. switch (c) {
  819. case '$':
  820. case '_':
  821. case '\u200C':
  822. case '\u200D':
  823. buffer += read();
  824. return
  825. case '\\':
  826. read();
  827. lexState = 'identifierNameEscape';
  828. return
  829. }
  830. if (util.isIdContinueChar(c)) {
  831. buffer += read();
  832. return
  833. }
  834. return newToken('identifier', buffer)
  835. },
  836. identifierNameEscape: function identifierNameEscape () {
  837. if (c !== 'u') {
  838. throw invalidChar(read())
  839. }
  840. read();
  841. var u = unicodeEscape();
  842. switch (u) {
  843. case '$':
  844. case '_':
  845. case '\u200C':
  846. case '\u200D':
  847. break
  848. default:
  849. if (!util.isIdContinueChar(u)) {
  850. throw invalidIdentifier()
  851. }
  852. break
  853. }
  854. buffer += u;
  855. lexState = 'identifierName';
  856. },
  857. sign: function sign$1 () {
  858. switch (c) {
  859. case '.':
  860. buffer = read();
  861. lexState = 'decimalPointLeading';
  862. return
  863. case '0':
  864. buffer = read();
  865. lexState = 'zero';
  866. return
  867. case '1':
  868. case '2':
  869. case '3':
  870. case '4':
  871. case '5':
  872. case '6':
  873. case '7':
  874. case '8':
  875. case '9':
  876. buffer = read();
  877. lexState = 'decimalInteger';
  878. return
  879. case 'I':
  880. read();
  881. literal('nfinity');
  882. return newToken('numeric', sign * Infinity)
  883. case 'N':
  884. read();
  885. literal('aN');
  886. return newToken('numeric', NaN)
  887. }
  888. throw invalidChar(read())
  889. },
  890. zero: function zero () {
  891. switch (c) {
  892. case '.':
  893. buffer += read();
  894. lexState = 'decimalPoint';
  895. return
  896. case 'e':
  897. case 'E':
  898. buffer += read();
  899. lexState = 'decimalExponent';
  900. return
  901. case 'x':
  902. case 'X':
  903. buffer += read();
  904. lexState = 'hexadecimal';
  905. return
  906. }
  907. return newToken('numeric', sign * 0)
  908. },
  909. decimalInteger: function decimalInteger () {
  910. switch (c) {
  911. case '.':
  912. buffer += read();
  913. lexState = 'decimalPoint';
  914. return
  915. case 'e':
  916. case 'E':
  917. buffer += read();
  918. lexState = 'decimalExponent';
  919. return
  920. }
  921. if (util.isDigit(c)) {
  922. buffer += read();
  923. return
  924. }
  925. return newToken('numeric', sign * Number(buffer))
  926. },
  927. decimalPointLeading: function decimalPointLeading () {
  928. if (util.isDigit(c)) {
  929. buffer += read();
  930. lexState = 'decimalFraction';
  931. return
  932. }
  933. throw invalidChar(read())
  934. },
  935. decimalPoint: function decimalPoint () {
  936. switch (c) {
  937. case 'e':
  938. case 'E':
  939. buffer += read();
  940. lexState = 'decimalExponent';
  941. return
  942. }
  943. if (util.isDigit(c)) {
  944. buffer += read();
  945. lexState = 'decimalFraction';
  946. return
  947. }
  948. return newToken('numeric', sign * Number(buffer))
  949. },
  950. decimalFraction: function decimalFraction () {
  951. switch (c) {
  952. case 'e':
  953. case 'E':
  954. buffer += read();
  955. lexState = 'decimalExponent';
  956. return
  957. }
  958. if (util.isDigit(c)) {
  959. buffer += read();
  960. return
  961. }
  962. return newToken('numeric', sign * Number(buffer))
  963. },
  964. decimalExponent: function decimalExponent () {
  965. switch (c) {
  966. case '+':
  967. case '-':
  968. buffer += read();
  969. lexState = 'decimalExponentSign';
  970. return
  971. }
  972. if (util.isDigit(c)) {
  973. buffer += read();
  974. lexState = 'decimalExponentInteger';
  975. return
  976. }
  977. throw invalidChar(read())
  978. },
  979. decimalExponentSign: function decimalExponentSign () {
  980. if (util.isDigit(c)) {
  981. buffer += read();
  982. lexState = 'decimalExponentInteger';
  983. return
  984. }
  985. throw invalidChar(read())
  986. },
  987. decimalExponentInteger: function decimalExponentInteger () {
  988. if (util.isDigit(c)) {
  989. buffer += read();
  990. return
  991. }
  992. return newToken('numeric', sign * Number(buffer))
  993. },
  994. hexadecimal: function hexadecimal () {
  995. if (util.isHexDigit(c)) {
  996. buffer += read();
  997. lexState = 'hexadecimalInteger';
  998. return
  999. }
  1000. throw invalidChar(read())
  1001. },
  1002. hexadecimalInteger: function hexadecimalInteger () {
  1003. if (util.isHexDigit(c)) {
  1004. buffer += read();
  1005. return
  1006. }
  1007. return newToken('numeric', sign * Number(buffer))
  1008. },
  1009. string: function string () {
  1010. switch (c) {
  1011. case '\\':
  1012. read();
  1013. buffer += escape();
  1014. return
  1015. case '"':
  1016. if (doubleQuote) {
  1017. read();
  1018. return newToken('string', buffer)
  1019. }
  1020. buffer += read();
  1021. return
  1022. case "'":
  1023. if (!doubleQuote) {
  1024. read();
  1025. return newToken('string', buffer)
  1026. }
  1027. buffer += read();
  1028. return
  1029. case '\n':
  1030. case '\r':
  1031. throw invalidChar(read())
  1032. case '\u2028':
  1033. case '\u2029':
  1034. separatorChar(c);
  1035. break
  1036. case undefined:
  1037. throw invalidChar(read())
  1038. }
  1039. buffer += read();
  1040. },
  1041. start: function start () {
  1042. switch (c) {
  1043. case '{':
  1044. case '[':
  1045. return newToken('punctuator', read())
  1046. // This code is unreachable since the default lexState handles eof.
  1047. // case undefined:
  1048. // return newToken('eof')
  1049. }
  1050. lexState = 'value';
  1051. },
  1052. beforePropertyName: function beforePropertyName () {
  1053. switch (c) {
  1054. case '$':
  1055. case '_':
  1056. buffer = read();
  1057. lexState = 'identifierName';
  1058. return
  1059. case '\\':
  1060. read();
  1061. lexState = 'identifierNameStartEscape';
  1062. return
  1063. case '}':
  1064. return newToken('punctuator', read())
  1065. case '"':
  1066. case "'":
  1067. doubleQuote = (read() === '"');
  1068. lexState = 'string';
  1069. return
  1070. }
  1071. if (util.isIdStartChar(c)) {
  1072. buffer += read();
  1073. lexState = 'identifierName';
  1074. return
  1075. }
  1076. throw invalidChar(read())
  1077. },
  1078. afterPropertyName: function afterPropertyName () {
  1079. if (c === ':') {
  1080. return newToken('punctuator', read())
  1081. }
  1082. throw invalidChar(read())
  1083. },
  1084. beforePropertyValue: function beforePropertyValue () {
  1085. lexState = 'value';
  1086. },
  1087. afterPropertyValue: function afterPropertyValue () {
  1088. switch (c) {
  1089. case ',':
  1090. case '}':
  1091. return newToken('punctuator', read())
  1092. }
  1093. throw invalidChar(read())
  1094. },
  1095. beforeArrayValue: function beforeArrayValue () {
  1096. if (c === ']') {
  1097. return newToken('punctuator', read())
  1098. }
  1099. lexState = 'value';
  1100. },
  1101. afterArrayValue: function afterArrayValue () {
  1102. switch (c) {
  1103. case ',':
  1104. case ']':
  1105. return newToken('punctuator', read())
  1106. }
  1107. throw invalidChar(read())
  1108. },
  1109. end: function end () {
  1110. // This code is unreachable since it's handled by the default lexState.
  1111. // if (c === undefined) {
  1112. // read()
  1113. // return newToken('eof')
  1114. // }
  1115. throw invalidChar(read())
  1116. },
  1117. };
  1118. function newToken (type, value) {
  1119. return {
  1120. type: type,
  1121. value: value,
  1122. line: line,
  1123. column: column,
  1124. }
  1125. }
  1126. function literal (s) {
  1127. for (var i = 0, list = s; i < list.length; i += 1) {
  1128. var c = list[i];
  1129. var p = peek();
  1130. if (p !== c) {
  1131. throw invalidChar(read())
  1132. }
  1133. read();
  1134. }
  1135. }
  1136. function escape () {
  1137. var c = peek();
  1138. switch (c) {
  1139. case 'b':
  1140. read();
  1141. return '\b'
  1142. case 'f':
  1143. read();
  1144. return '\f'
  1145. case 'n':
  1146. read();
  1147. return '\n'
  1148. case 'r':
  1149. read();
  1150. return '\r'
  1151. case 't':
  1152. read();
  1153. return '\t'
  1154. case 'v':
  1155. read();
  1156. return '\v'
  1157. case '0':
  1158. read();
  1159. if (util.isDigit(peek())) {
  1160. throw invalidChar(read())
  1161. }
  1162. return '\0'
  1163. case 'x':
  1164. read();
  1165. return hexEscape()
  1166. case 'u':
  1167. read();
  1168. return unicodeEscape()
  1169. case '\n':
  1170. case '\u2028':
  1171. case '\u2029':
  1172. read();
  1173. return ''
  1174. case '\r':
  1175. read();
  1176. if (peek() === '\n') {
  1177. read();
  1178. }
  1179. return ''
  1180. case '1':
  1181. case '2':
  1182. case '3':
  1183. case '4':
  1184. case '5':
  1185. case '6':
  1186. case '7':
  1187. case '8':
  1188. case '9':
  1189. throw invalidChar(read())
  1190. case undefined:
  1191. throw invalidChar(read())
  1192. }
  1193. return read()
  1194. }
  1195. function hexEscape () {
  1196. var buffer = '';
  1197. var c = peek();
  1198. if (!util.isHexDigit(c)) {
  1199. throw invalidChar(read())
  1200. }
  1201. buffer += read();
  1202. c = peek();
  1203. if (!util.isHexDigit(c)) {
  1204. throw invalidChar(read())
  1205. }
  1206. buffer += read();
  1207. return String.fromCodePoint(parseInt(buffer, 16))
  1208. }
  1209. function unicodeEscape () {
  1210. var buffer = '';
  1211. var count = 4;
  1212. while (count-- > 0) {
  1213. var c = peek();
  1214. if (!util.isHexDigit(c)) {
  1215. throw invalidChar(read())
  1216. }
  1217. buffer += read();
  1218. }
  1219. return String.fromCodePoint(parseInt(buffer, 16))
  1220. }
  1221. var parseStates = {
  1222. start: function start () {
  1223. if (token.type === 'eof') {
  1224. throw invalidEOF()
  1225. }
  1226. push();
  1227. },
  1228. beforePropertyName: function beforePropertyName () {
  1229. switch (token.type) {
  1230. case 'identifier':
  1231. case 'string':
  1232. key = token.value;
  1233. parseState = 'afterPropertyName';
  1234. return
  1235. case 'punctuator':
  1236. // This code is unreachable since it's handled by the lexState.
  1237. // if (token.value !== '}') {
  1238. // throw invalidToken()
  1239. // }
  1240. pop();
  1241. return
  1242. case 'eof':
  1243. throw invalidEOF()
  1244. }
  1245. // This code is unreachable since it's handled by the lexState.
  1246. // throw invalidToken()
  1247. },
  1248. afterPropertyName: function afterPropertyName () {
  1249. // This code is unreachable since it's handled by the lexState.
  1250. // if (token.type !== 'punctuator' || token.value !== ':') {
  1251. // throw invalidToken()
  1252. // }
  1253. if (token.type === 'eof') {
  1254. throw invalidEOF()
  1255. }
  1256. parseState = 'beforePropertyValue';
  1257. },
  1258. beforePropertyValue: function beforePropertyValue () {
  1259. if (token.type === 'eof') {
  1260. throw invalidEOF()
  1261. }
  1262. push();
  1263. },
  1264. beforeArrayValue: function beforeArrayValue () {
  1265. if (token.type === 'eof') {
  1266. throw invalidEOF()
  1267. }
  1268. if (token.type === 'punctuator' && token.value === ']') {
  1269. pop();
  1270. return
  1271. }
  1272. push();
  1273. },
  1274. afterPropertyValue: function afterPropertyValue () {
  1275. // This code is unreachable since it's handled by the lexState.
  1276. // if (token.type !== 'punctuator') {
  1277. // throw invalidToken()
  1278. // }
  1279. if (token.type === 'eof') {
  1280. throw invalidEOF()
  1281. }
  1282. switch (token.value) {
  1283. case ',':
  1284. parseState = 'beforePropertyName';
  1285. return
  1286. case '}':
  1287. pop();
  1288. }
  1289. // This code is unreachable since it's handled by the lexState.
  1290. // throw invalidToken()
  1291. },
  1292. afterArrayValue: function afterArrayValue () {
  1293. // This code is unreachable since it's handled by the lexState.
  1294. // if (token.type !== 'punctuator') {
  1295. // throw invalidToken()
  1296. // }
  1297. if (token.type === 'eof') {
  1298. throw invalidEOF()
  1299. }
  1300. switch (token.value) {
  1301. case ',':
  1302. parseState = 'beforeArrayValue';
  1303. return
  1304. case ']':
  1305. pop();
  1306. }
  1307. // This code is unreachable since it's handled by the lexState.
  1308. // throw invalidToken()
  1309. },
  1310. end: function end () {
  1311. // This code is unreachable since it's handled by the lexState.
  1312. // if (token.type !== 'eof') {
  1313. // throw invalidToken()
  1314. // }
  1315. },
  1316. };
  1317. function push () {
  1318. var value;
  1319. switch (token.type) {
  1320. case 'punctuator':
  1321. switch (token.value) {
  1322. case '{':
  1323. value = {};
  1324. break
  1325. case '[':
  1326. value = [];
  1327. break
  1328. }
  1329. break
  1330. case 'null':
  1331. case 'boolean':
  1332. case 'numeric':
  1333. case 'string':
  1334. value = token.value;
  1335. break
  1336. // This code is unreachable.
  1337. // default:
  1338. // throw invalidToken()
  1339. }
  1340. if (root === undefined) {
  1341. root = value;
  1342. } else {
  1343. var parent = stack[stack.length - 1];
  1344. if (Array.isArray(parent)) {
  1345. parent.push(value);
  1346. } else {
  1347. parent[key] = value;
  1348. }
  1349. }
  1350. if (value !== null && typeof value === 'object') {
  1351. stack.push(value);
  1352. if (Array.isArray(value)) {
  1353. parseState = 'beforeArrayValue';
  1354. } else {
  1355. parseState = 'beforePropertyName';
  1356. }
  1357. } else {
  1358. var current = stack[stack.length - 1];
  1359. if (current == null) {
  1360. parseState = 'end';
  1361. } else if (Array.isArray(current)) {
  1362. parseState = 'afterArrayValue';
  1363. } else {
  1364. parseState = 'afterPropertyValue';
  1365. }
  1366. }
  1367. }
  1368. function pop () {
  1369. stack.pop();
  1370. var current = stack[stack.length - 1];
  1371. if (current == null) {
  1372. parseState = 'end';
  1373. } else if (Array.isArray(current)) {
  1374. parseState = 'afterArrayValue';
  1375. } else {
  1376. parseState = 'afterPropertyValue';
  1377. }
  1378. }
  1379. // This code is unreachable.
  1380. // function invalidParseState () {
  1381. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1382. // }
  1383. // This code is unreachable.
  1384. // function invalidLexState (state) {
  1385. // return new Error(`JSON5: invalid lex state '${state}'`)
  1386. // }
  1387. function invalidChar (c) {
  1388. if (c === undefined) {
  1389. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1390. }
  1391. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1392. }
  1393. function invalidEOF () {
  1394. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1395. }
  1396. // This code is unreachable.
  1397. // function invalidToken () {
  1398. // if (token.type === 'eof') {
  1399. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1400. // }
  1401. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1402. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1403. // }
  1404. function invalidIdentifier () {
  1405. column -= 5;
  1406. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1407. }
  1408. function separatorChar (c) {
  1409. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1410. }
  1411. function formatChar (c) {
  1412. var replacements = {
  1413. "'": "\\'",
  1414. '"': '\\"',
  1415. '\\': '\\\\',
  1416. '\b': '\\b',
  1417. '\f': '\\f',
  1418. '\n': '\\n',
  1419. '\r': '\\r',
  1420. '\t': '\\t',
  1421. '\v': '\\v',
  1422. '\0': '\\0',
  1423. '\u2028': '\\u2028',
  1424. '\u2029': '\\u2029',
  1425. };
  1426. if (replacements[c]) {
  1427. return replacements[c]
  1428. }
  1429. if (c < ' ') {
  1430. var hexString = c.charCodeAt(0).toString(16);
  1431. return '\\x' + ('00' + hexString).substring(hexString.length)
  1432. }
  1433. return c
  1434. }
  1435. function syntaxError (message) {
  1436. var err = new SyntaxError(message);
  1437. err.lineNumber = line;
  1438. err.columnNumber = column;
  1439. return err
  1440. }
  1441. var stringify = function stringify (value, replacer, space) {
  1442. var stack = [];
  1443. var indent = '';
  1444. var propertyList;
  1445. var replacerFunc;
  1446. var gap = '';
  1447. var quote;
  1448. if (
  1449. replacer != null &&
  1450. typeof replacer === 'object' &&
  1451. !Array.isArray(replacer)
  1452. ) {
  1453. space = replacer.space;
  1454. quote = replacer.quote;
  1455. replacer = replacer.replacer;
  1456. }
  1457. if (typeof replacer === 'function') {
  1458. replacerFunc = replacer;
  1459. } else if (Array.isArray(replacer)) {
  1460. propertyList = [];
  1461. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1462. var v = list[i];
  1463. var item = (void 0);
  1464. if (typeof v === 'string') {
  1465. item = v;
  1466. } else if (
  1467. typeof v === 'number' ||
  1468. v instanceof String ||
  1469. v instanceof Number
  1470. ) {
  1471. item = String(v);
  1472. }
  1473. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1474. propertyList.push(item);
  1475. }
  1476. }
  1477. }
  1478. if (space instanceof Number) {
  1479. space = Number(space);
  1480. } else if (space instanceof String) {
  1481. space = String(space);
  1482. }
  1483. if (typeof space === 'number') {
  1484. if (space > 0) {
  1485. space = Math.min(10, Math.floor(space));
  1486. gap = ' '.substr(0, space);
  1487. }
  1488. } else if (typeof space === 'string') {
  1489. gap = space.substr(0, 10);
  1490. }
  1491. return serializeProperty('', {'': value})
  1492. function serializeProperty (key, holder) {
  1493. var value = holder[key];
  1494. if (value != null) {
  1495. if (typeof value.toJSON5 === 'function') {
  1496. value = value.toJSON5(key);
  1497. } else if (typeof value.toJSON === 'function') {
  1498. value = value.toJSON(key);
  1499. }
  1500. }
  1501. if (replacerFunc) {
  1502. value = replacerFunc.call(holder, key, value);
  1503. }
  1504. if (value instanceof Number) {
  1505. value = Number(value);
  1506. } else if (value instanceof String) {
  1507. value = String(value);
  1508. } else if (value instanceof Boolean) {
  1509. value = value.valueOf();
  1510. }
  1511. switch (value) {
  1512. case null: return 'null'
  1513. case true: return 'true'
  1514. case false: return 'false'
  1515. }
  1516. if (typeof value === 'string') {
  1517. return quoteString(value)
  1518. }
  1519. if (typeof value === 'number') {
  1520. return String(value)
  1521. }
  1522. if (typeof value === 'object') {
  1523. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1524. }
  1525. return undefined
  1526. }
  1527. function quoteString (value) {
  1528. var quotes = {
  1529. "'": 0.1,
  1530. '"': 0.2,
  1531. };
  1532. var replacements = {
  1533. "'": "\\'",
  1534. '"': '\\"',
  1535. '\\': '\\\\',
  1536. '\b': '\\b',
  1537. '\f': '\\f',
  1538. '\n': '\\n',
  1539. '\r': '\\r',
  1540. '\t': '\\t',
  1541. '\v': '\\v',
  1542. '\0': '\\0',
  1543. '\u2028': '\\u2028',
  1544. '\u2029': '\\u2029',
  1545. };
  1546. var product = '';
  1547. for (var i = 0; i < value.length; i++) {
  1548. var c = value[i];
  1549. switch (c) {
  1550. case "'":
  1551. case '"':
  1552. quotes[c]++;
  1553. product += c;
  1554. continue
  1555. case '\0':
  1556. if (util.isDigit(value[i + 1])) {
  1557. product += '\\x00';
  1558. continue
  1559. }
  1560. }
  1561. if (replacements[c]) {
  1562. product += replacements[c];
  1563. continue
  1564. }
  1565. if (c < ' ') {
  1566. var hexString = c.charCodeAt(0).toString(16);
  1567. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1568. continue
  1569. }
  1570. product += c;
  1571. }
  1572. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1573. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1574. return quoteChar + product + quoteChar
  1575. }
  1576. function serializeObject (value) {
  1577. if (stack.indexOf(value) >= 0) {
  1578. throw TypeError('Converting circular structure to JSON5')
  1579. }
  1580. stack.push(value);
  1581. var stepback = indent;
  1582. indent = indent + gap;
  1583. var keys = propertyList || Object.keys(value);
  1584. var partial = [];
  1585. for (var i = 0, list = keys; i < list.length; i += 1) {
  1586. var key = list[i];
  1587. var propertyString = serializeProperty(key, value);
  1588. if (propertyString !== undefined) {
  1589. var member = serializeKey(key) + ':';
  1590. if (gap !== '') {
  1591. member += ' ';
  1592. }
  1593. member += propertyString;
  1594. partial.push(member);
  1595. }
  1596. }
  1597. var final;
  1598. if (partial.length === 0) {
  1599. final = '{}';
  1600. } else {
  1601. var properties;
  1602. if (gap === '') {
  1603. properties = partial.join(',');
  1604. final = '{' + properties + '}';
  1605. } else {
  1606. var separator = ',\n' + indent;
  1607. properties = partial.join(separator);
  1608. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1609. }
  1610. }
  1611. stack.pop();
  1612. indent = stepback;
  1613. return final
  1614. }
  1615. function serializeKey (key) {
  1616. if (key.length === 0) {
  1617. return quoteString(key)
  1618. }
  1619. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1620. if (!util.isIdStartChar(firstChar)) {
  1621. return quoteString(key)
  1622. }
  1623. for (var i = firstChar.length; i < key.length; i++) {
  1624. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1625. return quoteString(key)
  1626. }
  1627. }
  1628. return key
  1629. }
  1630. function serializeArray (value) {
  1631. if (stack.indexOf(value) >= 0) {
  1632. throw TypeError('Converting circular structure to JSON5')
  1633. }
  1634. stack.push(value);
  1635. var stepback = indent;
  1636. indent = indent + gap;
  1637. var partial = [];
  1638. for (var i = 0; i < value.length; i++) {
  1639. var propertyString = serializeProperty(String(i), value);
  1640. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1641. }
  1642. var final;
  1643. if (partial.length === 0) {
  1644. final = '[]';
  1645. } else {
  1646. if (gap === '') {
  1647. var properties = partial.join(',');
  1648. final = '[' + properties + ']';
  1649. } else {
  1650. var separator = ',\n' + indent;
  1651. var properties$1 = partial.join(separator);
  1652. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1653. }
  1654. }
  1655. stack.pop();
  1656. indent = stepback;
  1657. return final
  1658. }
  1659. };
  1660. var JSON5 = {
  1661. parse: parse,
  1662. stringify: stringify,
  1663. };
  1664. var lib = JSON5;
  1665. var es5 = lib;
  1666. return es5;
  1667. })));
  1668. });
  1669. /*! *****************************************************************************
  1670. Copyright (c) Microsoft Corporation.
  1671. Permission to use, copy, modify, and/or distribute this software for any
  1672. purpose with or without fee is hereby granted.
  1673. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1674. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1675. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1676. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1677. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1678. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1679. PERFORMANCE OF THIS SOFTWARE.
  1680. ***************************************************************************** */
  1681. /* global Reflect, Promise */
  1682. var extendStatics = function(d, b) {
  1683. extendStatics = Object.setPrototypeOf ||
  1684. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1685. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1686. return extendStatics(d, b);
  1687. };
  1688. function __extends(d, b) {
  1689. extendStatics(d, b);
  1690. function __() { this.constructor = d; }
  1691. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1692. }
  1693. var __assign = function() {
  1694. __assign = Object.assign || function __assign(t) {
  1695. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1696. s = arguments[i];
  1697. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1698. }
  1699. return t;
  1700. };
  1701. return __assign.apply(this, arguments);
  1702. };
  1703. function __decorate(decorators, target, key, desc) {
  1704. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1705. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1706. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1707. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1708. }
  1709. function __param(paramIndex, decorator) {
  1710. return function (target, key) { decorator(target, key, paramIndex); }
  1711. }
  1712. function __metadata(metadataKey, metadataValue) {
  1713. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1714. }
  1715. function __values(o) {
  1716. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1717. if (m) return m.call(o);
  1718. if (o && typeof o.length === "number") return {
  1719. next: function () {
  1720. if (o && i >= o.length) o = void 0;
  1721. return { value: o && o[i++], done: !o };
  1722. }
  1723. };
  1724. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1725. }
  1726. function __read(o, n) {
  1727. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1728. if (!m) return o;
  1729. var i = m.call(o), r, ar = [], e;
  1730. try {
  1731. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1732. }
  1733. catch (error) { e = { error: error }; }
  1734. finally {
  1735. try {
  1736. if (r && !r.done && (m = i["return"])) m.call(i);
  1737. }
  1738. finally { if (e) throw e.error; }
  1739. }
  1740. return ar;
  1741. }
  1742. function __spread() {
  1743. for (var ar = [], i = 0; i < arguments.length; i++)
  1744. ar = ar.concat(__read(arguments[i]));
  1745. return ar;
  1746. }
  1747. var PropertyDescription = /** @class */ (function () {
  1748. function PropertyDescription() {
  1749. var _this = this;
  1750. var args = [];
  1751. for (var _i = 0; _i < arguments.length; _i++) {
  1752. args[_i] = arguments[_i];
  1753. }
  1754. this.propertyes = {
  1755. props: [],
  1756. events: []
  1757. };
  1758. _$2.each(args, function (arg) {
  1759. _this.merge(arg);
  1760. });
  1761. }
  1762. PropertyDescription.prototype.merge = function (pd) {
  1763. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1764. if (pd.events) {
  1765. if (this.propertyes.events) {
  1766. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1767. }
  1768. else {
  1769. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1770. }
  1771. }
  1772. };
  1773. /**
  1774. * 根据分组名 获取属性定义
  1775. */
  1776. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1777. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1778. };
  1779. /**
  1780. * 获取全部事件
  1781. */
  1782. PropertyDescription.prototype.getEvents = function () {
  1783. return this.propertyes.events;
  1784. };
  1785. return PropertyDescription;
  1786. }());
  1787. //# sourceMappingURL=PropertyDescription.js.map
  1788. var PropertyDescriptionTable = new Map();
  1789. var width = {
  1790. name: 'width',
  1791. default: '',
  1792. group: 'common',
  1793. desc: '宽',
  1794. type: 'string'
  1795. };
  1796. var height = {
  1797. name: 'height',
  1798. default: '',
  1799. group: 'common',
  1800. desc: '高',
  1801. type: 'string'
  1802. };
  1803. var fieldLabel = {
  1804. name: 'fieldLabel',
  1805. default: '',
  1806. group: 'common',
  1807. desc: '文本描述',
  1808. type: 'string',
  1809. expr: true,
  1810. };
  1811. var text$1 = {
  1812. name: 'text',
  1813. default: '',
  1814. group: 'common',
  1815. desc: '文本描述',
  1816. type: 'string',
  1817. expr: true,
  1818. };
  1819. var iconCls = {
  1820. name: 'iconCls',
  1821. default: '',
  1822. group: 'common',
  1823. desc: '图标',
  1824. type: 'string',
  1825. expr: true,
  1826. };
  1827. var disabled = {
  1828. name: 'disabled',
  1829. default: false,
  1830. group: 'common',
  1831. desc: '禁用',
  1832. type: 'boolean',
  1833. expr: true,
  1834. };
  1835. var value = {
  1836. name: 'value',
  1837. default: '',
  1838. group: 'common',
  1839. desc: '字段值',
  1840. type: 'string',
  1841. expr: true,
  1842. };
  1843. var template = {
  1844. name: 'template',
  1845. default: '',
  1846. group: 'common',
  1847. desc: 'HTML内容',
  1848. type: 'string',
  1849. expr: true,
  1850. };
  1851. var reference = {
  1852. name: 'reference',
  1853. default: '',
  1854. group: 'common',
  1855. desc: '组件句柄',
  1856. type: 'string',
  1857. expr: true,
  1858. };
  1859. var tooltip = {
  1860. name: 'tooltip',
  1861. default: '',
  1862. group: 'common',
  1863. desc: '悬停提示',
  1864. type: 'string'
  1865. };
  1866. // =============事件 ==============
  1867. var click = {
  1868. name: 'click',
  1869. default: '',
  1870. group: 'listeners',
  1871. desc: '点击事件',
  1872. eventParamter: [
  1873. 'sender',
  1874. 'e: any'
  1875. ],
  1876. type: 'listeners'
  1877. };
  1878. var change = {
  1879. name: 'change',
  1880. default: '',
  1881. group: 'listeners',
  1882. desc: 'value change事件',
  1883. eventParamter: [
  1884. 'sender',
  1885. 'e: any'
  1886. ],
  1887. type: 'listeners'
  1888. };
  1889. var keyup = {
  1890. name: 'keyup',
  1891. default: '',
  1892. group: 'listeners',
  1893. desc: '键盘按键抬起事件',
  1894. eventParamter: [
  1895. 'sender',
  1896. 'e'
  1897. ],
  1898. type: 'listeners'
  1899. };
  1900. var afterrender = {
  1901. name: 'afterrender',
  1902. default: '',
  1903. group: 'listeners',
  1904. desc: '控件渲染后触发',
  1905. eventParamter: [
  1906. 'sender',
  1907. 'e'
  1908. ],
  1909. type: 'listeners'
  1910. };
  1911. // =============特性 ==============
  1912. var fix = {
  1913. name: 'fix',
  1914. default: '',
  1915. group: 'fix',
  1916. desc: '特性',
  1917. type: 'fix',
  1918. expr: true,
  1919. };
  1920. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1921. props: [
  1922. height
  1923. ]
  1924. }));
  1925. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1926. props: [
  1927. {
  1928. name: 'borderless',
  1929. default: true,
  1930. group: 'css',
  1931. desc: '有无边框',
  1932. type: 'boolean'
  1933. },
  1934. {
  1935. name: 'type',
  1936. default: '',
  1937. group: 'css',
  1938. desc: '布局类型',
  1939. type: ['line', 'clean', 'wide', 'space', 'form']
  1940. },
  1941. {
  1942. name: '_designMode',
  1943. default: 'module',
  1944. group: 'common',
  1945. desc: '设计类型',
  1946. type: ['none', 'module', 'scroll-module']
  1947. }
  1948. ]
  1949. }));
  1950. var YvBase = {
  1951. props: [
  1952. width, height, reference, afterrender, fix
  1953. ],
  1954. events: [
  1955. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1956. ]
  1957. };
  1958. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1959. props: [
  1960. template
  1961. ]
  1962. }));
  1963. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1964. props: [
  1965. {
  1966. name: 'label',
  1967. default: '',
  1968. group: 'common',
  1969. desc: '字段组标题',
  1970. type: 'string'
  1971. }
  1972. ]
  1973. }));
  1974. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1975. props: [
  1976. {
  1977. name: 'src',
  1978. default: '',
  1979. group: 'common',
  1980. desc: '地址路径',
  1981. type: 'string'
  1982. }
  1983. ]
  1984. }));
  1985. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1986. props: [
  1987. width, height,
  1988. {
  1989. name: 'value',
  1990. default: '上传',
  1991. group: 'common',
  1992. desc: '文本描述',
  1993. type: 'string'
  1994. },
  1995. {
  1996. name: 'upload',
  1997. default: '/upload',
  1998. group: 'common',
  1999. desc: '上传地址',
  2000. type: 'string'
  2001. },
  2002. ],
  2003. events: [
  2004. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2005. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2006. ]
  2007. }));
  2008. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2009. props: [
  2010. value,
  2011. {
  2012. name: 'imgWidth',
  2013. default: '',
  2014. group: 'common',
  2015. desc: '图片宽',
  2016. type: 'string'
  2017. },
  2018. {
  2019. name: 'imgHeight',
  2020. default: '',
  2021. group: 'common',
  2022. desc: '图片高',
  2023. type: 'string'
  2024. }
  2025. ]
  2026. }));
  2027. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2028. props: [
  2029. value,
  2030. {
  2031. name: 'imgWidth',
  2032. default: '',
  2033. group: 'common',
  2034. desc: '图片宽',
  2035. type: 'string'
  2036. },
  2037. {
  2038. name: 'imgHeight',
  2039. default: '',
  2040. group: 'common',
  2041. desc: '图片高',
  2042. type: 'string'
  2043. }
  2044. ]
  2045. }));
  2046. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2047. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2048. }));
  2049. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2050. props: [
  2051. fieldLabel, value, disabled,
  2052. tooltip, width, height
  2053. ],
  2054. }));
  2055. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2056. props: [
  2057. fieldLabel, value, disabled,
  2058. tooltip, width, height, keyup, afterrender, change
  2059. ],
  2060. }));
  2061. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2062. props: [
  2063. fieldLabel, value, disabled,
  2064. tooltip, width, height, keyup, afterrender, change
  2065. ],
  2066. }));
  2067. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2068. props: [
  2069. fieldLabel, value, disabled,
  2070. tooltip, width, height, keyup, afterrender, change
  2071. ],
  2072. }));
  2073. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2074. props: [
  2075. fieldLabel, value, disabled,
  2076. tooltip, width, height, keyup, afterrender, change
  2077. ],
  2078. }));
  2079. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2080. props: [
  2081. fieldLabel, value, disabled,
  2082. tooltip, width, height, keyup, afterrender, change
  2083. ],
  2084. }));
  2085. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height, keyup, afterrender, change
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, afterrender, change
  2131. ],
  2132. }));
  2133. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2134. /**
  2135. * 弹出输入框,输入文字
  2136. * @param message 提示文字
  2137. * @param defaultValue 默认值
  2138. * @param multiLine 是否多行输入
  2139. */
  2140. function prompt$1(message, defaultValue, multiLine) {
  2141. if (defaultValue === void 0) { defaultValue = ""; }
  2142. if (multiLine === void 0) { multiLine = false; }
  2143. return new Promise(function (resolve) {
  2144. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2145. if (button === 'ok') {
  2146. resolve(value);
  2147. }
  2148. }, null, multiLine, defaultValue);
  2149. });
  2150. }
  2151. /**
  2152. * 显示错误异常信息
  2153. * @param msg 错误内容
  2154. * @param sender 发送者按钮(可以为空)
  2155. */
  2156. function showErrorDialog(msg, sender) {
  2157. console.error(msg);
  2158. Ext.MessageBox.show({
  2159. title: '错误',
  2160. msg: msg,
  2161. buttons: Ext.MessageBox.OK,
  2162. animateTarget: sender,
  2163. icon: 'error',
  2164. cls: 'show-icon-messagebox',
  2165. });
  2166. }
  2167. /**
  2168. * 显示错误异常信息
  2169. * @param msg 错误内容
  2170. * @param sender 发送者按钮(可以为空)
  2171. */
  2172. function showInfoDialogSimple(msg, sender) {
  2173. console.info(msg);
  2174. Ext.MessageBox.show({
  2175. title: '提示',
  2176. msg: msg,
  2177. buttons: Ext.MessageBox.OK,
  2178. animateTarget: sender,
  2179. icon: 'info',
  2180. cls: 'show-icon-messagebox',
  2181. });
  2182. }
  2183. function msgError(msg, sender) {
  2184. showErrorDialog(msg, sender);
  2185. }
  2186. /**
  2187. * 中间灰底白字提示
  2188. */
  2189. function msg(message) {
  2190. console.log(message);
  2191. var t = { message: message };
  2192. var WMSTranslate = window["WMSTranslate"];
  2193. if (WMSTranslate) {
  2194. if (typeof window['viewTranslate'] === 'function') {
  2195. window['viewTranslate'](t, message, "message");
  2196. }
  2197. }
  2198. var $body = $$2('body');
  2199. $body.find('[xtype=tooltip]').remove();
  2200. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2201. ' <div class="yvan-msg-content">' +
  2202. _$2.escape(t.message) +
  2203. '</div></div>');
  2204. $body.append($w);
  2205. var iframeWidth = $w.parent().width();
  2206. var iframeHeight = $w.parent().height();
  2207. var windowWidth = $w.width();
  2208. var windowHeight = $w.height();
  2209. var setWidth = (iframeWidth - windowWidth) / 2;
  2210. var setHeight = (iframeHeight - windowHeight) / 2;
  2211. if (iframeHeight < windowHeight || setHeight < 0) {
  2212. setHeight = 0;
  2213. }
  2214. if (iframeWidth < windowWidth || setWidth < 0) {
  2215. setWidth = 0;
  2216. }
  2217. $w.css({ left: setWidth, top: setHeight });
  2218. setTimeout(function () {
  2219. $w.remove();
  2220. }, 3000);
  2221. }
  2222. //# sourceMappingURL=message.js.map
  2223. localforage.config({
  2224. name: "studio",
  2225. storeName: "item",
  2226. });
  2227. function getItem(key, callback) {
  2228. localforage.getItem(key).then(function (value) {
  2229. if (callback) {
  2230. callback(value);
  2231. }
  2232. });
  2233. }
  2234. function setItem(key, value, callback) {
  2235. localforage.setItem(key, value).then(function (val) {
  2236. if (callback) {
  2237. callback();
  2238. }
  2239. });
  2240. }
  2241. var native = {
  2242. /**
  2243. * 读取文件
  2244. */
  2245. loadFile: function (fileName, callback) {
  2246. console.log('loadFile', fileName);
  2247. getItem('NATIVE_' + fileName, callback);
  2248. },
  2249. /**
  2250. * 保存文件
  2251. */
  2252. saveFile: function (fileName, content) {
  2253. console.log('saveFile', fileName, content);
  2254. setItem('NATIVE_' + fileName, content);
  2255. },
  2256. openInIdea: function (path) {
  2257. msg(path);
  2258. },
  2259. /**
  2260. * 初始化 native 工具类
  2261. */
  2262. init: function () {
  2263. var ClipboardJS = window['ClipboardJS'];
  2264. if (!ClipboardJS) {
  2265. msg('没有引入 ClipboardJS');
  2266. return;
  2267. }
  2268. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2269. var clipboard = new ClipboardJS('.__btnClipboard');
  2270. },
  2271. /**
  2272. * 设置剪切板
  2273. */
  2274. clipboardSet: function (c) {
  2275. var $btn = $('.__btnClipboard');
  2276. $btn.attr('data-clipboard-text', c);
  2277. $btn.trigger("click");
  2278. },
  2279. };
  2280. /**
  2281. * 判断变量是否有值 value === null || value === undefined
  2282. * @param value 目标变量
  2283. */
  2284. var noValue = function (value) {
  2285. return value === null || value === undefined;
  2286. };
  2287. //# sourceMappingURL=Utils.js.map
  2288. function initStateTree () {
  2289. Ext.define('com.yvan.studio.StateTree', {
  2290. extend: 'Ext.tree.Panel',
  2291. _saveStateFlag: true,
  2292. _filterText: '',
  2293. fbar: [
  2294. {
  2295. xtype: 'textfield',
  2296. flex: 1,
  2297. emptyText: '搜索过滤',
  2298. enableKeyEvents: true,
  2299. listeners: {
  2300. change: function (sender) {
  2301. var tree = sender.up("treepanel");
  2302. tree.filterByText(this.getRawValue());
  2303. },
  2304. keyup: function (sender, e) {
  2305. var tree = sender.up("treepanel");
  2306. if (e.ESC === e.getKey()) {
  2307. sender.setValue('');
  2308. tree.filterByText('');
  2309. }
  2310. }
  2311. }
  2312. },
  2313. ],
  2314. getStateFilename: function () {
  2315. throw Error('没有实现这个函数');
  2316. },
  2317. initComponent: function () {
  2318. var me = this;
  2319. this.on({
  2320. afterrender: function () {
  2321. var _this = this;
  2322. // 回车后打开节点
  2323. $(me.el.dom).keydown(function (event) {
  2324. if (event.keyCode === 13) {
  2325. event.preventDefault();
  2326. _this.fireEvent('itemverify');
  2327. return;
  2328. }
  2329. });
  2330. },
  2331. afteritemexpand: {
  2332. fn: function (node, index, item, eOpts) {
  2333. this.saveState();
  2334. },
  2335. buffer: 100,
  2336. },
  2337. afteritemcollapse: {
  2338. fn: function (node, index, item, eOpts) {
  2339. this.saveState();
  2340. },
  2341. buffer: 100,
  2342. },
  2343. itemdblclick: function (sender, record) {
  2344. this.fireEvent('itemverify');
  2345. },
  2346. itemclick: {
  2347. fn: function (node, index, item, eOpts) {
  2348. this.saveState();
  2349. },
  2350. buffer: 100,
  2351. }
  2352. });
  2353. this.superclass.superclass.initComponent.apply(this, arguments);
  2354. },
  2355. restoreState: function () {
  2356. var _this = this;
  2357. native.loadFile(this.getStateFilename(), function (content) {
  2358. if (!content)
  2359. return;
  2360. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2361. _this._saveStateFlag = false;
  2362. if (_.isArray(expands)) {
  2363. _.forEach(expands, function (p) {
  2364. _this.expandPath(p);
  2365. });
  2366. }
  2367. if (_.isArray(selections) && selections[0]) {
  2368. try {
  2369. _this.selectPath(selections[0]);
  2370. }
  2371. catch (e) {
  2372. }
  2373. }
  2374. if (scrollPosition && scrollSize) {
  2375. var size = _this.scrollable.getSize();
  2376. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2377. try {
  2378. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2379. }
  2380. catch (e) {
  2381. }
  2382. }
  2383. }
  2384. setTimeout(function () {
  2385. _this._saveStateFlag = true;
  2386. }, 200);
  2387. });
  2388. },
  2389. saveState: function () {
  2390. if (!this._saveStateFlag) {
  2391. return;
  2392. }
  2393. if (this._filterText) {
  2394. // 有筛选,不保存展开状态
  2395. return;
  2396. }
  2397. var expands = [];
  2398. var selections = [];
  2399. var selection = this.getSelection();
  2400. _.forEach(selection, function (item) {
  2401. selections.push(item.getPath());
  2402. });
  2403. var data = this.getStore().data;
  2404. _.forEach(data.items, function (item) {
  2405. if (item.data.expanded === true) {
  2406. expands.push(item.getPath());
  2407. }
  2408. });
  2409. var scrollPosition = this.scrollable.position;
  2410. var scrollSize = this.scrollable.getSize();
  2411. native.saveFile(this.getStateFilename(), {
  2412. selections: selections,
  2413. expands: expands,
  2414. scrollPosition: scrollPosition,
  2415. scrollSize: scrollSize
  2416. });
  2417. },
  2418. filterByText: function (text) {
  2419. this._filterText = text;
  2420. this._filterBy(this, text, 'text');
  2421. },
  2422. _filterBy: _.debounce(function (me, text, by) {
  2423. var view = me.getView();
  2424. me.store.clearFilter();
  2425. if (!me._filterText) {
  2426. // 没有筛选内容,还原状态
  2427. var selections = me.getSelection();
  2428. var selectionPaths_1 = [];
  2429. _.forEach(me.getSelection(), function (item) {
  2430. selectionPaths_1.push(item.getPath());
  2431. });
  2432. me.collapseAll();
  2433. me.restoreState();
  2434. _.forEach(selectionPaths_1, function (path) {
  2435. me.expandPath(path);
  2436. });
  2437. me.setSelection(selections);
  2438. return;
  2439. }
  2440. // 递归查找所有需要可见的节点 id 数组
  2441. var nodesAndParents = [];
  2442. var expandPaths = [];
  2443. me.getRootNode().cascadeBy(function (tree, view) {
  2444. var currNode = this;
  2445. currNode.collapse();
  2446. if (currNode && currNode.data[by] &&
  2447. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2448. // 展开到匹配的路径
  2449. // me.expandPath(currNode.getPath());
  2450. expandPaths.push(currNode.getPath());
  2451. // 沿途父节点全部设定为可见
  2452. while (currNode.parentNode) {
  2453. nodesAndParents.push(currNode.id);
  2454. currNode = currNode.parentNode;
  2455. }
  2456. }
  2457. }, null, [me, view]);
  2458. me.store.filterBy(function (r) {
  2459. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2460. });
  2461. _.forEach(expandPaths, function (path) {
  2462. me.expandPath(path);
  2463. });
  2464. }, 1000),
  2465. });
  2466. }
  2467. //# sourceMappingURL=StateTree.js.map
  2468. function initDashboard () {
  2469. Ext.define('com.yvan.studio.Dashboard', {
  2470. extend: 'Ext.panel.Panel',
  2471. alias: 'widget.dashboard',
  2472. xtype: 'dashboard',
  2473. html: ''
  2474. });
  2475. }
  2476. //# sourceMappingURL=dashboard.js.map
  2477. var handles$1 = {
  2478. mainWindow: undefined,
  2479. fileTree: undefined,
  2480. dbTree: undefined,
  2481. viewoutlinetree: undefined,
  2482. statusbar: undefined,
  2483. dictTree: undefined,
  2484. property: undefined,
  2485. dbcode: undefined,
  2486. report: undefined,
  2487. widget: undefined,
  2488. whLayout: undefined,
  2489. };
  2490. window['handles'] = handles$1;
  2491. function setDictTree(value) {
  2492. handles$1.dictTree = value;
  2493. }
  2494. function setMainWindow(value) {
  2495. handles$1.mainWindow = value;
  2496. }
  2497. function setReport(value) {
  2498. handles$1.report = value;
  2499. }
  2500. function setStatusbar(statusbar) {
  2501. handles$1.statusbar = statusbar;
  2502. }
  2503. function setFileTree(value) {
  2504. handles$1.fileTree = value;
  2505. }
  2506. function setDbTree(value) {
  2507. handles$1.dbTree = value;
  2508. }
  2509. function setWidget(value) {
  2510. handles$1.widget = value;
  2511. }
  2512. function setWhLayout(value) {
  2513. handles$1.whLayout = value;
  2514. }
  2515. function setViewoutlinetree(value) {
  2516. handles$1.viewoutlinetree = value;
  2517. }
  2518. function setPropertyPanel(value) {
  2519. handles$1.property = value;
  2520. }
  2521. function setDbCode(value) {
  2522. handles$1.dbcode = value;
  2523. }
  2524. //# sourceMappingURL=Handles.js.map
  2525. /**
  2526. * 调用方法
  2527. */
  2528. function invokeMethod(fn, sender, args) {
  2529. if (typeof fn === 'function') {
  2530. fn.apply.apply(fn, __spread([sender], args));
  2531. }
  2532. }
  2533. /**
  2534. * 判断事件是否为有效的输入字符
  2535. * @param e
  2536. */
  2537. function isChartEvent(e) {
  2538. if (e.key === 'Shift' ||
  2539. e.key === 'Control' ||
  2540. e.key === 'Alt' ||
  2541. e.key === 'Escape' ||
  2542. e.key === 'ArrowRight' ||
  2543. e.key === 'Tab' ||
  2544. e.key === 'ArrowLeft') {
  2545. return false;
  2546. }
  2547. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2548. // 0-9
  2549. return true;
  2550. }
  2551. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2552. // a-z
  2553. return true;
  2554. }
  2555. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2556. // 小键盘 0-9
  2557. return true;
  2558. }
  2559. return false;
  2560. }
  2561. if (!window["time_offset"]) {
  2562. window["time_offset"] = 0;
  2563. }
  2564. function syncDate(date) {
  2565. if (date && date.setTime && date.getTime) {
  2566. date.setTime(date.getTime() + window["time_offset"]);
  2567. }
  2568. return date;
  2569. }
  2570. //# sourceMappingURL=utils.js.map
  2571. function isDesignMode(control, config) {
  2572. var _a, _b;
  2573. if (window["IS_DESIGN_MODE"]) {
  2574. return true;
  2575. }
  2576. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2577. return true;
  2578. }
  2579. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2580. return true;
  2581. }
  2582. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2583. return true;
  2584. }
  2585. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2586. return true;
  2587. }
  2588. return false;
  2589. }
  2590. function toString(value) {
  2591. if (typeof value === 'undefined' || value === null) {
  2592. return "";
  2593. }
  2594. if (typeof value === 'number' && isNaN(value)) {
  2595. return "";
  2596. }
  2597. if (value == 'N/A') {
  2598. return "";
  2599. }
  2600. return ("" + value);
  2601. }
  2602. function isEmpty(value) {
  2603. if (typeof value === 'undefined' || value === null) {
  2604. return true;
  2605. }
  2606. if (typeof value === 'number' && isNaN(value)) {
  2607. return true;
  2608. }
  2609. if (value == 'N/A') {
  2610. return true;
  2611. }
  2612. return ("" + value).trim().length <= 0;
  2613. }
  2614. function createUUID() {
  2615. //@ts-ignore
  2616. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2617. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2618. });
  2619. }
  2620. function getRegList() {
  2621. var regList = _$2.get(window, 'yvanLib.regList');
  2622. if (!regList) {
  2623. regList = [];
  2624. _$2.set(window, 'yvanLib.regList', regList);
  2625. }
  2626. return regList;
  2627. }
  2628. function getRegParamList(methodName) {
  2629. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2630. if (!regParamList) {
  2631. regParamList = {};
  2632. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2633. }
  2634. if (!_$2.has(regParamList, methodName)) {
  2635. regParamList[methodName] = [];
  2636. }
  2637. return regParamList[methodName];
  2638. }
  2639. /**
  2640. * 模拟点击按钮
  2641. */
  2642. function raiseClick(buttonHandle) {
  2643. if (!buttonHandle) {
  2644. return false;
  2645. }
  2646. if (buttonHandle.disabled) {
  2647. // 按钮是禁止状态
  2648. return false;
  2649. }
  2650. if (buttonHandle.hidden) {
  2651. // 按钮是隐藏状态
  2652. return false;
  2653. }
  2654. // 按钮点击
  2655. buttonHandle.click();
  2656. return true;
  2657. }
  2658. /**
  2659. * 标注系统全局函数的参数
  2660. * @param title 函数名称
  2661. * @param type 函数类型
  2662. * @param allowEmpty 可否为空
  2663. */
  2664. function LibParam(title, type, allowEmpty) {
  2665. if (allowEmpty === void 0) { allowEmpty = false; }
  2666. return function (target, methodName, paramsIndex) {
  2667. var systemFnArgs = getRegParamList(methodName);
  2668. systemFnArgs[paramsIndex] = {
  2669. type: type,
  2670. title: title,
  2671. name: methodName,
  2672. allowEmpty: allowEmpty,
  2673. };
  2674. };
  2675. }
  2676. /**
  2677. * 标注函数变成"系统全局函数"
  2678. */
  2679. function Lib(registe) {
  2680. return function (target, propertyKey, descriptor) {
  2681. var libList = getRegList();
  2682. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2683. if (registe.type === 'system') {
  2684. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2685. }
  2686. else if (registe.type === 'format') {
  2687. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2688. }
  2689. return target;
  2690. };
  2691. }
  2692. /**
  2693. * 解析事件
  2694. * 'scope.私有方法名'
  2695. * 'system.系统函数名'
  2696. * 'format.格式化名'
  2697. */
  2698. function lookupFn(scope, event, errorWho) {
  2699. if (isDesignMode(scope, undefined)) {
  2700. return Ext.emptyFn;
  2701. }
  2702. if (!_$2.startsWith(event, 'scope.') &&
  2703. !_$2.startsWith(event, 'system.') &&
  2704. !_$2.startsWith(event, 'format.')) {
  2705. console.error('无法识别的事件响应类型', event);
  2706. throw new TypeError('无法识别的事件响应类型');
  2707. }
  2708. // 为 eval 准备环境
  2709. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2710. var data = scope.viewModel.data;
  2711. var keys = [];
  2712. var values = [];
  2713. _$2.forOwn(data, function (value, key) {
  2714. var idxKey = key.indexOf('//');
  2715. if (idxKey >= 0) {
  2716. keys.push(key.substr(0, idxKey));
  2717. }
  2718. else {
  2719. keys.push(key);
  2720. }
  2721. values.push(value);
  2722. });
  2723. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2724. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2725. if (typeof funcResult !== 'function') {
  2726. console.error('无法识别的事件响应类型', event, func, errorWho);
  2727. throw new TypeError('无法识别的事件响应类型');
  2728. }
  2729. return funcResult;
  2730. }
  2731. /**
  2732. * 从 ext.element 获取 scope 对象
  2733. */
  2734. function lookupScope(extHandle) {
  2735. if (!extHandle) {
  2736. // @ts-ignore
  2737. return;
  2738. }
  2739. if (extHandle.isScope) {
  2740. return extHandle;
  2741. }
  2742. if (extHandle.column) {
  2743. // 列上的组件
  2744. return extHandle.column.lookupReferenceHolder().yvanScope;
  2745. }
  2746. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2747. if (typeof extHandle.lookupViewModel === 'function') {
  2748. var vm = extHandle.lookupViewModel();
  2749. return vm.yvanScope;
  2750. }
  2751. return;
  2752. }
  2753. //# sourceMappingURL=lib.js.map
  2754. /**
  2755. * 全局 ajax 方法
  2756. */
  2757. var ajax = {};
  2758. /**
  2759. * 计算拼音的函数
  2760. */
  2761. var pinyinFunc = function (str) { return (str); };
  2762. exports.scopeOnLoad = null;
  2763. exports.apiConvert = undefined;
  2764. var baseConfigProcessList = [];
  2765. /**
  2766. * 在基类添加 Config 的处理方法
  2767. */
  2768. function baseConfigProcess(option) {
  2769. return function (target, propertyKey) {
  2770. baseConfigProcessList.push(target[propertyKey]);
  2771. };
  2772. }
  2773. // let designMode: boolean = false
  2774. //
  2775. // export function isDesignMode(): boolean {
  2776. // return designMode
  2777. // }
  2778. //
  2779. // export function setDesignMode(v: boolean) {
  2780. // designMode = v
  2781. // }
  2782. /**
  2783. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2784. */
  2785. function serverInvokeUrlTransform(url, option) {
  2786. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2787. }
  2788. /**
  2789. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2790. */
  2791. function sqlUrlTransform(url) {
  2792. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2793. }
  2794. /**
  2795. * YvanUI 全局扩展配置
  2796. */
  2797. function extend(option) {
  2798. if (option.ajax) {
  2799. ajax.func = option.ajax;
  2800. }
  2801. if (option.serverInvokeUrlTransform) {
  2802. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2803. }
  2804. if (option.sqlUrlTransform) {
  2805. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2806. }
  2807. if (option.pinyinFunction) {
  2808. pinyinFunc = option.pinyinFunction;
  2809. }
  2810. if (option.scopeOnLoad) {
  2811. exports.scopeOnLoad = option.scopeOnLoad;
  2812. }
  2813. if (option.scopeOnCreate) {
  2814. exports.scopeOnCreate = option.scopeOnCreate;
  2815. }
  2816. if (option.apiConvert) {
  2817. exports.apiConvert = option.apiConvert;
  2818. }
  2819. // if (typeof option.designMode !== 'undefined') {
  2820. // setDesignMode(option.designMode)
  2821. // }
  2822. }
  2823. function getApiConvert() {
  2824. return exports.apiConvert;
  2825. }
  2826. function getScopeOnCreate() {
  2827. return exports.scopeOnCreate;
  2828. }
  2829. function getPinyin(v) {
  2830. return pinyinFunc(v);
  2831. }
  2832. /**
  2833. * 适用于 Select / Tree 等,作筛选的通用方法.
  2834. * 1.首字母模糊匹配(不区分大小写)
  2835. * 2.标识的模糊匹配(不区分大小写)
  2836. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2837. */
  2838. function keywordFilter(keyword, label, value) {
  2839. if (!keyword) {
  2840. return true;
  2841. }
  2842. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2843. // const labelPy = _.toLower(getPinyin(label))
  2844. //@ts-ignore
  2845. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2846. value = _$2.toLower(_$2.trim(value));
  2847. var found = 0;
  2848. _$2.some(ws, function (word) {
  2849. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2850. found++;
  2851. return;
  2852. }
  2853. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2854. found++;
  2855. return;
  2856. }
  2857. });
  2858. return found >= ws.length;
  2859. }
  2860. //# sourceMappingURL=config.js.map
  2861. var idPrefix = "_ds_";
  2862. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2863. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2864. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2865. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2866. var layoutOrXtypeNameMap = {
  2867. fit: 'fit布局',
  2868. border: 'border布局',
  2869. center: '中部',
  2870. north: '上部',
  2871. south: '下部',
  2872. west: '左部',
  2873. east: '右部',
  2874. yvgrid: '表格',
  2875. tree: '树',
  2876. tabpanel: '标签页',
  2877. form: '表单',
  2878. fieldset: '字段组',
  2879. tbar: '顶部工具栏',
  2880. fbar: '底部工具栏',
  2881. toolbar: '工具栏',
  2882. cols: '列容器',
  2883. rows: '行容器',
  2884. textfield: '文本框',
  2885. textareafield: '长文本框',
  2886. numberfield: '数字框',
  2887. label: "文本",
  2888. combo: "下拉框",
  2889. combobox: "下拉框",
  2890. combotree: "下拉树",
  2891. combogrid: "下拉表",
  2892. datefield: "日期框",
  2893. searchfield: "搜索框",
  2894. button: "按钮",
  2895. checkbox: "勾选",
  2896. checkboxgroup: "勾选组",
  2897. radio: "点选",
  2898. radiogroup: "点选组",
  2899. container: "占位"
  2900. };
  2901. /**
  2902. * 从 VJSON 中找到 rows/cols 的数组
  2903. */
  2904. function findArrayContainer(vjson, id) {
  2905. var parentVJson = getSuperVjson(vjson, id);
  2906. if (_$2.isArray(parentVJson)) {
  2907. return parentVJson;
  2908. }
  2909. if (parentVJson.hasOwnProperty('items')) {
  2910. return parentVJson.items;
  2911. }
  2912. }
  2913. /**
  2914. * 根据id查找上级vjson
  2915. * @param vjson 原始 vjson 视图
  2916. * @param targetId 子元素的id
  2917. */
  2918. function getSuperVjson(vjson, targetId) {
  2919. return deepTravFindSuper(vjson, vjson, targetId);
  2920. }
  2921. /**
  2922. * 根据id查找上级vjson id
  2923. * @param vjson 原始 vjson 视图
  2924. * @param targetId 子元素的id
  2925. */
  2926. function getSuperVjsonId(vjson, targetId) {
  2927. var vj = getSuperVjson(vjson, targetId);
  2928. return vj.id;
  2929. }
  2930. function deepTravFindSuper(superVjson, vjson, targetId) {
  2931. var rObj = null;
  2932. _$2.forOwn(vjson, function (value, key) {
  2933. if (rObj) {
  2934. return;
  2935. }
  2936. if (typeof value !== "object") {
  2937. return;
  2938. }
  2939. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2940. if (key !== 'items') {
  2941. return;
  2942. }
  2943. }
  2944. else {
  2945. // 模型、数据、数据源不扫描
  2946. if (key === 'data' ||
  2947. key === 'dataSource' ||
  2948. key === 'suggest' ||
  2949. key === 'options' ||
  2950. key === 'config' ||
  2951. key === 'columns' ||
  2952. key === 'viewModel' ||
  2953. key === 'store') {
  2954. return;
  2955. }
  2956. }
  2957. //事件不扫描
  2958. if (key === "on" && _$2.isObject(value)) {
  2959. return;
  2960. }
  2961. if (key.startsWith("on") && _$2.size(key) > 2) {
  2962. return;
  2963. }
  2964. if (value.id === targetId) {
  2965. if (_$2.isArray(vjson)) {
  2966. rObj = superVjson;
  2967. }
  2968. else {
  2969. rObj = vjson;
  2970. }
  2971. return;
  2972. }
  2973. rObj = deepTravFindSuper(vjson, value, targetId);
  2974. });
  2975. return rObj;
  2976. }
  2977. /**
  2978. * 深度遍历 vjson
  2979. * @param vjson 视图JSON
  2980. * @param resolver 分析函数
  2981. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  2982. */
  2983. function deepTravVJson(vjson, resolver, propDeep) {
  2984. if (propDeep === void 0) { propDeep = false; }
  2985. var markerList = [];
  2986. deepTrav1(vjson, resolver, markerList, propDeep);
  2987. return markerList;
  2988. }
  2989. function deepTrav1(obj, resolver, marker, propDeep) {
  2990. if (propDeep === void 0) { propDeep = false; }
  2991. var isMarker = resolver(obj);
  2992. if (marker && isMarker === true) {
  2993. marker.unshift({ id: 0, keyName: '', object: obj });
  2994. }
  2995. _$2.forOwn(obj, function (value, key) {
  2996. if (typeof value !== 'object') {
  2997. return;
  2998. }
  2999. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3000. if (key !== 'items' && key !== 'children') {
  3001. return;
  3002. }
  3003. }
  3004. else {
  3005. // 模型、数据、数据源不扫描
  3006. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3007. return;
  3008. }
  3009. if (!propDeep &&
  3010. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3011. key === 'listeners' || key === 'bind')) {
  3012. return;
  3013. }
  3014. }
  3015. //事件不扫描
  3016. if (key === 'on' && _$2.isObject(value)) {
  3017. return;
  3018. }
  3019. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3020. return;
  3021. }
  3022. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3023. if (marker && isMarkerChild === true) {
  3024. isMarker = true;
  3025. marker.unshift({ id: obj.id, keyName: key, object: value });
  3026. }
  3027. });
  3028. // @ts-ignore 删除作废对象
  3029. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3030. return isMarker;
  3031. }
  3032. /**
  3033. * 在代码中找到 reference 对应的对象
  3034. */
  3035. function findInCode(code, id) {
  3036. try {
  3037. deepTravVJson(code, function (child) {
  3038. if (child.id === id) {
  3039. throw child;
  3040. }
  3041. });
  3042. return undefined;
  3043. }
  3044. catch (err) {
  3045. return err;
  3046. }
  3047. }
  3048. function replaceVjsonById(vjson, itemVjson, itemId) {
  3049. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3050. msgError('无法定位组件!');
  3051. debugger;
  3052. return;
  3053. }
  3054. var id = itemId || itemVjson.id;
  3055. deepTravVJson(vjson, function (obj) {
  3056. if (obj.id == id) {
  3057. _$2.assign(obj, itemVjson, { id: id });
  3058. }
  3059. });
  3060. }
  3061. function deepTravDeleteVjson(obj, targetId) {
  3062. var isDelete = false;
  3063. _$2.forOwn(obj, function (value, key) {
  3064. if (isDelete) {
  3065. return;
  3066. }
  3067. if (typeof value !== 'object') {
  3068. return;
  3069. }
  3070. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3071. if (key !== 'items') {
  3072. return;
  3073. }
  3074. }
  3075. else {
  3076. // 模型、数据、数据源不扫描
  3077. if (key === 'data' ||
  3078. key === 'dataSource' ||
  3079. key === 'suggest' ||
  3080. key === 'options' ||
  3081. key === 'config' ||
  3082. key === 'columns' ||
  3083. key === 'viewModel' ||
  3084. key === 'store') {
  3085. return;
  3086. }
  3087. }
  3088. //事件不扫描
  3089. if (key === 'on' && _$2.isObject(value)) {
  3090. return;
  3091. }
  3092. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3093. return;
  3094. }
  3095. if (value.id === targetId) {
  3096. isDelete = true;
  3097. /** 如果是数组的元素*/
  3098. if (_$2.isArray(obj)) {
  3099. obj.splice(key, 1);
  3100. }
  3101. else {
  3102. delete obj[key];
  3103. }
  3104. return;
  3105. }
  3106. isDelete = deepTravDeleteVjson(value, targetId);
  3107. });
  3108. return isDelete;
  3109. }
  3110. /**
  3111. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3112. * @param obj 原始 vjson 视图
  3113. * @param targetId 子元素的id
  3114. */
  3115. function deletVjsonById(vjson, targetId) {
  3116. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3117. // if (_.isArray(obj)) {
  3118. // if (obj.length <= 0) {
  3119. // let T: any = {
  3120. // view: "template",
  3121. // template: "拖动任何组件到此处",
  3122. // role: "placeholder",
  3123. // id: webix.uid()
  3124. // }
  3125. // obj.push(T);
  3126. // }
  3127. // }
  3128. return isDeleted;
  3129. }
  3130. function removeDesignProp(vjson) {
  3131. deepTravVJson(vjson, function (obj) {
  3132. if (obj.hasOwnProperty('id')) {
  3133. delete obj.id;
  3134. }
  3135. if (obj.hasOwnProperty("designMode")) {
  3136. delete obj.designMode;
  3137. }
  3138. });
  3139. if (vjson.hasOwnProperty("cls")) {
  3140. delete vjson.cls;
  3141. }
  3142. if (vjson.hasOwnProperty("viewModel")) {
  3143. delete vjson.viewModel;
  3144. }
  3145. if (vjson.hasOwnProperty("store")) {
  3146. delete vjson.store;
  3147. }
  3148. }
  3149. function getLayoutOutline(vjson) {
  3150. deepTravVJson(vjson, function (obj) {
  3151. if (!Array.isArray(obj)) {
  3152. _$2.forOwn(obj, function (value, key) {
  3153. if (key === 'id' || key === 'region' || key === 'layoutName'
  3154. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3155. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3156. if (key === 'region'
  3157. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3158. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3159. if (!_$2.has(obj, 'layoutName')) {
  3160. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3161. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3162. // console.log(obj.layoutName, obj.layoutNameDesc)
  3163. }
  3164. }
  3165. }
  3166. else {
  3167. if (key === 'items') {
  3168. obj.children = obj[key];
  3169. }
  3170. if (key === 'tbar') {
  3171. var t = obj[key];
  3172. t.layoutName = key;
  3173. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3174. // console.log(t.layoutName, t.layoutNameDesc)
  3175. if (_$2.has(obj, "items")) {
  3176. obj.items.splice(0, 0, t);
  3177. }
  3178. else if (_$2.has(obj, "children")) {
  3179. obj.children.splice(0, 0, t);
  3180. }
  3181. else {
  3182. obj.children = [t];
  3183. }
  3184. }
  3185. if (key === 'fbar') {
  3186. var t = obj[key];
  3187. t.layoutName = key;
  3188. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3189. // console.log(t.layoutName, t.layoutNameDesc)
  3190. if (_$2.has(obj, "items")) {
  3191. obj.items.push(t);
  3192. }
  3193. else if (_$2.has(obj, "children")) {
  3194. obj.children.push(t);
  3195. }
  3196. else {
  3197. obj.children = [t];
  3198. }
  3199. }
  3200. delete obj[key];
  3201. }
  3202. });
  3203. if (!obj.hasOwnProperty("children")) {
  3204. obj.leaf = true;
  3205. }
  3206. if (!obj.hasOwnProperty("expanded")) {
  3207. obj.expanded = true;
  3208. }
  3209. }
  3210. });
  3211. return vjson;
  3212. }
  3213. //# sourceMappingURL=ViewHelper.js.map
  3214. var Scope = /** @class */ (function () {
  3215. function Scope(args) {
  3216. /**
  3217. * 业务模块的唯一编号
  3218. */
  3219. this.id = _$2.uniqueId('scope_');
  3220. this.IS_DESIGN_MODE = false;
  3221. /**
  3222. * onload 运行完成之后才会设置本标记为 true
  3223. */
  3224. this.isLoadFinish = false;
  3225. this._isLoading = false;
  3226. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  3227. this.model = model;
  3228. if (typeof vjson.layout === 'undefined') {
  3229. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3230. var ret = buildPlus({ model: model, vjson: vjson });
  3231. model = ret.model;
  3232. vjson = ret.vjson;
  3233. }
  3234. this.originalVjson = _$2.cloneDeep(vjson);
  3235. this.vjson = this.originalVjson; // this.buildVjson()
  3236. var WMSTranslate = window["WMSTranslate"];
  3237. if (WMSTranslate) {
  3238. var i18nPath_1 = this.constructor.name;
  3239. if (i18n) {
  3240. WMSTranslate[i18nPath_1] = i18n;
  3241. }
  3242. this.vjson.i18nPath = i18nPath_1;
  3243. deepTravVJson(this.vjson, function (obj) {
  3244. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3245. return;
  3246. }
  3247. obj.i18nPath = i18nPath_1;
  3248. });
  3249. }
  3250. var extScope = getScopeOnCreate();
  3251. if (typeof extScope === 'function') {
  3252. extScope({ vjson: vjson, model: model }, this);
  3253. }
  3254. }
  3255. Scope.prototype._addWatch = function (tplExpress, fn) {
  3256. if (!this._watchList) {
  3257. this._watchList = [];
  3258. }
  3259. this._watchList.push({ watch: tplExpress, fn: fn });
  3260. };
  3261. Scope.prototype._applyWatchList = function () {
  3262. var _this = this;
  3263. _$2.forEach(this._watchList, function (item) {
  3264. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3265. });
  3266. };
  3267. Object.defineProperty(Scope.prototype, "isScope", {
  3268. get: function () {
  3269. return true;
  3270. },
  3271. enumerable: true,
  3272. configurable: true
  3273. });
  3274. /**
  3275. * 产生一个当前模块有效的唯一id
  3276. * @param key 唯一编号
  3277. */
  3278. Scope.prototype.uid = function (key) {
  3279. return this.id + key;
  3280. };
  3281. /**
  3282. * 对话框"保存"成功.
  3283. * 关闭对话框,并响应 success 方法
  3284. * @param data 要傳回的數據(可以為空)
  3285. */
  3286. Scope.prototype.dialogSuccess = function (data) {
  3287. this._handle.fireEvent('success', this, data);
  3288. var sender = this._handle.config.animateTarget;
  3289. var scope = lookupScope(sender);
  3290. if (typeof this['success'] === 'function') {
  3291. this['success'].call(scope, sender, data);
  3292. }
  3293. this.close();
  3294. };
  3295. /**
  3296. * 设置等待状态
  3297. * @param value
  3298. * @param msg
  3299. */
  3300. Scope.prototype.setLoading = function (value) {
  3301. var _a;
  3302. var scope = this;
  3303. this._isLoading = value;
  3304. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3305. };
  3306. Scope.prototype.getLoading = function () {
  3307. return this._isLoading;
  3308. };
  3309. /**
  3310. * 以对话框模式打开当前模块
  3311. * @param sender 发送者(按钮或Scope对象)
  3312. * @param vjsonOption 界面覆盖选项(可以为空)
  3313. * @param dataOption 数据覆盖选项(可以为空)
  3314. */
  3315. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3316. var _a;
  3317. var that = this;
  3318. var vmodel = _$2.defaultsDeep({
  3319. //
  3320. }, dataOption, that.model);
  3321. this.viewModel = new Ext.app.ViewModel(vmodel);
  3322. this.viewModel.yvanScope = this;
  3323. this._applyWatchList();
  3324. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3325. var config = _$2.defaultsDeep({
  3326. animateTarget: sender,
  3327. viewModel: this.viewModel,
  3328. yvanScope: this,
  3329. referenceHolder: true,
  3330. }, vjsonOption, that.vjson, windows);
  3331. if (config.height === 'unset') {
  3332. delete config.height;
  3333. }
  3334. if (config.width === 'unset') {
  3335. delete config.width;
  3336. }
  3337. // const holder = sender?.lookupReferenceHolder()
  3338. // delete config.constrain
  3339. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3340. if (topScope) {
  3341. config.constrain = true;
  3342. this.topScope = topScope;
  3343. }
  3344. var win = new Ext.Window(config);
  3345. // if (holder) {
  3346. // holder.add(win)
  3347. // }
  3348. if (topScope) {
  3349. topScope._handle.add(win);
  3350. }
  3351. win.addListener('beforerender', function (sender) {
  3352. // 记录句柄
  3353. if (sender && !that._handle) {
  3354. that._handle = sender;
  3355. }
  3356. });
  3357. win.addListener('afterrender', function (sender) {
  3358. // 调用onLoad回调
  3359. try {
  3360. that._onLoad();
  3361. }
  3362. catch (e) {
  3363. console.error('errorAt onLoad', e);
  3364. }
  3365. window['cw'] = that;
  3366. });
  3367. win.addListener('destroy', this._destroy.bind(this));
  3368. win.show();
  3369. };
  3370. /**
  3371. * 以标签模式打开当前模块
  3372. * @param vjsonOption 界面覆盖选项(可以为空)
  3373. * @param dataOption 数据覆盖选项(可以为空)
  3374. */
  3375. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3376. var _this = this;
  3377. var that = this;
  3378. this._vjsonOption = vjsonOption;
  3379. this._dataOption = dataOption;
  3380. var vmodel = _$2.defaultsDeep({
  3381. data: {}
  3382. }, dataOption, that.model);
  3383. this.viewModel = new Ext.app.ViewModel(vmodel);
  3384. this.viewModel.yvanScope = this;
  3385. this._applyWatchList();
  3386. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3387. // 根级不能设置id
  3388. delete that.vjson.id;
  3389. var config = _$2.defaultsDeep({
  3390. viewModel: this.viewModel,
  3391. yvanScope: this,
  3392. referenceHolder: true,
  3393. }, vjsonOption, that.vjson);
  3394. var tt = Ext.getCmp('TT');
  3395. var handle = tt.addScope(this, config, function (handle) {
  3396. handle.addListener('added', function (sender) {
  3397. // 记录句柄
  3398. if (sender && !that._handle) {
  3399. that._handle = sender;
  3400. }
  3401. });
  3402. handle.addListener('afterrender', function (sender) {
  3403. // 调用onLoad回调
  3404. try {
  3405. that._onLoad();
  3406. }
  3407. catch (e) {
  3408. console.error('errorAt onLoad', e);
  3409. }
  3410. });
  3411. handle.addListener('destroy', _this._destroy.bind(_this));
  3412. });
  3413. return handle;
  3414. };
  3415. /**
  3416. * 直接渲染到元素
  3417. * @param element 渲染目标
  3418. * @param vjsonOption 界面覆盖选项(可以为空)
  3419. * @param dataOption 数据覆盖选项(可以为空)
  3420. */
  3421. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3422. var that = this;
  3423. this._vjsonOption = vjsonOption;
  3424. this._dataOption = dataOption;
  3425. var vmodel = _$2.defaultsDeep({
  3426. data: {}
  3427. }, that.model, dataOption);
  3428. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3429. this.viewModel = new Ext.app.ViewModel(vmodel);
  3430. this.viewModel.yvanScope = this;
  3431. this._applyWatchList();
  3432. var config = _$2.defaultsDeep({
  3433. viewModel: this.viewModel,
  3434. yvanScope: this,
  3435. referenceHolder: true,
  3436. renderTo: element,
  3437. listeners: {
  3438. afterrender: function (sender) {
  3439. var _a;
  3440. // 记录句柄
  3441. if (sender && !that._handle) {
  3442. that._handle = sender;
  3443. }
  3444. // 调用onLoad回调
  3445. that._onLoad();
  3446. // 如果vjson中配置了 afterrender ,需要恢复状态
  3447. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3448. },
  3449. },
  3450. }, vjsonOption, that.vjson);
  3451. new Ext.container.Viewport(config);
  3452. };
  3453. Scope.prototype.showDesigner = function (designer, option) {
  3454. var that = this;
  3455. var vmodel = _$2.defaultsDeep({
  3456. data: {
  3457. IS_DESIGN_MODE: true,
  3458. }
  3459. }, that.model);
  3460. this.IS_DESIGN_MODE = true;
  3461. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3462. this.viewModel = new Ext.app.ViewModel(vmodel);
  3463. this.viewModel.yvanScope = this;
  3464. this._applyWatchList();
  3465. var config = _$2.defaultsDeep({
  3466. viewModel: this.viewModel,
  3467. yvanScope: this,
  3468. referenceHolder: true,
  3469. listeners: {
  3470. afterrender: function (sender) {
  3471. var _a;
  3472. // 记录句柄
  3473. if (sender && !that._handle) {
  3474. that._handle = sender;
  3475. }
  3476. // 调用onLoad回调
  3477. that._onLoad();
  3478. // 如果vjson中配置了 afterrender ,需要恢复状态
  3479. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3480. },
  3481. },
  3482. }, that.vjson);
  3483. designer.removeAll(true);
  3484. designer.add(config);
  3485. };
  3486. /**
  3487. * 关闭对话框(或标签页)
  3488. */
  3489. Scope.prototype.close = function () {
  3490. this._handle.close();
  3491. };
  3492. Object.defineProperty(Scope.prototype, "data", {
  3493. /**
  3494. * 获取 viewModel 里包含的数据(只读)
  3495. */
  3496. get: function () {
  3497. return this.viewModel.getData();
  3498. },
  3499. enumerable: true,
  3500. configurable: true
  3501. });
  3502. /**
  3503. * 设置 viewModel 中的数据
  3504. * 可以是 key, value 模式
  3505. * 也可以是 {key:value} 模式
  3506. */
  3507. Scope.prototype.set = function (path, value) {
  3508. return this.viewModel.set(path, value);
  3509. };
  3510. /**
  3511. * 寻找模块内所有的 xtype 对应的对象
  3512. * @param xtypeKey
  3513. */
  3514. Scope.prototype.down = function (xtypeKey) {
  3515. return this._handle.down(xtypeKey);
  3516. };
  3517. Object.defineProperty(Scope.prototype, "refs", {
  3518. /**
  3519. * 获取所有设置过 Reference 名称的组件
  3520. */
  3521. get: function () {
  3522. var _a, _b;
  3523. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3524. },
  3525. enumerable: true,
  3526. configurable: true
  3527. });
  3528. Scope.prototype._destroy = function () {
  3529. var that = this;
  3530. that.onDestroy();
  3531. delete that._watchList;
  3532. delete that._handle;
  3533. this.isLoadFinish = false;
  3534. };
  3535. /**
  3536. * 私有渲染完成后的回调
  3537. */
  3538. Scope.prototype._onLoad = function () {
  3539. var _this = this;
  3540. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3541. exports.scopeOnLoad(this);
  3542. }
  3543. this.onLoad();
  3544. _$2.defer(function () {
  3545. _this.isLoadFinish = true;
  3546. });
  3547. };
  3548. /**
  3549. * 默认 渲染完成之后调用的函数
  3550. */
  3551. Scope.prototype.onLoad = function () {
  3552. };
  3553. /**
  3554. * 组件卸载之后的回调
  3555. */
  3556. Scope.prototype.onDestroy = function () {
  3557. };
  3558. return Scope;
  3559. }());
  3560. /**
  3561. * 观察装饰器,viewModel 属性更改时触发成员方法
  3562. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3563. */
  3564. function watch(tplExpress, deep) {
  3565. if (deep === void 0) { deep = false; }
  3566. return function (target, propertyKey, pd) {
  3567. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3568. return target[propertyKey];
  3569. };
  3570. }
  3571. // 获取vjson的hash值
  3572. function getVjsonHash(str) {
  3573. var hash = 3465217896, i, ch;
  3574. for (i = str.length - 1; i >= 0; i--) {
  3575. ch = str.charCodeAt(i);
  3576. hash ^= ((hash << 5) + ch + (hash >> 2));
  3577. }
  3578. return (hash & 0x7FFFFFFF) + "";
  3579. }
  3580. function buildPlus(_a) {
  3581. var model = _a.model, vjson = _a.vjson;
  3582. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3583. {
  3584. layout: 'border',
  3585. // tbar: vjson.action,
  3586. items: vjson.items,
  3587. },
  3588. ] });
  3589. if (_$2.isArray(vjson.action)) {
  3590. vjsonNew.items[0].tbar = vjson.action;
  3591. }
  3592. return { model: model, vjson: vjsonNew };
  3593. }
  3594. //# sourceMappingURL=Scope.js.map
  3595. var model = {
  3596. data: {
  3597. leftTabTitle: ''
  3598. }
  3599. };
  3600. //# sourceMappingURL=Workbench.model.js.map
  3601. var vjson = {
  3602. frame: false,
  3603. layout: 'border',
  3604. width: '100%',
  3605. height: '100%',
  3606. border: false,
  3607. defaults: {
  3608. border: false
  3609. },
  3610. items: [
  3611. {
  3612. region: 'north',
  3613. height: 60,
  3614. cls: 'main-header',
  3615. reference: 'mainTop',
  3616. layout: 'hbox',
  3617. items: [
  3618. {
  3619. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3620. flex: 1,
  3621. border: false
  3622. },
  3623. {
  3624. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3625. menu: [
  3626. {
  3627. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3628. reference: 'commonSetting'
  3629. },
  3630. {
  3631. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3632. listeners: {
  3633. // click: 'scope.ready_api_click'
  3634. }
  3635. },
  3636. ]
  3637. },
  3638. {
  3639. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3640. cls: 'header-menu',
  3641. menu: [
  3642. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3643. ]
  3644. },
  3645. ]
  3646. },
  3647. {
  3648. region: 'west',
  3649. bind: {
  3650. title: '{leftTabTitle}',
  3651. },
  3652. titleAlign: 'center',
  3653. border: true, split: true, width: 340, collapsible: true,
  3654. reference: 'leftTab',
  3655. xtype: 'tabpanel',
  3656. tabPosition: 'left',
  3657. tabRotation: 0,
  3658. tabBar: {
  3659. border: false
  3660. },
  3661. listeners: {
  3662. tabchange: 'scope.leftTabChange',
  3663. },
  3664. items: [
  3665. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3666. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3667. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3668. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3669. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3670. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3671. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3672. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3673. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3674. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3675. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3676. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3677. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3678. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3679. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3680. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3681. ]
  3682. },
  3683. {
  3684. region: 'east',
  3685. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3686. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3687. },
  3688. {
  3689. region: 'center',
  3690. split: true, border: true,
  3691. xtype: 'maintab', reference: 'tt', id: 'TT',
  3692. plain: true,
  3693. listeners: {
  3694. restorypage: 'scope.openScope',
  3695. tabchange: 'scope.tabchange'
  3696. },
  3697. items: []
  3698. },
  3699. ],
  3700. };
  3701. //# sourceMappingURL=Workbench.view.js.map
  3702. /**
  3703. * 获取当前打开的项目资料
  3704. */
  3705. function getCurrentProject() {
  3706. // const value = sessionStorage.getItem('CurrentProject');
  3707. // if (value) {
  3708. // project = JSON.parse(value)
  3709. // if (!project.url) {
  3710. // project = undefined
  3711. // }
  3712. // }
  3713. // return project
  3714. return {
  3715. uuid: '00000000',
  3716. name: '本服项目',
  3717. url: '',
  3718. };
  3719. }
  3720. /**
  3721. * 设置当前打开的项目资料(全局)
  3722. */
  3723. function setCurrentProject(value) {
  3724. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3725. }
  3726. //# sourceMappingURL=Project.js.map
  3727. // ------------------------------------------------------------------------------------------ types
  3728. /** 订阅消息key类型 */
  3729. var EventType;
  3730. (function (EventType) {
  3731. /** FileTree打开Module */
  3732. EventType["ModuleOpen"] = "ModuleOpen";
  3733. /** ModulePage 创建 */
  3734. EventType["ModulePageCreate"] = "ModulePageCreate";
  3735. /** ModuleItem内容变化 */
  3736. EventType["ModuleItemChange"] = "ModuleItemChange";
  3737. /** ModuleItem的 jsView 内容变化 */
  3738. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3739. /** 设置 vjson */
  3740. EventType["SetVjson"] = "SetVjson";
  3741. /** 更新 vjson */
  3742. EventType["UpdateVjson"] = "UpdateVjson";
  3743. /** 更新 组件vjson */
  3744. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3745. /** Component 选中内容变化 */
  3746. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3747. /** Component 选中内容变化 */
  3748. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3749. /** Component 删除事件 */
  3750. EventType["ComponentDelete"] = "ComponentDelete";
  3751. /** MainTab 选中改变事件 */
  3752. EventType["MainTabChange"] = "MainTabChange";
  3753. /** ModuleTab 选中改变事件 */
  3754. EventType["ModuleTabChange"] = "ModuleTabChange";
  3755. /** 保存事件 */
  3756. EventType["SaveCall"] = "SaveCall";
  3757. /** 撤销 */
  3758. EventType["Undo"] = "Undo";
  3759. /** 还原 */
  3760. EventType["Redo"] = "Redo";
  3761. /** 剪切 */
  3762. EventType["Cut"] = "Cut";
  3763. /** 复制 */
  3764. EventType["Copy"] = "Copy";
  3765. /** 粘贴 */
  3766. EventType["Paste"] = "Paste";
  3767. /** 全选 */
  3768. EventType["SelectAll"] = "SelectAll";
  3769. /** 读取剪切板 */
  3770. EventType["ClipboardRead"] = "ClipboardRead";
  3771. /** 检查模块更新 */
  3772. EventType["RunCheckModule"] = "RunCheckModule";
  3773. /** 停止检查模块更新 */
  3774. EventType["StopCheckModule"] = "StopCheckModule";
  3775. })(EventType || (EventType = {}));
  3776. // ------------------------------------------------------------------------------------------ impls
  3777. var EventBus = /** @class */ (function () {
  3778. function EventBus() {
  3779. /** 事件数据 */
  3780. this.store = {};
  3781. /** 事件订阅者注册表 */
  3782. this.observeStoreTable = {};
  3783. this.init();
  3784. }
  3785. EventBus.prototype.init = function () {
  3786. var _this = this;
  3787. // 更改store值就会自动publish消息 - 实现
  3788. this.store = new Proxy({}, {
  3789. get: function (target, key) {
  3790. return target[key];
  3791. },
  3792. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3793. set: function (target, key, data) {
  3794. if (noValue(key))
  3795. return false;
  3796. target[key] = data;
  3797. // 消息通知订阅者
  3798. var observerArr = _this.observeStoreTable[key];
  3799. if (noValue(observerArr) || observerArr.length <= 0)
  3800. return true;
  3801. observerArr.forEach(function (handler) {
  3802. //try {
  3803. handler(data, key);
  3804. // } catch (err) {
  3805. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3806. // }
  3807. });
  3808. return true;
  3809. },
  3810. });
  3811. };
  3812. /** 取消注册订阅者 */
  3813. EventBus.prototype.unregisterObserver = function (key, handler) {
  3814. var _this = this;
  3815. var observerArr = this.observeStoreTable[key];
  3816. if (noValue(observerArr) || observerArr.length <= 0)
  3817. return;
  3818. if (noValue(handler)) {
  3819. this.observeStoreTable[key] = [];
  3820. }
  3821. else {
  3822. observerArr.forEach(function (obsHandler, index) {
  3823. if (obsHandler !== handler)
  3824. return;
  3825. _this.observeStoreTable[key].splice(index, 1);
  3826. });
  3827. }
  3828. };
  3829. /** 注册订阅者 */
  3830. EventBus.prototype.registerObserver = function (key, handler) {
  3831. var observerArr = this.observeStoreTable[key];
  3832. if (noValue(observerArr) || observerArr.length <= 0) {
  3833. observerArr = [];
  3834. this.observeStoreTable[key] = observerArr;
  3835. }
  3836. observerArr.push(handler);
  3837. // if (noValue(key)) return;
  3838. // const sourceValue = this.store[key];
  3839. // if (noValue(sourceValue)) return;
  3840. // handler(sourceValue, key);
  3841. };
  3842. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3843. EventBus.prototype.getStore = function () {
  3844. return this.store;
  3845. };
  3846. /**
  3847. * 取消订阅
  3848. * @param key 订阅的消息key
  3849. * @param handler 指定取消的监听函数
  3850. */
  3851. EventBus.prototype.unsubscribe = function (key, handler) {
  3852. var _this = this;
  3853. if (key instanceof Array) {
  3854. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3855. }
  3856. else {
  3857. this.unregisterObserver(key, handler);
  3858. }
  3859. };
  3860. /**
  3861. * 消息订阅
  3862. * @param key 订阅的消息key
  3863. * @param handler 监听函数
  3864. */
  3865. EventBus.prototype.subscribe = function (key, handler) {
  3866. var _this = this;
  3867. var cancelSubscribe = {
  3868. key: key,
  3869. cancel: function () {
  3870. },
  3871. };
  3872. if (key instanceof Array) {
  3873. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3874. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3875. }
  3876. else {
  3877. this.registerObserver(key, handler);
  3878. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3879. }
  3880. return cancelSubscribe;
  3881. };
  3882. /**
  3883. * 消息订阅(只订阅一次)
  3884. * @param key 订阅的消息key
  3885. * @param handler 监听函数
  3886. */
  3887. EventBus.prototype.subscribeOnce = function (key, handler) {
  3888. var cancelSubscribe = this.subscribe(key, function (data) {
  3889. // try {
  3890. handler(data, key);
  3891. // } catch (err) {
  3892. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3893. // }
  3894. cancelSubscribe.cancel();
  3895. });
  3896. };
  3897. /**
  3898. * 发送消息(触发订阅监听函数)
  3899. * @param key 消息key
  3900. * @param eventData 消息值
  3901. */
  3902. EventBus.prototype.publish = function (key, eventData) {
  3903. var _this = this;
  3904. if (key instanceof Array) {
  3905. key.forEach(function (k) { return _this.store[k] = eventData; });
  3906. }
  3907. else {
  3908. this.store[key] = eventData;
  3909. }
  3910. };
  3911. return EventBus;
  3912. }());
  3913. // ------------------------------------------------------------------------------------------ use
  3914. var eventBus = new EventBus();
  3915. //# sourceMappingURL=EventBus.js.map
  3916. var model$1 = {
  3917. data: {
  3918. dataSync_isStart: false,
  3919. dataSync: {
  3920. skipError: false,
  3921. clearData: false,
  3922. tables: []
  3923. },
  3924. dataSyncResult: {
  3925. jobId: ''
  3926. },
  3927. dataSource1: '',
  3928. dataSource2: '',
  3929. schema1: '',
  3930. schema2: '',
  3931. hasDiff: false,
  3932. }
  3933. };
  3934. //# sourceMappingURL=DbSync.model.js.map
  3935. var vjson$1 = {
  3936. title: '数据库同步',
  3937. layout: 'fit',
  3938. items: [
  3939. {
  3940. reference: 'wizard1',
  3941. layout: 'card',
  3942. items: [
  3943. {
  3944. reference: 'first',
  3945. layout: 'fit',
  3946. bbar: [
  3947. '->',
  3948. {
  3949. xtype: 'button',
  3950. iconCls: 'x-fa fa-road',
  3951. text: '结构同步 &raquo;',
  3952. bind: {
  3953. disabled: '{!hasDiff}'
  3954. },
  3955. listeners: {
  3956. click: 'scope.structCopyTo',
  3957. }
  3958. },
  3959. {
  3960. xtype: 'button',
  3961. iconCls: 'x-fa fa-files-o',
  3962. text: '数据同步 &raquo;',
  3963. bind: {
  3964. disabled: '{!hasDiff}'
  3965. },
  3966. listeners: {
  3967. click: 'scope.dataCopyTo',
  3968. }
  3969. },
  3970. {
  3971. xtype: 'button',
  3972. iconCls: 'x-fa fa-sort-alpha-desc',
  3973. text: '索引同步 &raquo;',
  3974. bind: {
  3975. disabled: '{!hasDiff}'
  3976. },
  3977. listeners: {
  3978. click: 'scope.indexCopyTo',
  3979. }
  3980. },
  3981. {
  3982. xtype: 'button',
  3983. iconCls: 'x-fa fa-product-hunt',
  3984. text: '存储过程同步 &raquo;',
  3985. bind: {
  3986. disabled: '{!hasDiff}'
  3987. },
  3988. listeners: {
  3989. click: 'scope.procedureCopyTo',
  3990. }
  3991. },
  3992. ],
  3993. items: [
  3994. {
  3995. title: '数据库对比',
  3996. reference: 'grid1',
  3997. xtype: 'yvgrid',
  3998. pagination: false,
  3999. border: false,
  4000. cellTip: true,
  4001. selModel: {
  4002. type: 'checkboxmodel',
  4003. mode: 'MULTI',
  4004. },
  4005. tbar: {
  4006. xtype: 'toolbar',
  4007. items: [
  4008. {
  4009. xtype: 'combo',
  4010. fieldLabel: '源数据库',
  4011. bind: {
  4012. value: '{dataSource1}'
  4013. },
  4014. dataSource: 'scope.getDataBaseName'
  4015. },
  4016. {
  4017. xtype: 'combo',
  4018. fieldLabel: '目标数据库',
  4019. bind: {
  4020. value: '{dataSource2}'
  4021. },
  4022. dataSource: 'scope.getDataBaseName'
  4023. },
  4024. {
  4025. xtype: 'button',
  4026. iconCls: 'x-fa fa-flash',
  4027. text: '对比',
  4028. bind: {
  4029. disabled: '{!dataSource1 || !dataSource2}'
  4030. },
  4031. listeners: {
  4032. click: 'scope.diff',
  4033. }
  4034. },
  4035. {
  4036. xtype: 'button',
  4037. iconCls: 'x-fa fa-cloud-download',
  4038. text: '重新拉取结构(耗时!)',
  4039. bind: {
  4040. disabled: '{!dataSource1 || !dataSource2}'
  4041. },
  4042. listeners: {
  4043. click: 'scope.dbToMeta',
  4044. }
  4045. },
  4046. ]
  4047. },
  4048. columns: [
  4049. {
  4050. dataIndex: 'table_name1',
  4051. header: '源表',
  4052. width: 300,
  4053. },
  4054. {
  4055. dataIndex: 'table_name2',
  4056. header: '目标表',
  4057. width: 300,
  4058. },
  4059. {
  4060. dataIndex: 'diff',
  4061. header: '对比结果',
  4062. width: 100,
  4063. },
  4064. {
  4065. xtype: 'actioncolumn',
  4066. width: 30,
  4067. sortable: false,
  4068. menuDisabled: true,
  4069. items: [
  4070. {
  4071. iconCls: 'x-fa fa-bars',
  4072. text: '打开',
  4073. handler: 'scope.showDetail',
  4074. }
  4075. ]
  4076. },
  4077. {
  4078. dataIndex: 'remark',
  4079. header: '详情',
  4080. width: 200,
  4081. sortable: true,
  4082. },
  4083. ],
  4084. },
  4085. ]
  4086. },
  4087. {
  4088. reference: 'ddl',
  4089. layout: {
  4090. type: 'vbox',
  4091. pack: 'start',
  4092. align: 'stretch'
  4093. },
  4094. items: [
  4095. {
  4096. xtype: 'sqleditor',
  4097. reference: 'ddleditor',
  4098. flex: 1,
  4099. },
  4100. {
  4101. xtype: 'toolbar',
  4102. items: [
  4103. '->',
  4104. {
  4105. xtype: 'button',
  4106. text: '&laquo; 上一步',
  4107. listeners: {
  4108. click: 'scope.back'
  4109. }
  4110. },
  4111. {
  4112. xtype: 'button',
  4113. iconCls: 'x-fa fa-flash',
  4114. text: '执行',
  4115. listeners: {
  4116. click: 'scope.executeDDL'
  4117. }
  4118. },
  4119. ]
  4120. }
  4121. ]
  4122. },
  4123. {
  4124. reference: 'ddl_idx',
  4125. layout: {
  4126. type: 'vbox',
  4127. pack: 'start',
  4128. align: 'stretch'
  4129. },
  4130. items: [
  4131. {
  4132. xtype: 'sqleditor',
  4133. reference: 'ddleditor_idx',
  4134. flex: 1,
  4135. },
  4136. {
  4137. xtype: 'toolbar',
  4138. items: [
  4139. '->',
  4140. {
  4141. xtype: 'button',
  4142. text: '&laquo; 上一步',
  4143. listeners: {
  4144. click: 'scope.back'
  4145. }
  4146. },
  4147. {
  4148. xtype: 'button',
  4149. iconCls: 'x-fa fa-flash',
  4150. text: '执行',
  4151. listeners: {
  4152. click: 'scope.executeDDLIdx'
  4153. }
  4154. },
  4155. ]
  4156. }
  4157. ]
  4158. },
  4159. {
  4160. reference: 'ddl_procedure',
  4161. layout: {
  4162. type: 'vbox',
  4163. pack: 'start',
  4164. align: 'stretch'
  4165. },
  4166. items: [
  4167. {
  4168. xtype: 'sqleditor',
  4169. reference: 'ddleditor_procedure',
  4170. flex: 1,
  4171. },
  4172. {
  4173. xtype: 'toolbar',
  4174. items: [
  4175. '->',
  4176. {
  4177. xtype: 'button',
  4178. text: '&laquo; 上一步',
  4179. listeners: {
  4180. click: 'scope.back'
  4181. }
  4182. },
  4183. {
  4184. xtype: 'button',
  4185. iconCls: 'x-fa fa-flash',
  4186. text: '执行',
  4187. listeners: {
  4188. click: 'scope.executeProcedureSQL'
  4189. }
  4190. },
  4191. ]
  4192. }
  4193. ]
  4194. },
  4195. {
  4196. reference: 'datacopy',
  4197. xtype: 'yvgrid',
  4198. pagination: false,
  4199. tbar: {
  4200. xtype: 'toolbar',
  4201. items: [
  4202. {
  4203. xtype: 'checkbox',
  4204. fieldLabel: '忽略错误',
  4205. bind: {
  4206. value: '{dataSync.skipError}'
  4207. },
  4208. },
  4209. {
  4210. xtype: 'checkbox',
  4211. fieldLabel: '清空数据',
  4212. bind: {
  4213. value: '{dataSync.clearData}'
  4214. },
  4215. },
  4216. {
  4217. xtype: 'button',
  4218. iconCls: 'x-fa fa-play-circle',
  4219. text: '开始',
  4220. bind: {
  4221. disabled: '{dataSync_isStart}'
  4222. },
  4223. listeners: { click: 'scope.dataSync_start' }
  4224. },
  4225. {
  4226. xtype: 'button',
  4227. iconCls: 'x-fa fa-stop-circle',
  4228. text: '停止',
  4229. bind: {
  4230. disabled: '{!dataSync_isStart}'
  4231. },
  4232. listeners: { click: 'scope.dataSync_stop' }
  4233. },
  4234. ]
  4235. },
  4236. columns: [
  4237. {
  4238. dataIndex: 'tableName', header: '表名',
  4239. width: 300,
  4240. },
  4241. {
  4242. dataIndex: 'dataCount', header: '总记录数',
  4243. width: 150,
  4244. },
  4245. {
  4246. dataIndex: 'currentIdx', header: '当前记录数',
  4247. width: 150,
  4248. },
  4249. {
  4250. dataIndex: 'syncCount', header: '同步数',
  4251. width: 150,
  4252. },
  4253. {
  4254. dataIndex: 'deleteCount', header: '删除',
  4255. width: 150,
  4256. },
  4257. {
  4258. dataIndex: 'syncProgress', header: '进度',
  4259. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4260. },
  4261. ]
  4262. }
  4263. ]
  4264. }
  4265. ]
  4266. };
  4267. //# sourceMappingURL=DbSync.view.js.map
  4268. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4269. function createEmptyModule(path, filename) {
  4270. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4271. }
  4272. function createFolder(parentPath, filename) {
  4273. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4274. }
  4275. function getModuleFileContent(module) {
  4276. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4277. }
  4278. function saveFile(fileFullPath, fileContent) {
  4279. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4280. // @ts-ignore
  4281. system.msg("保存成功");
  4282. return res;
  4283. });
  4284. }
  4285. function getQueryDslInfo(tableName) {
  4286. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4287. args: [
  4288. { tableName: tableName }
  4289. ]
  4290. }).catch(function (e) {
  4291. var _a, _b;
  4292. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4293. showErrorDialog(msg);
  4294. console.error(msg, e);
  4295. });
  4296. }
  4297. function invokeServer(url, param) {
  4298. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4299. return request.post(url, {
  4300. args: [
  4301. param
  4302. ]
  4303. }).catch(function (e) {
  4304. var _a, _b;
  4305. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4306. showErrorDialog(msg);
  4307. console.error(msg, e);
  4308. });
  4309. }
  4310. function parseSqlApi(sql) {
  4311. return request.post(getBaseUrl() + "@parseSqlApi", {
  4312. args: [sql]
  4313. }).catch(function (e) {
  4314. var _a, _b;
  4315. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4316. showErrorDialog(msg);
  4317. console.error(msg, e);
  4318. });
  4319. }
  4320. function saveModuleFiles(param) {
  4321. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4322. args: [
  4323. param
  4324. ]
  4325. }).catch(function (e) {
  4326. var _a, _b;
  4327. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4328. showErrorDialog(msg);
  4329. console.error(msg, e);
  4330. });
  4331. }
  4332. function createQueryDSLFile(_a) {
  4333. var schema_name = _a.schema_name, table_name = _a.table_name;
  4334. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4335. args: [{ schema_name: schema_name, table_name: table_name }]
  4336. }).catch(function (e) {
  4337. var _a, _b;
  4338. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4339. showErrorDialog(msg);
  4340. console.error(msg, e);
  4341. });
  4342. }
  4343. function dbToMeta(param) {
  4344. if (typeof param === 'undefined') {
  4345. param = { datasource: 'master' };
  4346. }
  4347. else if (typeof param.datasource === 'undefined') {
  4348. param.datasource = 'master';
  4349. }
  4350. return request.post(getBaseUrl() + "@dbToMeta", {
  4351. args: [
  4352. param
  4353. ]
  4354. }).catch(function (e) {
  4355. var _a, _b;
  4356. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4357. showErrorDialog(msg);
  4358. console.error(msg, e);
  4359. });
  4360. }
  4361. function getColumnDomainApi(param) {
  4362. if (typeof param === 'undefined') {
  4363. param = { datasource: 'master' };
  4364. }
  4365. else if (typeof param.datasource === 'undefined') {
  4366. param.datasource = 'master';
  4367. }
  4368. return request.post(getBaseUrl() + "@getColumnDomain", {
  4369. args: [
  4370. param
  4371. ]
  4372. }).catch(function (e) {
  4373. var _a, _b;
  4374. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4375. showErrorDialog(msg);
  4376. console.error(msg, e);
  4377. });
  4378. }
  4379. function getMateData(param) {
  4380. if (typeof param === 'undefined') {
  4381. param = { datasource: 'master' };
  4382. }
  4383. else if (typeof param.datasource === 'undefined') {
  4384. param.datasource = 'master';
  4385. }
  4386. return request.post(getBaseUrl() + "@getMateData", {
  4387. args: [
  4388. param
  4389. ]
  4390. }).catch(function (e) {
  4391. var _a, _b;
  4392. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4393. showErrorDialog(msg);
  4394. console.error(msg, e);
  4395. });
  4396. }
  4397. function getMateDataByTableName(param) {
  4398. if (typeof param === 'undefined') {
  4399. param = { datasource: 'master' };
  4400. }
  4401. else if (typeof param.datasource === 'undefined') {
  4402. param.datasource = 'master';
  4403. }
  4404. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4405. args: [
  4406. param
  4407. ]
  4408. }).catch(function (e) {
  4409. var _a, _b;
  4410. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4411. showErrorDialog(msg);
  4412. console.error(msg, e);
  4413. });
  4414. }
  4415. function saveMetaTableChanges(param) {
  4416. if (typeof param === 'undefined') {
  4417. param = { datasource: 'master' };
  4418. }
  4419. else if (typeof param.datasource === 'undefined') {
  4420. param.datasource = 'master';
  4421. }
  4422. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4423. args: [
  4424. param
  4425. ]
  4426. }).catch(function (e) {
  4427. var _a, _b;
  4428. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4429. showErrorDialog(msg);
  4430. console.error(msg, e);
  4431. });
  4432. }
  4433. function getModifyTableDDL(param) {
  4434. if (typeof param === 'undefined') {
  4435. param = { datasource: 'master' };
  4436. }
  4437. else if (typeof param.datasource === 'undefined') {
  4438. param.datasource = 'master';
  4439. }
  4440. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4441. args: [
  4442. param
  4443. ]
  4444. }).catch(function (e) {
  4445. var _a, _b;
  4446. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4447. showErrorDialog(msg);
  4448. console.error(msg, e);
  4449. });
  4450. }
  4451. function pushToDbCommitApi(param) {
  4452. if (typeof param === 'undefined') {
  4453. param = { datasource: 'master' };
  4454. }
  4455. else if (typeof param.datasource === 'undefined') {
  4456. param.datasource = 'master';
  4457. }
  4458. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4459. args: [
  4460. param
  4461. ]
  4462. }).catch(function (e) {
  4463. var _a, _b;
  4464. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4465. showErrorDialog(msg);
  4466. console.error(msg, e);
  4467. });
  4468. }
  4469. /**
  4470. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4471. */
  4472. function saveMetaExBuildDDL(param) {
  4473. if (typeof param === 'undefined') {
  4474. param = { datasource: 'master' };
  4475. }
  4476. else if (typeof param.datasource === 'undefined') {
  4477. param.datasource = 'master';
  4478. }
  4479. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4480. args: [
  4481. param
  4482. ]
  4483. }).catch(function (e) {
  4484. var _a, _b;
  4485. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4486. showErrorDialog(msg);
  4487. console.error(msg, e);
  4488. });
  4489. }
  4490. function registerResource(params) {
  4491. return request.post(getBaseUrl() + "@registerResource", {
  4492. args: [params]
  4493. }).catch(function (e) {
  4494. var _a, _b;
  4495. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4496. showErrorDialog(msg);
  4497. console.error(msg, e);
  4498. });
  4499. }
  4500. function getMenuTree(params) {
  4501. return request.post(getBaseUrl() + "@getMenuTree", {
  4502. args: [params]
  4503. }).catch(function (e) {
  4504. var _a, _b;
  4505. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4506. showErrorDialog(msg);
  4507. console.error(msg, e);
  4508. });
  4509. }
  4510. function moduleTree() {
  4511. return request.post(getBaseUrl() + "@moduleTree")
  4512. .catch(function (e) {
  4513. var _a, _b;
  4514. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4515. showErrorDialog(msg);
  4516. console.error(msg, e);
  4517. });
  4518. }
  4519. function dropTableDDL(schemaName, tableName) {
  4520. return request.post(getBaseUrl() + "@dropTableDDL", {
  4521. args: [
  4522. { schemaName: schemaName, tableName: tableName },
  4523. ]
  4524. }).catch(function (e) {
  4525. var _a, _b;
  4526. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4527. showErrorDialog(msg);
  4528. console.error(msg, e);
  4529. });
  4530. }
  4531. function renameTableDDL(schemaName, tableName, reTableName) {
  4532. return request.post(getBaseUrl() + "@renameTableDDL", {
  4533. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4534. }).catch(function (e) {
  4535. var _a, _b;
  4536. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4537. showErrorDialog(msg);
  4538. console.error(msg, e);
  4539. });
  4540. }
  4541. function executeModifyProcedureSQL(param) {
  4542. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4543. args: [
  4544. param,
  4545. ]
  4546. }).catch(function (e) {
  4547. var _a, _b;
  4548. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4549. showErrorDialog(msg);
  4550. console.error(msg, e);
  4551. });
  4552. }
  4553. function parseDynamicSqlApi(sql, dataSource) {
  4554. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4555. args: [
  4556. { sql: sql, dataSource: dataSource },
  4557. ]
  4558. }).catch(function (e) {
  4559. var _a, _b;
  4560. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4561. showErrorDialog(msg);
  4562. console.error(msg, e);
  4563. });
  4564. }
  4565. function exporerList() {
  4566. return request.post(getBaseUrl() + "@exporerList", {
  4567. args: [{}]
  4568. }).catch(function (e) {
  4569. var _a, _b;
  4570. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4571. showErrorDialog(msg);
  4572. console.error(msg, e);
  4573. });
  4574. }
  4575. function reportListApi() {
  4576. return request.post(getBaseUrl() + "@reportList", {
  4577. args: []
  4578. }).catch(function (e) {
  4579. var _a, _b;
  4580. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4581. showErrorDialog(msg);
  4582. console.error(msg, e);
  4583. });
  4584. }
  4585. function reportByIdApi(reportId) {
  4586. return request.post(getBaseUrl() + "@reportById", {
  4587. args: [
  4588. { reportId: reportId },
  4589. ]
  4590. }).catch(function (e) {
  4591. var _a, _b;
  4592. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4593. showErrorDialog(msg);
  4594. console.error(msg, e);
  4595. });
  4596. }
  4597. function createReportApi(reportName) {
  4598. return request.post(getBaseUrl() + "@createReport", {
  4599. args: [
  4600. { reportName: reportName },
  4601. ]
  4602. }).catch(function (e) {
  4603. var _a, _b;
  4604. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4605. showErrorDialog(msg);
  4606. console.error(msg, e);
  4607. });
  4608. }
  4609. function saveReportApi(param) {
  4610. return request.post(getBaseUrl() + "@saveReport", {
  4611. args: [
  4612. param,
  4613. ]
  4614. }).catch(function (e) {
  4615. var _a, _b;
  4616. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4617. showErrorDialog(msg);
  4618. console.error(msg, e);
  4619. });
  4620. }
  4621. function delReportApi(report_id) {
  4622. return request.post(getBaseUrl() + "@delReport", {
  4623. args: [{ report_id: report_id },]
  4624. }).catch(function (e) {
  4625. var _a, _b;
  4626. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4627. showErrorDialog(msg);
  4628. console.error(msg, e);
  4629. });
  4630. }
  4631. function getDict(param) {
  4632. if (typeof param === 'undefined') {
  4633. param = { datasource: 'master' };
  4634. }
  4635. else if (typeof param.datasource === 'undefined') {
  4636. param.datasource = 'master';
  4637. }
  4638. return request.post(getBaseUrl() + "@getDict", {
  4639. args: [
  4640. param
  4641. ]
  4642. });
  4643. }
  4644. function saveDictApi(param) {
  4645. if (typeof param === 'undefined') {
  4646. param = { datasource: 'master' };
  4647. }
  4648. else if (typeof param.datasource === 'undefined') {
  4649. param.datasource = 'master';
  4650. }
  4651. return request.post(getBaseUrl() + "@saveDict", {
  4652. args: [
  4653. param
  4654. ]
  4655. }).catch(function (e) {
  4656. var _a, _b;
  4657. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4658. showErrorDialog(msg);
  4659. console.error(msg, e);
  4660. });
  4661. }
  4662. function saveDictItemsApi(param) {
  4663. if (typeof param === 'undefined') {
  4664. param = { datasource: 'master' };
  4665. }
  4666. else if (typeof param.datasource === 'undefined') {
  4667. param.datasource = 'master';
  4668. }
  4669. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4670. args: [
  4671. param
  4672. ]
  4673. }).catch(function (e) {
  4674. var _a, _b;
  4675. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4676. showErrorDialog(msg);
  4677. console.error(msg, e);
  4678. });
  4679. }
  4680. function createDictEnum(param) {
  4681. return request.post(getBaseUrl() + "@createDictEnum", {
  4682. args: [
  4683. param
  4684. ]
  4685. }).catch(function (e) {
  4686. var _a, _b;
  4687. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4688. showErrorDialog(msg);
  4689. console.error(msg, e);
  4690. });
  4691. }
  4692. function loadSqlContentApi(url) {
  4693. return request.post(getBaseUrl() + "@loadSqlContent", {
  4694. args: [
  4695. {
  4696. url: GLOBAL_NAMESPACE_PREFIX + url,
  4697. }
  4698. ]
  4699. }).catch(function (e) {
  4700. var _a, _b;
  4701. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4702. showErrorDialog(msg);
  4703. console.error(msg, e);
  4704. });
  4705. }
  4706. function saveSqlContentApi(url, content) {
  4707. return request.post(getBaseUrl() + "@saveSqlContent", {
  4708. args: [
  4709. {
  4710. url: GLOBAL_NAMESPACE_PREFIX + url,
  4711. content: content,
  4712. }
  4713. ]
  4714. }).catch(function (e) {
  4715. var _a, _b;
  4716. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4717. showErrorDialog(msg);
  4718. console.error(msg, e);
  4719. });
  4720. }
  4721. function readBpmn(param) {
  4722. return request.post(getBaseUrl() + "@readBpmn", {
  4723. args: [param]
  4724. }).catch(function (e) {
  4725. var _a, _b;
  4726. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4727. showErrorDialog(msg);
  4728. console.error(msg, e);
  4729. });
  4730. }
  4731. function createBpmn(path, filename) {
  4732. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4733. var _a, _b;
  4734. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4735. showErrorDialog(msg);
  4736. console.error(msg, e);
  4737. });
  4738. }
  4739. function saveBpmn(fileFullPath, fileContent) {
  4740. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4741. // @ts-ignore
  4742. system.msg("保存成功");
  4743. return res;
  4744. });
  4745. }
  4746. function deleteBpmn(path, filename) {
  4747. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4748. var _a, _b;
  4749. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4750. showErrorDialog(msg);
  4751. console.error(msg, e);
  4752. });
  4753. }
  4754. function createDevForm(param) {
  4755. return request.post(getBaseUrl() + "@createDevForm", {
  4756. args: [param]
  4757. }).catch(function (e) {
  4758. var _a, _b;
  4759. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4760. showErrorDialog(msg);
  4761. console.error(msg, e);
  4762. });
  4763. }
  4764. function readDevForm(param) {
  4765. return request.post(getBaseUrl() + "@readDevForm", {
  4766. args: [param]
  4767. }).catch(function (e) {
  4768. var _a, _b;
  4769. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4770. showErrorDialog(msg);
  4771. console.error(msg, e);
  4772. });
  4773. }
  4774. function calcColumnForm(param) {
  4775. return request.post(getBaseUrl() + "@calcColumnForm", {
  4776. args: [param]
  4777. }).catch(function (e) {
  4778. var _a, _b;
  4779. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4780. showErrorDialog(msg);
  4781. console.error(msg, e);
  4782. });
  4783. }
  4784. function widgetListApi(param) {
  4785. return request.post(getBaseUrl() + "@widgetListApi", {
  4786. args: [param]
  4787. }).catch(function (e) {
  4788. var _a, _b;
  4789. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4790. showErrorDialog(msg);
  4791. console.error(msg, e);
  4792. });
  4793. }
  4794. function readWidget(param) {
  4795. return request.post(getBaseUrl() + "@readWidget", {
  4796. args: [param]
  4797. }).catch(function (e) {
  4798. var _a, _b;
  4799. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4800. showErrorDialog(msg);
  4801. console.error(msg, e);
  4802. });
  4803. }
  4804. function saveWidget(param) {
  4805. return request.post(getBaseUrl() + "@saveWidget", {
  4806. args: [param]
  4807. }).catch(function (e) {
  4808. var _a, _b;
  4809. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4810. showErrorDialog(msg);
  4811. console.error(msg, e);
  4812. });
  4813. }
  4814. function deleteWidget(param) {
  4815. return request.post(getBaseUrl() + "@deleteWidget", {
  4816. args: [param]
  4817. }).catch(function (e) {
  4818. var _a, _b;
  4819. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4820. showErrorDialog(msg);
  4821. console.error(msg, e);
  4822. });
  4823. }
  4824. function getDataBaseNameApi() {
  4825. return request.post(getBaseUrl() + "@getDataBaseName", {
  4826. args: []
  4827. }).catch(function (e) {
  4828. var _a, _b;
  4829. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4830. showErrorDialog(msg);
  4831. console.error(msg, e);
  4832. });
  4833. }
  4834. function getDiffDDLApi(param) {
  4835. return request.post(getBaseUrl() + "@getDiffDDL", {
  4836. args: [
  4837. param
  4838. ]
  4839. }).catch(function (e) {
  4840. var _a, _b;
  4841. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4842. showErrorDialog(msg);
  4843. console.error(msg, e);
  4844. });
  4845. }
  4846. function dataSyncApi(param) {
  4847. return request.post(getBaseUrl() + "@dataSync", {
  4848. args: [
  4849. param
  4850. ]
  4851. }).catch(function (e) {
  4852. var _a, _b;
  4853. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4854. showErrorDialog(msg);
  4855. console.error(msg, e);
  4856. });
  4857. }
  4858. function dataSyncInfoApi(param) {
  4859. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4860. args: [
  4861. param
  4862. ]
  4863. }).catch(function (e) {
  4864. var _a, _b;
  4865. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4866. showErrorDialog(msg);
  4867. console.error(msg, e);
  4868. });
  4869. }
  4870. function saveColumnDomain(param) {
  4871. if (typeof param === 'undefined') {
  4872. param = { datasource: 'master' };
  4873. }
  4874. else if (typeof param.datasource === 'undefined') {
  4875. param.datasource = 'master';
  4876. }
  4877. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4878. args: [
  4879. param
  4880. ]
  4881. }).catch(function (e) {
  4882. var _a, _b;
  4883. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4884. showErrorDialog('发生错误:' + msg);
  4885. console.error(msg, e);
  4886. });
  4887. }
  4888. function devOpsList() {
  4889. return request.post(getBaseUrl() + "@devOpsList", {
  4890. args: [{}]
  4891. }).catch(function (e) {
  4892. var _a, _b;
  4893. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4894. showErrorDialog('发生错误:' + msg);
  4895. console.error(msg, e);
  4896. });
  4897. }
  4898. function devOpsById(opsId) {
  4899. return request.post(getBaseUrl() + "@devOpsById", {
  4900. args: [{ opsId: opsId }]
  4901. }).catch(function (e) {
  4902. var _a, _b;
  4903. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4904. showErrorDialog('发生错误:' + msg);
  4905. console.error(msg, e);
  4906. });
  4907. }
  4908. function metricsRequestApi() {
  4909. return request.get("/api/metrics/request")
  4910. .catch(function (e) {
  4911. var _a, _b;
  4912. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4913. showErrorDialog('发生错误:' + msg);
  4914. console.error(msg, e);
  4915. });
  4916. }
  4917. function metricsJdbcApi() {
  4918. return request.get("/api/metrics/jdbc")
  4919. .catch(function (e) {
  4920. var _a, _b;
  4921. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4922. showErrorDialog('发生错误:' + msg);
  4923. console.error(msg, e);
  4924. });
  4925. }
  4926. function executeDDL(param) {
  4927. return request.post(getBaseUrl() + "@executeDDL", {
  4928. args: [
  4929. param,
  4930. ]
  4931. }).catch(function (e) {
  4932. var _a, _b;
  4933. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4934. showErrorDialog('发生错误:' + msg);
  4935. console.error(msg, e);
  4936. });
  4937. }
  4938. function getModifyIdxDDL(param) {
  4939. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4940. args: [
  4941. param,
  4942. ]
  4943. }).catch(function (e) {
  4944. var _a, _b;
  4945. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4946. showErrorDialog('发生错误:' + msg);
  4947. console.error(msg, e);
  4948. });
  4949. }
  4950. function getModifyProcedureSQL(param) {
  4951. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4952. args: [
  4953. param,
  4954. ]
  4955. }).catch(function (e) {
  4956. var _a, _b;
  4957. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4958. showErrorDialog('发生错误:' + msg);
  4959. console.error(msg, e);
  4960. });
  4961. }
  4962. function saveWhLayout(param) {
  4963. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4964. args: [
  4965. param,
  4966. ]
  4967. }).catch(function (e) {
  4968. var _a, _b;
  4969. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4970. showErrorDialog('发生错误:' + msg);
  4971. console.error(msg, e);
  4972. });
  4973. }
  4974. function deleteWhLayout(param) {
  4975. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4976. args: [
  4977. param,
  4978. ]
  4979. }).catch(function (e) {
  4980. var _a, _b;
  4981. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4982. showErrorDialog('发生错误:' + msg);
  4983. console.error(msg, e);
  4984. });
  4985. }
  4986. function loadWhLayoutAll() {
  4987. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4988. args: []
  4989. }).catch(function (e) {
  4990. var _a, _b;
  4991. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4992. showErrorDialog('发生错误:' + msg);
  4993. console.error(msg, e);
  4994. });
  4995. }
  4996. function loadWhLayout(param) {
  4997. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4998. args: [
  4999. param,
  5000. ]
  5001. }).catch(function (e) {
  5002. var _a, _b;
  5003. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  5004. showErrorDialog('发生错误:' + msg);
  5005. console.error(msg, e);
  5006. });
  5007. }
  5008. var baseUrl = "/api/com/yvan/studio/FileManager";
  5009. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  5010. function getBaseUrl() {
  5011. // return getCurrentProject().url + baseUrl
  5012. return baseUrl;
  5013. }
  5014. function getLayoutUrl() {
  5015. // return getCurrentProject().url + baseUrl
  5016. return layoutUrl;
  5017. }
  5018. var Request = /** @class */ (function () {
  5019. function Request(axiosInstance) {
  5020. this.axiosInstance = axiosInstance;
  5021. }
  5022. // 全局响应数据转换处理
  5023. Request.transformResponse = function (response) {
  5024. var _a;
  5025. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5026. };
  5027. Request.prototype.get = function (url, config) {
  5028. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5029. };
  5030. Request.prototype.delete = function (url, config) {
  5031. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5032. };
  5033. Request.prototype.head = function (url, config) {
  5034. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5035. };
  5036. Request.prototype.options = function (url, config) {
  5037. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5038. };
  5039. Request.prototype.post = function (url, data, config) {
  5040. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5041. };
  5042. Request.prototype.put = function (url, data, config) {
  5043. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5044. };
  5045. Request.prototype.patch = function (url, data, config) {
  5046. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5047. };
  5048. Request.prototype.request = function (config) {
  5049. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5050. };
  5051. return Request;
  5052. }());
  5053. /** 创建一个axios实例对象 */
  5054. function axiosCreate(config) {
  5055. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5056. }
  5057. var axiosInstance;
  5058. function init() {
  5059. axiosInstance = axiosCreate({
  5060. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5061. });
  5062. request = new Request(axiosInstance);
  5063. }
  5064. var request;
  5065. /**
  5066. * 对比两个列 是否存在不一致
  5067. */
  5068. function compareColumn(t1, c1, t2, c2) {
  5069. if (typeof c2 === 'undefined') {
  5070. return 'column_name';
  5071. }
  5072. if (c1.column_name !== c2.column_name) {
  5073. return 'column_name';
  5074. }
  5075. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5076. return 'default_value';
  5077. }
  5078. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5079. return 'column_comment';
  5080. }
  5081. if (c1.is_primary_key !== c2.is_primary_key) {
  5082. return 'is_primary_key';
  5083. }
  5084. if (c1.not_null !== c2.not_null) {
  5085. return 'not_null';
  5086. }
  5087. var symbol1 = getDataTypeSymbol(t1, c1);
  5088. var symbol2 = getDataTypeSymbol(t2, c2);
  5089. if (symbol1 !== symbol2) {
  5090. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5091. return 'data_type';
  5092. }
  5093. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5094. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5095. // 只关注长度
  5096. if (c1.column_size != c2.column_size) {
  5097. return 'column_size';
  5098. }
  5099. }
  5100. else {
  5101. // 其他情况,长度和精度都要关注
  5102. if (c1.column_size != c2.column_size) {
  5103. return 'column_size';
  5104. }
  5105. if (c1.decimal_digits !== c2.decimal_digits) {
  5106. return 'decimal_digits';
  5107. }
  5108. }
  5109. }
  5110. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5111. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5112. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5113. if (symbol1 !== symbol2) {
  5114. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5115. return 'data_type';
  5116. }
  5117. if (is_fix_size) {
  5118. // 字段域吧大小限制住了
  5119. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5120. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5121. // 只关注长度
  5122. if (column.column_size != domain.column_size) {
  5123. return 'column_size';
  5124. }
  5125. }
  5126. else {
  5127. // 其他情况,长度和精度都要关注
  5128. if (column.column_size != domain.column_size) {
  5129. return 'column_size';
  5130. }
  5131. if (column.decimal_digits !== domain.decimal_digits) {
  5132. return 'decimal_digits';
  5133. }
  5134. }
  5135. }
  5136. }
  5137. function checkColumn(table, col) {
  5138. if (isEmpty(col.column_name)) {
  5139. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5140. }
  5141. if (isKeyword(col.column_name)) {
  5142. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5143. }
  5144. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5145. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5146. }
  5147. return undefined;
  5148. }
  5149. function applyDomain(dbType, domain) {
  5150. var editRow = {
  5151. data_type: domain[dbType + '_datatype'],
  5152. };
  5153. domain = _$2.cloneDeep(domain);
  5154. if (!editRow.data_type) {
  5155. throw Error('字段域没有定义数据类型!');
  5156. }
  5157. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5158. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5159. if (match) {
  5160. // 类型里面包含括号
  5161. var sz = parseInt(match[2]);
  5162. if (isNaN(sz)) {
  5163. throw Error('字段域的定义错误:' + editRow.data_type);
  5164. }
  5165. domain.is_fix_size = true;
  5166. editRow.data_type = match[1];
  5167. domain.column_size = sz;
  5168. domain.decimal_digits = 0;
  5169. }
  5170. else {
  5171. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5172. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5173. if (match2) {
  5174. // 类型里面包含括号
  5175. var sz = parseInt(match2[2]);
  5176. if (isNaN(sz)) {
  5177. throw Error('字段域的定义错误:' + editRow.data_type);
  5178. }
  5179. var dg = parseInt(match2[3]);
  5180. if (isNaN(dg)) {
  5181. throw Error('字段域的定义错误:' + editRow.data_type);
  5182. }
  5183. domain.is_fix_size = true;
  5184. editRow.data_type = match[1];
  5185. domain.column_size = sz;
  5186. domain.decimal_digits = dg;
  5187. }
  5188. }
  5189. if (domain.domain_column_ui) {
  5190. _$2.extend(editRow, {
  5191. column_ui: domain.domain_column_ui,
  5192. });
  5193. }
  5194. if (domain.domain_column_dict) {
  5195. _$2.extend(editRow, {
  5196. column_dict: domain.domain_column_dict,
  5197. });
  5198. }
  5199. if (domain.is_fix_size) {
  5200. _$2.extend(editRow, {
  5201. column_size: domain.column_size,
  5202. decimal_digits: domain.decimal_digits
  5203. });
  5204. }
  5205. if (domain.is_fix_default_value) {
  5206. _$2.extend(editRow, {
  5207. default_value: domain.default_value,
  5208. });
  5209. }
  5210. return editRow;
  5211. }
  5212. /**
  5213. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5214. */
  5215. function getDataTypeSymbol(table, col) {
  5216. if (table.db_type === 'oracle') {
  5217. switch (col.data_type) {
  5218. case 'number':
  5219. if (col.column_size <= 10 && !col.decimal_digits) {
  5220. return 'integer';
  5221. }
  5222. else if (col.column_size <= 19 && !col.decimal_digits) {
  5223. return 'long';
  5224. }
  5225. return 'bigdecimal';
  5226. case 'char':
  5227. if (col.column_size > 3000) {
  5228. return 'clob';
  5229. }
  5230. return 'char';
  5231. case 'integer':
  5232. return 'integer';
  5233. case 'varchar':
  5234. case 'varchar2':
  5235. if (col.column_size > 3000) {
  5236. return 'clob';
  5237. }
  5238. return 'varchar';
  5239. case 'clob':
  5240. return 'clob';
  5241. case 'blob':
  5242. return 'blob';
  5243. case 'date':
  5244. case 'timestamp':
  5245. case 'timestamp(6)':
  5246. case 'timestamp with local time zone':
  5247. case 'timestamp(6) with local time zone':
  5248. case 'timestamp(6) with time zone':
  5249. return 'timestamp';
  5250. }
  5251. return "undefined";
  5252. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5253. }
  5254. if (table.db_type === 'pgsql') {
  5255. switch (col.data_type) {
  5256. case 'int4':
  5257. return 'integer';
  5258. case 'int8':
  5259. return 'long';
  5260. case 'char':
  5261. return 'char';
  5262. case 'varchar':
  5263. case 'varchar2':
  5264. if (col.column_size > 3000) {
  5265. return 'clob';
  5266. }
  5267. return 'varchar';
  5268. case 'numeric':
  5269. if (col.column_size <= 10 && !col.decimal_digits) {
  5270. return 'integer';
  5271. }
  5272. else if (col.column_size <= 19 && !col.decimal_digits) {
  5273. return 'long';
  5274. }
  5275. return 'bigdecimal';
  5276. case 'timestamp':
  5277. case 'timestamptz':
  5278. return 'timestamp';
  5279. case 'bytea':
  5280. return 'blob';
  5281. }
  5282. return "undefined";
  5283. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5284. }
  5285. throw Error('未知数据库类型:' + table.db_type);
  5286. }
  5287. /**
  5288. * 判断对象名称是不是数据库关键字(保留字)
  5289. */
  5290. function isKeyword(word) {
  5291. if (!word || typeof word !== 'string') {
  5292. return false;
  5293. }
  5294. var kk = ['access',
  5295. 'add',
  5296. 'all',
  5297. 'alter',
  5298. 'and',
  5299. 'any',
  5300. 'as',
  5301. 'asc',
  5302. 'audit',
  5303. 'between',
  5304. 'by',
  5305. 'char',
  5306. 'check',
  5307. 'cluster',
  5308. 'column',
  5309. 'comment',
  5310. 'compress',
  5311. 'connect',
  5312. 'create',
  5313. 'current',
  5314. 'date',
  5315. 'decimal',
  5316. 'default',
  5317. 'delete',
  5318. 'desc',
  5319. 'distinct',
  5320. 'drop',
  5321. 'else',
  5322. 'exclusive',
  5323. 'exists',
  5324. 'file',
  5325. 'float',
  5326. 'for',
  5327. 'from',
  5328. 'grant',
  5329. 'group',
  5330. 'having',
  5331. 'identified',
  5332. 'immediate',
  5333. 'in',
  5334. 'increment',
  5335. 'index',
  5336. 'initial',
  5337. 'insert',
  5338. 'integer',
  5339. 'intersect',
  5340. 'into',
  5341. 'is',
  5342. 'level',
  5343. 'like',
  5344. 'lock',
  5345. 'long',
  5346. 'maxextents',
  5347. 'minus',
  5348. 'mlslabel',
  5349. 'mode',
  5350. 'modify',
  5351. 'noaudit',
  5352. 'nocompress',
  5353. 'not',
  5354. 'nowait',
  5355. 'null',
  5356. 'number',
  5357. 'of',
  5358. 'offline',
  5359. 'on',
  5360. 'online',
  5361. 'option',
  5362. 'or',
  5363. 'order',
  5364. 'p',
  5365. 'ctfree',
  5366. 'prior',
  5367. 'privileges',
  5368. 'public',
  5369. 'raw',
  5370. 'rename',
  5371. 'resource',
  5372. 'revoke',
  5373. 'row',
  5374. 'rowid',
  5375. 'rownum',
  5376. 'rows',
  5377. 'select',
  5378. 'session',
  5379. 'set',
  5380. 'share',
  5381. 'size',
  5382. 'smallint',
  5383. 'start',
  5384. 'successful',
  5385. 'synonym',
  5386. 'sysdate',
  5387. 'table',
  5388. 'then',
  5389. 'to',
  5390. 'trigger',
  5391. 'uid',
  5392. 'union',
  5393. 'unique',
  5394. 'update',
  5395. 'user',
  5396. 'validate',
  5397. 'values',
  5398. 'varchar',
  5399. 'varchar2',
  5400. 'view',
  5401. 'whenever',
  5402. 'where',
  5403. 'with'];
  5404. return _$2.includes(kk, word.toLowerCase());
  5405. }
  5406. //# sourceMappingURL=DbUtils.js.map
  5407. var DbSync = /** @class */ (function (_super) {
  5408. __extends(DbSync, _super);
  5409. function DbSync() {
  5410. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5411. }
  5412. DbSync.prototype.onLoad = function () {
  5413. };
  5414. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5415. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5416. getDataBaseNameApi().then(function (res) {
  5417. successCallback(res.data.map(function (name) {
  5418. return {
  5419. id: name, text: name
  5420. };
  5421. }));
  5422. });
  5423. };
  5424. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5425. showInfoDialog(record.get('remark'));
  5426. };
  5427. DbSync.prototype.diff = function () {
  5428. var _this = this;
  5429. var promise1 = getMateData({
  5430. datasource: this.viewModel.get('dataSource1')
  5431. });
  5432. var promise2 = getMateData({
  5433. datasource: this.viewModel.get('dataSource2')
  5434. });
  5435. this.viewModel.set('schema1', '');
  5436. this.viewModel.set('schema2', '');
  5437. this.refs.grid1.setLoading(true);
  5438. Promise.all([promise1, promise2]).then(function (_a) {
  5439. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5440. var rows = [];
  5441. if (_$2.size(res1) > 0) {
  5442. // res1 起码有一个 schema
  5443. _this.viewModel.set('schema1', res1[0].schema_name);
  5444. _this.viewModel.set('schema2', res2[0].schema_name);
  5445. if (!_this.viewModel.get('schema1')) {
  5446. msg$1('datasource1 最起码需要一张表');
  5447. return;
  5448. }
  5449. if (!_this.viewModel.get('schema2')) {
  5450. msg$1('datasource2 最起码需要一张表');
  5451. return;
  5452. }
  5453. _$2.forEach(res1[0].table_list, function (table1) {
  5454. var _a;
  5455. var table2 = _$2.find((_a = res2[0]) === null || _a === void 0 ? void 0 : _a.table_list, function (r) { return r.table_name === table1.table_name; });
  5456. if (table1.schema_name) {
  5457. _this.viewModel.set('schema1', table1.schema_name);
  5458. }
  5459. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5460. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5461. }
  5462. var row = {
  5463. table_name1: table1.table_name,
  5464. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5465. table_info: table1
  5466. };
  5467. if (!table2) {
  5468. row.diff = '不一致';
  5469. row.remark = '目标表缺失';
  5470. }
  5471. else if (table1.column_list.length !== table2.column_list.length) {
  5472. row.diff = '不一致';
  5473. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5474. }
  5475. else {
  5476. row.diff = '一致';
  5477. var remark_1 = [];
  5478. _$2.forEach(table1.column_list, function (col1) {
  5479. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5480. if (!col2) {
  5481. row.diff = '不一致';
  5482. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5483. }
  5484. else {
  5485. var colDiff = compareColumn(table1, col1, table2, col2);
  5486. if (colDiff) {
  5487. row.diff = '不一致';
  5488. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5489. }
  5490. }
  5491. });
  5492. row.remark = remark_1.join('\n');
  5493. }
  5494. rows.push(row);
  5495. });
  5496. }
  5497. _this.refs.grid1.setData(rows);
  5498. _this.viewModel.set('hasDiff', true);
  5499. }).finally(function () {
  5500. _this.refs.grid1.setLoading(false);
  5501. });
  5502. };
  5503. DbSync.prototype.structCopyTo = function () {
  5504. var _this = this;
  5505. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5506. msg$1('选择数据源!');
  5507. return;
  5508. }
  5509. var recordList = this.refs.grid1.getSelection();
  5510. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5511. if (_$2.size(tableNameList) <= 0) {
  5512. msg$1('请选择要同步的表');
  5513. return;
  5514. }
  5515. var error = undefined;
  5516. _$2.forEach(tableNameList, function (tableInfo) {
  5517. _$2.forEach(tableInfo.column_list, function (col) {
  5518. error = checkColumn(tableInfo, col);
  5519. return false;
  5520. });
  5521. if (error) {
  5522. return false;
  5523. }
  5524. });
  5525. if (error) {
  5526. msg$1(error);
  5527. return;
  5528. }
  5529. var schema1 = this.viewModel.get('schema1');
  5530. var schema2 = this.viewModel.get('schema2');
  5531. if (!schema1 || !schema2) {
  5532. msg$1('无法识别 schema 名称');
  5533. return;
  5534. }
  5535. this.refs.grid1.setLoading(true);
  5536. getDiffDDLApi({
  5537. datasource1: this.viewModel.get('dataSource1'),
  5538. datasource2: this.viewModel.get('dataSource2'),
  5539. schema1: this.viewModel.get('schema1'),
  5540. schema2: this.viewModel.get('schema2'),
  5541. tables: tableNameList,
  5542. }).then(function (res) {
  5543. if (res.success) {
  5544. _this.refs.ddleditor.setCode(res.data);
  5545. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5546. }
  5547. }).finally(function () {
  5548. _this.refs.grid1.setLoading(false);
  5549. });
  5550. };
  5551. DbSync.prototype.indexCopyTo = function () {
  5552. var _this = this;
  5553. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5554. msg$1('选择数据源!');
  5555. return;
  5556. }
  5557. var recordList = this.refs.grid1.getSelection();
  5558. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5559. if (_$2.size(tableNameList) <= 0) {
  5560. msg$1('请选择要同步的表');
  5561. return;
  5562. }
  5563. var schema1 = this.viewModel.get('schema1');
  5564. var schema2 = this.viewModel.get('schema2');
  5565. if (!schema1 || !schema2) {
  5566. msg$1('无法识别 schema 名称');
  5567. return;
  5568. }
  5569. this.refs.grid1.setLoading(true);
  5570. getModifyIdxDDL({
  5571. datasource1: this.viewModel.get('dataSource1'),
  5572. datasource2: this.viewModel.get('dataSource2'),
  5573. schema1: this.viewModel.get('schema1'),
  5574. schema2: this.viewModel.get('schema2'),
  5575. tables: tableNameList,
  5576. }).then(function (res) {
  5577. if (res.success) {
  5578. _this.refs.ddleditor_idx.setCode(res.data);
  5579. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5580. }
  5581. }).finally(function () {
  5582. _this.refs.grid1.setLoading(false);
  5583. });
  5584. };
  5585. DbSync.prototype.procedureCopyTo = function () {
  5586. var _this = this;
  5587. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5588. msg$1('选择数据源!');
  5589. return;
  5590. }
  5591. var schema1 = this.viewModel.get('schema1');
  5592. var schema2 = this.viewModel.get('schema2');
  5593. if (!schema1 || !schema2) {
  5594. msg$1('无法识别 schema 名称');
  5595. return;
  5596. }
  5597. this.refs.grid1.setLoading(true);
  5598. getModifyProcedureSQL({
  5599. datasource1: this.viewModel.get('dataSource1'),
  5600. datasource2: this.viewModel.get('dataSource2'),
  5601. schema1: this.viewModel.get('schema1'),
  5602. schema2: this.viewModel.get('schema2'),
  5603. }).then(function (res) {
  5604. if (res.success) {
  5605. _this.refs.ddleditor_procedure.setCode(res.data);
  5606. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5607. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5608. }
  5609. }).finally(function () {
  5610. _this.refs.grid1.setLoading(false);
  5611. });
  5612. };
  5613. DbSync.prototype.dataSync_start = function () {
  5614. var _this = this;
  5615. this.viewModel.set('dataSync_isStart', true);
  5616. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5617. this.refs.datacopy.setLoading(true);
  5618. dataSyncApi(dataSync)
  5619. .then(function (res) {
  5620. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5621. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5622. })
  5623. .finally(function () {
  5624. _this.refs.datacopy.setLoading(false);
  5625. });
  5626. };
  5627. DbSync.prototype.dataSync_process = function () {
  5628. var _this = this;
  5629. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5630. dataSyncInfoApi({ jobId: jobId })
  5631. .then(function (res) {
  5632. if (_$2.isArray(res.tableSyncInfos)) {
  5633. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5634. _this.refs.datacopy.setData(res.tableSyncInfos);
  5635. try {
  5636. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5637. }
  5638. catch (e) {
  5639. }
  5640. }
  5641. if (res.endTime) {
  5642. // 已经结束
  5643. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5644. if (res.success) {
  5645. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5646. }
  5647. else {
  5648. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5649. }
  5650. _this.dataSync_stop();
  5651. }
  5652. })
  5653. .catch(function (e) {
  5654. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5655. console.error(e);
  5656. // this.dataSync_stop()
  5657. })
  5658. .finally(function () {
  5659. _this.refs.datacopy.setLoading(false);
  5660. });
  5661. };
  5662. DbSync.prototype.dataSync_stop = function () {
  5663. this.viewModel.set('dataSync_isStart', false);
  5664. clearInterval(this.dataSyncInterval);
  5665. delete this.dataSyncInterval;
  5666. };
  5667. DbSync.prototype.dataCopyTo = function () {
  5668. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5669. msg$1('选择数据源!');
  5670. return;
  5671. }
  5672. var recordList = this.refs.grid1.getSelection();
  5673. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5674. if (_$2.size(tableNameList) <= 0) {
  5675. msg$1('请选择要同步的表');
  5676. return;
  5677. }
  5678. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5679. this.viewModel.set('dataSync.tables', tableNameList);
  5680. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5681. };
  5682. DbSync.prototype.next = function () {
  5683. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5684. };
  5685. DbSync.prototype.back = function () {
  5686. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5687. };
  5688. DbSync.prototype.dbToMeta = function () {
  5689. var _this = this;
  5690. var dataSource1 = this.viewModel.get('dataSource1');
  5691. var dataSource2 = this.viewModel.get('dataSource2');
  5692. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5693. var promise1 = dbToMeta({ datasource: dataSource1 });
  5694. var promise2 = dbToMeta({ datasource: dataSource2 });
  5695. _this.refs.grid1.setLoading(true);
  5696. Promise.all([promise1, promise2]).then(function (_a) {
  5697. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5698. _this.diff();
  5699. }).catch(function (res) {
  5700. _this.refs.grid1.setLoading(false);
  5701. showErrorDialog$1(res);
  5702. });
  5703. });
  5704. };
  5705. DbSync.prototype.executeDDL = function () {
  5706. var _this = this;
  5707. var code = this.refs.ddleditor.getValue();
  5708. var dataSource2 = this.viewModel.get('dataSource2');
  5709. var target_schema_name = this.viewModel.get('schema2');
  5710. var recordList = this.refs.grid1.getSelection();
  5711. var table_infos = _$2.map(recordList, function (r) {
  5712. return r.get('table_info');
  5713. });
  5714. this.setLoading(true);
  5715. pushToDbCommitApi({
  5716. datasource: dataSource2,
  5717. ddl: code,
  5718. table_infos: table_infos,
  5719. target_schema_name: target_schema_name,
  5720. }).then(function (res) {
  5721. if (res === null || res === void 0 ? void 0 : res.success) {
  5722. msg$1('执行成功');
  5723. _this.back();
  5724. _this.diff();
  5725. return;
  5726. }
  5727. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5728. }).finally(function () {
  5729. _this.setLoading(false);
  5730. });
  5731. };
  5732. DbSync.prototype.executeDDLIdx = function () {
  5733. var _this = this;
  5734. var code = this.refs.ddleditor_idx.getValue();
  5735. var dataSource2 = this.viewModel.get('dataSource2');
  5736. this.setLoading(true);
  5737. executeDDL({
  5738. datasource: dataSource2,
  5739. ddl: code,
  5740. }).then(function (res) {
  5741. if (res === null || res === void 0 ? void 0 : res.success) {
  5742. msg$1('执行成功');
  5743. _this.back();
  5744. return;
  5745. }
  5746. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5747. }).finally(function () {
  5748. _this.setLoading(false);
  5749. });
  5750. };
  5751. DbSync.prototype.executeProcedureSQL = function () {
  5752. var _this = this;
  5753. this.setLoading(true);
  5754. executeModifyProcedureSQL({
  5755. datasource1: this.viewModel.get('dataSource1'),
  5756. datasource2: this.viewModel.get('dataSource2'),
  5757. schema1: this.viewModel.get('schema1'),
  5758. schema2: this.viewModel.get('schema2'),
  5759. }).then(function (res) {
  5760. if (res === null || res === void 0 ? void 0 : res.success) {
  5761. msg$1('执行成功');
  5762. _this.back();
  5763. return;
  5764. }
  5765. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5766. }).finally(function () {
  5767. _this.setLoading(false);
  5768. });
  5769. };
  5770. return DbSync;
  5771. }(Scope));
  5772. //# sourceMappingURL=DbSync.js.map
  5773. var model$2 = {
  5774. data: {}
  5775. };
  5776. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5777. var vjson$2 = {
  5778. title: '示例代码',
  5779. layout: 'fit',
  5780. items: [
  5781. {
  5782. layout: 'border',
  5783. items: [
  5784. {
  5785. region: 'north',
  5786. split: true,
  5787. height: 200,
  5788. title: '表格数据',
  5789. reference: 'dataeditor',
  5790. xtype: 'jsoneditor',
  5791. listeners: {
  5792. change: 'scope.dataChanged'
  5793. },
  5794. },
  5795. {
  5796. region: 'west',
  5797. split: true,
  5798. width: 230,
  5799. title: '模板',
  5800. reference: 'tree1',
  5801. xtype: 'treepanel',
  5802. rootVisible: false,
  5803. useArrows: true,
  5804. colspan: 2,
  5805. lines: true,
  5806. multiSelect: false,
  5807. listeners: {
  5808. itemclick: 'scope.templateChange',
  5809. },
  5810. },
  5811. {
  5812. region: 'center',
  5813. title: '参考代码',
  5814. reference: 'preview',
  5815. xtype: 'jsoneditor',
  5816. },
  5817. ]
  5818. }
  5819. ]
  5820. };
  5821. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5822. var rootNode = {
  5823. id: 'ROOT',
  5824. type: "ROOT",
  5825. path: "",
  5826. expanded: true,
  5827. leaf: false,
  5828. children: [
  5829. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5830. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5831. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5832. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5833. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5834. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5835. ],
  5836. };
  5837. var TemplateDev = /** @class */ (function (_super) {
  5838. __extends(TemplateDev, _super);
  5839. function TemplateDev() {
  5840. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5841. _this.dataChanged = _$2.debounce(function () {
  5842. var me = _this;
  5843. if (me.refs.tree1.selection) {
  5844. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5845. }
  5846. }, 50);
  5847. return _this;
  5848. }
  5849. TemplateDev.prototype.onDestroy = function () {
  5850. setDbCode(undefined);
  5851. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5852. };
  5853. TemplateDev.prototype.onLoad = function () {
  5854. setDbCode(this);
  5855. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5856. this.refs.tree1.setRootNode(rootNode);
  5857. getColumnDomainApi({}).then(function (_a) {
  5858. var data = _a.data;
  5859. return window['dev_column_domain'] = data;
  5860. });
  5861. };
  5862. TemplateDev.prototype.dbTreeNodeChange = function () {
  5863. var me = handles$1.dbcode;
  5864. var tables = [];
  5865. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5866. var raw = _$2.cloneDeep(r.get('raw'));
  5867. raw.id = r.get('id');
  5868. if (r.get('type') === 'table') {
  5869. tables.push(raw);
  5870. return;
  5871. }
  5872. if (r.get('type') === 'column') {
  5873. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5874. if (!tableInfo) {
  5875. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5876. tables.push(tableInfo);
  5877. }
  5878. if (!tableInfo.column_list) {
  5879. tableInfo.column_list = [raw];
  5880. }
  5881. else {
  5882. tableInfo.column_list.push(raw);
  5883. }
  5884. }
  5885. });
  5886. // 对于没有选择列的表格,默认加上所有列
  5887. _$2.forEach(tables, function (tableInfo) {
  5888. if (typeof tableInfo.column_list === 'undefined') {
  5889. tableInfo.column_list = [];
  5890. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5891. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5892. });
  5893. }
  5894. });
  5895. var code = JSON.stringify(tables, null, ' ');
  5896. me.refs.dataeditor.setCode(code);
  5897. };
  5898. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5899. var url = record.data.url;
  5900. var rd = _$2.uniqueId('db_code_request');
  5901. if (url) {
  5902. var data = void 0;
  5903. try {
  5904. data = JSON.parse(this.refs.dataeditor.getCode());
  5905. }
  5906. catch (e) {
  5907. return;
  5908. }
  5909. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5910. // if (typeof node.default === "function") {
  5911. // const v = toString(node.default(data))
  5912. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5913. // this.refs.preview.setLanguage("plaintext")
  5914. // this.refs.preview.setCode(v)
  5915. // }
  5916. // })
  5917. showErrorDialog$1('没做这里');
  5918. }
  5919. };
  5920. return TemplateDev;
  5921. }(Scope));
  5922. //# sourceMappingURL=DbCodeTemplate.js.map
  5923. var model$3 = {
  5924. data: {
  5925. hasChanged: false,
  5926. }
  5927. };
  5928. //# sourceMappingURL=DbDomain.model.js.map
  5929. var vjson$3 = {
  5930. bind: {
  5931. title: '字段域{grid1.ischanged?" *":""}',
  5932. },
  5933. layout: 'fit',
  5934. items: [
  5935. {
  5936. layout: 'border',
  5937. items: [
  5938. {
  5939. region: 'center',
  5940. xtype: 'yvgrid',
  5941. selModel: {
  5942. type: 'spreadsheet',
  5943. columnSelect: true,
  5944. pruneRemoved: false,
  5945. extensible: 'y'
  5946. },
  5947. plugins: {
  5948. clipboard: true,
  5949. selectionreplicator: true
  5950. },
  5951. reference: 'grid1',
  5952. pagination: false,
  5953. tbar: {
  5954. xtype: 'toolbar',
  5955. items: [
  5956. {
  5957. xtype: 'button',
  5958. text: '添加',
  5959. iconCls: 'x-fa fa-plus-circle',
  5960. listeners: {
  5961. click: 'scope.addField'
  5962. }
  5963. },
  5964. {
  5965. xtype: 'button',
  5966. text: '删除',
  5967. iconCls: 'x-fa fa-minus-circle',
  5968. listeners: {
  5969. click: 'scope.removeField'
  5970. }
  5971. },
  5972. {
  5973. xtype: 'button',
  5974. text: '保存',
  5975. iconCls: 'x-fa fa-save',
  5976. bind: {
  5977. disabled: '{!grid1.ischanged}'
  5978. },
  5979. listeners: {
  5980. click: 'scope.save'
  5981. }
  5982. },
  5983. ]
  5984. },
  5985. listeners: {
  5986. editfinish: 'scope.gridEditFinish',
  5987. },
  5988. columns: [
  5989. {
  5990. text: '字段域名称', dataIndex: 'domain_name',
  5991. sortable: false,
  5992. menuDisabled: true,
  5993. locked: true,
  5994. editor: {
  5995. selectOnFocus: true
  5996. }
  5997. },
  5998. {
  5999. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  6000. sortable: false, menuDisabled: true,
  6001. editor: {
  6002. selectOnFocus: true
  6003. }
  6004. },
  6005. {
  6006. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  6007. sortable: false, menuDisabled: true,
  6008. editor: {
  6009. selectOnFocus: true
  6010. }
  6011. },
  6012. {
  6013. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  6014. sortable: false, menuDisabled: true,
  6015. editor: {
  6016. selectOnFocus: true
  6017. }
  6018. },
  6019. {
  6020. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  6021. sortable: false, menuDisabled: true,
  6022. editor: {
  6023. selectOnFocus: true
  6024. }
  6025. },
  6026. {
  6027. text: 'Java类型', dataIndex: 'java_datatype',
  6028. sortable: false, menuDisabled: true,
  6029. editor: {
  6030. selectOnFocus: true
  6031. }
  6032. },
  6033. {
  6034. text: '固定长度', dataIndex: 'is_fix_size',
  6035. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6036. width: 88, resizable: false,
  6037. },
  6038. {
  6039. text: '长度', dataIndex: 'column_size',
  6040. sortable: false, menuDisabled: true, dataType: 'int',
  6041. xtype: 'numbercolumn', format: '0',
  6042. editor: { selectOnFocus: true }
  6043. },
  6044. {
  6045. text: '小数位', dataIndex: 'decimal_digits',
  6046. sortable: false, menuDisabled: true, dataType: 'int',
  6047. xtype: 'numbercolumn', format: '0',
  6048. editor: { selectOnFocus: true }
  6049. },
  6050. {
  6051. text: '字典', dataIndex: 'domain_column_dict',
  6052. sortable: false, menuDisabled: true,
  6053. // fix: ['system.getDict("DICT")'],
  6054. width: 200,
  6055. editor: {
  6056. xtype: 'combo',
  6057. listConfig: {
  6058. minWidth: 350
  6059. },
  6060. }
  6061. },
  6062. {
  6063. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6064. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6065. width: 88, resizable: false,
  6066. },
  6067. {
  6068. text: '默认值', dataIndex: 'default_value',
  6069. sortable: false, menuDisabled: true,
  6070. editor: {
  6071. selectOnFocus: true
  6072. }
  6073. },
  6074. {
  6075. text: 'UI建议', dataIndex: 'domain_column_ui',
  6076. sortable: false, menuDisabled: true,
  6077. // fix: ['system.getDict("column_ui")'],
  6078. editor: {
  6079. xtype: 'combo',
  6080. allowBlank: true,
  6081. listConfig: {
  6082. minWidth: 200
  6083. },
  6084. }
  6085. },
  6086. {
  6087. text: '详细描述', dataIndex: 'domain_note',
  6088. sortable: false, menuDisabled: true,
  6089. editor: {}
  6090. },
  6091. {
  6092. text: '责任人', dataIndex: 'domain_person',
  6093. sortable: false, menuDisabled: true,
  6094. editor: {
  6095. selectOnFocus: true
  6096. }
  6097. },
  6098. {
  6099. text: '版本', dataIndex: 'domain_version',
  6100. sortable: false, menuDisabled: true,
  6101. editor: {
  6102. selectOnFocus: true
  6103. }
  6104. },
  6105. ]
  6106. }
  6107. ]
  6108. },
  6109. ]
  6110. };
  6111. //# sourceMappingURL=DbDomain.view.js.map
  6112. var CacheStore = /** @class */ (function () {
  6113. function CacheStore() {
  6114. // 订阅
  6115. this.subscribeList = [];
  6116. this.apiResponse = undefined;
  6117. }
  6118. /**
  6119. * 订阅结果集
  6120. */
  6121. CacheStore.prototype.registe = function (fn) {
  6122. this.subscribeList.push(fn);
  6123. };
  6124. /**
  6125. * 取消订阅
  6126. */
  6127. CacheStore.prototype.unregiste = function (fn) {
  6128. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6129. };
  6130. /**
  6131. * 尝试取数据(先读缓存)
  6132. */
  6133. CacheStore.prototype.reloadIfNeed = function (param) {
  6134. var _this = this;
  6135. if (typeof this.apiResponse === 'undefined') {
  6136. // 从未有获取过值
  6137. var cacheKey = this.getCacheKey(param);
  6138. if (cacheKey) {
  6139. // 可以从缓存读
  6140. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6141. native.loadFile(fileName, function (res) {
  6142. if (res) {
  6143. // 缓存有值
  6144. _this.apiResponse = res;
  6145. _this.notifyRefresh();
  6146. }
  6147. else {
  6148. // 缓存没值
  6149. _this.reloadForce(param).then(function (res) {
  6150. });
  6151. }
  6152. });
  6153. }
  6154. else {
  6155. // 不能从缓存读
  6156. this.reloadForce(param).then(function (res) {
  6157. });
  6158. }
  6159. return true;
  6160. }
  6161. return false;
  6162. };
  6163. /**
  6164. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6165. */
  6166. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6167. var _this = this;
  6168. return new Promise(function (resolve, reject) {
  6169. if (typeof _this.apiResponse === 'undefined') {
  6170. // 从未有获取过值
  6171. var cacheKey = _this.getCacheKey(param);
  6172. if (cacheKey) {
  6173. // 可以从缓存读
  6174. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6175. native.loadFile(fileName, function (res) {
  6176. if (res) {
  6177. // 缓存有值
  6178. _this.apiResponse = res;
  6179. _this.notifyRefresh();
  6180. resolve(_this.apiResponse);
  6181. }
  6182. else {
  6183. // 缓存没值
  6184. _this.reloadForce(param).then(function (res) {
  6185. resolve(_this.apiResponse);
  6186. });
  6187. }
  6188. });
  6189. }
  6190. else {
  6191. // 不能从缓存读
  6192. _this.reloadForce(param).then(function (res) {
  6193. resolve(_this.apiResponse);
  6194. });
  6195. }
  6196. }
  6197. else {
  6198. // 有值,获取过
  6199. resolve(_this.apiResponse);
  6200. }
  6201. });
  6202. };
  6203. /**
  6204. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6205. */
  6206. CacheStore.prototype.reloadForce = function (param) {
  6207. var _this = this;
  6208. _$2.forEach(this.subscribeList, function (fn) {
  6209. fn(true);
  6210. });
  6211. return this.invokeApi(param)
  6212. .then(function (res) {
  6213. _this.apiResponse = res;
  6214. var cacheKey = _this.getCacheKey(param);
  6215. if (cacheKey) {
  6216. // 可以保存到缓存
  6217. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6218. native.saveFile(fileName, res);
  6219. }
  6220. // 通知订阅者刷新
  6221. _this.notifyRefresh();
  6222. })
  6223. .finally(function () {
  6224. _$2.forEach(_this.subscribeList, function (fn) {
  6225. fn(false);
  6226. });
  6227. });
  6228. };
  6229. /**
  6230. * 通知组件,isLoading状态被更改
  6231. */
  6232. CacheStore.prototype.notifyLoading = function (isLoading) {
  6233. var _this = this;
  6234. _$2.forEach(this.subscribeList, function (fn) {
  6235. fn(_this.apiResponse);
  6236. });
  6237. };
  6238. /**
  6239. * 通知数据更改,需要刷新
  6240. */
  6241. CacheStore.prototype.notifyRefresh = function () {
  6242. var _this = this;
  6243. _$2.forEach(this.subscribeList, function (fn) {
  6244. fn(_this.apiResponse);
  6245. });
  6246. };
  6247. return CacheStore;
  6248. }());
  6249. //# sourceMappingURL=CacheStore.js.map
  6250. // 字段域数据
  6251. var columnDomain = undefined;
  6252. var DomainStore = /** @class */ (function (_super) {
  6253. __extends(DomainStore, _super);
  6254. function DomainStore() {
  6255. return _super !== null && _super.apply(this, arguments) || this;
  6256. }
  6257. DomainStore.prototype.getCacheKey = function (param) {
  6258. return "domain_data.json";
  6259. };
  6260. DomainStore.prototype.invokeApi = function (param) {
  6261. return getColumnDomainApi();
  6262. };
  6263. /**
  6264. * 设置全局可访问的 字段域数据
  6265. */
  6266. DomainStore.prototype.getColumnDomainComboData = function () {
  6267. var _this = this;
  6268. return new Promise(function (resolve) {
  6269. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6270. resolve(_this.apiResponse.data.map(function (v) {
  6271. return { id: v.domain_id, text: v.domain_name };
  6272. }));
  6273. });
  6274. });
  6275. };
  6276. /**
  6277. * 设置全局可访问的 字段域数据
  6278. */
  6279. DomainStore.prototype.getColumnDomainById = function (value) {
  6280. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6281. };
  6282. DomainStore.prototype.getAllDomain = function () {
  6283. return new Promise(function (resolve, reject) {
  6284. getColumnDomainApi()
  6285. .then(function (res) {
  6286. if (res.success) {
  6287. if (res.success) {
  6288. var tt = _$2.map(res.data, function (row) {
  6289. return {
  6290. text: row.domain_name,
  6291. id: row.domain_id,
  6292. };
  6293. });
  6294. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  6295. }
  6296. columnDomain = res.data;
  6297. resolve(res.data);
  6298. }
  6299. else {
  6300. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6301. console.error('getColumnDomain', res.msg);
  6302. }
  6303. })
  6304. .catch(function (e) {
  6305. window['showErrorDialog']('getColumnDomain error!');
  6306. console.error('getColumnDomain', e);
  6307. reject(e);
  6308. });
  6309. });
  6310. };
  6311. return DomainStore;
  6312. }(CacheStore));
  6313. var instance = new DomainStore();
  6314. //# sourceMappingURL=DomainStore.js.map
  6315. var DbDomain = /** @class */ (function (_super) {
  6316. __extends(DbDomain, _super);
  6317. function DbDomain() {
  6318. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6319. }
  6320. DbDomain.prototype.onLoad = function () {
  6321. var _this = this;
  6322. instance.getAllDomain().then(function (data) {
  6323. _this.refs.grid1.setData(data);
  6324. });
  6325. };
  6326. DbDomain.prototype.gridEditFinish = function () {
  6327. this.viewModel.set('hasChanged', true);
  6328. };
  6329. DbDomain.prototype.addField = function () {
  6330. this.refs.grid1.appendEditRow({
  6331. domainName: '',
  6332. pgSqlDataType: '',
  6333. mysqlDataType: '',
  6334. oracleDataType: '',
  6335. sqlserverDataType: '',
  6336. javaDataType: '',
  6337. isFixSize: true,
  6338. size: '',
  6339. decimalDigits: '',
  6340. isFixDefaultValue: false,
  6341. defaultValue: null,
  6342. domainColumnDict: '',
  6343. domainColumnUI: '',
  6344. note: '',
  6345. domainPerson: '',
  6346. domainVersion: '',
  6347. }, 0);
  6348. };
  6349. DbDomain.prototype.removeField = function () {
  6350. var _this = this;
  6351. var rows = [];
  6352. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6353. rows.push(r);
  6354. });
  6355. _.forEach(rows, function (r) {
  6356. _this.refs.grid1.getStore().remove(r);
  6357. });
  6358. };
  6359. DbDomain.prototype.save = function () {
  6360. var _this = this;
  6361. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6362. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6363. if (err) {
  6364. // 如果有异常就不保存
  6365. return;
  6366. }
  6367. // 进行业务上的逻辑校验,比如说必填校验等等
  6368. var hasError = false;
  6369. _.forEach(rows, function (row, i) {
  6370. if (isEmpty(row.domain_name)) {
  6371. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6372. hasError = true;
  6373. return false;
  6374. }
  6375. if (isEmpty(row.pgsql_datatype) ||
  6376. isEmpty(row.mysql_datatype) ||
  6377. isEmpty(row.oracle_datatype) ||
  6378. isEmpty(row.sqlserver_datatype)) {
  6379. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6380. hasError = true;
  6381. return false;
  6382. }
  6383. });
  6384. if (hasError) {
  6385. return;
  6386. }
  6387. // 设置当前界面为 "保存中..." 状态
  6388. this.setLoading(true);
  6389. saveColumnDomain({
  6390. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6391. newRows: newRows,
  6392. modifyRows: modifyRows,
  6393. removeRecords: removeRecords,
  6394. }).then(function (res) {
  6395. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6396. system.msg(res.msg);
  6397. instance.reloadForce({}).then(function () {
  6398. instance.getAllDomain().then(function (data) {
  6399. _this.refs.grid1.setData(data);
  6400. });
  6401. }).finally(function () {
  6402. // 无论正常异常,关闭 "保存中..." 状态
  6403. _this.setLoading(false);
  6404. });
  6405. }).catch(function (e) {
  6406. // 无论正常异常,关闭 "保存中..." 状态
  6407. _this.setLoading(false);
  6408. });
  6409. };
  6410. return DbDomain;
  6411. }(Scope));
  6412. //# sourceMappingURL=DbDomain.js.map
  6413. var model$4 = {
  6414. data: {
  6415. report_id: '',
  6416. report_name: '',
  6417. report_enable: false,
  6418. report: {
  6419. dataSource: '',
  6420. grid: {
  6421. pagination: true,
  6422. },
  6423. query: [],
  6424. columns: [],
  6425. summary: [],
  6426. },
  6427. querySql: '',
  6428. summarySql: '',
  6429. createAt: '',
  6430. createBy: '',
  6431. updateAt: '',
  6432. updateBy: '',
  6433. }
  6434. };
  6435. //# sourceMappingURL=ReportDesign.model.js.map
  6436. var vjson$4 = {
  6437. bind: {
  6438. title: '报表-{report_name}',
  6439. },
  6440. layout: 'fit',
  6441. items: [
  6442. {
  6443. layout: 'border',
  6444. items: [
  6445. {
  6446. region: 'north',
  6447. items: [
  6448. {
  6449. xtype: 'toolbar',
  6450. border: false,
  6451. items: [
  6452. {
  6453. xtype: 'button',
  6454. text: '刷新',
  6455. iconCls: 'x-fa fa-refresh',
  6456. listeners: {
  6457. click: 'scope.load'
  6458. }
  6459. },
  6460. {
  6461. xtype: 'button',
  6462. text: '保存',
  6463. iconCls: 'x-fa fa-save',
  6464. listeners: {
  6465. click: 'scope.save'
  6466. }
  6467. },
  6468. {
  6469. xtype: 'button',
  6470. text: '预览',
  6471. iconCls: 'x-fa fa-play-circle-o',
  6472. listeners: {
  6473. click: 'scope.preview'
  6474. }
  6475. },
  6476. {
  6477. xtype: 'textfield',
  6478. fieldLabel: '报表名称',
  6479. flex: 1,
  6480. bind: {
  6481. value: '{report_name}'
  6482. }
  6483. },
  6484. {
  6485. xtype: 'checkbox',
  6486. fieldLabel: '启用报表',
  6487. checkedValue: 1,
  6488. uncheckedValue: 0,
  6489. bind: {
  6490. value: '{report_enable}'
  6491. }
  6492. },
  6493. {
  6494. xtype: 'checkbox',
  6495. fieldLabel: '启用分页',
  6496. bind: {
  6497. value: '{report.grid.pagination}'
  6498. }
  6499. },
  6500. {
  6501. xtype: 'textfield',
  6502. fieldLabel: '数据源',
  6503. flex: 1,
  6504. bind: {
  6505. value: '{report.dataSource}'
  6506. }
  6507. },
  6508. ]
  6509. }
  6510. ]
  6511. },
  6512. {
  6513. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6514. items: [
  6515. {
  6516. title: 'SQL和查询条件',
  6517. layout: 'border',
  6518. border: false,
  6519. items: [
  6520. {
  6521. region: 'north',
  6522. height: 200,
  6523. border: false,
  6524. split: true,
  6525. xtype: 'yvgrid',
  6526. reference: 'gridCondition',
  6527. pagination: false,
  6528. hideFootbar: true,
  6529. plugins: {
  6530. clipboard: true,
  6531. selectionreplicator: true
  6532. },
  6533. selModel: {
  6534. type: 'spreadsheet',
  6535. columnSelect: false,
  6536. pruneRemoved: false,
  6537. extensible: 'y'
  6538. },
  6539. tbar: {
  6540. xtype: 'toolbar',
  6541. border: false,
  6542. items: [
  6543. {
  6544. xtype: 'button',
  6545. text: '添加条件',
  6546. iconCls: 'x-fa fa-plus-circle',
  6547. listeners: {
  6548. click: 'scope.addCondition'
  6549. }
  6550. },
  6551. {
  6552. xtype: 'button',
  6553. text: '删除条件',
  6554. iconCls: 'x-fa fa-minus-circle',
  6555. listeners: {
  6556. click: 'scope.removeCondition'
  6557. }
  6558. },
  6559. '-',
  6560. {
  6561. xtype: 'button',
  6562. text: '自动分析条件变量',
  6563. iconCls: 'x-fa fa-code-fork',
  6564. listeners: {
  6565. click: 'scope.calcCondition'
  6566. }
  6567. },
  6568. {
  6569. xtype: 'button',
  6570. text: '上移',
  6571. iconCls: 'x-fa fa-arrow-up',
  6572. listeners: {
  6573. click: 'scope.moveUp'
  6574. }
  6575. },
  6576. {
  6577. xtype: 'button',
  6578. text: '下移',
  6579. iconCls: 'x-fa fa-arrow-down',
  6580. listeners: {
  6581. click: 'scope.moveDown'
  6582. }
  6583. },
  6584. ]
  6585. },
  6586. columns: [
  6587. {
  6588. text: '条件变量',
  6589. dataIndex: 'conditionFieldBind',
  6590. width: 140,
  6591. sortable: false,
  6592. menuDisabled: true,
  6593. editor: {
  6594. selectOnFocus: true
  6595. },
  6596. },
  6597. {
  6598. text: '中文标题',
  6599. dataIndex: 'conditionFieldLabel',
  6600. width: 120,
  6601. sortable: false,
  6602. menuDisabled: true,
  6603. editor: {
  6604. selectOnFocus: true
  6605. },
  6606. },
  6607. {
  6608. text: '编辑类型',
  6609. dataIndex: 'conditionFieldXtype',
  6610. width: 80,
  6611. sortable: false,
  6612. menuDisabled: true,
  6613. editor: {
  6614. xtype: 'combo',
  6615. typeAhead: true,
  6616. triggerAction: 'all',
  6617. selectOnFocus: true,
  6618. store: [
  6619. ['textfield', 'textfield'],
  6620. ['combo', 'combo'],
  6621. ['datefield', 'datefield'],
  6622. ['datetimefield', 'datetimefield'],
  6623. ['numberfield', 'numberfield'],
  6624. ['multiplesearch', 'multiplesearch'],
  6625. ]
  6626. }
  6627. },
  6628. {
  6629. text: '权重',
  6630. dataIndex: 'conditionFieldFlex',
  6631. align: 'right',
  6632. width: 60,
  6633. sortable: false,
  6634. menuDisabled: true,
  6635. editor: {
  6636. xtype: 'numberfield',
  6637. selectOnFocus: false,
  6638. minValue: 0,
  6639. maxValue: 10
  6640. },
  6641. },
  6642. {
  6643. text: '字典',
  6644. dataIndex: 'conditionFieldDict',
  6645. width: 160,
  6646. sortable: false,
  6647. menuDisabled: true,
  6648. editor: {
  6649. selectOnFocus: false
  6650. },
  6651. },
  6652. {
  6653. xtype: 'checkcolumn',
  6654. dataIndex: "conditionFieldWrap", header: "换行",
  6655. width: 65,
  6656. sortable: false,
  6657. menuDisabled: true,
  6658. },
  6659. {
  6660. text: '扩展参数',
  6661. dataIndex: 'conditionFieldExtend',
  6662. sortable: false,
  6663. menuDisabled: true,
  6664. editor: {
  6665. selectOnFocus: false
  6666. },
  6667. },
  6668. ]
  6669. },
  6670. {
  6671. region: 'center',
  6672. xtype: 'sqleditor',
  6673. layout: 'fit',
  6674. reference: 'sqlEditor',
  6675. split: true,
  6676. },
  6677. ]
  6678. },
  6679. {
  6680. title: '查询结果字段',
  6681. xtype: 'yvgrid',
  6682. reference: 'gridColumn',
  6683. pagination: false,
  6684. hideFootbar: true,
  6685. border: false,
  6686. plugins: {
  6687. clipboard: true,
  6688. selectionreplicator: true
  6689. },
  6690. selModel: {
  6691. type: 'spreadsheet',
  6692. columnSelect: false,
  6693. pruneRemoved: false,
  6694. extensible: 'y'
  6695. },
  6696. tbar: {
  6697. xtype: 'toolbar',
  6698. items: [
  6699. {
  6700. xtype: 'button',
  6701. text: '添加',
  6702. iconCls: 'x-fa fa-plus-circle',
  6703. listeners: {
  6704. click: 'scope.addColumn'
  6705. }
  6706. },
  6707. {
  6708. xtype: 'button',
  6709. text: '删除',
  6710. iconCls: 'x-fa fa-minus-circle',
  6711. listeners: {
  6712. click: 'scope.removeColumn'
  6713. }
  6714. },
  6715. '-',
  6716. {
  6717. xtype: 'button',
  6718. text: '自动分析',
  6719. iconCls: 'x-fa fa-code-fork',
  6720. listeners: {
  6721. click: 'scope.calcColumn'
  6722. }
  6723. },
  6724. {
  6725. xtype: 'button',
  6726. text: '上移',
  6727. iconCls: 'x-fa fa-arrow-up',
  6728. listeners: {
  6729. click: 'scope.moveUp'
  6730. }
  6731. },
  6732. {
  6733. xtype: 'button',
  6734. text: '下移',
  6735. iconCls: 'x-fa fa-arrow-down',
  6736. listeners: {
  6737. click: 'scope.moveDown'
  6738. }
  6739. },
  6740. ]
  6741. },
  6742. columns: [
  6743. { xtype: 'rownumberer' },
  6744. {
  6745. text: '字段',
  6746. dataIndex: 'dataIndex',
  6747. width: 140,
  6748. sortable: false,
  6749. menuDisabled: true,
  6750. editor: {
  6751. selectOnFocus: true
  6752. },
  6753. },
  6754. {
  6755. text: '标题',
  6756. dataIndex: 'header',
  6757. width: 120,
  6758. sortable: false,
  6759. menuDisabled: true,
  6760. editor: {
  6761. selectOnFocus: true
  6762. },
  6763. },
  6764. {
  6765. text: '显示类型',
  6766. dataIndex: 'xtype',
  6767. width: 90,
  6768. sortable: false,
  6769. menuDisabled: true,
  6770. editor: {
  6771. xtype: 'combo',
  6772. typeAhead: true,
  6773. triggerAction: 'all',
  6774. selectOnFocus: true,
  6775. store: [
  6776. ['', ''],
  6777. ['rownum', 'rownum'],
  6778. ['button', 'button'],
  6779. ['checkbox', 'checkbox'],
  6780. ['progres', 'progres'],
  6781. ]
  6782. }
  6783. },
  6784. {
  6785. text: '数据类型',
  6786. dataIndex: 'dataType',
  6787. width: 90,
  6788. sortable: false,
  6789. menuDisabled: true,
  6790. editor: {
  6791. xtype: 'combo',
  6792. typeAhead: true,
  6793. triggerAction: 'all',
  6794. selectOnFocus: true,
  6795. store: [
  6796. ['', ''],
  6797. ['string', 'string'],
  6798. ['number', 'number'],
  6799. ['date', 'date'],
  6800. ]
  6801. }
  6802. },
  6803. {
  6804. text: '宽度',
  6805. dataIndex: 'width',
  6806. align: 'right',
  6807. width: 60,
  6808. sortable: false,
  6809. menuDisabled: true,
  6810. editor: {
  6811. xtype: 'numberfield',
  6812. selectOnFocus: true,
  6813. minValue: 0,
  6814. maxValue: 1000
  6815. },
  6816. },
  6817. {
  6818. text: '权重',
  6819. dataIndex: 'flex',
  6820. align: 'right',
  6821. width: 60,
  6822. sortable: false,
  6823. menuDisabled: true,
  6824. editor: {
  6825. xtype: 'numberfield',
  6826. selectOnFocus: true,
  6827. minValue: 0,
  6828. maxValue: 10
  6829. },
  6830. },
  6831. {
  6832. text: '字典',
  6833. dataIndex: 'dict',
  6834. sortable: false,
  6835. menuDisabled: true,
  6836. width: 120,
  6837. editor: {
  6838. selectOnFocus: true,
  6839. },
  6840. },
  6841. {
  6842. text: '对齐',
  6843. dataIndex: 'align',
  6844. width: 60,
  6845. sortable: false,
  6846. menuDisabled: true,
  6847. editor: {
  6848. xtype: 'combo',
  6849. typeAhead: true,
  6850. triggerAction: 'all',
  6851. selectOnFocus: false,
  6852. store: [
  6853. ['', ''],
  6854. ['start', 'start'],
  6855. ['center', 'center'],
  6856. ['end', 'end'],
  6857. ]
  6858. },
  6859. },
  6860. {
  6861. text: '过滤',
  6862. dataIndex: 'filterable',
  6863. xtype: 'checkcolumn',
  6864. width: 50,
  6865. resizable: false,
  6866. sortable: false,
  6867. menuDisabled: true,
  6868. },
  6869. {
  6870. text: '隐藏',
  6871. dataIndex: 'hidden',
  6872. xtype: 'checkcolumn',
  6873. width: 50,
  6874. resizable: false,
  6875. sortable: false,
  6876. menuDisabled: true,
  6877. },
  6878. {
  6879. text: '排序',
  6880. dataIndex: 'sortable',
  6881. xtype: 'checkcolumn',
  6882. width: 50,
  6883. resizable: false,
  6884. sortable: false,
  6885. menuDisabled: true,
  6886. },
  6887. {
  6888. text: '扩展参数',
  6889. dataIndex: 'fieldExtend',
  6890. sortable: false,
  6891. menuDisabled: true,
  6892. editor: {
  6893. selectOnFocus: false
  6894. },
  6895. },
  6896. ],
  6897. },
  6898. {
  6899. title: '汇总和汇总逻辑',
  6900. layout: 'border',
  6901. border: false,
  6902. items: [
  6903. {
  6904. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6905. reference: 'gridSum',
  6906. pagination: false,
  6907. hideFootbar: true,
  6908. height: 200,
  6909. split: true,
  6910. border: false,
  6911. plugins: {
  6912. clipboard: true,
  6913. selectionreplicator: true
  6914. },
  6915. selModel: {
  6916. type: 'spreadsheet',
  6917. columnSelect: false,
  6918. pruneRemoved: false,
  6919. extensible: 'y'
  6920. },
  6921. tbar: {
  6922. xtype: 'toolbar',
  6923. border: false,
  6924. items: [
  6925. {
  6926. xtype: 'button',
  6927. text: '添加',
  6928. iconCls: 'x-fa fa-plus-circle',
  6929. listeners: {
  6930. click: 'scope.addSum'
  6931. }
  6932. },
  6933. {
  6934. xtype: 'button',
  6935. text: '删除',
  6936. iconCls: 'x-fa fa-minus-circle',
  6937. listeners: {
  6938. click: 'scope.removeSum'
  6939. }
  6940. },
  6941. '-',
  6942. {
  6943. xtype: 'button',
  6944. text: '自动分析',
  6945. iconCls: 'x-fa fa-code-fork',
  6946. listeners: {
  6947. click: 'scope.calcSum'
  6948. }
  6949. },
  6950. {
  6951. xtype: 'button',
  6952. text: '上移',
  6953. iconCls: 'x-fa fa-arrow-up',
  6954. listeners: {
  6955. click: 'scope.moveUp'
  6956. }
  6957. },
  6958. {
  6959. xtype: 'button',
  6960. text: '下移',
  6961. iconCls: 'x-fa fa-arrow-down',
  6962. listeners: {
  6963. click: 'scope.moveDown'
  6964. }
  6965. },
  6966. ]
  6967. },
  6968. columns: [
  6969. {
  6970. text: '字段名',
  6971. dataIndex: 'sumFieldBind',
  6972. width: 140,
  6973. sortable: false,
  6974. menuDisabled: true,
  6975. editor: {
  6976. selectOnFocus: true
  6977. },
  6978. },
  6979. {
  6980. text: '标题',
  6981. dataIndex: 'sumFieldLabel',
  6982. width: 120,
  6983. sortable: false,
  6984. menuDisabled: true,
  6985. editor: {
  6986. selectOnFocus: true
  6987. },
  6988. },
  6989. {
  6990. text: '权重',
  6991. dataIndex: 'sumFieldFlex',
  6992. align: 'right',
  6993. width: 60,
  6994. sortable: false,
  6995. menuDisabled: true,
  6996. editor: {
  6997. xtype: 'numberfield',
  6998. selectOnFocus: false,
  6999. allowBlank: true,
  7000. minValue: 0,
  7001. maxValue: 10
  7002. },
  7003. },
  7004. {
  7005. xtype: 'checkcolumn',
  7006. dataIndex: "sumFieldWrap", header: "换行",
  7007. sortable: false,
  7008. menuDisabled: true,
  7009. width: 65,
  7010. },
  7011. {
  7012. text: '扩展参数',
  7013. dataIndex: 'sumFieldExtend',
  7014. sortable: false,
  7015. menuDisabled: true,
  7016. editor: {
  7017. selectOnFocus: false
  7018. },
  7019. },
  7020. ]
  7021. },
  7022. {
  7023. region: 'center',
  7024. xtype: 'sqleditor',
  7025. layout: 'fit',
  7026. reference: 'sqlSumEditor',
  7027. },
  7028. ]
  7029. },
  7030. ]
  7031. }
  7032. ]
  7033. }
  7034. ]
  7035. }; //
  7036. //
  7037. //# sourceMappingURL=ReportDesign.view.js.map
  7038. var DbStore = /** @class */ (function (_super) {
  7039. __extends(DbStore, _super);
  7040. function DbStore() {
  7041. return _super !== null && _super.apply(this, arguments) || this;
  7042. }
  7043. DbStore.prototype.getCacheKey = function (param) {
  7044. return "db_data.json";
  7045. };
  7046. DbStore.prototype.invokeApi = function (param) {
  7047. return getMateData(param);
  7048. };
  7049. /**
  7050. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7051. */
  7052. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7053. return new Promise(function (resolve, reject) {
  7054. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7055. resolve(res1);
  7056. // TODO 好像不需要,先跳过
  7057. // reloadByTableName(schema_name, table_name).then(res2 => {
  7058. // resolve(res1)
  7059. // }).catch(e => {
  7060. // reject(e)
  7061. // })
  7062. }).catch(function (e) {
  7063. reject(e);
  7064. });
  7065. });
  7066. };
  7067. /**
  7068. * 保存元数据至表格
  7069. */
  7070. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7071. var _this = this;
  7072. return new Promise(function (resolve, reject) {
  7073. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7074. // 保存后重新刷新
  7075. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7076. resolve({
  7077. data: res2,
  7078. msg: res1.msg
  7079. });
  7080. }).catch(function (e) {
  7081. reject(e);
  7082. });
  7083. }).catch(function (e) {
  7084. reject(e);
  7085. });
  7086. });
  7087. };
  7088. /**
  7089. * 预览生成的 DDL 语句
  7090. */
  7091. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7092. return new Promise(function (resolve, reject) {
  7093. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7094. .then(function (res) {
  7095. resolve(res);
  7096. });
  7097. });
  7098. };
  7099. /**
  7100. * 执行 DDL
  7101. */
  7102. DbStore.prototype.pushToDbCommit = function (arg) {
  7103. return new Promise(function (resolve, reject) {
  7104. pushToDbCommitApi(arg).then(function (res) {
  7105. resolve(res);
  7106. }).catch(function (e) {
  7107. reject(e);
  7108. });
  7109. });
  7110. };
  7111. /**
  7112. * 重读某一个表格的 meta 元数据
  7113. */
  7114. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7115. var _this = this;
  7116. return new Promise(function (resolve, reject) {
  7117. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7118. if (!res[0] || !res[0].table_list[0]) {
  7119. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7120. return;
  7121. }
  7122. var tableRow = _this.getTableByName(schema_name, table_name);
  7123. if (!tableRow) {
  7124. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7125. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7126. if (!schemaRow) {
  7127. showErrorDialog$1('没有找到 schema:' + schema_name);
  7128. return;
  7129. }
  7130. schemaRow.table_list.push(res[0].table_list[0]);
  7131. }
  7132. else {
  7133. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7134. Object.assign(tableRow, res[0].table_list[0]);
  7135. }
  7136. // 所有界面通知一遍刷新
  7137. _this.notifyRefresh();
  7138. resolve(res);
  7139. }).catch(function (e) {
  7140. reject(e);
  7141. });
  7142. });
  7143. };
  7144. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7145. var result = undefined;
  7146. _$2.forEach(this.apiResponse, function (schemaRow) {
  7147. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7148. if (tableRow) {
  7149. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7150. if (columnRow) {
  7151. result = columnRow;
  7152. return false;
  7153. }
  7154. }
  7155. });
  7156. return result;
  7157. };
  7158. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7159. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7160. if (!schemaRow) {
  7161. showErrorDialog$1('没有找到 schema:' + schemaName);
  7162. return;
  7163. }
  7164. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7165. if (!schemaRow) {
  7166. showErrorDialog$1('没有找到 table:' + tableName);
  7167. return;
  7168. }
  7169. return tableRow;
  7170. };
  7171. /**
  7172. * 添加一个新表格
  7173. */
  7174. DbStore.prototype.appendNewTable = function (tableInfo) {
  7175. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7176. if (!schemaRow) {
  7177. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7178. return;
  7179. }
  7180. schemaRow.table_list.push(tableInfo);
  7181. };
  7182. /**
  7183. * 从数据库结构重新生成元数据
  7184. */
  7185. DbStore.prototype.dbToMetaAndReload = function () {
  7186. var _this = this;
  7187. this.notifyLoading(true);
  7188. dbToMeta().then(function () {
  7189. _this.reloadForce(undefined);
  7190. }).catch(function (e) {
  7191. _this.notifyLoading(false);
  7192. });
  7193. };
  7194. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7195. var dbType = undefined;
  7196. _$2.forEach(this.apiResponse, function (schemaRow) {
  7197. if (schemaRow.schema_name === schemaName) {
  7198. dbType = schemaRow.db_type;
  7199. return false;
  7200. }
  7201. });
  7202. return dbType;
  7203. };
  7204. return DbStore;
  7205. }(CacheStore));
  7206. function syncQueryDSL(_a) {
  7207. var schema_name = _a.schema_name, table_name = _a.table_name;
  7208. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7209. }
  7210. var instance$1 = new DbStore();
  7211. // // 字段域数据
  7212. // let columnDomain = undefined
  7213. // // 元数据
  7214. // let apiResponse = []
  7215. //
  7216. // // 订阅
  7217. // const subscribeList = []
  7218. // /**
  7219. // * 获取全部元数据
  7220. // */
  7221. // export function getApiResponse() {
  7222. // return apiResponse
  7223. // }
  7224. //
  7225. // export function getColumnDomain() {
  7226. // return columnDomain
  7227. // }
  7228. // window['getApiResponse'] = getApiResponse
  7229. // window['getColumnDomain'] = getColumnDomain
  7230. // window['getDbTreeStore'] = function () {
  7231. // return apiResponse
  7232. // }
  7233. //
  7234. // /**
  7235. // * 订阅结果集
  7236. // */
  7237. // export function subscribe(fn) {
  7238. // subscribeList.push(fn)
  7239. // }
  7240. //
  7241. // /**
  7242. // * 取消订阅
  7243. // */
  7244. // export function describe(fn) {
  7245. // _.remove(subscribeList, item => item === fn)
  7246. // }
  7247. //
  7248. // /**
  7249. // * 刷新,如果前端从来没有取到过结果的话
  7250. // * 如果强制刷新成功,就返回 true
  7251. // * 如果没有被强制刷新,返回 false
  7252. // */
  7253. // export function reloadIfNeed() {
  7254. // if (_.size(apiResponse) <= 0) {
  7255. // reloadForce()
  7256. // return true
  7257. // }
  7258. // return false
  7259. // }
  7260. //
  7261. // export function reloadIfNeedPromise() {
  7262. // return new Promise((resolve, reject) => {
  7263. // if (_.size(apiResponse) <= 0) {
  7264. // // 从未有获取过值
  7265. // reloadForce().then(res => {
  7266. // resolve(apiResponse)
  7267. // })
  7268. // return
  7269. // }
  7270. // resolve(apiResponse)
  7271. // return
  7272. // })
  7273. // }
  7274. //
  7275. // /**
  7276. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7277. // */
  7278. // export function reloadForce() {
  7279. // _.forEach(subscribeList, fn => {
  7280. // fn(true)
  7281. // })
  7282. //
  7283. // return getMateData().then((content) => {
  7284. // apiResponse = content
  7285. // _.forEach(subscribeList, fn => {
  7286. // fn(apiResponse)
  7287. // })
  7288. // }).finally(() => {
  7289. // _.forEach(subscribeList, fn => {
  7290. // fn(false)
  7291. // })
  7292. // })
  7293. // }
  7294. //
  7295. // /**
  7296. // * 通知刷新元数据
  7297. // */
  7298. // export function notifyRefresh() {
  7299. // _.forEach(subscribeList, fn => {
  7300. // fn(apiResponse)
  7301. // })
  7302. // }
  7303. // export function getAllDomain() {
  7304. // return new Promise((resolve, reject) => {
  7305. // getColumnDomainApi()
  7306. // .then(res => {
  7307. // if (res.success) {
  7308. // columnDomain = res.data
  7309. // resolve(res.data)
  7310. // } else {
  7311. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7312. // console.error('getColumnDomain', res.msg)
  7313. // }
  7314. //
  7315. // })
  7316. // .catch(e => {
  7317. // showErrorDialog('getColumnDomain error!')
  7318. // console.error('getColumnDomain', e)
  7319. // reject(e)
  7320. // })
  7321. // })
  7322. // }
  7323. //# sourceMappingURL=DbStore.js.map
  7324. var PROJECT_DICT_CACHE = {};
  7325. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7326. /**
  7327. *项目运行时构建
  7328. **/
  7329. function createRuntime() {
  7330. {
  7331. // 已经构建过了
  7332. return new Promise(function (resolve) {
  7333. resolve();
  7334. });
  7335. }
  7336. }
  7337. //# sourceMappingURL=ProjectRuntime.js.map
  7338. function ReportRunner(reportId, setLoadingFn) {
  7339. return new Promise(function (resolve) {
  7340. setLoadingFn(true);
  7341. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7342. // const {model, vjson, report} = buildVjson(res.data)
  7343. // const ret = new ReportScope({model, vjson})
  7344. // ret.report_id = reportId
  7345. // ret.report = report
  7346. // resolve(ret)
  7347. var _b = __read(_a, 1), res = _b[0];
  7348. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7349. resolve(ret);
  7350. }).finally(function () {
  7351. setLoadingFn(false);
  7352. });
  7353. });
  7354. }
  7355. //# sourceMappingURL=ReportRunner.js.map
  7356. //gridCondition
  7357. //gridColumn
  7358. //gridSum
  7359. //sqlSumEditor
  7360. //sqlEditor
  7361. var ReportDesign = /** @class */ (function (_super) {
  7362. __extends(ReportDesign, _super);
  7363. function ReportDesign() {
  7364. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7365. }
  7366. ReportDesign.prototype.onLoad = function () {
  7367. this.load();
  7368. };
  7369. ReportDesign.prototype.save = function (sender) {
  7370. var _this = this;
  7371. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7372. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7373. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7374. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7375. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7376. var report = this.viewModel.get('report');
  7377. var data = {
  7378. report_id: this.viewModel.get('report_id'),
  7379. report_name: this.viewModel.get('report_name'),
  7380. report_enable: this.viewModel.get('report_enable'),
  7381. query_sql: this.viewModel.get('querySql'),
  7382. summary_sql: this.viewModel.get('summarySql'),
  7383. report: json5.stringify(report, null, ' '),
  7384. };
  7385. sender.setLoading(true);
  7386. saveReportApi(data).then(function (res) {
  7387. if (res.success) {
  7388. msg$1('保存成功');
  7389. _this.dialogSuccess(data);
  7390. _this.load();
  7391. }
  7392. }).finally(function () {
  7393. sender.setLoading(false);
  7394. });
  7395. };
  7396. ReportDesign.prototype.preview = function (sender) {
  7397. var reportId = this.viewModel.get('report_id');
  7398. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7399. handles.mainWindow.showReportPreview(reportId, scope);
  7400. });
  7401. };
  7402. ReportDesign.prototype.load = function () {
  7403. var _this = this;
  7404. var reportId = this.viewModel.get('report_id');
  7405. this.setLoading(true);
  7406. reportByIdApi(reportId).then(function (res) {
  7407. var _a = res.data, query_sql = _a.query_sql, report = _a.report, report_enable = _a.report_enable, report_name = _a.report_name, summary_sql = _a.summary_sql;
  7408. if (report) {
  7409. report = json5.parse(report);
  7410. }
  7411. else {
  7412. report = {};
  7413. }
  7414. _this.viewModel.set('report_enable', report_enable);
  7415. _this.viewModel.set('report_name', report_name);
  7416. _this.viewModel.set('querySql', query_sql || '');
  7417. _this.viewModel.set('summarySql', summary_sql || '');
  7418. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7419. var query = _this.viewModel.get('report.query') || [];
  7420. var columns = _this.viewModel.get('report.columns') || [];
  7421. var summary = _this.viewModel.get('report.summary') || [];
  7422. var querySql = _this.viewModel.get('querySql');
  7423. var summarySql = _this.viewModel.get('summarySql');
  7424. _this.refs.gridCondition.setData(query);
  7425. _this.refs.gridColumn.setData(columns);
  7426. _this.refs.gridSum.setData(summary);
  7427. _this.refs.sqlEditor.setCode(querySql);
  7428. _this.refs.sqlSumEditor.setCode(summarySql);
  7429. }).finally(function () {
  7430. _this.setLoading(false);
  7431. });
  7432. };
  7433. ReportDesign.prototype.addCondition = function () {
  7434. this.refs.gridCondition.appendEditRow({
  7435. conditionFieldBind: '',
  7436. conditionFieldLabel: '',
  7437. conditionFieldXtype: 'textfield',
  7438. conditionFieldFlex: 1,
  7439. conditionFieldDict: '',
  7440. conditionFieldWrap: false,
  7441. conditionFieldExtend: '{}',
  7442. }, 'conditionFieldBind');
  7443. };
  7444. ReportDesign.prototype.removeCondition = function () {
  7445. var _this = this;
  7446. var rows = [];
  7447. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7448. rows.push(r);
  7449. });
  7450. _.forEach(rows, function (r) {
  7451. _this.refs.gridCondition.getStore().remove(r);
  7452. });
  7453. };
  7454. ReportDesign.prototype.moveUp = function (sender) {
  7455. var grid = sender.up('grid');
  7456. grid.rowMoveUp();
  7457. };
  7458. ReportDesign.prototype.moveDown = function (sender) {
  7459. var grid = sender.up('grid');
  7460. grid.rowMoveDown();
  7461. };
  7462. ReportDesign.prototype.calcCondition = function () {
  7463. var _this = this;
  7464. var sql = this.refs.sqlEditor.getCode();
  7465. var re = sql.matchAll(/#{(.+?)}/gi);
  7466. var rows = this.refs.gridCondition.getDataRows();
  7467. this.refs.gridCondition.setLoading(true);
  7468. Promise.all([
  7469. parseDynamicSqlApi(sql),
  7470. instance$1.reloadIfNeedPromise(),
  7471. ]).then(function (_a) {
  7472. var e_1, _b;
  7473. var _c = __read(_a, 1), res1 = _c[0];
  7474. if (res1.success) {
  7475. var tables_1 = [];
  7476. _.forEach(res1.data, function (parseItem) {
  7477. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7478. if (tableName && !_.includes(tables_1, tableName)) {
  7479. tables_1.push(tableName);
  7480. }
  7481. });
  7482. var _loop_1 = function (m) {
  7483. var e_2, _a;
  7484. var columnName = m[1];
  7485. // 没有这个列才添加
  7486. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7487. var meta = undefined;
  7488. try {
  7489. for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
  7490. var tableName = tables_2_1.value;
  7491. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7492. if (meta) {
  7493. break;
  7494. }
  7495. }
  7496. }
  7497. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7498. finally {
  7499. try {
  7500. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7501. }
  7502. finally { if (e_2) throw e_2.error; }
  7503. }
  7504. if (meta) {
  7505. // 找到元数据
  7506. var r = {
  7507. conditionFieldBind: meta.column_name,
  7508. conditionFieldLabel: meta.column_comment,
  7509. conditionFieldXtype: 'textfield',
  7510. conditionFieldFlex: 1,
  7511. conditionFieldDict: '',
  7512. conditionFieldWrap: false,
  7513. conditionFieldExtend: '{}',
  7514. };
  7515. if (meta.column_ui === 'combo' && meta.column_dict) {
  7516. r.conditionFieldXtype = 'combo';
  7517. r.conditionFieldDict = meta.column_dict;
  7518. }
  7519. else if (meta.column_ui === "checkbox") {
  7520. r.conditionFieldXtype = 'checkbox';
  7521. }
  7522. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7523. r.conditionFieldXtype = 'numberfield';
  7524. }
  7525. _this.refs.gridCondition.appendEditRow(r);
  7526. }
  7527. else {
  7528. // 没找到元数据,直接添加
  7529. _this.refs.gridCondition.appendEditRow({
  7530. conditionFieldBind: columnName,
  7531. conditionFieldLabel: '',
  7532. conditionFieldXtype: 'textfield',
  7533. conditionFieldFlex: 1,
  7534. conditionFieldDict: '',
  7535. conditionFieldWrap: false,
  7536. conditionFieldExtend: '{}',
  7537. });
  7538. }
  7539. }
  7540. };
  7541. try {
  7542. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7543. var m = re_1_1.value;
  7544. _loop_1(m);
  7545. }
  7546. }
  7547. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7548. finally {
  7549. try {
  7550. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7551. }
  7552. finally { if (e_1) throw e_1.error; }
  7553. }
  7554. }
  7555. }).finally(function () {
  7556. _this.refs.gridCondition.setLoading(false);
  7557. });
  7558. };
  7559. ReportDesign.prototype.addColumn = function () {
  7560. this.refs.gridColumn.appendEditRow({
  7561. dataIndex: '',
  7562. header: '',
  7563. xtype: '',
  7564. dataType: '',
  7565. width: '',
  7566. dict: '',
  7567. align: '',
  7568. filterable: true,
  7569. hidden: false,
  7570. sortable: true,
  7571. fieldExtend: '{}',
  7572. }, 'header');
  7573. };
  7574. ReportDesign.prototype.removeColumn = function () {
  7575. var _this = this;
  7576. var rows = [];
  7577. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7578. rows.push(r);
  7579. });
  7580. _.forEach(rows, function (r) {
  7581. _this.refs.gridColumn.getStore().remove(r);
  7582. });
  7583. };
  7584. ReportDesign.prototype.calcColumn = function () {
  7585. var _this = this;
  7586. var sql = this.refs.sqlEditor.getCode();
  7587. this.refs.gridColumn.setLoading(true);
  7588. var rows = this.refs.gridColumn.getDataRows();
  7589. Promise.all([
  7590. parseDynamicSqlApi(sql),
  7591. instance$1.reloadIfNeedPromise(),
  7592. ]).then(function (_a) {
  7593. var _b = __read(_a, 1), res1 = _b[0];
  7594. if (res1.success) {
  7595. _.forEach(res1.data, function (parseItem) {
  7596. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7597. // 是否找到重复字段
  7598. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7599. if (exists) {
  7600. if ((columnTypeName || "").toLowerCase() === "number") {
  7601. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7602. if (record) {
  7603. record.set("dataType", "number");
  7604. record.set("align", "end");
  7605. }
  7606. }
  7607. return;
  7608. }
  7609. if (tableName) {
  7610. // 解出表格名和字段名
  7611. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7612. if (meta) {
  7613. // 找到了元数据
  7614. var r = {
  7615. dataIndex: meta.column_name,
  7616. header: meta.column_comment,
  7617. xtype: '',
  7618. dataType: '',
  7619. width: '',
  7620. dict: '',
  7621. align: '',
  7622. filterable: true,
  7623. hidden: false,
  7624. sortable: true,
  7625. fieldExtend: '{}',
  7626. };
  7627. if (meta.column_ui === 'combo' && meta.column_dict) {
  7628. r.dict = meta.column_dict;
  7629. }
  7630. else if (meta.column_ui === "checkbox") {
  7631. r.xtype = 'checkbox';
  7632. }
  7633. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7634. r.dataType = meta.data_type;
  7635. r.align = 'end';
  7636. }
  7637. if ((columnTypeName || "").toLowerCase() === "number") {
  7638. r.dataType = "number";
  7639. r.align = 'end';
  7640. }
  7641. _this.refs.gridColumn.appendEditRow(r);
  7642. return;
  7643. }
  7644. }
  7645. if (columnName) {
  7646. // 解出字段名
  7647. var r = {
  7648. dataIndex: columnName,
  7649. header: columnName,
  7650. xtype: '',
  7651. dataType: '',
  7652. width: '',
  7653. dict: '',
  7654. align: '',
  7655. filterable: true,
  7656. hidden: false,
  7657. sortable: true,
  7658. fieldExtend: '{}',
  7659. };
  7660. if ((columnTypeName || "").toLowerCase() === "number") {
  7661. r.dataType = "number";
  7662. r.align = 'end';
  7663. }
  7664. _this.refs.gridColumn.appendEditRow(r);
  7665. }
  7666. });
  7667. }
  7668. }).finally(function () {
  7669. _this.refs.gridColumn.setLoading(false);
  7670. });
  7671. };
  7672. ReportDesign.prototype.addSum = function () {
  7673. this.refs.gridSum.appendEditRow({
  7674. sumFieldBind: '',
  7675. sumFieldLabel: '',
  7676. sumFieldFlex: 1,
  7677. sumFieldWrap: false,
  7678. sumFieldExtend: '{}',
  7679. }, 'sumFieldBind');
  7680. };
  7681. ReportDesign.prototype.removeSum = function () {
  7682. var _this = this;
  7683. var rows = [];
  7684. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7685. rows.push(r);
  7686. });
  7687. _.forEach(rows, function (r) {
  7688. _this.refs.gridSum.getStore().remove(r);
  7689. });
  7690. };
  7691. ReportDesign.prototype.calcSum = function () {
  7692. var _this = this;
  7693. var sql = this.refs.sqlSumEditor.getCode();
  7694. var rows = this.refs.gridSum.getDataRows();
  7695. this.refs.gridSum.setLoading(true);
  7696. parseDynamicSqlApi(sql).then(function (res1) {
  7697. if (res1.success) {
  7698. _.forEach(res1.data, function (parseItem) {
  7699. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7700. // 是否找到重复字段
  7701. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7702. return;
  7703. }
  7704. if (columnName) {
  7705. // 解出字段名
  7706. _this.refs.gridSum.appendEditRow({
  7707. sumFieldBind: columnName,
  7708. sumFieldLabel: columnName,
  7709. sumFieldFlex: 1,
  7710. sumFieldWrap: false,
  7711. sumFieldExtend: '{}',
  7712. });
  7713. }
  7714. });
  7715. }
  7716. }).finally(function () {
  7717. _this.refs.gridSum.setLoading(false);
  7718. });
  7719. };
  7720. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7721. get: function () {
  7722. return this.viewModel.get('report_id');
  7723. },
  7724. enumerable: true,
  7725. configurable: true
  7726. });
  7727. return ReportDesign;
  7728. }(Scope));
  7729. //# sourceMappingURL=ReportDesign.js.map
  7730. var model$5 = {
  7731. data: {
  7732. originalTableInfo: {
  7733. table_name: '',
  7734. description: '',
  7735. },
  7736. hasChanged: false,
  7737. schema_name: undefined,
  7738. table_name: undefined,
  7739. column_name: undefined,
  7740. tableInfo: {
  7741. schema_name: '',
  7742. table_name: '',
  7743. description: '',
  7744. biz_category: '',
  7745. note: '',
  7746. archive_enable: false,
  7747. archive_cron: '',
  7748. archive_condition: '',
  7749. column_list: []
  7750. },
  7751. },
  7752. formulas: {
  7753. shouldSave: function (get) {
  7754. // console.log("-->", get('grid1.ischanged'))
  7755. return get('grid1.ischanged')
  7756. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7757. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7758. },
  7759. },
  7760. };
  7761. //# sourceMappingURL=DbColumn.model.js.map
  7762. var vjson$5 = {
  7763. bind: {
  7764. title: '{tableName}{shouldSave?" *":""}',
  7765. },
  7766. layout: 'fit',
  7767. items: [
  7768. {
  7769. layout: 'border',
  7770. tbar: {
  7771. xtype: 'toolbar',
  7772. items: [
  7773. // {
  7774. // xtype: 'button',
  7775. // text: '拉取库结构',
  7776. // iconCls: 'x-fa fa-cloud-download',
  7777. // listeners: {
  7778. // click: 'scope.pullFromDb'
  7779. // }
  7780. // },
  7781. {
  7782. xtype: 'button',
  7783. text: '保存至数据库',
  7784. iconCls: 'x-fa fa-save',
  7785. bind: {
  7786. disabled: '{!shouldSave}'
  7787. },
  7788. listeners: {
  7789. click: 'scope.pushToDb'
  7790. }
  7791. },
  7792. '-',
  7793. {
  7794. xtype: 'button',
  7795. text: '刷新 QueryDSL',
  7796. iconCls: 'x-fa fa-refresh',
  7797. listeners: {
  7798. click: 'scope.syncQueryDSL'
  7799. }
  7800. },
  7801. {
  7802. xtype: 'button',
  7803. text: '生成 DDL',
  7804. iconCls: 'x-fa fa-file-text',
  7805. listeners: {
  7806. click: 'scope.buildDDL'
  7807. }
  7808. }
  7809. ]
  7810. },
  7811. items: [
  7812. {
  7813. region: 'center',
  7814. xtype: 'tabpanel',
  7815. items: [
  7816. {
  7817. title: '字段',
  7818. xtype: 'yvgrid',
  7819. selModel: {
  7820. type: 'spreadsheet',
  7821. columnSelect: true,
  7822. pruneRemoved: false,
  7823. extensible: 'y'
  7824. },
  7825. enableLocking: false,
  7826. idField: 'column_name',
  7827. plugins: {
  7828. clipboard: true,
  7829. selectionreplicator: true
  7830. },
  7831. reference: 'grid1',
  7832. pagination: false,
  7833. // hideFootbar: true,
  7834. tbar: {
  7835. xtype: 'form',
  7836. items: [
  7837. {
  7838. xtype: 'cols',
  7839. items: [
  7840. {
  7841. xtype: 'textfield',
  7842. fieldLabel: '表格名',
  7843. reference: 'text_table_name',
  7844. readOnly: true,
  7845. bind: {
  7846. value: '{tableInfo.table_name}'
  7847. }
  7848. },
  7849. {
  7850. xtype: 'textfield',
  7851. fieldLabel: '描述',
  7852. // readOnly: true,
  7853. bind: {
  7854. value: '{tableInfo.description}'
  7855. }
  7856. },
  7857. ]
  7858. },
  7859. {
  7860. xtype: 'toolbar',
  7861. items: [
  7862. {
  7863. xtype: 'button',
  7864. text: '添加',
  7865. iconCls: 'x-fa fa-plus-circle',
  7866. listeners: {
  7867. click: 'scope.addField'
  7868. }
  7869. },
  7870. {
  7871. xtype: 'button',
  7872. text: '删除',
  7873. iconCls: 'x-fa fa-minus-circle',
  7874. listeners: {
  7875. click: 'scope.removeField'
  7876. }
  7877. },
  7878. ]
  7879. },
  7880. ]
  7881. },
  7882. listeners: {
  7883. editbefore: 'scope.gridEditBefore'
  7884. },
  7885. columns: [
  7886. {
  7887. text: '字段名', dataIndex: 'column_name',
  7888. sortable: false,
  7889. menuDisabled: true,
  7890. width: 120,
  7891. editor: {
  7892. allowBlank: true,
  7893. selectOnFocus: false
  7894. }
  7895. },
  7896. {
  7897. text: '字段中文', dataIndex: 'column_comment',
  7898. width: 130,
  7899. sortable: false,
  7900. menuDisabled: true,
  7901. editor: {
  7902. allowBlank: true,
  7903. selectOnFocus: false
  7904. }
  7905. },
  7906. {
  7907. text: '主键', dataIndex: 'is_primary_key',
  7908. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7909. width: 48, resizable: false,
  7910. },
  7911. {
  7912. text: '必填', dataIndex: 'not_null',
  7913. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7914. width: 48, resizable: false,
  7915. },
  7916. {
  7917. text: '字段域', dataIndex: 'column_domain',
  7918. sortable: false, menuDisabled: true,
  7919. width: 148,
  7920. dict: 'column_domain',
  7921. editor: {
  7922. xtype: 'combo',
  7923. allowBlank: true,
  7924. selectOnFocus: true,
  7925. // fix: ['system.getDict("column_domain")'],
  7926. dict: 'column_domain',
  7927. listConfig: {
  7928. minWidth: 200
  7929. },
  7930. listeners: {
  7931. change: 'scope.columnDomainChange',
  7932. }
  7933. }
  7934. },
  7935. {
  7936. text: '数据类型', dataIndex: 'data_type',
  7937. sortable: false, menuDisabled: true,
  7938. editor: { allowBlank: true, selectOnFocus: true }
  7939. },
  7940. {
  7941. text: '长度', dataIndex: 'column_size',
  7942. sortable: false, menuDisabled: true,
  7943. xtype: 'numbercolumn', format: '0',
  7944. editor: { allowBlank: true, selectOnFocus: true }
  7945. },
  7946. {
  7947. text: '小数位', dataIndex: 'decimal_digits',
  7948. sortable: false, menuDisabled: true,
  7949. xtype: 'numbercolumn', format: '0',
  7950. editor: { allowBlank: true, selectOnFocus: true }
  7951. },
  7952. {
  7953. text: '默认值', dataIndex: 'default_value',
  7954. sortable: false, menuDisabled: true,
  7955. editor: { allowBlank: true, selectOnFocus: true }
  7956. },
  7957. {
  7958. text: '字典', dataIndex: 'column_dict',
  7959. sortable: false, menuDisabled: true,
  7960. // fix: ['system.getDict("DICT")'],
  7961. width: 200,
  7962. editor: {
  7963. xtype: 'combo',
  7964. allowBlank: true,
  7965. listConfig: {
  7966. minWidth: 350
  7967. },
  7968. }
  7969. },
  7970. {
  7971. text: 'UI建议', dataIndex: 'column_ui',
  7972. sortable: false, menuDisabled: true,
  7973. // fix: ['system.getDict("column_ui")'],
  7974. editor: {
  7975. xtype: 'combo',
  7976. allowBlank: true,
  7977. listConfig: {
  7978. minWidth: 200
  7979. },
  7980. }
  7981. },
  7982. {
  7983. text: '详细描述', dataIndex: 'column_note',
  7984. sortable: false, menuDisabled: true,
  7985. editor: { allowBlank: true, }
  7986. },
  7987. ]
  7988. },
  7989. {
  7990. title: '高级属性',
  7991. xtype: 'form',
  7992. items: [
  7993. // {
  7994. // xtype: 'textfield',
  7995. // fieldLabel: '表格名',
  7996. // bind: {
  7997. // value: '{tableName}'
  7998. // }
  7999. // },
  8000. // {
  8001. // xtype: 'textfield',
  8002. // fieldLabel: '中文含义',
  8003. // bind: {
  8004. // value: '{tableInfo.description}'
  8005. // }
  8006. // },
  8007. {
  8008. xtype: 'combo',
  8009. fieldLabel: '业务类型',
  8010. bind: {
  8011. value: '{tableInfo.biz_category}'
  8012. },
  8013. store: [
  8014. '基础资料',
  8015. '系统',
  8016. '账目与库存',
  8017. '单据',
  8018. '指令',
  8019. '规则与流程',
  8020. '开发辅助',
  8021. ]
  8022. },
  8023. {
  8024. xtype: 'textfield',
  8025. fieldLabel: '详细描述',
  8026. bind: {
  8027. value: '{tableInfo.note}'
  8028. },
  8029. },
  8030. {
  8031. xtype: 'checkbox',
  8032. fieldLabel: '允许归档',
  8033. bind: "{tableInfo.archive_enable}",
  8034. },
  8035. {
  8036. xtype: 'textfield',
  8037. fieldLabel: '归档周期',
  8038. bind: {
  8039. value: '{tableInfo.archive_cron}',
  8040. hidden: '{!tableInfo.archive_enable}',
  8041. }
  8042. },
  8043. {
  8044. xtype: 'textfield',
  8045. fieldLabel: '归档条件',
  8046. bind: {
  8047. value: '{tableInfo.archive_condition}',
  8048. hidden: '{!tableInfo.archive_enable}',
  8049. }
  8050. },
  8051. ]
  8052. },
  8053. ]
  8054. }
  8055. ]
  8056. },
  8057. ]
  8058. };
  8059. //# sourceMappingURL=DbColumn.view.js.map
  8060. var DbColumn = /** @class */ (function (_super) {
  8061. __extends(DbColumn, _super);
  8062. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8063. var _this = _super.call(this, {
  8064. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8065. vjson: vjson$5
  8066. }) || this;
  8067. _this.isCreate = false;
  8068. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8069. return _this;
  8070. }
  8071. DbColumn.prototype.onLoad = function () {
  8072. var _this = this;
  8073. var _a, _b, _c, _d, _e, _f, _g, _h;
  8074. console.log('me', this);
  8075. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8076. this.refs.grid1.autoSizeColumns();
  8077. // this.refs.grid1.columns[0].hide()
  8078. // 自动定位到选定的列
  8079. if (this.viewModel.get('column_name')) {
  8080. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8081. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8082. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8083. return;
  8084. }
  8085. }
  8086. }
  8087. instance.getColumnDomainComboData().then(function () {
  8088. _this.checkDomain();
  8089. });
  8090. this.viewModel.set('originalTableInfo.table_name', (_c = (_b = (_a = this.viewModel.data) === null || _a === void 0 ? void 0 : _a.tableInfo) === null || _b === void 0 ? void 0 : _b.table_name) !== null && _c !== void 0 ? _c : "");
  8091. this.viewModel.set('originalTableInfo.description', (_f = (_e = (_d = this.viewModel.data) === null || _d === void 0 ? void 0 : _d.tableInfo) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : "");
  8092. if (this.isCreate)
  8093. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8094. };
  8095. DbColumn.prototype.checkDomain = function () {
  8096. // 走查一遍 domain
  8097. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8098. var dbType = this.viewModel.get('tableInfo.db_type');
  8099. var diffColumnName = [];
  8100. var tableInfo = this.viewModel.get('tableInfo');
  8101. this.refs.grid1.store.data.items.forEach(function (record) {
  8102. var data = record.data;
  8103. var column_domain = data.column_domain;
  8104. var domain = instance.getColumnDomainById(column_domain);
  8105. if (!domain) {
  8106. // 没有找到 domain
  8107. return;
  8108. }
  8109. var editRow = applyDomain(dbType, domain);
  8110. // 字段跟领域做对比
  8111. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8112. if (typeof compareResult === 'string') {
  8113. // 不一样的情况下,要改成一致
  8114. _$2.forOwn(editRow, function (value, key) {
  8115. // 改成与 domain 一致
  8116. record.set(key, value);
  8117. });
  8118. diffColumnName.push(data.column_name + '.' + compareResult);
  8119. }
  8120. });
  8121. if (diffColumnName.length > 0) {
  8122. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8123. }
  8124. };
  8125. DbColumn.prototype.addField = function () {
  8126. this.refs.grid1.appendEditRow({
  8127. column_name: '',
  8128. column_comment: '',
  8129. is_primary_key: false,
  8130. not_null: true,
  8131. column_domain: '',
  8132. data_type: '',
  8133. column_size: 0,
  8134. decimal_digits: 0,
  8135. default_value: '',
  8136. column_dict: '',
  8137. column_ui: '',
  8138. column_note: '',
  8139. }, 'column_name');
  8140. };
  8141. DbColumn.prototype.removeField = function () {
  8142. var _this = this;
  8143. var rows = [];
  8144. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8145. rows.push(r);
  8146. });
  8147. _$2.forEach(rows, function (r) {
  8148. _this.refs.grid1.getStore().remove(r);
  8149. });
  8150. };
  8151. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8152. instance.getColumnDomainComboData().then(function (data) {
  8153. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8154. });
  8155. // 被字段域锁定的内容,不允许修改
  8156. var record = context.record, field = context.field;
  8157. var domainId = record.get('column_domain');
  8158. if (!domainId) {
  8159. return;
  8160. }
  8161. var domain = instance.getColumnDomainById(domainId);
  8162. if (!domain) {
  8163. msg$1('没有找到字段域' + domainId);
  8164. return;
  8165. }
  8166. if (field === "data_type") {
  8167. // 字段类型不允许修改
  8168. context.cancel = true;
  8169. return;
  8170. }
  8171. if (domain.is_fix_size &&
  8172. (field === "column_size" ||
  8173. field === "decimal_digits")) {
  8174. // 锁定长度的情况下,大小不允许修改
  8175. context.cancel = true;
  8176. return;
  8177. }
  8178. if (domain.is_fix_default_value && field === "default_value") {
  8179. // 锁定默认值的情况下,默认值不允许修改
  8180. context.cancel = true;
  8181. return;
  8182. }
  8183. };
  8184. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8185. if (!newValue) {
  8186. return;
  8187. }
  8188. var grid = editor.up('grid').ownerGrid;
  8189. var domain = instance.getColumnDomainById(newValue);
  8190. if (!domain) {
  8191. msg$1('没有找到 domain:' + newValue);
  8192. return;
  8193. }
  8194. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8195. var dbType = this.viewModel.get('tableInfo.db_type');
  8196. var editRow = applyDomain(dbType, domain);
  8197. grid.setEditRow(editRow);
  8198. };
  8199. DbColumn.prototype.pullFromDb = function () {
  8200. };
  8201. DbColumn.prototype.pushToDb = function (sender) {
  8202. var _this = this;
  8203. // 设置当前界面为 "保存中..." 状态
  8204. var me = this;
  8205. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8206. this.viewModel.set('tableInfo.table_name', table_name);
  8207. this.viewModel.set('tableInfo.schema_name', schema_name);
  8208. var tableInfo = this.viewModel.get('tableInfo');
  8209. var column_list = this.refs.grid1.getDataRows();
  8210. var hasError = false;
  8211. if (column_list.length <= 0) {
  8212. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8213. hasError = true;
  8214. }
  8215. var columnNameExistsCheck = {};
  8216. _$2.forEach(column_list, function (row, i) {
  8217. var checkResult = checkColumn(tableInfo, row);
  8218. if (typeof checkResult !== 'undefined') {
  8219. msg$1(checkResult);
  8220. hasError = true;
  8221. _this.refs.grid1.beginEdit(i, 'column_name');
  8222. return false;
  8223. }
  8224. if (!row.column_domain || row.column_domain === '0') {
  8225. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8226. hasError = true;
  8227. _this.refs.grid1.beginEdit(i, 'column_domain');
  8228. return false;
  8229. }
  8230. if (isEmpty(row.data_type)) {
  8231. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8232. hasError = true;
  8233. _this.refs.grid1.beginEdit(i, 'data_type');
  8234. return false;
  8235. }
  8236. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8237. // 列名已存在
  8238. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8239. hasError = true;
  8240. _this.refs.grid1.beginEdit(i, 'column_name');
  8241. return false;
  8242. }
  8243. columnNameExistsCheck[row.column_name] = true;
  8244. });
  8245. if (hasError)
  8246. return;
  8247. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8248. me.setLoading(true);
  8249. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8250. .then(function (res) {
  8251. var _a;
  8252. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8253. // 返回 DDL 就要显示出来
  8254. var window_1 = Ext.create('Ext.window.Window', {
  8255. title: 'SQL 预览',
  8256. height: 400,
  8257. width: 600,
  8258. modal: true,
  8259. animateTarget: sender,
  8260. maximizable: true,
  8261. layout: 'fit',
  8262. items: {
  8263. xtype: 'sqleditor',
  8264. value: res.data.ddl
  8265. },
  8266. buttons: [
  8267. {
  8268. xtype: 'button',
  8269. text: '执行',
  8270. iconCls: 'x-fa fa-save',
  8271. handler: function (sender) {
  8272. var editor = sender.up('window').down('sqleditor');
  8273. var ddl = editor.getValue();
  8274. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8275. }
  8276. },
  8277. {
  8278. xtype: 'button',
  8279. text: '取消',
  8280. iconCls: 'x-fa fa-times',
  8281. handler: function () {
  8282. window_1.close();
  8283. }
  8284. }
  8285. ]
  8286. }).show();
  8287. return;
  8288. }
  8289. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8290. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8291. if (!tableRow) {
  8292. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8293. console.log('这是一个新 table');
  8294. instance$1.appendNewTable(tableInfo);
  8295. }
  8296. _this.viewModel.set('schema_name', schema_name);
  8297. _this.viewModel.set('table_name', table_name);
  8298. _this.viewModel.set('tableInfo', tableInfo);
  8299. _this.refs.grid1.setData(tableInfo.column_list);
  8300. if (tableRow)
  8301. Object.assign(tableRow, tableInfo);
  8302. msg$1('保存成功');
  8303. _this.viewModel.set('hasChanged', false);
  8304. })
  8305. .finally(function () {
  8306. me.setLoading(false);
  8307. });
  8308. };
  8309. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8310. var _this = this;
  8311. window.setLoading(true);
  8312. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8313. .then(function (res) {
  8314. var _a, _b, _c, _d;
  8315. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8316. // 保存成功就提示一下,并重新载入数据
  8317. msg$1(res.msg);
  8318. instance$1.reloadForce(undefined);
  8319. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8320. if (!tableRow) {
  8321. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8322. console.log('这是一个新 table');
  8323. instance$1.appendNewTable(tableInfo);
  8324. }
  8325. _this.viewModel.set('schema_name', schema_name);
  8326. _this.viewModel.set('table_name', table_name);
  8327. _this.viewModel.set('tableInfo', tableInfo);
  8328. _this.refs.grid1.setData(tableInfo.column_list);
  8329. if (tableRow)
  8330. Object.assign(tableRow, tableInfo);
  8331. instance$1.notifyRefresh();
  8332. window.close();
  8333. _this.viewModel.set('hasChanged', false);
  8334. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8335. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8336. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8337. })
  8338. .finally(function () {
  8339. // 无论正常异常,关闭 "保存中..." 状态
  8340. window.setLoading(false);
  8341. });
  8342. };
  8343. DbColumn.prototype.syncQueryDSL = function () {
  8344. var _this = this;
  8345. var tableInfo = this.viewModel.get("tableInfo");
  8346. this.setLoading(true);
  8347. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8348. .then(function () {
  8349. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8350. })
  8351. .finally(function () {
  8352. _this.setLoading(false);
  8353. });
  8354. };
  8355. DbColumn.prototype.buildDDL = function () {
  8356. };
  8357. return DbColumn;
  8358. }(Scope));
  8359. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8360. model.data.schema_name = schemaName;
  8361. model.data.table_name = tableName;
  8362. model.data.column_name = columnName;
  8363. if (isCreateTable) {
  8364. var dbType = instance$1.getSchemaDbType(schemaName);
  8365. if (!dbType) {
  8366. throw Error('无法识别数据库类型' + schemaName);
  8367. }
  8368. model.data.tableInfo.schema_name = model.data.schema_name;
  8369. model.data.tableInfo.table_name = model.data.table_name;
  8370. model.data.tableInfo.db_type = dbType;
  8371. model.data.tableInfo.column_list = [];
  8372. model.data.tableInfo.is_create = true;
  8373. return model;
  8374. }
  8375. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8376. if (!tableRow) {
  8377. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8378. }
  8379. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8380. model.data.tableInfo.is_create = false;
  8381. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8382. return model;
  8383. }
  8384. //# sourceMappingURL=DbColumn.js.map
  8385. var model$6 = {
  8386. data: {
  8387. id: '',
  8388. path: '',
  8389. form: {
  8390. title: '',
  8391. sqlId: '',
  8392. }
  8393. }
  8394. };
  8395. //# sourceMappingURL=WidgetDesign.model.js.map
  8396. var vjson$6 = {
  8397. bind: {
  8398. title: '{title}',
  8399. },
  8400. layout: 'fit',
  8401. items: [
  8402. {
  8403. layout: 'border',
  8404. items: [
  8405. {
  8406. region: 'center',
  8407. layout: 'border',
  8408. items: [
  8409. {
  8410. region: 'north',
  8411. items: [
  8412. {
  8413. xtype: 'toolbar',
  8414. border: false,
  8415. items: [
  8416. {
  8417. xtype: 'button',
  8418. text: '刷新',
  8419. iconCls: 'x-fa fa-refresh',
  8420. listeners: {
  8421. click: 'scope.load'
  8422. }
  8423. },
  8424. {
  8425. xtype: 'button',
  8426. text: '保存',
  8427. iconCls: 'x-fa fa-save',
  8428. listeners: {
  8429. click: 'scope.widgetSave'
  8430. }
  8431. },
  8432. {
  8433. xtype: 'button',
  8434. text: '预览',
  8435. iconCls: 'x-fa fa-play-circle-o',
  8436. listeners: {
  8437. //click: 'scope.preview'
  8438. }
  8439. },
  8440. {
  8441. xtype: 'textfield',
  8442. fieldLabel: '弹窗文件',
  8443. reference: "wPath",
  8444. labelWidth: 80,
  8445. //width: 200,
  8446. bind: {
  8447. value: '{widgetPath}',
  8448. },
  8449. readOnly: true,
  8450. },
  8451. {
  8452. xtype: 'textfield',
  8453. fieldLabel: '弹窗名称',
  8454. reference: "wTitle",
  8455. labelWidth: 80,
  8456. //width: 200,
  8457. bind: {
  8458. value: '{form.title}',
  8459. },
  8460. readOnly: true,
  8461. },
  8462. {
  8463. xtype: 'textfield',
  8464. fieldLabel: 'sqlId',
  8465. bind: {
  8466. value: '{form.sqlId}',
  8467. },
  8468. readOnly: true,
  8469. },
  8470. ]
  8471. },
  8472. ]
  8473. },
  8474. {
  8475. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8476. items: [
  8477. {
  8478. title: "SQL和条件",
  8479. layout: 'border',
  8480. border: false,
  8481. items: [
  8482. {
  8483. region: 'north',
  8484. height: 200,
  8485. xtype: 'yvgrid',
  8486. reference: "grid2",
  8487. split: true,
  8488. selModel: {
  8489. selType: 'rowmodel',
  8490. mode: 'SINGLE',
  8491. },
  8492. store: {},
  8493. pagination: false,
  8494. hideFootbar: true,
  8495. tbar: {
  8496. xtype: 'toolbar',
  8497. items: [
  8498. {
  8499. xtype: 'button',
  8500. text: '添加',
  8501. iconCls: 'x-fa fa-plus-circle',
  8502. listeners: {}
  8503. },
  8504. {
  8505. xtype: 'button',
  8506. text: '删除',
  8507. iconCls: 'x-fa fa-minus-circle',
  8508. listeners: {
  8509. click: 'scope.delCondition'
  8510. }
  8511. },
  8512. '-',
  8513. {
  8514. xtype: 'button',
  8515. text: '上移',
  8516. iconCls: 'x-fa fa-refresh',
  8517. listeners: {
  8518. //click: 'scope.saveAll'
  8519. }
  8520. },
  8521. {
  8522. xtype: 'button',
  8523. text: '下移',
  8524. iconCls: 'x-fa fa-refresh',
  8525. listeners: {
  8526. //click: 'scope.saveAll'
  8527. }
  8528. },
  8529. '-',
  8530. {
  8531. xtype: 'button',
  8532. text: '自动分析',
  8533. iconCls: 'x-fa fa-refresh',
  8534. listeners: {
  8535. click: 'scope.calcCondition'
  8536. }
  8537. },
  8538. ]
  8539. },
  8540. columns: [
  8541. {
  8542. text: '条件变量',
  8543. dataIndex: 'conditionFieldBind',
  8544. width: 140,
  8545. sortable: false,
  8546. menuDisabled: true,
  8547. editor: {
  8548. selectOnFocus: true
  8549. },
  8550. },
  8551. {
  8552. text: '中文标题',
  8553. dataIndex: 'conditionFieldLabel',
  8554. width: 120,
  8555. sortable: false,
  8556. menuDisabled: true,
  8557. editor: {
  8558. selectOnFocus: true
  8559. },
  8560. },
  8561. {
  8562. text: '编辑类型',
  8563. dataIndex: 'xtype',
  8564. sortable: false,
  8565. menuDisabled: true,
  8566. editor: {
  8567. xtype: 'combo',
  8568. typeAhead: true,
  8569. triggerAction: 'all',
  8570. selectOnFocus: true,
  8571. store: [
  8572. ['textfield', 'textfield'],
  8573. ['combo', 'combo'],
  8574. ['datefield', 'datefield'],
  8575. ['datetimefield', 'datetimefield'],
  8576. ['numberfield', 'numberfield'],
  8577. ['multiplesearch', 'multiplesearch'],
  8578. ]
  8579. }
  8580. },
  8581. {
  8582. text: '权重',
  8583. dataIndex: 'conditionFieldFlex',
  8584. align: 'right',
  8585. sortable: false,
  8586. menuDisabled: true,
  8587. editor: {
  8588. xtype: 'numberfield',
  8589. selectOnFocus: false,
  8590. minValue: 0,
  8591. maxValue: 10
  8592. },
  8593. },
  8594. {
  8595. text: '字典',
  8596. dataIndex: 'conditionFieldDict',
  8597. width: 160,
  8598. sortable: false,
  8599. menuDisabled: true,
  8600. editor: {
  8601. selectOnFocus: false
  8602. },
  8603. },
  8604. {
  8605. xtype: 'checkcolumn',
  8606. dataIndex: "conditionFieldWrap", header: "换行",
  8607. width: 65,
  8608. sortable: false,
  8609. menuDisabled: true,
  8610. },
  8611. ]
  8612. },
  8613. {
  8614. region: 'center',
  8615. xtype: 'sqleditor',
  8616. layout: 'fit',
  8617. reference: 'sqlEditor',
  8618. split: true,
  8619. bind: {
  8620. value: "{form.sql}"
  8621. },
  8622. },
  8623. ]
  8624. },
  8625. {
  8626. title: "结果字段定义",
  8627. border: false,
  8628. xtype: 'yvgrid',
  8629. reference: "grid3",
  8630. selModel: {
  8631. selType: 'rowmodel',
  8632. mode: 'SINGLE',
  8633. },
  8634. store: {},
  8635. pagination: false,
  8636. hideFootbar: true,
  8637. tbar: {
  8638. xtype: 'toolbar',
  8639. items: [
  8640. {
  8641. xtype: 'button',
  8642. text: '添加',
  8643. iconCls: 'x-fa fa-plus-circle',
  8644. listeners: {}
  8645. },
  8646. {
  8647. xtype: 'button',
  8648. text: '删除',
  8649. iconCls: 'x-fa fa-minus-circle',
  8650. listeners: {
  8651. click: 'scope.delColumn'
  8652. }
  8653. },
  8654. '-',
  8655. {
  8656. xtype: 'button',
  8657. text: '上移',
  8658. iconCls: 'x-fa fa-refresh',
  8659. listeners: {
  8660. //click: 'scope.saveAll'
  8661. }
  8662. },
  8663. {
  8664. xtype: 'button',
  8665. text: '下移',
  8666. iconCls: 'x-fa fa-refresh',
  8667. listeners: {
  8668. //click: 'scope.saveAll'
  8669. }
  8670. },
  8671. '-',
  8672. {
  8673. xtype: 'button',
  8674. text: '自动分析',
  8675. iconCls: 'x-fa fa-refresh',
  8676. listeners: {
  8677. click: 'scope.calcColumn'
  8678. }
  8679. },
  8680. ]
  8681. },
  8682. columns: [
  8683. { xtype: 'rownumberer' },
  8684. {
  8685. text: '字段',
  8686. dataIndex: 'dataIndex',
  8687. width: 140,
  8688. sortable: false,
  8689. menuDisabled: true,
  8690. editor: {
  8691. selectOnFocus: true
  8692. },
  8693. },
  8694. {
  8695. text: '标题',
  8696. dataIndex: 'header',
  8697. width: 120,
  8698. sortable: false,
  8699. menuDisabled: true,
  8700. editor: {
  8701. selectOnFocus: true
  8702. },
  8703. },
  8704. {
  8705. text: '显示类型',
  8706. dataIndex: 'xtype',
  8707. width: 90,
  8708. sortable: false,
  8709. menuDisabled: true,
  8710. editor: {
  8711. xtype: 'combo',
  8712. typeAhead: true,
  8713. triggerAction: 'all',
  8714. selectOnFocus: true,
  8715. store: [
  8716. ['', ''],
  8717. ['rownum', 'rownum'],
  8718. ['button', 'button'],
  8719. ['checkbox', 'checkbox'],
  8720. ['progres', 'progres'],
  8721. ]
  8722. }
  8723. },
  8724. {
  8725. text: '数据类型',
  8726. dataIndex: 'dataType',
  8727. width: 90,
  8728. sortable: false,
  8729. menuDisabled: true,
  8730. editor: {
  8731. xtype: 'combo',
  8732. typeAhead: true,
  8733. triggerAction: 'all',
  8734. selectOnFocus: true,
  8735. store: [
  8736. ['', ''],
  8737. ['string', 'string'],
  8738. ['number', 'number'],
  8739. ['date', 'date'],
  8740. ]
  8741. }
  8742. },
  8743. {
  8744. text: '数据字典',
  8745. dataIndex: 'dict',
  8746. sortable: false,
  8747. menuDisabled: true,
  8748. width: 120,
  8749. editor: {
  8750. selectOnFocus: true,
  8751. },
  8752. },
  8753. ],
  8754. },
  8755. ]
  8756. },
  8757. ]
  8758. },
  8759. ]
  8760. }
  8761. ]
  8762. }; //
  8763. //
  8764. //# sourceMappingURL=WidgetDesign.view.js.map
  8765. var WidgetDesign = /** @class */ (function (_super) {
  8766. __extends(WidgetDesign, _super);
  8767. function WidgetDesign(widgetPath, widgetName) {
  8768. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8769. _this.widgetPath = widgetPath;
  8770. _this.widgetName = widgetName;
  8771. return _this;
  8772. }
  8773. WidgetDesign.prototype.onLoad = function () {
  8774. if (this.widgetPath) {
  8775. this.loadForm(this.widgetPath);
  8776. this.viewModel.set("widgetPath", this.widgetPath);
  8777. this.refs.wTitle.setReadOnly(true);
  8778. this.refs.wPath.setReadOnly(true);
  8779. }
  8780. else {
  8781. this.refs.wTitle.setReadOnly(false);
  8782. this.refs.wPath.setReadOnly(false);
  8783. }
  8784. };
  8785. WidgetDesign.prototype.load = function () {
  8786. var widgetPath = this.viewModel.get("widgetPath");
  8787. if (widgetPath) {
  8788. this.loadForm(widgetPath);
  8789. }
  8790. };
  8791. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8792. var _this = this;
  8793. var me = this;
  8794. me.setLoading(true);
  8795. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8796. msg$1(res.msg);
  8797. if (res.success) {
  8798. _this.viewModel.set("widgetPath", widgetPath);
  8799. me.refs.grid3.getStore().removeAll();
  8800. if (res.data.form.columns) {
  8801. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8802. }
  8803. _this.viewModel.set("form.title", res.data.form.title);
  8804. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8805. // set sql
  8806. _this.refs.sqlEditor.setCode(res.data.sql);
  8807. }
  8808. }).finally(function () {
  8809. me.setLoading(false);
  8810. });
  8811. };
  8812. WidgetDesign.prototype.widgetAdd = function (sender) {
  8813. var _this = this;
  8814. var title = this.viewModel.get("form.title");
  8815. if (title) {
  8816. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8817. if (btn == 'yes') {
  8818. alert(1);
  8819. }
  8820. else {
  8821. alert(2);
  8822. }
  8823. });
  8824. }
  8825. else {
  8826. var me_1 = this;
  8827. var win_1 = new Ext.Window({
  8828. autoDestroy: true,
  8829. title: "新建弹框",
  8830. width: 400,
  8831. height: 220,
  8832. resizable: true,
  8833. closable: true,
  8834. maximizable: true,
  8835. minimizable: true,
  8836. plain: true,
  8837. // constrainHeader: true,
  8838. constrain: true,
  8839. layout: 'fit',
  8840. animateTarget: sender,
  8841. buttonAlign: 'center',
  8842. items: [
  8843. {
  8844. xtype: "form",
  8845. layout: "hbox",
  8846. margin: '10px 20px',
  8847. border: 0,
  8848. items: [
  8849. {
  8850. flex: 1,
  8851. layout: 'vbox',
  8852. items: [
  8853. {
  8854. xtype: "textfield",
  8855. name: "widgetcode",
  8856. fieldLabel: "弹框编号",
  8857. flex: 1,
  8858. allowBlank: false,
  8859. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8860. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8861. labelWidth: 50,
  8862. width: "100%",
  8863. },
  8864. {
  8865. xtype: "textfield",
  8866. name: "widgetname",
  8867. fieldLabel: "弹框名称",
  8868. flex: 1,
  8869. allowBlank: false,
  8870. labelWidth: 50,
  8871. width: "100%",
  8872. },
  8873. ]
  8874. },
  8875. ]
  8876. }
  8877. ],
  8878. //窗口按钮
  8879. buttons: [
  8880. {
  8881. xtype: 'button', text: '保存', handler: function (btn) {
  8882. //窗口获取表单
  8883. var form = win_1.down('form');
  8884. var vaildSuccess = form.isValid();
  8885. if (!vaildSuccess) {
  8886. return;
  8887. }
  8888. var title = form.down('textfield[name="widgetname"]').getValue();
  8889. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8890. me_1.viewModel.set("form.title", title);
  8891. me_1.viewModel.set("widgetPath", widgetPath);
  8892. var formdata = _this.viewModel.get("form");
  8893. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8894. if (res.success) {
  8895. msg$1('添加成功');
  8896. }
  8897. me_1.loadForm(widgetPath);
  8898. win_1.close();
  8899. });
  8900. }
  8901. },
  8902. {
  8903. xtype: 'button', text: '取消', handler: function (btn) {
  8904. //窗口关闭
  8905. win_1.close();
  8906. }
  8907. }
  8908. ]
  8909. });
  8910. win_1.show();
  8911. }
  8912. };
  8913. WidgetDesign.prototype.widgetSave = function () {
  8914. var _this = this;
  8915. var _a, _b;
  8916. var widgetPath = this.viewModel.get("widgetPath");
  8917. if (!widgetPath) {
  8918. msg$1("请选择或添加弹框后再保存!");
  8919. return;
  8920. }
  8921. var title = this.viewModel.get("form.title");
  8922. if (!title) {
  8923. msg$1("请选择或添加弹框后再保存!");
  8924. return;
  8925. }
  8926. // 获取条件
  8927. var conditions = (_a = this.refs.grid2.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }).map(function (r) {
  8928. delete r.id;
  8929. return r;
  8930. });
  8931. this.viewModel.set("form.conditions", conditions);
  8932. // 获取查询列
  8933. var columns = (_b = this.refs.grid3.getStore().getData().items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }).map(function (r) {
  8934. delete r.id;
  8935. if (r.dict) {
  8936. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8937. }
  8938. return r;
  8939. });
  8940. this.viewModel.set("form.columns", columns);
  8941. // sql
  8942. var sql = this.refs.sqlEditor.getCode();
  8943. this.viewModel.set("form.sql", sql);
  8944. var form = this.viewModel.get("form");
  8945. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8946. msg$1(res.msg);
  8947. if (res.success) {
  8948. msg$1('保存成功');
  8949. _this.loadForm(widgetPath);
  8950. }
  8951. }).catch(function (res) {
  8952. });
  8953. };
  8954. WidgetDesign.prototype.delCondition = function () {
  8955. var _a;
  8956. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8957. };
  8958. WidgetDesign.prototype.delColumn = function () {
  8959. var _a;
  8960. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8961. };
  8962. WidgetDesign.prototype.calcCondition = function () {
  8963. var _this = this;
  8964. var sql = this.refs.sqlEditor.getCode();
  8965. var re = sql.matchAll(/#{(.+?)}/gi);
  8966. var rows = this.refs.grid2.getDataRows();
  8967. this.refs.grid2.setLoading(true);
  8968. parseDynamicSqlApi(sql).then(function (res) {
  8969. var e_1, _a;
  8970. if (res.success) {
  8971. var tables_1 = [];
  8972. _.forEach(res.data, function (parseItem) {
  8973. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8974. if (tableName && !_.includes(tables_1, tableName)) {
  8975. tables_1.push(tableName);
  8976. }
  8977. });
  8978. var _loop_1 = function (m) {
  8979. var e_2, _a;
  8980. var columnName = m[1];
  8981. // 没有这个列才添加
  8982. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8983. var meta = undefined;
  8984. try {
  8985. for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
  8986. var tableName = tables_2_1.value;
  8987. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8988. if (meta) {
  8989. break;
  8990. }
  8991. }
  8992. }
  8993. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8994. finally {
  8995. try {
  8996. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8997. }
  8998. finally { if (e_2) throw e_2.error; }
  8999. }
  9000. if (meta) {
  9001. // 没找到元数据,直接添加
  9002. _this.refs.grid2.appendEditRow({
  9003. conditionFieldBind: columnName,
  9004. conditionFieldLabel: meta.column_comment,
  9005. conditionFieldXtype: 'textfield',
  9006. conditionFieldFlex: 1,
  9007. conditionFieldDict: '',
  9008. conditionFieldWrap: false,
  9009. });
  9010. }
  9011. else {
  9012. _this.refs.grid2.appendEditRow({
  9013. conditionFieldBind: columnName,
  9014. conditionFieldLabel: '',
  9015. conditionFieldXtype: 'textfield',
  9016. conditionFieldFlex: 1,
  9017. conditionFieldDict: '',
  9018. conditionFieldWrap: false,
  9019. });
  9020. }
  9021. }
  9022. };
  9023. try {
  9024. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  9025. var m = re_1_1.value;
  9026. _loop_1(m);
  9027. }
  9028. }
  9029. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  9030. finally {
  9031. try {
  9032. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  9033. }
  9034. finally { if (e_1) throw e_1.error; }
  9035. }
  9036. }
  9037. }).finally(function () {
  9038. _this.refs.grid2.setLoading(false);
  9039. });
  9040. };
  9041. WidgetDesign.prototype.calcColumn = function () {
  9042. var _this = this;
  9043. var sql = this.refs.sqlEditor.getCode();
  9044. var rows = this.refs.grid3.getDataRows();
  9045. this.refs.grid3.setLoading(true);
  9046. parseDynamicSqlApi(sql).then(function (res) {
  9047. _.forEach(res.data, function (parseItem) {
  9048. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9049. // 是否找到重复字段
  9050. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9051. if (exists) {
  9052. return;
  9053. }
  9054. if (tableName) {
  9055. // 解出表格名和字段名
  9056. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9057. if (meta) {
  9058. // 找到了元数据
  9059. var r = {
  9060. dataIndex: meta.column_name,
  9061. header: meta.column_comment,
  9062. xtype: '',
  9063. dataType: 'string',
  9064. dict: '',
  9065. };
  9066. if (meta.column_ui === 'combo' && meta.column_dict) {
  9067. r.dict = meta.column_dict;
  9068. }
  9069. else if (meta.column_ui === "checkbox") {
  9070. r.xtype = 'checkbox';
  9071. }
  9072. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9073. r.dataType = meta.data_type;
  9074. }
  9075. _this.refs.grid3.appendEditRow(r);
  9076. return;
  9077. }
  9078. }
  9079. if (columnName) {
  9080. // 解出字段名
  9081. var r = {
  9082. dataIndex: columnName,
  9083. header: columnName,
  9084. xtype: '',
  9085. dataType: 'string',
  9086. dict: '',
  9087. };
  9088. _this.refs.grid3.appendEditRow(r);
  9089. }
  9090. });
  9091. }).finally(function () {
  9092. _this.refs.grid3.setLoading(false);
  9093. });
  9094. };
  9095. return WidgetDesign;
  9096. }(Scope));
  9097. //# sourceMappingURL=WidgetDesign.js.map
  9098. var model$7 = {
  9099. data: {
  9100. // spreadsheet: false,
  9101. // multSelect: false,
  9102. // showCheckColumn: false,
  9103. // checkColumncheckOnly: false,
  9104. // disableSelection: false,
  9105. vjson: {
  9106. reference: '',
  9107. pagination: false,
  9108. pageSize: false,
  9109. pageSizeOption: false,
  9110. hideFootbar: false,
  9111. hideRefresh: false,
  9112. hideExport: false,
  9113. hideAutoSize: false,
  9114. hideClearFilter: false,
  9115. hideSaveGridUIConfig: false,
  9116. hideClearGridUIConfig: false,
  9117. selectMode: '',
  9118. cellediting_clicksToEdit: 1,
  9119. columnLines: false,
  9120. rowLines: false,
  9121. border: false,
  9122. autoLoad: false,
  9123. remoteSort: false,
  9124. remoteFilter: false,
  9125. enableLocking: false,
  9126. enableColumnHide: false,
  9127. enableColumnMove: false,
  9128. gridfilters: false,
  9129. enableColumnResize: false,
  9130. sortOnClick: false,
  9131. hidden: false,
  9132. cls: '',
  9133. dataSource: {
  9134. url: '',
  9135. params: {
  9136. formData: '{form}',
  9137. },
  9138. },
  9139. listeners: {
  9140. beforeselect: '',
  9141. selectionchange: '',
  9142. itemclick: '',
  9143. itemdblclick: '',
  9144. cellClick: '',
  9145. celldblclick: '',
  9146. afterrender: '',
  9147. destory: '',
  9148. }
  9149. },
  9150. }
  9151. };
  9152. //# sourceMappingURL=YvgridDesign.model.js.map
  9153. var vjson$7 = {
  9154. title: '表格-高级',
  9155. height: 450,
  9156. width: 970,
  9157. layout: 'fit',
  9158. modal: true,
  9159. items: [
  9160. {
  9161. xtype: 'tabpanel',
  9162. items: [
  9163. {
  9164. title: '属性',
  9165. xtype: 'form',
  9166. scrollable: true,
  9167. items: [
  9168. {
  9169. xtype: 'cols',
  9170. items: [
  9171. {
  9172. xtype: 'textfield',
  9173. fieldLabel: '引用名',
  9174. tooltip: 'reference',
  9175. bind: '{vjson.reference}',
  9176. },
  9177. ]
  9178. },
  9179. {
  9180. xtype: 'cols',
  9181. border: false,
  9182. items: [
  9183. // 允许分页、页大小、页大小选项
  9184. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9185. // 多选、显示勾选、自动勾选、
  9186. // 单击编辑、列分割线、行分割线、边框
  9187. // 数据源自动加载、后端排序、后端过滤
  9188. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9189. {
  9190. xtype: 'checkbox',
  9191. fieldLabel: '允许分页',
  9192. bind: {
  9193. value: "{vjson.pagination}"
  9194. }
  9195. },
  9196. {
  9197. xtype: 'numberfield',
  9198. fieldLabel: '页大小',
  9199. bind: '{vjson.pageSize}',
  9200. },
  9201. {
  9202. xtype: 'textfield',
  9203. fieldLabel: '页大小选项',
  9204. flex: 2,
  9205. bind: '{vjson.pageSizeOption}',
  9206. },
  9207. ]
  9208. },
  9209. {
  9210. layout: 'hbox',
  9211. border: false,
  9212. items: [
  9213. {
  9214. xtype: 'combo',
  9215. fieldLabel: '选择模式',
  9216. flex: 4,
  9217. data: [
  9218. { id: 'spreadsheet', text: 'Excel模式' },
  9219. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9220. { id: 'checkColumn', text: '勾选框' },
  9221. { id: 'row_mulity', text: '行选择-允许多选' },
  9222. { id: 'row_single', text: '行选择-单选' },
  9223. { id: 'disableSelection', text: '禁用' },
  9224. ],
  9225. bind: {
  9226. value: '{vjson.selectMode}'
  9227. }
  9228. }
  9229. ]
  9230. },
  9231. {
  9232. layout: 'hbox',
  9233. border: false,
  9234. defaults: {
  9235. xtype: 'checkbox',
  9236. margin: '0 15 0 0',
  9237. },
  9238. items: [
  9239. {
  9240. xtype: 'container',
  9241. margin: '3',
  9242. border: false,
  9243. width: 80,
  9244. },
  9245. {
  9246. boxLabel: '隐藏底部',
  9247. bind: {
  9248. value: "{vjson.hideFootbar}"
  9249. }
  9250. },
  9251. {
  9252. boxLabel: '隐藏刷新',
  9253. bind: {
  9254. value: "{vjson.hideRefresh}"
  9255. }
  9256. },
  9257. {
  9258. boxLabel: '隐藏导出',
  9259. bind: {
  9260. value: "{vjson.hideExport}"
  9261. }
  9262. },
  9263. {
  9264. boxLabel: '隐藏自动调宽',
  9265. bind: {
  9266. value: "{vjson.hideAutoSize}"
  9267. }
  9268. },
  9269. {
  9270. boxLabel: '隐藏清空筛选',
  9271. bind: {
  9272. value: "{vjson.hideClearFilter}"
  9273. }
  9274. },
  9275. {
  9276. boxLabel: '隐藏保存布局',
  9277. bind: {
  9278. value: "{vjson.hideSaveGridUIConfig}"
  9279. }
  9280. },
  9281. {
  9282. boxLabel: '隐藏重置布局',
  9283. bind: {
  9284. value: "{vjson.hideClearGridUIConfig}"
  9285. }
  9286. },
  9287. ]
  9288. },
  9289. {
  9290. layout: 'hbox',
  9291. border: false,
  9292. defaults: {
  9293. xtype: 'checkbox',
  9294. margin: '0 15 0 0',
  9295. },
  9296. items: [
  9297. {
  9298. xtype: 'container',
  9299. margin: '3',
  9300. border: false,
  9301. width: 80
  9302. },
  9303. {
  9304. boxLabel: '单击编辑',
  9305. bind: {
  9306. value: "{vjson.cellediting_clicksToEdit}"
  9307. }
  9308. },
  9309. {
  9310. boxLabel: '列分隔线',
  9311. bind: {
  9312. value: "{vjson.columnLines}"
  9313. }
  9314. },
  9315. {
  9316. boxLabel: '行分隔线',
  9317. bind: {
  9318. value: "{vjson.rowLines}"
  9319. }
  9320. },
  9321. {
  9322. boxLabel: '边框',
  9323. bind: {
  9324. value: "{vjson.border}"
  9325. }
  9326. },
  9327. ]
  9328. },
  9329. {
  9330. layout: 'hbox',
  9331. border: false,
  9332. defaults: {
  9333. xtype: 'checkbox',
  9334. margin: '0 15 0 0',
  9335. },
  9336. items: [
  9337. {
  9338. xtype: 'container',
  9339. margin: '3',
  9340. border: false,
  9341. width: 80
  9342. },
  9343. {
  9344. boxLabel: '数据源自动加载',
  9345. bind: {
  9346. value: "{vjson.autoLoad}"
  9347. }
  9348. },
  9349. {
  9350. boxLabel: '后端排序',
  9351. bind: {
  9352. value: "{vjson.remoteSort}"
  9353. }
  9354. },
  9355. {
  9356. boxLabel: '后端过滤',
  9357. bind: {
  9358. value: "{vjson.remoteFilter}"
  9359. }
  9360. },
  9361. ]
  9362. },
  9363. {
  9364. layout: 'hbox',
  9365. border: false,
  9366. defaults: {
  9367. xtype: 'checkbox',
  9368. margin: '0 15 0 0',
  9369. },
  9370. items: [
  9371. {
  9372. xtype: 'container',
  9373. margin: '3',
  9374. border: false,
  9375. width: 80
  9376. },
  9377. {
  9378. boxLabel: '自定义锁定',
  9379. bind: {
  9380. value: "{vjson.enableLocking}"
  9381. }
  9382. },
  9383. {
  9384. boxLabel: '自定义隐藏',
  9385. bind: {
  9386. value: "{vjson.enableColumnHide}"
  9387. }
  9388. },
  9389. {
  9390. boxLabel: '用户拖拽字段',
  9391. bind: {
  9392. value: "{vjson.enableColumnMove}"
  9393. }
  9394. },
  9395. {
  9396. boxLabel: '自定义筛选',
  9397. bind: {
  9398. value: "{vjson.gridfilters}"
  9399. }
  9400. },
  9401. {
  9402. boxLabel: '用户拖拽字段宽度',
  9403. bind: {
  9404. value: "{vjson.enableColumnResize}"
  9405. }
  9406. },
  9407. {
  9408. boxLabel: '点击列头排序',
  9409. bind: {
  9410. value: "{vjson.sortOnClick}"
  9411. }
  9412. },
  9413. {
  9414. xtype: 'checkbox',
  9415. boxLabel: '隐藏',
  9416. bind: {
  9417. value: "{vjson.hidden}"
  9418. }
  9419. },
  9420. ]
  9421. },
  9422. {
  9423. xtype: 'cols',
  9424. items: [
  9425. {
  9426. xtype: 'textfield',
  9427. fieldLabel: '样式',
  9428. bind: '{vjson.cls}',
  9429. flex: 4
  9430. },
  9431. ]
  9432. },
  9433. ]
  9434. },
  9435. {
  9436. title: '字段',
  9437. xtype: 'yvgrid',
  9438. reference: 'grid1',
  9439. pagination: false,
  9440. hideFootbar: true,
  9441. plugins: {
  9442. clipboard: true,
  9443. selectionreplicator: true
  9444. },
  9445. selModel: {
  9446. type: 'spreadsheet',
  9447. columnSelect: true,
  9448. pruneRemoved: false,
  9449. extensible: 'y'
  9450. },
  9451. listeners: {
  9452. editfinish: 'scope.gridEditFinish',
  9453. },
  9454. tbar: {
  9455. xtype: 'toolbar',
  9456. items: [
  9457. {
  9458. xtype: 'button',
  9459. text: '添加',
  9460. iconCls: 'x-fa fa-plus-circle',
  9461. listeners: {
  9462. click: 'scope.addColumn'
  9463. }
  9464. },
  9465. {
  9466. xtype: 'button',
  9467. text: '删除',
  9468. iconCls: 'x-fa fa-minus-circle',
  9469. listeners: {
  9470. click: 'scope.removeColumn'
  9471. }
  9472. },
  9473. '-',
  9474. {
  9475. xtype: 'button',
  9476. text: '自动分析',
  9477. iconCls: 'x-fa fa-code-fork',
  9478. listeners: {
  9479. click: 'scope.calcColumn'
  9480. }
  9481. },
  9482. {
  9483. xtype: 'button',
  9484. text: '上移',
  9485. iconCls: 'x-fa fa-arrow-up',
  9486. listeners: {
  9487. click: 'scope.moveUp'
  9488. }
  9489. },
  9490. {
  9491. xtype: 'button',
  9492. text: '下移',
  9493. iconCls: 'x-fa fa-arrow-down',
  9494. listeners: {
  9495. click: 'scope.moveDown'
  9496. }
  9497. },
  9498. ]
  9499. },
  9500. columns: [
  9501. { xtype: 'rownumberer' },
  9502. {
  9503. text: '字段',
  9504. dataIndex: 'dataIndex',
  9505. width: 140,
  9506. sortable: false,
  9507. menuDisabled: true,
  9508. editor: {
  9509. selectOnFocus: true,
  9510. },
  9511. },
  9512. {
  9513. text: '标题',
  9514. dataIndex: 'header',
  9515. width: 120,
  9516. sortable: false,
  9517. menuDisabled: true,
  9518. editor: {
  9519. selectOnFocus: true,
  9520. },
  9521. },
  9522. {
  9523. text: '类型',
  9524. dataIndex: 'xtype',
  9525. width: 100,
  9526. sortable: false,
  9527. menuDisabled: true,
  9528. editor: {
  9529. xtype: 'combo',
  9530. typeAhead: true,
  9531. triggerAction: 'all',
  9532. selectOnFocus: false,
  9533. listConfig: {
  9534. minWidth: 200
  9535. },
  9536. store: [
  9537. ['', '默认'],
  9538. ['rownum', 'rownum'],
  9539. ['checkcolumn', 'checkcolumn'],
  9540. ]
  9541. },
  9542. },
  9543. {
  9544. text: '数据类型',
  9545. dataIndex: 'dataType',
  9546. width: 100,
  9547. sortable: false,
  9548. menuDisabled: true,
  9549. editor: {
  9550. xtype: 'combo',
  9551. selectOnFocus: true,
  9552. listConfig: {
  9553. minWidth: 200
  9554. },
  9555. store: [
  9556. ['', '默认'],
  9557. ['string', 'string'],
  9558. ['number', 'number'],
  9559. ['date', 'date'],
  9560. ]
  9561. },
  9562. },
  9563. {
  9564. text: '编辑模式',
  9565. dataIndex: 'editor',
  9566. width: 100,
  9567. sortable: false,
  9568. menuDisabled: true,
  9569. editor: {
  9570. xtype: 'combo',
  9571. selectOnFocus: true,
  9572. listConfig: {
  9573. minWidth: 200
  9574. },
  9575. store: [
  9576. ['', ''],
  9577. ['textfield', 'textfield'],
  9578. ['numberfield', 'numberfield'],
  9579. ['combo', 'combo'],
  9580. ['combogrid', 'combogrid'],
  9581. ['datefield', 'datefield'],
  9582. ]
  9583. },
  9584. },
  9585. {
  9586. text: '宽度',
  9587. dataIndex: 'width',
  9588. align: 'right',
  9589. width: 100,
  9590. sortable: false,
  9591. menuDisabled: true,
  9592. editor: {
  9593. xtype: 'numberfield',
  9594. selectOnFocus: true,
  9595. minValue: 0,
  9596. maxValue: 1000
  9597. },
  9598. },
  9599. {
  9600. text: '权重',
  9601. dataIndex: 'flex',
  9602. align: 'right',
  9603. width: 90,
  9604. sortable: false,
  9605. menuDisabled: true,
  9606. editor: {
  9607. xtype: 'numberfield',
  9608. selectOnFocus: true,
  9609. minValue: 0,
  9610. maxValue: 10
  9611. },
  9612. },
  9613. {
  9614. text: '字典',
  9615. dataIndex: 'dict',
  9616. sortable: false,
  9617. menuDisabled: true,
  9618. width: 210,
  9619. editor: {
  9620. selectOnFocus: true,
  9621. },
  9622. },
  9623. {
  9624. text: '对齐',
  9625. dataIndex: 'align',
  9626. width: 90,
  9627. sortable: false,
  9628. menuDisabled: true,
  9629. editor: {
  9630. xtype: 'combo',
  9631. selectOnFocus: true,
  9632. listConfig: {
  9633. minWidth: 120
  9634. },
  9635. store: [
  9636. ['start', 'start'],
  9637. ['center', 'center'],
  9638. ['end', 'end'],
  9639. ]
  9640. },
  9641. },
  9642. {
  9643. text: '必填',
  9644. dataIndex: 'notAllowBlank',
  9645. width: 50,
  9646. resizable: false,
  9647. sortable: false,
  9648. menuDisabled: true,
  9649. xtype: 'checkcolumn',
  9650. },
  9651. {
  9652. text: '禁用',
  9653. dataIndex: 'disabled',
  9654. width: 50,
  9655. resizable: false,
  9656. sortable: false,
  9657. menuDisabled: true,
  9658. xtype: 'checkcolumn',
  9659. },
  9660. {
  9661. text: '禁菜',
  9662. dataIndex: 'menuDisabled',
  9663. width: 50,
  9664. resizable: false,
  9665. sortable: false,
  9666. menuDisabled: true,
  9667. xtype: 'checkcolumn',
  9668. },
  9669. {
  9670. text: '过滤',
  9671. dataIndex: 'filterable',
  9672. xtype: 'checkcolumn',
  9673. width: 50,
  9674. resizable: false,
  9675. sortable: false,
  9676. menuDisabled: true,
  9677. },
  9678. {
  9679. text: '隐藏',
  9680. dataIndex: 'hidden',
  9681. xtype: 'checkcolumn',
  9682. width: 50,
  9683. resizable: false,
  9684. sortable: false,
  9685. menuDisabled: true,
  9686. },
  9687. {
  9688. text: '可隐',
  9689. dataIndex: 'hideable',
  9690. xtype: 'checkcolumn',
  9691. width: 50,
  9692. resizable: false,
  9693. sortable: false,
  9694. menuDisabled: true,
  9695. },
  9696. {
  9697. text: '调宽',
  9698. dataIndex: 'resizable',
  9699. xtype: 'checkcolumn',
  9700. width: 50,
  9701. resizable: false,
  9702. sortable: false,
  9703. menuDisabled: true,
  9704. },
  9705. {
  9706. text: '排序',
  9707. dataIndex: 'sortable',
  9708. xtype: 'checkcolumn',
  9709. width: 50,
  9710. resizable: false,
  9711. sortable: false,
  9712. menuDisabled: true,
  9713. },
  9714. {
  9715. text: '适宽',
  9716. dataIndex: 'autoSize',
  9717. xtype: 'checkcolumn',
  9718. width: 50,
  9719. resizable: false,
  9720. sortable: false,
  9721. menuDisabled: true,
  9722. },
  9723. ],
  9724. },
  9725. {
  9726. title: '数据源',
  9727. layout: 'border',
  9728. listeners: {
  9729. activate: 'scope.dataSourceActivate'
  9730. },
  9731. items: [
  9732. {
  9733. region: 'north',
  9734. xtype: 'toolbar',
  9735. border: false,
  9736. items: [
  9737. {
  9738. xtype: 'textfield',
  9739. fieldLabel: '数据源',
  9740. flex: 1,
  9741. bind: {
  9742. value: '{vjson.dataSource.url}'
  9743. }
  9744. },
  9745. {
  9746. xtype: 'button',
  9747. text: '保存',
  9748. iconCls: 'x-fa fa-save',
  9749. listeners: {
  9750. click: 'scope.dataSourceSave'
  9751. }
  9752. },
  9753. {
  9754. xtype: 'button',
  9755. text: '读取',
  9756. iconCls: 'x-fa fa-folder-open',
  9757. listeners: {
  9758. click: 'scope.reloadSqlContent'
  9759. }
  9760. },
  9761. ]
  9762. },
  9763. {
  9764. region: 'center',
  9765. xtype: 'sqleditor',
  9766. layout: 'fit',
  9767. reference: 'sqlEditor',
  9768. },
  9769. {
  9770. region: 'south',
  9771. xtype: 'jsoneditor',
  9772. height: 200,
  9773. split: true,
  9774. collapsible: true,
  9775. title: '参数',
  9776. reference: 'sqlParams',
  9777. }
  9778. ]
  9779. },
  9780. {
  9781. title: '事件',
  9782. xtype: 'form',
  9783. scrollable: true,
  9784. margin: '10',
  9785. defaults: {
  9786. width: '100%',
  9787. labelAlign: 'top',
  9788. },
  9789. items: [
  9790. {
  9791. xtype: 'textfield',
  9792. fieldLabel: '选中前触发 beforeSelect',
  9793. bind: {
  9794. value: '{vjson.listeners.beforeselect}'
  9795. },
  9796. },
  9797. {
  9798. xtype: 'textfield',
  9799. fieldLabel: '选择范围改变 selectionChange',
  9800. bind: {
  9801. value: '{vjson.listeners.selectionchange}'
  9802. },
  9803. },
  9804. {
  9805. xtype: 'textfield',
  9806. fieldLabel: '行点击 itemClick',
  9807. bind: {
  9808. value: '{vjson.listeners.itemclick}'
  9809. },
  9810. },
  9811. {
  9812. xtype: 'textfield',
  9813. fieldLabel: '行双击 itemDblClick',
  9814. bind: {
  9815. value: '{vjson.listeners.itemdblclick}'
  9816. },
  9817. },
  9818. {
  9819. xtype: 'textfield',
  9820. fieldLabel: '单元格点击 cellClick',
  9821. bind: {
  9822. value: '{vjson.listeners.cellClick}'
  9823. },
  9824. },
  9825. {
  9826. xtype: 'textfield',
  9827. fieldLabel: '单元格双击 cellDblClick',
  9828. bind: {
  9829. value: '{vjson.listeners.celldblclick}'
  9830. },
  9831. },
  9832. {
  9833. xtype: 'textfield',
  9834. fieldLabel: '渲染后触发 afterrender',
  9835. bind: {
  9836. value: '{vjson.listeners.afterrender}'
  9837. },
  9838. },
  9839. {
  9840. xtype: 'textfield',
  9841. fieldLabel: '销毁后触发 destory',
  9842. bind: {
  9843. value: '{vjson.listeners.destory}'
  9844. },
  9845. },
  9846. ]
  9847. },
  9848. ],
  9849. }
  9850. ],
  9851. fbar: [
  9852. {
  9853. text: '应用', iconCls: 'x-fa fa-save',
  9854. listeners: {
  9855. click: 'scope.save'
  9856. }
  9857. },
  9858. '-',
  9859. {
  9860. text: '确定', iconCls: 'x-fa fa-check-circle',
  9861. listeners: {
  9862. click: 'scope.saveClose'
  9863. }
  9864. },
  9865. {
  9866. text: '取消', iconCls: 'x-fa fa-times-circle',
  9867. listeners: {
  9868. click: 'system.closeMe()'
  9869. }
  9870. },
  9871. ]
  9872. };
  9873. //# sourceMappingURL=YvgridDesign.view.js.map
  9874. var checkFlags = {};
  9875. // ------------------------------------------------------------------------------------------ impls
  9876. function jsViewToVJson(modulePage, jsView) {
  9877. if (!jsView)
  9878. return {};
  9879. jsView = jsView.replace(/^\s*export\s+default/, "");
  9880. jsView = _$2.trim(jsView) || "{}";
  9881. try {
  9882. var json = dist.parse(jsView);
  9883. return modulePage.addViewId(json);
  9884. }
  9885. catch (e) {
  9886. //@ts-ignore
  9887. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9888. }
  9889. }
  9890. function stringToJsonObj(jsonStr) {
  9891. if (!jsonStr)
  9892. return {};
  9893. try {
  9894. return dist.parse(jsonStr);
  9895. }
  9896. catch (e) {
  9897. return {};
  9898. }
  9899. }
  9900. /**
  9901. * 获取view.js 文件 string
  9902. */
  9903. function vjsonTojsView(vjson) {
  9904. var reVjson = _$2.cloneDeep(vjson);
  9905. removeDesignProp(reVjson);
  9906. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9907. }
  9908. var ModuleStore = /** @class */ (function (_super) {
  9909. __extends(ModuleStore, _super);
  9910. function ModuleStore() {
  9911. var _this = _super.call(this) || this;
  9912. _this.store = {};
  9913. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9914. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9915. _this.addModule(id, module, modulePage);
  9916. });
  9917. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9918. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9919. _this.onMainTabChange(moduleId, oldModuleId, from);
  9920. });
  9921. return _this;
  9922. }
  9923. ModuleStore.prototype.getCacheKey = function (param) {
  9924. return "filetree_data.json";
  9925. };
  9926. ModuleStore.prototype.invokeApi = function (param) {
  9927. return moduleTree();
  9928. };
  9929. ModuleStore.prototype.reloadModule = function (id) {
  9930. var moduleObject = this.store[id];
  9931. if (!moduleObject)
  9932. return;
  9933. var module = moduleObject.module;
  9934. getModuleFileContent(module).then(function (_a) {
  9935. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9936. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9937. moduleObject.lastModifyTime = lastModifyTime;
  9938. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9939. // 触发事件 ModuleItemChange
  9940. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9941. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9942. vjson: moduleObject.moduleObj.vjson,
  9943. from: "reloadModule"
  9944. });
  9945. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9946. });
  9947. };
  9948. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9949. var _this = this;
  9950. window['mainWindow'].setLoading(true);
  9951. getModuleFileContent(module)
  9952. .then(function (_a) {
  9953. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9954. var moduleObject = {
  9955. id: id, module: module,
  9956. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9957. lastModifyTime: lastModifyTime,
  9958. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9959. modulePage: modulePage,
  9960. moduleEventBus: modulePage.moduleEventBus
  9961. };
  9962. _this.store[id] = moduleObject;
  9963. // 触发事件 ModuleItemChange
  9964. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9965. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9966. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9967. })
  9968. .finally(function () {
  9969. window['mainWindow'].setLoading(false);
  9970. });
  9971. };
  9972. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9973. if (this.store[moduleId]) {
  9974. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9975. }
  9976. };
  9977. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9978. var moduleObject = this.store[id];
  9979. moduleObject.fileContent.jsController = codeValue;
  9980. };
  9981. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9982. var moduleObject = this.store[id];
  9983. moduleObject.fileContent.jsView = codeValue;
  9984. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9985. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9986. vjson: moduleObject.moduleObj.vjson,
  9987. from: from
  9988. });
  9989. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9990. };
  9991. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9992. var moduleObject = this.store[id];
  9993. moduleObject.fileContent.jsModel = codeValue;
  9994. };
  9995. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9996. var moduleObject = this.store[id];
  9997. moduleObject.fileContent.groovy = codeValue;
  9998. };
  9999. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  10000. var moduleObject = this.store[id];
  10001. moduleObject.fileContent.mybatis = codeValue;
  10002. };
  10003. ModuleStore.prototype.getModuleObject = function (id) {
  10004. return this.store[id];
  10005. };
  10006. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  10007. if (checkFlags[moduleId] === 1) {
  10008. // @ts-ignore
  10009. system.msg("正在检测文件是否有外部修改,请稍后操作");
  10010. }
  10011. eventBus.publish(EventType.StopCheckModule, {});
  10012. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  10013. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  10014. saveFile(fileFullPath, fileContent).then(function (res) {
  10015. if (res.data && res.data.lastModified) {
  10016. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  10017. }
  10018. }).finally(function () {
  10019. eventBus.publish(EventType.RunCheckModule, {});
  10020. });
  10021. };
  10022. ModuleStore.prototype.check = function (moduleId) {
  10023. {
  10024. return;
  10025. }
  10026. };
  10027. return ModuleStore;
  10028. }(CacheStore));
  10029. // ------------------------------------------------------------------------------------------ use
  10030. var moduleStore = new ModuleStore();
  10031. //# sourceMappingURL=ModuleStore.js.map
  10032. var VjsonExchange = /** @class */ (function () {
  10033. function VjsonExchange(vjson) {
  10034. this.pendingSet = true;
  10035. this.vjsonOrigin = _$2.cloneDeep(vjson);
  10036. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  10037. }
  10038. /**
  10039. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  10040. * @param propName
  10041. * @param value
  10042. */
  10043. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10044. if (this.pendingSet) {
  10045. return;
  10046. }
  10047. // selectMode
  10048. // pageSizeOption
  10049. // cellediting_clicksToEdit
  10050. msg$1('' + propName + '=' + value);
  10051. _$2.set(this.vjson, propName, value);
  10052. };
  10053. /**
  10054. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10055. */
  10056. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10057. var _a, _b, _c;
  10058. if (this.pendingSet) {
  10059. return;
  10060. }
  10061. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10062. // 如果不使用默认属性,就直接设定 undefined
  10063. var vs = {
  10064. dataIndex: undefined,
  10065. header: undefined,
  10066. xtype: '',
  10067. width: undefined,
  10068. flex: undefined,
  10069. align: 'start',
  10070. editor: undefined,
  10071. dataType: 'string',
  10072. dict: undefined,
  10073. disabled: false,
  10074. menuDisabled: false,
  10075. notAllowBlank: false,
  10076. filterable: true,
  10077. hidden: false,
  10078. hideable: true,
  10079. resizable: true,
  10080. sortable: true,
  10081. autoSize: true,
  10082. };
  10083. var raw = record.get('raw');
  10084. if (raw === undefined || raw == null) {
  10085. raw = {};
  10086. record.set('raw', raw);
  10087. }
  10088. var setRaw = function (propName, value) {
  10089. if (typeof value === 'undefined' || value == null) {
  10090. msg$1("delete columns[" + rowIdx + "]." + propName);
  10091. delete raw[propName];
  10092. return;
  10093. }
  10094. var defaultValue = vs[propName];
  10095. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10096. // 要设的值,与默认值相同,就直接删除这个属性
  10097. msg$1("delete columns[" + rowIdx + "]." + propName);
  10098. delete raw[propName];
  10099. return;
  10100. }
  10101. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10102. _$2.set(raw, propName, value);
  10103. };
  10104. if (!vs.hasOwnProperty(propName)) {
  10105. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10106. return;
  10107. }
  10108. else if (propName === 'dict') {
  10109. if (value) {
  10110. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10111. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10112. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10113. }
  10114. }
  10115. else {
  10116. setRaw('fix', undefined);
  10117. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10118. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10119. delete raw.editor.fix;
  10120. }
  10121. }
  10122. }
  10123. else if (propName === 'xtype') {
  10124. if (!value) {
  10125. setRaw('xtype', undefined);
  10126. }
  10127. else {
  10128. setRaw('xtype', value);
  10129. }
  10130. }
  10131. else if (propName === 'notAllowBlank') {
  10132. setRaw('editor.allowBlank', !value);
  10133. }
  10134. else if (propName === 'editor') {
  10135. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10136. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10137. value = undefined;
  10138. }
  10139. // editor.xtype
  10140. if (!value) {
  10141. // 不需要编辑器
  10142. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10143. msg$1("delete columns[" + rowIdx + "].editor");
  10144. delete raw.editor;
  10145. record.set('notAllowBlank', false);
  10146. }
  10147. }
  10148. else {
  10149. setRaw('editor.xtype', value);
  10150. var dict = record.get('dict');
  10151. if (value === 'combo' && dict) {
  10152. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10153. }
  10154. }
  10155. }
  10156. else if (propName === 'width') {
  10157. var width = value;
  10158. var flex = record.get('flex');
  10159. if (!width && !flex) {
  10160. setRaw('width', undefined);
  10161. setRaw('flex', undefined);
  10162. record.set('flex', undefined);
  10163. record.set('width', undefined);
  10164. return;
  10165. }
  10166. else if (!!width) {
  10167. setRaw('flex', undefined);
  10168. record.set('flex', undefined);
  10169. setRaw('width', width);
  10170. return;
  10171. }
  10172. }
  10173. else if (propName === 'flex') {
  10174. var width = record.get('width');
  10175. var flex = value;
  10176. if (!width && !flex) {
  10177. setRaw('width', undefined);
  10178. setRaw('flex', undefined);
  10179. record.set('flex', undefined);
  10180. record.set('width', undefined);
  10181. return;
  10182. }
  10183. else if (!!flex) {
  10184. setRaw('width', undefined);
  10185. record.set('width', undefined);
  10186. setRaw('flex', flex);
  10187. return;
  10188. }
  10189. }
  10190. else {
  10191. // 其他属性,作为同名属性,与 raw 同步
  10192. setRaw(propName, value);
  10193. }
  10194. };
  10195. /**
  10196. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10197. */
  10198. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10199. var _this = this;
  10200. var vs = [
  10201. 'reference', 'pagination', 'pageSize',
  10202. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10203. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10204. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10205. 'listeners.beforeselect',
  10206. 'listeners.selectionchange',
  10207. 'listeners.itemclick',
  10208. 'listeners.itemdblclick',
  10209. 'listeners.cellClick',
  10210. 'listeners.celldblclick',
  10211. 'listeners.afterrender',
  10212. 'listeners.destory',
  10213. ];
  10214. _$2.forEach(vs, function (v) {
  10215. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10216. });
  10217. };
  10218. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10219. var me = this;
  10220. return function (value) {
  10221. me.setPropValue(propName, value);
  10222. };
  10223. };
  10224. VjsonExchange.prototype.parseModel = function () {
  10225. var _this = this;
  10226. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
  10227. //@ts-ignore
  10228. var df = YvanUI.Defaults.grid;
  10229. var vjson = _$2.assign({}, df, this.vjson);
  10230. var model = {
  10231. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10232. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10233. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10234. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10235. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10236. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10237. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10238. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10239. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10240. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10241. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10242. selectMode: 'spreadsheet',
  10243. cellediting_clicksToEdit: true,
  10244. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10245. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10246. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10247. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10248. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10249. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10250. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10251. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10252. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10253. gridfilters: true,
  10254. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10255. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10256. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10257. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10258. columns: [],
  10259. listeners: {
  10260. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10261. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10262. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10263. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10264. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10265. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10266. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10267. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10268. }
  10269. };
  10270. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10271. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10272. }
  10273. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10274. if (_$2.get(vjson, 'disableSelection') == true) {
  10275. model.selectMode = 'disableSelection';
  10276. }
  10277. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10278. model.selectMode = 'spreadsheet';
  10279. }
  10280. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10281. model.selectMode = 'onlyCheckColumn';
  10282. }
  10283. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10284. model.selectMode = 'checkColumn';
  10285. }
  10286. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10287. model.selectMode = 'row_mulity';
  10288. }
  10289. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10290. model.selectMode = 'row_single';
  10291. }
  10292. else {
  10293. model.selectMode = 'row_single';
  10294. }
  10295. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10296. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10297. model.dataSource = {
  10298. url: _$2.get(vjson, 'dataSource.url'),
  10299. //@ts-ignore
  10300. params: _$2.get(vjson, 'dataSource.params')
  10301. };
  10302. }
  10303. _$2.forEach(vjson.columns, function (column) {
  10304. model.columns.push(_this.parseColumn(column));
  10305. });
  10306. return model;
  10307. };
  10308. VjsonExchange.prototype.parseColumn = function (column) {
  10309. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10310. var model = {
  10311. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10312. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10313. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10314. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10315. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10316. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10317. editor: '',
  10318. editParam: '',
  10319. dict: '',
  10320. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10321. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10322. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10323. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10324. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10325. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10326. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10327. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10328. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10329. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10330. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10331. raw: _$2.cloneDeep(column),
  10332. };
  10333. // width / flex 只能留一个属性, 或者全不留
  10334. if (model.width <= 0 && model.flex <= 0) {
  10335. delete model.width;
  10336. delete model.flex;
  10337. }
  10338. else if (model.width > 0) {
  10339. delete model.flex;
  10340. }
  10341. else {
  10342. delete model.width;
  10343. }
  10344. // editor
  10345. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10346. model.editor = _$2.get(column, 'editor.xtype');
  10347. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10348. if (!model.editor) {
  10349. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10350. model.editor = 'textfield';
  10351. }
  10352. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10353. msg$1('不可识别的 editor.xtype=' + model.editor);
  10354. console.error('不可识别的 editor.xtype', column);
  10355. }
  10356. if (_$2.get(column, 'editor.allowBlank') === false) {
  10357. model.notAllowBlank = true;
  10358. }
  10359. }
  10360. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10361. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10362. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10363. if (match && match[1]) {
  10364. model.dict = match[1];
  10365. }
  10366. }
  10367. return model;
  10368. };
  10369. return VjsonExchange;
  10370. }());
  10371. //
  10372. //# sourceMappingURL=YvgridExchange.js.map
  10373. var YvgridDesign = /** @class */ (function (_super) {
  10374. __extends(YvgridDesign, _super);
  10375. function YvgridDesign(moduleId) {
  10376. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10377. _this.moduleId = '';
  10378. _this.name = 'YvgridDesign';
  10379. _this.dataSourceIsActived = false;
  10380. _this.setModuleId(moduleId);
  10381. return _this;
  10382. }
  10383. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10384. var _this = this;
  10385. this.moduleId = moduleId;
  10386. if (this.componentSelectionChangeSubscribe) {
  10387. this.componentSelectionChangeSubscribe.cancel();
  10388. this.componentSelectionChangeSubscribe = null;
  10389. }
  10390. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10391. var id = _a.id, from = _a.from;
  10392. _this.onComponentSelectionChange(id, from);
  10393. });
  10394. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10395. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10396. if (vj.xtype !== 'yvgrid') {
  10397. throw Error('非 yvgrid 组件');
  10398. }
  10399. this.vjsonExchange = new VjsonExchange(vj);
  10400. };
  10401. YvgridDesign.prototype.onLoad = function () {
  10402. var _this = this;
  10403. var model = this.vjsonExchange.parseModel();
  10404. this.vjsonExchange.pendingSet = true;
  10405. mergeViewModel(this.viewModel, "vjson", model, false);
  10406. this.refs.grid1.setData(model.columns);
  10407. this.vjsonExchange.attachViewModel(this.viewModel);
  10408. _$2.defer(function () {
  10409. _this.vjsonExchange.pendingSet = false;
  10410. });
  10411. };
  10412. YvgridDesign.prototype.moveUp = function (sender) {
  10413. var grid = sender.up('grid');
  10414. grid.rowMoveUp();
  10415. };
  10416. YvgridDesign.prototype.moveDown = function (sender) {
  10417. var grid = sender.up('grid');
  10418. grid.rowMoveDown();
  10419. };
  10420. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10421. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10422. };
  10423. YvgridDesign.prototype.reloadSqlContent = function () {
  10424. var _this = this;
  10425. var url = this.viewModel.get('vjson.dataSource.url');
  10426. if (url) {
  10427. loadSqlContentApi(url).then(function (res) {
  10428. _this.refs.sqlEditor.setCode('');
  10429. if (res.success) {
  10430. _this.refs.sqlEditor.setCode(res.data.content);
  10431. }
  10432. }).catch(function () {
  10433. _this.refs.sqlEditor.setCode('');
  10434. });
  10435. }
  10436. };
  10437. YvgridDesign.prototype.dataSourceSave = function () {
  10438. var url = this.viewModel.get('vjson.dataSource.url');
  10439. if (!url) {
  10440. msg$1('必须填写 groovy/SQL 模块路径');
  10441. return;
  10442. }
  10443. var content = this.refs.sqlEditor.getCode();
  10444. saveSqlContentApi(url, content).then(function (res) {
  10445. if (res.success) {
  10446. msg$1('保存成功');
  10447. }
  10448. else {
  10449. msg$1(res.msg);
  10450. }
  10451. });
  10452. };
  10453. YvgridDesign.prototype.dataSourceActivate = function () {
  10454. if (!this.dataSourceIsActived) {
  10455. // 激活
  10456. this.reloadSqlContent();
  10457. var params = this.viewModel.get('vjson.dataSource.params');
  10458. if (_$2.isObject(params)) {
  10459. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10460. }
  10461. this.dataSourceIsActived = true;
  10462. }
  10463. };
  10464. // 外部控件选择发生改变
  10465. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10466. if (!id || from === this.name) {
  10467. return;
  10468. }
  10469. this.setVjson(id);
  10470. };
  10471. YvgridDesign.prototype.setVjson = function (id) {
  10472. // 找到对应的组件 判断是不是表格
  10473. };
  10474. YvgridDesign.prototype.save = function () {
  10475. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10476. if (this.dataSourceIsActived) {
  10477. var url = this.viewModel.get('vjson.dataSource.url');
  10478. // 解析 params
  10479. var paramsString = this.refs.sqlParams.getCode('');
  10480. var params = undefined;
  10481. if (paramsString) {
  10482. try {
  10483. params = window['YvanUI'].json5.parse(paramsString);
  10484. }
  10485. catch (e) {
  10486. msg$1('dataSource.params 格式非法,请检查');
  10487. return;
  10488. }
  10489. }
  10490. if (typeof params === 'undefined') {
  10491. params = this.viewModel.get('vjson.dataSource.params');
  10492. }
  10493. if (url) {
  10494. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10495. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10496. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10497. }
  10498. else {
  10499. delete this.vjsonExchange.vjson['dataSource'];
  10500. }
  10501. }
  10502. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10503. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10504. from: this.name,
  10505. ignoreRenderUI: false
  10506. });
  10507. };
  10508. YvgridDesign.prototype.saveClose = function () {
  10509. this.save();
  10510. this.close();
  10511. };
  10512. YvgridDesign.prototype.addColumn = function () {
  10513. this.refs.grid1.appendEditRow({
  10514. dataIndex: '',
  10515. header: '',
  10516. xtype: '',
  10517. width: 80,
  10518. align: '',
  10519. editor: '',
  10520. editParam: '',
  10521. dict: '',
  10522. disabled: false,
  10523. notAllowBlank: false,
  10524. menuDisabled: false,
  10525. filterable: false,
  10526. hidden: false,
  10527. hideable: true,
  10528. resizable: true,
  10529. sortable: true,
  10530. locked: false,
  10531. lockable: false,
  10532. autoSize: true,
  10533. raw: undefined,
  10534. }, 'header');
  10535. };
  10536. YvgridDesign.prototype.removeColumn = function () {
  10537. var _this = this;
  10538. var rows = [];
  10539. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10540. rows.push(r);
  10541. });
  10542. _$2.forEach(rows, function (r) {
  10543. _this.refs.grid1.getStore().remove(r);
  10544. });
  10545. };
  10546. YvgridDesign.prototype.calcColumn = function () {
  10547. msg$1('暂未实现');
  10548. };
  10549. YvgridDesign.prototype.onDestroy = function () {
  10550. if (this.componentSelectionChangeSubscribe) {
  10551. this.componentSelectionChangeSubscribe.cancel();
  10552. this.componentSelectionChangeSubscribe = null;
  10553. }
  10554. };
  10555. return YvgridDesign;
  10556. }(Scope));
  10557. //# sourceMappingURL=YvgridDesign.js.map
  10558. // export const idPrefix = "_ds_"
  10559. var _designInstance;
  10560. function setDesignInstance(instance) {
  10561. _designInstance = instance;
  10562. }
  10563. function getDesignInstance() {
  10564. return _designInstance;
  10565. }
  10566. function delegateDragmove(node, source, info) {
  10567. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10568. //@ts-ignore
  10569. _designInstance.dragmove(node, source, info);
  10570. }
  10571. }
  10572. function delegateDragend(node, source, info) {
  10573. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10574. //@ts-ignore
  10575. _designInstance.dragend(node, source, info);
  10576. }
  10577. }
  10578. //# sourceMappingURL=DropHelper.js.map
  10579. var YvanUI$1 = window['YvanUI'];
  10580. var _$1 = window["_"];
  10581. var Ext$1 = window['Ext'];
  10582. var $$1 = window["$"];
  10583. var historySize = 100;
  10584. var ViewDesign = /** @class */ (function () {
  10585. function ViewDesign(moduleId, reference) {
  10586. var _this = this;
  10587. this.name = "ViewDesign";
  10588. this.expandedVjsonObjArray = [];
  10589. // 编辑历史
  10590. this.undoVjsonList = [];
  10591. // 撤销历史
  10592. this.redoVjsonList = [];
  10593. // 订阅事件列表
  10594. this.subscribeList = [];
  10595. // private getOuterCopyValueTimer: any = null
  10596. /**
  10597. * 唯一编号
  10598. */
  10599. this.id = _$1.uniqueId("_dv");
  10600. this.moduleId = moduleId;
  10601. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10602. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10603. this.designReference = reference;
  10604. this.designElement = reference.ariaEl.dom;
  10605. this.$overlay.appendTo(this.designElement);
  10606. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10607. // 添加到撤销
  10608. this.lastVjson = _$1.cloneDeep(this.vjson);
  10609. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10610. event.stopPropagation();
  10611. event.preventDefault();
  10612. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10613. });
  10614. this.$overlay.on('click', '.studio_mask', function (event) {
  10615. event.stopPropagation();
  10616. event.preventDefault();
  10617. _this.clearSelection();
  10618. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10619. _$1.defer(function () {
  10620. _this.$overlay.focus();
  10621. });
  10622. });
  10623. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10624. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10625. this.$overlay.on('copy', this.onCopy.bind(this));
  10626. this.$overlay.on('paste', this.onPaste.bind(this));
  10627. this.$overlay.on('focus', this.onfocus.bind(this));
  10628. // this.$overlay.on('mouseenter', ()=>{
  10629. // clearTimeout(this.getOuterCopyValueTimer);
  10630. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10631. // })
  10632. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10633. _this.onMousemove(event);
  10634. }, 300, { maxWait: 500 }).bind(this));
  10635. window.addEventListener('message', this.onMessageEvent.bind(this));
  10636. this.subscribe();
  10637. setDesignInstance(this);
  10638. }
  10639. // todo ======== 方法 ==========
  10640. ViewDesign.prototype.subscribe = function () {
  10641. var _this = this;
  10642. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10643. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10644. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10645. _this.setVjson(vjson, from, ignoreRenderUI);
  10646. }));
  10647. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10648. var id = _a.id, from = _a.from;
  10649. _this.onComponentSelectionChange(id, from);
  10650. }));
  10651. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10652. var id = _a.id, from = _a.from;
  10653. _this.onComponentDelete(id, from);
  10654. }));
  10655. };
  10656. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10657. if (vjson === void 0) { vjson = this.vjson; }
  10658. if (from === void 0) { from = this.name; }
  10659. this.vjson = vjson;
  10660. if (from !== "undo" && from !== "redo") {
  10661. if (this.undoVjsonList.length >= 100) {
  10662. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10663. }
  10664. this.undoVjsonList.push(this.lastVjson);
  10665. }
  10666. this.lastVjson = _$1.cloneDeep(vjson);
  10667. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10668. };
  10669. /**
  10670. * 覆盖层点击事件
  10671. */
  10672. ViewDesign.prototype.overlayClickFunction = function (event) {
  10673. if (!event.altKey && !event.shiftKey) {
  10674. var target = this.findElByXY(event.clientX, event.clientY);
  10675. if (target) {
  10676. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10677. var extHandle = Ext$1.get(target).component;
  10678. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10679. rect.x = position.x;
  10680. rect.y = position.y;
  10681. this.clearSelection();
  10682. this.appendMaskbox(rect, extHandle.id);
  10683. }
  10684. }
  10685. };
  10686. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10687. if (dragType === void 0) { dragType = ""; }
  10688. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10689. var ele = document.elementsFromPoint(x, y);
  10690. if (ele.length <= 1) {
  10691. return;
  10692. }
  10693. var target = null;
  10694. for (var i = 0; i < ele.length; i++) {
  10695. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10696. if (((_a = ele[i].getAttribute("class")) === null || _a === void 0 ? void 0 : _a.indexOf("yvan_design ")) >= 0 && ele[i].id && ele[i].id.indexOf('-') < 0) {
  10697. switch (dragType) {
  10698. case "cols-container":
  10699. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10700. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10701. target = ele[i];
  10702. }
  10703. break;
  10704. case "col-item":
  10705. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10706. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10707. target = ele[i];
  10708. }
  10709. break;
  10710. case "rows-container":
  10711. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10712. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10713. target = ele[i];
  10714. }
  10715. break;
  10716. case "row-item":
  10717. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10718. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10719. target = ele[i];
  10720. }
  10721. break;
  10722. default:
  10723. target = ele[i];
  10724. break;
  10725. }
  10726. if (target) {
  10727. break;
  10728. }
  10729. }
  10730. }
  10731. return target;
  10732. };
  10733. /**
  10734. * 清空选择项
  10735. */
  10736. ViewDesign.prototype.clearSelection = function () {
  10737. // $(this.designElement).removeClass('selected');
  10738. // // $(this.designElement).find('.selected').removeClass('selected')
  10739. // $(this.designElement).find('.ds_mask')
  10740. // .not('.mask_not_hide')
  10741. // .remove();
  10742. $$1('.studio_mask').remove();
  10743. // $(this.designElement).find('.selected').each(function () {
  10744. // $(this).removeClass('selected');
  10745. // // const extHandle = Ext.get(this).component
  10746. // // if (extHandle) {
  10747. // // extHandle.removeCls('selected')
  10748. // // }
  10749. // })
  10750. };
  10751. /**
  10752. * 添加遮罩层
  10753. */
  10754. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10755. var that = this;
  10756. if (vjsonId) {
  10757. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10758. }
  10759. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10760. // return item === cj.xtype
  10761. // }) >= 0
  10762. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10763. this.$mask = $$1("\n<div class=\"studio_mask\" tabindex=\"0\">\n <span style=\"display: none\">dsMain.BILL_DATE</span>\n <i class=\"fa fa-trash-o ds_del\"></i>\n <i class=\"fa fa-angle-double-up ds_parent\"></i>\n</div>");
  10764. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10765. this.$mask.css({
  10766. position: 'absolute',
  10767. top: top, left: left, width: width, height: height,
  10768. border: '2px dashed #1890ff',
  10769. zIndex: 100,
  10770. });
  10771. this.$mask.appendTo(this.$overlay);
  10772. this.$mask.on("click", ".ds_del", function (e) {
  10773. e.stopPropagation();
  10774. e.preventDefault();
  10775. that.deleteComponent(vjsonId);
  10776. });
  10777. // 点击选中父级
  10778. this.$mask.on('click', '.ds_parent', function (e) {
  10779. e.stopPropagation();
  10780. e.preventDefault();
  10781. that.selectParent(vjsonId);
  10782. });
  10783. var sel = document.getElementById(vjsonId);
  10784. var sVjosn = findInCode(this.vjson, vjsonId);
  10785. // 限制可以拖动的组件
  10786. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10787. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10788. this.dragSource = new Ext$1.drag.Source({
  10789. element: this.$mask[0],
  10790. constrain: this.$overlay[0],
  10791. listeners: {
  10792. dragmove: this.dragmove.bind(that, this.vjson),
  10793. dragend: this.dragend.bind(that, this.vjson)
  10794. },
  10795. startRect: rect,
  10796. sourceVjson: findInCode(this.vjson, vjsonId),
  10797. sourceVjsonId: vjsonId,
  10798. dragType: dragType
  10799. });
  10800. }
  10801. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10802. };
  10803. /**
  10804. * 选中某个选项
  10805. */
  10806. ViewDesign.prototype.setSelection = function (id) {
  10807. var _a, _b;
  10808. if (!this.designElement) {
  10809. return;
  10810. }
  10811. // 清空选中内容
  10812. this.clearSelection();
  10813. if (!id) {
  10814. return;
  10815. }
  10816. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10817. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10818. rect.x = position.x;
  10819. rect.y = position.y;
  10820. this.appendMaskbox(rect, id);
  10821. };
  10822. /**
  10823. * 删除组件
  10824. * @param id
  10825. */
  10826. ViewDesign.prototype.deleteComponent = function (id) {
  10827. deletVjsonById(this.vjson, id);
  10828. this.moduleObject.modulePage.currentComponentSelectId = null;
  10829. this.setVjson();
  10830. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10831. this.clearSelection();
  10832. };
  10833. ViewDesign.prototype.selectParent = function (id) {
  10834. var pid = getSuperVjsonId(this.vjson, id);
  10835. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10836. this.setSelection(pid);
  10837. };
  10838. // todo ====== 拖拽事件 ======
  10839. ViewDesign.prototype.dragmove = function (node, source, info) {
  10840. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10841. if (!target) {
  10842. return;
  10843. }
  10844. var rect = target.getBoundingClientRect();
  10845. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10846. var extHandle = Ext$1.get(target).component;
  10847. if (!extHandle) {
  10848. return;
  10849. }
  10850. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10851. rect.x = position.x;
  10852. rect.y = position.y;
  10853. this.appendDirection(rect, extHandle.id, direction);
  10854. };
  10855. ViewDesign.prototype.dragend = function (node, source, info) {
  10856. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10857. if (!target) {
  10858. return;
  10859. }
  10860. var rect = target.getBoundingClientRect();
  10861. var extHandle = Ext$1.get(target).component;
  10862. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10863. if (!extHandle) {
  10864. return;
  10865. }
  10866. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10867. this.removeDirection();
  10868. };
  10869. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10870. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10871. var cv = findInCode(this.vjson, vjsonId);
  10872. if (this.$direction) {
  10873. $$1('#direction' + this.id).remove();
  10874. }
  10875. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10876. //
  10877. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10878. if (direction) {
  10879. if (direction === "top") {
  10880. // direction = 'center'
  10881. height = height / 4;
  10882. }
  10883. else if (direction === "bottom") {
  10884. // direction = 'center'
  10885. top = top + height / 4 * 3;
  10886. height = height / 4;
  10887. }
  10888. else if (direction === "left") {
  10889. width = width / 4;
  10890. }
  10891. else if (direction === "right") {
  10892. left = left + width / 4 * 3;
  10893. width = width / 4;
  10894. }
  10895. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10896. this.$direction.css({
  10897. position: 'absolute',
  10898. top: top, left: left, width: width, height: height,
  10899. // border: '2px dashed #1890ff',
  10900. background: 'rgba(40,224,218,0.75)',
  10901. zIndex: 100,
  10902. });
  10903. this.$direction.appendTo(this.$overlay);
  10904. // }
  10905. }
  10906. };
  10907. ViewDesign.prototype.removeDirection = function () {
  10908. if (this.$direction) {
  10909. this.$direction.remove();
  10910. this.$direction = null;
  10911. }
  10912. };
  10913. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10914. var arrS;
  10915. if (sourceVjId) {
  10916. arrS = findArrayContainer(this.vjson, sourceVjId);
  10917. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10918. var indexS = _$1.findIndex(arrS, function (v) {
  10919. return v.id === sourceVjId;
  10920. });
  10921. if (indexS < 0) {
  10922. return;
  10923. }
  10924. }
  10925. delete sourceVjson.id;
  10926. var vjsonT = findInCode(this.vjson, targetVjId);
  10927. var arrT = findArrayContainer(this.vjson, targetVjId);
  10928. var indexT = _$1.findIndex(arrT, function (v) {
  10929. return v.id === targetVjId;
  10930. });
  10931. if (indexT < 0) {
  10932. return;
  10933. }
  10934. switch (direction) {
  10935. case 'top':
  10936. case 'left':
  10937. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10938. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10939. vjsonT.items.splice(0, 0, sourceVjson);
  10940. }
  10941. else {
  10942. arrT.splice(indexT, 0, sourceVjson);
  10943. }
  10944. break;
  10945. case 'bottom':
  10946. case 'right':
  10947. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10948. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10949. vjsonT.items.push(sourceVjson);
  10950. }
  10951. else {
  10952. arrT.splice(indexT + 1, 0, sourceVjson);
  10953. }
  10954. break;
  10955. case 'center':
  10956. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10957. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10958. vjsonT.items.push(sourceVjson);
  10959. }
  10960. else {
  10961. arrT.splice(indexT, 1, sourceVjson);
  10962. }
  10963. break;
  10964. }
  10965. if (sourceVjId) {
  10966. deletVjsonById(this.vjson, sourceVjId);
  10967. sourceVjson.id = sourceVjId;
  10968. }
  10969. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10970. };
  10971. // todo ======== 事件 ==========
  10972. // 接收 postMessage 事件分发
  10973. ViewDesign.prototype.onMessageEvent = function (event) {
  10974. var _a, _b;
  10975. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10976. if (fucName && typeof this[fucName] === 'function') {
  10977. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10978. }
  10979. };
  10980. // 接收外部选中组件事件
  10981. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10982. if (from !== this.name) {
  10983. this.setSelection(id);
  10984. }
  10985. };
  10986. // 接收外部组件删除事件
  10987. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10988. if (from !== this.name) {
  10989. this.deleteComponent(id);
  10990. }
  10991. };
  10992. // 组件被选中
  10993. ViewDesign.prototype.onComponentSelect = function (args) {
  10994. if (args[2] != this.moduleId) {
  10995. return;
  10996. }
  10997. if (args[0]) {
  10998. var rect = args[0];
  10999. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11000. rect.x = position.x;
  11001. rect.y = position.y;
  11002. this.clearSelection();
  11003. this.appendMaskbox(rect, args[1]);
  11004. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  11005. }
  11006. };
  11007. ViewDesign.prototype.onComponentInfo = function (_a) {
  11008. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  11009. if (moduleId != this.moduleId) {
  11010. return;
  11011. }
  11012. if (rect) {
  11013. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11014. rect.x = position.x;
  11015. rect.y = position.y;
  11016. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  11017. var cv_1 = findInCode(this.vjson, vjsonId);
  11018. if (this.$direction) {
  11019. $$1('#direction' + this.id).remove();
  11020. }
  11021. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  11022. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  11023. if (direction) {
  11024. if (direction === "top") {
  11025. direction = 'center';
  11026. //height = height/3
  11027. }
  11028. else if (direction === "bottom") {
  11029. direction = 'center';
  11030. // top=top+height/3*2
  11031. // height = height/3
  11032. }
  11033. else if (direction === "left") {
  11034. width = width / 3;
  11035. }
  11036. else if (direction === "right") {
  11037. left = left + width / 3 * 2;
  11038. width = width / 3;
  11039. }
  11040. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11041. this.$direction.css({
  11042. position: 'absolute',
  11043. top: top, left: left, width: width, height: height,
  11044. // border: '2px dashed #1890ff',
  11045. background: 'rgba(74,106,201,0.42)',
  11046. zIndex: 100,
  11047. });
  11048. this.$direction.appendTo(this.$overlay);
  11049. }
  11050. }
  11051. console.log("direction", direction);
  11052. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11053. // rect.x = position.x
  11054. // rect.y = position.y
  11055. // this.clearSelection()
  11056. // this.appendMaskbox(rect, args[1])
  11057. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11058. }
  11059. };
  11060. ViewDesign.prototype.onUndo = function () {
  11061. if (this.undoVjsonList.length > 0) {
  11062. if (this.redoVjsonList.length >= 100) {
  11063. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11064. }
  11065. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11066. this.vjson = this.undoVjsonList.pop();
  11067. // this.setVjson(this.vjson, "", false, "undo")
  11068. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11069. }
  11070. };
  11071. ViewDesign.prototype.onRedo = function () {
  11072. if (this.redoVjsonList.length > 0) {
  11073. if (this.undoVjsonList.length >= 100) {
  11074. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11075. }
  11076. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11077. this.vjson = this.redoVjsonList.pop();
  11078. // this.setVjson(this.vjson, "", false, "redo")
  11079. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11080. }
  11081. };
  11082. ViewDesign.prototype.onKeyPress = function (event) {
  11083. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11084. // if (this.backStep()) {
  11085. // event.stopPropagation()
  11086. // event.preventDefault()
  11087. // return
  11088. // }
  11089. // }
  11090. //
  11091. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11092. // if (this.recoverStep()) {
  11093. // event.stopPropagation()
  11094. // event.preventDefault()
  11095. // return
  11096. // }
  11097. // }
  11098. // if (event.key === 'ArrowUp') {
  11099. // if (this.selectParent()) {
  11100. // event.stopPropagation()
  11101. // event.preventDefault()
  11102. // return;
  11103. // }
  11104. // }
  11105. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11106. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11107. event.stopPropagation();
  11108. event.preventDefault();
  11109. return;
  11110. }
  11111. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11112. // if (this.copyView()) {
  11113. // event.stopPropagation()
  11114. // event.preventDefault()
  11115. // return;
  11116. // }
  11117. // }
  11118. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11119. // if (this.copyView(true)) {
  11120. // event.stopPropagation()
  11121. // event.preventDefault()
  11122. // return;
  11123. // }
  11124. // }
  11125. //
  11126. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11127. // if (this.selectRoot()) {
  11128. // event.stopPropagation()
  11129. // event.preventDefault()
  11130. // return;
  11131. // }
  11132. //
  11133. };
  11134. ViewDesign.prototype.onCopy = function (event) {
  11135. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11136. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11137. if (copyVjson) {
  11138. removeDesignProp(copyVjson);
  11139. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11140. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11141. }
  11142. }
  11143. };
  11144. ViewDesign.prototype.onPaste = function (event) {
  11145. debugger;
  11146. };
  11147. ViewDesign.prototype.onfocus = function () {
  11148. console.log("getCopy");
  11149. console.log("document.activeElement", document.activeElement.id);
  11150. // clearTimeout(this.getOuterCopyValueTimer);
  11151. // native.clipboardRead()
  11152. };
  11153. ViewDesign.prototype.onMousemove = function (event) {
  11154. var _a;
  11155. if (document.activeElement.id === this.$overlay[0].id) {
  11156. // console.log(event.clientX, event.clientY)
  11157. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11158. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11159. // this.iframeWindow.postMessage({
  11160. // method: 'overlayGetInfo',
  11161. // args: [position, this.moduleId]
  11162. // }, '*')
  11163. }
  11164. }
  11165. };
  11166. ViewDesign.prototype.onDestroy = function () {
  11167. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11168. for (var i = 0; i < this.subscribeList.length; i++) {
  11169. this.subscribeList[i].cancel();
  11170. }
  11171. };
  11172. // todo ======== 工具方法 ==========
  11173. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11174. if (relative === void 0) { relative = null; }
  11175. if (from === "main" && to === "overlay") {
  11176. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11177. var x = overlayRect.x;
  11178. var y = overlayRect.y;
  11179. if (relative) {
  11180. var relativeRect = relative.getBoundingClientRect();
  11181. console.log("main->", relativeRect.x, relativeRect.y);
  11182. x = x - relativeRect.x;
  11183. y = y - relativeRect.y;
  11184. }
  11185. pos.x = pos.x - x;
  11186. pos.y = pos.y - y;
  11187. }
  11188. else if (from === "overlay" && to === "main") {
  11189. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11190. var x = overlayRect.x;
  11191. var y = overlayRect.y;
  11192. if (relative) {
  11193. var relativeRect = relative.getBoundingClientRect();
  11194. console.log("iframe->", relativeRect.x, relativeRect.y);
  11195. x = x - relativeRect.x;
  11196. y = y - relativeRect.y;
  11197. }
  11198. pos.x = pos.x + x;
  11199. pos.y = pos.y + y;
  11200. }
  11201. return pos;
  11202. };
  11203. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11204. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11205. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11206. return "center";
  11207. }
  11208. // col-item 只能放左右
  11209. if (dragType === "col-item" || dragType === "") {
  11210. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11211. if (x > rect.x && x < rect.x + rect.width / 3) {
  11212. return "left";
  11213. }
  11214. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11215. return "right";
  11216. }
  11217. }
  11218. }
  11219. // cols-container 只能放上下
  11220. if (dragType === "cols-container" || dragType === "") {
  11221. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11222. if (y > rect.y && y < rect.y + rect.height / 3) {
  11223. return "top";
  11224. }
  11225. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11226. return "bottom";
  11227. }
  11228. }
  11229. }
  11230. return "";
  11231. };
  11232. return ViewDesign;
  11233. }());
  11234. //
  11235. //# sourceMappingURL=ViewDesign.js.map
  11236. var model$8 = {
  11237. data: {
  11238. iframeSrc: ''
  11239. }
  11240. };
  11241. //# sourceMappingURL=ModulePage.model.js.map
  11242. var vjson$8 = {
  11243. layout: 'fit',
  11244. border: false,
  11245. iconCls: 'x-fa fa-newspaper-o',
  11246. referenceHolder: true,
  11247. items: [
  11248. {
  11249. layout: 'border',
  11250. border: false,
  11251. items: [
  11252. {
  11253. region: 'center',
  11254. xtype: 'tabpanel',
  11255. border: false,
  11256. tabPosition: 'bottom',
  11257. reference: 'tabPanel',
  11258. listeners: {
  11259. tabchange: 'scope.tabchange'
  11260. },
  11261. defaults: {
  11262. border: false,
  11263. },
  11264. items: [
  11265. {
  11266. title: 'controller.js',
  11267. xtype: 'jseditor',
  11268. reference: 'controllerEditor',
  11269. },
  11270. {
  11271. title: 'view.design',
  11272. xtype: 'designer',
  11273. reference: 'designer',
  11274. listeners: {
  11275. afterrender: 'scope.previewRender'
  11276. },
  11277. },
  11278. {
  11279. title: 'view.js',
  11280. xtype: 'jseditor',
  11281. reference: 'viewEditor',
  11282. },
  11283. {
  11284. title: 'model.js',
  11285. xtype: 'jseditor',
  11286. reference: 'modelEditor',
  11287. },
  11288. {
  11289. title: 'groovy',
  11290. xtype: 'groovyeditor',
  11291. reference: 'groovyEditor',
  11292. },
  11293. {
  11294. title: 'SQL',
  11295. xtype: 'sqleditor',
  11296. reference: 'sqlEditor',
  11297. }
  11298. ]
  11299. }
  11300. ]
  11301. }
  11302. ]
  11303. };
  11304. //# sourceMappingURL=ModulePage.view.js.map
  11305. var ModulePage = /** @class */ (function (_super) {
  11306. __extends(ModulePage, _super);
  11307. function ModulePage(moduleId, module) {
  11308. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11309. _this.name = "ModulePage";
  11310. _this.viewDesign = null;
  11311. _this.maxViewId = 0;
  11312. _this.moduleEventBus = new EventBus();
  11313. _this.codeChange = _$2.debounce(function (code, from, e) {
  11314. try {
  11315. switch (from) {
  11316. case _this.refs.controllerEditor.name:
  11317. moduleStore.updateJsController(_this.moduleId, code, from);
  11318. break;
  11319. case _this.refs.viewEditor.name:
  11320. moduleStore.updateJsView(_this.moduleId, code, from);
  11321. break;
  11322. case _this.refs.modelEditor.name:
  11323. moduleStore.updateJsModel(_this.moduleId, code, from);
  11324. break;
  11325. case _this.refs.groovyEditor.name:
  11326. moduleStore.updateGroovy(_this.moduleId, code, from);
  11327. break;
  11328. case _this.refs.sqlEditor.name:
  11329. moduleStore.updateMybatis(_this.moduleId, code, from);
  11330. break;
  11331. }
  11332. }
  11333. catch (e) {
  11334. }
  11335. }, 500, { maxWait: 10000 });
  11336. _this.moduleId = moduleId;
  11337. _this.module = module;
  11338. _this.cancelSubscribe = [];
  11339. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11340. _this.initEditor(moduleItem);
  11341. }));
  11342. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11343. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11344. _this.previewReRender();
  11345. }));
  11346. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11347. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11348. _this.updateVjson(vjson, from, ignoreRenderUI);
  11349. }));
  11350. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11351. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11352. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11353. }));
  11354. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11355. var id = _a.id, from = _a.from;
  11356. _this.onComponentSelectionChange(id, from);
  11357. }));
  11358. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11359. _this.onUndo();
  11360. }));
  11361. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11362. _this.onRedo();
  11363. }));
  11364. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11365. _this.currentCopyVjson = stringToJsonObj(value);
  11366. }));
  11367. return _this;
  11368. }
  11369. ModulePage.prototype.onLoad = function () {
  11370. var _this = this;
  11371. // this.refs.preview.src = href
  11372. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11373. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11374. _this.saveCall();
  11375. }));
  11376. this.activeEditor = this.refs.controllerEditor;
  11377. this.refs.controllerEditor.modulePage = this;
  11378. this.refs.viewEditor.modulePage = this;
  11379. this.refs.modelEditor.modulePage = this;
  11380. this.refs.groovyEditor.modulePage = this;
  11381. this.refs.sqlEditor.modulePage = this;
  11382. this.refs.controllerEditor.name = "controllerEditor";
  11383. this.refs.viewEditor.name = "viewEditor";
  11384. this.refs.modelEditor.name = "modelEditor";
  11385. this.refs.groovyEditor.name = "groovyEditor";
  11386. this.refs.sqlEditor.name = "sqlEditor";
  11387. this.refs.controllerEditor.codeChange = this.codeChange;
  11388. this.refs.viewEditor.codeChange = this.codeChange;
  11389. this.refs.modelEditor.codeChange = this.codeChange;
  11390. this.refs.groovyEditor.codeChange = this.codeChange;
  11391. this.refs.sqlEditor.codeChange = this.codeChange;
  11392. };
  11393. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11394. if (!cmpVjson || from === this.name) {
  11395. return;
  11396. }
  11397. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11398. replaceVjsonById(vj, cmpVjson);
  11399. this.updateVjson(vj, from, ignoreRenderUI);
  11400. };
  11401. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11402. var _this = this;
  11403. var _a, _b;
  11404. if (!vjson || from === this.name) {
  11405. return;
  11406. }
  11407. this.addViewId(vjson);
  11408. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11409. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11410. (_a = this.refs.viewEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleStore.getModuleObject(this.moduleId).fileContent) === null || _b === void 0 ? void 0 : _b.jsView);
  11411. this.previewReRender();
  11412. _$2.defer(function () {
  11413. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11414. });
  11415. };
  11416. ModulePage.prototype.previewRender = function (sender) {
  11417. var _this = this;
  11418. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11419. if (!this.designScope) {
  11420. this.designScope = new Scope({
  11421. vjson: vjson,
  11422. model: {
  11423. data: {}
  11424. }
  11425. });
  11426. }
  11427. else {
  11428. this.designScope.vjson = vjson;
  11429. }
  11430. this.designScope.showDesigner(sender, {
  11431. moduleId: this.moduleId,
  11432. });
  11433. if (this.viewDesign) {
  11434. return;
  11435. }
  11436. _$2.defer(function () {
  11437. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11438. handles$1.mainWindow.setLoading(false);
  11439. });
  11440. };
  11441. ModulePage.prototype.previewReRender = function () {
  11442. var designer = this.refs.designer;
  11443. this.previewRender(designer);
  11444. };
  11445. ModulePage.prototype.initEditor = function (moduleItem) {
  11446. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11447. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11448. return;
  11449. (_a = this.refs.controllerEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _b === void 0 ? void 0 : _b.jsController);
  11450. (_c = this.refs.viewEditor) === null || _c === void 0 ? void 0 : _c.setCode((_d = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _d === void 0 ? void 0 : _d.jsView);
  11451. (_e = this.refs.modelEditor) === null || _e === void 0 ? void 0 : _e.setCode((_f = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _f === void 0 ? void 0 : _f.jsModel);
  11452. (_g = this.refs.groovyEditor) === null || _g === void 0 ? void 0 : _g.setCode((_h = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _h === void 0 ? void 0 : _h.groovy);
  11453. (_j = this.refs.sqlEditor) === null || _j === void 0 ? void 0 : _j.setCode((_k = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _k === void 0 ? void 0 : _k.mybatis);
  11454. };
  11455. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11456. this.currentComponentSelectId = id;
  11457. };
  11458. ModulePage.prototype.onUndo = function () {
  11459. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11460. this.viewDesign.onUndo();
  11461. }
  11462. };
  11463. ModulePage.prototype.onRedo = function () {
  11464. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11465. this.viewDesign.onRedo();
  11466. }
  11467. };
  11468. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11469. this.activeEditor = newCard;
  11470. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11471. };
  11472. ModulePage.prototype.saveCall = function () {
  11473. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11474. moduleStore.saveFile(this.moduleId, "jsView");
  11475. }
  11476. else if (this.activeEditor === this.refs.controllerEditor) {
  11477. moduleStore.saveFile(this.moduleId, "jsController");
  11478. }
  11479. else if (this.activeEditor === this.refs.modelEditor) {
  11480. moduleStore.saveFile(this.moduleId, "jsModel");
  11481. }
  11482. else if (this.activeEditor === this.refs.groovyEditor) {
  11483. moduleStore.saveFile(this.moduleId, "groovy");
  11484. }
  11485. else if (this.activeEditor === this.refs.sqlEditor) {
  11486. moduleStore.saveFile(this.moduleId, "mybatis");
  11487. }
  11488. };
  11489. ModulePage.prototype.check = function () {
  11490. moduleStore.check(this.moduleId);
  11491. };
  11492. /**
  11493. * 为vjson添加id
  11494. * @param vjson
  11495. * @param isAll
  11496. */
  11497. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11498. var _this = this;
  11499. if (isAll === void 0) { isAll = false; }
  11500. var maxIdTag = 0;
  11501. // 先提取当前的最大id
  11502. deepTravVJson(vjson, function (obj) {
  11503. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11504. return;
  11505. }
  11506. if (obj.id && obj.id.indexOf(idPrefix)) {
  11507. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11508. if (sutr.length > 0) {
  11509. var tid = sutr.replace(idPrefix, "");
  11510. var idNum = parseInt(tid);
  11511. if (idNum && maxIdTag < idNum) {
  11512. maxIdTag = idNum;
  11513. }
  11514. }
  11515. }
  11516. });
  11517. // 标记最大的id号,避免重复
  11518. this.maxViewId = maxIdTag;
  11519. deepTravVJson(vjson, function (obj) {
  11520. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11521. return;
  11522. }
  11523. if (!obj.hasOwnProperty('id')) {
  11524. obj.id = _this.createViewId();
  11525. }
  11526. if (!obj.hasOwnProperty('designMode')) {
  11527. obj.designMode = true;
  11528. }
  11529. // if (obj.xtype == "tabview" && obj.activeTab) {
  11530. // // 设置默认的选项
  11531. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11532. // if (typeof obj.activeTab === 'number') {
  11533. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11534. // } else if (typeof obj.activeTab === 'string') {
  11535. // this._tabViewSelect[obj.id] = obj.activeTab
  11536. // }
  11537. //
  11538. // }
  11539. // }
  11540. if (isAll && obj.hasOwnProperty("view")) ;
  11541. });
  11542. return vjson;
  11543. };
  11544. /**
  11545. * 为组件创建 ID
  11546. */
  11547. ModulePage.prototype.createViewId = function () {
  11548. this.maxViewId++;
  11549. return this.id + idPrefix + this.maxViewId;
  11550. };
  11551. ModulePage.prototype.onDestroy = function () {
  11552. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11553. this.cancelSubscribe[i].cancel();
  11554. }
  11555. _super.prototype.onDestroy.call(this);
  11556. };
  11557. return ModulePage;
  11558. }(Scope));
  11559. //# sourceMappingURL=ModulePage.js.map
  11560. var camundaModdleDescriptor = {
  11561. "name": "Camunda",
  11562. "uri": "http://camunda.org/schema/1.0/bpmn",
  11563. "prefix": "camunda",
  11564. "xml": {
  11565. "tagAlias": "lowerCase"
  11566. },
  11567. "associations": [],
  11568. "types": [
  11569. {
  11570. "name": "Definitions",
  11571. "isAbstract": true,
  11572. "extends": [
  11573. "bpmn:Definitions"
  11574. ],
  11575. "properties": [
  11576. {
  11577. "name": "diagramRelationId",
  11578. "isAttr": true,
  11579. "type": "String"
  11580. }
  11581. ]
  11582. },
  11583. {
  11584. "name": "InOutBinding",
  11585. "superClass": [
  11586. "Element"
  11587. ],
  11588. "isAbstract": true,
  11589. "properties": [
  11590. {
  11591. "name": "source",
  11592. "isAttr": true,
  11593. "type": "String"
  11594. },
  11595. {
  11596. "name": "sourceExpression",
  11597. "isAttr": true,
  11598. "type": "String"
  11599. },
  11600. {
  11601. "name": "target",
  11602. "isAttr": true,
  11603. "type": "String"
  11604. },
  11605. {
  11606. "name": "businessKey",
  11607. "isAttr": true,
  11608. "type": "String"
  11609. },
  11610. {
  11611. "name": "local",
  11612. "isAttr": true,
  11613. "type": "Boolean",
  11614. "default": false
  11615. },
  11616. {
  11617. "name": "variables",
  11618. "isAttr": true,
  11619. "type": "String"
  11620. }
  11621. ]
  11622. },
  11623. {
  11624. "name": "In",
  11625. "superClass": [
  11626. "InOutBinding"
  11627. ],
  11628. "meta": {
  11629. "allowedIn": [
  11630. "bpmn:CallActivity",
  11631. "bpmn:SignalEventDefinition"
  11632. ]
  11633. }
  11634. },
  11635. {
  11636. "name": "Out",
  11637. "superClass": [
  11638. "InOutBinding"
  11639. ],
  11640. "meta": {
  11641. "allowedIn": [
  11642. "bpmn:CallActivity"
  11643. ]
  11644. }
  11645. },
  11646. {
  11647. "name": "AsyncCapable",
  11648. "isAbstract": true,
  11649. "extends": [
  11650. "bpmn:Activity",
  11651. "bpmn:Gateway",
  11652. "bpmn:Event"
  11653. ],
  11654. "properties": [
  11655. {
  11656. "name": "async",
  11657. "isAttr": true,
  11658. "type": "Boolean",
  11659. "default": false
  11660. },
  11661. {
  11662. "name": "asyncBefore",
  11663. "isAttr": true,
  11664. "type": "Boolean",
  11665. "default": false
  11666. },
  11667. {
  11668. "name": "asyncAfter",
  11669. "isAttr": true,
  11670. "type": "Boolean",
  11671. "default": false
  11672. },
  11673. {
  11674. "name": "exclusive",
  11675. "isAttr": true,
  11676. "type": "Boolean",
  11677. "default": true
  11678. }
  11679. ]
  11680. },
  11681. {
  11682. "name": "JobPriorized",
  11683. "isAbstract": true,
  11684. "extends": [
  11685. "bpmn:Process",
  11686. "camunda:AsyncCapable"
  11687. ],
  11688. "properties": [
  11689. {
  11690. "name": "jobPriority",
  11691. "isAttr": true,
  11692. "type": "String"
  11693. }
  11694. ]
  11695. },
  11696. {
  11697. "name": "SignalEventDefinitionExtension",
  11698. "isAbstract": true,
  11699. "extends": [
  11700. "bpmn:SignalEventDefinition"
  11701. ],
  11702. "properties": [
  11703. {
  11704. "name": "async",
  11705. "isAttr": true,
  11706. "type": "Boolean",
  11707. "default": false
  11708. }
  11709. ]
  11710. },
  11711. {
  11712. "name": "ErrorEventDefinitionExtension",
  11713. "isAbstract": true,
  11714. "extends": [
  11715. "bpmn:ErrorEventDefinition"
  11716. ],
  11717. "properties": [
  11718. {
  11719. "name": "errorCodeVariable",
  11720. "isAttr": true,
  11721. "type": "String"
  11722. },
  11723. {
  11724. "name": "errorMessageVariable",
  11725. "isAttr": true,
  11726. "type": "String"
  11727. }
  11728. ]
  11729. },
  11730. {
  11731. "name": "ErrorEventDefinition",
  11732. "superClass": [
  11733. "bpmn:ErrorEventDefinition",
  11734. "Element"
  11735. ],
  11736. "properties": [
  11737. {
  11738. "name": "expression",
  11739. "isAttr": true,
  11740. "type": "String"
  11741. }
  11742. ],
  11743. "meta": {
  11744. "allowedIn": ["bpmn:ServiceTask"]
  11745. }
  11746. },
  11747. {
  11748. "name": "Error",
  11749. "isAbstract": true,
  11750. "extends": [
  11751. "bpmn:Error"
  11752. ],
  11753. "properties": [
  11754. {
  11755. "name": "camunda:errorMessage",
  11756. "isAttr": true,
  11757. "type": "String"
  11758. }
  11759. ]
  11760. },
  11761. {
  11762. "name": "PotentialStarter",
  11763. "superClass": [
  11764. "Element"
  11765. ],
  11766. "properties": [
  11767. {
  11768. "name": "resourceAssignmentExpression",
  11769. "type": "bpmn:ResourceAssignmentExpression"
  11770. }
  11771. ]
  11772. },
  11773. {
  11774. "name": "FormSupported",
  11775. "isAbstract": true,
  11776. "extends": [
  11777. "bpmn:StartEvent",
  11778. "bpmn:UserTask"
  11779. ],
  11780. "properties": [
  11781. {
  11782. "name": "formHandlerClass",
  11783. "isAttr": true,
  11784. "type": "String"
  11785. },
  11786. {
  11787. "name": "formKey",
  11788. "isAttr": true,
  11789. "type": "String"
  11790. },
  11791. {
  11792. "name": "formRef",
  11793. "isAttr": true,
  11794. "type": "String"
  11795. },
  11796. {
  11797. "name": "formRefBinding",
  11798. "isAttr": true,
  11799. "type": "String"
  11800. },
  11801. {
  11802. "name": "formRefVersion",
  11803. "isAttr": true,
  11804. "type": "String"
  11805. }
  11806. ]
  11807. },
  11808. {
  11809. "name": "TemplateSupported",
  11810. "isAbstract": true,
  11811. "extends": [
  11812. "bpmn:Collaboration",
  11813. "bpmn:Process",
  11814. "bpmn:FlowElement"
  11815. ],
  11816. "properties": [
  11817. {
  11818. "name": "modelerTemplate",
  11819. "isAttr": true,
  11820. "type": "String"
  11821. },
  11822. {
  11823. "name": "modelerTemplateVersion",
  11824. "isAttr": true,
  11825. "type": "Integer"
  11826. }
  11827. ]
  11828. },
  11829. {
  11830. "name": "Initiator",
  11831. "isAbstract": true,
  11832. "extends": ["bpmn:StartEvent"],
  11833. "properties": [
  11834. {
  11835. "name": "initiator",
  11836. "isAttr": true,
  11837. "type": "String"
  11838. }
  11839. ]
  11840. },
  11841. {
  11842. "name": "ScriptTask",
  11843. "isAbstract": true,
  11844. "extends": [
  11845. "bpmn:ScriptTask"
  11846. ],
  11847. "properties": [
  11848. {
  11849. "name": "resultVariable",
  11850. "isAttr": true,
  11851. "type": "String"
  11852. },
  11853. {
  11854. "name": "resource",
  11855. "isAttr": true,
  11856. "type": "String"
  11857. }
  11858. ]
  11859. },
  11860. {
  11861. "name": "Process",
  11862. "isAbstract": true,
  11863. "extends": [
  11864. "bpmn:Process"
  11865. ],
  11866. "properties": [
  11867. {
  11868. "name": "candidateStarterGroups",
  11869. "isAttr": true,
  11870. "type": "String"
  11871. },
  11872. {
  11873. "name": "candidateStarterUsers",
  11874. "isAttr": true,
  11875. "type": "String"
  11876. },
  11877. {
  11878. "name": "versionTag",
  11879. "isAttr": true,
  11880. "type": "String"
  11881. },
  11882. {
  11883. "name": "historyTimeToLive",
  11884. "isAttr": true,
  11885. "type": "String"
  11886. },
  11887. {
  11888. "name": "isStartableInTasklist",
  11889. "isAttr": true,
  11890. "type": "Boolean",
  11891. "default": true
  11892. }
  11893. ]
  11894. },
  11895. {
  11896. "name": "EscalationEventDefinitionExtension",
  11897. "isAbstract": true,
  11898. "extends": [
  11899. "bpmn:EscalationEventDefinition"
  11900. ],
  11901. "properties": [
  11902. {
  11903. "name": "escalationCodeVariable",
  11904. "isAttr": true,
  11905. "type": "String"
  11906. }
  11907. ]
  11908. },
  11909. {
  11910. "name": "FormalExpression",
  11911. "isAbstract": true,
  11912. "extends": [
  11913. "bpmn:FormalExpression"
  11914. ],
  11915. "properties": [
  11916. {
  11917. "name": "resource",
  11918. "isAttr": true,
  11919. "type": "String"
  11920. }
  11921. ]
  11922. },
  11923. {
  11924. "name": "Assignable",
  11925. "extends": ["bpmn:UserTask"],
  11926. "properties": [
  11927. {
  11928. "name": "assignee",
  11929. "isAttr": true,
  11930. "type": "String"
  11931. },
  11932. {
  11933. "name": "candidateUsers",
  11934. "isAttr": true,
  11935. "type": "String"
  11936. },
  11937. {
  11938. "name": "candidateGroups",
  11939. "isAttr": true,
  11940. "type": "String"
  11941. },
  11942. {
  11943. "name": "dueDate",
  11944. "isAttr": true,
  11945. "type": "String"
  11946. },
  11947. {
  11948. "name": "followUpDate",
  11949. "isAttr": true,
  11950. "type": "String"
  11951. },
  11952. {
  11953. "name": "priority",
  11954. "isAttr": true,
  11955. "type": "String"
  11956. }
  11957. ]
  11958. },
  11959. {
  11960. "name": "CallActivity",
  11961. "extends": ["bpmn:CallActivity"],
  11962. "properties": [
  11963. {
  11964. "name": "calledElementBinding",
  11965. "isAttr": true,
  11966. "type": "String",
  11967. "default": "latest"
  11968. },
  11969. {
  11970. "name": "calledElementVersion",
  11971. "isAttr": true,
  11972. "type": "String"
  11973. },
  11974. {
  11975. "name": "calledElementVersionTag",
  11976. "isAttr": true,
  11977. "type": "String"
  11978. },
  11979. {
  11980. "name": "calledElementTenantId",
  11981. "isAttr": true,
  11982. "type": "String"
  11983. },
  11984. {
  11985. "name": "caseRef",
  11986. "isAttr": true,
  11987. "type": "String"
  11988. },
  11989. {
  11990. "name": "caseBinding",
  11991. "isAttr": true,
  11992. "type": "String",
  11993. "default": "latest"
  11994. },
  11995. {
  11996. "name": "caseVersion",
  11997. "isAttr": true,
  11998. "type": "String"
  11999. },
  12000. {
  12001. "name": "caseTenantId",
  12002. "isAttr": true,
  12003. "type": "String"
  12004. },
  12005. {
  12006. "name": "variableMappingClass",
  12007. "isAttr": true,
  12008. "type": "String"
  12009. },
  12010. {
  12011. "name": "variableMappingDelegateExpression",
  12012. "isAttr": true,
  12013. "type": "String"
  12014. }
  12015. ]
  12016. },
  12017. {
  12018. "name": "ServiceTaskLike",
  12019. "extends": [
  12020. "bpmn:ServiceTask",
  12021. "bpmn:BusinessRuleTask",
  12022. "bpmn:SendTask",
  12023. "bpmn:MessageEventDefinition"
  12024. ],
  12025. "properties": [
  12026. {
  12027. "name": "expression",
  12028. "isAttr": true,
  12029. "type": "String"
  12030. },
  12031. {
  12032. "name": "class",
  12033. "isAttr": true,
  12034. "type": "String"
  12035. },
  12036. {
  12037. "name": "delegateExpression",
  12038. "isAttr": true,
  12039. "type": "String"
  12040. },
  12041. {
  12042. "name": "resultVariable",
  12043. "isAttr": true,
  12044. "type": "String"
  12045. }
  12046. ]
  12047. },
  12048. {
  12049. "name": "DmnCapable",
  12050. "extends": [
  12051. "bpmn:BusinessRuleTask"
  12052. ],
  12053. "properties": [
  12054. {
  12055. "name": "decisionRef",
  12056. "isAttr": true,
  12057. "type": "String"
  12058. },
  12059. {
  12060. "name": "decisionRefBinding",
  12061. "isAttr": true,
  12062. "type": "String",
  12063. "default": "latest"
  12064. },
  12065. {
  12066. "name": "decisionRefVersion",
  12067. "isAttr": true,
  12068. "type": "String"
  12069. },
  12070. {
  12071. "name": "mapDecisionResult",
  12072. "isAttr": true,
  12073. "type": "String",
  12074. "default": "resultList"
  12075. },
  12076. {
  12077. "name": "decisionRefTenantId",
  12078. "isAttr": true,
  12079. "type": "String"
  12080. }
  12081. ]
  12082. },
  12083. {
  12084. "name": "ExternalCapable",
  12085. "extends": [
  12086. "camunda:ServiceTaskLike"
  12087. ],
  12088. "properties": [
  12089. {
  12090. "name": "type",
  12091. "isAttr": true,
  12092. "type": "String"
  12093. },
  12094. {
  12095. "name": "topic",
  12096. "isAttr": true,
  12097. "type": "String"
  12098. }
  12099. ]
  12100. },
  12101. {
  12102. "name": "TaskPriorized",
  12103. "extends": [
  12104. "bpmn:Process",
  12105. "camunda:ExternalCapable"
  12106. ],
  12107. "properties": [
  12108. {
  12109. "name": "taskPriority",
  12110. "isAttr": true,
  12111. "type": "String"
  12112. }
  12113. ]
  12114. },
  12115. {
  12116. "name": "Properties",
  12117. "superClass": [
  12118. "Element"
  12119. ],
  12120. "meta": {
  12121. "allowedIn": ["*"]
  12122. },
  12123. "properties": [
  12124. {
  12125. "name": "values",
  12126. "type": "Property",
  12127. "isMany": true
  12128. }
  12129. ]
  12130. },
  12131. {
  12132. "name": "Property",
  12133. "superClass": [
  12134. "Element"
  12135. ],
  12136. "properties": [
  12137. {
  12138. "name": "id",
  12139. "type": "String",
  12140. "isAttr": true
  12141. },
  12142. {
  12143. "name": "name",
  12144. "type": "String",
  12145. "isAttr": true
  12146. },
  12147. {
  12148. "name": "value",
  12149. "type": "String",
  12150. "isAttr": true
  12151. }
  12152. ]
  12153. },
  12154. {
  12155. "name": "Connector",
  12156. "superClass": [
  12157. "Element"
  12158. ],
  12159. "meta": {
  12160. "allowedIn": [
  12161. "camunda:ServiceTaskLike"
  12162. ]
  12163. },
  12164. "properties": [
  12165. {
  12166. "name": "inputOutput",
  12167. "type": "InputOutput"
  12168. },
  12169. {
  12170. "name": "connectorId",
  12171. "type": "String"
  12172. }
  12173. ]
  12174. },
  12175. {
  12176. "name": "InputOutput",
  12177. "superClass": [
  12178. "Element"
  12179. ],
  12180. "meta": {
  12181. "allowedIn": [
  12182. "bpmn:FlowNode",
  12183. "camunda:Connector"
  12184. ]
  12185. },
  12186. "properties": [
  12187. {
  12188. "name": "inputOutput",
  12189. "type": "InputOutput"
  12190. },
  12191. {
  12192. "name": "connectorId",
  12193. "type": "String"
  12194. },
  12195. {
  12196. "name": "inputParameters",
  12197. "isMany": true,
  12198. "type": "InputParameter"
  12199. },
  12200. {
  12201. "name": "outputParameters",
  12202. "isMany": true,
  12203. "type": "OutputParameter"
  12204. }
  12205. ]
  12206. },
  12207. {
  12208. "name": "InputOutputParameter",
  12209. "properties": [
  12210. {
  12211. "name": "name",
  12212. "isAttr": true,
  12213. "type": "String"
  12214. },
  12215. {
  12216. "name": "value",
  12217. "isBody": true,
  12218. "type": "String"
  12219. },
  12220. {
  12221. "name": "definition",
  12222. "type": "InputOutputParameterDefinition"
  12223. }
  12224. ]
  12225. },
  12226. {
  12227. "name": "InputOutputParameterDefinition",
  12228. "isAbstract": true
  12229. },
  12230. {
  12231. "name": "List",
  12232. "superClass": ["InputOutputParameterDefinition"],
  12233. "properties": [
  12234. {
  12235. "name": "items",
  12236. "isMany": true,
  12237. "type": "InputOutputParameterDefinition"
  12238. }
  12239. ]
  12240. },
  12241. {
  12242. "name": "Map",
  12243. "superClass": ["InputOutputParameterDefinition"],
  12244. "properties": [
  12245. {
  12246. "name": "entries",
  12247. "isMany": true,
  12248. "type": "Entry"
  12249. }
  12250. ]
  12251. },
  12252. {
  12253. "name": "Entry",
  12254. "properties": [
  12255. {
  12256. "name": "key",
  12257. "isAttr": true,
  12258. "type": "String"
  12259. },
  12260. {
  12261. "name": "value",
  12262. "isBody": true,
  12263. "type": "String"
  12264. },
  12265. {
  12266. "name": "definition",
  12267. "type": "InputOutputParameterDefinition"
  12268. }
  12269. ]
  12270. },
  12271. {
  12272. "name": "Value",
  12273. "superClass": [
  12274. "InputOutputParameterDefinition"
  12275. ],
  12276. "properties": [
  12277. {
  12278. "name": "id",
  12279. "isAttr": true,
  12280. "type": "String"
  12281. },
  12282. {
  12283. "name": "name",
  12284. "isAttr": true,
  12285. "type": "String"
  12286. },
  12287. {
  12288. "name": "value",
  12289. "isBody": true,
  12290. "type": "String"
  12291. }
  12292. ]
  12293. },
  12294. {
  12295. "name": "Script",
  12296. "superClass": ["InputOutputParameterDefinition"],
  12297. "properties": [
  12298. {
  12299. "name": "scriptFormat",
  12300. "isAttr": true,
  12301. "type": "String"
  12302. },
  12303. {
  12304. "name": "resource",
  12305. "isAttr": true,
  12306. "type": "String"
  12307. },
  12308. {
  12309. "name": "value",
  12310. "isBody": true,
  12311. "type": "String"
  12312. }
  12313. ]
  12314. },
  12315. {
  12316. "name": "Field",
  12317. "superClass": ["Element"],
  12318. "meta": {
  12319. "allowedIn": [
  12320. "camunda:ServiceTaskLike",
  12321. "camunda:ExecutionListener",
  12322. "camunda:TaskListener"
  12323. ]
  12324. },
  12325. "properties": [
  12326. {
  12327. "name": "name",
  12328. "isAttr": true,
  12329. "type": "String"
  12330. },
  12331. {
  12332. "name": "expression",
  12333. "type": "String"
  12334. },
  12335. {
  12336. "name": "stringValue",
  12337. "isAttr": true,
  12338. "type": "String"
  12339. },
  12340. {
  12341. "name": "string",
  12342. "type": "String"
  12343. }
  12344. ]
  12345. },
  12346. {
  12347. "name": "InputParameter",
  12348. "superClass": ["InputOutputParameter"]
  12349. },
  12350. {
  12351. "name": "OutputParameter",
  12352. "superClass": ["InputOutputParameter"]
  12353. },
  12354. {
  12355. "name": "Collectable",
  12356. "isAbstract": true,
  12357. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12358. "superClass": ["camunda:AsyncCapable"],
  12359. "properties": [
  12360. {
  12361. "name": "collection",
  12362. "isAttr": true,
  12363. "type": "String"
  12364. },
  12365. {
  12366. "name": "elementVariable",
  12367. "isAttr": true,
  12368. "type": "String"
  12369. }
  12370. ]
  12371. },
  12372. {
  12373. "name": "FailedJobRetryTimeCycle",
  12374. "superClass": ["Element"],
  12375. "meta": {
  12376. "allowedIn": [
  12377. "camunda:AsyncCapable",
  12378. "bpmn:MultiInstanceLoopCharacteristics"
  12379. ]
  12380. },
  12381. "properties": [
  12382. {
  12383. "name": "body",
  12384. "isBody": true,
  12385. "type": "String"
  12386. }
  12387. ]
  12388. },
  12389. {
  12390. "name": "ExecutionListener",
  12391. "superClass": ["Element"],
  12392. "meta": {
  12393. "allowedIn": [
  12394. "bpmn:Task",
  12395. "bpmn:ServiceTask",
  12396. "bpmn:UserTask",
  12397. "bpmn:BusinessRuleTask",
  12398. "bpmn:ScriptTask",
  12399. "bpmn:ReceiveTask",
  12400. "bpmn:ManualTask",
  12401. "bpmn:ExclusiveGateway",
  12402. "bpmn:SequenceFlow",
  12403. "bpmn:ParallelGateway",
  12404. "bpmn:InclusiveGateway",
  12405. "bpmn:EventBasedGateway",
  12406. "bpmn:StartEvent",
  12407. "bpmn:IntermediateCatchEvent",
  12408. "bpmn:IntermediateThrowEvent",
  12409. "bpmn:EndEvent",
  12410. "bpmn:BoundaryEvent",
  12411. "bpmn:CallActivity",
  12412. "bpmn:SubProcess",
  12413. "bpmn:Process"
  12414. ]
  12415. },
  12416. "properties": [
  12417. {
  12418. "name": "expression",
  12419. "isAttr": true,
  12420. "type": "String"
  12421. },
  12422. {
  12423. "name": "class",
  12424. "isAttr": true,
  12425. "type": "String"
  12426. },
  12427. {
  12428. "name": "delegateExpression",
  12429. "isAttr": true,
  12430. "type": "String"
  12431. },
  12432. {
  12433. "name": "event",
  12434. "isAttr": true,
  12435. "type": "String"
  12436. },
  12437. {
  12438. "name": "script",
  12439. "type": "Script"
  12440. },
  12441. {
  12442. "name": "fields",
  12443. "type": "Field",
  12444. "isMany": true
  12445. }
  12446. ]
  12447. },
  12448. {
  12449. "name": "TaskListener",
  12450. "superClass": ["Element"],
  12451. "meta": {
  12452. "allowedIn": [
  12453. "bpmn:UserTask"
  12454. ]
  12455. },
  12456. "properties": [
  12457. {
  12458. "name": "expression",
  12459. "isAttr": true,
  12460. "type": "String"
  12461. },
  12462. {
  12463. "name": "class",
  12464. "isAttr": true,
  12465. "type": "String"
  12466. },
  12467. {
  12468. "name": "delegateExpression",
  12469. "isAttr": true,
  12470. "type": "String"
  12471. },
  12472. {
  12473. "name": "event",
  12474. "isAttr": true,
  12475. "type": "String"
  12476. },
  12477. {
  12478. "name": "script",
  12479. "type": "Script"
  12480. },
  12481. {
  12482. "name": "fields",
  12483. "type": "Field",
  12484. "isMany": true
  12485. },
  12486. {
  12487. "name": "id",
  12488. "type": "String",
  12489. "isAttr": true
  12490. },
  12491. {
  12492. "name": "eventDefinitions",
  12493. "type": "bpmn:TimerEventDefinition",
  12494. "isMany": true
  12495. }
  12496. ]
  12497. },
  12498. {
  12499. "name": "FormProperty",
  12500. "superClass": ["Element"],
  12501. "meta": {
  12502. "allowedIn": [
  12503. "bpmn:StartEvent",
  12504. "bpmn:UserTask"
  12505. ]
  12506. },
  12507. "properties": [
  12508. {
  12509. "name": "id",
  12510. "type": "String",
  12511. "isAttr": true
  12512. },
  12513. {
  12514. "name": "name",
  12515. "type": "String",
  12516. "isAttr": true
  12517. },
  12518. {
  12519. "name": "type",
  12520. "type": "String",
  12521. "isAttr": true
  12522. },
  12523. {
  12524. "name": "required",
  12525. "type": "String",
  12526. "isAttr": true
  12527. },
  12528. {
  12529. "name": "readable",
  12530. "type": "String",
  12531. "isAttr": true
  12532. },
  12533. {
  12534. "name": "writable",
  12535. "type": "String",
  12536. "isAttr": true
  12537. },
  12538. {
  12539. "name": "variable",
  12540. "type": "String",
  12541. "isAttr": true
  12542. },
  12543. {
  12544. "name": "expression",
  12545. "type": "String",
  12546. "isAttr": true
  12547. },
  12548. {
  12549. "name": "datePattern",
  12550. "type": "String",
  12551. "isAttr": true
  12552. },
  12553. {
  12554. "name": "default",
  12555. "type": "String",
  12556. "isAttr": true
  12557. },
  12558. {
  12559. "name": "values",
  12560. "type": "Value",
  12561. "isMany": true
  12562. }
  12563. ]
  12564. },
  12565. {
  12566. "name": "FormData",
  12567. "superClass": ["Element"],
  12568. "meta": {
  12569. "allowedIn": [
  12570. "bpmn:StartEvent",
  12571. "bpmn:UserTask"
  12572. ]
  12573. },
  12574. "properties": [
  12575. {
  12576. "name": "fields",
  12577. "type": "FormField",
  12578. "isMany": true
  12579. },
  12580. {
  12581. "name": "businessKey",
  12582. "type": "String",
  12583. "isAttr": true
  12584. }
  12585. ]
  12586. },
  12587. {
  12588. "name": "FormField",
  12589. "superClass": ["Element"],
  12590. "properties": [
  12591. {
  12592. "name": "id",
  12593. "type": "String",
  12594. "isAttr": true
  12595. },
  12596. {
  12597. "name": "label",
  12598. "type": "String",
  12599. "isAttr": true
  12600. },
  12601. {
  12602. "name": "type",
  12603. "type": "String",
  12604. "isAttr": true
  12605. },
  12606. {
  12607. "name": "datePattern",
  12608. "type": "String",
  12609. "isAttr": true
  12610. },
  12611. {
  12612. "name": "defaultValue",
  12613. "type": "String",
  12614. "isAttr": true
  12615. },
  12616. {
  12617. "name": "properties",
  12618. "type": "Properties"
  12619. },
  12620. {
  12621. "name": "validation",
  12622. "type": "Validation"
  12623. },
  12624. {
  12625. "name": "values",
  12626. "type": "Value",
  12627. "isMany": true
  12628. }
  12629. ]
  12630. },
  12631. {
  12632. "name": "Validation",
  12633. "superClass": ["Element"],
  12634. "properties": [
  12635. {
  12636. "name": "constraints",
  12637. "type": "Constraint",
  12638. "isMany": true
  12639. }
  12640. ]
  12641. },
  12642. {
  12643. "name": "Constraint",
  12644. "superClass": ["Element"],
  12645. "properties": [
  12646. {
  12647. "name": "name",
  12648. "type": "String",
  12649. "isAttr": true
  12650. },
  12651. {
  12652. "name": "config",
  12653. "type": "String",
  12654. "isAttr": true
  12655. }
  12656. ]
  12657. },
  12658. {
  12659. "name": "ConditionalEventDefinitionExtension",
  12660. "isAbstract": true,
  12661. "extends": [
  12662. "bpmn:ConditionalEventDefinition"
  12663. ],
  12664. "properties": [
  12665. {
  12666. "name": "variableName",
  12667. "isAttr": true,
  12668. "type": "String"
  12669. },
  12670. {
  12671. "name": "variableEvents",
  12672. "isAttr": true,
  12673. "type": "String"
  12674. }
  12675. ]
  12676. }
  12677. ],
  12678. "emumerations": []
  12679. };
  12680. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12681. /**
  12682. * This is a sample file that should be replaced with the actual translation.
  12683. *
  12684. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12685. * translations and labels to translate.
  12686. */
  12687. var translations = {
  12688. // Labels
  12689. 'Activate the global connect tool': '激活全局连接工具',
  12690. 'Append {type}': '追加 {type}',
  12691. 'Append EndEvent': '追加 结束事件 ',
  12692. 'Append Task': '追加 任务',
  12693. 'Append Gateway': '追加 网关',
  12694. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12695. 'Add Lane above': '在上面添加道',
  12696. 'Divide into two Lanes': '分割成两个道',
  12697. 'Divide into three Lanes': '分割成三个道',
  12698. 'Add Lane below': '在下面添加道',
  12699. 'Append compensation activity': '追加补偿活动',
  12700. 'Change type': '修改类型',
  12701. 'Connect using Association': '使用关联连接',
  12702. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12703. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12704. 'Remove': '移除',
  12705. 'Activate the hand tool': '激活抓手工具',
  12706. 'Activate the lasso tool': '激活套索工具',
  12707. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12708. 'Create expanded SubProcess': '创建扩展子过程',
  12709. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12710. 'Create Pool/Participant': '创建池/参与者',
  12711. 'Parallel Multi Instance': '并行多重事件',
  12712. 'Sequential Multi Instance': '时序多重事件',
  12713. 'DataObjectReference': '数据对象参考',
  12714. 'DataStoreReference': '数据存储参考',
  12715. 'Loop': '循环',
  12716. 'Ad-hoc': '即席',
  12717. 'Create {type}': '创建 {type}',
  12718. 'Create Task': '创建任务',
  12719. 'Create StartEvent': '创建开始事件',
  12720. 'Create EndEvent': '创建结束事件',
  12721. 'Create Group': '创建组',
  12722. 'Task': '任务',
  12723. 'Send Task': '发送任务',
  12724. 'Receive Task': '接收任务',
  12725. 'User Task': '用户任务',
  12726. 'Manual Task': '手工任务',
  12727. 'Business Rule Task': '业务规则任务',
  12728. 'Service Task': '服务任务',
  12729. 'Script Task': '脚本任务',
  12730. 'Call Activity': '调用活动',
  12731. 'Sub Process (collapsed)': '子流程(折叠的)',
  12732. 'Sub Process (expanded)': '子流程(展开的)',
  12733. 'Start Event': '开始事件',
  12734. 'StartEvent': '开始事件',
  12735. 'Intermediate Throw Event': '中间事件',
  12736. 'End Event': '结束事件',
  12737. 'EndEvent': '结束事件',
  12738. 'Create Gateway': '创建网关',
  12739. 'GateWay': '网关',
  12740. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12741. 'Message Start Event': '消息开始事件',
  12742. 'Timer Start Event': '定时开始事件',
  12743. 'Conditional Start Event': '条件开始事件',
  12744. 'Signal Start Event': '信号开始事件',
  12745. 'Error Start Event': '错误开始事件',
  12746. 'Escalation Start Event': '升级开始事件',
  12747. 'Compensation Start Event': '补偿开始事件',
  12748. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12749. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12750. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12751. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12752. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12753. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12754. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12755. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12756. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12757. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12758. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12759. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12760. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12761. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12762. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12763. 'Message End Event': '消息结束事件',
  12764. 'Escalation End Event': '定时结束事件',
  12765. 'Error End Event': '错误结束事件',
  12766. 'Cancel End Event': '取消结束事件',
  12767. 'Compensation End Event': '补偿结束事件',
  12768. 'Signal End Event': '信号结束事件',
  12769. 'Terminate End Event': '终止结束事件',
  12770. 'Message Boundary Event': '消息边界事件',
  12771. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12772. 'Timer Boundary Event': '定时边界事件',
  12773. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12774. 'Escalation Boundary Event': '升级边界事件',
  12775. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12776. 'Conditional Boundary Event': '条件边界事件',
  12777. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12778. 'Error Boundary Event': '错误边界事件',
  12779. 'Cancel Boundary Event': '取消边界事件',
  12780. 'Signal Boundary Event': '信号边界事件',
  12781. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12782. 'Compensation Boundary Event': '补偿边界事件',
  12783. 'Exclusive Gateway': '互斥网关',
  12784. 'Parallel Gateway': '并行网关',
  12785. 'Inclusive Gateway': '相容网关',
  12786. 'Complex Gateway': '复杂网关',
  12787. 'Event based Gateway': '事件网关',
  12788. 'Transaction': '转运',
  12789. 'Sub Process': '子流程',
  12790. 'Event Sub Process': '事件子流程',
  12791. 'Collapsed Pool': '折叠池',
  12792. 'Expanded Pool': '展开池',
  12793. // Errors
  12794. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12795. 'no shape type specified': '没有指定的形状类型',
  12796. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12797. 'out of bounds release': 'out of bounds release',
  12798. 'more than {count} child lanes': '子道大于{count} ',
  12799. 'element required': '元素不能为空',
  12800. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12801. 'no diagram to display': '没有可展示的流程图',
  12802. 'no process or collaboration to display': '没有可展示的流程/协作',
  12803. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12804. 'already rendered {element}': '{element} 已被渲染',
  12805. 'failed to import {element}': '导入{element}失败',
  12806. // 属性面板的参数
  12807. 'Id': '编号',
  12808. 'Name': '名称',
  12809. 'General': '常规',
  12810. 'Details': '详情',
  12811. 'Message Name': '消息名称',
  12812. 'Message': '消息',
  12813. 'Initiator': '创建者',
  12814. 'Asynchronous Continuations': '持续异步',
  12815. 'Asynchronous Before': '异步前',
  12816. 'Asynchronous After': '异步后',
  12817. 'Job Configuration': '工作配置',
  12818. 'Exclusive': '排除',
  12819. 'Job Priority': '工作优先级',
  12820. 'Retry Time Cycle': '重试时间周期',
  12821. 'Documentation': '文档',
  12822. 'Element Documentation': '元素文档',
  12823. 'History Configuration': '历史配置',
  12824. 'History Time To Live': '历史的生存时间',
  12825. 'Forms': '表单',
  12826. 'Form Key': '表单key',
  12827. 'Form Fields': '表单字段',
  12828. 'Business Key': '业务key',
  12829. 'Form Field': '表单字段',
  12830. 'ID': '编号',
  12831. 'Type': '类型',
  12832. 'Label': '名称',
  12833. 'Default Value': '默认值',
  12834. 'Validation': '校验',
  12835. 'Add Constraint': '添加约束',
  12836. 'Config': '配置',
  12837. 'Properties': '属性',
  12838. 'Add Property': '添加属性',
  12839. 'Value': '值',
  12840. 'Add': '添加',
  12841. 'Values': '值',
  12842. 'Add Value': '添加值',
  12843. 'Listeners': '监听器',
  12844. 'Execution Listener': '执行监听',
  12845. 'Event Type': '事件类型',
  12846. 'Listener Type': '监听器类型',
  12847. 'Java Class': 'Java类',
  12848. 'Expression': '表达式',
  12849. 'Must provide a value': '必须提供一个值',
  12850. 'Delegate Expression': '代理表达式',
  12851. 'Script': '脚本',
  12852. 'Script Format': '脚本格式',
  12853. 'Script Type': '脚本类型',
  12854. 'Inline Script': '内联脚本',
  12855. 'External Script': '外部脚本',
  12856. 'Resource': '资源',
  12857. 'Field Injection': '字段注入',
  12858. 'Extensions': '扩展',
  12859. 'Input/Output': '输入/输出',
  12860. 'Input Parameters': '输入参数',
  12861. 'Output Parameters': '输出参数',
  12862. 'Parameters': '参数',
  12863. 'Output Parameter': '输出参数',
  12864. 'Timer Definition Type': '定时器定义类型',
  12865. 'Timer Definition': '定时器定义',
  12866. 'Date': '日期',
  12867. 'Duration': '持续',
  12868. 'Cycle': '循环',
  12869. 'Signal': '信号',
  12870. 'Signal Name': '信号名称',
  12871. 'Escalation': '升级',
  12872. 'Error': '错误',
  12873. 'Link Name': '链接名称',
  12874. 'Condition': '条件名称',
  12875. 'Variable Name': '变量名称',
  12876. 'Variable Event': '变量事件',
  12877. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12878. 'Wait for Completion': '等待完成',
  12879. 'Activity Ref': '活动参考',
  12880. 'Version Tag': '版本标签',
  12881. 'Executable': '可执行文件',
  12882. 'External Task Configuration': '扩展任务配置',
  12883. 'Task Priority': '任务优先级',
  12884. 'External': '外部',
  12885. 'Connector': '连接器',
  12886. 'Must configure Connector': '必须配置连接器',
  12887. 'Connector Id': '连接器编号',
  12888. 'Implementation': '实现方式',
  12889. 'Field Injections': '字段注入',
  12890. 'Fields': '字段',
  12891. 'Result Variable': '结果变量',
  12892. 'Topic': '主题',
  12893. 'Configure Connector': '配置连接器',
  12894. 'Input Parameter': '输入参数',
  12895. 'Assignee': '代理人',
  12896. 'Candidate Users': '候选用户',
  12897. 'Candidate Groups': '候选组',
  12898. 'Due Date': '到期时间',
  12899. 'Follow Up Date': '跟踪日期',
  12900. 'Priority': '优先级',
  12901. // eslint-disable-next-line no-template-curly-in-string
  12902. 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
  12903. // eslint-disable-next-line no-template-curly-in-string
  12904. 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
  12905. 'Variables': '变量',
  12906. 'Candidate Starter Configuration': '候选开始配置',
  12907. 'Task Listener': '任务监听器',
  12908. 'Candidate Starter Groups': '候选开始组',
  12909. 'Candidate Starter Users': '候选开始用户',
  12910. 'Tasklist Configuration': '任务列表配置',
  12911. 'Startable': '启动',
  12912. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12913. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12914. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12915. 'CallActivity Type': '调用活动类型',
  12916. 'Condition Type': '条件类型',
  12917. 'Create UserTask': '创建用户任务',
  12918. 'Create CallActivity': '创建调用活动',
  12919. 'Called Element': '调用元素',
  12920. 'Create DataObjectReference': '创建数据对象引用',
  12921. 'Create DataStoreReference': '创建数据存储引用',
  12922. 'Multi Instance': '多实例',
  12923. 'Loop Cardinality': '实例数量',
  12924. Collection: '任务参与人列表',
  12925. 'Element Variable': '元素变量',
  12926. 'Completion Condition': '完成条件'
  12927. };
  12928. //# sourceMappingURL=translations.js.map
  12929. function customTranslate(template, replacements) {
  12930. replacements = replacements || {};
  12931. // Translate
  12932. template = translations[template] || template;
  12933. // Replace
  12934. return template.replace(/{([^}]+)}/g, function (_, key) {
  12935. return replacements[key] || '{' + key + '}';
  12936. });
  12937. }
  12938. //# sourceMappingURL=customTranslate.js.map
  12939. var vjson$9 = {
  12940. title: '导入流程',
  12941. layout: 'fit',
  12942. width: 400,
  12943. height: 400,
  12944. items: [
  12945. {
  12946. layout: 'border',
  12947. items: [
  12948. {
  12949. xtype: 'form',
  12950. items: [
  12951. // {
  12952. // xtype: 'cols',
  12953. // items: [
  12954. // {
  12955. // xtype: 'textfield',
  12956. // allowBlank: false,
  12957. // fieldLabel: '流程名称',
  12958. // bind: '{name}'
  12959. // },
  12960. // ],
  12961. // },
  12962. {
  12963. xtype: 'cols',
  12964. items: [
  12965. {
  12966. xtype: 'filefield',
  12967. name: 'deployFile',
  12968. fieldLabel: '文件名称',
  12969. // labelWidth: '100%',
  12970. msgTarget: 'side',
  12971. reference: 'MOBANB_FILE',
  12972. fileUpload: true,
  12973. allowBlank: false,
  12974. // flex: 1,
  12975. // width: '100%',
  12976. buttonText: '请选择文件位置',
  12977. listeners: {
  12978. change: 'scope.fileChange'
  12979. }
  12980. // bind: '{FILE}'
  12981. },
  12982. ]
  12983. }
  12984. ],
  12985. region: 'center',
  12986. split: true,
  12987. },
  12988. ],
  12989. },
  12990. ],
  12991. fbar: {
  12992. xtype: 'toolbar',
  12993. items: [
  12994. {
  12995. xtype: 'button',
  12996. text: '保存',
  12997. iconCls: 'x-fa fa-save',
  12998. listeners: {
  12999. click: 'scope.save',
  13000. },
  13001. }
  13002. ],
  13003. },
  13004. };
  13005. //# sourceMappingURL=ImportBpmn.view.js.map
  13006. var model$9 = {
  13007. data: {
  13008. name: '',
  13009. file_content: ''
  13010. }
  13011. };
  13012. //# sourceMappingURL=ImportBpmn.model.js.map
  13013. var ImportBpmn = /** @class */ (function (_super) {
  13014. __extends(ImportBpmn, _super);
  13015. function ImportBpmn() {
  13016. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  13017. }
  13018. ImportBpmn.prototype.onLoad = function () {
  13019. };
  13020. ImportBpmn.prototype.save = function (sender) {
  13021. if (this.data.file_content) {
  13022. this.dialogSuccess(this.data);
  13023. }
  13024. else {
  13025. Ext.Msg.alert('提示', "请先上传文件");
  13026. }
  13027. };
  13028. ImportBpmn.prototype.fileChange = function (e) {
  13029. var _this = this;
  13030. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  13031. var file = e.fileInputEl.dom.files[0]; //获取文件
  13032. var reader = new FileReader();
  13033. reader.readAsText(file, "UTF-8");
  13034. reader.onload = function () {
  13035. _this.data.file_content = reader.result;
  13036. };
  13037. };
  13038. return ImportBpmn;
  13039. }(Scope));
  13040. //# sourceMappingURL=ImportBpmn.js.map
  13041. var model$a = {
  13042. data: {
  13043. form_id: '',
  13044. form_name: '',
  13045. save_dir_path: '',
  13046. absolute_path: '',
  13047. form: {
  13048. id: '',
  13049. code: '',
  13050. name: '',
  13051. table: '',
  13052. controller: '',
  13053. groovy: '',
  13054. fields: [],
  13055. buttons: [],
  13056. },
  13057. }
  13058. };
  13059. //# sourceMappingURL=ConfigStrategy.model.js.map
  13060. var vjson$a = {
  13061. title: '配置适配策略',
  13062. layout: 'fit',
  13063. items: [
  13064. {
  13065. layout: 'border',
  13066. items: [
  13067. {
  13068. region: 'center',
  13069. xtype: 'yvgrid',
  13070. pagination: false,
  13071. hideFootbar: true,
  13072. plugins: {
  13073. clipboard: true,
  13074. selectionreplicator: true
  13075. },
  13076. tbar: {
  13077. xtype: 'toolbar',
  13078. items: [
  13079. {
  13080. xtype: 'button',
  13081. text: '添加策略',
  13082. iconCls: 'x-fa fa-plus-circle',
  13083. listeners: {
  13084. click: 'scope.addStrategy'
  13085. }
  13086. },
  13087. {
  13088. xtype: 'button',
  13089. text: '删除',
  13090. iconCls: 'x-fa fa-minus-circle',
  13091. listeners: {}
  13092. },
  13093. '-',
  13094. {
  13095. xtype: 'button',
  13096. text: '上移',
  13097. iconCls: 'x-fa fa-arrow-up',
  13098. listeners: {}
  13099. },
  13100. {
  13101. xtype: 'button',
  13102. text: '下移',
  13103. iconCls: 'x-fa fa-arrow-down',
  13104. listeners: {}
  13105. },
  13106. ]
  13107. },
  13108. columns: [
  13109. { xtype: 'rownumberer' },
  13110. {
  13111. header: '优先级',
  13112. dataIndex: 'priority',
  13113. width: 140,
  13114. sortable: false,
  13115. menuDisabled: true,
  13116. editor: {
  13117. selectOnFocus: true
  13118. },
  13119. },
  13120. {
  13121. header: '策略编号',
  13122. dataIndex: 'strategy_code',
  13123. width: 140,
  13124. sortable: false,
  13125. menuDisabled: true,
  13126. editor: {
  13127. selectOnFocus: true
  13128. },
  13129. },
  13130. {
  13131. header: '策略名称',
  13132. dataIndex: 'strategy_name',
  13133. width: 140,
  13134. sortable: false,
  13135. menuDisabled: true,
  13136. editor: {
  13137. selectOnFocus: true
  13138. },
  13139. },
  13140. {
  13141. header: "条件表达式",
  13142. dataIndex: "strategy_exp",
  13143. },
  13144. ],
  13145. },
  13146. {
  13147. title: '适配条件',
  13148. region: 'south',
  13149. height: '50%',
  13150. xtype: 'form',
  13151. items: [
  13152. {
  13153. xtype: 'cols',
  13154. items: [
  13155. {
  13156. xtype: 'rows',
  13157. items: [
  13158. {
  13159. xtype: 'textfield',
  13160. fieldLabel: "仓库",
  13161. },
  13162. {
  13163. xtype: 'textfield',
  13164. fieldLabel: "货主",
  13165. },
  13166. {
  13167. xtype: 'textfield',
  13168. fieldLabel: "项目",
  13169. },
  13170. {
  13171. xtype: 'textfield',
  13172. fieldLabel: "行政区划",
  13173. },
  13174. {
  13175. xtype: 'textfield',
  13176. fieldLabel: "客户",
  13177. },
  13178. {
  13179. xtype: 'textfield',
  13180. fieldLabel: "商品",
  13181. }
  13182. ]
  13183. },
  13184. {
  13185. xtype: 'rows',
  13186. margin: '8 0 0 10',
  13187. items: [
  13188. {
  13189. xtype: 'label',
  13190. html: '自定义表达式',
  13191. },
  13192. {
  13193. xtype: 'textarea',
  13194. }
  13195. ]
  13196. }
  13197. ]
  13198. }
  13199. ]
  13200. }
  13201. ]
  13202. }
  13203. ]
  13204. };
  13205. //
  13206. //# sourceMappingURL=ConfigStrategy.view.js.map
  13207. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13208. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13209. // import ReportRunner from "./ReportRunner";
  13210. var ConfigStrategy = /** @class */ (function (_super) {
  13211. __extends(ConfigStrategy, _super);
  13212. function ConfigStrategy() {
  13213. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13214. }
  13215. ConfigStrategy.prototype.onLoad = function () {
  13216. this.load();
  13217. };
  13218. ConfigStrategy.prototype.load = function () {
  13219. var _this = this;
  13220. var form_id = this.viewModel.get("form_id");
  13221. var absolute_path = this.viewModel.get("absolute_path");
  13222. var save_dir_path = this.viewModel.get("save_dir_path");
  13223. if (absolute_path && form_id) {
  13224. this.setLoading(true);
  13225. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13226. if (res.success) {
  13227. // 基础属性
  13228. _this.viewModel.set('form', res.data.form);
  13229. // 字段定义
  13230. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13231. // 按钮
  13232. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13233. }
  13234. }).finally(function () {
  13235. _this.setLoading(false);
  13236. });
  13237. }
  13238. };
  13239. ConfigStrategy.prototype.saveAll = function () {
  13240. var _this = this;
  13241. var save_dir_path = this.viewModel.get("save_dir_path");
  13242. if (!save_dir_path) {
  13243. msg("save_dir_path error");
  13244. return;
  13245. }
  13246. var form_id = this.viewModel.get("form_id");
  13247. var absolute_path = this.viewModel.get("absolute_path");
  13248. // 表格校验
  13249. if (!this.refs.form1.isValid()) {
  13250. msg("请检查表单必填项!");
  13251. return;
  13252. }
  13253. // 字段数据
  13254. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13255. delete item.id;
  13256. if (item.hide) {
  13257. delete item.hide_text;
  13258. }
  13259. else {
  13260. item.hide = item.hide_text;
  13261. delete item.hide_text;
  13262. }
  13263. if (item.readonly) {
  13264. delete item.readonly_text;
  13265. }
  13266. else {
  13267. item.readonly = item.readonly_text;
  13268. delete item.readonly_text;
  13269. }
  13270. if (item.disabled) {
  13271. delete item.disabled_text;
  13272. }
  13273. else {
  13274. item.disabled = item.disabled_text;
  13275. delete item.disabled_text;
  13276. }
  13277. if (item.required) {
  13278. delete item.required_text;
  13279. }
  13280. else {
  13281. item.required = item.required_text;
  13282. delete item.required_text;
  13283. }
  13284. return item;
  13285. });
  13286. this.viewModel.set("form.fields", gridColumnRows);
  13287. // 按钮数据
  13288. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13289. delete item.id;
  13290. return item;
  13291. });
  13292. this.viewModel.set("form.buttons", gridBtnRows);
  13293. // 查询条件
  13294. // 策略
  13295. var form = this.viewModel.get("form");
  13296. this.setLoading(true);
  13297. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13298. if (res.success) {
  13299. msg('保存成功');
  13300. handles$1.mainWindow.refs['exporerTree'].reload();
  13301. }
  13302. }).finally(function () {
  13303. _this.setLoading(false);
  13304. });
  13305. };
  13306. ConfigStrategy.prototype.addColumn = function () {
  13307. this.refs.gridColumn.getStore().add({});
  13308. };
  13309. ConfigStrategy.prototype.removeColumn = function () {
  13310. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13311. };
  13312. ConfigStrategy.prototype.calcColumn = function (sender) {
  13313. var _this = this;
  13314. var table = this.viewModel.get("form.table");
  13315. if (!table) {
  13316. msg("表名不存在!");
  13317. return;
  13318. }
  13319. this.setLoading(true);
  13320. calcColumnForm({ table: table }).then(function (res) {
  13321. if (res.success) {
  13322. msg(res.msg);
  13323. if (res.data.columns.length > 0) {
  13324. _$2.forEach(res.data.columns, function (it) {
  13325. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13326. });
  13327. }
  13328. }
  13329. }).finally(function () {
  13330. _this.setLoading(false);
  13331. });
  13332. };
  13333. ConfigStrategy.prototype.addButton = function () {
  13334. this.refs.gridButton.getStore().add({});
  13335. };
  13336. ConfigStrategy.prototype.moveUp = function (sender) {
  13337. var grid = sender.up('grid');
  13338. grid.rowMoveUp();
  13339. };
  13340. ConfigStrategy.prototype.moveDown = function (sender) {
  13341. var grid = sender.up('grid');
  13342. grid.rowMoveDown();
  13343. };
  13344. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13345. var win = new Ext.Window({
  13346. autoDestroy: true,
  13347. title: "添加(编辑)策略",
  13348. width: 400,
  13349. height: 300,
  13350. resizable: true,
  13351. closable: true,
  13352. maximizable: true,
  13353. minimizable: true,
  13354. plain: true,
  13355. // constrainHeader: true,
  13356. constrain: true,
  13357. layout: 'fit',
  13358. animateTarget: sender,
  13359. buttonAlign: 'center',
  13360. items: [
  13361. {
  13362. xtype: "form",
  13363. layout: "hbox",
  13364. margin: '10px 20px',
  13365. border: 0,
  13366. items: [
  13367. {
  13368. flex: 1,
  13369. layout: 'vbox',
  13370. items: [
  13371. {
  13372. xtype: "numberfield",
  13373. fieldLabel: "优先级",
  13374. flex: 1,
  13375. allowBlank: false,
  13376. labelWidth: 50,
  13377. width: "100%",
  13378. },
  13379. {
  13380. xtype: "textfield",
  13381. fieldLabel: "策略名称",
  13382. flex: 1,
  13383. allowBlank: false,
  13384. labelWidth: 50,
  13385. width: "100%",
  13386. },
  13387. {
  13388. xtype: "textfield",
  13389. fieldLabel: "策略编号",
  13390. flex: 1,
  13391. allowBlank: false,
  13392. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13393. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13394. labelWidth: 50,
  13395. width: "100%",
  13396. },
  13397. {
  13398. xtype: "textfield",
  13399. fieldLabel: "仓库ID",
  13400. flex: 1,
  13401. allowBlank: false,
  13402. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13403. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13404. labelWidth: 50,
  13405. width: "100%",
  13406. },
  13407. ]
  13408. },
  13409. ]
  13410. }
  13411. ],
  13412. //窗口按钮
  13413. buttons: [
  13414. {
  13415. xtype: 'button', text: '保存', handler: function (btn) {
  13416. //窗口获取表单
  13417. var form = win.down('form');
  13418. var vaildSuccess = form.isValid();
  13419. if (!vaildSuccess) {
  13420. return;
  13421. }
  13422. var filename = form.down('textfield[name="filename"]').getValue();
  13423. }
  13424. },
  13425. {
  13426. xtype: 'button', text: '取消', handler: function (btn) {
  13427. //窗口关闭
  13428. win.close();
  13429. }
  13430. }
  13431. ]
  13432. });
  13433. win.show();
  13434. };
  13435. return ConfigStrategy;
  13436. }(Scope));
  13437. //# sourceMappingURL=ConfigStrategy.js.map
  13438. var buildVjson = function () {
  13439. return {
  13440. bind: {
  13441. title: '流程编辑-{text}',
  13442. },
  13443. layout: 'fit',
  13444. items: [{
  13445. layout: 'border',
  13446. tbar: {
  13447. xtype: 'toolbar',
  13448. items: [
  13449. {
  13450. xtype: 'button',
  13451. text: '撤销',
  13452. listeners: {
  13453. click: "scope.undo"
  13454. }
  13455. },
  13456. {
  13457. xtype: 'button',
  13458. text: '还原',
  13459. listeners: {
  13460. click: "scope.redo"
  13461. }
  13462. },
  13463. {
  13464. xtype: 'button',
  13465. text: '保存',
  13466. listeners: {
  13467. click: "scope.save"
  13468. }
  13469. },
  13470. {
  13471. xtype: 'button',
  13472. text: '导入BPM',
  13473. listeners: {
  13474. click: "scope.importBpm"
  13475. }
  13476. },
  13477. {
  13478. xtype: 'button',
  13479. text: '配置适配策略',
  13480. listeners: {
  13481. click: "scope.configStrategy"
  13482. }
  13483. },
  13484. {
  13485. fieldLabel: '选择配置分支',
  13486. xtype: 'combogrid',
  13487. },
  13488. ]
  13489. },
  13490. items: [
  13491. {
  13492. xtype: "panel",
  13493. region: 'center',
  13494. reference: "bpmn_view",
  13495. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13496. },
  13497. {
  13498. split: true,
  13499. xtype: "panel",
  13500. region: 'east',
  13501. width: '30%',
  13502. reference: "bpmn_properties",
  13503. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13504. }
  13505. ],
  13506. }],
  13507. listeners: {
  13508. afterrender: 'scope.onViewRender'
  13509. }
  13510. };
  13511. };
  13512. var BpmnDesign = /** @class */ (function (_super) {
  13513. __extends(BpmnDesign, _super);
  13514. function BpmnDesign() {
  13515. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13516. _this.bpmnModeler = null;
  13517. _this.bpmnModelerName = "";
  13518. return _this;
  13519. }
  13520. BpmnDesign.prototype.onLoad = function () {
  13521. var _this = this;
  13522. _super.prototype.onLoad.call(this);
  13523. this.setLoading(true);
  13524. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13525. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13526. if (res && res.success && res.data && res.data.bpmn) {
  13527. var diagramXML = res.data.bpmn;
  13528. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13529. var elements = _this.bpmnModeler._definitions.rootElements;
  13530. if (Array.isArray(elements) && elements.length > 0) {
  13531. elements[0].name = _this.bpmnModelerName;
  13532. }
  13533. }).catch(function (err) {
  13534. msgError(err);
  13535. });
  13536. }
  13537. else {
  13538. msgError(res.msg);
  13539. }
  13540. }).finally(function () {
  13541. _this.setLoading(false);
  13542. });
  13543. };
  13544. BpmnDesign.prototype.onViewRender = function (sender) {
  13545. var customTranslateModule = {
  13546. translate: ['value', customTranslate]
  13547. };
  13548. this.bpmnModeler = new BpmnModeler({
  13549. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13550. propertiesPanel: {
  13551. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13552. },
  13553. additionalModules: [
  13554. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13555. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13556. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13557. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13558. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13559. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13560. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13561. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13562. customTranslateModule,
  13563. ],
  13564. moddleExtensions: {
  13565. camunda: camundaModdleDescriptor
  13566. },
  13567. keyboard: { bindTo: document } // 使用键盘快捷键
  13568. });
  13569. };
  13570. //开启快捷键
  13571. //modeler.get('keyboard').bind(document);
  13572. //关闭快捷键
  13573. //modeler.get('keyboard').unbind();
  13574. BpmnDesign.prototype.undo = function (sender) {
  13575. this.bpmnModeler.get('commandStack').undo();
  13576. };
  13577. BpmnDesign.prototype.redo = function (sender) {
  13578. this.bpmnModeler.get('commandStack').redo();
  13579. };
  13580. BpmnDesign.prototype.save = function (sender) {
  13581. var _this = this;
  13582. this.setLoading(true);
  13583. this.bpmnModeler.saveXML().then(function (resBpm) {
  13584. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13585. if (res.success) {
  13586. msg$1("保存成功");
  13587. }
  13588. else {
  13589. msgError(res.msg);
  13590. }
  13591. }).catch(function (e) {
  13592. var _a, _b;
  13593. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13594. msgError(msg);
  13595. }).finally(function () {
  13596. _this.setLoading(false);
  13597. });
  13598. }).catch(function (e) {
  13599. msgError(e);
  13600. _this.setLoading(false);
  13601. });
  13602. };
  13603. BpmnDesign.prototype.importBpm = function (sender) {
  13604. var _this = this;
  13605. var dlg = new ImportBpmn();
  13606. //@ts-ignore
  13607. dlg.success = function (sen, data) {
  13608. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13609. var elements = _this.bpmnModeler._definitions.rootElements;
  13610. if (Array.isArray(elements) && elements.length > 0) {
  13611. elements[0].name = _this.bpmnModelerName;
  13612. }
  13613. }).catch(function (err) {
  13614. msgError(err);
  13615. });
  13616. };
  13617. dlg.showDialog(sender, {}, {});
  13618. // this.bpmnModeler.importXML()
  13619. };
  13620. BpmnDesign.prototype.configStrategy = function (sender) {
  13621. var configStrategy = new ConfigStrategy();
  13622. configStrategy.showDialog(sender, {}, {});
  13623. };
  13624. return BpmnDesign;
  13625. }(Scope));
  13626. //# sourceMappingURL=BpmnDesign.js.map
  13627. var model$b = {
  13628. data: {
  13629. id: '',
  13630. path: '',
  13631. form: {
  13632. title: '',
  13633. sqlId: '',
  13634. }
  13635. }
  13636. };
  13637. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13638. var vjson$b = {
  13639. bind: {
  13640. title: '{title}',
  13641. },
  13642. layout: 'fit',
  13643. items: [
  13644. {
  13645. layout: 'border',
  13646. items: [
  13647. {
  13648. region: 'center',
  13649. reference: 'editor',
  13650. border: true,
  13651. // html: '<div class="geEditor"></div>',
  13652. // listeners: {
  13653. // afterrender: 'scope.editorInit'
  13654. // }
  13655. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13656. listeners: {
  13657. afterrender: 'scope.iframeRender'
  13658. }
  13659. },
  13660. ]
  13661. }
  13662. ]
  13663. }; //
  13664. //
  13665. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13666. var WidgetDesign$1 = /** @class */ (function (_super) {
  13667. __extends(WidgetDesign, _super);
  13668. function WidgetDesign(layoutCode, layoutName) {
  13669. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13670. _this.layoutCode = layoutCode;
  13671. _this.layoutName = layoutName;
  13672. return _this;
  13673. }
  13674. WidgetDesign.prototype.onLoad = function () {
  13675. this.viewModel.set('layoutCode', this.layoutCode);
  13676. this.viewModel.set('layoutName', this.layoutName);
  13677. if (this.layoutCode) {
  13678. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13679. }
  13680. else {
  13681. this.viewModel.set('title', '新建图纸');
  13682. }
  13683. };
  13684. WidgetDesign.prototype.reload = function () {
  13685. var _this = this;
  13686. this.setLoading(true);
  13687. loadWhLayout({
  13688. layoutCode: this.layoutCode,
  13689. layoutName: this.layoutName,
  13690. }).then(function (res) {
  13691. if (res.success) {
  13692. var xml = res.data.layoutContent;
  13693. var doc = _this.mxUtils.parseXml(xml);
  13694. var graph = _this.editorUi.editor.graph;
  13695. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13696. }
  13697. }).finally(function () {
  13698. _this.setLoading(false);
  13699. });
  13700. };
  13701. WidgetDesign.prototype.editorInit = function (sender) {
  13702. var that = this;
  13703. var dom = $(sender.el.dom).find('.geEditor')[0];
  13704. //@ts-ignore
  13705. require(['mxgraph'], function () {
  13706. var editorUiInit = EditorUi.prototype.init;
  13707. EditorUi.prototype.init = function () {
  13708. editorUiInit.apply(this, arguments);
  13709. this.actions.get('save').funct = that.onFileSave.bind(that);
  13710. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13711. this.actions.get('open').visible = false;
  13712. this.actions.get('new').visible = false;
  13713. this.actions.get('preview').visible = false;
  13714. this.actions.get('print').visible = false;
  13715. this.actions.get('pageSetup').visible = false;
  13716. this.actions.get('help').visible = false;
  13717. this.actions.get('export').visible = false;
  13718. this.actions.get('about').visible = false;
  13719. this.menus.menus.help.setEnabled(false);
  13720. that.editorUi = this;
  13721. if (that.layoutCode) {
  13722. that.reload();
  13723. }
  13724. };
  13725. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13726. var mxLanguage = 'zh';
  13727. mxResources.loadDefaultBundle = false;
  13728. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13729. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13730. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13731. // Fixes possible asynchronous requests
  13732. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13733. // Adds bundle text to resources
  13734. mxResources.parse(xhr[0].getText());
  13735. // Configures the default graph theme
  13736. var themes = new Object();
  13737. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13738. // Main
  13739. new EditorUi(new Editor(false, themes), dom);
  13740. }, function () {
  13741. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13742. });
  13743. });
  13744. };
  13745. WidgetDesign.prototype.iframeRender = function (sender) {
  13746. var that = this;
  13747. var iframe = $(sender.el.dom).find('iframe')[0];
  13748. iframe.contentWindow['designer'] = that;
  13749. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13750. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13751. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13752. editorUi.actions.get('open').visible = false;
  13753. editorUi.actions.get('new').visible = false;
  13754. editorUi.actions.get('preview').visible = false;
  13755. editorUi.actions.get('print').visible = false;
  13756. editorUi.actions.get('pageSetup').visible = false;
  13757. editorUi.actions.get('help').visible = false;
  13758. editorUi.actions.get('export').visible = false;
  13759. editorUi.actions.get('about').visible = false;
  13760. editorUi.menus.menus.help.setEnabled(false);
  13761. that.editorUi = editorUi;
  13762. that.mxUtils = iframe.contentWindow['mxUtils'];
  13763. if (that.layoutCode) {
  13764. that.reload();
  13765. }
  13766. };
  13767. };
  13768. WidgetDesign.prototype.onDestroy = function () {
  13769. var _a;
  13770. try {
  13771. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13772. }
  13773. catch (e) {
  13774. }
  13775. };
  13776. WidgetDesign.prototype.onFileSaveAs = function () {
  13777. var _this = this;
  13778. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13779. .then(function (_a) {
  13780. var code = _a.code, name = _a.name;
  13781. _this.layoutCode = code;
  13782. _this.layoutName = name;
  13783. _this.onSave();
  13784. });
  13785. };
  13786. WidgetDesign.prototype.onSave = function () {
  13787. var _this = this;
  13788. var layoutContent = this.editorUi.getEditBlankXml();
  13789. var layoutCode = this.layoutCode;
  13790. var layoutName = this.layoutName;
  13791. if (!layoutCode || !layoutName) {
  13792. msg$1('图形编号和图形名称必填');
  13793. return;
  13794. }
  13795. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13796. this.setLoading(true);
  13797. saveWhLayout({
  13798. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13799. }).then(function (res) {
  13800. msg$1(res.msg);
  13801. handles$1.whLayout.reload();
  13802. }).finally(function () {
  13803. _this.setLoading(false);
  13804. });
  13805. };
  13806. WidgetDesign.prototype.onFileSave = function () {
  13807. if (!this.layoutCode || !this.layoutName) {
  13808. this.onFileSaveAs();
  13809. }
  13810. else {
  13811. this.onSave();
  13812. }
  13813. };
  13814. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13815. var code = _a.code, name = _a.name;
  13816. return new Promise(function (resolve, reject) {
  13817. var viewModel = new Ext.app.ViewModel({
  13818. data: {
  13819. code: code !== null && code !== void 0 ? code : '',
  13820. name: name !== null && name !== void 0 ? name : '',
  13821. }
  13822. });
  13823. var dlg = Ext.create('Ext.window.Window', {
  13824. title: '保存',
  13825. viewModel: viewModel,
  13826. layout: {
  13827. type: "vbox",
  13828. pack: "start",
  13829. align: "stretch"
  13830. },
  13831. items: [
  13832. {
  13833. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13834. bind: '{code}'
  13835. },
  13836. {
  13837. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13838. bind: '{name}'
  13839. }
  13840. ],
  13841. fbar: [
  13842. {
  13843. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13844. click: function () {
  13845. var code = viewModel.get('code');
  13846. var name = viewModel.get('name');
  13847. resolve({ code: code, name: name });
  13848. dlg.close();
  13849. }
  13850. }
  13851. },
  13852. {
  13853. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13854. click: function () {
  13855. dlg.close();
  13856. }
  13857. }
  13858. },
  13859. ]
  13860. });
  13861. dlg.show();
  13862. });
  13863. };
  13864. return WidgetDesign;
  13865. }(Scope));
  13866. //# sourceMappingURL=WhLayoutDesign.js.map
  13867. // init()
  13868. var Workbench = /** @class */ (function (_super) {
  13869. __extends(Workbench, _super);
  13870. // activeModulePage: ModulePage = null
  13871. function Workbench() {
  13872. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13873. _this.name = "MainWindow";
  13874. _this.modules = [];
  13875. _this.yvgridDesign = null;
  13876. return _this;
  13877. }
  13878. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13879. if (newCard) {
  13880. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13881. }
  13882. else {
  13883. this.viewModel.set('leftTabTitle', '未选中');
  13884. }
  13885. };
  13886. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13887. get: function () {
  13888. var _a;
  13889. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13890. },
  13891. enumerable: true,
  13892. configurable: true
  13893. });
  13894. Workbench.prototype.documentKeydown = function (event) {
  13895. if (event.ctrlKey || event.metaKey) {
  13896. if (event.key.toLowerCase() === 's') {
  13897. eventBus.publish(EventType.SaveCall, {});
  13898. event.stopPropagation();
  13899. event.preventDefault();
  13900. }
  13901. else if (event.key.toLowerCase() === 'z') {
  13902. if (event.shiftKey) {
  13903. eventBus.publish(EventType.Redo, {});
  13904. event.stopPropagation();
  13905. event.preventDefault();
  13906. }
  13907. else {
  13908. eventBus.publish(EventType.Undo, {});
  13909. event.stopPropagation();
  13910. event.preventDefault();
  13911. }
  13912. }
  13913. }
  13914. };
  13915. Workbench.prototype.onLoad = function () {
  13916. var _this = this;
  13917. window["tt"] = this.refs['tt'];
  13918. window["vm"] = this.viewModel;
  13919. $('#loading').remove();
  13920. setMainWindow(this);
  13921. setStatusbar(this.down('statusbar'));
  13922. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13923. var currentProject = getCurrentProject();
  13924. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13925. // handles.fileTree.reload()
  13926. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13927. _this.showModule(rawData);
  13928. });
  13929. eventBus.subscribe(EventType.Undo, function () {
  13930. _this.onUndo();
  13931. });
  13932. eventBus.subscribe(EventType.Redo, function () {
  13933. _this.onRedo();
  13934. });
  13935. eventBus.subscribe(EventType.Cut, function (_a) {
  13936. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13937. _this.onCut(a, b, c, d);
  13938. });
  13939. eventBus.subscribe(EventType.Copy, function (_a) {
  13940. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13941. _this.onCopy(a, b, c, d);
  13942. });
  13943. eventBus.subscribe(EventType.Paste, function (_a) {
  13944. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13945. _this.onPaste(a, b, c, d);
  13946. });
  13947. eventBus.subscribe(EventType.SelectAll, function () {
  13948. _this.onSelectAll();
  13949. });
  13950. eventBus.subscribe(EventType.SelectAll, function () {
  13951. _this.onSelectAll();
  13952. });
  13953. eventBus.subscribe(EventType.RunCheckModule, function () {
  13954. _this.runCheckModule();
  13955. });
  13956. eventBus.subscribe(EventType.StopCheckModule, function () {
  13957. _this.stopCheckModule();
  13958. });
  13959. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13960. _this.onCompoentContextMenu(args);
  13961. });
  13962. this.runCheckModule();
  13963. };
  13964. Workbench.prototype.onCompoentContextMenu = function (args) {
  13965. var _this = this;
  13966. if (!this.yvgridDesign) {
  13967. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13968. this.yvgridDesign.showDialog(null, {}, {});
  13969. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13970. this.yvgridDesign.onDestroy = function () {
  13971. fn_1();
  13972. _this.yvgridDesign = null;
  13973. };
  13974. }
  13975. };
  13976. Workbench.prototype.runCheckModule = function () {
  13977. var _this = this;
  13978. if (this.checkTimer) {
  13979. return;
  13980. }
  13981. this.checkTimer = setInterval(function () {
  13982. var _a;
  13983. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13984. _this.activeModulePage.check();
  13985. }
  13986. }, 5000);
  13987. };
  13988. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13989. var dlg = new WidgetDesign(widgetPath, widgetName);
  13990. dlg.showPage({
  13991. id: 'widget_' + widgetPath,
  13992. path: 'widget_' + widgetPath,
  13993. }, {
  13994. data: {
  13995. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13996. }
  13997. });
  13998. dlg.dialogSuccess = successCallback;
  13999. };
  14000. Workbench.prototype.stopCheckModule = function () {
  14001. clearInterval(this.checkTimer);
  14002. this.checkTimer = null;
  14003. };
  14004. Workbench.prototype.showDataSync = function () {
  14005. var ins = new DbSync();
  14006. ins.showPage({
  14007. id: 'db_sync__',
  14008. path: 'db_sync__',
  14009. }, {
  14010. data: {}
  14011. });
  14012. };
  14013. /**
  14014. * 打开一个项目
  14015. */
  14016. Workbench.prototype.openProject = function (project) {
  14017. setCurrentProject(project);
  14018. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  14019. handles$1.fileTree.reload();
  14020. };
  14021. /**
  14022. * 打开模板开发面板
  14023. */
  14024. Workbench.prototype.showTemplateDev = function () {
  14025. var ins = new TemplateDev();
  14026. ins.showPage({
  14027. id: 'template_dev__',
  14028. path: 'template_dev__',
  14029. }, {
  14030. data: {}
  14031. });
  14032. };
  14033. Workbench.prototype.openScope = function () {
  14034. };
  14035. /**
  14036. * 显示字段域管理器
  14037. */
  14038. Workbench.prototype.showColumnDomain = function () {
  14039. var instance = new DbDomain();
  14040. instance.showPage({
  14041. id: 'domain__',
  14042. path: 'domain__',
  14043. }, {
  14044. data: {}
  14045. });
  14046. };
  14047. /**
  14048. * 显示性能统计
  14049. */
  14050. Workbench.prototype.showPerform = function () {
  14051. // const instance = new PerformStats()
  14052. // instance.showPage({
  14053. // id: 'perform__',
  14054. // path: 'perform__',
  14055. //
  14056. // }, {
  14057. // data: {}
  14058. // })
  14059. };
  14060. /**
  14061. * 显示数据库代码模板库
  14062. */
  14063. Workbench.prototype.showDbCodeTemplate = function () {
  14064. // const instance = new DbCodeTemplate()
  14065. // instance.showPage({
  14066. // id: 'dbcode__',
  14067. // path: 'dbcode__',
  14068. //
  14069. // }, {
  14070. // data: {}
  14071. // })
  14072. };
  14073. /**
  14074. * 显示数据库代码模板库
  14075. */
  14076. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14077. var instance = new ReportDesign();
  14078. instance.showPage({
  14079. id: 'report_' + report_id,
  14080. path: 'report_' + report_id,
  14081. }, {
  14082. data: {
  14083. report_id: report_id,
  14084. report_name: report_name,
  14085. }
  14086. });
  14087. instance.dialogSuccess = success;
  14088. };
  14089. /**
  14090. * 显示报表
  14091. */
  14092. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14093. instance.showPage({
  14094. id: 'REPORT__' + report_id,
  14095. path: 'REPORT__' + report_id,
  14096. }, {
  14097. data: {
  14098. report_id: report_id,
  14099. }
  14100. });
  14101. var reportName = instance.viewModel.get('report_name');
  14102. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14103. };
  14104. /**
  14105. * 显示运维页面
  14106. */
  14107. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14108. // const instance = new DevOpsTerminal()
  14109. // instance.showPage({
  14110. // id: 'ops_' + opsId,
  14111. // path: 'ops_' + opsId,
  14112. //
  14113. // }, {
  14114. // data: {
  14115. // opsId: opsId,
  14116. // name: name,
  14117. // }
  14118. // })
  14119. // instance.dialogSuccess = success
  14120. };
  14121. /**
  14122. * 显示表结构
  14123. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14124. * columnName 可以为空
  14125. */
  14126. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14127. var id = 'tableColumn_' + tableName;
  14128. var isCreateTable = false;
  14129. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14130. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14131. if (!tableName) {
  14132. id = _$2.uniqueId('new_table');
  14133. tableName = id;
  14134. isCreateTable = true;
  14135. }
  14136. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14137. instance.showPage({
  14138. id: id,
  14139. path: id,
  14140. locatPath: locatPath
  14141. }, {
  14142. data: {
  14143. tableName: tableName,
  14144. columnName: columnName
  14145. }
  14146. });
  14147. };
  14148. /**
  14149. * 打开某个模块
  14150. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14151. */
  14152. Workbench.prototype.showModule = function (rawData) {
  14153. var id = rawData.id, path = rawData.path;
  14154. var separator = '/';
  14155. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14156. var module = this.modules[idx];
  14157. var pageId = path.replaceAll('/', '_');
  14158. console.log('open module', module);
  14159. var instance = new ModulePage(id, module);
  14160. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14161. instance.showPage({
  14162. id: 'module_' + pageId,
  14163. path: path,
  14164. title: module.name
  14165. }, {
  14166. data: {}
  14167. });
  14168. };
  14169. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14170. var bpmnDesign = new BpmnDesign();
  14171. bpmnDesign.showPage({}, {
  14172. data: {
  14173. absolutePath: absolutePath,
  14174. id: id,
  14175. text: text
  14176. }
  14177. });
  14178. };
  14179. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14180. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14181. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14182. layoutDesign.showPage({
  14183. id: id,
  14184. path: id,
  14185. }, {
  14186. data: {}
  14187. });
  14188. };
  14189. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14190. var _a;
  14191. // this.activeModulePage = newCard.yvanScope
  14192. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14193. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14194. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14195. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14196. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14197. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14198. eventBus.publish(EventType.MainTabChange, {
  14199. moduleId: newCard.yvanScope.moduleId,
  14200. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14201. from: this.name
  14202. });
  14203. };
  14204. Workbench.prototype.onUndo = function () {
  14205. var _a;
  14206. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14207. };
  14208. Workbench.prototype.onRedo = function () {
  14209. var _a;
  14210. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14211. };
  14212. Workbench.prototype.onCut = function (a, b, c, d) {
  14213. var _a;
  14214. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14215. };
  14216. Workbench.prototype.onCopy = function (a, b, c, d) {
  14217. var _a;
  14218. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14219. };
  14220. Workbench.prototype.onPaste = function (a, b, c, d) {
  14221. var _a;
  14222. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14223. };
  14224. Workbench.prototype.onSelectAll = function () {
  14225. var _a;
  14226. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14227. };
  14228. return Workbench;
  14229. }(Scope));
  14230. //# sourceMappingURL=Workbench.js.map
  14231. (function (FuncDomain) {
  14232. FuncDomain["SCOPE"] = "scope";
  14233. FuncDomain["SYSTEM"] = "system";
  14234. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14235. (function (BizMode) {
  14236. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14237. BizMode[BizMode["query"] = 1] = "query";
  14238. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14239. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14240. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14241. })(exports.BizMode || (exports.BizMode = {}));
  14242. (function (BizFormat) {
  14243. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14244. BizFormat[BizFormat["button"] = 1] = "button";
  14245. BizFormat[BizFormat["progress"] = 2] = "progress";
  14246. BizFormat[BizFormat["date"] = 3] = "date";
  14247. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14248. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14249. })(exports.BizFormat || (exports.BizFormat = {}));
  14250. (function (BizUnique) {
  14251. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14252. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14253. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14254. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14255. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14256. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14257. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14258. })(exports.BizUnique || (exports.BizUnique = {}));
  14259. var ScopeEngine = /** @class */ (function () {
  14260. function ScopeEngine() {
  14261. }
  14262. ScopeEngine.getBizFile = function (director) {
  14263. return new Promise(function (resolve, reject) {
  14264. debugger;
  14265. });
  14266. };
  14267. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14268. return new Promise(function (resolve, reject) {
  14269. var requireArr = [];
  14270. var requireKeyArr = [];
  14271. _$2.forOwn(billFile.domains, function (v, k) {
  14272. requireArr.push(v.domain);
  14273. requireKeyArr.push(k);
  14274. if (v.layout) {
  14275. requireArr.push(v.layout);
  14276. requireKeyArr.push(k + "_layout");
  14277. }
  14278. });
  14279. requireArr.push(billFile.layout);
  14280. requireKeyArr.push("layout");
  14281. requireArr.push(billFile.converter);
  14282. requireKeyArr.push("converter");
  14283. // @ts-ignore
  14284. require(requireArr, function () {
  14285. var requireReArr = [];
  14286. for (var _i = 0; _i < arguments.length; _i++) {
  14287. requireReArr[_i] = arguments[_i];
  14288. }
  14289. if (requireReArr.length <= 0) {
  14290. reject(new Error("没有加载到相关的文件!"));
  14291. }
  14292. var domains = {};
  14293. for (var i = 0; i < requireReArr.length - 2; i++) {
  14294. if (requireKeyArr[i].endsWith("_layout")) {
  14295. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14296. domains[key_d].layout = requireReArr[i].default;
  14297. }
  14298. else {
  14299. domains[requireKeyArr[i]] = requireReArr[i].default;
  14300. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14301. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14302. }
  14303. }
  14304. var bizFile = {
  14305. bill: billFile,
  14306. domains: domains,
  14307. layout: requireReArr[requireReArr.length - 2].default,
  14308. converter: requireReArr[requireReArr.length - 1].default,
  14309. };
  14310. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14311. scope.billSetting = bizFile;
  14312. resolve(scope);
  14313. });
  14314. });
  14315. };
  14316. ScopeEngine.buildScopeFromPath = function (path) {
  14317. return new Promise(function (resolve, reject) {
  14318. // @ts-ignore
  14319. require([path], function (bill) {
  14320. bill = bill.default;
  14321. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14322. resolve(scope);
  14323. }).catch(function (e) {
  14324. reject(e);
  14325. });
  14326. });
  14327. });
  14328. };
  14329. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14330. var controller = {};
  14331. var vjson = {
  14332. layout: 'fit',
  14333. title: bizFile.bill.name,
  14334. items: []
  14335. };
  14336. var model = {};
  14337. if (bizFile.layout.layout === "fit") {
  14338. vjson.items = bizFile.layout.items;
  14339. }
  14340. else if (bizFile.layout.layout === "border") {
  14341. vjson.items = [bizFile.layout];
  14342. }
  14343. var domainsVjson = {};
  14344. _$2.forOwn(bizFile.domains, function (v, k) {
  14345. var domainVjson = null;
  14346. var buttons = bizFile.domains[k].buttons;
  14347. if (bizFile.bill.domains[k].mode === "form") {
  14348. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14349. if (Array.isArray(buttons) && buttons.length > 0) {
  14350. if (bizFile.bill.domains[k].type === "header") {
  14351. vjson.tbar = {
  14352. xtype: 'toolbar',
  14353. items: ScopeEngine.buildButton(controller, buttons)
  14354. };
  14355. }
  14356. else {
  14357. domainVjson.items.push({
  14358. xtype: "cols",
  14359. items: ScopeEngine.buildButton(controller, buttons)
  14360. });
  14361. }
  14362. }
  14363. }
  14364. else if (bizFile.bill.domains[k].mode === "table") {
  14365. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14366. if (Array.isArray(buttons) && buttons.length > 0) {
  14367. if (bizFile.bill.domains[k].type === "header") {
  14368. vjson.tbar = {
  14369. xtype: 'toolbar',
  14370. items: ScopeEngine.buildButton(controller, buttons)
  14371. };
  14372. }
  14373. else {
  14374. domainVjson.tbar = {
  14375. xtype: 'toolbar',
  14376. items: ScopeEngine.buildButton(controller, buttons)
  14377. };
  14378. }
  14379. }
  14380. }
  14381. if (domainVjson) {
  14382. domainsVjson[k] = domainVjson;
  14383. }
  14384. });
  14385. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14386. var scope = new Scope({ model: model, vjson: vjson });
  14387. scope['bill_define'] = bizFile;
  14388. _$2.merge(scope, controller);
  14389. console.log('bill_define', vjson, scope, scope['bill_define']);
  14390. return scope;
  14391. };
  14392. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14393. var fieldGroups = {};
  14394. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14395. var field = bizFile.domains[domainKey].fields[i];
  14396. var item = { sort: field.form_sort };
  14397. item.xtype = field.xtype;
  14398. item.fieldLabel = field.column_desc;
  14399. item.bind = {
  14400. value: "{" + domainKey + "." + field.column_name + "}",
  14401. };
  14402. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14403. // if (field.disabled !== "true" && field.disabled !== "false") {
  14404. // item.bind.disabled = eval(field.disabled)
  14405. // } else {
  14406. // item.disabled = (field.disabled === "true")
  14407. // }
  14408. // if (field.readonly !== "true" && field.readonly !== "false") {
  14409. // item.bind.disabled = eval(field.readonly)
  14410. // } else {
  14411. // item.readonly = (field.readonly === "true")
  14412. // }
  14413. // if (field.required !== "true" && field.required !== "false") {
  14414. // item.bind.required = eval(field.required)
  14415. // } else {
  14416. // item.required = (field.required === "true")
  14417. // }
  14418. // if (field.hide !== "true" && field.hide !== "false") {
  14419. // item.bind.hidden = eval(field.hide)
  14420. // } else {
  14421. // item.hidden = (field.hide === "true")
  14422. // }
  14423. // item.flex = field.
  14424. if (field.dict) {
  14425. item.fix = eval(field.dict);
  14426. }
  14427. // _.set(formModel, "", "")
  14428. item.field = field;
  14429. if (field.form_group) {
  14430. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14431. fieldGroups[field.form_group] = [item];
  14432. }
  14433. else {
  14434. fieldGroups[field.form_group].push(item);
  14435. }
  14436. }
  14437. }
  14438. var formVjson = {
  14439. xtype: "form",
  14440. title: bizFile.domains[domainKey].name,
  14441. items: []
  14442. };
  14443. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14444. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14445. if (items) {
  14446. var fieldsetVjson = {
  14447. xtype: "fieldset",
  14448. title: k,
  14449. items: items
  14450. };
  14451. formVjson.items.push(fieldsetVjson);
  14452. }
  14453. });
  14454. return formVjson;
  14455. };
  14456. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14457. // const vjson = { xtype: "grid", items: []}
  14458. var gridVjson = {
  14459. xtype: "yvgrid",
  14460. columns: [],
  14461. split: true,
  14462. reference: domainKey,
  14463. listeners: {
  14464. itemdblclick: function () {
  14465. },
  14466. },
  14467. };
  14468. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14469. var field = bizFile.domains[domainKey].fields[i];
  14470. gridVjson.columns.push({
  14471. dataIndex: field.column_name,
  14472. header: field.column_desc,
  14473. });
  14474. }
  14475. return gridVjson;
  14476. };
  14477. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14478. var colGroups = [{
  14479. xtype: "cols",
  14480. items: []
  14481. }];
  14482. var colGroup = colGroups[0];
  14483. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14484. for (var i = 0; i < fieldGroup.length; i++) {
  14485. var field = fieldGroup[i];
  14486. if (field.field.form_newline === "true") {
  14487. if (colGroup.items.length > 0) {
  14488. colGroup = {
  14489. xtype: "cols",
  14490. items: [field]
  14491. };
  14492. colGroups.push(colGroup);
  14493. }
  14494. }
  14495. else {
  14496. colGroup.items.push(field);
  14497. }
  14498. delete field.field;
  14499. }
  14500. return colGroups;
  14501. };
  14502. ScopeEngine.buildButton = function (controller, buttons) {
  14503. var buttonsVjson = [];
  14504. var _loop_1 = function (i) {
  14505. var item = buttons[i];
  14506. var button = {
  14507. xtype: "button",
  14508. text: item.btn_name,
  14509. iconCls: item.icon
  14510. };
  14511. if (item.hidden === "true" || item.hidden === "false") {
  14512. button.hidden = (item.hidden === "true");
  14513. }
  14514. if (item.listeners) {
  14515. var listeners_1 = {};
  14516. _$2.forOwn(item.listeners, function (v, k) {
  14517. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14518. listeners_1[k] = v;
  14519. }
  14520. else {
  14521. try {
  14522. listeners_1[k] = eval(v);
  14523. }
  14524. catch (e) {
  14525. throw e;
  14526. }
  14527. }
  14528. });
  14529. button.listeners = listeners_1;
  14530. }
  14531. buttonsVjson.push(button);
  14532. };
  14533. for (var i = 0; i < buttons.length; i++) {
  14534. _loop_1(i);
  14535. }
  14536. return buttonsVjson;
  14537. };
  14538. ScopeEngine.buildListeners = function (controller, item) {
  14539. if (!item.hasOwnProperty("listeners")) {
  14540. return;
  14541. }
  14542. _$2.forOwn(item.listeners, function (v, k) {
  14543. if (v && typeof v === "string") {
  14544. if (v.indexOf(".") > -1) {
  14545. var strArr = v.split(".");
  14546. if (strArr.length != 2) {
  14547. console.error(item.listeners, "语法解析错误,请检查!");
  14548. }
  14549. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14550. switch (funcDomain) {
  14551. case exports.FuncDomain.SCOPE:
  14552. controller[k] = findCustFunc(item, k);
  14553. break;
  14554. case exports.FuncDomain.SYSTEM:
  14555. break;
  14556. default:
  14557. throw new Error("错误的函数域定义");
  14558. }
  14559. }
  14560. else {
  14561. var func = eval(v);
  14562. if (typeof func === 'function') {
  14563. controller[k] = func;
  14564. }
  14565. throw new Error("解析自定义函数出错");
  14566. }
  14567. }
  14568. });
  14569. var findCustFunc = function (item, funcName) {
  14570. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14571. throw new Error("没有找到相关的函数定义");
  14572. }
  14573. var func = eval(item[funcName]);
  14574. if (typeof func === 'function') {
  14575. return func;
  14576. }
  14577. throw new Error("解析自定义函数出错");
  14578. };
  14579. };
  14580. /**
  14581. * 只检索 items 的模式,深度遍历 vjson
  14582. */
  14583. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14584. if (Array.isArray(vjson)) {
  14585. for (var i = 0; i < vjson.length; i++) {
  14586. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14587. }
  14588. }
  14589. else {
  14590. _$2.forOwn(vjson, function (v, k) {
  14591. if (k !== "domain") {
  14592. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14593. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14594. }
  14595. }
  14596. else {
  14597. delete vjson.domain;
  14598. _$2.merge(vjson, domainsVjson[v]);
  14599. }
  14600. });
  14601. }
  14602. };
  14603. return ScopeEngine;
  14604. }());
  14605. //# sourceMappingURL=ScopeEngine.js.map
  14606. function initComponent () {
  14607. var ct = Ext.Component.prototype.constructor;
  14608. Ext.Component.override({
  14609. constructor: function (config) {
  14610. var _a, _b;
  14611. if (!isDesignMode(this, config)) {
  14612. var me_1 = this;
  14613. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14614. _$2.each(baseConfigProcessList, function (process) {
  14615. process.call(me_1, me_1, config);
  14616. });
  14617. }
  14618. if (config) {
  14619. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14620. config.i18nPath = config.$initParent.i18nPath;
  14621. }
  14622. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14623. var setTitle_1 = config.$initParent.setTitle;
  14624. var handel_1 = config.$initParent;
  14625. config.$initParent.setTitle = function (title) {
  14626. var t = { title: title };
  14627. var WMSTranslate = window["WMSTranslate"];
  14628. if (WMSTranslate) {
  14629. if (typeof window['viewTranslate'] === 'function') {
  14630. window['viewTranslate'](t, title, "title");
  14631. }
  14632. }
  14633. setTitle_1.call(handel_1, t.title);
  14634. }.bind(config.$initParent);
  14635. }
  14636. var WMSTranslate = window["WMSTranslate"];
  14637. if (WMSTranslate) {
  14638. if (typeof window['viewTranslate'] === 'function') {
  14639. window['viewTranslate'](config, config.text, "text");
  14640. window['viewTranslate'](config, config.title, "title");
  14641. window['viewTranslate'](config, config.header, "header");
  14642. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14643. window['viewTranslate'](config, config.emptyText, "emptyText");
  14644. }
  14645. }
  14646. }
  14647. ct.call(this, config);
  14648. }
  14649. });
  14650. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14651. Ext.picker.Date.override({
  14652. initComponent: function () {
  14653. var me = this;
  14654. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14655. _initComponent.call(me);
  14656. },
  14657. selectToday: function () {
  14658. var me = this, btn = me.todayBtn, handler = me.handler;
  14659. if (btn && !btn.disabled) {
  14660. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14661. me.fireEvent('select', me, me.value);
  14662. if (handler) {
  14663. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14664. }
  14665. me.onSelect();
  14666. }
  14667. return me;
  14668. },
  14669. });
  14670. }
  14671. //# sourceMappingURL=component.js.map
  14672. function initMainTab () {
  14673. Ext.define('Yvan.MainTab', {
  14674. extend: 'Ext.tab.Panel',
  14675. xtype: 'maintab',
  14676. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14677. closeTabText: '关闭',
  14678. closeOthersTabsText: '关闭其他',
  14679. closeAllTabsText: '关闭所有'
  14680. }),
  14681. constructor: function (config) {
  14682. var me = this;
  14683. var newConfig = _$2.defaultsDeep({
  14684. // 强制属性
  14685. }, config);
  14686. this.superclass.constructor.call(me, newConfig);
  14687. },
  14688. initComponent: function () {
  14689. var me = this;
  14690. this.on({
  14691. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14692. _$2.defer(function () {
  14693. me.changeHash(newCard.id);
  14694. window['cp'] = newCard.yvanScope;
  14695. });
  14696. $$2(window).trigger('tabChange', {
  14697. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14698. });
  14699. },
  14700. afterrender: function () {
  14701. _$2.defer(function () {
  14702. me.tryRestoryPage();
  14703. });
  14704. }
  14705. });
  14706. this.superclass.initComponent.call(me);
  14707. },
  14708. tryRestoryPage: function () {
  14709. var me = this;
  14710. var hash = '' + window.location.hash;
  14711. if (hash && hash.indexOf('page=') > 0) {
  14712. if (hash.startsWith('#')) {
  14713. hash = hash.substr(1);
  14714. }
  14715. if (hash) {
  14716. var page = Qs.parse(hash).page;
  14717. if (page) {
  14718. // this.openScope(page)
  14719. me.fireEvent('restorypage', page);
  14720. }
  14721. }
  14722. }
  14723. },
  14724. changeHash: function (id) {
  14725. window.location.hash = Qs.stringify({ page: id });
  14726. },
  14727. /**
  14728. * 添加一个业务模块实例到选项卡
  14729. * @param scopeInstance 业务对象实例
  14730. * @param config ExtJS配置对象
  14731. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14732. */
  14733. addScope: function (scopeInstance, config, panelInitCallback) {
  14734. scopeInstance.topScope = scopeInstance;
  14735. var me = this;
  14736. if (config.path) {
  14737. for (var i = 0; i < this.items.items.length; i++) {
  14738. // 找到当前 tabs 里有没有已经打开过
  14739. var tab = this.items.items[i];
  14740. if (_$2.isEqual(tab.path, config.path)) {
  14741. // 激活
  14742. this.setActiveTab(tab);
  14743. return tab;
  14744. }
  14745. }
  14746. }
  14747. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14748. if (typeof panelInitCallback === 'function') {
  14749. panelInitCallback(newPanel);
  14750. }
  14751. // 添加业务模块
  14752. var newTab = this.add(newPanel);
  14753. this.setActiveTab(newTab);
  14754. newTab.on({
  14755. destroy: function (sender) {
  14756. me.changeHash('');
  14757. delete window['cp'];
  14758. }
  14759. });
  14760. return newTab;
  14761. }
  14762. });
  14763. }
  14764. //# sourceMappingURL=MainTab.js.map
  14765. /**
  14766. * 构建所有组件的公共属性
  14767. * @param config 原始config
  14768. * @param dragType 组件模式
  14769. * 不填,代表不能在设计时被拖拽
  14770. * row-container 是一个rows容器
  14771. * col-container 是一个cols容器
  14772. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14773. * row-item rows中的一行,比如 tree / grid / panel 等等
  14774. */
  14775. function baseConfig(config, dragType) {
  14776. // if (isDesignMode(config, undefined) && dragType) {
  14777. if (typeof config === 'object') {
  14778. var cc = '';
  14779. switch (dragType) {
  14780. case "cols-container":
  14781. cc = 'design_cols_container';
  14782. break;
  14783. case "col-item":
  14784. cc = 'design_col_item';
  14785. break;
  14786. case "rows-container":
  14787. cc = 'design_rows_container';
  14788. break;
  14789. case "row-item":
  14790. cc = 'design_row_item';
  14791. break;
  14792. }
  14793. if (typeof config.cls === 'string') {
  14794. _$2.extend(config, {
  14795. cls: [config.cls, 'yvan_design', cc]
  14796. });
  14797. }
  14798. else if (_$2.isArray(config.cls)) {
  14799. _$2.extend(config, {
  14800. cls: __spread(config.cls, ['yvan_design', cc])
  14801. });
  14802. }
  14803. else {
  14804. _$2.extend(config, {
  14805. cls: ['yvan_design', cc]
  14806. });
  14807. }
  14808. }
  14809. return config;
  14810. }
  14811. //# sourceMappingURL=base.js.map
  14812. function initPanel () {
  14813. /**
  14814. *
  14815. */
  14816. var ct = Ext.panel.Panel.prototype.constructor;
  14817. Ext.panel.Panel.override({
  14818. constructor: function (config) {
  14819. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14820. ct.call(this, newConfig);
  14821. }
  14822. });
  14823. var ss = Ext.form.FieldContainer.prototype;
  14824. Ext.form.FieldContainer.override({
  14825. config: __assign({}, fieldContainer)
  14826. });
  14827. }
  14828. //# sourceMappingURL=panel.js.map
  14829. function initGridColumn () {
  14830. var ct = Ext.grid.column.Column.prototype.constructor;
  14831. Ext.grid.column.Column.override({
  14832. constructor: function (config) {
  14833. var scope = lookupScope(config.$initParent.$initParent);
  14834. var newConfig = _$2.defaults({}, config, column);
  14835. if (typeof newConfig.summaryRenderer === 'string') {
  14836. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14837. if (typeof newConfig.summaryRenderer === 'function') {
  14838. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14839. }
  14840. }
  14841. if (config.formatter === 'datetime') {
  14842. newConfig.fix = ['system.formatDate()'];
  14843. delete newConfig.formatter;
  14844. }
  14845. // 在 grid.constructor 已经转换过了
  14846. // if (typeof newConfig.renderer === 'string') {
  14847. // newConfig.renderer = lookupFn(scope, config.renderer)
  14848. // if (typeof newConfig.renderer === 'function') {
  14849. // newConfig.renderer = newConfig.renderer.bind(scope)
  14850. // }
  14851. // }
  14852. ct.call(this, newConfig);
  14853. }
  14854. });
  14855. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14856. Ext.grid.column.Action.override({
  14857. constructor: function (config) {
  14858. var scope = lookupScope(config.$initParent.$initParent);
  14859. _$2.forEach(config.items, function (item) {
  14860. if (typeof item.handler === 'string') {
  14861. item.handler = lookupFn(scope, item.handler);
  14862. if (typeof item.handler === 'function') {
  14863. item.handler = item.handler.bind(scope);
  14864. }
  14865. }
  14866. });
  14867. ctAction.call(this, config);
  14868. }
  14869. });
  14870. var ck = Ext.grid.column.Check.prototype.constructor;
  14871. Ext.grid.column.Check.override({
  14872. constructor: function (config) {
  14873. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14874. var grid = sender.view.grid.ownerGrid;
  14875. var column = grid.getColumns()[sender.fullColumnIndex];
  14876. var context = {
  14877. event: e,
  14878. column: column,
  14879. field: sender.dataIndex,
  14880. value: checked,
  14881. record: record,
  14882. rowIdx: rowIndex
  14883. };
  14884. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14885. });
  14886. ck.call(this, config);
  14887. }
  14888. });
  14889. // 227573
  14890. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14891. // Ext.define('Yvan.ColumnOverride', {
  14892. // override: 'Ext.grid.column.Column',
  14893. //
  14894. // config: {
  14895. // enableSortOnClick: false,
  14896. // },
  14897. //
  14898. // // /**@Overrides*/
  14899. // onTitleElClick: function (e, t, sortOnClick) {
  14900. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14901. // if (!$(e.target).is('.x-column-header-trigger')) {
  14902. // // 不是点击菜单的情况下,让列自适应宽度
  14903. // this.autoSize()
  14904. // }
  14905. // return onTitleElClick.call(this, e, t, false)
  14906. // }
  14907. // });
  14908. }
  14909. //# sourceMappingURL=gridcolumn.js.map
  14910. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14911. /**
  14912. * 判断目标字符串与关键字是否重叠
  14913. * @param target 目标字符串
  14914. * @param keyword 搜索关键字
  14915. */
  14916. function pinyinMatch(target, keyword) {
  14917. if (typeof target != 'string' || typeof keyword != 'string') {
  14918. return false;
  14919. }
  14920. if (!keyword || !target) {
  14921. return false;
  14922. }
  14923. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14924. keyword = _$2.toLower(keyword);
  14925. var pos1 = _$2.toLower(target).indexOf(keyword);
  14926. if (pos1 >= 0) {
  14927. return true;
  14928. }
  14929. var len = _$2.intersection(keyword.split('')).length;
  14930. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14931. return true;
  14932. }
  14933. return false;
  14934. }
  14935. /**
  14936. * 对某个表达式进行求值
  14937. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14938. *
  14939. * @example
  14940. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14941. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14942. *
  14943. * @param data 数据环境对象
  14944. * @param express 表达式对象
  14945. */
  14946. function calcExpress(data, express) {
  14947. var result = express;
  14948. if (SIMPLE_RE.test(express)) {
  14949. // '{foo}' 简单表达式
  14950. var path = express.substring(1, express.length - 1);
  14951. var ret = _$2.get(data, path);
  14952. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14953. }
  14954. while (true) {
  14955. var mlist = result.match(/{(.*?)}/);
  14956. if (!mlist) {
  14957. break;
  14958. }
  14959. var pathC = mlist[0]; // {query.a}
  14960. var path = mlist[1]; // query.a
  14961. var value = _$2.get(data, path);
  14962. result = result.replaceAll(pathC, value || '');
  14963. }
  14964. return result;
  14965. }
  14966. /**
  14967. * 对个对象进行表达式求值,不用回调
  14968. * @example
  14969. * calcObjectFlat({query:{a:'aValue',b1:'b1Value',b2:'b2Value',d1:1,d2:2}}, { a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}'] })
  14970. *
  14971. * {
  14972. * a: '{query.a}',
  14973. * b: {
  14974. * b1: '{query.b1}',
  14975. * b2: '{query.b2}',
  14976. * },
  14977. * c: 'aa',
  14978. * d: [
  14979. * '{query.d1}',
  14980. * '{query.d2}'
  14981. * ]
  14982. * }
  14983. *
  14984. * 计算结果为
  14985. * {
  14986. * a: 'aValue',
  14987. * b: {
  14988. * b1: 'b1Value',
  14989. * b2: 'b2Value'
  14990. * },
  14991. * c: 'aa'
  14992. * d: [
  14993. * '1',
  14994. * '2'
  14995. * ]
  14996. * }
  14997. *
  14998. * @param data
  14999. * @param paramObject
  15000. */
  15001. function calcObjectFlat(data, paramObject) {
  15002. var result = _$2.cloneDeep(paramObject);
  15003. if (typeof paramObject === 'string') {
  15004. return calcExpress(data, paramObject);
  15005. }
  15006. var trav = function (param) {
  15007. _$2.forOwn(param, function (value, key) {
  15008. if (_$2.isPlainObject(value)) {
  15009. // 深度递归,对子对象进行求解
  15010. trav(value);
  15011. }
  15012. else if (_$2.isString(value)) {
  15013. // 字符串直接用 calcExpress 表达式求解
  15014. param[key] = calcExpress(data, param[key]);
  15015. }
  15016. else if (_$2.isArray(value)) {
  15017. // 数组求解
  15018. _$2.each(value, function (v, idx) {
  15019. value[idx] = calcExpress(data, v);
  15020. });
  15021. }
  15022. });
  15023. };
  15024. trav(result);
  15025. return result;
  15026. }
  15027. /**
  15028. * 合併 data 到當前的 ViewModel 對象
  15029. */
  15030. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  15031. var newRow = {};
  15032. if (isFlat == false) {
  15033. newRow = data;
  15034. }
  15035. else {
  15036. flatObject(newRow, '', data);
  15037. }
  15038. if (!propertyName) {
  15039. _$2.forOwn(newRow, function (value, key) {
  15040. viewModel.set(key, value);
  15041. });
  15042. }
  15043. else {
  15044. _$2.forOwn(newRow, function (value, key) {
  15045. viewModel.set(propertyName + "." + key, value);
  15046. });
  15047. }
  15048. }
  15049. /**
  15050. * 转换内联结构的行,到平面结构
  15051. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  15052. *
  15053. * @param array
  15054. * @param flatOption
  15055. * @return {[]}
  15056. */
  15057. function flatRow(array) {
  15058. var ret = [];
  15059. _$2.forEach(array, function (row) {
  15060. var newRow = {};
  15061. flatObject(newRow, '', row);
  15062. ret.push(newRow);
  15063. });
  15064. return ret;
  15065. }
  15066. function flatObject(parentObj, parentProp, obj) {
  15067. _$2.forOwn(obj, function (value, key) {
  15068. var fullKey = parentProp ? parentProp + '_' + key : key;
  15069. if (_$2.isArray(value)) {
  15070. parentObj[fullKey] = _$2.map(value, function (row) {
  15071. var newRow = {};
  15072. flatObject(newRow, '', row);
  15073. return newRow;
  15074. });
  15075. }
  15076. else {
  15077. if (typeof value === 'object') {
  15078. flatObject(parentObj, fullKey, value);
  15079. }
  15080. else {
  15081. parentObj[fullKey] = value;
  15082. }
  15083. }
  15084. });
  15085. }
  15086. /**
  15087. * 替换内部结构中,所有 N/A
  15088. */
  15089. function replaceNA(obj) {
  15090. if (obj === 'N/A') {
  15091. return '';
  15092. }
  15093. if (_$2.isArray(obj)) {
  15094. _$2.forEach(obj, function (value, idx) {
  15095. if (value === 'N/A') {
  15096. obj[idx] = '';
  15097. }
  15098. else {
  15099. replaceNA(value);
  15100. }
  15101. });
  15102. }
  15103. else if (_$2.isPlainObject(obj)) {
  15104. _$2.forOwn(obj, function (value, key) {
  15105. if (value === 'N/A') {
  15106. obj[key] = '';
  15107. }
  15108. else {
  15109. replaceNA(value);
  15110. }
  15111. });
  15112. }
  15113. }
  15114. function deepTravJson(obj, resolver) {
  15115. if (_$2.isArray(obj)) {
  15116. _$2.forEach(obj, function (value, idx) {
  15117. if (typeof value === 'string') {
  15118. resolver(obj, value, idx);
  15119. }
  15120. else {
  15121. deepTravJson(value, resolver);
  15122. }
  15123. });
  15124. }
  15125. else if (_$2.isPlainObject(obj)) {
  15126. _$2.forOwn(obj, function (value, key) {
  15127. if (typeof value === 'string') {
  15128. resolver(obj, value, key);
  15129. }
  15130. else {
  15131. deepTravJson(value, resolver);
  15132. }
  15133. });
  15134. }
  15135. }
  15136. /**
  15137. * 根据表达式进入写值
  15138. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15139. * express="test-{query.a}" 写值就会失败
  15140. *
  15141. * @example
  15142. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15143. * 写值成功
  15144. *
  15145. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15146. * 写值失败
  15147. *
  15148. * @param viewModel VM对象
  15149. * @param express 表达式对象
  15150. * @param value 目标值
  15151. */
  15152. function tryWriteByExpress(viewModel, express, value) {
  15153. if (SIMPLE_RE.test(express)) {
  15154. // '{foo}' 简单表达式
  15155. express = express.substring(1, express.length - 1);
  15156. viewModel.set(express, value);
  15157. }
  15158. }
  15159. /**
  15160. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15161. * @example
  15162. * tryWriteObject({ a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}']}, {a:'aValue', b:{b1:'b1Value', b2:'b2Value'}, c:'aa', d:[1,2]})
  15163. *
  15164. * expressObject:
  15165. * {
  15166. * a: '{query.a}',
  15167. * b: {
  15168. * b1: '{query.b1}',
  15169. * b2: '{query.b2}',
  15170. * },
  15171. * c: 'aa',
  15172. * d: [
  15173. * '{query.a}',
  15174. * '{query.b2}'
  15175. * ]
  15176. * }
  15177. *
  15178. * valueObject:
  15179. * {
  15180. * a: 'aValue',
  15181. * b: {
  15182. * b1: 'b1Value',
  15183. * b2: 'b2Value'
  15184. * },
  15185. * c: 'aa'
  15186. * c: [
  15187. * 'aValue',
  15188. * 'b2Value'
  15189. * ]
  15190. * }
  15191. *
  15192. * 系统会尝试回写
  15193. * viewModel.set('query.a', 'aValue')
  15194. * viewModel.set('query.b1', 'b1Value')
  15195. * viewModel.set('query.b2', 'b2Value')
  15196. *
  15197. * @param expressObject 含表达式的对象
  15198. * @param valueObject 表达式计算完成之后的结果对象
  15199. * @param writeFn 写入的方法 (path, value)=>void
  15200. */
  15201. function tryWriteObject(expressObject, valueObject, writeFn) {
  15202. var trav = function (pathPrefix) {
  15203. var parent = expressObject;
  15204. if (_$2.size(pathPrefix) > 1) {
  15205. parent = _$2.get(parent, pathPrefix.substring(1));
  15206. }
  15207. _$2.forOwn(parent, function (value, key) {
  15208. if (_$2.isPlainObject(value)) {
  15209. // 深度递归,对子对象进行求解
  15210. trav(pathPrefix + "." + key);
  15211. }
  15212. else if (_$2.isString(value)) {
  15213. // 字符串直接用 calcExpress 表达式求解
  15214. if (SIMPLE_RE.test(value)) {
  15215. // If we have '{foo}' alone it is a literal 简单表达式
  15216. var targetPath = value.substring(1, value.length - 1);
  15217. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15218. if (!writeFn) {
  15219. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15220. }
  15221. else {
  15222. writeFn(targetPath, targetValue);
  15223. }
  15224. }
  15225. }
  15226. else if (_$2.isArray(value)) {
  15227. _$2.each(value, function (v, idx) {
  15228. if (SIMPLE_RE.test(v)) {
  15229. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15230. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15231. if (!writeFn) {
  15232. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15233. }
  15234. else {
  15235. writeFn(targetPath, targetValue);
  15236. }
  15237. }
  15238. });
  15239. }
  15240. });
  15241. };
  15242. trav("");
  15243. }
  15244. /**
  15245. * 尝试去掉变量两边括号
  15246. * {a} => a
  15247. * a => a
  15248. */
  15249. function tryVarSimple(value) {
  15250. if (SIMPLE_RE.test(value)) {
  15251. // If we have '{foo}' alone it is a literal 简单表达式
  15252. return value.substring(1, value.length - 1);
  15253. }
  15254. return value;
  15255. }
  15256. /**
  15257. * 对多个表达式进行求值. 异步回调的方式返回
  15258. * {
  15259. * a: 1,
  15260. * b: '{someBind}',
  15261. * c: ['a', 'b', 'c'],
  15262. * d: ['a', 'b', '{someBind}'],
  15263. * e: {
  15264. * y: 1,
  15265. * z: 2
  15266. * },
  15267. * f: {
  15268. * y: 1,
  15269. * z: '{someBind}'
  15270. * }
  15271. * }
  15272. *
  15273. * // Will produce
  15274. * {
  15275. * b: value,
  15276. * d: ['a', 'b', value],
  15277. * f: {
  15278. * y: 1,
  15279. * z: value
  15280. * }
  15281. * }
  15282. * @param viewModel scope.viewModel对象
  15283. * @param paramObject 求值对象
  15284. */
  15285. function calcObject(viewModel, paramObject) {
  15286. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15287. return new Promise(function (resolve) {
  15288. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15289. schedule.destroy();
  15290. // 从 Ext.data.Model 对象转换为 js-object 对象
  15291. ret = toPlainObject(ret);
  15292. resolve(ret);
  15293. }, viewModel, { single: true });
  15294. });
  15295. }
  15296. /**
  15297. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15298. * @param config 组件构造函数传入的 config 配置文件
  15299. */
  15300. function getParentGrid(config) {
  15301. var _a;
  15302. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15303. }
  15304. /**
  15305. * 解析
  15306. * {
  15307. * condition: "{skuId}",
  15308. * errorMsg: "无法编辑",
  15309. * notice: 'msg'
  15310. * }
  15311. */
  15312. function tryEnable(data, enableSetting) {
  15313. if (!enableSetting) {
  15314. // 没有这一段配置,可以编辑
  15315. return true;
  15316. }
  15317. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15318. if (!evalFunction(data, condition)) {
  15319. // 没有达成 condition 条件
  15320. // 计算 msg 消息内容
  15321. var msgContent = calcExpress(data, errorMsg);
  15322. if (msgContent) {
  15323. if (!notice || notice === 'msg') {
  15324. // 进行提示
  15325. msg$1(msgContent);
  15326. }
  15327. }
  15328. return false;
  15329. }
  15330. return true;
  15331. }
  15332. /**
  15333. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15334. * @param sender 目标对象
  15335. * @param config 目标对象的配置(在构造函数之前也可以)
  15336. * @param getDictFn 获取字典的方法
  15337. * @param bizKey 传入字典的参数
  15338. * @param multiValueSeparator 多个字典值的分割符号
  15339. */
  15340. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15341. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15342. // sender 和 config为空的时候获取值、
  15343. if (_$2.isArray(getDictFn)) {
  15344. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15345. var realArray_1 = getDictFn;
  15346. getDictFn = function () {
  15347. return realArray_1;
  15348. };
  15349. }
  15350. if (!sender) {
  15351. return new Promise(function (resolve, reject) {
  15352. getDictFn(bizKey, function (r) {
  15353. resolve({ config: config, r: r });
  15354. });
  15355. });
  15356. }
  15357. if (sender.xtype === 'combotree') {
  15358. getDictFn(bizKey, function (r) {
  15359. if (sender.store) {
  15360. // 异步回传
  15361. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15362. }
  15363. else {
  15364. // 同步回传
  15365. config.store = new Ext.data.TreeStore({ root: r });
  15366. }
  15367. });
  15368. return;
  15369. }
  15370. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15371. getDictFn(bizKey, function (r) {
  15372. var _a, _b;
  15373. if (sender.store) {
  15374. // 异步回传
  15375. sender.setStore(new Ext.data.Store(r));
  15376. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15377. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15378. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15379. if (typeof realValue !== 'undefined') {
  15380. sender.setValue(realValue);
  15381. }
  15382. }
  15383. else {
  15384. // 同步回传
  15385. config.store = new Ext.data.Store(r);
  15386. }
  15387. });
  15388. return;
  15389. }
  15390. else if (sender.xtype === 'gridcolumn') {
  15391. var grid = getParentGrid(config);
  15392. var editor_1 = config.editor, renderer = config.renderer;
  15393. getDictFn(bizKey, function (r) {
  15394. if (sender.store) {
  15395. // 已经渲染出来了, 用方法进行修改
  15396. var editor_2 = sender.getEditor();
  15397. if (editor_2 && editor_2.xtype === 'combo') {
  15398. var valueField_1 = r.field[0];
  15399. var displayField_1 = r.field[1];
  15400. editor_2.valueField = valueField_1;
  15401. editor_2.setDisplayField(displayField_1);
  15402. editor_2.setStore(new Ext.data.Store(r));
  15403. }
  15404. sender.setFilter({
  15405. type: 'list',
  15406. options: _$2.map(r.data, function (r) { return ({
  15407. id: '' + r.id,
  15408. text: r.text,
  15409. }); })
  15410. });
  15411. }
  15412. else {
  15413. // 没有渲染之前,修改 config 即可
  15414. if (editor_1 && editor_1.xtype === 'combo') {
  15415. // 带编辑模式
  15416. editor_1.store = new Ext.data.Store(r);
  15417. }
  15418. config.filter = {
  15419. type: 'list',
  15420. options: _$2.map(r.data, function (r) { return ({
  15421. id: '' + r.id,
  15422. text: r.text,
  15423. }); })
  15424. };
  15425. }
  15426. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15427. var renderer = function (value, metaData) {
  15428. if (metaData === void 0) { metaData = false; }
  15429. if (!value && value != 0) {
  15430. return '';
  15431. }
  15432. var valueField = r.field[metaData === true ? 1 : 0];
  15433. var displayField = r.field[metaData === true ? 0 : 1];
  15434. var separator = multiValueSeparator;
  15435. if (separator) {
  15436. var arr = value.split(separator);
  15437. var displayValue_1 = "";
  15438. var _loop_1 = function (i) {
  15439. var itv = arr[i];
  15440. if (i > 0) {
  15441. displayValue_1 += separator;
  15442. }
  15443. _$2.each(r.data, function (row) {
  15444. // 从 valueField 找到要显示的 displayField
  15445. if (row[valueField] == itv) {
  15446. displayValue_1 += row[displayField];
  15447. return false;
  15448. }
  15449. else {
  15450. if (i >= r.data.length - 1) {
  15451. displayValue_1 += itv;
  15452. }
  15453. }
  15454. });
  15455. };
  15456. for (var i = 0; i < arr.length; i++) {
  15457. _loop_1(i);
  15458. }
  15459. return displayValue_1;
  15460. }
  15461. _$2.each(r.data, function (row) {
  15462. // 从 valueField 找到要显示的 displayField
  15463. if (row[valueField] == value) {
  15464. value = row[displayField];
  15465. return false;
  15466. }
  15467. });
  15468. return value;
  15469. };
  15470. var dictForExcel = {};
  15471. var valueField = r.field[0];
  15472. var displayField = r.field[1];
  15473. _$2.each(r.data, function (row) {
  15474. // 从 valueField 找到要显示的 displayField
  15475. var key = row[valueField];
  15476. if (key != '' && typeof key != "undefined" && key != null) {
  15477. dictForExcel[key] = row[displayField];
  15478. }
  15479. });
  15480. if (sender.rendered) {
  15481. // 已经渲染出来了, 对列进行渲染
  15482. sender.renderer = renderer;
  15483. sender.dictForExcel = dictForExcel;
  15484. sender.getView().refresh();
  15485. }
  15486. else {
  15487. sender.renderer = renderer;
  15488. sender.dictForExcel = dictForExcel;
  15489. config.renderer = renderer;
  15490. config.dictForExcel = dictForExcel;
  15491. }
  15492. });
  15493. return;
  15494. }
  15495. throw new TypeError("无法识别的组件类型");
  15496. }
  15497. /**
  15498. * 调用服务器 Ajax
  15499. */
  15500. function invokeServer$1(url) {
  15501. var args = [];
  15502. for (var _i = 1; _i < arguments.length; _i++) {
  15503. args[_i - 1] = arguments[_i];
  15504. }
  15505. // @ts-ignore
  15506. return ajax.func({
  15507. url: url,
  15508. method: 'invoke',
  15509. args: args
  15510. });
  15511. }
  15512. function clearViewModelValues(viewModel, propertyName) {
  15513. if (!propertyName) {
  15514. var dd_1 = viewModel.getData();
  15515. _$2.forOwn(dd_1, function (value, key) {
  15516. viewModel.set(key, '');
  15517. });
  15518. return;
  15519. }
  15520. var dd = _$2.get(viewModel.getData(), propertyName);
  15521. _$2.forOwn(dd, function (value, key) {
  15522. viewModel.set(propertyName + '.' + key, '');
  15523. });
  15524. }
  15525. function reloadGrid(scope, gridRefName) {
  15526. var _a;
  15527. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15528. }
  15529. /**
  15530. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15531. */
  15532. function toPlainObject(obj) {
  15533. if (obj.isModel) {
  15534. obj = obj.data;
  15535. }
  15536. _$2.forOwn(obj, function (v, k) {
  15537. // Ext.data.Model.constructor
  15538. if (!v) {
  15539. return;
  15540. }
  15541. if (v.isModel) {
  15542. v = v.data;
  15543. }
  15544. if (typeof v === 'object') {
  15545. obj[k] = toPlainObject(v);
  15546. }
  15547. else {
  15548. obj[k] = v;
  15549. }
  15550. });
  15551. return obj;
  15552. }
  15553. function confirm(msg, sender) {
  15554. return new Promise(function (resolve) {
  15555. var _a, _b;
  15556. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15557. var t = { msg: msg };
  15558. var WMSTranslate = window["WMSTranslate"];
  15559. if (WMSTranslate) {
  15560. if (typeof window['viewTranslate'] === 'function') {
  15561. window['viewTranslate'](t, msg, "msg");
  15562. }
  15563. }
  15564. var config = {
  15565. title: '请确认',
  15566. modal: true,
  15567. animateTarget: sender,
  15568. // resizable: false,
  15569. // constrainHeader: true,
  15570. // constrain: true,
  15571. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15572. layout: {
  15573. type: 'hbox',
  15574. pack: 'start',
  15575. align: 'stretch'
  15576. },
  15577. items: [
  15578. {
  15579. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15580. border: false,
  15581. },
  15582. {
  15583. flex: 1,
  15584. border: false,
  15585. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15586. }
  15587. ],
  15588. buttons: [
  15589. {
  15590. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15591. handler: function () {
  15592. resolve();
  15593. win.close();
  15594. }
  15595. },
  15596. {
  15597. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15598. handler: function () {
  15599. win.close();
  15600. }
  15601. }
  15602. ],
  15603. keyMapEnabled: true,
  15604. keyMap: {
  15605. ENTER: function () {
  15606. resolve();
  15607. win.close();
  15608. }
  15609. }
  15610. };
  15611. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15612. config.constrain = true;
  15613. }
  15614. var win = new Ext.Window(config);
  15615. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15616. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15617. }
  15618. win.show();
  15619. });
  15620. }
  15621. /**
  15622. * 任何符号字符串都替换成下换线
  15623. */
  15624. function normId(value) {
  15625. return _$2.replace(value, /[^\w]/g, '_');
  15626. }
  15627. /**
  15628. *
  15629. * @param sender
  15630. * @param propertyName
  15631. * @param gridRefName
  15632. */
  15633. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15634. var _a, _b;
  15635. var scope = lookupScope(sender);
  15636. clearViewModelValues(scope.viewModel, propertyName);
  15637. if (!gridRefName) {
  15638. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15639. }
  15640. else {
  15641. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15642. }
  15643. }
  15644. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15645. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15646. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15647. var value = _$2.trim(sender.rawValue);
  15648. raiseClick(eOpts.handle);
  15649. }
  15650. }, 150);
  15651. function saveGridRow(grid1) {
  15652. var _a;
  15653. var config = grid1.config;
  15654. var scope = lookupScope(grid1);
  15655. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15656. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15657. // "表格保存"的相关配置
  15658. var dbSaveConfig = {
  15659. columns: [],
  15660. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15661. saveRowValues: saveRowValues,
  15662. path: scope.originalVjson.__custom_path,
  15663. };
  15664. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15665. if (err) {
  15666. // 如果有异常就不保存
  15667. return;
  15668. }
  15669. // 构建"表格保存"的相关配置
  15670. for (var i = 0; i < config.columns.length; i++) {
  15671. var c = config.columns[i];
  15672. var v = {
  15673. dataIndex: c.dataIndex,
  15674. header: c.header,
  15675. dbColumn: c.dbColumn,
  15676. serverCreateValue: c.serverCreateValue,
  15677. dbIsDeleteKey: c.dbIsDeleteKey,
  15678. dbIsUpdateKey: c.dbIsUpdateKey,
  15679. dbUpdateEnable: c.dbUpdateEnable,
  15680. serverValueConvert: c.dbUpdateEnable,
  15681. };
  15682. if (c.editor) {
  15683. v.editor = {
  15684. xtype: c.editor.xtype,
  15685. required: c.editor.required,
  15686. };
  15687. }
  15688. dbSaveConfig.columns.push(v);
  15689. }
  15690. // 进行业务上的逻辑校验
  15691. var hasError = false;
  15692. _$2.forEach(rows, function (row, i) {
  15693. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15694. var c = config.columns[i_1];
  15695. var value = row[c.dataIndex];
  15696. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15697. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15698. hasError = true;
  15699. return false;
  15700. }
  15701. if (c.xtype === 'checkcolumn') {
  15702. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15703. row[c.dataIndex] = c.uncheckedValue;
  15704. }
  15705. if (value === true && typeof c.checkedValue !== 'undefined') {
  15706. row[c.dataIndex] = c.checkedValue;
  15707. }
  15708. }
  15709. }
  15710. });
  15711. if (hasError) {
  15712. return;
  15713. }
  15714. // 设置当前界面为 "保存中..." 状态
  15715. grid1.setLoading(true);
  15716. invokeServer$1('/Dev@batchSave', {
  15717. newRows: newRows,
  15718. modifyRows: modifyRows,
  15719. removeRecords: removeRecords,
  15720. config: dbSaveConfig,
  15721. }).then(function (res) {
  15722. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15723. msg$1(res.msg);
  15724. grid1.reload();
  15725. }).catch(function (e) {
  15726. console.error(e);
  15727. showErrorDialog$1(_$2.toString(e));
  15728. }).finally(function () {
  15729. // 无论正常异常,关闭 "保存中..." 状态
  15730. grid1.setLoading(false);
  15731. });
  15732. }
  15733. function insertGridRow(grid1) {
  15734. var config = grid1.config;
  15735. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15736. var insertRow = {};
  15737. _$2.forEach(config.columns, function (c) {
  15738. var fn = c.createValue;
  15739. if (_$2.startsWith(fn, 'scope.') ||
  15740. _$2.startsWith(fn, 'system.')) {
  15741. var scope = lookupScope(grid1);
  15742. var fn2 = lookupFn(scope, fn, c);
  15743. if (_$2.isFunction(fn2)) {
  15744. var newValue = fn2();
  15745. if (!_$2.isUndefined(newValue)) {
  15746. insertRow[c.dataIndex] = newValue;
  15747. }
  15748. }
  15749. }
  15750. else if (_$2.isString(fn) && fn) {
  15751. insertRow[c.dataIndex] = fn;
  15752. }
  15753. });
  15754. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15755. }
  15756. function commitMe(sender) {
  15757. var window = sender.up('window');
  15758. var scope = lookupScope(sender);
  15759. if (typeof scope['commit'] === 'function') {
  15760. scope['commit']().then(function (res) {
  15761. window.close();
  15762. });
  15763. }
  15764. }
  15765. function removeGridRow(grid1) {
  15766. var _a;
  15767. var config = grid1.config;
  15768. var rows = [];
  15769. if (grid1.selModel.selType === "rowmodel") {
  15770. rows.push(grid1.selection);
  15771. }
  15772. else {
  15773. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15774. rows.push(r);
  15775. });
  15776. }
  15777. if (rows.length > 1) {
  15778. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15779. if (_$2.isUndefined(batchRemoveConfirm)) {
  15780. //不需要提示
  15781. _$2.forEach(rows, function (r) {
  15782. grid1.getStore().remove(r);
  15783. });
  15784. }
  15785. else {
  15786. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15787. confirm(tip).then(function () {
  15788. _$2.forEach(rows, function (r) {
  15789. grid1.getStore().remove(r);
  15790. });
  15791. });
  15792. }
  15793. }
  15794. else if (rows.length === 1) {
  15795. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15796. if (_$2.isUndefined(singleRemoveConfirm)) {
  15797. //不需要提示
  15798. grid1.getStore().remove(rows[0]);
  15799. }
  15800. else {
  15801. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15802. _$2.forEach(config.columns, function (c) {
  15803. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15804. });
  15805. confirm(tip_1).then(function () {
  15806. grid1.getStore().remove(rows[0]);
  15807. });
  15808. }
  15809. }
  15810. else {
  15811. msg$1('请选择要删除的数据!');
  15812. }
  15813. }
  15814. function moveUpGridRow(grid) {
  15815. grid.rowMoveUp();
  15816. }
  15817. function moveDownGridRow(grid) {
  15818. grid.rowMoveDown();
  15819. }
  15820. var SystemEventFu = /** @class */ (function () {
  15821. function SystemEventFu() {
  15822. }
  15823. SystemEventFu.prototype.moveUpGridRow = function () {
  15824. return function (sender) {
  15825. var grid1 = sender.up('yvgrid');
  15826. moveUpGridRow(grid1);
  15827. };
  15828. };
  15829. SystemEventFu.prototype.commitMe = function () {
  15830. return function (sender) {
  15831. commitMe(sender);
  15832. };
  15833. };
  15834. SystemEventFu.prototype.moveDownGridRow = function () {
  15835. return function (sender) {
  15836. var grid1 = sender.up('yvgrid');
  15837. moveDownGridRow(grid1);
  15838. };
  15839. };
  15840. SystemEventFu.prototype.saveGridRow = function () {
  15841. return function (sender) {
  15842. var grid1 = sender.up('yvgrid');
  15843. saveGridRow(grid1);
  15844. };
  15845. };
  15846. SystemEventFu.prototype.insertGridRow = function () {
  15847. return function (sender) {
  15848. var grid1 = sender.up('yvgrid');
  15849. insertGridRow(grid1);
  15850. };
  15851. };
  15852. SystemEventFu.prototype.removeGridRow = function () {
  15853. return function (sender) {
  15854. var grid1 = sender.up('yvgrid');
  15855. removeGridRow(grid1);
  15856. };
  15857. };
  15858. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15859. return function (sender, config) {
  15860. if (!config.listeners) {
  15861. config.listeners = {};
  15862. }
  15863. config.listeners.afterrender = function (sender) {
  15864. var scope = lookupScope(sender);
  15865. // $(sender.el.dom).on('keydown', (e) => {
  15866. // const xtype = Ext.fly(e.target).component.xtype
  15867. // if (xtype === 'textfield' && e.keyCode === 13) {
  15868. // Ext.defer(() => {
  15869. // raiseClick(scope.refs[btnReferenceName])
  15870. // })
  15871. // e.preventDefault()
  15872. // e.stopPropagation()
  15873. // return false
  15874. // }
  15875. // })
  15876. $(sender.el.dom).on('keyup', function (e) {
  15877. var tt = Ext.fly(e.target).component;
  15878. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15879. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15880. ![10, 13, 20, 40].includes(e.keyCode)) {
  15881. return;
  15882. }
  15883. e.preventDefault();
  15884. e.stopPropagation();
  15885. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15886. return;
  15887. });
  15888. };
  15889. };
  15890. };
  15891. SystemEventFu.prototype.confirm = function (text, fn) {
  15892. return function (sender) {
  15893. var scope = lookupScope(sender);
  15894. var msg = calcExpress(scope.viewModel.data, text);
  15895. confirm(msg, sender).then(function () {
  15896. fn.call(scope, sender);
  15897. });
  15898. };
  15899. };
  15900. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15901. return function (sender) {
  15902. var scope = lookupScope(sender);
  15903. var grid = scope.refs[gridRefName];
  15904. if (grid) {
  15905. var records = grid.getSelectionModel().getLastSelected();
  15906. grid.store.remove(records);
  15907. }
  15908. };
  15909. };
  15910. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15911. //可以是 scope.XX / system.XX / string / lookup表达式
  15912. writeTarget) {
  15913. return function (sender) {
  15914. if (!invokeUrl) {
  15915. return;
  15916. }
  15917. var scope = lookupScope(sender);
  15918. scope.setLoading(true);
  15919. var data = scope.viewModel.data;
  15920. if (invokeParam) {
  15921. data = calcObjectFlat(data, invokeParam);
  15922. }
  15923. invokeServer$1(invokeUrl, data).then(function (res) {
  15924. if (res.success) {
  15925. if (typeof writeTarget === "string") {
  15926. _$2.forOwn(res.data, function (v, k) {
  15927. scope.viewModel.set(writeTarget + "." + k, v);
  15928. });
  15929. }
  15930. else if (typeof writeTarget === 'function') {
  15931. writeTarget.call(scope, res.data);
  15932. }
  15933. else if (typeof writeTarget === 'object') {
  15934. var ret = calcObjectFlat(res.data, writeTarget);
  15935. _$2.forOwn(ret, function (v, k) {
  15936. scope.viewModel.set(k, v);
  15937. });
  15938. }
  15939. }
  15940. else {
  15941. showErrorDialog$1(res.msg || '未知错误', sender);
  15942. }
  15943. }).catch(function (e) {
  15944. var _a, _b;
  15945. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15946. showErrorDialog$1(msg || e.toString(), sender);
  15947. }).finally(function () {
  15948. scope.setLoading(false);
  15949. });
  15950. };
  15951. };
  15952. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15953. return function (sender) {
  15954. var scope = lookupScope(sender);
  15955. scope.setLoading(true);
  15956. var data = scope.viewModel.data;
  15957. if (arg0) {
  15958. data = calcObjectFlat(data, arg0);
  15959. }
  15960. invokeServer$1(groovyUrl, data).then(function (res) {
  15961. if (res.success) {
  15962. if (res.msg) {
  15963. msg(res.msg);
  15964. }
  15965. if (typeof successCallback === 'function') {
  15966. successCallback.call(scope, sender, res.data);
  15967. }
  15968. }
  15969. else {
  15970. showErrorDialog$1(res.msg || '未知错误', sender);
  15971. }
  15972. }).catch(function (e) {
  15973. var _a, _b;
  15974. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15975. showErrorDialog$1(msg || e.toString(), sender);
  15976. }).finally(function () {
  15977. scope.setLoading(false);
  15978. });
  15979. };
  15980. };
  15981. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15982. return function (sender) {
  15983. var scope = lookupScope(sender);
  15984. var form = scope.down('form');
  15985. if (form) {
  15986. // 如果下级有表单,就做表单校验
  15987. var valid = form.isValid();
  15988. if (!valid) {
  15989. return;
  15990. }
  15991. }
  15992. scope.setLoading(true);
  15993. var data = scope.viewModel.data;
  15994. if (arg0) {
  15995. data = calcObjectFlat(data, arg0);
  15996. }
  15997. invokeServer$1(groovyUrl, data).then(function (res) {
  15998. if (res.success) {
  15999. if (res.msg) {
  16000. msg(res.msg);
  16001. }
  16002. scope.dialogSuccess(res);
  16003. }
  16004. else {
  16005. showErrorDialog$1(res.msg || '未知错误', sender);
  16006. }
  16007. }).catch(function (e) {
  16008. var _a, _b;
  16009. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  16010. showErrorDialog$1(msg || e.toString(), sender);
  16011. }).finally(function () {
  16012. scope.setLoading(false);
  16013. });
  16014. };
  16015. };
  16016. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16017. return function (sender) {
  16018. var scope = lookupScope(sender);
  16019. if (lookupObject) {
  16020. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16021. }
  16022. else {
  16023. scope.dialogSuccess();
  16024. }
  16025. };
  16026. };
  16027. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16028. return function (sender) {
  16029. var scope = lookupScope(sender);
  16030. clearViewModelValues(scope.viewModel, propertyName);
  16031. };
  16032. };
  16033. SystemEventFu.prototype.getGrid = function (url) {
  16034. return function (sender, config) {
  16035. if (config.xtype == "combogridmulti") {
  16036. // @ts-ignore
  16037. require([url], function (grid) {
  16038. _$2.forOwn(grid.default, function (v, k) {
  16039. sender[k] = v;
  16040. sender.config[k] = v;
  16041. if (sender.rendered) {
  16042. // 已经渲染出来了,重新调用 reload 强制刷新
  16043. sender.reload();
  16044. }
  16045. });
  16046. });
  16047. }
  16048. else {
  16049. // @ts-ignore
  16050. require([url], function (grid) {
  16051. sender.grid = grid.default;
  16052. config.grid = grid.default;
  16053. });
  16054. }
  16055. };
  16056. };
  16057. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16058. return function (sender) {
  16059. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16060. };
  16061. };
  16062. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16063. return function (sender) {
  16064. var _a, _b;
  16065. var scope = lookupScope(sender);
  16066. if (!gridRefName) {
  16067. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16068. }
  16069. else {
  16070. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16071. }
  16072. };
  16073. };
  16074. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16075. return function (sender) {
  16076. var scope = lookupScope(sender);
  16077. var data = scope.viewModel.data;
  16078. var param = calcObjectFlat(data, lookupForData);
  16079. // @ts-ignore
  16080. require([url], function (module) {
  16081. var ScopeClass = module.default;
  16082. var scope = new ScopeClass();
  16083. scope.success = successCallback;
  16084. scope.showDialog(sender, {}, { data: param });
  16085. });
  16086. };
  16087. };
  16088. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16089. return function (sender, queryValue) {
  16090. showWidget(widgetUrl, lookup, sender, queryValue);
  16091. };
  16092. };
  16093. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16094. return function (sender) {
  16095. clearViewModelByLookup(sender, lookup);
  16096. };
  16097. };
  16098. SystemEventFu.prototype.closeMe = function (callBack) {
  16099. return function (sender) {
  16100. var scope = lookupScope(sender);
  16101. scope.close();
  16102. if (callBack) {
  16103. callBack.call(sender);
  16104. }
  16105. };
  16106. };
  16107. // 未完成
  16108. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16109. return function (sender) {
  16110. var scope = lookupScope(sender);
  16111. var data = scope.viewModel.data;
  16112. var billSetting = scope.billSetting;
  16113. var param = calcObjectFlat(data, lookupForData);
  16114. return new Promise(function (resolve, reject) {
  16115. var sf = function (scope) {
  16116. scope.success = function (dlgScope, dlgSender, reData) {
  16117. };
  16118. scope.showDialog(sender, {}, { data: param });
  16119. };
  16120. // @ts-ignore
  16121. require([url], function (module) {
  16122. // 业务描述文件
  16123. if (url.endsWith(".bill")) {
  16124. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16125. sf(scope);
  16126. });
  16127. }
  16128. else { //原生yvanui文件
  16129. var ScopeClass = module.default;
  16130. var scope_1 = new ScopeClass();
  16131. sf(scope_1);
  16132. }
  16133. });
  16134. });
  16135. };
  16136. };
  16137. __decorate([
  16138. Lib({
  16139. title: '为某个表格,上移行',
  16140. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16141. }),
  16142. __metadata("design:type", Function),
  16143. __metadata("design:paramtypes", []),
  16144. __metadata("design:returntype", void 0)
  16145. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16146. __decorate([
  16147. Lib({
  16148. title: '为某个表格,上移行',
  16149. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16150. }),
  16151. __metadata("design:type", Function),
  16152. __metadata("design:paramtypes", []),
  16153. __metadata("design:returntype", void 0)
  16154. ], SystemEventFu.prototype, "commitMe", null);
  16155. __decorate([
  16156. Lib({
  16157. title: '为某个表格,下移行',
  16158. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16159. }),
  16160. __metadata("design:type", Function),
  16161. __metadata("design:paramtypes", []),
  16162. __metadata("design:returntype", void 0)
  16163. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16164. __decorate([
  16165. Lib({
  16166. title: '为某个表格,批量保存至数据库',
  16167. author: '罗一帆',
  16168. createAt: '2022-07-19',
  16169. updateAt: '2022-07-19',
  16170. type: 'system',
  16171. category: '表格',
  16172. }),
  16173. __metadata("design:type", Function),
  16174. __metadata("design:paramtypes", []),
  16175. __metadata("design:returntype", void 0)
  16176. ], SystemEventFu.prototype, "saveGridRow", null);
  16177. __decorate([
  16178. Lib({
  16179. title: '为某个表格插入数据行',
  16180. author: '罗一帆',
  16181. createAt: '2022-07-19',
  16182. updateAt: '2022-07-19',
  16183. type: 'system',
  16184. category: '表格',
  16185. }),
  16186. __metadata("design:type", Function),
  16187. __metadata("design:paramtypes", []),
  16188. __metadata("design:returntype", void 0)
  16189. ], SystemEventFu.prototype, "insertGridRow", null);
  16190. __decorate([
  16191. Lib({
  16192. title: '为某个表格删除所选数据行',
  16193. author: '罗一帆',
  16194. createAt: '2022-07-19',
  16195. updateAt: '2022-07-19',
  16196. type: 'system',
  16197. category: '表格',
  16198. }),
  16199. __metadata("design:type", Function),
  16200. __metadata("design:paramtypes", []),
  16201. __metadata("design:returntype", void 0)
  16202. ], SystemEventFu.prototype, "removeGridRow", null);
  16203. __decorate([
  16204. Lib({
  16205. title: '按下回车键之后默认是否按下某个按钮',
  16206. author: '罗一帆',
  16207. createAt: '2021-07-02',
  16208. updateAt: '2021-07-02',
  16209. type: 'system',
  16210. category: '字典',
  16211. }),
  16212. __metadata("design:type", Function),
  16213. __metadata("design:paramtypes", [Object]),
  16214. __metadata("design:returntype", void 0)
  16215. ], SystemEventFu.prototype, "enterToClick", null);
  16216. __decorate([
  16217. Lib({
  16218. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16219. author: '罗一帆',
  16220. createAt: '2021-07-06',
  16221. updateAt: '2021-07-06',
  16222. type: 'system',
  16223. category: '对话框',
  16224. }),
  16225. __param(0, LibParam('对话框的确认文字', 'string')),
  16226. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16227. __metadata("design:type", Function),
  16228. __metadata("design:paramtypes", [Object, Object]),
  16229. __metadata("design:returntype", void 0)
  16230. ], SystemEventFu.prototype, "confirm", null);
  16231. __decorate([
  16232. Lib({
  16233. title: '删除表格当前的选中行(前端删除)',
  16234. author: '罗一帆',
  16235. createAt: '2021-07-08',
  16236. updateAt: '2021-07-08',
  16237. type: 'system',
  16238. category: '表格',
  16239. }),
  16240. __param(0, LibParam('表格引用名', 'refs')),
  16241. __metadata("design:type", Function),
  16242. __metadata("design:paramtypes", [Object]),
  16243. __metadata("design:returntype", void 0)
  16244. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16245. __decorate([
  16246. Lib({
  16247. title: '查询表单,如果 url 为空值,就取消查询',
  16248. author: '罗一帆',
  16249. createAt: '2021-07-06',
  16250. updateAt: '2021-07-06',
  16251. type: 'system',
  16252. category: '表单',
  16253. }),
  16254. __param(0, LibParam('后端服务路径', 'string')),
  16255. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16256. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16257. __metadata("design:type", Function),
  16258. __metadata("design:paramtypes", [String, Object, Object]),
  16259. __metadata("design:returntype", void 0)
  16260. ], SystemEventFu.prototype, "loadForm", null);
  16261. __decorate([
  16262. Lib({
  16263. title: '提交(不做校验、不关闭窗体)',
  16264. author: '罗一帆',
  16265. createAt: '2021-07-02',
  16266. updateAt: '2021-07-02',
  16267. type: 'system',
  16268. category: '表单',
  16269. }),
  16270. __param(0, LibParam('后端服务路径', 'string')),
  16271. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16272. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16273. __metadata("design:type", Function),
  16274. __metadata("design:paramtypes", [String, Object, Object]),
  16275. __metadata("design:returntype", void 0)
  16276. ], SystemEventFu.prototype, "commit", null);
  16277. __decorate([
  16278. Lib({
  16279. title: '提交表单',
  16280. author: '罗一帆',
  16281. createAt: '2021-07-02',
  16282. updateAt: '2021-07-02',
  16283. type: 'system',
  16284. category: '表单',
  16285. }),
  16286. __param(0, LibParam('后端服务路径', 'string')),
  16287. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16288. __metadata("design:type", Function),
  16289. __metadata("design:paramtypes", [String, Object]),
  16290. __metadata("design:returntype", void 0)
  16291. ], SystemEventFu.prototype, "formCommit", null);
  16292. __decorate([
  16293. Lib({
  16294. title: '对话框成功回调',
  16295. author: '罗一帆',
  16296. createAt: '2021-07-02',
  16297. updateAt: '2021-07-02',
  16298. type: 'system',
  16299. category: '对话框',
  16300. }),
  16301. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16302. __metadata("design:type", Function),
  16303. __metadata("design:paramtypes", [Object]),
  16304. __metadata("design:returntype", void 0)
  16305. ], SystemEventFu.prototype, "dialogSuccess", null);
  16306. __decorate([
  16307. Lib({
  16308. title: '清空 viewModel 某个属性',
  16309. author: '罗一帆',
  16310. createAt: '2021-07-02',
  16311. updateAt: '2021-07-02',
  16312. type: 'system',
  16313. category: '表单',
  16314. }),
  16315. __param(0, LibParam('属性路径', 'viewModel', true)),
  16316. __metadata("design:type", Function),
  16317. __metadata("design:paramtypes", [String]),
  16318. __metadata("design:returntype", void 0)
  16319. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16320. __decorate([
  16321. Lib({
  16322. title: '从其他资源获取表格设置',
  16323. author: '罗一帆',
  16324. createAt: '2021-07-02',
  16325. updateAt: '2021-07-02',
  16326. type: 'system',
  16327. category: '表单',
  16328. }),
  16329. __param(0, LibParam('定义文件', 'module')),
  16330. __metadata("design:type", Function),
  16331. __metadata("design:paramtypes", [Object]),
  16332. __metadata("design:returntype", void 0)
  16333. ], SystemEventFu.prototype, "getGrid", null);
  16334. __decorate([
  16335. Lib({
  16336. title: '清空 viewModel 某个属性,并刷新表格',
  16337. author: '罗一帆',
  16338. createAt: '2021-07-02',
  16339. updateAt: '2021-07-02',
  16340. type: 'system',
  16341. category: '表单',
  16342. }),
  16343. __param(0, LibParam('清空的属性', 'viewModel')),
  16344. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16345. __metadata("design:type", Function),
  16346. __metadata("design:paramtypes", [String, String]),
  16347. __metadata("design:returntype", void 0)
  16348. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16349. __decorate([
  16350. Lib({
  16351. title: '刷新表格',
  16352. author: '罗一帆',
  16353. createAt: '2021-07-02',
  16354. updateAt: '2021-07-02',
  16355. type: 'system',
  16356. category: '表单',
  16357. }),
  16358. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16359. __metadata("design:type", Function),
  16360. __metadata("design:paramtypes", [String]),
  16361. __metadata("design:returntype", void 0)
  16362. ], SystemEventFu.prototype, "reloadGrid", null);
  16363. __decorate([
  16364. Lib({
  16365. title: '显示对话框',
  16366. author: '罗一帆',
  16367. createAt: '2021-07-02',
  16368. updateAt: '2021-07-02',
  16369. type: 'system',
  16370. category: '对话框',
  16371. }),
  16372. __param(0, LibParam('业务模块名', 'module')),
  16373. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16374. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16375. __metadata("design:type", Function),
  16376. __metadata("design:paramtypes", [String, Object, Object]),
  16377. __metadata("design:returntype", void 0)
  16378. ], SystemEventFu.prototype, "showDialog", null);
  16379. __decorate([
  16380. Lib({
  16381. title: '弹出查找框(不借助 search)',
  16382. author: '罗一帆',
  16383. createAt: '2021-07-02',
  16384. updateAt: '2021-07-02',
  16385. type: 'system',
  16386. category: '对话框',
  16387. }),
  16388. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16389. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16390. __metadata("design:type", Function),
  16391. __metadata("design:paramtypes", [Object, Object]),
  16392. __metadata("design:returntype", void 0)
  16393. ], SystemEventFu.prototype, "showWidget", null);
  16394. __decorate([
  16395. Lib({
  16396. title: '根据 lookup 清空 viewModel',
  16397. author: '罗一帆',
  16398. createAt: '2021-07-05',
  16399. updateAt: '2021-07-05',
  16400. type: 'system',
  16401. category: '表单',
  16402. }),
  16403. __param(0, LibParam('设值表达式', 'lookup')),
  16404. __metadata("design:type", Function),
  16405. __metadata("design:paramtypes", [Object]),
  16406. __metadata("design:returntype", void 0)
  16407. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16408. __decorate([
  16409. Lib({
  16410. title: '关闭对话框',
  16411. author: '罗一帆',
  16412. createAt: '2021-07-05',
  16413. updateAt: '2021-07-05',
  16414. type: 'system',
  16415. category: '对话框',
  16416. }),
  16417. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16418. __metadata("design:type", Function),
  16419. __metadata("design:paramtypes", [Object]),
  16420. __metadata("design:returntype", void 0)
  16421. ], SystemEventFu.prototype, "closeMe", null);
  16422. __decorate([
  16423. Lib({
  16424. title: '打开对话框并返回数据',
  16425. author: '余亮',
  16426. createAt: '2022-07-07',
  16427. updateAt: '2022-07-07',
  16428. type: 'system',
  16429. category: '对话框',
  16430. }),
  16431. __param(0, LibParam('业务模块名', 'module')),
  16432. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16433. __param(2, LibParam('结果映射关系', 'string', true)),
  16434. __metadata("design:type", Function),
  16435. __metadata("design:paramtypes", [String, Object, Object]),
  16436. __metadata("design:returntype", void 0)
  16437. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16438. return SystemEventFu;
  16439. }());
  16440. /**
  16441. * 清空 viewmodel 里下属的所有属性
  16442. * @param viewModel VM对象
  16443. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16444. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16445. */
  16446. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16447. var data = viewModel.data;
  16448. if (propertyKey) {
  16449. data = _$2.get(data, propertyKey);
  16450. }
  16451. _$2.forOwn(data, function (value, key) {
  16452. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16453. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16454. return;
  16455. }
  16456. viewModel.set(targetKey, '');
  16457. });
  16458. }
  16459. function clearViewModelByLookup(sender, lookup) {
  16460. if (_$2.isPlainObject(lookup)) {
  16461. var parentScope_1 = lookupScope(sender);
  16462. _$2.forOwn(lookup, function (value, key) {
  16463. if (SIMPLE_RE.test(value)) {
  16464. // '{foo}' 简单表达式
  16465. var path = value.substring(1, value.length - 1);
  16466. if (path !== 'queryValue') {
  16467. parentScope_1.viewModel.set(path, '');
  16468. }
  16469. }
  16470. });
  16471. }
  16472. }
  16473. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16474. if (vjson === void 0) { vjson = {}; }
  16475. var parentScope = lookupScope(sender);
  16476. var me = sender;
  16477. // @ts-ignore
  16478. require([widgetUrl], function (widgetScope) {
  16479. var WidgetScopeClass = widgetScope.default;
  16480. widgetScope = new WidgetScopeClass();
  16481. // 传递进 widget.model 的数据
  16482. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16483. widgetScope.parentScope = parentScope;
  16484. widgetScope.searchWidgetSuccess = function (data) {
  16485. if (typeof lookup === 'string') {
  16486. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16487. me.setValue(data[lookup]);
  16488. return;
  16489. }
  16490. /**
  16491. * lookup: {
  16492. * // 扩展到 viewModel 的值做更改
  16493. * WH_CODE: "{queryValue}",
  16494. * WH_NAME: "{query.WH_NAME}",
  16495. * }
  16496. */
  16497. if (_$2.isPlainObject(lookup)) {
  16498. var parentScope_2 = lookupScope(sender);
  16499. tryWriteObject(lookup, data, function (path, value) {
  16500. if (path === 'queryValue') {
  16501. me.setValue(value);
  16502. }
  16503. else {
  16504. parentScope_2.viewModel.set(path, value);
  16505. }
  16506. });
  16507. }
  16508. return true;
  16509. };
  16510. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16511. });
  16512. }
  16513. /**
  16514. * 停止事件的默认行为
  16515. * @param e
  16516. */
  16517. function stopEvent(e) {
  16518. e.preventDefault();
  16519. e.stopPropagation();
  16520. // @ts-ignore
  16521. window.event.cancelBubble = true;
  16522. e.returnValue = false;
  16523. e.cancelBubble = true;
  16524. }
  16525. /**
  16526. * 屏幕中央显示一个黑框提示
  16527. */
  16528. function msg$1(content) {
  16529. msg(content);
  16530. }
  16531. /**
  16532. * 错误对话框的强提醒
  16533. */
  16534. function showErrorDialog$1(msg, sender) {
  16535. showErrorDialog(msg, sender);
  16536. }
  16537. /**
  16538. * 错误对话框的强提醒
  16539. */
  16540. function showInfoDialog(msg, sender) {
  16541. showInfoDialogSimple(msg, sender);
  16542. }
  16543. /**
  16544. * 错误对话框的强提醒
  16545. */
  16546. function prompt$2(message, defaultValue, multiLine) {
  16547. if (defaultValue === void 0) { defaultValue = ""; }
  16548. if (multiLine === void 0) { multiLine = false; }
  16549. return prompt$1(message, defaultValue, multiLine);
  16550. }
  16551. /**
  16552. * 用于计算 express 表达式
  16553. */
  16554. function evalFunction(data, express) {
  16555. var keys = [];
  16556. var values = [];
  16557. _$2.forOwn(data, function (value, key) {
  16558. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16559. if (match) {
  16560. key = key.substring(0, match.index);
  16561. }
  16562. keys.push(key);
  16563. values.push(value);
  16564. });
  16565. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16566. try {
  16567. return func.apply(void 0, __spread(values));
  16568. }
  16569. catch (e) {
  16570. return;
  16571. }
  16572. }
  16573. /**
  16574. * 获取表格编辑的行数据
  16575. */
  16576. function getGridEditRows(grid) {
  16577. return grid.getGridEditRows();
  16578. }
  16579. //# sourceMappingURL=systemLib.js.map
  16580. var SystemLib = /*#__PURE__*/Object.freeze({
  16581. __proto__: null,
  16582. SIMPLE_RE: SIMPLE_RE,
  16583. pinyinMatch: pinyinMatch,
  16584. calcExpress: calcExpress,
  16585. calcObjectFlat: calcObjectFlat,
  16586. mergeViewModel: mergeViewModel,
  16587. flatRow: flatRow,
  16588. replaceNA: replaceNA,
  16589. deepTravJson: deepTravJson,
  16590. tryWriteByExpress: tryWriteByExpress,
  16591. tryWriteObject: tryWriteObject,
  16592. tryVarSimple: tryVarSimple,
  16593. calcObject: calcObject,
  16594. getParentGrid: getParentGrid,
  16595. tryEnable: tryEnable,
  16596. setComboStore: setComboStore,
  16597. invokeServer: invokeServer$1,
  16598. clearViewModelValues: clearViewModelValues,
  16599. reloadGrid: reloadGrid,
  16600. toPlainObject: toPlainObject,
  16601. confirm: confirm,
  16602. normId: normId,
  16603. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16604. saveGridRow: saveGridRow,
  16605. insertGridRow: insertGridRow,
  16606. commitMe: commitMe,
  16607. removeGridRow: removeGridRow,
  16608. moveUpGridRow: moveUpGridRow,
  16609. moveDownGridRow: moveDownGridRow,
  16610. SystemEventFu: SystemEventFu,
  16611. clearViewModel: clearViewModel,
  16612. clearViewModelByLookup: clearViewModelByLookup,
  16613. showWidget: showWidget,
  16614. stopEvent: stopEvent,
  16615. msg: msg$1,
  16616. showErrorDialog: showErrorDialog$1,
  16617. showInfoDialog: showInfoDialog,
  16618. prompt: prompt$2,
  16619. evalFunction: evalFunction,
  16620. getGridEditRows: getGridEditRows
  16621. });
  16622. function initTree () {
  16623. Ext.define('Yvan.Tree', {
  16624. extend: 'Ext.tree.Panel',
  16625. alias: 'widget.yvtree',
  16626. xtype: 'yvtree',
  16627. constructor: function (config) {
  16628. var newConfig = _$2.defaultsDeep({
  16629. // 强制性属性
  16630. }, baseConfig(config, 'row-item'), config, tree);
  16631. _$2.assign(newConfig, {
  16632. tbar: [
  16633. {
  16634. xtype: 'textfield',
  16635. // triggerCls: 'x-form-clear-trigger',
  16636. flex: 1,
  16637. emptyText: '搜索过滤',
  16638. enableKeyEvents: true,
  16639. listeners: {
  16640. change: function (sender) {
  16641. var tree = sender.up("treepanel");
  16642. tree.filterByText(this.getRawValue());
  16643. },
  16644. keyup: function (sender, e) {
  16645. var tree = sender.up("treepanel");
  16646. if (e.ESC === e.getKey()) {
  16647. sender.setValue('');
  16648. tree.filterByText('');
  16649. }
  16650. }
  16651. }
  16652. },
  16653. ],
  16654. });
  16655. if (!newConfig.hideRefresh) {
  16656. newConfig.tbar.push({
  16657. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16658. listeners: {
  16659. click: function (sender) {
  16660. var scope = sender.up("yvtree");
  16661. scope.reload();
  16662. }
  16663. }
  16664. });
  16665. }
  16666. if (!newConfig.hideExpand) {
  16667. newConfig.tbar.push({
  16668. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16669. listeners: {
  16670. click: function (sender) {
  16671. var scope = sender.up("yvtree");
  16672. scope.expandAll();
  16673. }
  16674. }
  16675. });
  16676. }
  16677. if (!newConfig.hideCollapse) {
  16678. newConfig.tbar.push({
  16679. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16680. listeners: {
  16681. click: function (sender) {
  16682. var scope = sender.up("yvtree");
  16683. scope.collapseAll();
  16684. }
  16685. }
  16686. });
  16687. }
  16688. this.superclass.constructor.call(this, newConfig);
  16689. },
  16690. /**
  16691. * 在根节点上增加一个节点,会触发 addNode 事件
  16692. * @param props
  16693. */
  16694. addRoot: function (props) {
  16695. var me = this;
  16696. var tableNode = me.getRootNode();
  16697. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16698. if (_$2.isFunction(props)) {
  16699. props = props.call(this, parent);
  16700. }
  16701. _$2.forOwn(props, function (value, key) {
  16702. fieldNode.set(key, value);
  16703. });
  16704. var node = tableNode.appendChild(fieldNode);
  16705. me.ensureVisible(node);
  16706. me.setSelection(node);
  16707. me.fireEvent('addNode', me, {
  16708. parent: tableNode,
  16709. node: node,
  16710. });
  16711. },
  16712. addLast: function (props) {
  16713. var me = this;
  16714. var sel = me.selModel.getSelection();
  16715. if (!sel || sel.length <= 0) {
  16716. msg('请选择一个要添加的同级节点路径');
  16717. return;
  16718. }
  16719. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16720. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16721. if (_$2.isFunction(props)) {
  16722. props = props.call(this, parent);
  16723. }
  16724. _$2.forOwn(props, function (value, key) {
  16725. fieldNode.set(key, value);
  16726. });
  16727. var node = parent.appendChild(fieldNode);
  16728. me.ensureVisible(node);
  16729. me.setSelection(node);
  16730. me.fireEvent('addNode', me, {
  16731. parent: parent,
  16732. node: node,
  16733. });
  16734. },
  16735. addChildren: function (props) {
  16736. var me = this;
  16737. var sel = me.selModel.getSelection();
  16738. if (!sel || sel.length <= 0) {
  16739. msg('请选择一个要添加子节点的路径');
  16740. return;
  16741. }
  16742. var parent = sel[0];
  16743. if (_$2.isFunction(props)) {
  16744. props = props.call(this, parent);
  16745. }
  16746. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16747. _$2.forOwn(props, function (value, key) {
  16748. fieldNode.set(key, value);
  16749. });
  16750. var node = parent.appendChild(fieldNode);
  16751. parent.expand();
  16752. me.ensureVisible(node);
  16753. me.setSelection(node);
  16754. me.fireEvent('addNode', me, {
  16755. parent: parent,
  16756. node: node,
  16757. });
  16758. },
  16759. initComponent: function () {
  16760. var me = this;
  16761. var config = me.config;
  16762. var scope = lookupScope(this);
  16763. if (!isDesignMode(scope, config)) {
  16764. // 转换 dataSource 属性
  16765. convertDataSource(me, scope, config);
  16766. }
  16767. this.superclass.initComponent.call(this);
  16768. this.on({
  16769. afterrender: function (sender) {
  16770. var me = this;
  16771. var config = this.config;
  16772. var dataSource = config.dataSource;
  16773. if (config.autoLoad) {
  16774. if (config.dataSourceCallbackFn) {
  16775. me.reload();
  16776. }
  16777. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16778. me.reload();
  16779. }
  16780. }
  16781. }
  16782. });
  16783. },
  16784. _setDataReal: function (value) {
  16785. var me = this;
  16786. // me.setStore(new Ext.data.TreeStore({
  16787. // root: {
  16788. // expanded: true,
  16789. // // children: value
  16790. // children: [
  16791. // {
  16792. // id: '1', text: 'A',
  16793. // children: [
  16794. // {id: '1', text: 'A',},
  16795. // {id: '2', text: 'B'},
  16796. // ]
  16797. // },
  16798. // {id: '2', text: 'B'},
  16799. // ]
  16800. // }
  16801. // }))
  16802. me.store.setRoot({
  16803. expanded: true,
  16804. children: value
  16805. });
  16806. // me.store = new Ext.data.TreeStore({
  16807. // root: {
  16808. // expanded: true,
  16809. // // children: value
  16810. // children: [
  16811. // {
  16812. // id: '1', text: 'A',
  16813. // children: [
  16814. // {id: '1', text: 'A',},
  16815. // {id: '2', text: 'B'},
  16816. // ]
  16817. // },
  16818. // {id: '2', text: 'B'},
  16819. // ]
  16820. // }
  16821. // })
  16822. },
  16823. /**
  16824. * 重新载入数据(重新计算参数)
  16825. */
  16826. reload: function (reloadParams) {
  16827. if (reloadParams === void 0) { reloadParams = {}; }
  16828. var me = this;
  16829. var config = me.config;
  16830. if (config.dataSourceCallbackFn) {
  16831. // 函数请求刷新
  16832. var scope_1 = lookupScope(this);
  16833. // me.setLoading(true)
  16834. config.dataSourceCallbackFn.call(scope_1, me, {
  16835. successCallback: function (value) {
  16836. me._setDataReal(value);
  16837. // me.setLoading(false)
  16838. me.fireEvent('dataLoadComplete', me, true, value);
  16839. },
  16840. failCallback: function (error) {
  16841. // me.setLoading(false)
  16842. me.fireEvent('dataLoadComplete', me, false, error);
  16843. }
  16844. });
  16845. return;
  16846. }
  16847. var scope = lookupScope(me);
  16848. var dataSource = config.dataSource;
  16849. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16850. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16851. me.setLoading(true);
  16852. invokeServer$1(dataSource.url, params)
  16853. .then(function (res) {
  16854. me._setDataReal(res.data);
  16855. me.fireEvent('dataLoadComplete', me, res);
  16856. })
  16857. .finally(function () {
  16858. me.setLoading(false);
  16859. });
  16860. }
  16861. },
  16862. filterByText: function (text) {
  16863. this._filterText = text;
  16864. this._filterBy(this, text, 'text');
  16865. },
  16866. _filterBy: _$2.debounce(function (me, text, by) {
  16867. var view = me.getView();
  16868. me.store.clearFilter();
  16869. if (!me._filterText) {
  16870. // 没有筛选内容,还原状态
  16871. var selections = me.getSelection();
  16872. var selectionPaths_1 = [];
  16873. _$2.forEach(me.getSelection(), function (item) {
  16874. selectionPaths_1.push(item.getPath());
  16875. });
  16876. me.collapseAll();
  16877. _$2.forEach(selectionPaths_1, function (path) {
  16878. me.expandPath(path);
  16879. });
  16880. me.setSelection(selections);
  16881. return;
  16882. }
  16883. // 递归查找所有需要可见的节点 id 数组
  16884. var nodesAndParents = [];
  16885. var expandPaths = [];
  16886. me.getRootNode().cascadeBy(function (tree, view) {
  16887. var currNode = this;
  16888. currNode.collapse();
  16889. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16890. // 展开到匹配的路径
  16891. // me.expandPath(currNode.getPath());
  16892. expandPaths.push(currNode.getPath());
  16893. // 沿途父节点全部设定为可见
  16894. while (currNode.parentNode) {
  16895. nodesAndParents.push(currNode.id);
  16896. currNode = currNode.parentNode;
  16897. }
  16898. }
  16899. }, null, [me, view]);
  16900. me.store.filterBy(function (r) {
  16901. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16902. });
  16903. _$2.forEach(expandPaths, function (path) {
  16904. me.expandPath(path);
  16905. });
  16906. }, 1000),
  16907. });
  16908. }
  16909. function convertDataSource(sender, scope, newConfig) {
  16910. if (typeof newConfig.store !== 'undefined') {
  16911. // 有 store 属性的情况下,不做任何事
  16912. return;
  16913. }
  16914. if (typeof newConfig.dataSource === 'undefined') {
  16915. // 没有定义 dataSource 的情况下,不做任何事
  16916. return;
  16917. }
  16918. var dataSource = newConfig.dataSource;
  16919. if (typeof dataSource === 'string') {
  16920. // dataSource 是字符串的情况下,找到成员函数
  16921. dataSource = lookupFn(scope, dataSource);
  16922. }
  16923. if (typeof dataSource === 'function') {
  16924. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16925. newConfig.store = new Ext.data.TreeStore({
  16926. root: {
  16927. expanded: true,
  16928. children: []
  16929. }
  16930. });
  16931. newConfig.dataSourceCallbackFn = dataSource;
  16932. return;
  16933. }
  16934. // throw new TypeError('无法识别的调用方法')
  16935. }
  16936. //# sourceMappingURL=yvtree.js.map
  16937. /**
  16938. * 构建一个 grid 支持的 dataSource
  16939. */
  16940. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16941. if (reloadParams === void 0) { reloadParams = {}; }
  16942. if (isExcelExport === void 0) { isExcelExport = false; }
  16943. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16944. var _a;
  16945. var me = grid;
  16946. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16947. var storeOption = {};
  16948. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16949. if (dataSource.sqlId) {
  16950. dataSource.method = 'invoke';
  16951. dataSource.url = '/Dev@executeSQL';
  16952. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16953. // sqlId 是 @ 开头,代表直接带中文名
  16954. var scope_1 = lookupScope(grid);
  16955. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16956. params.sqlId = dataSource.sqlId.substring(1);
  16957. }
  16958. else {
  16959. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16960. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16961. params.path = path;
  16962. params.sqlId = sqlId;
  16963. }
  16964. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16965. }
  16966. var fields_1 = [];
  16967. _$2.forEach(grid.columns, function (col) {
  16968. var c = {};
  16969. if (col.dataIndex) {
  16970. c.name = col.dataIndex;
  16971. fields_1.push(c);
  16972. }
  16973. if (col.dataType) {
  16974. c.type = col.dataType;
  16975. }
  16976. });
  16977. // 默认支持 gridInvoke
  16978. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16979. //@ts-ignore
  16980. storeOption = {
  16981. fields: fields_1,
  16982. remoteSort: config.remoteSort,
  16983. remoteFilter: config.remoteFilter,
  16984. autoLoad: true,
  16985. pageSize: me.store.pageSize || config.pageSize,
  16986. proxy: {
  16987. type: 'jsonAjax',
  16988. $owner: me,
  16989. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16990. extraParams: extraParams,
  16991. reader: {
  16992. type: 'json',
  16993. rootProperty: 'data',
  16994. totalProperty: 'pagination.total',
  16995. successProperty: 'success',
  16996. messageProperty: 'msg',
  16997. transform: function (data) {
  16998. if (typeof window['ajaxProcess'] === 'function') {
  16999. window['ajaxProcess'](data);
  17000. }
  17001. if (typeof window['apiTranslate'] === 'function') {
  17002. window['apiTranslate'](data, dataSource.url);
  17003. }
  17004. if (typeof grid._transform === 'function') {
  17005. // 系统转换函数
  17006. grid._transform(data.data);
  17007. }
  17008. if (grid.dataTransform) {
  17009. if (typeof grid.dataTransform === 'string') {
  17010. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17011. }
  17012. return grid.dataTransform.call(scope, grid, data);
  17013. }
  17014. return data;
  17015. }
  17016. }
  17017. },
  17018. listeners: {
  17019. load: function (store, records, successful, operation) {
  17020. var _a, _b, _c;
  17021. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17022. if (rep.pagination) {
  17023. grid.dbInfo = rep.pagination.dbInfo;
  17024. grid.exportDataSql = rep.pagination.exportDataSql;
  17025. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17026. }
  17027. me.exportExcelTotal = ((_b = rep === null || rep === void 0 ? void 0 : rep.pagination) === null || _b === void 0 ? void 0 : _b.total) || ((_c = rep === null || rep === void 0 ? void 0 : rep.data) === null || _c === void 0 ? void 0 : _c.length) || 0;
  17028. if (isExcelExport) {
  17029. if (typeof excelExportCallBack === 'function') {
  17030. excelExportCallBack(rep);
  17031. }
  17032. else if (excelExportCallBack) {
  17033. console.error("导出回调方法错误!");
  17034. }
  17035. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17036. }
  17037. else {
  17038. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17039. // 自动选中第一行
  17040. var data = grid.getStore().data;
  17041. if (data.length > 0) {
  17042. grid.setSelection(data.items[0]);
  17043. }
  17044. }
  17045. me.fireEvent('dataLoadComplete', me, successful, records);
  17046. }
  17047. }
  17048. }
  17049. };
  17050. }
  17051. else if (exports.apiConvert) {
  17052. // 外部扩展的 apiConvert
  17053. //@ts-ignore
  17054. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17055. }
  17056. else {
  17057. throw new TypeError("不支持的 API 请求方式");
  17058. }
  17059. if (isExcelExport) {
  17060. var excelStore = new Ext.data.Store(storeOption);
  17061. excelStore.load();
  17062. }
  17063. else {
  17064. if (me.groupField) {
  17065. console.log('groupField', storeOption.groupField);
  17066. storeOption.groupField = me.groupField;
  17067. }
  17068. me.setStore(new Ext.data.Store(storeOption));
  17069. }
  17070. }
  17071. function initStores () {
  17072. Ext.define('Yvan.JsonAjaxProxy', {
  17073. extend: 'Ext.data.proxy.Ajax',
  17074. alias: 'proxy.jsonAjax',
  17075. actionMethods: {
  17076. create: "POST",
  17077. read: "POST",
  17078. update: "POST",
  17079. destroy: "POST"
  17080. },
  17081. timeout: storeAjax.timeout,
  17082. buildRequest: function (operation) {
  17083. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17084. var me = this;
  17085. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17086. var scope = lookupScope($owner);
  17087. var gridParam = me.getParams(operation);
  17088. var customParam = {};
  17089. // 提取 srot 元素
  17090. if (gridParam.sort) {
  17091. var sort = JSON.parse(gridParam.sort);
  17092. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17093. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17094. customParam.sortModel = [];
  17095. _$2.forEach(sort, function (s) {
  17096. customParam.sortModel.push({
  17097. colId: s.property,
  17098. sort: _$2.toLower(s.direction)
  17099. });
  17100. });
  17101. delete gridParam.sort;
  17102. }
  17103. // 提取筛选元素
  17104. if (gridParam.filter) {
  17105. var filter = JSON.parse(gridParam.filter);
  17106. console.log('gridParam.filter', gridParam.filter);
  17107. // "[{"operator":"like","value":"1","property":"id"}]"
  17108. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17109. customParam.filterModel = {};
  17110. _$2.forEach(filter, function (s) {
  17111. var newFilterItem = {};
  17112. if (s.operator === 'like') {
  17113. newFilterItem.filterType = 'text';
  17114. newFilterItem.type = 'contains';
  17115. newFilterItem.filter = s.value;
  17116. }
  17117. else {
  17118. // 无法识别的筛选类型
  17119. newFilterItem.filterType = 'dict';
  17120. newFilterItem.type = 'in';
  17121. newFilterItem.filter = s.value;
  17122. }
  17123. customParam.filterModel[s.property] = newFilterItem;
  17124. });
  17125. delete gridParam.filter;
  17126. }
  17127. // 被 grid.constructor 作为方法存在
  17128. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17129. var params = _$2.defaultsDeep(gridParam, extraParams);
  17130. // var request = this.superclass.buildRequest.apply(this, arguments);
  17131. var request = new Ext.data.Request({
  17132. params: {},
  17133. action: operation.getAction(),
  17134. records: operation.getRecords(),
  17135. url: me.buildUrl(),
  17136. jsonData: __assign({ args: [
  17137. params
  17138. ] }, customParam),
  17139. proxy: me
  17140. });
  17141. operation.setRequest(request);
  17142. return request;
  17143. },
  17144. afterRequest: function (req, res) {
  17145. // Extend.afterExtRequest(req, res)
  17146. }
  17147. });
  17148. Ext.define('Ext.ux.data.MyReader', {
  17149. extend: 'Ext.data.reader.Json',
  17150. xtype: 'yvgridreader',
  17151. useSimpleAccessors: false,
  17152. });
  17153. }
  17154. //# sourceMappingURL=stores.js.map
  17155. function initBehaviorEdit(config) {
  17156. var _a, _b, _c;
  17157. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17158. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17159. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17160. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17161. if (dbTableName) {
  17162. // 生成增删查改
  17163. var tbar = [
  17164. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17165. click: 'system.saveGridRow()'
  17166. }, bind: {
  17167. disabled: '{!' + config.reference + '.ischanged}'
  17168. } }, saveButtonConfig),
  17169. '-',
  17170. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17171. click: 'system.insertGridRow()'
  17172. } }, addButtonConfig),
  17173. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17174. click: 'system.removeGridRow()'
  17175. } }, deleteButtonConfig),
  17176. ];
  17177. if (_$2.isArray(config.tbar)) {
  17178. config.tbar = __spread(tbar, [
  17179. '-'
  17180. ], config.tbar);
  17181. }
  17182. else if (_$2.isPlainObject(config.tbar)) {
  17183. config.tbar = {
  17184. border: false,
  17185. layout: {
  17186. type: 'vbox',
  17187. align: 'stretch'
  17188. },
  17189. items: [
  17190. {
  17191. xtype: 'toolbar',
  17192. border: false,
  17193. items: tbar
  17194. },
  17195. config.tbar,
  17196. ]
  17197. };
  17198. }
  17199. else if (_$2.isUndefined(config.tbar)) {
  17200. config.tbar = tbar;
  17201. }
  17202. else {
  17203. console.error("can't build tbar property!", config.tbar);
  17204. }
  17205. }
  17206. }
  17207. //# sourceMappingURL=grid_behavior.js.map
  17208. function initGridDialog(config) {
  17209. var detailDialog = _$2.get(config, 'detailDialog');
  17210. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17211. if (_$2.isPlainObject(detailDialog)) {
  17212. var tbar = [
  17213. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17214. click: 'system.showGridRowDetail()',
  17215. }, bind: {
  17216. disabled: '{!' + config.reference + '.selection}'
  17217. } }, detailButtonConfig)
  17218. ];
  17219. if (_$2.isArray(config.tbar)) {
  17220. config.tbar = __spread(config.tbar, [
  17221. '-'
  17222. ], tbar);
  17223. }
  17224. else if (_$2.isPlainObject(config.tbar)) {
  17225. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17226. config.tbar.items = __spread(config.tbar.items);
  17227. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17228. if (!toolbar) {
  17229. config.tbar.items = __spread(config.tbar.items, [
  17230. {
  17231. xtype: 'toolbar',
  17232. border: false,
  17233. items: tbar
  17234. },
  17235. ]);
  17236. }
  17237. else {
  17238. toolbar.items = __spread(toolbar.items, [
  17239. '-'
  17240. ], tbar);
  17241. }
  17242. }
  17243. else {
  17244. config.tbar = {
  17245. border: false,
  17246. layout: {
  17247. type: 'vbox',
  17248. align: 'stretch'
  17249. },
  17250. items: [
  17251. {
  17252. xtype: 'toolbar',
  17253. border: false,
  17254. items: tbar
  17255. },
  17256. config.tbar,
  17257. ]
  17258. };
  17259. }
  17260. }
  17261. else if (_$2.isUndefined(config.tbar)) {
  17262. config.tbar = tbar;
  17263. }
  17264. else {
  17265. console.error("can't build tbar property!", config.tbar);
  17266. }
  17267. }
  17268. }
  17269. var SystemEventFu$1 = /** @class */ (function () {
  17270. function SystemEventFu() {
  17271. }
  17272. SystemEventFu.prototype.showGridRowDetail = function () {
  17273. return function (sender) {
  17274. var grid1 = sender.up('yvgrid');
  17275. showGridRowDetail(grid1);
  17276. };
  17277. };
  17278. __decorate([
  17279. Lib({
  17280. title: '为某个表格所选数据行, 显示其对话框',
  17281. author: '罗一帆',
  17282. createAt: '2022-07-27',
  17283. updateAt: '2022-07-27',
  17284. type: 'system',
  17285. category: '表格',
  17286. }),
  17287. __metadata("design:type", Function),
  17288. __metadata("design:paramtypes", []),
  17289. __metadata("design:returntype", void 0)
  17290. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17291. return SystemEventFu;
  17292. }());
  17293. function showGridRowDetail(grid1, isEdit) {
  17294. if (isEdit === void 0) { isEdit = true; }
  17295. var _a, _b, _c;
  17296. if (!grid1.selection) {
  17297. msg$1('请选中要展示的数据行!');
  17298. return;
  17299. }
  17300. var record = grid1.selection;
  17301. if (_$2.isArray(record)) {
  17302. record = record[0];
  17303. }
  17304. if (!record) {
  17305. msg$1('请选中要展示的数据行!');
  17306. return;
  17307. }
  17308. var config = grid1._originVJson;
  17309. var detailDialog = config.detailDialog;
  17310. var vjson = {};
  17311. var parentScope = lookupScope(grid1);
  17312. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17313. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17314. _$2.defaultsDeep(vjson, {
  17315. // 强制属性
  17316. layout: 'fit',
  17317. __custom_path: __custom_path,
  17318. __custom_version: __custom_version,
  17319. fbar: __spread([
  17320. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17321. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17322. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17323. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17324. }, detailDialog, {
  17325. // 默认属性
  17326. width: 800,
  17327. height: 450,
  17328. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17329. });
  17330. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17331. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17332. vjson.items.push(tabpanel);
  17333. if (tabpanel) {
  17334. // 有多个选项卡,按每个选项卡进行过滤
  17335. _$2.forEach(tabpanel.items, function (tab) {
  17336. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17337. if (tabColumns.length > 0) {
  17338. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17339. _$2.extend(tab, tabVjson);
  17340. }
  17341. });
  17342. }
  17343. }
  17344. else {
  17345. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17346. }
  17347. var model = {
  17348. data: {
  17349. _edit: isEdit,
  17350. _editType: isEdit ? '编辑' : '添加',
  17351. }
  17352. };
  17353. _$2.forOwn(record.data, function (value, key) {
  17354. if (key === 'id') {
  17355. // 忽略 ID 属性
  17356. return;
  17357. }
  17358. if (_$2.startsWith(key, '_')) {
  17359. // 忽略 _ 开头的所有属性
  17360. return;
  17361. }
  17362. model.data[key] = value;
  17363. });
  17364. console.log(vjson);
  17365. var scope = new Scope({ vjson: vjson, model: model, });
  17366. //@ts-ignore
  17367. scope.commit = function () {
  17368. return new Promise(function (resolve) {
  17369. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17370. if (_$2.startsWith(key, '_')) {
  17371. // _origin 等属性可以被忽略
  17372. return;
  17373. }
  17374. if (key === 'id') {
  17375. // id 属性被忽略
  17376. return;
  17377. }
  17378. record.set(key, value);
  17379. });
  17380. resolve();
  17381. });
  17382. };
  17383. scope.showDialog(grid1, {}, {});
  17384. }
  17385. function buildForm(columns, tabpanel, detailDialog) {
  17386. var vjson = __assign({ border: false, layout: {
  17387. type: 'vbox',
  17388. pack: 'start',
  17389. align: 'stretch'
  17390. }, defaults: {
  17391. border: false,
  17392. anchor: '100%',
  17393. margin: '5',
  17394. }, scrollable: true, items: [] }, detailDialog.form);
  17395. var emptyFieldset = [];
  17396. var fieldsetList = [];
  17397. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17398. _$2.forEach(columns, function (c) {
  17399. var fieldset = _$2.get(c, 'form.fieldset');
  17400. if (fieldset) {
  17401. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17402. if (idx < 0) {
  17403. fieldsetList.push({
  17404. fieldset: fieldset,
  17405. columns: [c]
  17406. });
  17407. }
  17408. else {
  17409. fieldsetList[idx].columns.push(c);
  17410. }
  17411. }
  17412. else {
  17413. emptyFieldset.push(c);
  17414. }
  17415. });
  17416. _$2.forEach(fieldsetList, function (fs) {
  17417. var fieldSetVjson = {
  17418. xtype: 'fieldset',
  17419. title: fs.fieldset,
  17420. items: []
  17421. };
  17422. buildFieldItems(fieldSetVjson.items, fs.columns);
  17423. vjson.items.push(fieldSetVjson);
  17424. });
  17425. buildFieldItems(vjson.items, emptyFieldset);
  17426. return vjson;
  17427. }
  17428. // 构建字段组
  17429. function buildFieldItems(items, columns) {
  17430. var _a, _b, _c, _d, _e;
  17431. var row = {
  17432. xtype: 'cols',
  17433. items: []
  17434. };
  17435. for (var i = 0; i < columns.length; i++) {
  17436. var column = columns[i];
  17437. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17438. delete row.xtype;
  17439. row.layout = column.form.rowlayout;
  17440. }
  17441. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17442. row.items.push({ border: false, flex: column.form.prefix });
  17443. }
  17444. var fieldVjson = buildField(column, row.items.length);
  17445. if (!fieldVjson) {
  17446. continue;
  17447. }
  17448. row.items.push(fieldVjson);
  17449. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17450. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17451. }
  17452. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17453. items.push(row);
  17454. row = {
  17455. xtype: 'cols',
  17456. items: []
  17457. };
  17458. }
  17459. }
  17460. if (row.items.length > 0) {
  17461. items.push(row);
  17462. }
  17463. }
  17464. // 构建字段
  17465. function buildField(column, colIdx) {
  17466. var ret;
  17467. if (column.xtype === 'checkcolumn') {
  17468. ret = _$2.defaultsDeep({
  17469. xtype: 'checkbox',
  17470. uncheckedValue: column.uncheckedValue,
  17471. checkedValue: column.checkedValue,
  17472. boxLabel: column.header,
  17473. bind: {
  17474. value: '{' + column.dataIndex + '}'
  17475. }
  17476. }, column.form);
  17477. if (colIdx == 0) {
  17478. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17479. ret.margin = '0 0 0 85';
  17480. }
  17481. }
  17482. else {
  17483. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17484. fieldLabel: column.header,
  17485. bind: {
  17486. value: '{' + column.dataIndex + '}'
  17487. },
  17488. });
  17489. }
  17490. if (!ret.xtype) {
  17491. return;
  17492. }
  17493. if (!ret.dict && ret.xtype === 'combo') {
  17494. ret.dict = column.dict;
  17495. }
  17496. // 删除辅助属性
  17497. delete ret.order;
  17498. delete ret.wrap;
  17499. return ret;
  17500. }
  17501. //# sourceMappingURL=grid_dialog.js.map
  17502. var model$c = {
  17503. data: {}
  17504. };
  17505. //# sourceMappingURL=GridColumnCustom.model.js.map
  17506. var vjson$c = {
  17507. title: '自定义表格属性',
  17508. layout: 'fit',
  17509. width: 980,
  17510. height: 500,
  17511. fbar: [
  17512. {
  17513. xtype: "button",
  17514. text: "保存",
  17515. iconCls: 'x-fa fa-save',
  17516. listeners: {
  17517. click: 'scope.commit',
  17518. }
  17519. },
  17520. {
  17521. xtype: "button",
  17522. text: "关闭",
  17523. iconCls: 'x-fa fa-times',
  17524. listeners: {
  17525. click: 'system.closeMe()',
  17526. }
  17527. },
  17528. ],
  17529. items: [
  17530. {
  17531. region: 'center',
  17532. xtype: 'tabpanel',
  17533. items: [
  17534. {
  17535. title: '基本信息', reference: 'basic',
  17536. layout: {
  17537. type: 'vbox',
  17538. pack: 'start',
  17539. align: 'stretch'
  17540. },
  17541. defaults: {
  17542. border: false,
  17543. anchor: '100%',
  17544. margin: '5',
  17545. },
  17546. scrollable: true,
  17547. items: [
  17548. {
  17549. xtype: 'cols',
  17550. items: [
  17551. {
  17552. fieldLabel: '路径',
  17553. bind: { value: '{__custom_path}' },
  17554. xtype: 'textfield',
  17555. flex: 2,
  17556. },
  17557. {
  17558. fieldLabel: '版本',
  17559. bind: { value: '{__custom_version}' },
  17560. xtype: 'textfield',
  17561. },
  17562. ]
  17563. },
  17564. {
  17565. xtype: 'cols',
  17566. items: [
  17567. {
  17568. fieldLabel: '配置点',
  17569. bind: { value: '{__custom_point}' },
  17570. xtype: 'textfield',
  17571. },
  17572. {
  17573. fieldLabel: 'reference',
  17574. bind: { value: '{reference}' },
  17575. xtype: 'textfield',
  17576. },
  17577. {
  17578. fieldLabel: '编辑模式',
  17579. bind: { value: '{_mode}' },
  17580. xtype: 'combo',
  17581. dict: 'GRID_MODE',
  17582. },
  17583. ]
  17584. },
  17585. {
  17586. layout: 'hbox',
  17587. defaults: {
  17588. margin: '0 0 0 15',
  17589. },
  17590. items: [
  17591. {
  17592. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17593. bind: {
  17594. value: "{hideFootbar}"
  17595. }
  17596. },
  17597. {
  17598. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17599. bind: {
  17600. value: "{hideRefresh}"
  17601. }
  17602. },
  17603. {
  17604. boxLabel: '隐藏导出', xtype: 'checkbox',
  17605. bind: {
  17606. value: "{hideExport}"
  17607. }
  17608. },
  17609. {
  17610. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17611. bind: {
  17612. value: "{hideAutoSize}"
  17613. }
  17614. },
  17615. {
  17616. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17617. bind: {
  17618. value: "{hideClearFilter}"
  17619. }
  17620. },
  17621. {
  17622. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17623. bind: {
  17624. value: "{hideSaveGridUIConfig}"
  17625. }
  17626. },
  17627. {
  17628. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17629. bind: {
  17630. value: "{hideClearGridUIConfig}"
  17631. }
  17632. },
  17633. ]
  17634. },
  17635. {
  17636. layout: 'hbox',
  17637. defaults: {
  17638. margin: '0 0 0 15',
  17639. },
  17640. items: [
  17641. {
  17642. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17643. bind: { value: '{autoLoad}' },
  17644. margin: '0 0 0 85',
  17645. },
  17646. {
  17647. boxLabel: '分页模式', xtype: 'checkbox',
  17648. bind: { value: '{pagination}' },
  17649. },
  17650. {
  17651. boxLabel: '显示行序号', xtype: 'checkbox',
  17652. bind: { value: '{show_rownum}' },
  17653. },
  17654. {
  17655. boxLabel: '后端排序', xtype: 'checkbox',
  17656. bind: {
  17657. value: "{remoteSort}"
  17658. }
  17659. },
  17660. {
  17661. boxLabel: '后端过滤', xtype: 'checkbox',
  17662. bind: {
  17663. value: "{remoteFilter}"
  17664. }
  17665. },
  17666. {
  17667. boxLabel: '隐藏', xtype: 'checkbox',
  17668. bind: {
  17669. value: "{hidden}"
  17670. }
  17671. },
  17672. ]
  17673. },
  17674. {
  17675. layout: 'hbox',
  17676. defaults: {
  17677. margin: '0 0 0 15',
  17678. },
  17679. items: [
  17680. {
  17681. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17682. bind: {
  17683. value: "{enableColumnHide}"
  17684. }
  17685. },
  17686. {
  17687. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17688. bind: {
  17689. value: "{enableColumnMove}"
  17690. }
  17691. },
  17692. {
  17693. boxLabel: '自定义筛选', xtype: 'checkbox',
  17694. bind: {
  17695. value: "{gridfilters}"
  17696. }
  17697. },
  17698. {
  17699. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17700. bind: {
  17701. value: "{enableColumnResize}"
  17702. }
  17703. },
  17704. {
  17705. boxLabel: '点击列头排序', xtype: 'checkbox',
  17706. bind: {
  17707. value: "{sortOnClick}"
  17708. }
  17709. },
  17710. ]
  17711. },
  17712. {
  17713. xtype: 'cols',
  17714. items: [
  17715. {
  17716. fieldLabel: 'dbTableName',
  17717. labelWidth: 110,
  17718. bind: { value: '{behavior.dbTableName}' },
  17719. xtype: 'textfield',
  17720. },
  17721. {
  17722. fieldLabel: 'theid',
  17723. bind: { value: '{theid}' },
  17724. xtype: 'textfield',
  17725. },
  17726. {
  17727. fieldLabel: '添加行聚焦',
  17728. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17729. xtype: 'textfield',
  17730. },
  17731. ]
  17732. },
  17733. {
  17734. xtype: 'cols',
  17735. items: [
  17736. {
  17737. fieldLabel: '批量删除提示',
  17738. labelWidth: 110,
  17739. bind: { value: '{behavior.batchRemoveConfirm}' },
  17740. xtype: 'textfield',
  17741. },
  17742. {
  17743. fieldLabel: '删除提示',
  17744. bind: { value: '{behavior.singleRemoveConfirm}' },
  17745. xtype: 'textfield',
  17746. },
  17747. {
  17748. fieldLabel: '触发刷新',
  17749. labelWidth: 110,
  17750. bind: { value: '{behavior.selectToReload}' },
  17751. xtype: 'textfield',
  17752. },
  17753. ]
  17754. },
  17755. ]
  17756. },
  17757. {
  17758. title: '字段', reference: 'grid1',
  17759. xtype: 'yvgrid',
  17760. pagination: false,
  17761. _mode: 'edit',
  17762. listeners: {
  17763. buttonclick: 'scope.grid1Buttonclick',
  17764. },
  17765. hideFootbar: true,
  17766. tbar: [
  17767. {
  17768. xtype: 'button',
  17769. text: '添加',
  17770. iconCls: 'x-fa fa-plus-circle',
  17771. listeners: {
  17772. click: 'scope.addField'
  17773. }
  17774. },
  17775. {
  17776. xtype: 'button',
  17777. text: '删除',
  17778. iconCls: 'x-fa fa-minus-circle',
  17779. listeners: {
  17780. click: 'scope.removeField'
  17781. }
  17782. },
  17783. '-',
  17784. {
  17785. xtype: 'button',
  17786. text: '自动分析',
  17787. iconCls: 'x-fa fa-code-fork',
  17788. listeners: {
  17789. click: 'scope.calcField'
  17790. }
  17791. },
  17792. {
  17793. xtype: 'button',
  17794. text: '上移',
  17795. iconCls: 'x-fa fa-arrow-up',
  17796. listeners: {
  17797. click: 'scope.moveUp'
  17798. }
  17799. },
  17800. {
  17801. xtype: 'button',
  17802. text: '下移',
  17803. iconCls: 'x-fa fa-arrow-down',
  17804. listeners: {
  17805. click: 'scope.moveDown'
  17806. }
  17807. },
  17808. ],
  17809. store: {},
  17810. columns: [
  17811. {
  17812. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17813. editor: { xtype: 'textfield' }
  17814. },
  17815. {
  17816. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17817. editor: { xtype: 'textfield' }
  17818. },
  17819. {
  17820. dataIndex: 'header', header: '中文', width: 140,
  17821. editor: { xtype: 'textfield' }
  17822. },
  17823. {
  17824. dataIndex: 'dict', header: '字典', width: 110,
  17825. editor: { xtype: 'combogrid' }
  17826. },
  17827. {
  17828. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17829. editor: { xtype: 'combogrid' }, hidden: true,
  17830. },
  17831. {
  17832. dataIndex: 'width', header: '宽度', width: 80,
  17833. editor: { xtype: 'numberfield' }, hidden: true,
  17834. },
  17835. {
  17836. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17837. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17838. },
  17839. {
  17840. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17841. editor: { xtype: 'textfield' },
  17842. },
  17843. {
  17844. dataIndex: 'createValue', text: '客户端新创建值',
  17845. editor: { xtype: 'textfield' },
  17846. },
  17847. {
  17848. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17849. resizable: false, sortable: false, menuDisabled: true,
  17850. checkedValue: true, uncheckedValue: false,
  17851. },
  17852. {
  17853. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17854. resizable: false, sortable: false, menuDisabled: true,
  17855. checkedValue: true, uncheckedValue: false,
  17856. },
  17857. {
  17858. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17859. resizable: false, sortable: false, menuDisabled: true,
  17860. checkedValue: true, uncheckedValue: false,
  17861. },
  17862. {
  17863. dataIndex: 'formatter', header: '格式化', width: 110,
  17864. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17865. },
  17866. {
  17867. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17868. resizable: false, sortable: false, menuDisabled: true,
  17869. checkedValue: true, uncheckedValue: false, hidden: true,
  17870. },
  17871. {
  17872. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17873. resizable: false, sortable: false, menuDisabled: true,
  17874. hidden: true,
  17875. },
  17876. {
  17877. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17878. resizable: false, sortable: false, menuDisabled: true,
  17879. checkedValue: true, uncheckedValue: false, hidden: true,
  17880. },
  17881. {
  17882. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17883. resizable: false, sortable: false, menuDisabled: true,
  17884. },
  17885. {
  17886. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17887. resizable: false, sortable: false, menuDisabled: true,
  17888. checkedValue: true, uncheckedValue: false, hidden: true,
  17889. },
  17890. {
  17891. dataIndex: 'form_order', text: '对话框序号',
  17892. editor: { xtype: 'numberfield' },
  17893. },
  17894. {
  17895. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17896. resizable: false, sortable: false, menuDisabled: true,
  17897. checkedValue: true, uncheckedValue: false,
  17898. },
  17899. {
  17900. dataIndex: 'form_xtype', text: '对话框编辑器',
  17901. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17902. },
  17903. {
  17904. dataIndex: 'form_fieldset', text: '对话框字段组',
  17905. editor: { xtype: 'textfield' }, hidden: true,
  17906. },
  17907. {
  17908. dataIndex: 'form_tab', text: '对话框选项卡',
  17909. editor: { xtype: 'textfield' }, hidden: true,
  17910. },
  17911. {
  17912. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17913. resizable: false, sortable: false, menuDisabled: true,
  17914. checkedValue: true, uncheckedValue: false, hidden: true,
  17915. },
  17916. ],
  17917. },
  17918. {
  17919. title: 'SQL和查询条件', reference: 'sql',
  17920. layout: 'border',
  17921. border: false,
  17922. items: [
  17923. {
  17924. region: 'north',
  17925. height: 200,
  17926. border: false,
  17927. split: true,
  17928. xtype: 'yvgrid',
  17929. reference: 'gridCondition',
  17930. pagination: false,
  17931. hideFootbar: true,
  17932. _mode: 'edit',
  17933. listeners: {
  17934. buttonclick: 'scope.conditionButtonclick',
  17935. },
  17936. store: {},
  17937. tbar: {
  17938. xtype: 'toolbar',
  17939. border: false,
  17940. items: [
  17941. {
  17942. xtype: 'button',
  17943. text: '添加条件',
  17944. iconCls: 'x-fa fa-plus-circle',
  17945. listeners: {
  17946. click: 'scope.addCondition'
  17947. }
  17948. },
  17949. {
  17950. xtype: 'button',
  17951. text: '删除条件',
  17952. iconCls: 'x-fa fa-minus-circle',
  17953. listeners: {
  17954. click: 'scope.removeCondition'
  17955. }
  17956. },
  17957. '-',
  17958. {
  17959. xtype: 'button',
  17960. text: '自动分析条件变量',
  17961. iconCls: 'x-fa fa-code-fork',
  17962. listeners: {
  17963. click: 'scope.calcCondition'
  17964. }
  17965. },
  17966. {
  17967. xtype: 'button',
  17968. text: '上移',
  17969. iconCls: 'x-fa fa-arrow-up',
  17970. listeners: {
  17971. click: 'scope.moveUpCondition'
  17972. }
  17973. },
  17974. {
  17975. xtype: 'button',
  17976. text: '下移',
  17977. iconCls: 'x-fa fa-arrow-down',
  17978. listeners: {
  17979. click: 'scope.moveDownCondition'
  17980. }
  17981. },
  17982. ]
  17983. },
  17984. columns: [
  17985. {
  17986. text: '条件变量',
  17987. dataIndex: 'param_name',
  17988. width: 140,
  17989. sortable: false,
  17990. menuDisabled: true,
  17991. editor: {
  17992. selectOnFocus: true
  17993. },
  17994. },
  17995. {
  17996. text: '中文标题',
  17997. dataIndex: 'fieldLabel',
  17998. width: 120,
  17999. sortable: false,
  18000. menuDisabled: true,
  18001. editor: {
  18002. selectOnFocus: true
  18003. },
  18004. },
  18005. {
  18006. text: '编辑类型',
  18007. dataIndex: 'xtype',
  18008. width: 80,
  18009. sortable: false,
  18010. menuDisabled: true,
  18011. editor: {
  18012. xtype: 'combo',
  18013. typeAhead: true,
  18014. triggerAction: 'all',
  18015. selectOnFocus: true,
  18016. store: [
  18017. ['textfield', 'textfield'],
  18018. ['combo', 'combo'],
  18019. ['datefield', 'datefield'],
  18020. ['datetimefield', 'datetimefield'],
  18021. ['numberfield', 'numberfield'],
  18022. ['multiplesearch', 'multiplesearch'],
  18023. ]
  18024. }
  18025. },
  18026. {
  18027. text: '权重',
  18028. dataIndex: 'conditionFieldFlex',
  18029. align: 'right',
  18030. width: 60,
  18031. sortable: false,
  18032. menuDisabled: true,
  18033. editor: {
  18034. xtype: 'numberfield',
  18035. selectOnFocus: false,
  18036. minValue: 0,
  18037. maxValue: 10
  18038. },
  18039. },
  18040. {
  18041. text: '字典',
  18042. dataIndex: 'conditionFieldDict',
  18043. width: 160,
  18044. sortable: false,
  18045. menuDisabled: true,
  18046. editor: {
  18047. selectOnFocus: false
  18048. },
  18049. },
  18050. {
  18051. xtype: 'checkcolumn',
  18052. dataIndex: "conditionFieldWrap", header: "换行",
  18053. width: 65,
  18054. sortable: false,
  18055. menuDisabled: true,
  18056. },
  18057. {
  18058. text: '扩展参数',
  18059. dataIndex: 'conditionFieldExtend',
  18060. sortable: false,
  18061. menuDisabled: true,
  18062. editor: {
  18063. selectOnFocus: false
  18064. },
  18065. },
  18066. ]
  18067. },
  18068. {
  18069. region: 'center',
  18070. xtype: 'sqleditor',
  18071. layout: 'fit',
  18072. reference: 'sqlEditor',
  18073. split: true,
  18074. },
  18075. ]
  18076. },
  18077. {
  18078. title: '详情对话框',
  18079. layout: {
  18080. type: 'vbox',
  18081. pack: 'start',
  18082. align: 'stretch'
  18083. },
  18084. defaults: {
  18085. border: false,
  18086. anchor: '100%',
  18087. margin: '5',
  18088. },
  18089. scrollable: true,
  18090. items: [
  18091. {
  18092. xtype: 'cols',
  18093. items: [
  18094. {
  18095. fieldLabel: '对话框标题',
  18096. bind: { value: '{detailDialog.title}' },
  18097. xtype: 'textfield',
  18098. flex: 2,
  18099. },
  18100. {
  18101. fieldLabel: '宽度',
  18102. bind: { value: '{detailDialog.width}' },
  18103. xtype: 'numberfield',
  18104. },
  18105. {
  18106. fieldLabel: '高度',
  18107. bind: { value: '{detailDialog.height}' },
  18108. xtype: 'numberfield',
  18109. },
  18110. ]
  18111. },
  18112. ]
  18113. },
  18114. {
  18115. title: '界面源码',
  18116. xtype: 'jseditor',
  18117. reference: 'jseditor'
  18118. }
  18119. ]
  18120. }
  18121. ]
  18122. };
  18123. //# sourceMappingURL=GridColumnCustom.view.js.map
  18124. var GridColumnCustom = /** @class */ (function (_super) {
  18125. __extends(GridColumnCustom, _super);
  18126. function GridColumnCustom() {
  18127. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18128. }
  18129. GridColumnCustom.prototype.commit = function () {
  18130. };
  18131. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18132. };
  18133. GridColumnCustom.prototype.conditionButtonclick = function () {
  18134. };
  18135. GridColumnCustom.prototype.addField = function () {
  18136. };
  18137. GridColumnCustom.prototype.removeField = function () {
  18138. };
  18139. GridColumnCustom.prototype.calcField = function () {
  18140. };
  18141. GridColumnCustom.prototype.moveUp = function () {
  18142. };
  18143. GridColumnCustom.prototype.moveDown = function () {
  18144. };
  18145. GridColumnCustom.prototype.addCondition = function () {
  18146. };
  18147. GridColumnCustom.prototype.removeCondition = function () {
  18148. };
  18149. GridColumnCustom.prototype.calcCondition = function () {
  18150. };
  18151. GridColumnCustom.prototype.moveUpCondition = function () {
  18152. };
  18153. GridColumnCustom.prototype.moveDownCondition = function () {
  18154. };
  18155. return GridColumnCustom;
  18156. }(Scope));
  18157. //# sourceMappingURL=GridColumnCustom.js.map
  18158. function initGridCode(grid, newConfig, buttons) {
  18159. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18160. buttons.push({
  18161. xtype: 'button',
  18162. tooltip: '定义表格属性',
  18163. iconCls: 'x-fa fa-codepen',
  18164. handler: function (btn) {
  18165. var customWindow = new GridColumnCustom();
  18166. customWindow.showDialog(btn, {}, {});
  18167. }
  18168. });
  18169. buttons.push({
  18170. xtype: 'button',
  18171. tooltip: '定义表格数据源',
  18172. iconCls: 'x-fa fa-database',
  18173. handler: function () {
  18174. // showCustomGridDataSource(grid)
  18175. }
  18176. });
  18177. }
  18178. }
  18179. //# sourceMappingURL=grid_code.js.map
  18180. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18181. var hexToString = function (hex) {
  18182. var arr = hex.split("");
  18183. var out = "";
  18184. for (var i = 0; i < arr.length / 2; i++) {
  18185. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18186. // @ts-ignore
  18187. var charValue = String.fromCharCode(tmp);
  18188. out += charValue;
  18189. }
  18190. return out;
  18191. };
  18192. var defaultGrid = grid;
  18193. function initGrid () {
  18194. Ext.define('Yvan.Grid', {
  18195. extend: 'Ext.grid.Panel',
  18196. xtype: 'yvgrid',
  18197. __suspendReload: false,
  18198. _originVJson: {},
  18199. constructor: function (config) {
  18200. var _this = this;
  18201. var _a, _b, _c, _d, _e, _f;
  18202. var me = this;
  18203. var dataSource = config.dataSource;
  18204. var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope);
  18205. me._originVJson = config;
  18206. if (!isDesignMode(scope, config)) {
  18207. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18208. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18209. var cacheData = this.getColumnConfigCache();
  18210. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18211. var newColumns = [];
  18212. for (var j = 0; j < cacheData.length; j++) {
  18213. var itData = cacheData[j];
  18214. for (var i = 0; i < config.columns.length; i++) {
  18215. var column = config.columns[i];
  18216. if (itData.dataIndex === column.dataIndex) {
  18217. if (itData.width) {
  18218. column.width = itData.width;
  18219. }
  18220. column.hidden = itData.hidden;
  18221. column.locked = itData.locked;
  18222. newColumns.push(column);
  18223. break;
  18224. }
  18225. }
  18226. }
  18227. config.columns = newColumns;
  18228. }
  18229. }
  18230. }
  18231. var newConfig = _$2.defaultsDeep({
  18232. // 强制性属性 bug.
  18233. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18234. // enableLocking: false,
  18235. // syncRowHeight: false,
  18236. }, baseConfig(config, 'row-item'), config, grid);
  18237. // 在面板上的组件
  18238. // const scope = newConfig.$initParent?.yvanScope ||
  18239. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18240. // config.$vmParent?.yvanScope ||
  18241. // newConfig.$vmParent?._parent?.yvanScope;
  18242. var buttons = [];
  18243. var getRowClass = newConfig.getRowClass;
  18244. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18245. _$2.startsWith(getRowClass, "system."))) {
  18246. var fn = lookupFn(scope, getRowClass);
  18247. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18248. }
  18249. if (!newConfig.hideExport) {
  18250. buttons.push({
  18251. xtype: 'button',
  18252. tooltip: '导出Excel',
  18253. iconCls: 'x-fa fa-download',
  18254. listeners: {
  18255. click: this.exportExcel
  18256. },
  18257. });
  18258. }
  18259. if (!newConfig.hideAutoSize) {
  18260. buttons.push({
  18261. xtype: 'button',
  18262. iconCls: 'x-fa fa-text-width',
  18263. tooltip: '自适应宽度',
  18264. listeners: {
  18265. click: this.autoSizeColumns
  18266. }
  18267. });
  18268. }
  18269. if (!newConfig.hideClearFilter) {
  18270. buttons.push({
  18271. xtype: 'button',
  18272. tooltip: '清空筛选',
  18273. iconCls: 'x-fa fa-filter',
  18274. handler: this.clearFilter
  18275. });
  18276. }
  18277. if (!newConfig.hideSaveGridUIConfig) {
  18278. buttons.push({
  18279. xtype: 'button',
  18280. tooltip: '保存布局',
  18281. iconCls: 'x-fa fa-cogs',
  18282. handler: this.saveGridUIConfig
  18283. });
  18284. }
  18285. if (!newConfig.hideClearGridUIConfig) {
  18286. buttons.push({
  18287. xtype: 'button',
  18288. tooltip: '还原布局',
  18289. iconCls: 'x-fa fa-reply-all',
  18290. handler: this.clearGridUIConfig
  18291. });
  18292. }
  18293. initGridCode(me, newConfig, buttons);
  18294. if (!newConfig.hideFootbar) {
  18295. if (newConfig.pagination) {
  18296. newConfig.bbar = new Ext.PagingToolbar({
  18297. // pageSize: newConfig.pageSize, 这个值是无效的
  18298. displayInfo: true,
  18299. store: this.store,
  18300. emptyMsg: '没有记录',
  18301. cls: 'grid-bbar',
  18302. items: __spread([
  18303. {
  18304. xtype: 'combobox',
  18305. tooltip: '分页',
  18306. queryMode: 'local',
  18307. editable: false,
  18308. allowBlank: true,
  18309. labelAlign: 'right',
  18310. width: 90,
  18311. // labelWidth: 30,
  18312. listConfig: {
  18313. minWidth: null
  18314. },
  18315. value: 50,
  18316. valueField: undefined,
  18317. displayField: undefined,
  18318. hideClear: true,
  18319. store: newConfig.pageSizeOption,
  18320. listeners: {
  18321. change: function (sender, nv, ov) {
  18322. _this.store.pageSize = nv;
  18323. _this.store.loadPage(1);
  18324. }
  18325. }
  18326. }
  18327. ], buttons),
  18328. doRefresh: function () {
  18329. me.reload();
  18330. }
  18331. });
  18332. }
  18333. else {
  18334. newConfig.bbar = {
  18335. xtype: 'toolbar', overflowHandler: 'menu',
  18336. cls: 'grid-bbar',
  18337. items: __spread([
  18338. {
  18339. xtype: 'button',
  18340. tooltip: '刷新',
  18341. iconCls: 'x-fa fa-refresh',
  18342. handler: function () {
  18343. _this.reload();
  18344. }
  18345. },
  18346. '-'
  18347. ], buttons)
  18348. };
  18349. if (newConfig.hideRefresh) {
  18350. newConfig.bbar.items.splice(0, 1);
  18351. }
  18352. }
  18353. }
  18354. if (_$2.isArray(newConfig.condition)) {
  18355. // 带查询条件
  18356. var conditionRows_1 = [];
  18357. var newRow_1 = false;
  18358. var currentRow_1 = { xtype: 'cols', items: [], };
  18359. conditionRows_1.push(currentRow_1);
  18360. _$2.forEach(newConfig.condition, function (item) {
  18361. var _a;
  18362. if (newRow_1) {
  18363. currentRow_1 = { xtype: 'cols', items: [], };
  18364. conditionRows_1.push(currentRow_1);
  18365. }
  18366. var vj = _$2.cloneDeep(item);
  18367. if (vj.xtype) {
  18368. if (item.xtype === 'combo' && item.dict) {
  18369. vj.fix = ['system.getDict("' + item.dict + '")'];
  18370. }
  18371. if (item.xtype === 'datetimefield') {
  18372. _$2.defer(function () {
  18373. //@ts-ignore
  18374. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18375. });
  18376. }
  18377. else if (item.xtype === 'datefield') {
  18378. _$2.defer(function () {
  18379. //@ts-ignore
  18380. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18381. });
  18382. }
  18383. else {
  18384. scope.viewModel.set(item.param_name, '');
  18385. }
  18386. }
  18387. else {
  18388. // 没有组件类型,是个空占位符
  18389. vj.border = false;
  18390. }
  18391. if (item.param_name) {
  18392. vj.bind = {
  18393. value: '{' + item.param_name + '}'
  18394. };
  18395. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18396. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18397. }
  18398. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18399. currentRow_1.items.push(vj);
  18400. });
  18401. newConfig.tbar = {
  18402. xtype: 'form',
  18403. border: false,
  18404. items: conditionRows_1,
  18405. defaults: {
  18406. margin: '8 0 8 0'
  18407. },
  18408. };
  18409. console.log('newConfig', newConfig);
  18410. }
  18411. _$2.each(newConfig.columns, function (c) {
  18412. var renderer = c.renderer, formatter = c.formatter;
  18413. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18414. _$2.startsWith(renderer, "system."))) {
  18415. if (newConfig.$initParent) {
  18416. if (scope) {
  18417. var rendererFn = lookupFn(scope, renderer);
  18418. c.renderer = rendererFn.bind(scope);
  18419. }
  18420. }
  18421. }
  18422. if (c.dict) {
  18423. c.fix = ['system.getDict("' + c.dict + '")'];
  18424. if (c.editor && c.editor.xtype === 'combo') {
  18425. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18426. c.editor.typeAhead = true;
  18427. c.editor.triggerAction = 'all';
  18428. c.editor.selectOnFocus = false;
  18429. c.editor.listConfig = {
  18430. minWidth: 200
  18431. };
  18432. }
  18433. }
  18434. if (formatter === 'button') {
  18435. c.tdCls = 'td-btn';
  18436. if (!c.listeners) {
  18437. c.listeners = {};
  18438. }
  18439. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18440. if ($(event.target).is('input')) {
  18441. me.fireEvent('buttonclick', me, this, record);
  18442. }
  18443. };
  18444. }
  18445. else if (formatter === 'percentRenderer') {
  18446. c.tdCls = 'td-percent';
  18447. }
  18448. });
  18449. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18450. // 强制为编辑模式
  18451. newConfig.selModel = {
  18452. type: 'spreadsheet',
  18453. columnSelect: true,
  18454. pruneRemoved: false,
  18455. extensible: 'y'
  18456. };
  18457. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18458. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18459. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18460. }
  18461. else {
  18462. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18463. }
  18464. }
  18465. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18466. // 强制为勾选模式
  18467. newConfig.selModel = {
  18468. type: 'checkboxmodel',
  18469. mode: 'MULTI',
  18470. };
  18471. }
  18472. else if (newConfig._mode === 'checkonly') {
  18473. newConfig.selModel = {
  18474. type: 'checkboxmodel',
  18475. mode: 'MULTI',
  18476. checkOnly: true,
  18477. };
  18478. }
  18479. else if (newConfig._mode === 'select') {
  18480. // 强制为选择模式
  18481. newConfig.selModel = {
  18482. selType: 'rowmodel',
  18483. mode: 'SINGLE',
  18484. };
  18485. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18486. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18487. }
  18488. }
  18489. initBehaviorEdit(newConfig);
  18490. initGridDialog(newConfig);
  18491. this.superclass.constructor.call(this, newConfig);
  18492. this.store.pageSize = newConfig.pageSize;
  18493. },
  18494. setData: function (value) {
  18495. var me = this;
  18496. me._setDataReal(value);
  18497. },
  18498. /**
  18499. * 添加行,并进入编辑状态
  18500. * @param record 新行的属性集
  18501. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18502. */
  18503. appendEditRow: function (record, editRowCol) {
  18504. var records = this.getStore().add(record);
  18505. var recNew = records[0];
  18506. this.setSelection(records);
  18507. if (typeof editRowCol === 'string' && editRowCol) {
  18508. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18509. }
  18510. if (typeof editRowCol === 'number') {
  18511. var ce = this.findPlugin('cellediting');
  18512. this.editingPlugin = ce;
  18513. ce.startEdit(recNew, editRowCol);
  18514. }
  18515. },
  18516. beginEdit: function (record, editRowCol) {
  18517. if (typeof record === 'number') {
  18518. record = this.store.data.getAt(record);
  18519. }
  18520. if (record.isEntity === true) {
  18521. this.setSelection([record]);
  18522. if (typeof editRowCol === 'string' && editRowCol) {
  18523. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18524. }
  18525. if (typeof editRowCol === 'number') {
  18526. var ce = this.findPlugin('cellediting');
  18527. this.editingPlugin = ce;
  18528. ce.startEdit(record, editRowCol);
  18529. }
  18530. }
  18531. },
  18532. /**
  18533. * 移除行
  18534. * @param record 如果记录传空,就是当前选中的行
  18535. */
  18536. removeEditRow: function (record) {
  18537. if (!record) {
  18538. record = this.selection;
  18539. }
  18540. if (!record) {
  18541. msg('请选中要删除的行');
  18542. return;
  18543. }
  18544. this.getStore().remove(record);
  18545. },
  18546. /**
  18547. * 获取全部原始数据
  18548. */
  18549. getDataRows: function () {
  18550. return this.getStore().data.items.map(function (r) { return r.data; });
  18551. },
  18552. /**
  18553. * 获取全部原始数据, 不带 id/ 不带 origin
  18554. */
  18555. getDataRowsOnlyData: function () {
  18556. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18557. delete r.id;
  18558. delete r._origin;
  18559. return r;
  18560. });
  18561. },
  18562. rowMoveUp: function () {
  18563. var grid = this;
  18564. if (!grid.selection) {
  18565. msg('无法对多行进行移动');
  18566. return;
  18567. }
  18568. var record = grid.selection;
  18569. if (_$2.isArray(record)) {
  18570. record = record[0];
  18571. }
  18572. if (!record) {
  18573. msg('无法对多行进行移动');
  18574. return;
  18575. }
  18576. // const records = grid.selModel.getSelection()
  18577. // if (records.length !== 1) {
  18578. // msg('无法对多行进行移动')
  18579. // return
  18580. // }
  18581. //
  18582. // const [record] = records
  18583. var index = grid.store.indexOf(record);
  18584. if (index > 0) {
  18585. grid.store.removeAt(index);
  18586. grid.store.insert(index - 1, record);
  18587. grid.getView().refresh();
  18588. grid.selModel.select([record]);
  18589. }
  18590. },
  18591. rowMoveDown: function () {
  18592. var grid = this;
  18593. // const records = grid.selModel.getSelection()
  18594. // if (records.length !== 1) {
  18595. // msg('无法对多行进行移动')
  18596. // return
  18597. // }
  18598. if (!grid.selection) {
  18599. msg('无法对多行进行移动');
  18600. return;
  18601. }
  18602. var record = grid.selection;
  18603. if (_$2.isArray(record)) {
  18604. record = record[0];
  18605. }
  18606. if (!record) {
  18607. msg('无法对多行进行移动');
  18608. return;
  18609. }
  18610. var index = grid.store.indexOf(record);
  18611. if (index < grid.store.getCount() - 1) {
  18612. grid.store.removeAt(index);
  18613. grid.store.insert(index + 1, record);
  18614. grid.getView().refresh();
  18615. grid.selModel.select([record]);
  18616. }
  18617. },
  18618. getEditRecord: function () {
  18619. var _a, _b;
  18620. var me = this;
  18621. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18622. var rowIdx = (_b = (_a = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.rowIdx;
  18623. var record;
  18624. if (typeof rowIdx === 'undefined') {
  18625. record = me.getSelectionModel().getLastSelected();
  18626. }
  18627. else {
  18628. record = me.store.getAt(rowIdx);
  18629. }
  18630. return record;
  18631. },
  18632. getEditRow: function () {
  18633. var _a;
  18634. var me = this;
  18635. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18636. },
  18637. setEditRow: function (rowValues) {
  18638. var me = this;
  18639. var record = me.getEditRecord();
  18640. if (record) {
  18641. _$2.forOwn(rowValues, function (v, k) {
  18642. record.set(k, v);
  18643. });
  18644. }
  18645. },
  18646. _transform: function (data) {
  18647. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18648. _$2.forEach(data, function (row) {
  18649. row._origin = _$2.clone(row);
  18650. });
  18651. },
  18652. _setDataReal: function (value) {
  18653. var me = this;
  18654. this._transform(value);
  18655. var storeOpt = {
  18656. fields: getFileds(this),
  18657. data: value,
  18658. };
  18659. if (this.groupField) {
  18660. storeOpt.groupField = this.groupField;
  18661. }
  18662. var store = new Ext.data.Store(storeOpt);
  18663. me.setStore(store);
  18664. },
  18665. setStore: function (store) {
  18666. var me = this;
  18667. if (_$2.isArray(store)) {
  18668. var value = store;
  18669. this._transform(value);
  18670. var storeOpt = {
  18671. fields: getFileds(this),
  18672. data: value,
  18673. };
  18674. if (this.groupField) {
  18675. storeOpt.groupField = this.groupField;
  18676. }
  18677. store = new Ext.data.Store(storeOpt);
  18678. }
  18679. me.superclass.setStore.call(this, store);
  18680. var reference = this.reference;
  18681. if (reference) {
  18682. var scope = lookupScope(this);
  18683. scope.viewModel.set(reference + '.ischanged', false);
  18684. scope.viewModel.set(reference + '.theid', null);
  18685. scope.viewModel.set(reference + '.theid2', null);
  18686. scope.viewModel.set(reference + '.theid3', null);
  18687. }
  18688. if (store) {
  18689. store.on({
  18690. add: function (store, records, index, eOpts) {
  18691. me._raiseChange(store, 'add');
  18692. },
  18693. remove: function (store, records, index, isMove, eOpts) {
  18694. me._raiseChange(store, 'remove');
  18695. },
  18696. datachanged: function (sender, opt) {
  18697. me._raiseChange(store, 'datachanged');
  18698. }
  18699. });
  18700. }
  18701. },
  18702. _raiseChange: function (store, type) {
  18703. var _a, _b;
  18704. var reference = this.reference;
  18705. if (reference && store) {
  18706. var ischanged = false;
  18707. if (store.getModifiedRecords().length > 0 ||
  18708. store.getNewRecords().length > 0 ||
  18709. store.getRemovedRecords().length > 0) {
  18710. ischanged = true;
  18711. }
  18712. else {
  18713. ischanged = false;
  18714. }
  18715. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18716. }
  18717. },
  18718. /**
  18719. * 轻量级刷新
  18720. */
  18721. refreshData: function () {
  18722. var store = this.getStore();
  18723. if (store) {
  18724. store.reload();
  18725. }
  18726. },
  18727. /**
  18728. * 为表格强制设置焦点
  18729. * @param seq 顺序号
  18730. */
  18731. focusRow: function (seq) {
  18732. this.setSelection(this.store.getAt(seq));
  18733. this.getView().focusRow(seq);
  18734. },
  18735. /**
  18736. * 重新载入数据(重新计算参数)
  18737. */
  18738. reload: function (reloadParams) {
  18739. if (reloadParams === void 0) { reloadParams = {}; }
  18740. var me = this;
  18741. var config = me.config;
  18742. if (config.dataSourceCallbackFn) {
  18743. // 函数请求刷新
  18744. var scope_1 = lookupScope(this);
  18745. _$2.defer(function () {
  18746. me.setLoading(true);
  18747. });
  18748. config.dataSourceCallbackFn.call(scope_1, me, {
  18749. successCallback: function (value) {
  18750. me._setDataReal(value);
  18751. _$2.defer(function () {
  18752. me.setLoading(false);
  18753. });
  18754. // 自动选中第一行
  18755. var data = me.getStore().data;
  18756. if (data.length > 0) {
  18757. me.setSelection(data.items[0]);
  18758. }
  18759. me.fireEvent('dataLoadComplete', me, true, value);
  18760. },
  18761. failCallback: function (error) {
  18762. _$2.defer(function () {
  18763. me.setLoading(false);
  18764. });
  18765. me.fireEvent('dataLoadComplete', me, false, error);
  18766. }
  18767. });
  18768. return;
  18769. }
  18770. // if (this.store) {
  18771. // this.store.reload({aaaa: 1, bbbb: 2})
  18772. // }
  18773. var dataSource = config.dataSource;
  18774. var scope = lookupScope(me);
  18775. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18776. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18777. }
  18778. },
  18779. exportCurrentExcelClick: function () {
  18780. var _a;
  18781. var me = this;
  18782. var config = me.config;
  18783. var scope = lookupScope(me);
  18784. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18785. if (excelFileName.endsWith(".xlsx")) {
  18786. excelFileName = excelFileName.split(".xlsx")[0];
  18787. }
  18788. excelFileName += ".xlsx";
  18789. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18790. var excelData = me.makeExcelData(rowsAll);
  18791. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18792. },
  18793. exportExcelClick: function (excelExportParams) {
  18794. var me = this;
  18795. var config = me.config;
  18796. excelExportParams.isExcelExport = true;
  18797. var scope = lookupScope(me);
  18798. var dataSource = config.dataSource;
  18799. scope.setLoading(true);
  18800. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18801. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18802. var _a, _b, _c, _d;
  18803. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18804. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18805. var total = parseInt((_c = responseData.pagination) === null || _c === void 0 ? void 0 : _c.total) || ((_d = responseData.data) === null || _d === void 0 ? void 0 : _d.length) || 0;
  18806. me.exportExcelCurrentPage = page;
  18807. me.exportExcelPageSize = size;
  18808. me.exportExcelTotal = total;
  18809. if (excelFileName.endsWith(".xlsx")) {
  18810. excelFileName = excelFileName.split(".xlsx")[0];
  18811. }
  18812. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18813. excelFileName += ".xlsx";
  18814. var excelData = me.makeExcelData(responseData.data);
  18815. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18816. if (page < total / size) {
  18817. page++;
  18818. me.exportExcelCurrentPage = page;
  18819. }
  18820. scope.setLoading(false);
  18821. });
  18822. },
  18823. exportBigExcelClick: function () {
  18824. var _a;
  18825. var me = this;
  18826. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18827. showErrorDialog('当前表格不支持大批量导出');
  18828. return;
  18829. }
  18830. var config = me.config;
  18831. var scope = lookupScope(me);
  18832. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18833. var head = [];
  18834. var dict = {};
  18835. _$2.forEach(me.columns, function (column) {
  18836. if (column.isHidden())
  18837. return;
  18838. if (!column.dataIndex)
  18839. return;
  18840. if (!column.text)
  18841. return;
  18842. head.push({ field: column.dataIndex, name: column.text });
  18843. if (column.dictForExcel) {
  18844. dict[column.dataIndex] = column.dictForExcel;
  18845. }
  18846. });
  18847. // 判断是否需要解密
  18848. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18849. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18850. me.dbInfo.password = hexToString(me.dbInfo.password);
  18851. me.dbInfo.username = hexToString(me.dbInfo.username);
  18852. }
  18853. scope.setLoading(true);
  18854. Ext.Ajax.request({
  18855. timeout: 15000,
  18856. url: window["EXPORT_DATA_HOST"],
  18857. method: "POST",
  18858. jsonData: {
  18859. file: excelFileName,
  18860. dbInfo: me.dbInfo,
  18861. exportDataSql: me.exportDataSql,
  18862. exportDataSqlParams: me.exportDataSqlParams,
  18863. head: head,
  18864. dict: dict,
  18865. },
  18866. }).then(function () {
  18867. scope.setLoading(false);
  18868. msg('请求成功');
  18869. }).catch(function () {
  18870. scope.setLoading(false);
  18871. showErrorDialog('请求失败,请确认是否已安装客户端');
  18872. });
  18873. },
  18874. makeExcelData: function (jsonData) {
  18875. var me = this;
  18876. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18877. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18878. return;
  18879. }
  18880. var data = [];
  18881. // 获取表格的列定义
  18882. var headerTextArr = [];
  18883. var headers = [];
  18884. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18885. var header = me.headerCt.getGridColumns()[i];
  18886. if (!header.isHidden()) {
  18887. var textStr = _$2.trim(header.text);
  18888. var dataIndexStr = _$2.trim(header.dataIndex);
  18889. if (dataIndexStr) {
  18890. if (textStr === '') {
  18891. headerTextArr.push(dataIndexStr);
  18892. }
  18893. else {
  18894. headerTextArr.push(textStr);
  18895. }
  18896. headers.push(header);
  18897. }
  18898. }
  18899. }
  18900. if (headers.length === 0) {
  18901. return;
  18902. }
  18903. data.push(headerTextArr);
  18904. for (var i = 0; i < jsonData.length; i++) {
  18905. var dataRow = jsonData[i];
  18906. var row = [];
  18907. for (var j = 0; j < headers.length; j++) {
  18908. var key = headers[j].dataIndex;
  18909. var value = dataRow[key];
  18910. if (!value && value !== 0) {
  18911. value = '';
  18912. }
  18913. var oValue = value;
  18914. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18915. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18916. try {
  18917. value = headers[j].renderer(value);
  18918. if (!value && value !== 0) {
  18919. value = oValue;
  18920. }
  18921. }
  18922. catch (e) {
  18923. value = oValue;
  18924. }
  18925. }
  18926. row.push(value);
  18927. }
  18928. data.push(row);
  18929. }
  18930. return data;
  18931. },
  18932. initComponent: function () {
  18933. var _this = this;
  18934. var _a;
  18935. var me = this;
  18936. var config = me.config;
  18937. var scope = lookupScope(this);
  18938. if (isDesignMode(scope, config)) {
  18939. this.superclass.initComponent.call(this);
  18940. return;
  18941. }
  18942. // 转换 dataSource 属性
  18943. convertDataSource$1(me, scope, config);
  18944. this.on({
  18945. afterrender: function (sender) {
  18946. var me = this;
  18947. var config = this.config;
  18948. var dataSource = config.dataSource;
  18949. if (config.autoLoad) {
  18950. if (config.dataSourceCallbackFn) {
  18951. me.reload();
  18952. }
  18953. else if (_$2.isPlainObject(dataSource)) {
  18954. me.reload();
  18955. }
  18956. }
  18957. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18958. var vm = this.lookupViewModel();
  18959. this.contextMenu = this.add(new Ext.menu.Menu({
  18960. viewModel: vm,
  18961. items: _$2.map(config.tbar, function (item) {
  18962. var menuItem = __assign({}, item);
  18963. if (menuItem.xtype === 'button') {
  18964. delete menuItem.xtype;
  18965. }
  18966. return menuItem;
  18967. })
  18968. }));
  18969. }
  18970. else if (_$2.isPlainObject(config.contextMenu)) {
  18971. this.contextMenu = this.add(config.contextMenu);
  18972. }
  18973. var $dom = $(sender.el.dom);
  18974. $dom.on('keydown', function (e) {
  18975. me.fireEvent('keydown', me, e);
  18976. }).on('keyup', function (e) {
  18977. me.fireEvent('keyup', me, e);
  18978. });
  18979. // 默认显示提示
  18980. if (this.cellTip) {
  18981. this.tip = Ext.create('Ext.tip.ToolTip', {
  18982. target: this.el,
  18983. delegate: '.x-grid-cell-inner',
  18984. trackMouse: true,
  18985. ancor: 'top',
  18986. style: 'background-color: #0D6EFD;',
  18987. listeners: {
  18988. beforeshow: function (tip) {
  18989. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18990. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18991. return false;
  18992. }
  18993. tip.update(tipText);
  18994. }
  18995. }
  18996. });
  18997. }
  18998. },
  18999. itemcontextmenu: function (view, rec, node, index, e) {
  19000. if (this.contextMenu) {
  19001. e.stopEvent();
  19002. this.contextMenu.show().setLocalXY(e.getXY());
  19003. return false;
  19004. }
  19005. },
  19006. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  19007. // this.setColumnConfigCache()
  19008. // },
  19009. // columnhide(sender, column, eOpts) {
  19010. // this.setColumnConfigCache()
  19011. // },
  19012. // columnshow(sender, column, eOpts) {
  19013. // this.setColumnConfigCache()
  19014. // },
  19015. // columnresize(sender, column, width, eOpts) {
  19016. // this.setColumnConfigCache()
  19017. // },
  19018. destory: function () {
  19019. },
  19020. selectionchange: function (sender, param) {
  19021. var record = undefined;
  19022. if (_$2.isArray(param)) {
  19023. record = param[0];
  19024. }
  19025. else if (_$2.isObject(param)) {
  19026. record = _$2.get(param, 'endCell.record');
  19027. }
  19028. itemselectFun(this, sender, record);
  19029. },
  19030. itemclick: function (sender, record) {
  19031. itemselectFun(this, sender, record);
  19032. },
  19033. show: function (sender) {
  19034. if (sender.__suspendReload) {
  19035. sender.__suspendReload = false;
  19036. sender.reload();
  19037. }
  19038. }
  19039. });
  19040. _$2.defer(function () {
  19041. var ce = _this.findPlugin('cellediting');
  19042. ce.on({
  19043. beforeedit: function (editor, context, eOpts) {
  19044. me.fireEvent('editbefore', me, editor, context, eOpts);
  19045. },
  19046. canceledit: function (editor, context, eOpts) {
  19047. me.fireEvent('editcancel', me, editor, context, eOpts);
  19048. },
  19049. edit: function (editor, context, eOpts) {
  19050. me.fireEvent('editfinish', me, editor, context, eOpts);
  19051. },
  19052. validateedit: function (editor, context, eOpts) {
  19053. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19054. },
  19055. });
  19056. });
  19057. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19058. var reference = me.reference;
  19059. var scope = lookupScope(me);
  19060. var theid = _$2.get(config, 'behavior.theid');
  19061. if (theid && reference) {
  19062. if (!record) {
  19063. scope.viewModel.set(reference + '.theid', null);
  19064. }
  19065. else {
  19066. scope.viewModel.set(reference + '.theid', record.get(theid));
  19067. }
  19068. }
  19069. var theid2 = _$2.get(config, 'behavior.theid2');
  19070. if (theid2 && reference) {
  19071. if (!record) {
  19072. scope.viewModel.set(reference + '.theid2', null);
  19073. }
  19074. else {
  19075. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19076. }
  19077. }
  19078. var theid3 = _$2.get(config, 'behavior.theid3');
  19079. if (theid3 && reference) {
  19080. if (!record) {
  19081. scope.viewModel.set(reference + '.theid3', null);
  19082. }
  19083. else {
  19084. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19085. }
  19086. }
  19087. me.fireEvent('itemselect', sender, record);
  19088. }, 50);
  19089. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19090. // 为 stores.proxy.buildRequest 做准备
  19091. this.store.proxy.$owner = this;
  19092. }
  19093. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19094. if (selectToReload) {
  19095. // 点击后触发某个目标表格刷新
  19096. this.on({
  19097. itemselect: function (sender) {
  19098. if (_$2.isArray(selectToReload)) {
  19099. _$2.forEach(selectToReload, function (ref) {
  19100. if (ref) {
  19101. var ctlTarget = scope.refs[ref];
  19102. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19103. if (ctlTarget.isVisible()) {
  19104. ctlTarget.reload();
  19105. }
  19106. else {
  19107. ctlTarget.__suspendReload = true;
  19108. }
  19109. }
  19110. }
  19111. });
  19112. }
  19113. else if (_$2.isString(selectToReload)) {
  19114. var ctlTarget = scope.refs[selectToReload];
  19115. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19116. ctlTarget.reload();
  19117. }
  19118. }
  19119. }
  19120. });
  19121. }
  19122. this.superclass.initComponent.call(this);
  19123. },
  19124. // 生成列自定义的缓存key
  19125. makeColumnConfigCacheKey: function (config) {
  19126. var _a, _b, _c, _d, _e, _f;
  19127. var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope);
  19128. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19129. if (config.reference) {
  19130. key += config.reference;
  19131. }
  19132. else {
  19133. var subKey = "";
  19134. for (var i = 0; i < config.columns.length; i++) {
  19135. var column = config.columns[i];
  19136. if (column.dataIndex) {
  19137. subKey += column.dataIndex;
  19138. }
  19139. }
  19140. key += subKey;
  19141. }
  19142. return key;
  19143. },
  19144. getColumnConfigCache: function () {
  19145. var key = this.columnConfigCacheKey;
  19146. var dataStr = localStorage.getItem(key);
  19147. if (dataStr) {
  19148. return JSON.parse(dataStr);
  19149. }
  19150. return "";
  19151. },
  19152. setColumnConfigCache: function () {
  19153. var key = this.columnConfigCacheKey;
  19154. var cacheData = [];
  19155. var columns = this.headerCt.getGridColumns();
  19156. var index = 0;
  19157. for (var i = 0; i < columns.length; i++) {
  19158. var column = columns[i];
  19159. if (column.dataIndex) {
  19160. cacheData.push({
  19161. dataIndex: column.dataIndex,
  19162. width: column.width,
  19163. hidden: column.hidden,
  19164. locked: column.locked,
  19165. index: index
  19166. });
  19167. index++;
  19168. }
  19169. }
  19170. localStorage.setItem(key, JSON.stringify(cacheData));
  19171. },
  19172. autoSizeColumns: function (sender) {
  19173. var grid = sender ? sender.up('grid') : this;
  19174. // const columns = grid.columns;
  19175. // for (let i = 0; i < columns.length; i++) {
  19176. // const column = columns[i];
  19177. // grid.getView().autoSizeColumn(column);
  19178. // column.setWidth(column.getWidth() + 5);
  19179. // }
  19180. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19181. grid.headerCt.getGridColumns()[i].autoSize(i);
  19182. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19183. }
  19184. },
  19185. clearFilter: function (sender) {
  19186. var grid = sender.up('grid');
  19187. grid.filters.clearFilters();
  19188. grid.getStore().sorters.removeAll();
  19189. // grid.getStore().reload()
  19190. },
  19191. saveGridUIConfig: function (sender) {
  19192. var grid = sender.up('grid');
  19193. grid.setColumnConfigCache();
  19194. msg('保存设置成功!');
  19195. },
  19196. clearGridUIConfig: function (sender) {
  19197. var grid = sender.up('grid');
  19198. var key = grid.columnConfigCacheKey;
  19199. localStorage.setItem(key, "");
  19200. msg('清空设置成功,重新打开后生效!');
  19201. },
  19202. setLoading: function (value) {
  19203. if (value) {
  19204. this.mask('读取中');
  19205. }
  19206. else {
  19207. this.unmask();
  19208. }
  19209. },
  19210. exportExcel: function (sender) {
  19211. var rect = sender.btnEl.dom.getBoundingClientRect();
  19212. var scope = lookupScope(this);
  19213. var grid = sender.up('grid');
  19214. var menuItems = [];
  19215. if (grid.dataSource.method === 'invoke' || grid.dataSource.sqlId) {
  19216. menuItems.push({
  19217. text: '大批量导出 (需要客户端支持!)',
  19218. iconCls: 'x-fa fa-download',
  19219. listeners: {
  19220. click: function (sender, value) {
  19221. // @ts-ignore
  19222. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19223. .then(function (res) {
  19224. grid.exportBigExcelClick();
  19225. });
  19226. }
  19227. }
  19228. });
  19229. menuItems.push('-');
  19230. }
  19231. menuItems.push({
  19232. text: '导出当前数据',
  19233. iconCls: 'x-fa fa-download',
  19234. listeners: {
  19235. click: function (sender, value) {
  19236. grid.exportCurrentExcelClick();
  19237. }
  19238. }
  19239. }, {
  19240. xtype: "textfield",
  19241. fieldLabel: '当前导出页',
  19242. maskRe: /[0-9]/,
  19243. value: grid.exportExcelCurrentPage,
  19244. listeners: {
  19245. render: function (sender) {
  19246. grid.exportExcelCurrentPageCmp = sender;
  19247. },
  19248. change: function (sender, value) {
  19249. var v = parseInt(value);
  19250. if (isNaN(v) || v === 0) {
  19251. window['system'].msg("页码不能为0");
  19252. v = 1;
  19253. sender.setValue(v);
  19254. }
  19255. var size = parseInt(grid.exportExcelPageSize);
  19256. var total = parseInt(grid.exportExcelTotal);
  19257. if (v > total / size) {
  19258. v = parseInt(total / size + "");
  19259. }
  19260. grid.exportExcelCurrentPage = v + "";
  19261. }
  19262. }
  19263. }, {
  19264. xtype: "textfield",
  19265. fieldLabel: '导出页大小',
  19266. maskRe: /[0-9]/,
  19267. value: grid.exportExcelPageSize,
  19268. listeners: {
  19269. render: function (sender) {
  19270. grid.exportExcelPageSizeCmp = sender;
  19271. },
  19272. change: function (sender, value) {
  19273. var v = parseInt(value);
  19274. if (isNaN(v) || v === 0) {
  19275. window['system'].msg("导出页大小不能为0");
  19276. v = defaultGrid.exportExcelPageSize;
  19277. sender.setValue(v);
  19278. }
  19279. if (v > 10000) {
  19280. window['system'].msg("导出页大小不能大于10000");
  19281. v = 10000;
  19282. sender.setValue(v);
  19283. }
  19284. var page = parseInt(grid.exportExcelCurrentPage);
  19285. var total = parseInt(grid.exportExcelTotal);
  19286. if (page > total / v) {
  19287. page = parseInt(total / v + "") + 1;
  19288. grid.exportExcelCurrentPageCmp.setValue(page);
  19289. }
  19290. grid.exportExcelPageSize = v + "";
  19291. }
  19292. }
  19293. }, {
  19294. xtype: "textfield",
  19295. fieldLabel: '总条数',
  19296. value: grid.exportExcelTotal,
  19297. readOnly: true
  19298. }, {
  19299. text: '导出',
  19300. iconCls: 'x-fa fa-download',
  19301. listeners: {
  19302. click: function (sender, value) {
  19303. grid.exportExcelClick({
  19304. exportExcelPageSize: grid.exportExcelPageSize,
  19305. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19306. });
  19307. }
  19308. }
  19309. });
  19310. var treeMenu = new Ext.menu.Menu({
  19311. xtype: 'menu',
  19312. floated: false,
  19313. width: 300,
  19314. docked: 'left',
  19315. items: menuItems
  19316. });
  19317. treeMenu.showAt(rect.left, rect.top - 120);
  19318. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19319. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19320. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19321. // }
  19322. },
  19323. /**
  19324. * 获取表格编辑的行数据
  19325. */
  19326. getGridEditRows: function () {
  19327. var grid = this;
  19328. var store = grid.getStore();
  19329. var rows = [];
  19330. var modifyRows = [];
  19331. var newRows = [];
  19332. var err = "";
  19333. var records = store.getModifiedRecords();
  19334. var newRecords = store.getNewRecords();
  19335. var removeRecords = [];
  19336. _$2.forEach(store.getRemovedRecords(), function (row) {
  19337. removeRecords.push(row.data);
  19338. });
  19339. _$2.forEach(records, function (record) {
  19340. var colums = grid.columns;
  19341. var errFunc = undefined;
  19342. _$2.forEach(colums, function (col) {
  19343. var name = col.dataIndex;
  19344. var value = record.data[name];
  19345. var colIndex = col.getIndex(); //获得列号
  19346. var rowIndex = store.indexOfId(record.id); //获得行号
  19347. var editor = col.getEditor(); //使用的编辑器
  19348. var tmpErrFunc = function () {
  19349. var text = col.text || col.name;
  19350. msg(text + ' 校验失败, 请确保输入的数据正确');
  19351. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19352. };
  19353. if (editor && !editor.allowBlank && isEmpty(value)) {
  19354. errFunc = tmpErrFunc;
  19355. return false;
  19356. }
  19357. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19358. errFunc = tmpErrFunc;
  19359. return false;
  19360. }
  19361. });
  19362. if (typeof errFunc === 'function') {
  19363. err = "1";
  19364. _$2.remove(rows, function (n) {
  19365. return true;
  19366. });
  19367. //@ts-ignore
  19368. errFunc();
  19369. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19370. return false;
  19371. }
  19372. else {
  19373. if (_$2.findIndex(newRecords, function (item) {
  19374. return item === record;
  19375. }) >= 0) {
  19376. newRows.push(record.data);
  19377. }
  19378. else {
  19379. modifyRows.push(record.data);
  19380. }
  19381. rows.push(record.data);
  19382. }
  19383. });
  19384. return {
  19385. rows: rows,
  19386. newRows: newRows,
  19387. modifyRows: modifyRows,
  19388. removeRecords: removeRecords,
  19389. err: err
  19390. };
  19391. }
  19392. // reload() {
  19393. // dataSourceReload(this)
  19394. // },
  19395. });
  19396. }
  19397. /**
  19398. * 获取 columns 中所有的 dataIndex
  19399. */
  19400. function getFileds(newConfig) {
  19401. var fields = [];
  19402. _$2.forEach(newConfig.columns, function (c) {
  19403. if (c.dataIndex) {
  19404. fields.push(c.dataIndex);
  19405. }
  19406. });
  19407. return fields;
  19408. }
  19409. function convertDataSource$1(sender, scope, newConfig) {
  19410. if (typeof newConfig.store !== 'undefined') {
  19411. // 有 store 属性的情况下,不做任何事
  19412. return;
  19413. }
  19414. if (typeof newConfig.dataSource === 'undefined') {
  19415. // 没有定义 dataSource 的情况下,不做任何事
  19416. return;
  19417. }
  19418. if (_$2.isArray(newConfig.data)) {
  19419. // 有 data 属性赋值的情况下
  19420. newConfig.store = {
  19421. fields: getFileds(newConfig),
  19422. data: newConfig.data
  19423. };
  19424. delete newConfig.data;
  19425. return;
  19426. }
  19427. var dataSource = newConfig.dataSource;
  19428. if (typeof dataSource === 'string') {
  19429. // dataSource 是字符串的情况下,找到成员函数
  19430. dataSource = lookupFn(scope, dataSource);
  19431. }
  19432. if (typeof dataSource === 'function') {
  19433. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19434. newConfig.store = new Ext.data.Store({
  19435. fields: getFileds(newConfig),
  19436. // data: [],
  19437. autoLoad: true,
  19438. proxy: {
  19439. type: 'memory',
  19440. data: [],
  19441. }
  19442. });
  19443. newConfig.dataSourceCallbackFn = dataSource;
  19444. return;
  19445. }
  19446. // throw new TypeError('无法识别的调用方法')
  19447. }
  19448. //# sourceMappingURL=grid.js.map
  19449. function initTextfield () {
  19450. var cc = Ext.form.field.Text.prototype.constructor;
  19451. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19452. Ext.form.field.Text.override({
  19453. constructor: function (config) {
  19454. var newConfig = _$2.defaultsDeep({
  19455. // 强制属性
  19456. triggers: {
  19457. clear: {
  19458. weight: -1,
  19459. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19460. hidden: true,
  19461. handler: 'onClearClick',
  19462. },
  19463. }
  19464. }, baseConfig(config, 'col-item'), config, text);
  19465. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19466. newConfig.enableKeyEvents = true;
  19467. }
  19468. cc.call(this, newConfig);
  19469. },
  19470. /**
  19471. * 清空所有值
  19472. */
  19473. onClearClick: function (sender, e) {
  19474. var me = this;
  19475. me.setValue('');
  19476. },
  19477. /**
  19478. * 尝试获取下一个要获取焦点的控件
  19479. */
  19480. _raiseNextFocus: function (sender) {
  19481. var config = sender.config;
  19482. var scope = lookupScope(sender);
  19483. if (typeof config.nextFocus === 'function') {
  19484. config.nextFocus(sender);
  19485. }
  19486. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19487. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19488. var fn = lookupFn(scope, config.nextFocus);
  19489. if (typeof fn === 'function') {
  19490. var nextCtlReference = fn(sender);
  19491. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19492. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19493. if (ctl) {
  19494. if (typeof ctl.focus2 === 'function') {
  19495. ctl.focus2();
  19496. }
  19497. else {
  19498. ctl.focus();
  19499. }
  19500. }
  19501. }
  19502. }
  19503. }
  19504. else {
  19505. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19506. if (ctl) {
  19507. if (typeof ctl.focus2 === 'function') {
  19508. ctl.focus2();
  19509. }
  19510. else {
  19511. ctl.focus();
  19512. }
  19513. }
  19514. }
  19515. }
  19516. },
  19517. initComponent: function () {
  19518. /**
  19519. * 改变必填项之前加星号
  19520. */
  19521. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19522. // this.beforeLabelTextTpl = [
  19523. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19524. // ];
  19525. this.afterLabelTextTpl = [
  19526. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19527. ];
  19528. }
  19529. var me = this;
  19530. this.on({
  19531. change: function (sender, newVal) {
  19532. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19533. if (hideTrigger || disabled || readOnly || hideClear) {
  19534. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19535. return;
  19536. }
  19537. var value = newVal;
  19538. if (value) {
  19539. me.getTrigger('clear').show();
  19540. me.updateLayout();
  19541. }
  19542. else {
  19543. me.getTrigger('clear').hide();
  19544. me.updateLayout();
  19545. }
  19546. },
  19547. afterrender: function (sender) {
  19548. var _this = this;
  19549. var _a;
  19550. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19551. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19552. $$2(sender.inputEl.dom).on('click', function (e) {
  19553. sender.fireEvent('click', _this, e);
  19554. });
  19555. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19556. var _a, _b, _c, _d;
  19557. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19558. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19559. if (sender.isExpanded === true) {
  19560. // 弹开下拉框的基础上,不干预上下选择
  19561. return;
  19562. }
  19563. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19564. var grid = sender.ownerCt.up('grid');
  19565. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19566. if (editingPlugin) {
  19567. var rowIdx = (_c = (_b = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.rowIdx;
  19568. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19569. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19570. // editingPlugin
  19571. var targetRecord = void 0;
  19572. if (e.code === 'ArrowDown') {
  19573. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19574. }
  19575. else {
  19576. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19577. }
  19578. if (targetRecord) {
  19579. grid.setSelection([targetRecord]);
  19580. editingPlugin.startEdit(targetRecord, column);
  19581. }
  19582. e.stopPropagation();
  19583. e.preventDefault();
  19584. }
  19585. }
  19586. }
  19587. }
  19588. });
  19589. }
  19590. var config = sender.config;
  19591. if (config.ff && config.ff > 0) {
  19592. setTimeout(function () {
  19593. if (typeof sender.focus2 === 'function') {
  19594. sender.focus2();
  19595. }
  19596. else {
  19597. sender.focus();
  19598. }
  19599. }, config.ff);
  19600. }
  19601. }
  19602. });
  19603. var config = this.config;
  19604. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19605. this.on({
  19606. keyup: function (sender, e) {
  19607. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19608. sender._raiseNextFocus(sender);
  19609. }
  19610. }
  19611. });
  19612. }
  19613. var that = this;
  19614. this.on({
  19615. keyup: function (sender, e, eOpts) {
  19616. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19617. return;
  19618. }
  19619. that.keydown_fun_item(sender, e, eOpts);
  19620. }
  19621. });
  19622. initComponent.call(this);
  19623. },
  19624. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19625. var that = sender;
  19626. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19627. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19628. var value = _$2.trim(sender.rawValue);
  19629. var r = that.fireEvent('scancode', that, value, event);
  19630. if (r === 'OK') {
  19631. // 停止事件的默认处理程序,停止事件的冒泡
  19632. // event.stopEvent();
  19633. event.preventDefault();
  19634. event.stopPropagation();
  19635. }
  19636. }
  19637. }, 100)
  19638. });
  19639. }
  19640. //# sourceMappingURL=textfield.js.map
  19641. function initTbFill () {
  19642. /**
  19643. *
  19644. */
  19645. var ct = Ext.toolbar.Fill.prototype.constructor;
  19646. Ext.toolbar.Fill.override({
  19647. constructor: function (config) {
  19648. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19649. ct.call(this, newConfig);
  19650. }
  19651. });
  19652. }
  19653. //# sourceMappingURL=tbfill.js.map
  19654. function initTbSeparator () {
  19655. /**
  19656. *
  19657. */
  19658. var ct = Ext.toolbar.Separator.prototype.constructor;
  19659. Ext.toolbar.Separator.override({
  19660. constructor: function (config) {
  19661. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19662. ct.call(this, newConfig);
  19663. }
  19664. });
  19665. }
  19666. //# sourceMappingURL=tbseparator.js.map
  19667. function initToolbar () {
  19668. /**
  19669. *
  19670. */
  19671. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19672. Ext.toolbar.Toolbar.override({
  19673. constructor: function (config) {
  19674. var newConfig = _$2.defaultsDeep({
  19675. // 强制性属性
  19676. }, baseConfig(config, 'cols-container'), config, toolbar);
  19677. ct.call(this, newConfig);
  19678. }
  19679. });
  19680. initTbFill();
  19681. initTbSeparator();
  19682. }
  19683. //# sourceMappingURL=toolbar.js.map
  19684. function initSplitter () {
  19685. var ct = Ext.resizer.Splitter.prototype.constructor;
  19686. Ext.resizer.Splitter.override({
  19687. constructor: function (config) {
  19688. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19689. ct.call(this, newConfig);
  19690. }
  19691. });
  19692. }
  19693. //# sourceMappingURL=splitter.js.map
  19694. /**
  19695. * 通用 dataSource 解析,
  19696. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19697. */
  19698. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19699. var config = ctl.config;
  19700. return new Promise(function (resolve, reject) {
  19701. if (!config.dataSource) {
  19702. // 没有设置数据源,直接置空
  19703. return Promise.resolve();
  19704. }
  19705. var option = {
  19706. extraParam: extraParam,
  19707. _successCb: _successCb,
  19708. successCallback: function (value) {
  19709. if (typeof successCallback === "function") {
  19710. successCallback(value);
  19711. }
  19712. else {
  19713. ctl.setData(value);
  19714. }
  19715. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19716. ctl.setLoading(false);
  19717. resolve(value);
  19718. },
  19719. failCallback: function (error) {
  19720. if (typeof failCallback === "function") {
  19721. failCallback(error);
  19722. }
  19723. ctl.fireEvent('dataLoadComplete', ctl, false);
  19724. ctl.setLoading(false);
  19725. reject(error);
  19726. }
  19727. };
  19728. // 请求前要求确认一下
  19729. var isCanceled = false;
  19730. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19731. isCanceled = true;
  19732. } }, option));
  19733. if (!isCanceled) {
  19734. // 请求没有被取消
  19735. // 调用异步接口返回 Promise
  19736. return _innerReload(ctl, option);
  19737. }
  19738. return reject();
  19739. });
  19740. }
  19741. function _innerReload(ctl, option) {
  19742. var config = ctl.config;
  19743. ctl.setLoading(true);
  19744. var scope = lookupScope(ctl);
  19745. var dataSource = config.dataSource;
  19746. if (typeof dataSource == 'string') {
  19747. dataSource = lookupFn(scope, config.dataSource);
  19748. }
  19749. if (typeof dataSource === 'function') {
  19750. // @ts-ignore
  19751. dataSource.call(scope, ctl, option);
  19752. return;
  19753. }
  19754. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19755. if (!ajax.func) {
  19756. console.error("没有配置 ajax");
  19757. return;
  19758. }
  19759. var params_1 = {};
  19760. var sortModel = null;
  19761. var filterModel = null;
  19762. if (option.extraParam && option.extraParam.filterModel) {
  19763. filterModel = option.extraParam.filterModel;
  19764. }
  19765. if (option.extraParam && option.extraParam.sortModel) {
  19766. sortModel = option.extraParam.sortModel;
  19767. }
  19768. _$2.forOwn(option.extraParam, function (v, key) {
  19769. if (key != "filterModel" && key != "sortModel") {
  19770. if (typeof v === 'function') {
  19771. params_1[key] = v();
  19772. }
  19773. else {
  19774. params_1[key] = v;
  19775. }
  19776. }
  19777. });
  19778. var ds = dataSource;
  19779. _$2.forOwn(ds.params, function (v, key) {
  19780. if (typeof v === 'function') {
  19781. params_1[key] = v();
  19782. }
  19783. else {
  19784. params_1[key] = v;
  19785. }
  19786. });
  19787. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19788. // @ts-ignore
  19789. ajax.func({
  19790. method: dataSource.method,
  19791. url: ds.url,
  19792. data: params_1,
  19793. filterModel: filterModel,
  19794. sortModel: sortModel,
  19795. }).then(function (res) {
  19796. if (res.success) {
  19797. option.successCallback(res.data);
  19798. }
  19799. else {
  19800. option.failCallback(res.msg);
  19801. }
  19802. }).catch(function (e) {
  19803. option.failCallback(e);
  19804. });
  19805. }
  19806. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19807. var ds_1 = ctl.dataSource;
  19808. // @ts-ignore
  19809. Extend.ajax.func({
  19810. url: ds_1.sqlId,
  19811. data: params_1,
  19812. db: ds_1.db,
  19813. method: 'sql',
  19814. filterModel: filterModel,
  19815. sortModel: sortModel,
  19816. }).then(function (res) {
  19817. if (res.success) {
  19818. option.successCallback(res.data);
  19819. }
  19820. else {
  19821. option.failCallback(res.msg);
  19822. }
  19823. }).catch(function (e) {
  19824. option.failCallback(e);
  19825. }).finally(function () {
  19826. ctl.loading = false;
  19827. });
  19828. return;
  19829. }
  19830. else {
  19831. console.error("非法的 dataSource", ctl.dataSource);
  19832. debugger;
  19833. throw new Error("非法的 dataSource");
  19834. }
  19835. }
  19836. }
  19837. //# sourceMappingURL=DataSourceHelper.js.map
  19838. function initCombo () {
  19839. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19840. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19841. Ext.form.field.ComboBox.override({
  19842. constructor: function (config) {
  19843. var newConfig = _$2.defaultsDeep({
  19844. // 强制性属性
  19845. }, baseConfig(config, 'col-item'), config, combo);
  19846. if (typeof config.dict === 'string') {
  19847. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19848. }
  19849. else if (typeof newConfig.store == 'undefined') {
  19850. if (_$2.isArray(newConfig.data)) {
  19851. // ExtJS 无法直接接受数组模式
  19852. newConfig.store = {
  19853. fields: [newConfig.valueField, newConfig.displayField],
  19854. data: newConfig.data
  19855. };
  19856. delete newConfig.data;
  19857. }
  19858. else if (typeof newConfig.data !== 'object') {
  19859. newConfig.store = {
  19860. fields: [newConfig.valueField, newConfig.displayField],
  19861. data: []
  19862. };
  19863. delete newConfig.data;
  19864. }
  19865. }
  19866. cc.call(this, newConfig);
  19867. },
  19868. setDict: function (bizKey) {
  19869. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19870. this.dict = bizKey;
  19871. },
  19872. getDict: function () {
  19873. return this.dict;
  19874. },
  19875. setData: function (value) {
  19876. if (!value) {
  19877. return;
  19878. }
  19879. var config = value.config;
  19880. if (!this.store) {
  19881. this.store = new Ext.data.Store({
  19882. fields: [config.valueField, config.displayField],
  19883. data: value
  19884. });
  19885. }
  19886. else {
  19887. this.store.getProxy().setData(value);
  19888. this.store.load();
  19889. }
  19890. },
  19891. setLoading: function (value) {
  19892. if (value) {
  19893. if (!this.loadMask) {
  19894. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19895. }
  19896. }
  19897. else {
  19898. if (this.loadMask) {
  19899. this.loadMask.destroy();
  19900. delete this.loadMask;
  19901. }
  19902. }
  19903. },
  19904. reload: function () {
  19905. dataSourceReload(this);
  19906. },
  19907. initComponent: function () {
  19908. var that = this;
  19909. var toggle = function (e) {
  19910. var readOnly = that.readOnly, disabled = that.disabled;
  19911. if (readOnly || disabled) {
  19912. return;
  19913. }
  19914. if ($(e.target).is('.x-form-trigger')) {
  19915. return;
  19916. }
  19917. // 点击后下拉
  19918. if (that.isExpanded) {
  19919. that.collapse();
  19920. }
  19921. else {
  19922. that.expand();
  19923. that.doQuery(that.allQuery, true);
  19924. }
  19925. };
  19926. this.on({
  19927. afterrender: function (sender) {
  19928. var config = this.config;
  19929. if (config.dataSource && config.autoLoad) {
  19930. dataSourceReload(this);
  19931. }
  19932. // 点击后下拉
  19933. $(this.el.dom).on('click', toggle.bind(this));
  19934. },
  19935. focusenter: function (sender, event, opt) {
  19936. var _a;
  19937. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19938. // 表格内编辑框,获取焦点后自动弹开
  19939. toggle.call(this, event);
  19940. }
  19941. },
  19942. destory: function () {
  19943. $(this.el.dom).off('click', toggle.bind(this));
  19944. },
  19945. beforequery: function (context) {
  19946. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19947. // console.log('beforequery', query)
  19948. if (!forceAll && query) {
  19949. combo.store.clearFilter();
  19950. combo.store.filterBy(function (record, id) {
  19951. var text = record.get(combo.displayField);
  19952. // 用拼音筛选的方式
  19953. return keywordFilter(query, text, id);
  19954. });
  19955. combo.expand();
  19956. return false;
  19957. }
  19958. combo.store.clearFilter();
  19959. combo.expand();
  19960. return false;
  19961. },
  19962. });
  19963. initComponent.call(this);
  19964. },
  19965. focus2: function () {
  19966. this.focus();
  19967. var that = this;
  19968. _$2.defer(function () {
  19969. if (that.isExpanded) {
  19970. that.collapse();
  19971. }
  19972. else {
  19973. that.expand();
  19974. that.doQuery(that.allQuery, true);
  19975. }
  19976. });
  19977. }
  19978. });
  19979. }
  19980. //# sourceMappingURL=combo.js.map
  19981. /**
  19982. xtype: 'tagfield',
  19983. displayField: 'show',
  19984. valueField: 'id',
  19985. queryMode: 'local',
  19986. filterPickList: true,
  19987. store: {
  19988. fields: ['id', 'show'],
  19989. data: [
  19990. {id: 0, show: 'Battlestar Galactica'},
  19991. {id: 1, show: 'Doctor Who'},
  19992. {id: 2, show: 'Farscape'},
  19993. {id: 3, show: 'Firefly'},
  19994. {id: 4, show: 'Star Trek'},
  19995. {id: 5, show: 'Star Wars: Christmas Special'}
  19996. ]
  19997. }
  19998. */
  19999. function initTag () {
  20000. var cc = Ext.form.field.Tag.prototype.constructor;
  20001. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20002. Ext.form.field.Tag.override({
  20003. constructor: function (config) {
  20004. var newConfig = _$2.defaultsDeep({
  20005. // 强制性属性
  20006. }, baseConfig(config, 'col-item'), config, tagfield);
  20007. if (typeof config.dict === 'string') {
  20008. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20009. }
  20010. else if (typeof newConfig.store == 'undefined') {
  20011. if (_$2.isArray(newConfig.data)) {
  20012. // ExtJS 无法直接接受数组模式
  20013. newConfig.store = {
  20014. fields: [newConfig.valueField, newConfig.displayField],
  20015. data: newConfig.data
  20016. };
  20017. delete newConfig.data;
  20018. }
  20019. else if (typeof newConfig.data !== 'object') {
  20020. newConfig.store = {
  20021. fields: [newConfig.valueField, newConfig.displayField],
  20022. data: []
  20023. };
  20024. delete newConfig.data;
  20025. }
  20026. }
  20027. cc.call(this, newConfig);
  20028. },
  20029. setDict: function (bizKey) {
  20030. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20031. this.dict = bizKey;
  20032. },
  20033. getDict: function () {
  20034. return this.dict;
  20035. },
  20036. setData: function (value) {
  20037. if (!value) {
  20038. return;
  20039. }
  20040. var config = value.config;
  20041. if (!this.store) {
  20042. this.store = new Ext.data.Store({
  20043. fields: [config.valueField, config.displayField],
  20044. data: value
  20045. });
  20046. }
  20047. else {
  20048. this.store.getProxy().setData(value);
  20049. this.store.load();
  20050. }
  20051. },
  20052. setLoading: function (value) {
  20053. if (value) {
  20054. if (!this.loadMask) {
  20055. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20056. }
  20057. }
  20058. else {
  20059. if (this.loadMask) {
  20060. this.loadMask.destroy();
  20061. delete this.loadMask;
  20062. }
  20063. }
  20064. },
  20065. reload: function () {
  20066. dataSourceReload(this);
  20067. },
  20068. initComponent: function () {
  20069. var that = this;
  20070. var toggle = function (e) {
  20071. var readOnly = that.readOnly, disabled = that.disabled;
  20072. if (readOnly || disabled) {
  20073. return;
  20074. }
  20075. if ($(e.target).is('.x-form-trigger')) {
  20076. return;
  20077. }
  20078. // 点击后下拉
  20079. if (that.isExpanded) {
  20080. that.collapse();
  20081. }
  20082. else {
  20083. that.expand();
  20084. that.doQuery(that.allQuery, true);
  20085. }
  20086. };
  20087. this.on({
  20088. afterrender: function (sender) {
  20089. var config = this.config;
  20090. if (config.dataSource && config.autoLoad) {
  20091. dataSourceReload(this);
  20092. }
  20093. // 点击后下拉
  20094. $(this.el.dom).on('click', toggle.bind(this));
  20095. },
  20096. focusenter: function (sender, event, opt) {
  20097. var _a;
  20098. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20099. // 表格内编辑框,获取焦点后自动弹开
  20100. toggle.call(this, event);
  20101. }
  20102. },
  20103. destory: function () {
  20104. $(this.el.dom).off('click', toggle.bind(this));
  20105. },
  20106. });
  20107. initComponent.call(this);
  20108. },
  20109. focus2: function () {
  20110. this.focus();
  20111. var that = this;
  20112. _$2.defer(function () {
  20113. if (that.isExpanded) {
  20114. that.collapse();
  20115. }
  20116. else {
  20117. that.expand();
  20118. that.doQuery(that.allQuery, true);
  20119. }
  20120. });
  20121. }
  20122. });
  20123. }
  20124. //# sourceMappingURL=tagfield.js.map
  20125. function initComboGridMulti () {
  20126. Ext.define('Yvan.LocalComboGrid', {
  20127. extend: 'Ext.form.field.Picker',
  20128. // extend: 'Yvan.PickerAlignCenter',
  20129. xtype: 'combogridmulti',
  20130. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20131. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20132. editable: false,
  20133. initComponent: function () {
  20134. this.on({
  20135. afterrender: function () {
  20136. var config = this.config;
  20137. if (config.dataSource && config.autoLoad) {
  20138. dataSourceReload(this);
  20139. }
  20140. },
  20141. });
  20142. this.superclass.initComponent.apply(this, arguments);
  20143. },
  20144. setStore: function (store) {
  20145. this.store = store;
  20146. var me = this;
  20147. if (me.store) {
  20148. if (me.picker) {
  20149. me.picker.setStore(store);
  20150. if (me.isExpanded) {
  20151. me.collapse();
  20152. delete me.picker;
  20153. me.expand();
  20154. }
  20155. }
  20156. this.onLoad();
  20157. me.mon(me.store, {
  20158. scope: me,
  20159. load: me.onLoad,
  20160. update: me.onUpdate
  20161. });
  20162. }
  20163. },
  20164. reload: function () {
  20165. dataSourceReload(this);
  20166. },
  20167. setData: function (value) {
  20168. var me = this;
  20169. var config = me.config;
  20170. if (!value) {
  20171. return;
  20172. }
  20173. if (!this.store) {
  20174. this.store = new Ext.data.Store({
  20175. fields: [config.valueField, config.displayField],
  20176. data: value
  20177. });
  20178. }
  20179. else {
  20180. this.store.getProxy().setData(value);
  20181. this.store.load();
  20182. }
  20183. this.onLoad();
  20184. },
  20185. createPicker: function () {
  20186. var me = this;
  20187. var picker = new Ext.grid.Panel(__assign(__assign({}, comboGridMultiPicker), { border: false, baseCls: Ext.baseCSSPrefix + 'boundlist', shrinkWrapDock: 2, store: me.store, floating: true, displayField: me.displayField, columns: me.columns, minHeight: me.minPickerHeight, maxHeight: me.maxPickerHeight, minWidth: me.minPickerWidth, manageHeight: false, shadow: false, scrollable: true, listeners: {
  20188. scope: me,
  20189. selectionchange: me.onSelectionChange,
  20190. itemkeydown: me.onPickerKeyDown
  20191. } })), view = picker.getView();
  20192. if (Ext.isIE9 && Ext.isStrict) {
  20193. view.on({
  20194. scope: me,
  20195. highlightitem: me.repaintPickerView,
  20196. unhighlightitem: me.repaintPickerView,
  20197. afteritemexpand: me.repaintPickerView,
  20198. afteritemcollapse: me.repaintPickerView
  20199. });
  20200. }
  20201. return picker;
  20202. },
  20203. repaintPickerView: function () {
  20204. var style = this.picker.getView().getEl().dom.style;
  20205. style.display = style.display;
  20206. },
  20207. onSelectionChange: function (view, record, node, rowIndex, e) {
  20208. this.selectItem(view, record);
  20209. },
  20210. onPickerKeyDown: function (treeView, record, item, index, e) {
  20211. var key = e.getKey();
  20212. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20213. this.selectItem(treeView, record);
  20214. }
  20215. },
  20216. selectItem: function (sender, record) {
  20217. var me = this;
  20218. var ids = [];
  20219. _$2.forEach(me.picker.getSelection(), function (record) {
  20220. ids.push(record.get(me.valueField));
  20221. });
  20222. me.fireEvent('select', me, record);
  20223. me.setValue(ids.join(me.splitChar));
  20224. // me.collapse();
  20225. },
  20226. onExpand: function () {
  20227. var me = this;
  20228. var picker = this.picker;
  20229. var value = this.value;
  20230. if (!me.store) {
  20231. msg('正在初始化数据,请稍后');
  20232. me.collapse();
  20233. return;
  20234. }
  20235. var vs = _$2.split(value, me.splitChar);
  20236. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20237. picker.setSelection(records);
  20238. },
  20239. setValue: function (value) {
  20240. var me = this;
  20241. console.log('setValue', value);
  20242. me.value = value;
  20243. if (!me.store || me.store.loading) {
  20244. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20245. return me.mixins.field.setValue.call(me, value);
  20246. // return me;
  20247. }
  20248. var vs = _$2.split(value, me.splitChar);
  20249. var displayValues = [];
  20250. _$2.forEach(vs, function (v) {
  20251. var _a;
  20252. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20253. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20254. if (dv) {
  20255. displayValues.push(dv);
  20256. }
  20257. else {
  20258. displayValues.push(v);
  20259. }
  20260. });
  20261. // set the raw value to the record's display field if a record was found
  20262. me.setRawValue(displayValues.join(me.splitChar));
  20263. return me.mixins.field.setValue.call(me, value);
  20264. },
  20265. getSubmitValue: function () {
  20266. return this.value;
  20267. },
  20268. getValue: function () {
  20269. return this.value;
  20270. },
  20271. onLoad: function () {
  20272. var value = this.value;
  20273. if (value) {
  20274. this.setValue(value);
  20275. }
  20276. },
  20277. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20278. var display = this.displayField;
  20279. var me = this;
  20280. if (type === 'edit' && modifiedFieldNames &&
  20281. Ext.Array.contains(modifiedFieldNames, display) &&
  20282. this.value === rec.getId()) {
  20283. me.mixins.field.setValue.call(me, this.value);
  20284. this.setRawValue(rec.get(display));
  20285. }
  20286. }
  20287. });
  20288. }
  20289. //# sourceMappingURL=combogridmulti.js.map
  20290. function initSearch () {
  20291. Ext.define('Yvan.Search', {
  20292. extend: 'Ext.form.field.Text',
  20293. alias: 'widget.searchfield',
  20294. xtype: 'searchfield',
  20295. constructor: function (config) {
  20296. var self = this;
  20297. var newConfig = _$2.defaultsDeep({
  20298. // 强制性属性
  20299. triggers: {
  20300. clear: {
  20301. weight: 0,
  20302. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20303. hidden: true,
  20304. handler: 'onClearClick',
  20305. },
  20306. search: {
  20307. weight: 1,
  20308. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20309. handler: 'onSearchClick'
  20310. },
  20311. },
  20312. listeners: {
  20313. blur: function (sender, e) {
  20314. this.revertOnblur();
  20315. },
  20316. specialkey: function (sender, e) {
  20317. var _a;
  20318. var me = this;
  20319. if (e.getKey() === e.ENTER) {
  20320. me.onSearchClick(sender, {}, e);
  20321. return;
  20322. }
  20323. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20324. },
  20325. afterrender: function (sender, e) {
  20326. var _a;
  20327. this.replaceRawInputEvent();
  20328. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20329. }
  20330. },
  20331. }, baseConfig(config, 'col-item'), config, search);
  20332. this.superclass.constructor.call(self, newConfig);
  20333. },
  20334. revertOnblur: function () {
  20335. this.setRawValue(this.lastValue);
  20336. },
  20337. onSearchClick: function (sender, vv, e) {
  20338. var me = this;
  20339. var config = me.config;
  20340. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20341. if (e) {
  20342. e.preventDefault();
  20343. e.stopPropagation();
  20344. }
  20345. this.fireEvent('search', sender, e);
  20346. if (!widget) {
  20347. return;
  20348. }
  20349. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20350. },
  20351. replaceRawInputEvent: function () {
  20352. var me = this;
  20353. var $dom = $(me.inputEl.dom);
  20354. $dom.on('input', function (e) {
  20355. stopEvent(e);
  20356. // console.log('has input', e)
  20357. });
  20358. $dom.on('keyup', function (e) {
  20359. if (e.key === "Enter") {
  20360. me.onSearchClick(me, {}, e);
  20361. return;
  20362. }
  20363. stopEvent(e);
  20364. });
  20365. $dom.on('change', function (e) {
  20366. stopEvent(e);
  20367. });
  20368. },
  20369. onChange: function (newVal, oldVal) {
  20370. var me = this;
  20371. var value = newVal;
  20372. if (value) {
  20373. me.getTrigger('clear').show();
  20374. me.updateLayout();
  20375. }
  20376. else {
  20377. me.getTrigger('clear').hide();
  20378. me.updateLayout();
  20379. }
  20380. },
  20381. /**
  20382. * 清空所有值
  20383. */
  20384. onClearClick: function (sender, e) {
  20385. var me = this;
  20386. var config = me.config;
  20387. var lookup = config.lookup;
  20388. me.setValue('');
  20389. clearViewModelByLookup(sender, lookup);
  20390. }
  20391. });
  20392. }
  20393. //# sourceMappingURL=search.js.map
  20394. function initMultipleSearch () {
  20395. Ext.define('Yvan.MultipleSearch', {
  20396. extend: 'Ext.form.field.Text',
  20397. xtype: 'multiplesearch',
  20398. bindTargert: '',
  20399. constructor: function (config) {
  20400. var _a, _b, _c, _d;
  20401. var self = this;
  20402. var newConfig = _$2.defaultsDeep({
  20403. // 强制性属性
  20404. triggers: {
  20405. clear: {
  20406. weight: 0,
  20407. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20408. hidden: true,
  20409. handler: 'onClearClick',
  20410. }
  20411. },
  20412. transformRawValue: function (o) {
  20413. return o;
  20414. },
  20415. listeners: {
  20416. specialkey: function (sender, e) {
  20417. var me = this;
  20418. if (e.getKey() === e.ENTER) {
  20419. me.fireEvent('search', me, e);
  20420. }
  20421. },
  20422. afterrender: function (sender, e) {
  20423. var _a;
  20424. this.replaceRawInputEvent();
  20425. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20426. }
  20427. },
  20428. }, baseConfig(config, 'col-item'), config, search);
  20429. this.superclass.constructor.call(self, newConfig);
  20430. var vv = (_d = (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.bind) === null || _b === void 0 ? void 0 : _b.value) || ((_c = this.config) === null || _c === void 0 ? void 0 : _c.bind))) !== null && _d !== void 0 ? _d : '';
  20431. vv = _$2.replace(vv, "{", "");
  20432. vv = _$2.replace(vv, "}", "");
  20433. this.bindTargert = vv;
  20434. this.bindTargert = _$2.trim(this.bindTargert);
  20435. },
  20436. setBindValue: function (arrValue) {
  20437. if (this.bindTargert) {
  20438. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20439. }
  20440. },
  20441. replaceRawInputEvent: function () {
  20442. var me = this;
  20443. var $dom = $(me.inputEl.dom);
  20444. $dom.on('input', function (e) {
  20445. var _a, _b, _c, _d, _e, _f;
  20446. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20447. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20448. if (!a.endsWith(",") && a.length > 0) {
  20449. e.currentTarget.value = a + ",";
  20450. }
  20451. else {
  20452. e.currentTarget.value = a;
  20453. }
  20454. }
  20455. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20456. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20457. _$2.remove(arr, function (it) {
  20458. return !it;
  20459. });
  20460. me.setBindValue(arr);
  20461. stopEvent(e);
  20462. });
  20463. $dom.on('keyup', function (e) {
  20464. me.fireEvent('keyup', me, e);
  20465. // invokeMethod(me.config.listeners?.keyup, me, e)
  20466. stopEvent(e);
  20467. });
  20468. $dom.on('keydown', function (e) {
  20469. me.fireEvent('keydown', me, e);
  20470. // invokeMethod(me.config.listeners?.keydown, me, e)
  20471. //stopEvent(e)
  20472. });
  20473. $dom.on('change', function (e) {
  20474. stopEvent(e);
  20475. });
  20476. $dom.on('paste', function (e) {
  20477. var _a;
  20478. // @ts-ignore
  20479. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20480. var text = clipdata.getData("text/plain");
  20481. var spliter = ',';
  20482. text = text.replaceAll("\r", "");
  20483. text = text.replaceAll("\n", spliter);
  20484. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20485. var arr = text.split(spliter);
  20486. if (arr && Array.isArray(arr)) {
  20487. for (var i = 0; i < arr.length; i++) {
  20488. arr[i] = _$2.trim(arr[i]);
  20489. }
  20490. }
  20491. _$2.remove(arr, function (it) {
  20492. return !it;
  20493. });
  20494. me.setBindValue(arr);
  20495. stopEvent(e);
  20496. });
  20497. },
  20498. onChange: function (newVal, oldVal) {
  20499. var me = this;
  20500. var value = newVal;
  20501. if (value) {
  20502. me.getTrigger('clear').show();
  20503. me.updateLayout();
  20504. }
  20505. else {
  20506. me.getTrigger('clear').hide();
  20507. me.updateLayout();
  20508. }
  20509. },
  20510. /**
  20511. * 清空所有值
  20512. */
  20513. onClearClick: function (sender, e) {
  20514. var me = this;
  20515. var config = me.config;
  20516. var lookup = config.lookup;
  20517. me.setValue('');
  20518. clearViewModelByLookup(sender, lookup);
  20519. }
  20520. });
  20521. }
  20522. //# sourceMappingURL=multiplesearch.js.map
  20523. function initDate () {
  20524. var cc = Ext.form.field.Date.prototype.constructor;
  20525. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20526. Ext.form.field.Date.override({
  20527. format: 'Y-m-d',
  20528. altFormats: 'Y-m-d',
  20529. constructor: function (config) {
  20530. var newConfig = _$2.defaultsDeep({
  20531. // 强制属性
  20532. }, baseConfig(config, 'col-item'), config, date);
  20533. cc.call(this, newConfig);
  20534. },
  20535. getValue: function () {
  20536. var ov = getValue.call(this);
  20537. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20538. // console.log('cc:', nv, ov)
  20539. return nv;
  20540. },
  20541. // focus2() {
  20542. // const that = this
  20543. // if (that.isExpanded) {
  20544. // that.collapse()
  20545. //
  20546. // } else {
  20547. // that.expand();
  20548. // }
  20549. // _.defer(() => {
  20550. // that.focus()
  20551. // })
  20552. // },
  20553. initComponent: function () {
  20554. this.on({
  20555. afterrender: function () {
  20556. var config = this.config;
  20557. // 日期框,不要默认弹出
  20558. // $(this.el.dom).on('click', toggle.bind(this))
  20559. },
  20560. destory: function () {
  20561. // 日期框,不要默认弹出
  20562. // $(this.el.dom).off('click', toggle.bind(this))
  20563. },
  20564. change: {
  20565. fn: function (sender) {
  20566. if (sender.format === 'Y-m-d') {
  20567. // 年月日格式
  20568. var value = sender.getRawValue();
  20569. if (/^\d{8}$/.test(value)) {
  20570. // 8位数字,自动转换为 YYYY-MM-DD
  20571. var newValue = [
  20572. value.substr(0, 4),
  20573. value.substr(4, 2),
  20574. value.substr(6, 2)
  20575. ].join('-');
  20576. sender.setValue(newValue);
  20577. }
  20578. }
  20579. },
  20580. }
  20581. // focus: {
  20582. // // 获得焦点后自动下拉
  20583. // fn(sender) {
  20584. // sender.expand();
  20585. // this.doQuery(this.allQuery, true);
  20586. // },
  20587. // },
  20588. });
  20589. initComponent.call(this);
  20590. },
  20591. createInitialDate: function (value) {
  20592. var minValue = this.minValue, maxValue = this.maxValue;
  20593. value = value || syncDate(new Date());
  20594. if (minValue && minValue > value) {
  20595. value = minValue;
  20596. }
  20597. else if (maxValue && maxValue < value) {
  20598. value = maxValue;
  20599. }
  20600. return value;
  20601. },
  20602. });
  20603. }
  20604. //# sourceMappingURL=datefield.js.map
  20605. function initDateTimePicker () {
  20606. Ext.define('Yvan.DateTimePicker', {
  20607. extend: 'Ext.picker.Date',
  20608. alias: 'datetimepicker',
  20609. alternateClassName: 'Ext.DateTimePicker',
  20610. renderTpl: [
  20611. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20612. '<div class="{baseCls}-header">',
  20613. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20614. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20615. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20616. '</div>',
  20617. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20618. '<thead>',
  20619. '<tr role="row">',
  20620. '<tpl for="dayNames">',
  20621. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20622. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20623. '</th>',
  20624. '</tpl>',
  20625. '</tr>',
  20626. '</thead>',
  20627. '<tbody>',
  20628. '<tr role="row">',
  20629. '<tpl for="days">',
  20630. '{#:this.isEndOfWeek}',
  20631. '<td role="gridcell">',
  20632. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20633. '</td>',
  20634. '</tpl>',
  20635. '</tr>',
  20636. '</tbody>',
  20637. '</table>',
  20638. '<tpl if="showToday">',
  20639. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20640. '</tpl>',
  20641. // These elements are used with Assistive Technologies such as screen readers
  20642. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20643. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20644. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20645. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20646. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20647. '</div>',
  20648. {
  20649. firstInitial: function (value) {
  20650. return Ext.picker.Date.prototype.getDayInitial(value);
  20651. },
  20652. isEndOfWeek: function (value) {
  20653. // convert from 1 based index to 0 based
  20654. // by decrementing value once.
  20655. value--;
  20656. // eslint-disable-next-line vars-on-top
  20657. var end = value % 7 === 0 && value !== 0;
  20658. return end ? '</tr><tr role="row">' : '';
  20659. },
  20660. renderTodayBtn: function (values, out) {
  20661. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20662. },
  20663. renderMonthBtn: function (values, out) {
  20664. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20665. }
  20666. }
  20667. ],
  20668. beforeRender: function () {
  20669. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20670. this.superclass.beforeRender.call(this);
  20671. function handleInput(extHandle, $input) {
  20672. var $dom = $(extHandle.el.dom);
  20673. // const $up = $dom.find('.x-form-spinner-up')
  20674. // const $down = $dom.find('.x-form-spinner-down')
  20675. // debugger
  20676. // $up.on('mousedown', () => {
  20677. // debugger
  20678. // });
  20679. // $up.on('click', () => {
  20680. // debugger
  20681. // });
  20682. extHandle.on('click', function (sender) {
  20683. var hideBak = me.hide;
  20684. me.hide = Ext.emptyFn;
  20685. extHandle.focus();
  20686. me.hide = hideBak;
  20687. });
  20688. var changeValue = function (delta) {
  20689. if (_$2.trim(extHandle.getValue()) === '') {
  20690. extHandle.setValue(extHandle.minValue);
  20691. }
  20692. else {
  20693. var v = parseInt('' + extHandle.getValue());
  20694. if (v + delta > extHandle.maxValue) {
  20695. extHandle.setValue(extHandle.minValue);
  20696. }
  20697. else if (v + delta < extHandle.minValue) {
  20698. extHandle.setValue(extHandle.maxValue);
  20699. }
  20700. else {
  20701. extHandle.setValue(v + delta);
  20702. }
  20703. }
  20704. };
  20705. $input.on('mousewheel', function (e) {
  20706. e.stopPropagation();
  20707. var event = e.originalEvent;
  20708. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20709. // if (event.wheelDelta) {
  20710. // delta = event.wheelDelta / 120;
  20711. // } else if (event.detail) {
  20712. // delta = -event.detail / 3;
  20713. // }
  20714. var zoomSize = Math.ceil(eventDelta / 120);
  20715. changeValue(zoomSize);
  20716. // console.log('delta', delta)
  20717. // $input.focus()
  20718. });
  20719. }
  20720. me.input1 = Ext.create('Ext.form.field.Number', {
  20721. minValue: 0,
  20722. maxValue: 23,
  20723. flex: 1,
  20724. enableKeyEvents: true,
  20725. fieldLabel: '时',
  20726. labelWidth: 20,
  20727. hideLabel: true,
  20728. spinDownEnabled: false,
  20729. spinUpEnabled: false,
  20730. style: {
  20731. marginLeft: '5px',
  20732. },
  20733. listeners: {
  20734. afterrender: function (sender) {
  20735. var $input = $(sender.inputEl.dom);
  20736. handleInput(me.input1, $input);
  20737. },
  20738. change: function (sender, e) {
  20739. if (me.getValue()) {
  20740. me.value.setHours(sender.getValue());
  20741. }
  20742. },
  20743. }
  20744. });
  20745. me.input2 = Ext.create('Ext.form.field.Number', {
  20746. minValue: 0,
  20747. maxValue: 59,
  20748. flex: 1,
  20749. enableKeyEvents: true,
  20750. fieldLabel: ' ',
  20751. hideLabel: false,
  20752. labelWidth: 8,
  20753. spinDownEnabled: false,
  20754. spinUpEnabled: false,
  20755. listeners: {
  20756. afterrender: function (sender) {
  20757. var $input = $(sender.inputEl.dom);
  20758. handleInput(me.input2, $input);
  20759. },
  20760. change: function (sender, e) {
  20761. if (me.getValue()) {
  20762. me.value.setMinutes(sender.getValue());
  20763. }
  20764. },
  20765. }
  20766. });
  20767. me.input3 = Ext.create('Ext.form.field.Number', {
  20768. minValue: 0,
  20769. maxValue: 59,
  20770. flex: 1,
  20771. enableKeyEvents: true,
  20772. fieldLabel: ' ',
  20773. hideLabel: false,
  20774. labelWidth: 8,
  20775. spinDownEnabled: false,
  20776. spinUpEnabled: false,
  20777. style: {
  20778. marginRight: '5px',
  20779. },
  20780. listeners: {
  20781. afterrender: function (sender) {
  20782. var $input = $(sender.inputEl.dom);
  20783. handleInput(me.input3, $input);
  20784. },
  20785. change: function (sender, e) {
  20786. if (me.getValue()) {
  20787. me.value.setSeconds(sender.getValue());
  20788. }
  20789. },
  20790. }
  20791. });
  20792. me.confirmBtn = new Ext.button.Button({
  20793. text: '确认',
  20794. handler: me.confirmClick,
  20795. scope: me
  20796. });
  20797. me.tdBtn = new Ext.button.Button({
  20798. text: '现在',
  20799. handler: me.selectToday,
  20800. scope: me
  20801. });
  20802. me.todayBtn = Ext.create('Ext.container.Container', {
  20803. layout: 'anchor', border: false,
  20804. defaults: {
  20805. border: false, anchor: '100%',
  20806. margin: '0 0 5 0',
  20807. },
  20808. items: [
  20809. {
  20810. layout: 'hbox',
  20811. items: [
  20812. me.input1,
  20813. me.input2,
  20814. me.input3,
  20815. ]
  20816. },
  20817. {
  20818. layout: 'hbox',
  20819. items: [
  20820. me.confirmBtn,
  20821. me.tdBtn,
  20822. ]
  20823. }
  20824. ]
  20825. });
  20826. },
  20827. // finishRenderChildren() {
  20828. // var me = this;
  20829. //
  20830. // this.superclass.finishRenderChildren.call(this);
  20831. // //*
  20832. // me.input1.finishRender();
  20833. // me.input2.finishRender();
  20834. // me.input3.finishRender();
  20835. // //
  20836. // me.tdBtn.finishRender();
  20837. // me.confirmBtn.finishRender();
  20838. // },
  20839. setValue: function (value) {
  20840. //this.value = Ext.Date.clearTime(value, true);
  20841. this.value = value;
  20842. this.input1.setValue(this.value.getHours());
  20843. this.input2.setValue(this.value.getMinutes());
  20844. this.input3.setValue(this.value.getSeconds());
  20845. return this.update(this.value);
  20846. },
  20847. selectDate: function (value) {
  20848. if (this.showTime) {
  20849. value.setHours(this.input1.getValue());
  20850. value.setMinutes(this.input2.getValue());
  20851. value.setSeconds(this.input3.getValue());
  20852. }
  20853. this.value = value;
  20854. return this.update(this.value);
  20855. },
  20856. setDisabledStatus: function (disabled) {
  20857. var me = this;
  20858. debugger;
  20859. // me.callParent();
  20860. if (me.showTime) {
  20861. me.confirmBtn.setDisabled(disabled);
  20862. }
  20863. if (me.isShowFooter()) {
  20864. me.footerContainer.setDisabled(disabled);
  20865. }
  20866. },
  20867. handleDateClick: function (e, t) {
  20868. var me = this, handler = me.handler;
  20869. // e.stopEvent();
  20870. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20871. me.doCancelFocus = me.focusOnSelect === false;
  20872. me.selectDate(new Date(t.dateValue));
  20873. delete me.doCancelFocus;
  20874. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20875. if (me.showTime) {
  20876. return;
  20877. }
  20878. me.fireEvent('select', me, me.value);
  20879. if (handler) {
  20880. handler.call(me.scope || me, me, me.value);
  20881. }
  20882. me.onSelect();
  20883. }
  20884. },
  20885. selectToday: function () {
  20886. var me = this, btn = me.todayBtn, handler = me.handler;
  20887. if (btn && !btn.disabled) {
  20888. me.value = syncDate(new Date());
  20889. me.update(me.value);
  20890. me.fireEvent('select', me, me.value);
  20891. if (handler) {
  20892. handler.call(me.scope || me, me, me.value);
  20893. }
  20894. me.onSelect();
  20895. me.hide();
  20896. }
  20897. return me;
  20898. },
  20899. confirmClick: function () {
  20900. var me = this, btn = me.confirmBtn, handler = me.handler;
  20901. if (btn && !btn.disabled) {
  20902. me.fireEvent('select', me, me.value);
  20903. if (handler) {
  20904. handler.call(me.scope || me, me, me.value);
  20905. }
  20906. me.onSelect();
  20907. me.hide();
  20908. }
  20909. return me;
  20910. },
  20911. selectedUpdate: function (date) {
  20912. var me = this,
  20913. //t = date.getTime(),
  20914. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20915. cells.removeCls(cls);
  20916. for (c = 0; c < cLen; c++) {
  20917. cell = Ext.fly(cellItems[c]);
  20918. if (cell.dom.firstChild.dateValue == t) {
  20919. me.fireEvent('highlightitem', me, cell);
  20920. cell.addCls(cls);
  20921. if (me.isVisible() && !me.doCancelFocus) {
  20922. Ext.fly(cell.dom.firstChild).focus(50);
  20923. }
  20924. break;
  20925. }
  20926. }
  20927. },
  20928. // private, inherit docs
  20929. beforeDestroy: function () {
  20930. var me = this;
  20931. if (me.rendered) {
  20932. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20933. }
  20934. me.superclass.beforeDestroy.call(this);
  20935. }
  20936. });
  20937. }
  20938. //# sourceMappingURL=datetimepicker.js.map
  20939. function initDateTime () {
  20940. Ext.define('Yvan.DateTimeField', {
  20941. extend: 'Ext.form.field.Date',
  20942. xtype: 'datetimefield',
  20943. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20944. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20945. showTime: true,
  20946. format: "Y-m-d H:i:s",
  20947. constructor: function (config) {
  20948. var newConfig = _$2.defaultsDeep({
  20949. // 强制属性
  20950. }, baseConfig(config, 'col-item'), config, date);
  20951. this.superclass.constructor.call(this, newConfig);
  20952. },
  20953. initComponent: function () {
  20954. this.superclass.initComponent.call(this);
  20955. var setInitValue = function () {
  20956. var value = this.getRawValue();
  20957. if (!value) {
  20958. // 没填内容的时候,自动设置当前时间
  20959. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20960. }
  20961. };
  20962. this.on({
  20963. afterrender: function () {
  20964. var config = this.config;
  20965. // 日期框,不要默认弹出
  20966. $(this.el.dom).on('click', setInitValue.bind(this));
  20967. },
  20968. destory: function () {
  20969. // 日期框,不要默认弹出
  20970. $(this.el.dom).off('click', setInitValue.bind(this));
  20971. },
  20972. change: {
  20973. fn: function (sender) {
  20974. if (sender.format === "Y-m-d H:i:s") {
  20975. // 年月日格式
  20976. var value = sender.getRawValue();
  20977. if (/^\d{14}$/.test(value)) {
  20978. // 8位数字,自动转换为 YYYY-MM-DD
  20979. var newValue = [
  20980. value.substr(0, 4),
  20981. '-',
  20982. value.substr(4, 2),
  20983. '-',
  20984. value.substr(6, 2),
  20985. ' ',
  20986. value.substr(8, 2),
  20987. ':',
  20988. value.substr(10, 2),
  20989. ':',
  20990. value.substr(12, 2)
  20991. ].join('');
  20992. sender.setValue(newValue);
  20993. }
  20994. }
  20995. },
  20996. }
  20997. });
  20998. },
  20999. getValue: function () {
  21000. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  21001. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  21002. // console.log('cc:', nv, ov)
  21003. return nv;
  21004. },
  21005. onExpand: function () {
  21006. var strValue = this.getValue();
  21007. var value;
  21008. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21009. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)), parseInt(strValue.substr(11, 2)), parseInt(strValue.substr(14, 2)), parseInt(strValue.substr(17, 2)));
  21010. }
  21011. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21012. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21013. }
  21014. else {
  21015. value = syncDate(new Date());
  21016. }
  21017. this.picker.setValue(value);
  21018. },
  21019. createPicker: function () {
  21020. var me = this, format = Ext.String.format;
  21021. //@ts-ignore
  21022. return new Yvan.DateTimePicker({
  21023. pickerField: me,
  21024. ownerCt: me.ownerCt,
  21025. renderTo: document.body,
  21026. floating: true,
  21027. hidden: true,
  21028. focusOnShow: true,
  21029. minDate: me.minValue,
  21030. maxDate: me.maxValue,
  21031. disabledDatesRE: me.disabledDatesRE,
  21032. disabledDatesText: me.disabledDatesText,
  21033. disabledDays: me.disabledDays,
  21034. disabledDaysText: me.disabledDaysText,
  21035. format: me.format,
  21036. showToday: me.showToday,
  21037. showTime: me.showTime,
  21038. startDay: me.startDay,
  21039. minText: format(me.minText, me.formatDate(me.minValue)),
  21040. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21041. listeners: {
  21042. scope: me,
  21043. select: me.onSelect
  21044. },
  21045. keyNavConfig: {
  21046. esc: function () {
  21047. me.collapse();
  21048. }
  21049. }
  21050. });
  21051. },
  21052. });
  21053. }
  21054. //# sourceMappingURL=datetimefield.js.map
  21055. function initNumber () {
  21056. var cc = Ext.form.field.Number.prototype.constructor;
  21057. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21058. Ext.form.field.Number.override({
  21059. constructor: function (config) {
  21060. var newConfig = _$2.defaultsDeep({
  21061. // 强制属性
  21062. }, baseConfig(config, 'col-item'), config, numberfield);
  21063. cc.call(this, newConfig);
  21064. },
  21065. initComponent: function () {
  21066. this.on({
  21067. afterrender: function (sender) {
  21068. var _this = this;
  21069. var _a;
  21070. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21071. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21072. $$2(sender.inputEl.dom).on('click', function (e) {
  21073. sender.fireEvent('click', _this, e);
  21074. });
  21075. }
  21076. }
  21077. });
  21078. initComponent.call(this);
  21079. },
  21080. });
  21081. }
  21082. //# sourceMappingURL=numberfield.js.map
  21083. function initCheckbox () {
  21084. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21085. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21086. Ext.form.field.Checkbox.override({
  21087. constructor: function (config) {
  21088. var newConfig = _$2.defaultsDeep({
  21089. // 强制属性
  21090. }, baseConfig(config, 'col-item'), config, checkbox);
  21091. cc.call(this, newConfig);
  21092. },
  21093. getValue: function () {
  21094. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21095. var ov = getValue.call(this);
  21096. // const ov = this.getRawValue()
  21097. return (ov ? checkedValue : uncheckedValue);
  21098. },
  21099. setValue: function (nv) {
  21100. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21101. var value;
  21102. if (nv === checkedValue) {
  21103. value = true;
  21104. }
  21105. else if (nv === uncheckedValue) {
  21106. value = false;
  21107. }
  21108. else {
  21109. value = !!nv;
  21110. }
  21111. // me.setRawValue(value)
  21112. // me.checked = value
  21113. // return me.mixins.field.setValue.call(me, value);
  21114. setValue.call(this, value);
  21115. },
  21116. updateCheckedCls: function (checked) {
  21117. var me = this;
  21118. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21119. checked = checked != null ? checked : me.getValue();
  21120. if (checked === uncheckedValue) {
  21121. checked = false;
  21122. }
  21123. else if (checked === checkedValue) {
  21124. checked = true;
  21125. }
  21126. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21127. },
  21128. initComponent: function () {
  21129. initComponent.call(this);
  21130. },
  21131. });
  21132. }
  21133. //# sourceMappingURL=checkbox.js.map
  21134. function initCheckboxGroup () {
  21135. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21136. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21137. Ext.form.CheckboxGroup.override({
  21138. constructor: function (config) {
  21139. var newConfig = _$2.defaultsDeep({
  21140. // 强制属性
  21141. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21142. cc.call(this, newConfig);
  21143. },
  21144. initComponent: function () {
  21145. initComponent.call(this);
  21146. },
  21147. });
  21148. }
  21149. //# sourceMappingURL=checkboxgroup.js.map
  21150. function initRadio () {
  21151. var cc = Ext.form.field.Radio.prototype.constructor;
  21152. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21153. Ext.form.field.Radio.override({
  21154. constructor: function (config) {
  21155. var newConfig = _$2.defaultsDeep({
  21156. // 强制属性
  21157. }, baseConfig(config, 'col-item'), config, radio);
  21158. cc.call(this, newConfig);
  21159. },
  21160. initComponent: function () {
  21161. initComponent.call(this);
  21162. },
  21163. });
  21164. }
  21165. //# sourceMappingURL=radio.js.map
  21166. function initRadioGroup () {
  21167. var cc = Ext.form.RadioGroup.prototype.constructor;
  21168. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21169. Ext.form.RadioGroup.override({
  21170. constructor: function (config) {
  21171. var newConfig = _$2.defaultsDeep({
  21172. // 强制属性
  21173. }, baseConfig(config, 'col-item'), config, radiogroup);
  21174. cc.call(this, newConfig);
  21175. },
  21176. initComponent: function () {
  21177. initComponent.call(this);
  21178. },
  21179. });
  21180. }
  21181. //# sourceMappingURL=radiogroup.js.map
  21182. function initFieldset () {
  21183. /**
  21184. *
  21185. */
  21186. var ct = Ext.form.FieldSet.prototype.constructor;
  21187. Ext.form.FieldSet.override({
  21188. constructor: function (config) {
  21189. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21190. ct.call(this, newConfig);
  21191. }
  21192. });
  21193. }
  21194. //# sourceMappingURL=fieldset.js.map
  21195. function initCombotree () {
  21196. Ext.define('Yvan.ComboTree', {
  21197. extend: 'Ext.form.field.Picker',
  21198. xtype: 'combotree',
  21199. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21200. config: {
  21201. store: null,
  21202. displayField: null,
  21203. columns: null,
  21204. selectOnTab: true,
  21205. maxPickerHeight: 300,
  21206. minPickerHeight: 100,
  21207. minPickerWidth: 350,
  21208. rootVisible: true,
  21209. },
  21210. editable: false,
  21211. setStore: function (store) {
  21212. this.store = store;
  21213. var me = this;
  21214. if (me.store) {
  21215. if (me.picker) {
  21216. me.picker.setStore(store);
  21217. if (me.isExpanded) {
  21218. me.collapse();
  21219. delete me.picker;
  21220. me.expand();
  21221. }
  21222. }
  21223. this.onLoad();
  21224. me.mon(me.store, {
  21225. scope: me,
  21226. load: me.onLoad,
  21227. update: me.onUpdate
  21228. });
  21229. }
  21230. },
  21231. createPicker: function () {
  21232. var me = this;
  21233. var picker = new Ext.tree.Panel({
  21234. border: false,
  21235. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21236. shrinkWrapDock: 2,
  21237. store: me.store,
  21238. floating: true,
  21239. rootVisible: me.rootVisible,
  21240. displayField: me.displayField,
  21241. columns: me.columns,
  21242. minHeight: me.minPickerHeight,
  21243. maxHeight: me.maxPickerHeight,
  21244. minWidth: me.minPickerWidth,
  21245. manageHeight: false,
  21246. shadow: false,
  21247. scrollable: true,
  21248. // modal: true,
  21249. // constrain: true,
  21250. // constrainTo: topScope._handle.el.dom,
  21251. // renderTo: topScope._handle.el.dom,
  21252. // alignTarget: topScope._handle,
  21253. listeners: {
  21254. scope: me,
  21255. itemclick: me.onItemClick,
  21256. itemkeydown: me.onPickerKeyDown
  21257. }
  21258. }), view = picker.getView();
  21259. if (Ext.isIE9 && Ext.isStrict) {
  21260. view.on({
  21261. scope: me,
  21262. highlightitem: me.repaintPickerView,
  21263. unhighlightitem: me.repaintPickerView,
  21264. afteritemexpand: me.repaintPickerView,
  21265. afteritemcollapse: me.repaintPickerView
  21266. });
  21267. }
  21268. return picker;
  21269. },
  21270. repaintPickerView: function () {
  21271. var style = this.picker.getView().getEl().dom.style;
  21272. style.display = style.display;
  21273. },
  21274. onItemClick: function (view, record, node, rowIndex, e) {
  21275. this.selectItem(view, record);
  21276. },
  21277. onPickerKeyDown: function (treeView, record, item, index, e) {
  21278. var key = e.getKey();
  21279. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21280. this.selectItem(treeView, record);
  21281. }
  21282. },
  21283. selectItem: function (sender, record) {
  21284. var me = this;
  21285. me.setValue(record.getId());
  21286. me.fireEvent('select', me, record);
  21287. me.collapse();
  21288. },
  21289. onExpand: function () {
  21290. var picker = this.picker;
  21291. var store = picker.store;
  21292. var value = this.value;
  21293. var node;
  21294. if (value) {
  21295. node = store.getNodeById(value);
  21296. }
  21297. if (!node) {
  21298. node = store.getRoot();
  21299. }
  21300. picker.ensureVisible(node, {
  21301. select: true,
  21302. focus: true
  21303. });
  21304. },
  21305. setValue: function (value) {
  21306. var me = this;
  21307. console.log('setValue', value);
  21308. me.value = value;
  21309. if (!me.store || me.store.loading) {
  21310. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21311. return me.mixins.field.setValue.call(me, value);
  21312. // return me;
  21313. }
  21314. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21315. if (value === undefined) {
  21316. record = me.store.getRoot();
  21317. console.log('setValue', record.getId());
  21318. me.value = record.getId();
  21319. return me.mixins.field.setValue.call(me, value);
  21320. }
  21321. else {
  21322. record = me.store.getNodeById(value);
  21323. }
  21324. // set the raw value to the record's display field if a record was found
  21325. me.setRawValue(record ? record.get(me.displayField) : '');
  21326. return me.mixins.field.setValue.call(me, value);
  21327. },
  21328. getSubmitValue: function () {
  21329. return this.value;
  21330. },
  21331. getValue: function () {
  21332. return this.value;
  21333. },
  21334. onLoad: function () {
  21335. var value = this.value;
  21336. if (value) {
  21337. this.setValue(value);
  21338. }
  21339. },
  21340. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21341. var display = this.displayField;
  21342. var me = this;
  21343. if (type === 'edit' && modifiedFieldNames &&
  21344. Ext.Array.contains(modifiedFieldNames, display) &&
  21345. this.value === rec.getId()) {
  21346. me.mixins.field.setValue.call(me, this.value);
  21347. this.setRawValue(rec.get(display));
  21348. }
  21349. }
  21350. });
  21351. }
  21352. //# sourceMappingURL=combotree.js.map
  21353. function initPickerPlus () {
  21354. Ext.define('Yvan.PickerAlignCenter', {
  21355. extend: 'Ext.form.field.Picker',
  21356. /**
  21357. * Performs the alignment on the picker using the class defaults
  21358. * @private
  21359. */
  21360. doAlign: function () {
  21361. // 不要挪动就好
  21362. },
  21363. });
  21364. }
  21365. //# sourceMappingURL=pickerplus.js.map
  21366. function initCombogrid () {
  21367. Ext.define('Yvan.ComboGrid', {
  21368. extend: 'Ext.form.field.Picker',
  21369. // extend: 'Yvan.PickerAlignCenter',
  21370. xtype: 'combogrid',
  21371. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21372. triggers: {
  21373. clear: {
  21374. weight: 0,
  21375. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21376. hidden: true,
  21377. handler: 'onClearClick',
  21378. },
  21379. },
  21380. config: __assign({}, comboGrid),
  21381. editable: true,
  21382. _superBlur: false,
  21383. allowCustomInput: false,
  21384. pressEnterPopup: true,
  21385. initComponent: function () {
  21386. var that = this;
  21387. var scope = lookupScope(that);
  21388. var config = that.config;
  21389. if (isDesignMode(scope, config)) {
  21390. this.superclass.initComponent.call(this, arguments);
  21391. return;
  21392. }
  21393. this.on({
  21394. blur: function (sender, e) {
  21395. if (this._superBlur) {
  21396. // 挂起时不恢复内容
  21397. return;
  21398. }
  21399. // 离开焦点时,恢复原来的值
  21400. sender.setRawValue(sender.value);
  21401. },
  21402. afterrender: function (sender) {
  21403. var $dom = $(sender.inputEl.dom);
  21404. that.scope = lookupScope(sender);
  21405. if (sender.column) {
  21406. // 列模式,拦截 keydown
  21407. $dom.on('keydown', function (e) {
  21408. if (isChartEvent(e) && !that.tryEnable()) {
  21409. // 没有达成 editEnable 条件,不用响应
  21410. stopEvent(e);
  21411. return;
  21412. }
  21413. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21414. stopEvent(e);
  21415. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21416. return;
  21417. }
  21418. });
  21419. }
  21420. else {
  21421. // 常规模式,拦截 keyup
  21422. $dom.on('keyup', function (e) {
  21423. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21424. return;
  21425. }
  21426. if (isChartEvent(e) && !that.tryEnable()) {
  21427. // 没有达成 editEnable 条件,不用响应
  21428. stopEvent(e);
  21429. return;
  21430. }
  21431. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21432. stopEvent(e);
  21433. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21434. return;
  21435. }
  21436. if (!that.allowCustomInput) {
  21437. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21438. stopEvent(e);
  21439. }
  21440. });
  21441. $dom.on('change', function (e) {
  21442. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21443. // if (that.isExpanded) {
  21444. // that.filterChange(that, e.target.value)
  21445. // }
  21446. stopEvent(e);
  21447. });
  21448. }
  21449. $dom.on('input', function (e) {
  21450. stopEvent(e);
  21451. });
  21452. },
  21453. });
  21454. this.superclass.initComponent.apply(this, arguments);
  21455. },
  21456. createPicker: function () {
  21457. var me = this;
  21458. var cfg = {
  21459. layout: 'fit',
  21460. border: 0,
  21461. // border: 5,
  21462. style: {
  21463. // borderColor: 'black',
  21464. // borderWidth: '5px',
  21465. // borderStyle: 'solid',
  21466. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21467. },
  21468. shadow: 'side',
  21469. shadowOffset: 100,
  21470. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21471. shrinkWrapDock: 2,
  21472. floating: true,
  21473. width: me.pickerWidth,
  21474. height: me.pickerHeight,
  21475. minWidth: me.pickerWidth,
  21476. minHeight: me.pickerHeight,
  21477. maxWidth: me.pickerWidth,
  21478. maxHeight: me.pickerHeight,
  21479. items: [
  21480. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21481. xtype: 'toolbar',
  21482. items: [
  21483. { xtype: 'textfield', fieldLabel: '筛选' },
  21484. {
  21485. xtype: 'button',
  21486. text: '查询',
  21487. iconCls: 'x-fa fa-search',
  21488. cssType: 'primary',
  21489. listeners: {
  21490. click: function () {
  21491. me.reloadGrid();
  21492. }
  21493. }
  21494. },
  21495. ]
  21496. }, autoLoad: false, listeners: {
  21497. afterrender: function (grid) {
  21498. me.grid = grid;
  21499. grid.focus();
  21500. grid.on({
  21501. rowdblclick: function (sender, row) {
  21502. me.selectItem(row);
  21503. },
  21504. dataLoadComplete: function (sender) {
  21505. _$2.defer(function () {
  21506. me.setFocus();
  21507. });
  21508. },
  21509. keydown: function (sender, e) {
  21510. if (me.column) {
  21511. // 列模式,拦截 keydown
  21512. me.processKey(e);
  21513. }
  21514. },
  21515. keyup: function (sender, e) {
  21516. if (!me.column) {
  21517. // 常规模式,拦截 keyup
  21518. me.processKey(e);
  21519. }
  21520. }
  21521. });
  21522. },
  21523. } })
  21524. ]
  21525. };
  21526. // @ts-ignore
  21527. var picker = new Ext.container.Container(cfg);
  21528. return picker;
  21529. },
  21530. setFocus: function () {
  21531. if (this.grid.store.getCount() > 0) {
  21532. this.grid.focusRow(0);
  21533. }
  21534. },
  21535. processKey: function (e) {
  21536. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21537. this.selectItem(this.grid.selection);
  21538. stopEvent(e);
  21539. }
  21540. else if (e.key === 'Escape') {
  21541. this.collapse();
  21542. }
  21543. },
  21544. repaintPickerView: function () {
  21545. var style = this.picker.getView().getEl().dom.style;
  21546. style.display = style.display;
  21547. },
  21548. onItemClick: function (view, record, node, rowIndex, e) {
  21549. this.selectItem(record);
  21550. },
  21551. onPickerKeyDown: function (treeView, record, item, index, e) {
  21552. var key = e.getKey();
  21553. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21554. this.selectItem(record);
  21555. }
  21556. },
  21557. filterChange: _$2.debounce(function (sender, value) {
  21558. sender.onExpand();
  21559. }, 1000),
  21560. selectItem: function (record) {
  21561. var me = this;
  21562. var lookup = this.lookup;
  21563. var scope = lookupScope(this);
  21564. me.fireEvent('select', me, record);
  21565. if (record.isModel) {
  21566. record = record.data;
  21567. }
  21568. tryWriteObject(lookup, record, function (path, value) {
  21569. me._lookupSet(path, value);
  21570. });
  21571. // lookup
  21572. // fromColumn: 'toTarget'
  21573. // fromColumn: 'toTarget'
  21574. // fromColumn: 'toTarget'
  21575. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21576. var value = _$2.get(record, fromColumn);
  21577. me._lookupSet(toTarget, value);
  21578. });
  21579. // 选定之后不能做清空
  21580. // const {lookupClearOnChange} = me
  21581. // if (_.isArray(lookupClearOnChange)) {
  21582. // _.each(lookupClearOnChange, item => {
  21583. // me._lookupSet(item, '')
  21584. // })
  21585. // }
  21586. me.collapse();
  21587. // 触发 _raiseNextFocus
  21588. me._raiseNextFocus(me);
  21589. },
  21590. onExpand: function () {
  21591. // 展开时,根据 lookup 带入查询参数
  21592. var expressData = this.getExpressData();
  21593. var txtField = this.grid.down('toolbar').down('textfield');
  21594. txtField.setValue(expressData.queryValue);
  21595. this.reloadGrid();
  21596. },
  21597. reloadGrid: function () {
  21598. // 展开时,根据 lookup 带入查询参数
  21599. var expressData = this.getExpressData();
  21600. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21601. var txtField = this.grid.down('toolbar').down('textfield');
  21602. // 每个 combogrid 默认带上 __queryValue 属性
  21603. reloadParam["__queryValue"] = txtField.getValue();
  21604. this.grid.reload(reloadParam);
  21605. },
  21606. onTriggerClick: function (sender) {
  21607. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21608. if (!grid) {
  21609. msg('正在初始化,请稍后');
  21610. return;
  21611. }
  21612. if (!this.tryEnable()) {
  21613. // 没有达成 editEnable 条件,不用弹出
  21614. return;
  21615. }
  21616. if (isExpanded || readOnly || disabled) {
  21617. // 已弹出、只读、禁用状态下,不允许弹出
  21618. return;
  21619. }
  21620. this._superBlur = true;
  21621. this.superclass.onTriggerClick.apply(this, arguments);
  21622. this._superBlur = false;
  21623. },
  21624. onCollapse: function () {
  21625. // 每次收回时,删除下拉组件
  21626. // delete this.picker
  21627. },
  21628. /**
  21629. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21630. */
  21631. setValue: function (value) {
  21632. var me = this;
  21633. // 设值用户看到的表面内容
  21634. this.setRawValue(value);
  21635. // 设值 setValue 调用链,正常触发 change 事件等
  21636. return me.mixins.field.setValue.call(me, value);
  21637. },
  21638. _lookupSet: function (path, value) {
  21639. var me = this;
  21640. path = tryVarSimple(path);
  21641. if (me.column) {
  21642. // 判断写入目标,是否与自己绑定的属性相等
  21643. if (path === 'queryValue' || me.column.dataIndex === path) {
  21644. me.setValue(value);
  21645. }
  21646. // 列模式下,写当前编辑行
  21647. var parentRecord = me._lookupEditorRecord();
  21648. if (parentRecord) {
  21649. // Ext.data.Record / Ext.data.Model
  21650. parentRecord.set(path, value);
  21651. }
  21652. else {
  21653. debugger;
  21654. }
  21655. }
  21656. else {
  21657. // 常规模式下,写 viewModel
  21658. me.scope.viewModel.set(path, value);
  21659. }
  21660. },
  21661. _lookupGrid: function () {
  21662. return this.column.up('grid');
  21663. },
  21664. _lookupEditorRecord: function () {
  21665. var _a, _b, _c, _d;
  21666. // parentGrid.getSelectionModel().getLastSelected()
  21667. var grid = this._lookupGrid();
  21668. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21669. if (!editingPlugin) {
  21670. return grid.getSelectionModel().getLastSelected();
  21671. }
  21672. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21673. if (_$2.isNumber(rowIdx)) {
  21674. return grid.store.getAt(rowIdx);
  21675. }
  21676. else {
  21677. return grid.getSelectionModel().getLastSelected();
  21678. }
  21679. },
  21680. onChange: function (newVal, oldVal) {
  21681. var me = this;
  21682. var value = newVal;
  21683. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21684. if (hideTrigger || disabled || readOnly || hideClear) {
  21685. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21686. return;
  21687. }
  21688. if (value) {
  21689. me.getTrigger('clear').show();
  21690. me.updateLayout();
  21691. }
  21692. else {
  21693. me.getTrigger('clear').hide();
  21694. me.updateLayout();
  21695. }
  21696. },
  21697. /**
  21698. * 得到能用于 express 表达式计算的上下文数据
  21699. */
  21700. getExpressData: function () {
  21701. var queryValue = this.getRawValue();
  21702. if (!queryValue) {
  21703. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21704. queryValue = this.getPicker().down('textfield').getRawValue();
  21705. }
  21706. if (this.column) {
  21707. // 列模式, 准备好判断 editEnable 表达式用的数据
  21708. var parentRecord = this._lookupEditorRecord();
  21709. if (!parentRecord) {
  21710. debugger;
  21711. }
  21712. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21713. }
  21714. else {
  21715. // 编辑模式,准备好判断用的数据
  21716. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21717. }
  21718. },
  21719. tryEnable: function () {
  21720. return tryEnable(this.getExpressData(), this.editEnable);
  21721. },
  21722. /**
  21723. * 清空所有值
  21724. */
  21725. onClearClick: function (sender, e) {
  21726. var me = this;
  21727. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21728. me.fireEvent('clear', sender, e);
  21729. me.setValue('');
  21730. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21731. me._lookupSet(toTarget, '');
  21732. });
  21733. _$2.each(lookupClearOnChange, function (item) {
  21734. me._lookupSet(item, '');
  21735. });
  21736. }
  21737. });
  21738. }
  21739. //# sourceMappingURL=combogrid.js.map
  21740. function initContainer () {
  21741. var cc = Ext.container.Container.prototype.constructor;
  21742. //const {initComponent} = Ext.container.Container.prototype
  21743. Ext.container.Container.override({
  21744. constructor: function (config) {
  21745. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21746. cc.call(this, newConfig);
  21747. },
  21748. });
  21749. }
  21750. //# sourceMappingURL=container.js.map
  21751. function initRows () {
  21752. Ext.define('Yvan.Rows', {
  21753. extend: 'Ext.container.Container',
  21754. xtype: 'rows',
  21755. constructor: function (config) {
  21756. var self = this;
  21757. var newConfig = _$2.defaultsDeep({
  21758. // 强制性属性
  21759. layout: 'anchor', border: false,
  21760. defaults: {
  21761. border: false, anchor: '100%',
  21762. margin: '0 0 5 0',
  21763. },
  21764. }, baseConfig(config, 'rows-container'), config, rows);
  21765. this.superclass.constructor.call(self, newConfig);
  21766. },
  21767. });
  21768. }
  21769. //# sourceMappingURL=rows.js.map
  21770. function initForm () {
  21771. var ct = Ext.form.Panel.prototype.constructor;
  21772. Ext.form.Panel.override({
  21773. constructor: function (config) {
  21774. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21775. ct.call(this, newConfig);
  21776. }
  21777. });
  21778. }
  21779. //# sourceMappingURL=form.js.map
  21780. function initCols () {
  21781. Ext.define('Yvan.Cols', {
  21782. extend: 'Ext.container.Container',
  21783. xtype: 'cols',
  21784. constructor: function (config) {
  21785. var self = this;
  21786. var newConfig = _$2.defaultsDeep({
  21787. // 强制性属性
  21788. layout: 'hbox',
  21789. minHeight: config.designMode ? 32 : 0
  21790. }, baseConfig(config, 'cols-container'), config, cols);
  21791. this.superclass.constructor.call(self, newConfig);
  21792. },
  21793. });
  21794. }
  21795. //# sourceMappingURL=cols.js.map
  21796. function initButton () {
  21797. /**
  21798. *
  21799. */
  21800. var ct = Ext.button.Button.prototype.constructor;
  21801. Ext.button.Button.override({
  21802. constructor: function (config) {
  21803. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21804. ct.call(this, newConfig);
  21805. },
  21806. setLoading: function (value) {
  21807. if (value) {
  21808. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21809. this._originIconCls = this.iconCls;
  21810. }
  21811. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21812. this.setDisabled(true);
  21813. }
  21814. else {
  21815. this.setIconCls(this._originIconCls);
  21816. this.setDisabled(false);
  21817. }
  21818. }
  21819. });
  21820. }
  21821. //# sourceMappingURL=button.js.map
  21822. function initIframe () {
  21823. Ext.define('Ext.ux.IFrame', {
  21824. extend: 'Ext.Component',
  21825. alias: 'widget.uxiframe',
  21826. loadMask: 'Loading...',
  21827. src: 'about:blank',
  21828. renderTpl: [
  21829. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21830. ],
  21831. childEls: ['iframeEl'],
  21832. initComponent: function () {
  21833. this.superclass.initComponent.call(this);
  21834. this.superclass.initEvents.call(this);
  21835. this.frameName = this.frameName || this.id + '-frame';
  21836. },
  21837. initEvents: function () {
  21838. var me = this;
  21839. this.superclass.initEvents.call(this);
  21840. me.iframeEl.on('load', me.onLoad, me);
  21841. },
  21842. initRenderData: function () {
  21843. return Ext.apply(this.superclass.initRenderData.call(this), {
  21844. src: this.src,
  21845. frameName: this.frameName
  21846. });
  21847. },
  21848. getBody: function () {
  21849. var doc = this.getDoc();
  21850. return doc.body || doc.documentElement;
  21851. },
  21852. getDoc: function () {
  21853. try {
  21854. return this.getWin().document;
  21855. }
  21856. catch (ex) {
  21857. return null;
  21858. }
  21859. },
  21860. getWin: function () {
  21861. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21862. return win;
  21863. },
  21864. getFrame: function () {
  21865. var me = this;
  21866. return me.iframeEl.dom;
  21867. },
  21868. onLoad: function () {
  21869. var me = this, doc = me.getDoc();
  21870. if (doc) {
  21871. this.el.unmask();
  21872. this.fireEvent('load', this);
  21873. }
  21874. else if (me.src) {
  21875. this.el.unmask();
  21876. this.fireEvent('error', this);
  21877. }
  21878. },
  21879. load: function (src) {
  21880. var me = this, text = me.loadMask, frame = me.getFrame();
  21881. if (me.fireEvent('beforeload', me, src) !== false) {
  21882. if (text && me.el) {
  21883. me.el.mask(text);
  21884. }
  21885. frame.src = me.src = (src || me.src);
  21886. }
  21887. }
  21888. });
  21889. }
  21890. //# sourceMappingURL=iframe.js.map
  21891. /**
  21892. * 属性:
  21893. * - autoLoad: true
  21894. * - dataSource: ''
  21895. * 方法:
  21896. * - handleZoomBig
  21897. * - handleZoomSmall
  21898. * - handleZoomReset
  21899. * - openDiagram
  21900. * - getBpmn
  21901. * - getBpmnCanvas
  21902. * - getBpmnOverlays
  21903. * - getBpmnZoomScroll
  21904. * 事件:
  21905. * - initFinish
  21906. * - failed
  21907. * - success
  21908. * - itemHover
  21909. * - itemOut
  21910. * - itemClick
  21911. * - itemDblclick
  21912. * - itemMousedown
  21913. * - itemMouseup
  21914. */
  21915. function initBpmn () {
  21916. Ext.define('Yvan.Bpmn', {
  21917. // extend: 'Ext.container.Container',
  21918. extend: 'Ext.panel.Panel',
  21919. alias: 'widget.bpmn',
  21920. xtype: 'bpmn',
  21921. constructor: function (config) {
  21922. var self = this;
  21923. var newConfig = _$2.defaultsDeep({
  21924. // 强制性属性
  21925. }, baseConfig(config, 'row-item'), config, bpmn);
  21926. if (!newConfig.hideToolbar) {
  21927. newConfig.tbar = [];
  21928. newConfig.tbar.push({
  21929. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21930. listeners: {
  21931. click: function (sender) {
  21932. self.reload();
  21933. }
  21934. }
  21935. });
  21936. newConfig.tbar.push({
  21937. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21938. listeners: {
  21939. click: function (sender) {
  21940. self.handleZoomBig();
  21941. }
  21942. },
  21943. });
  21944. newConfig.tbar.push({
  21945. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21946. listeners: {
  21947. click: function (sender) {
  21948. self.handleZoomSmall();
  21949. }
  21950. },
  21951. });
  21952. newConfig.tbar.push({
  21953. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21954. listeners: {
  21955. click: function (sender) {
  21956. self.handleZoomReset();
  21957. }
  21958. },
  21959. });
  21960. }
  21961. this.superclass.constructor.call(self, newConfig);
  21962. },
  21963. initComponent: function () {
  21964. var _this = this;
  21965. var me = this;
  21966. var config = me.config;
  21967. var scope = lookupScope(this);
  21968. if (!isDesignMode(scope, config)) {
  21969. //@ts-ignore
  21970. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21971. console.log('BpNavigated', me, BpNavigated);
  21972. var dom = me.el.dom;
  21973. var $dom = $(dom);
  21974. var $container = $dom.find('.x-autocontainer-innerCt');
  21975. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21976. _this._bpmn = bpmn;
  21977. if (_this.autoLoad) {
  21978. _this.reload();
  21979. }
  21980. _this.fireEvent('initFinish', _this);
  21981. var eventBus = bpmn.get('eventBus');
  21982. eventBus.on('element.hover', function (e) {
  21983. // this.fireEvent('itemHover', this, e);
  21984. });
  21985. eventBus.on('element.out', function (e) {
  21986. _this.fireEvent('itemOut', _this, e);
  21987. });
  21988. eventBus.on('element.click', function (e) {
  21989. _this.fireEvent('itemClick', _this, e);
  21990. });
  21991. eventBus.on('element.dblclick', function (e) {
  21992. _this.fireEvent('itemDblclick', _this, e);
  21993. });
  21994. eventBus.on('element.mousedown', function (e) {
  21995. _this.fireEvent('itemMousedown', _this, e);
  21996. });
  21997. eventBus.on('element.mouseup', function (e) {
  21998. _this.fireEvent('itemMouseup', _this, e);
  21999. });
  22000. });
  22001. }
  22002. this.superclass.initComponent.call(this);
  22003. this.on({
  22004. afterrender: function (sender) {
  22005. }
  22006. });
  22007. },
  22008. /**
  22009. * 重新载入
  22010. */
  22011. reload: function () {
  22012. var _this = this;
  22013. var _a;
  22014. if (typeof this.dataSource === 'string' && this.dataSource) {
  22015. var scope = lookupScope(this);
  22016. var fn = lookupFn(scope, this.dataSource);
  22017. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22018. _this.openDiagram(res.data);
  22019. });
  22020. }
  22021. },
  22022. /**
  22023. * 获取bpmn
  22024. */
  22025. getBpmn: function () {
  22026. return this._bpmn;
  22027. },
  22028. getBpmnCanvas: function () {
  22029. var _a;
  22030. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22031. },
  22032. getBpmnOverlays: function () {
  22033. var _a;
  22034. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22035. },
  22036. getBpmnZoomScroll: function () {
  22037. var _a;
  22038. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22039. },
  22040. handleZoomBig: function () {
  22041. var _a;
  22042. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22043. },
  22044. handleZoomSmall: function () {
  22045. var _a;
  22046. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22047. },
  22048. handleZoomReset: function () {
  22049. var _a;
  22050. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22051. },
  22052. openDiagram: function (diagram) {
  22053. var _this = this;
  22054. if (!this.getBpmn()) {
  22055. return;
  22056. }
  22057. this.getBpmn().importXML(diagram, function (err) {
  22058. if (err) {
  22059. // YvEventDispatch(this.onFailed, this, undefined);
  22060. _this.fireEvent('failed', _this, err);
  22061. return console.error('could not import BPMN 2.0 diagram', err);
  22062. }
  22063. // zoom to fit full viewport
  22064. _this.getBpmnCanvas().zoom('fit-viewport');
  22065. _this.fireEvent('success', _this);
  22066. });
  22067. },
  22068. });
  22069. }
  22070. //# sourceMappingURL=bpmn.js.map
  22071. function initSqlComplex () {
  22072. Ext.define('Yvan.SqlComplex', {
  22073. extend: 'Ext.panel.Panel',
  22074. xtype: 'sqlcomplex',
  22075. alias: 'widget.sqlcomplex',
  22076. getSqlExpress: function () {
  22077. },
  22078. constructor: function (config) {
  22079. var reference = config.reference;
  22080. var me = this;
  22081. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22082. {
  22083. region: 'west',
  22084. width: 280,
  22085. border: false,
  22086. split: true,
  22087. reference: reference + '_tree',
  22088. xtype: 'yvtree',
  22089. hideRefresh: true,
  22090. hideExpand: true,
  22091. hideCollapse: true,
  22092. listeners: {
  22093. itemdblclick: function (sender, record, item, index, e) {
  22094. var field = record.get('field');
  22095. var defaultValue = record.get('defaultValue');
  22096. if (!field) {
  22097. return;
  22098. }
  22099. var tabExpress = me.down('tabpanel');
  22100. var sqleditor = me.down('sqleditor');
  22101. var expressGrid = me.down('yvgrid');
  22102. if (tabExpress.getActiveTab().key !== 'grid') {
  22103. // SQL 模式
  22104. sqleditor.insertText(field + '=');
  22105. }
  22106. else {
  22107. // 表格模式
  22108. expressGrid.appendEditRow({
  22109. field: field,
  22110. operator: '=',
  22111. value: defaultValue,
  22112. remark: '',
  22113. });
  22114. _$2.defer(function () {
  22115. gridChanged(me, expressGrid);
  22116. });
  22117. }
  22118. }
  22119. },
  22120. },
  22121. {
  22122. region: 'center',
  22123. xtype: 'tabpanel',
  22124. reference: reference + '_tab',
  22125. tabPosition: 'bottom',
  22126. listeners: {
  22127. afterrender: function (sender) {
  22128. var scope = lookupScope(me);
  22129. var value = scope.viewModel.get(me.config.bindValue);
  22130. // sql 转换为 grid
  22131. try {
  22132. var list_1 = parseSqlToGrid(value);
  22133. _$2.defer(function () {
  22134. var grid = me.down('yvgrid');
  22135. grid.setData(list_1);
  22136. });
  22137. }
  22138. catch (e) {
  22139. console.error(e);
  22140. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22141. var tabSql = sender.down('sqleditor');
  22142. sender.setActiveTab(tabSql);
  22143. }
  22144. },
  22145. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22146. var scope = lookupScope(me);
  22147. var value = scope.viewModel.get(me.config.bindValue);
  22148. if (newCard.key === 'grid') {
  22149. // sql 转换为 grid
  22150. try {
  22151. var list_2 = parseSqlToGrid(value);
  22152. _$2.defer(function () {
  22153. var grid = me.down('yvgrid');
  22154. grid.setData(list_2);
  22155. });
  22156. return true;
  22157. }
  22158. catch (e) {
  22159. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22160. console.error(e);
  22161. return false;
  22162. }
  22163. }
  22164. else if (newCard.key === 'sql') {
  22165. // grid 转换为 sql
  22166. _$2.defer(function () {
  22167. var editor = me.down('sqleditor');
  22168. editor.setValue(value);
  22169. });
  22170. return true;
  22171. }
  22172. }
  22173. },
  22174. items: [
  22175. {
  22176. title: '表格模式',
  22177. key: 'grid',
  22178. xtype: 'yvgrid',
  22179. _mode: 'select',
  22180. reference: reference + '_grid',
  22181. hideFootbar: true,
  22182. pagination: false,
  22183. tbar: [
  22184. {
  22185. xtype: 'button',
  22186. text: '删除',
  22187. iconCls: 'x-fa fa-minus-circle',
  22188. cls: 'ext-btn-danger',
  22189. bind: {
  22190. disabled: '{!' + reference + '_grid.selection}',
  22191. },
  22192. listeners: {
  22193. click: function (sender) {
  22194. var grid = sender.up('yvgrid');
  22195. removeGridRow(grid);
  22196. gridChanged(me, grid);
  22197. }
  22198. },
  22199. },
  22200. ],
  22201. store: {},
  22202. listeners: {
  22203. editfinish: function (sender) {
  22204. gridChanged(me, sender);
  22205. },
  22206. },
  22207. columns: [
  22208. {
  22209. dataIndex: 'field',
  22210. header: '字段', sortable: false, menuDisabled: true,
  22211. width: 190,
  22212. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22213. var column = context.column;
  22214. var propertyConfig = me.config.propertyConfig;
  22215. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22216. var field = record.get('field');
  22217. if (field) {
  22218. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22219. if (idx >= 0) {
  22220. var meta = propertyConfig[idx];
  22221. return meta.text;
  22222. }
  22223. }
  22224. return value;
  22225. }
  22226. },
  22227. {
  22228. dataIndex: 'operator',
  22229. header: '运算符', sortable: false, menuDisabled: true,
  22230. dict: 'operator',
  22231. width: 65,
  22232. editor: { xtype: 'combo' },
  22233. },
  22234. {
  22235. dataIndex: 'value',
  22236. header: '值', sortable: false, menuDisabled: true,
  22237. flex: 1,
  22238. getEditor: function (record) {
  22239. var column = this;
  22240. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22241. var propertyConfig = me.config.propertyConfig;
  22242. var field = record.get('field');
  22243. if (!field) {
  22244. // 没有填 propertyName
  22245. return;
  22246. }
  22247. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22248. if (idx < 0) {
  22249. console.error('没有找到 field=' + field + ". propertyConfig");
  22250. return;
  22251. }
  22252. var meta = propertyConfig[idx];
  22253. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22254. return new Ext.grid.CellEditor({
  22255. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22256. });
  22257. }
  22258. return new Ext.grid.CellEditor({
  22259. field: __assign({ dict: meta.dict }, meta.editor)
  22260. });
  22261. },
  22262. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22263. var column = context.column;
  22264. var grid = _$2.get(view, 'ownerGrid');
  22265. var propertyConfig = me.config.propertyConfig;
  22266. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22267. var field = record.get('field');
  22268. if (field) {
  22269. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22270. if (idx >= 0) {
  22271. var meta = propertyConfig[idx];
  22272. var dictName = _$2.get(meta, 'dict');
  22273. if (dictName && window['DICT_CACHE'][dictName]) {
  22274. var dict_1 = window['DICT_CACHE'][dictName];
  22275. var valueText_1 = [];
  22276. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22277. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22278. if (idxKv >= 0) {
  22279. valueText_1.push(dict_1[idxKv].text);
  22280. }
  22281. else {
  22282. valueText_1.push(value);
  22283. }
  22284. });
  22285. return valueText_1.join(',');
  22286. }
  22287. }
  22288. }
  22289. return valueList;
  22290. },
  22291. },
  22292. ]
  22293. },
  22294. {
  22295. title: 'SQL模式',
  22296. key: 'sql',
  22297. xtype: 'sqleditor',
  22298. reference: reference + '_sql',
  22299. listeners: {
  22300. change: function (sender) {
  22301. var scope = lookupScope(me);
  22302. // 保存 editor 写入的值
  22303. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22304. }
  22305. }
  22306. },
  22307. ]
  22308. }
  22309. ] });
  22310. this.superclass.constructor.call(this, newConfig);
  22311. },
  22312. initComponent: function () {
  22313. // 货位条件树
  22314. var me = this;
  22315. me.superclass.initComponent.apply(this, arguments);
  22316. var tree = this.down('yvtree');
  22317. var config = me.config;
  22318. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22319. },
  22320. });
  22321. function gridChanged(me, grid) {
  22322. var data = grid.getDataRows();
  22323. var propertyConfig = me.config.propertyConfig;
  22324. var bindValue = me.config.bindValue;
  22325. var scope = lookupScope(me);
  22326. var sql = parseGridToSql(data);
  22327. scope.viewModel.set(bindValue, sql);
  22328. }
  22329. /**
  22330. * 用于从 propertyConfig 解析出树形结构
  22331. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22332. * ->
  22333. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22334. */
  22335. function buildConfigTree(propertyConfig) {
  22336. var root = {
  22337. expanded: true,
  22338. leaf: false,
  22339. children: []
  22340. };
  22341. var categoryObj = {};
  22342. var cfgList = propertyConfig;
  22343. _$2.forEach(cfgList, function (cfg) {
  22344. var cateNode = categoryObj[cfg.category];
  22345. if (!cateNode) {
  22346. cateNode = {
  22347. text: cfg.category, expanded: true, leaf: false,
  22348. children: []
  22349. };
  22350. categoryObj[cfg.category] = cateNode;
  22351. root.children.push(cateNode);
  22352. }
  22353. cateNode.children.push({
  22354. text: cfg.text,
  22355. field: cfg.field,
  22356. operator: cfg.operator,
  22357. defaultValue: cfg.defaultValue,
  22358. leaf: true,
  22359. });
  22360. });
  22361. return root;
  22362. }
  22363. /**
  22364. * 将表格变成 SQL where语句 [
  22365. * {field: 'f1', value: 1, operator: '='}
  22366. * {field: 'f2', value: 2, operator: '='}
  22367. * {field: 'f3', value: '3', operator: '>='}
  22368. * {field: 'f4', value: 4, operator: '='}
  22369. * ]
  22370. * ->
  22371. * f1=v1 and f2=v2
  22372. */
  22373. function parseGridToSql(list) {
  22374. var sqls = [];
  22375. _$2.forEach(list, function (i) {
  22376. var _a;
  22377. if (i.operator === 'in') {
  22378. sqls.push(i.field + ' in (' + (i.value) + ')');
  22379. }
  22380. else if (i.operator === 'notIn') {
  22381. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22382. }
  22383. else {
  22384. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22385. }
  22386. });
  22387. return sqls.join(' AND ');
  22388. }
  22389. /**
  22390. * 将 SQL 语句的 where 片段变成表格
  22391. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22392. * @return [
  22393. {field: 'f1', value: 1, operator: '='}
  22394. {field: 'f2', value: 2, operator: '='}
  22395. {field: 'f3', value: '3', operator: '>='}
  22396. {field: 'f4', value: 4, operator: '='}
  22397. ]
  22398. */
  22399. function parseSqlToGrid(sql) {
  22400. if (!sql || !_$2.trim(sql)) {
  22401. return [];
  22402. }
  22403. var parser = new window['NodeSQLParser'].Parser();
  22404. var ast = parser.astify('select * from dual where ' + sql);
  22405. var ret = [];
  22406. exp(ast.where, ret);
  22407. return ret;
  22408. }
  22409. function exp(ast, ret) {
  22410. if (ast.type === 'binary_expr') {
  22411. if (_$2.toUpper(ast.operator) === 'AND') {
  22412. if (ast.left.type === 'binary_expr') {
  22413. exp(ast.left, ret);
  22414. }
  22415. if (ast.right.type === 'binary_expr') {
  22416. exp(ast.right, ret);
  22417. }
  22418. }
  22419. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22420. if (ast.left.type === 'column_ref') {
  22421. if (ast.right.type === 'number' ||
  22422. ast.right.type === 'single_quote_string' ||
  22423. ast.right.type === 'double_quote_string') {
  22424. // 具体值相等
  22425. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22426. }
  22427. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22428. && ast.right.type === 'expr_list') {
  22429. // in / not in
  22430. var valueList_1 = [];
  22431. _$2.forEach(ast.right.value, function (item) {
  22432. valueList_1.push(item.value);
  22433. });
  22434. var operator = void 0;
  22435. if (_$2.toUpper(ast.operator) === 'IN') {
  22436. operator = 'in';
  22437. }
  22438. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22439. operator = 'notIn';
  22440. }
  22441. ret.push({
  22442. field: ast.left.column, value: valueList_1.join(','),
  22443. operator: operator
  22444. });
  22445. }
  22446. else {
  22447. throw new Error('ast.right must is value.');
  22448. }
  22449. }
  22450. else {
  22451. throw new Error('ast.left must is column_ref.');
  22452. }
  22453. }
  22454. else {
  22455. // 必须用 AND 条件符匹配
  22456. throw new Error('ast.operator must is "AND / =".');
  22457. }
  22458. }
  22459. else {
  22460. throw new Error('ast.type must is "binary_expr".');
  22461. }
  22462. }
  22463. /**
  22464. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22465. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22466. {
  22467. type: 'binary_expr',
  22468. operator: 'AND',
  22469. left: {
  22470. type: 'binary_expr',
  22471. operator: 'AND',
  22472. left: {
  22473. type: 'binary_expr',
  22474. operator: 'AND',
  22475. left: {
  22476. type: 'binary_expr',
  22477. operator: 'AND',
  22478. left: {
  22479. type: 'binary_expr',
  22480. operator: '=',
  22481. left: {
  22482. type: 'column_ref',
  22483. table: null,
  22484. column: 'f1'
  22485. },
  22486. right: {
  22487. type: 'number',
  22488. value: 1
  22489. }
  22490. },
  22491. right: {
  22492. type: 'binary_expr',
  22493. operator: '=',
  22494. left: {
  22495. type: 'column_ref',
  22496. table: null,
  22497. column: 'f2'
  22498. },
  22499. right: {
  22500. type: 'number',
  22501. value: 2
  22502. }
  22503. }
  22504. },
  22505. right: {
  22506. type: 'binary_expr',
  22507. operator: '=',
  22508. left: {
  22509. type: 'column_ref',
  22510. table: null,
  22511. column: 'f3'
  22512. },
  22513. right: {
  22514. type: 'single_quote_string',
  22515. value: '3'
  22516. }
  22517. }
  22518. },
  22519. right: {
  22520. type: 'binary_expr',
  22521. operator: '>=',
  22522. left: {
  22523. type: 'column_ref',
  22524. table: null,
  22525. column: 'f4'
  22526. },
  22527. right: {
  22528. type: 'number',
  22529. value: 4
  22530. }
  22531. }
  22532. },
  22533. right: {
  22534. type: 'binary_expr',
  22535. operator: '<',
  22536. left: {
  22537. type: 'column_ref',
  22538. table: null,
  22539. column: 'f4'
  22540. },
  22541. right: {
  22542. type: 'number',
  22543. value: 3
  22544. }
  22545. }
  22546. }
  22547. * */
  22548. }
  22549. //# sourceMappingURL=SqlComplex.js.map
  22550. function initParamComplex () {
  22551. Ext.define('Yvan.ParamComplex', {
  22552. extend: 'Ext.panel.Panel',
  22553. xtype: 'paramcomplex',
  22554. alias: 'widget.paramcomplex',
  22555. getSqlExpress: function () {
  22556. },
  22557. constructor: function (config) {
  22558. var reference = config.reference;
  22559. var me = this;
  22560. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22561. {
  22562. region: 'west',
  22563. width: 280,
  22564. border: false,
  22565. split: true,
  22566. reference: reference + '_tree',
  22567. xtype: 'yvtree',
  22568. hideRefresh: true,
  22569. hideExpand: true,
  22570. hideCollapse: true,
  22571. listeners: {
  22572. itemdblclick: function (sender, record, item, index, e) {
  22573. var field = record.get('field');
  22574. var defaultValue = record.get('defaultValue');
  22575. if (!field) {
  22576. return;
  22577. }
  22578. var tabExpress = me.down('tabpanel');
  22579. var sqleditor = me.down('sqleditor');
  22580. var expressGrid = me.down('yvgrid');
  22581. if (tabExpress.getActiveTab().key !== 'grid') {
  22582. // SQL 模式
  22583. sqleditor.insertText(field + '=');
  22584. }
  22585. else {
  22586. // 表格模式
  22587. expressGrid.appendEditRow({
  22588. field: field,
  22589. operator: '=',
  22590. value: defaultValue,
  22591. remark: '',
  22592. });
  22593. _$2.defer(function () {
  22594. gridChanged(me, expressGrid);
  22595. });
  22596. }
  22597. }
  22598. },
  22599. },
  22600. {
  22601. region: 'center',
  22602. xtype: 'tabpanel',
  22603. reference: reference + '_tab',
  22604. tabPosition: 'bottom',
  22605. listeners: {
  22606. afterrender: function (sender) {
  22607. var scope = lookupScope(me);
  22608. var value = scope.viewModel.get(me.config.bindValue);
  22609. // sql 转换为 grid
  22610. try {
  22611. var list_1 = parseParamToGrid(value);
  22612. _$2.defer(function () {
  22613. var grid = me.down('yvgrid');
  22614. grid.setData(list_1);
  22615. });
  22616. }
  22617. catch (e) {
  22618. console.error(e);
  22619. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22620. var tabSql = sender.down('sqleditor');
  22621. sender.setActiveTab(tabSql);
  22622. }
  22623. },
  22624. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22625. var scope = lookupScope(me);
  22626. var value = scope.viewModel.get(me.config.bindValue);
  22627. if (newCard.key === 'grid') {
  22628. // sql 转换为 grid
  22629. try {
  22630. var list_2 = parseParamToGrid(value);
  22631. _$2.defer(function () {
  22632. var grid = me.down('yvgrid');
  22633. grid.setData(list_2);
  22634. });
  22635. return true;
  22636. }
  22637. catch (e) {
  22638. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22639. console.error(e);
  22640. return false;
  22641. }
  22642. }
  22643. else if (newCard.key === 'sql') {
  22644. // grid 转换为 sql
  22645. _$2.defer(function () {
  22646. var editor = me.down('sqleditor');
  22647. editor.setValue(value);
  22648. });
  22649. return true;
  22650. }
  22651. }
  22652. },
  22653. items: [
  22654. {
  22655. title: '表格模式',
  22656. key: 'grid',
  22657. xtype: 'yvgrid',
  22658. _mode: 'select',
  22659. reference: reference + '_grid',
  22660. hideFootbar: true,
  22661. pagination: false,
  22662. tbar: [
  22663. {
  22664. xtype: 'button',
  22665. text: '删除',
  22666. iconCls: 'x-fa fa-minus-circle',
  22667. cls: 'ext-btn-danger',
  22668. bind: {
  22669. disabled: '{!' + reference + '_grid.selection}',
  22670. },
  22671. listeners: {
  22672. click: function (sender) {
  22673. var grid = sender.up('yvgrid');
  22674. removeGridRow(grid);
  22675. gridChanged(me, grid);
  22676. }
  22677. },
  22678. },
  22679. ],
  22680. store: {},
  22681. listeners: {
  22682. editfinish: function (sender) {
  22683. gridChanged(me, sender);
  22684. },
  22685. },
  22686. columns: [
  22687. {
  22688. dataIndex: 'field',
  22689. header: '字段', sortable: false, menuDisabled: true,
  22690. width: 190,
  22691. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22692. var column = context.column;
  22693. var propertyConfig = me.config.propertyConfig;
  22694. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22695. var field = record.get('field');
  22696. if (field) {
  22697. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22698. if (idx >= 0) {
  22699. var meta = propertyConfig[idx];
  22700. return meta.text;
  22701. }
  22702. }
  22703. return value;
  22704. }
  22705. },
  22706. {
  22707. dataIndex: 'value',
  22708. header: '值', sortable: false, menuDisabled: true,
  22709. flex: 1,
  22710. getEditor: function (record) {
  22711. var column = this;
  22712. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22713. var propertyConfig = me.config.propertyConfig;
  22714. var field = record.get('field');
  22715. if (!field) {
  22716. // 没有填 propertyName
  22717. return;
  22718. }
  22719. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22720. if (idx < 0) {
  22721. console.error('没有找到 field=' + field + ". propertyConfig");
  22722. return;
  22723. }
  22724. var meta = propertyConfig[idx];
  22725. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22726. return new Ext.grid.CellEditor({
  22727. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22728. });
  22729. }
  22730. return new Ext.grid.CellEditor({
  22731. field: __assign({ dict: meta.dict }, meta.editor)
  22732. });
  22733. },
  22734. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22735. var column = context.column;
  22736. var grid = _$2.get(view, 'ownerGrid');
  22737. var propertyConfig = me.config.propertyConfig;
  22738. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22739. var field = record.get('field');
  22740. if (field) {
  22741. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22742. if (idx >= 0) {
  22743. var meta = propertyConfig[idx];
  22744. var dictName = _$2.get(meta, 'dict');
  22745. if (dictName && window['DICT_CACHE'][dictName]) {
  22746. var dict_1 = window['DICT_CACHE'][dictName];
  22747. var valueText_1 = [];
  22748. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22749. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22750. if (idxKv >= 0) {
  22751. valueText_1.push(dict_1[idxKv].text);
  22752. }
  22753. else {
  22754. valueText_1.push(value);
  22755. }
  22756. });
  22757. return valueText_1.join(',');
  22758. }
  22759. }
  22760. }
  22761. return valueList;
  22762. },
  22763. },
  22764. ]
  22765. },
  22766. {
  22767. title: '文本模式',
  22768. key: 'sql',
  22769. xtype: 'sqleditor',
  22770. reference: reference + '_sql',
  22771. listeners: {
  22772. change: function (sender) {
  22773. var scope = lookupScope(me);
  22774. // 保存 editor 写入的值
  22775. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22776. }
  22777. }
  22778. },
  22779. ]
  22780. }
  22781. ] });
  22782. this.superclass.constructor.call(this, newConfig);
  22783. },
  22784. initComponent: function () {
  22785. // 货位条件树
  22786. var me = this;
  22787. me.superclass.initComponent.apply(this, arguments);
  22788. var tree = this.down('yvtree');
  22789. var config = me.config;
  22790. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22791. },
  22792. });
  22793. function gridChanged(me, grid) {
  22794. var data = grid.getDataRows();
  22795. var propertyConfig = me.config.propertyConfig;
  22796. var bindValue = me.config.bindValue;
  22797. var scope = lookupScope(me);
  22798. var sql = parseGridToParam(data);
  22799. scope.viewModel.set(bindValue, sql);
  22800. }
  22801. /**
  22802. * 用于从 propertyConfig 解析出树形结构
  22803. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22804. * ->
  22805. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22806. */
  22807. function buildConfigTree(propertyConfig) {
  22808. var root = {
  22809. expanded: true,
  22810. leaf: false,
  22811. children: []
  22812. };
  22813. var categoryObj = {};
  22814. var cfgList = propertyConfig;
  22815. _$2.forEach(cfgList, function (cfg) {
  22816. var cateNode = categoryObj[cfg.category];
  22817. if (!cateNode) {
  22818. cateNode = {
  22819. text: cfg.category, expanded: true, leaf: false,
  22820. children: []
  22821. };
  22822. categoryObj[cfg.category] = cateNode;
  22823. root.children.push(cateNode);
  22824. }
  22825. cateNode.children.push({
  22826. text: cfg.text,
  22827. field: cfg.field,
  22828. operator: cfg.operator,
  22829. defaultValue: cfg.defaultValue,
  22830. leaf: true,
  22831. });
  22832. });
  22833. return root;
  22834. }
  22835. /**
  22836. * 将表格变成参数语句 [
  22837. * {field: 'f1', value: 1}
  22838. * {field: 'f2', value: 2}
  22839. * {field: 'f3', value: '3'}
  22840. * {field: 'f4', value: 4}
  22841. * ]
  22842. * ->
  22843. * f1=v1, f2=v2
  22844. */
  22845. function parseGridToParam(list) {
  22846. var sqls = [];
  22847. _$2.forEach(list, function (i) {
  22848. sqls.push(i.field + '=' + (i.value));
  22849. });
  22850. return sqls.join('; ');
  22851. }
  22852. /**
  22853. * 将 分号分割的的参数设置 变成表格
  22854. * @param param a=1; b=2; c='3'
  22855. * @return [
  22856. {field: 'a', value: 1}
  22857. {field: 'b', value: 2}
  22858. {field: 'c', value: '3'}
  22859. ]
  22860. */
  22861. function parseParamToGrid(param) {
  22862. if (!param || !_$2.trim(param)) {
  22863. return [];
  22864. }
  22865. var ret = [];
  22866. var sp = _$2.split(param, ';');
  22867. _$2.forEach(sp, function (v) {
  22868. var vi = _$2.indexOf(v, '=');
  22869. var field = _$2.trim(v.substr(0, vi));
  22870. var value = eval(v.substr(vi + 1));
  22871. ret.push({ field: field, value: value });
  22872. });
  22873. return ret;
  22874. }
  22875. }
  22876. //# sourceMappingURL=ParamComplex.js.map
  22877. function initSqlEditor () {
  22878. Ext.define('com.yvan.studio.SqlEditor', {
  22879. extend: 'Ext.panel.Panel',
  22880. alias: 'widget.sqleditor',
  22881. xtype: 'sqleditor',
  22882. layout: 'fit',
  22883. border: false,
  22884. html: "<div class=\"editor\"/>",
  22885. config: {
  22886. value: ''
  22887. },
  22888. codeChange: undefined,
  22889. isChangeFromOuter: false,
  22890. setCode: function (value) {
  22891. var _this = this;
  22892. this.code = value;
  22893. this.value = value;
  22894. _$2.defer(function () {
  22895. _this.isChangeFromOuter = true;
  22896. if (_this.editor) {
  22897. _this.editor.setValue(value);
  22898. }
  22899. });
  22900. },
  22901. getCode: function () {
  22902. return this.getValue();
  22903. },
  22904. updateOptions: function (options) {
  22905. if (this.editor && options) {
  22906. this.editor.updateOptions(options);
  22907. }
  22908. },
  22909. getValue: function () {
  22910. if (!this.editor) {
  22911. return this.code;
  22912. }
  22913. return this.editor.getValue();
  22914. },
  22915. applyPosition: function () {
  22916. var _this = this;
  22917. if (this.autoFocusMethod) {
  22918. if (this.editor) {
  22919. _$2.defer(function () {
  22920. if (_this.autoFocusStartLine) {
  22921. _this.editor.setPosition({
  22922. lineNumber: _this.autoFocusStartLine,
  22923. column: _this.autoFocusStartColumn
  22924. });
  22925. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22926. }
  22927. _this.editor.focus();
  22928. });
  22929. delete this.autoFocusMethod;
  22930. }
  22931. }
  22932. this.editor.layout();
  22933. },
  22934. insertText: function (text) {
  22935. var editor = this.editor;
  22936. var position = editor.getPosition();
  22937. editor.executeEdits('', [
  22938. {
  22939. range: {
  22940. startLineNumber: position.lineNumber,
  22941. startColumn: position.column,
  22942. endLineNumber: position.lineNumber,
  22943. endColumn: position.column
  22944. },
  22945. text: text
  22946. }
  22947. ]);
  22948. },
  22949. setValue: function (value, fromEditor) {
  22950. this.setCode(value);
  22951. var me = this;
  22952. if (me.value === value) {
  22953. // 值相等,不需要变化
  22954. return;
  22955. }
  22956. if (fromEditor !== true && me.editor) {
  22957. // 不是来源于编辑器的变化,才设置编辑器的值
  22958. me.editor.setValue(value);
  22959. }
  22960. // 通知mixins setValue
  22961. me.value = value;
  22962. me.fireEvent('change', value);
  22963. },
  22964. initComponent: function () {
  22965. var that = this;
  22966. this.superclass.initComponent.call(this);
  22967. that.on({
  22968. resize: function () {
  22969. if (that.editor) {
  22970. that.editor.layout();
  22971. }
  22972. },
  22973. destory: function () {
  22974. if (that.editor) {
  22975. that.editor.dispose();
  22976. delete that.editor;
  22977. }
  22978. },
  22979. afterrender: function (sender) {
  22980. var $dom = $(that.el.dom).find('.editor');
  22981. attach_2($dom[0], {
  22982. value: that.code
  22983. }).then(function (editor) {
  22984. that.editor = editor;
  22985. that.applyPosition();
  22986. that.editor.onDidChangeModelContent(function (e) {
  22987. that.fireEvent('change', that.editor, e);
  22988. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22989. that.codeChange(that.editor.getValue(), that.name, e);
  22990. }
  22991. that.isChangeFromOuter = false;
  22992. });
  22993. });
  22994. }
  22995. });
  22996. }
  22997. });
  22998. function attach_2(element, opts) {
  22999. if (!window['monaco']) {
  23000. return;
  23001. }
  23002. var monaco = window['monaco'];
  23003. return new Promise(function (resolve) {
  23004. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  23005. enabled: false
  23006. } }));
  23007. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  23008. // const sql = editor.getValue()
  23009. // if (_.trim(sql).length > 0) {
  23010. // editor.setValue(format(sql, {
  23011. // indent: ' ',
  23012. // uppercase: true,
  23013. // }))
  23014. // }
  23015. // })
  23016. editor.onKeyUp(function (e) {
  23017. // console.log(e)
  23018. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23019. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23020. }
  23021. });
  23022. resolve(editor);
  23023. });
  23024. }
  23025. }
  23026. //# sourceMappingURL=SqlEditor.js.map
  23027. function initJsonEditor () {
  23028. Ext.define('com.yvan.studio.JsonEditor', {
  23029. extend: 'Ext.panel.Panel',
  23030. alias: 'widget.jsoneditor',
  23031. xtype: 'jsoneditor',
  23032. layout: 'fit',
  23033. border: false,
  23034. html: "<div class=\"editor\"/>",
  23035. autoFocusMethod: true,
  23036. autoFocusStartLine: 0,
  23037. autoFocusStartColumn: 0,
  23038. codeChange: undefined,
  23039. funcArr: [],
  23040. modulePage: null,
  23041. isChangeFromOuter: false,
  23042. name: "",
  23043. /**
  23044. * 设置代码
  23045. */
  23046. setCode: function (value) {
  23047. var _this = this;
  23048. this.code = value;
  23049. _$2.defer(function () {
  23050. _this.isChangeFromOuter = true;
  23051. if (_this.editor) {
  23052. _this.editor.setValue(value);
  23053. }
  23054. });
  23055. },
  23056. updateOptions: function (options) {
  23057. if (this.editor && options) {
  23058. this.editor.updateOptions(options);
  23059. }
  23060. },
  23061. setLanguage: function (lang) {
  23062. if (!window['monaco']) {
  23063. return;
  23064. }
  23065. var monaco = window['monaco'];
  23066. if (this.editor && lang) {
  23067. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23068. }
  23069. },
  23070. getCode: function () {
  23071. var _a;
  23072. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23073. },
  23074. applyPosition: function () {
  23075. var _this = this;
  23076. if (this.autoFocusMethod) {
  23077. if (this.editor) {
  23078. _$2.defer(function () {
  23079. if (_this.autoFocusStartLine) {
  23080. _this.editor.setPosition({
  23081. lineNumber: _this.autoFocusStartLine,
  23082. column: _this.autoFocusStartColumn
  23083. });
  23084. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23085. }
  23086. _this.editor.focus();
  23087. });
  23088. delete this.autoFocusMethod;
  23089. }
  23090. }
  23091. this.editor.layout();
  23092. },
  23093. initComponent: function () {
  23094. var that = this;
  23095. this.superclass.initComponent.apply(this, arguments);
  23096. this.on({
  23097. resize: function (sender, width, height) {
  23098. if (that.editor) {
  23099. that.editor.layout();
  23100. }
  23101. },
  23102. destory: function () {
  23103. if (that.editor) {
  23104. that.editor.dispose();
  23105. delete that.editor;
  23106. }
  23107. },
  23108. afterrender: function (sender) {
  23109. var $dom = $(that.el.dom).find('.editor');
  23110. attach_116($dom[0], {
  23111. value: that.code
  23112. }).then(function (editor) {
  23113. that.editor = editor;
  23114. that.applyPosition();
  23115. that.editor.onDidChangeModelContent(function (e) {
  23116. that.fireEvent('change', that.editor, e);
  23117. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23118. that.codeChange(that.editor.getValue(), that.name, e);
  23119. }
  23120. that.isChangeFromOuter = false;
  23121. });
  23122. });
  23123. }
  23124. });
  23125. },
  23126. });
  23127. function attach_116(element, opts) {
  23128. if (!window['monaco']) {
  23129. return;
  23130. }
  23131. var monaco = window['monaco'];
  23132. return new Promise(function (resolve) {
  23133. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23134. enabled: false
  23135. } }));
  23136. editor.onKeyUp(function (e) {
  23137. // console.log(e)
  23138. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23139. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23140. }
  23141. });
  23142. resolve(editor);
  23143. });
  23144. }
  23145. }
  23146. //# sourceMappingURL=JsonEditor.js.map
  23147. function initJsEditor () {
  23148. Ext.define('com.yvan.studio.JsEditor', {
  23149. extend: 'Ext.panel.Panel',
  23150. alias: 'widget.jseditor',
  23151. xtype: 'jseditor',
  23152. layout: 'fit',
  23153. border: false,
  23154. html: "<div class=\"editor\"/>",
  23155. autoFocusMethod: true,
  23156. autoFocusStartLine: 0,
  23157. autoFocusStartColumn: 0,
  23158. codeChange: undefined,
  23159. funcArr: [],
  23160. modulePage: null,
  23161. isChangeFromOuter: false,
  23162. name: "",
  23163. /**
  23164. * 设置代码
  23165. */
  23166. setCode: function (value) {
  23167. var _this = this;
  23168. this.code = value;
  23169. _$2.defer(function () {
  23170. _this.isChangeFromOuter = true;
  23171. if (_this.editor) {
  23172. _this.editor.setValue(value);
  23173. if (_this.name === "controllerEditor") {
  23174. _this.funcArr = _this.getAllFunction();
  23175. }
  23176. }
  23177. });
  23178. },
  23179. getCode: function () {
  23180. var _a;
  23181. if (!this.editor) {
  23182. return this.code;
  23183. }
  23184. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23185. },
  23186. applyPosition: function () {
  23187. var _this = this;
  23188. if (this.autoFocusMethod) {
  23189. if (this.editor) {
  23190. _$2.defer(function () {
  23191. if (_this.autoFocusStartLine) {
  23192. _this.editor.setPosition({
  23193. lineNumber: _this.autoFocusStartLine,
  23194. column: _this.autoFocusStartColumn
  23195. });
  23196. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23197. }
  23198. _this.editor.focus();
  23199. });
  23200. delete this.autoFocusMethod;
  23201. }
  23202. }
  23203. this.editor.layout();
  23204. },
  23205. initComponent: function () {
  23206. var that = this;
  23207. this.superclass.initComponent.apply(this, arguments);
  23208. this.on({
  23209. resize: function (sender, width, height) {
  23210. if (that.editor) {
  23211. that.editor.layout();
  23212. }
  23213. },
  23214. destory: function () {
  23215. if (that.editor) {
  23216. that.editor.dispose();
  23217. delete that.editor;
  23218. }
  23219. },
  23220. afterrender: function () {
  23221. var $dom = $(that.el.dom).find('.editor');
  23222. attach_1($dom[0], {
  23223. value: that.code
  23224. }).then(function (editor) {
  23225. that.editor = editor;
  23226. that.applyPosition();
  23227. that.editor.onDidChangeModelContent(function (e) {
  23228. that.fireEvent('change', that.editor, e);
  23229. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23230. that.codeChange(that.editor.getValue(), that.name, e);
  23231. }
  23232. that.isChangeFromOuter = false;
  23233. });
  23234. });
  23235. }
  23236. });
  23237. },
  23238. getAllFunction: function () {
  23239. var funcArr = [];
  23240. var ast = window['YvanUI'].recast.parse(this.code);
  23241. if (ast && ast.program && ast.program.body) {
  23242. if (Array.isArray(ast.program.body)) {
  23243. for (var i = 0; i < ast.program.body.length; i++) {
  23244. var m = ast.program.body[i];
  23245. if (m.type === "ExportDefaultDeclaration") {
  23246. if (m.declaration.type === "ClassDeclaration") {
  23247. if (m.declaration.body.type === "ClassBody") {
  23248. if (Array.isArray(m.declaration.body.body)) {
  23249. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23250. var ob = m.declaration.body.body[j];
  23251. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23252. var funcItem = { name: ob.key.name, args: [] };
  23253. if (Array.isArray(ob.value.params)) {
  23254. for (var k = 0; k < ob.value.params.length; k++) {
  23255. var p = ob.value.params[k];
  23256. funcItem.args.push(p.name);
  23257. }
  23258. }
  23259. funcArr.push(funcItem);
  23260. }
  23261. }
  23262. }
  23263. }
  23264. }
  23265. }
  23266. }
  23267. }
  23268. }
  23269. return funcArr;
  23270. }
  23271. });
  23272. var isInited = false;
  23273. function attach_1(element, opts) {
  23274. if (!window['monaco']) {
  23275. return;
  23276. }
  23277. var monaco = window['monaco'];
  23278. return new Promise(function (resolve) {
  23279. if (!isInited) {
  23280. isInited = true;
  23281. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23282. noSemanticValidation: true,
  23283. noSyntaxValidation: false
  23284. });
  23285. // compiler options
  23286. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23287. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23288. allowNonTsExtensions: true,
  23289. });
  23290. // extra libraries
  23291. var libSource = [
  23292. 'declare class Facts {',
  23293. ' /**',
  23294. ' * Returns the next fact',
  23295. ' */',
  23296. ' static next():string',
  23297. ' static next222():string',
  23298. '}',
  23299. "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ",
  23300. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23301. ].join('\n');
  23302. var libUri = 'file:///index.d.ts';
  23303. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23304. // When resolving definitions and references, the editor will try to use created models.
  23305. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23306. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23307. }
  23308. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23309. resolve(editor);
  23310. });
  23311. }
  23312. }
  23313. //# sourceMappingURL=JsEditor.js.map
  23314. function initClipboard () {
  23315. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23316. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23317. Ext.grid.plugin.Clipboard.override({
  23318. getCellData: function (format, erase) {
  23319. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23320. if (selection) {
  23321. selection.eachCell(function (cellContext) {
  23322. column = cellContext.column;
  23323. view = cellContext.column.getView();
  23324. record = cellContext.record;
  23325. // Do not copy the check column or row numberer column
  23326. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23327. return;
  23328. }
  23329. if (lastRecord !== record) {
  23330. lastRecord = record;
  23331. ret.push(row = []);
  23332. }
  23333. dataIndex = column.dataIndex;
  23334. // 记录原始数据
  23335. var rData = record.data[dataIndex];
  23336. if (isRaw) {
  23337. data = record.data[dataIndex];
  23338. }
  23339. else {
  23340. // Try to access the view node.
  23341. viewNode = view.all.item(cellContext.rowIdx);
  23342. // If we could not, it's because it's outside of the rendered block -
  23343. // recreate it.
  23344. if (!viewNode) {
  23345. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23346. }
  23347. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23348. data = cell.innerHTML;
  23349. if (isText) {
  23350. data = Ext.util.Format.stripTags(data);
  23351. }
  23352. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23353. data = data || rData;
  23354. }
  23355. row.push(data);
  23356. if (erase && dataIndex) {
  23357. record.set(dataIndex, null);
  23358. }
  23359. });
  23360. }
  23361. // See decode() comment below
  23362. return Ext.util.TSV.encode(ret, undefined, null);
  23363. },
  23364. getCells: function (format, erase) {
  23365. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23366. if (selection) {
  23367. selection.eachCell(function (cellContext) {
  23368. record = cellContext.record;
  23369. if (lastRecord !== record) {
  23370. lastRecord = record;
  23371. ret.push(row = {
  23372. model: record.self,
  23373. fields: []
  23374. });
  23375. }
  23376. dataIndex = cellContext.column.dataIndex;
  23377. row.fields.push({
  23378. name: dataIndex,
  23379. value: record.data[dataIndex]
  23380. });
  23381. if (erase && dataIndex) {
  23382. record.set(dataIndex, null);
  23383. }
  23384. });
  23385. }
  23386. return ret;
  23387. },
  23388. getTextData: function (format, erase) {
  23389. return this.getCellData(format, erase);
  23390. },
  23391. putCellData: function (data, format) {
  23392. var _a;
  23393. var values = Ext.util.TSV.decode(data, undefined, null), row, recCount = values.length, colCount = recCount ? values[0].length : 0, sourceRowIdx, sourceColIdx, view = this.getCmp().getView(), maxRowIdx = view.dataSource.getCount() - 1, maxColIdx = view.getVisibleColumnManager().getColumns().length - 1, selModel = view.getSelectionModel(), selected = selModel.getSelected(), navModel = view.getNavigationModel(), destination = selected.startCell || navModel.getPosition(), dataIndex, destinationStartColumn, dataObject = {};
  23394. // If the view is not focused, use the first cell of the selection as the destination.
  23395. if (!destination && selected) {
  23396. selected.eachCell(function (c) {
  23397. destination = c;
  23398. return false;
  23399. });
  23400. }
  23401. if (destination) {
  23402. // Create a new Context based upon the outermost View.
  23403. // NavigationModel works on local views.
  23404. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23405. // At that point, we can use navModel.getPosition()
  23406. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23407. }
  23408. else {
  23409. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23410. }
  23411. destinationStartColumn = destination.colIdx;
  23412. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23413. row = values[sourceRowIdx];
  23414. // Collect new values in dataObject
  23415. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23416. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23417. continue;
  23418. }
  23419. dataIndex = destination.column.dataIndex;
  23420. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23421. if (dataIndex) {
  23422. switch (format) {
  23423. // Raw field values
  23424. case 'raw':
  23425. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23426. break;
  23427. // Textual data with HTML tags stripped
  23428. case 'text':
  23429. {
  23430. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23431. // 获取字典原始的value
  23432. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23433. }
  23434. else {
  23435. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23436. }
  23437. break;
  23438. }
  23439. }
  23440. }
  23441. // If we are at the end of the destination row, break the column loop.
  23442. if (destination.colIdx === maxColIdx) {
  23443. break;
  23444. }
  23445. destination.setColumn(destination.colIdx + 1);
  23446. }
  23447. // Update the record in one go.
  23448. destination.record.set(dataObject);
  23449. // If we are at the end of the destination store, break the row loop.
  23450. if (destination.rowIdx === maxRowIdx) {
  23451. break;
  23452. }
  23453. // Jump to next row in destination
  23454. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23455. }
  23456. },
  23457. putTextData: function (data, format) {
  23458. var _a, _b, _c;
  23459. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23460. // 根据复制的行数自动添加新的行
  23461. var dataLength = ((_c = (_b = (_a = this.cmp.getStore()) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.length) || 0;
  23462. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23463. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23464. this.cmp.getStore().add({});
  23465. }
  23466. }
  23467. this.putCellData(data, format);
  23468. },
  23469. });
  23470. }
  23471. //# sourceMappingURL=clipboard.js.map
  23472. function initDict () {
  23473. var DICT_CACHE = window['DICT_CACHE'];
  23474. if (!DICT_CACHE) {
  23475. DICT_CACHE = {};
  23476. window['DICT_CACHE'] = DICT_CACHE;
  23477. }
  23478. DICT_CACHE.XTYPE = [
  23479. { id: 'datefield', text: '日期' },
  23480. { id: 'datetimefield', text: '日期时间' },
  23481. { id: 'textfield', text: '文本' },
  23482. { id: 'numberfield', text: '数字' },
  23483. { id: 'combo', text: '下拉框' },
  23484. ];
  23485. DICT_CACHE.operator = [
  23486. { id: '=', text: '=' },
  23487. { id: '>', text: '>' },
  23488. { id: '<', text: '<' },
  23489. { id: '>=', text: '>=' },
  23490. { id: '<=', text: '<=' },
  23491. { id: 'in', text: 'in' },
  23492. { id: 'notIn', text: 'notIn' },
  23493. ];
  23494. DICT_CACHE.GRID_MODE = [
  23495. { id: 'edit1', text: '单机编辑模式' },
  23496. { id: 'edit2', text: '双击编辑模式' },
  23497. { id: 'checkbox', text: '勾选' },
  23498. { id: 'checkonly', text: '只勾选' },
  23499. { id: 'select', text: '行选择模式' },
  23500. ];
  23501. DICT_CACHE.BOTH_SELECT = [
  23502. { id: 'N/A', text: '<无>' },
  23503. { id: 'textfield', text: '文本' },
  23504. { id: 'numberfield', text: '数字框' },
  23505. { id: 'datefield', text: '日期' },
  23506. { id: 'datetimefield', text: '日期时间' },
  23507. { id: 'combo', text: '下拉框' },
  23508. { id: 'combogrid', text: '下拉表' },
  23509. { id: 'checkbox', text: '勾选' },
  23510. ];
  23511. DICT_CACHE.ROW_LAYOUT = [
  23512. { id: 'flex', text: '按权重摆放' },
  23513. { id: 'hbox', text: '按宽度摆放' },
  23514. ];
  23515. DICT_CACHE.GRID_XTYPE = [
  23516. { id: 'N/A', text: '<无>' },
  23517. { id: 'textfield', text: '文本-textfield' },
  23518. { id: 'numberfield', text: '数字框-numberfield' },
  23519. { id: 'datefield', text: '日期-datefield' },
  23520. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23521. { id: 'combo', text: '下拉框-combo' },
  23522. { id: 'combogrid', text: '下拉表-combogrid' },
  23523. { id: 'checkbox', text: '勾选-checkbox' },
  23524. ];
  23525. DICT_CACHE.FORM_XTYPE = [
  23526. { id: 'N/A', text: '<无>' },
  23527. { id: 'textfield', text: '文本-textfield' },
  23528. { id: 'numberfield', text: '数字框-numberfield' },
  23529. { id: 'datefield', text: '日期-datefield' },
  23530. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23531. { id: 'combo', text: '下拉框-combo' },
  23532. { id: 'combogrid', text: '下拉表-combogrid' },
  23533. { id: 'checkbox', text: '勾选-checkbox' },
  23534. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23535. ];
  23536. DICT_CACHE.GRID_FORMATTER = [
  23537. { id: 'N/A', text: '默认' },
  23538. { id: 'rownum', text: '序号-rownum' },
  23539. { id: 'button', text: '按钮-button' },
  23540. { id: 'checkbox', text: '勾选-checkbox' },
  23541. { id: 'progres', text: '进度条-progres' },
  23542. ];
  23543. }
  23544. //# sourceMappingURL=dict.js.map
  23545. function initDesigner () {
  23546. Ext.define('com.yvan.studio.designer', {
  23547. extend: 'Ext.panel.Panel',
  23548. alias: 'widget.designer',
  23549. xtype: 'designer',
  23550. layout: 'fit',
  23551. items: [],
  23552. constructor: function (config) {
  23553. var self = this;
  23554. var newConfig = _$2.defaultsDeep({
  23555. // 强制性属性
  23556. }, config);
  23557. this.superclass.constructor.call(self, newConfig);
  23558. },
  23559. initComponent: function () {
  23560. var me = this;
  23561. me.on({
  23562. afterrender: function () {
  23563. }
  23564. });
  23565. this.superclass.initComponent.call(me);
  23566. }
  23567. });
  23568. }
  23569. //# sourceMappingURL=designer.js.map
  23570. var FixClass = /** @class */ (function () {
  23571. function FixClass() {
  23572. }
  23573. FixClass.prototype.fix = function (me, config) {
  23574. var _this = this;
  23575. if (isDesignMode(me, config)) {
  23576. return;
  23577. }
  23578. if (!config) {
  23579. return;
  23580. }
  23581. var fix = config.fix;
  23582. if (!fix) {
  23583. return;
  23584. }
  23585. delete config.fix;
  23586. // 这里有个 bug
  23587. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23588. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23589. var scope;
  23590. if (config.$initParent) {
  23591. // 在面板上的组件
  23592. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23593. }
  23594. else if (config.column) {
  23595. // 在列上的组件
  23596. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23597. }
  23598. if (_$2.isArray(fix)) {
  23599. _$2.each(fix, function (f) {
  23600. var fn = lookupFn(scope, f);
  23601. fn.call(_this, me, config);
  23602. });
  23603. }
  23604. else if (_$2.isString(fix)) {
  23605. var fn = lookupFn(scope, fix);
  23606. fn.call(this, me, config);
  23607. }
  23608. };
  23609. __decorate([
  23610. baseConfigProcess(),
  23611. __metadata("design:type", Function),
  23612. __metadata("design:paramtypes", [Object, Object]),
  23613. __metadata("design:returntype", void 0)
  23614. ], FixClass.prototype, "fix", null);
  23615. return FixClass;
  23616. }());
  23617. //# sourceMappingURL=fix.js.map
  23618. function init$1() {
  23619. // 引入 filters 过滤插件
  23620. Ext.require([
  23621. 'Ext.grid.filters.Filters'
  23622. ]);
  23623. // 启用 tooltip 快捷提示
  23624. Ext.QuickTips.init();
  23625. // 定义日期格式化方法
  23626. if (Ext.util && Ext.util.Format) {
  23627. Ext.apply(Ext.util.Format, {
  23628. dateFormat: 'Y-m-d'
  23629. });
  23630. }
  23631. Ext.form.field.Display.override({
  23632. cls: 'yvan-display-field',
  23633. labelAlign: 'right'
  23634. });
  23635. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23636. override: "Ext.picker.Date",
  23637. format: "Y-m-d",
  23638. });
  23639. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23640. override: "Ext.form.field.Date",
  23641. format: "Y-m-d",
  23642. });
  23643. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23644. override: "Ext.grid.PropertyColumnModel",
  23645. format: "Y-m-d",
  23646. });
  23647. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23648. override: "Ext.view.AbstractView",
  23649. loadingText: "读取中..."
  23650. });
  23651. Ext.LoadMask.prototype.msg = '请稍后...';
  23652. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23653. override: "Ext.grid.header.Container",
  23654. sortClearText: '不排序',
  23655. sortAscText: "正序",
  23656. sortDescText: "倒序",
  23657. lockText: "锁定列",
  23658. unlockText: "解除锁定",
  23659. columnsText: "字段隐藏"
  23660. });
  23661. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23662. override: "Ext.grid.filters.filter.Date",
  23663. fields: {
  23664. lt: { text: '之前' },
  23665. gt: { text: '之后' },
  23666. eq: { text: '相等' },
  23667. },
  23668. // Defaults to Ext.Date.defaultFormat
  23669. dateFormat: null
  23670. });
  23671. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23672. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23673. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23674. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23675. override: "Ext.grid.locking.Lockable",
  23676. lockText: "锁定",
  23677. unlockText: '解锁',
  23678. });
  23679. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23680. override: "Ext.grid.filters.Filters",
  23681. menuFilterText: "过滤"
  23682. });
  23683. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23684. override: "Ext.grid.filters.filter.Boolean",
  23685. yesText: "已钩选",
  23686. noText: "未勾选"
  23687. });
  23688. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23689. override: "Ext.grid.filters.filter.String",
  23690. emptyText: "输入过滤文本..."
  23691. });
  23692. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23693. override: "Ext.grid.filters.filter.Number",
  23694. emptyText: "输入数字..."
  23695. });
  23696. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23697. override: "Ext.PagingToolbar",
  23698. beforePageText: "第",
  23699. // update
  23700. afterPageText: "/ {0} 页",
  23701. // update
  23702. firstText: "第一页",
  23703. prevText: "上一页",
  23704. // update
  23705. nextText: "下一页",
  23706. lastText: "最后页",
  23707. refreshText: "刷新",
  23708. displayMsg: "总共 {2} 条",
  23709. // update
  23710. emptyMsg: '没有数据'
  23711. });
  23712. /**
  23713. * 改变事件的获取方式.
  23714. * 具体见: ext-all-debug.js:23216 addListener
  23715. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23716. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23717. */
  23718. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23719. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23720. if (typeof fn === 'string' &&
  23721. (_$2.startsWith(fn, 'scope.') ||
  23722. _$2.startsWith(fn, 'system.') ||
  23723. _$2.startsWith(fn, 'format.'))) {
  23724. scope = lookupScope(this);
  23725. if (isDesignMode(scope, undefined)) {
  23726. fn = Ext.emptyFn;
  23727. }
  23728. else {
  23729. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23730. // const vm = this.lookupViewModel()
  23731. // if (vm && vm.yvanScope) {
  23732. // scope = vm.yvanScope
  23733. // fn = scope[fn.substr('scope.'.length)]
  23734. // }
  23735. fn = lookupFn(scope, fn, this);
  23736. }
  23737. }
  23738. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23739. };
  23740. // 将 SystemLib 扩展到 window.system 下
  23741. if (!window['system']) {
  23742. window['system'] = {};
  23743. }
  23744. _$2.extend(window['system'], SystemLib);
  23745. _$2.extend(window['system'], {
  23746. showGridRowDetail: showGridRowDetail
  23747. });
  23748. Ext.apply(Ext.util.Format, {
  23749. // 百分比
  23750. percentRenderer: function (v, rd, model) {
  23751. if (!v) {
  23752. v = 0;
  23753. }
  23754. if (typeof v === 'string') {
  23755. v = parseInt(v);
  23756. }
  23757. var valueString = v.toFixed(2);
  23758. var valueFixed = v > 100 ? 100 : v;
  23759. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23760. var cls = '';
  23761. if (v < 90) {
  23762. cls = 'danger';
  23763. }
  23764. else if (v < 100) {
  23765. cls = 'warning';
  23766. }
  23767. else {
  23768. cls = 'success';
  23769. }
  23770. return Ext.String
  23771. .format(
  23772. // '<div>'
  23773. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23774. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23775. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23776. // + '</div></div>', valueString, valueFixed, cls);
  23777. '<div class="x-progress x-progress-default x-widthed" style="width: 100%;"><div class="x-progress-text x-progress-text-back" style="width:100%;">{0}%</div><div class="x-progress-bar progress-{1}" style="width: {2}%;"><div class="x-progress-text" style="width: {3}%">{4}%</div></div></div>', valueString, cls, valueFixed, ((100 / valueFixed) * 100), valueString); // .format(
  23778. // '<div>'
  23779. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23780. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23781. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23782. // + '</div></div>', v, valueFixed, valueString);
  23783. },
  23784. //button
  23785. button: function (v, rd, model) {
  23786. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23787. }
  23788. });
  23789. initComponent();
  23790. initPanel();
  23791. initGridColumn();
  23792. initTree();
  23793. initGrid();
  23794. initMainTab();
  23795. initTextfield();
  23796. initCombo();
  23797. initTag();
  23798. initContainer();
  23799. initRows();
  23800. initCols();
  23801. initForm();
  23802. initToolbar();
  23803. initSplitter();
  23804. initButton();
  23805. initStores();
  23806. initSearch();
  23807. initMultipleSearch();
  23808. initDate();
  23809. initDateTimePicker();
  23810. initDateTime();
  23811. initNumber();
  23812. initCheckbox();
  23813. initCheckboxGroup();
  23814. initRadio();
  23815. initRadioGroup();
  23816. initFieldset();
  23817. initCombotree();
  23818. initPickerPlus();
  23819. initCombogrid();
  23820. initComboGridMulti();
  23821. initIframe();
  23822. initBpmn();
  23823. initSqlEditor();
  23824. initJsonEditor();
  23825. initJsEditor();
  23826. initClipboard();
  23827. initSqlComplex();
  23828. initParamComplex();
  23829. initDict();
  23830. initDesigner();
  23831. }
  23832. //# sourceMappingURL=init.js.map
  23833. /**
  23834. * 创建一个 Ajax 客户端
  23835. */
  23836. function createAjax(createOption) {
  23837. if (createOption.baseUrl) {
  23838. axios__default.defaults.baseURL = createOption.baseUrl;
  23839. axios__default.defaults.timeout = createOption.timeout;
  23840. storeAjax.timeout = createOption.timeout;
  23841. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23842. }
  23843. return function (option) {
  23844. //@ts-ignore
  23845. option.method = (option.method || 'get').toLocaleLowerCase();
  23846. //@ts-ignore
  23847. var ax = __assign({}, option);
  23848. switch (option.method) {
  23849. case 'get':
  23850. ax.method = 'GET';
  23851. ax.params = option.param;
  23852. ax.headers = __assign({}, option.headers);
  23853. break;
  23854. case 'post':
  23855. ax.method = 'POST';
  23856. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23857. ax.params = option.param;
  23858. ax.data = Qs.stringify(option.data);
  23859. break;
  23860. case 'put':
  23861. case 'patch':
  23862. case 'delete':
  23863. ax.method = option.method;
  23864. ax.headers = option.headers;
  23865. ax.params = option.param;
  23866. ax.data = Qs.stringify(option.data);
  23867. break;
  23868. case 'download':
  23869. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23870. return new Promise(function (resolver, reject) {
  23871. });
  23872. case "invoke":
  23873. ax.url = serverInvokeUrlTransform(option.url, option);
  23874. ax.method = 'POST';
  23875. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23876. if (typeof option.args === 'object') {
  23877. ax.data = JSON.stringify({
  23878. args: option.args,
  23879. });
  23880. }
  23881. else {
  23882. ax.data = JSON.stringify({
  23883. args: [
  23884. __assign(__assign({}, option.data), option.param)
  23885. ],
  23886. filterModel: option.filterModel,
  23887. sortModel: option.sortModel
  23888. });
  23889. }
  23890. break;
  23891. case 'post-json':
  23892. ax.method = 'POST';
  23893. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23894. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23895. break;
  23896. case 'post-file':
  23897. //TODO 刘壮. 上传文件
  23898. var forms = new FormData();
  23899. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23900. _$2.forOwn(option.data, function (value, key) {
  23901. if (key === 'files') {
  23902. var i_1 = 0;
  23903. _$2.each(value, function (f) {
  23904. // @ts-ignore
  23905. forms.append('file' + (++i_1), f);
  23906. });
  23907. }
  23908. else {
  23909. forms.append(key, value);
  23910. }
  23911. });
  23912. ax.data = forms;
  23913. ax.method = 'POST';
  23914. break;
  23915. case "sql":
  23916. ax.url = sqlUrlTransform(option.url);
  23917. ax.method = 'POST';
  23918. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23919. ax.data = JSON.stringify({
  23920. args: [option.data],
  23921. db: option.db,
  23922. filterModel: option.filterModel,
  23923. sortModel: option.sortModel
  23924. });
  23925. break;
  23926. default:
  23927. throw new Error('not implements');
  23928. }
  23929. return new Promise(function (resolver, reject) {
  23930. axios__default(ax).then(function (resolverRaw) {
  23931. var apiResult = {
  23932. rawData: resolverRaw.data,
  23933. status: resolverRaw.status,
  23934. success: (resolverRaw.data && resolverRaw.data.success),
  23935. data: resolverRaw.data.data,
  23936. pagination: resolverRaw.data.pagination,
  23937. msg: (resolverRaw.data.msg),
  23938. errors: resolverRaw.data.errors,
  23939. headers: resolverRaw.headers
  23940. };
  23941. if (typeof window['apiTranslate'] === 'function') {
  23942. window['apiTranslate'](apiResult.rawData, option.url);
  23943. }
  23944. resolver(apiResult);
  23945. }).catch(function (reason) {
  23946. reject(reason);
  23947. });
  23948. });
  23949. };
  23950. }
  23951. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23952. if (isJson === void 0) { isJson = false; }
  23953. var YvanUI = _$2.get(window, 'YvanUI');
  23954. YvanUI.loading();
  23955. var createObjectURL = function (object) {
  23956. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23957. };
  23958. // const formData = new FormData();
  23959. // _.forOwn(data, (v, k) => {
  23960. // formData.append(k, v);
  23961. // });
  23962. var formData = '';
  23963. var xhr = new XMLHttpRequest();
  23964. xhr.open('POST', downLoadUrl);
  23965. xhr.responseType = 'blob';
  23966. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23967. if (isJson) {
  23968. formData = data ? JSON.stringify(data) : '';
  23969. xhr.setRequestHeader('Content-Type', 'application/json');
  23970. }
  23971. else {
  23972. formData = data ? Qs.stringify(data) : '';
  23973. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23974. }
  23975. //
  23976. if (header) {
  23977. _$2.forOwn(header, function (v, k) {
  23978. xhr.setRequestHeader(k, v);
  23979. });
  23980. }
  23981. xhr.onload = function (e) {
  23982. if (this.status === 200) {
  23983. var blob = this.response;
  23984. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23985. navigator.msSaveBlob(blob, filename);
  23986. YvanUI.clearLoading();
  23987. }
  23988. else {
  23989. var a = document.createElement('a');
  23990. var url = createObjectURL(blob);
  23991. a.href = url;
  23992. a.download = filename;
  23993. document.append(a);
  23994. a.click();
  23995. a.remove();
  23996. window.URL.revokeObjectURL(url);
  23997. YvanUI.clearLoading();
  23998. }
  23999. }
  24000. };
  24001. xhr.send(formData);
  24002. }
  24003. //# sourceMappingURL=ajax.js.map
  24004. function readExcel(file) {
  24005. return new Promise(function (resolve, reject) {
  24006. if (!file) {
  24007. reject("文件读取失败!!!");
  24008. return;
  24009. }
  24010. var reader = new FileReader();
  24011. reader.onload = function (e) {
  24012. if (e.target) {
  24013. var data = e.target.result;
  24014. var workbook = XLSX.read(data, { type: 'binary' });
  24015. resolve(workbook);
  24016. }
  24017. else {
  24018. reject("文件读取失败!!!");
  24019. }
  24020. };
  24021. try {
  24022. reader.readAsBinaryString(file);
  24023. }
  24024. catch (e) {
  24025. reject(e);
  24026. }
  24027. });
  24028. }
  24029. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24030. if (dataStartRow === void 0) { dataStartRow = 2; }
  24031. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24032. if (rowValidate === void 0) { rowValidate = undefined; }
  24033. if (otherValidate === void 0) { otherValidate = undefined; }
  24034. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24035. return new Promise(function (resolve, reject) {
  24036. var promiseArr = [];
  24037. for (var i = 0; i < columnsSet.length; i++) {
  24038. var fix = columnsSet[i].fix;
  24039. if (_$2.isArray(fix) && fix.length > 0) {
  24040. var ss = fix[0].toLowerCase();
  24041. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24042. columnsSet[i].importFormatter = function (vdata) {
  24043. // @ts-ignore
  24044. return window.moment(vdata.ov) - 0;
  24045. };
  24046. }
  24047. else {
  24048. var fn = lookupFn(topScope, fix[0]);
  24049. promiseArr.push(fn(null, columnsSet[i]));
  24050. delete columnsSet[i].fix;
  24051. }
  24052. }
  24053. else if (_$2.isString(fix)) {
  24054. var ss = fix.toLowerCase();
  24055. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24056. columnsSet[i].importFormatter = function (vdata) {
  24057. // @ts-ignore
  24058. return window.moment(vdata.ov) - 0;
  24059. };
  24060. }
  24061. else {
  24062. var fn = lookupFn(topScope, fix);
  24063. promiseArr.push(fn(null, columnsSet[i]));
  24064. delete columnsSet[i].fix;
  24065. }
  24066. }
  24067. }
  24068. var read = function () {
  24069. readExcel(file).then(function (workbook) {
  24070. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24071. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24072. var titleRowValue = [];
  24073. var titleRowKey = [];
  24074. var needLoop = false; // 是否需要迭代
  24075. var columns = [];
  24076. if (worksheet && worksheet["!ref"]) {
  24077. var t = worksheet["!ref"];
  24078. var tempArr = t.split(':');
  24079. if (tempArr.length >= 2) {
  24080. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24081. // 选取title的行,删除之前的行
  24082. if (titleRowNumber > firstRowNumber) {
  24083. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24084. for (var key in worksheet) {
  24085. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24086. delete worksheet[key];
  24087. }
  24088. }
  24089. }
  24090. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24091. firstRowNumber = titleRowNumber + '';
  24092. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24093. }
  24094. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24095. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24096. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24097. for (var key in worksheet) {
  24098. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24099. titleRowKey.push(key);
  24100. titleRowValue.push(worksheet[key].v);
  24101. }
  24102. }
  24103. if (columnsSet && columnsSet.length > 0) {
  24104. var length = columnsSet.length;
  24105. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24106. for (var i = 0; i < length; i++) {
  24107. var vk = titleRowKey[i];
  24108. var item = columnsSet[i];
  24109. var column = {};
  24110. if (typeof item === 'string') {
  24111. column.dataIndex = item;
  24112. column.header = worksheet[vk].v;
  24113. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24114. }
  24115. else if (typeof item.dataIndex === "string") {
  24116. column.dataIndex = item.dataIndex;
  24117. column.header = worksheet[vk].v;
  24118. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24119. if (typeof item.validate === "function") {
  24120. column.validate = item.validate;
  24121. needLoop = true;
  24122. }
  24123. if (typeof item.importFormatter === "function") {
  24124. column.importFormatter = item.importFormatter;
  24125. needLoop = true;
  24126. }
  24127. if ((item.data instanceof Array && item.data.length > 0)
  24128. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24129. column.data = item.data;
  24130. needLoop = true;
  24131. }
  24132. }
  24133. columns.push(column);
  24134. }
  24135. }
  24136. }
  24137. }
  24138. if (fieldValidate && typeof fieldValidate === "function") {
  24139. if (fieldValidate(columns, titleRowValue) !== true) {
  24140. reject("fields validate error");
  24141. return;
  24142. }
  24143. }
  24144. var allData = XLSX.utils.sheet_to_json(worksheet);
  24145. var okData = [], errorData = [], errorMsgData = [];
  24146. var needItemLoop = needLoop;
  24147. if (rowValidate && typeof rowValidate === "function") {
  24148. needLoop = true;
  24149. }
  24150. if (needLoop === true) {
  24151. for (var index = 0; index < allData.length; index++) {
  24152. var row = allData[index];
  24153. var rowNumber = dataStartRow + index;
  24154. row.__importID__ = rowNumber;
  24155. var isRowOk = true;
  24156. if (needItemLoop) {
  24157. var _loop_1 = function (num) {
  24158. var column = columns[num];
  24159. var ov = row[column.dataIndex];
  24160. var nv = ov;
  24161. var hasError = false;
  24162. var rowNumber_1 = dataStartRow + index;
  24163. var ei = {
  24164. errorId: rowNumber_1 + '_' + column.dataIndex,
  24165. importID: rowNumber_1,
  24166. dataIndex: column.dataIndex,
  24167. header: column.header,
  24168. value: ov,
  24169. errormessage: ""
  24170. };
  24171. // 格式化
  24172. if (column.data instanceof Array) {
  24173. nv = undefined;
  24174. ei.errormessage = "字典匹配失败";
  24175. _$2.forEach(column.data, function (v, index) {
  24176. if (v.text === ov) {
  24177. nv = v.id;
  24178. return;
  24179. }
  24180. });
  24181. }
  24182. else if (_$2.isPlainObject(column.data)) {
  24183. nv = undefined;
  24184. ei.errormessage = "字典匹配失败";
  24185. _$2.forEach(column.data, function (value, key) {
  24186. if (value === ov) {
  24187. nv = key;
  24188. return;
  24189. }
  24190. });
  24191. }
  24192. if (typeof column.importFormatter === 'function') {
  24193. var vdata = {
  24194. column: column,
  24195. ov: ov,
  24196. nv: nv,
  24197. rowIndex: index,
  24198. data: row,
  24199. rowDatas: allData
  24200. };
  24201. nv = undefined;
  24202. ei.errormessage = "格式化失败";
  24203. nv = column.importFormatter(vdata);
  24204. }
  24205. if (!nv && nv != 0) {
  24206. hasError = true;
  24207. }
  24208. else {
  24209. row[column.dataIndex] = nv;
  24210. ei.errormessage = "";
  24211. }
  24212. // 校验
  24213. if (typeof column.validate === 'function') {
  24214. var vdata = {
  24215. column: column,
  24216. ov: ov,
  24217. nv: nv,
  24218. rowIndex: index,
  24219. data: row,
  24220. rowDatas: allData
  24221. };
  24222. var errormessage = column.validate(vdata);
  24223. if (errormessage === true) ;
  24224. else {
  24225. hasError = true;
  24226. ei.errormessage = ei.errormessage + "/" + errormessage;
  24227. }
  24228. }
  24229. if (hasError === true) {
  24230. isRowOk = false;
  24231. errorMsgData.push(ei);
  24232. }
  24233. };
  24234. for (var num = 0; num < columns.length; num++) {
  24235. _loop_1(num);
  24236. }
  24237. }
  24238. if (rowValidate && typeof rowValidate === "function") {
  24239. var errormessage = rowValidate({
  24240. columns: columns,
  24241. data: row,
  24242. rowIndex: index,
  24243. rowDatas: allData
  24244. });
  24245. if (errormessage === true) ;
  24246. else {
  24247. isRowOk = false;
  24248. var ei = {
  24249. errorId: rowNumber + '',
  24250. dataIndex: "row",
  24251. header: "数据行",
  24252. value: "当前行的数据",
  24253. importID: rowNumber,
  24254. errormessage: errormessage
  24255. };
  24256. errorMsgData.push(ei);
  24257. }
  24258. }
  24259. row.__hasError__ = !isRowOk;
  24260. if (isRowOk === true) {
  24261. okData.push(row);
  24262. }
  24263. else {
  24264. errorData.push(row);
  24265. }
  24266. }
  24267. }
  24268. else {
  24269. // 添加数据的唯一标识
  24270. for (var index = 0; index < allData.length; index++) {
  24271. var row = allData[index];
  24272. var rowNumber = dataStartRow + index;
  24273. row.__importID__ = rowNumber;
  24274. row.__hasError__ = false;
  24275. }
  24276. okData = allData;
  24277. }
  24278. if (otherValidate && typeof otherValidate === "function") {
  24279. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24280. }
  24281. else {
  24282. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24283. }
  24284. // clearLoading()
  24285. }).catch(function (e) {
  24286. reject(e);
  24287. });
  24288. };
  24289. if (promiseArr.length > 0) {
  24290. Promise.all(promiseArr).then(function (resArr) {
  24291. for (var i = 0; i < resArr.length; i++) {
  24292. var tmp = resArr[i];
  24293. tmp.config.data = [];
  24294. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24295. if (tmp.r.field.length > 1) {
  24296. var keyKey = tmp.r.field[0];
  24297. var valueKey = tmp.r.field[1];
  24298. for (var j = 0; j < tmp.r.data.length; j++) {
  24299. var it = tmp.r.data[j];
  24300. var newIt = {};
  24301. newIt.id = it[keyKey];
  24302. newIt.text = it[valueKey];
  24303. tmp.config.data.push(newIt);
  24304. }
  24305. }
  24306. }
  24307. }
  24308. read();
  24309. });
  24310. }
  24311. else {
  24312. setTimeout(read, 50);
  24313. }
  24314. });
  24315. }
  24316. //# sourceMappingURL=xlsx.js.map
  24317. var ExcelImportDialog = /** @class */ (function (_super) {
  24318. __extends(ExcelImportDialog, _super);
  24319. function ExcelImportDialog(option) {
  24320. var _this = this;
  24321. var vjson = vjsonFunc(option);
  24322. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24323. _this.importExcelOption = option;
  24324. return _this;
  24325. }
  24326. ExcelImportDialog.prototype.onLoad = function () {
  24327. _super.prototype.onLoad.call(this);
  24328. };
  24329. ExcelImportDialog.prototype.fileChange = function (sender) {
  24330. var _this = this;
  24331. var file = sender.fileInputEl.dom.files[0];
  24332. // const senderScope = lookupScope(sender)
  24333. var topScope = this.topScope;
  24334. var rowValidate = this.importExcelOption.rowValidate;
  24335. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24336. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24337. }
  24338. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24339. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24340. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24341. }
  24342. var fieldValidate = this.importExcelOption.fieldValidate;
  24343. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24344. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24345. }
  24346. this.setLoading(true);
  24347. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24348. _this.importData = res;
  24349. _this.refs.dataGrid.setData(res.allData);
  24350. _this.viewModel.set("dataCount", res.allData.length);
  24351. _this.refs.errGrid.setData(res.errorMsgData);
  24352. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24353. }).catch(function (e) {
  24354. _this.importData = null;
  24355. _this.refs.dataGrid.setData();
  24356. _this.refs.errGrid.setData();
  24357. msg(e.toString());
  24358. }).finally(function () {
  24359. _this.setLoading(false);
  24360. });
  24361. };
  24362. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24363. if (record.get('__hasError__')) {
  24364. return "x-grid-record-bg-red";
  24365. }
  24366. };
  24367. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24368. return "x-grid-record-bg-red";
  24369. };
  24370. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24371. var _a;
  24372. var id = record.data.__importID__;
  24373. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24374. var selectRecord = null;
  24375. var dataIndex = -1;
  24376. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24377. for (var i = 0; i < rows.length; i++) {
  24378. if (rows[i].importID === id) {
  24379. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24380. dataIndex = i;
  24381. }
  24382. if (rows[i].errorId === id + "_" + subId) {
  24383. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24384. dataIndex = i;
  24385. break;
  24386. }
  24387. }
  24388. if (selectRecord) {
  24389. this.refs.errGrid.ensureVisible(selectRecord);
  24390. this.refs.errGrid.selModel.select(dataIndex);
  24391. // this.refs.errGrid.reload()
  24392. }
  24393. };
  24394. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24395. var _a;
  24396. var id = record.data.importID;
  24397. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24398. var selectRecord = null;
  24399. var dataIndex = -1;
  24400. for (var i = 0; i < rows.length; i++) {
  24401. if (rows[i].__importID__ === id) {
  24402. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24403. dataIndex = i;
  24404. break;
  24405. }
  24406. }
  24407. if (selectRecord) {
  24408. this.refs.dataGrid.ensureVisible(selectRecord);
  24409. this.refs.dataGrid.selModel.select(dataIndex);
  24410. // this.refs.dataGrid.reload()
  24411. }
  24412. };
  24413. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24414. this.viewModel.set("dataType", newValue);
  24415. if (this.importData) {
  24416. this.refs.dataGrid.setData(this.importData[newValue]);
  24417. this.viewModel.set("dataCount", this.importData[newValue].length);
  24418. }
  24419. };
  24420. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24421. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24422. window.location.href = this.importExcelOption.dowLoadUrl;
  24423. return;
  24424. }
  24425. var xt = [];
  24426. _$2.forEach(this.importExcelOption.columns, function (v) {
  24427. xt.push(v.header);
  24428. });
  24429. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24430. if (filename.endsWith(".xlsx")) {
  24431. filename = filename.split(".xlsx")[0];
  24432. }
  24433. filename = filename + ".xlsx";
  24434. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24435. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24436. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24437. XLSX.writeFile(wb, filename); //导出Excel
  24438. };
  24439. ExcelImportDialog.prototype.getData = function (sender) {
  24440. _$2.each(this.importData.okData, function (item) {
  24441. delete item.id;
  24442. delete item.__hasError__;
  24443. delete item.__importID__;
  24444. delete item._origin;
  24445. });
  24446. _$2.each(this.importData.allData, function (item) {
  24447. delete item.id;
  24448. delete item.__hasError__;
  24449. delete item.__importID__;
  24450. delete item._origin;
  24451. });
  24452. _$2.each(this.importData.errorData, function (item) {
  24453. delete item.id;
  24454. delete item.__hasError__;
  24455. delete item.__importID__;
  24456. delete item._origin;
  24457. });
  24458. this.dialogSuccess(this.importData);
  24459. };
  24460. return ExcelImportDialog;
  24461. }(Scope));
  24462. var model$d = {
  24463. data: {
  24464. dataType: "all",
  24465. errMsgCount: 0,
  24466. dataCount: 0
  24467. }
  24468. };
  24469. var vjsonFunc = function (option) {
  24470. return {
  24471. title: option.title || 'excel导入',
  24472. layout: 'fit',
  24473. items: [
  24474. {
  24475. layout: 'border',
  24476. tbar: {
  24477. xtype: "form",
  24478. items: [
  24479. {
  24480. xtype: "cols",
  24481. items: [
  24482. {
  24483. xtype: "filefield",
  24484. fieldLabel: 'excel文件',
  24485. buttonText: '请选择excel文件',
  24486. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24487. flex: 3,
  24488. listeners: {
  24489. change: "scope.fileChange"
  24490. }
  24491. }, {
  24492. xtype: "button",
  24493. iconCls: "x-fa fa-download",
  24494. text: "下载模版",
  24495. listeners: {
  24496. click: "scope.downloadTemplate"
  24497. }
  24498. }, {
  24499. xtype: 'container',
  24500. border: false,
  24501. layout: 'hbox',
  24502. }, {
  24503. xtype: "button",
  24504. iconCls: "x-fa fa-upload",
  24505. text: option.tQButtonText || "提取数据",
  24506. listeners: {
  24507. click: "scope.getData"
  24508. }
  24509. }
  24510. ]
  24511. },
  24512. ]
  24513. },
  24514. items: [
  24515. {
  24516. tbar: {
  24517. xtype: "toolbar",
  24518. title: "导入的数据",
  24519. items: [{
  24520. xtype: 'label',
  24521. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24522. }, {
  24523. xtype: 'radiogroup',
  24524. items: [
  24525. {
  24526. boxLabel: '所有数据',
  24527. checked: true,
  24528. inputValue: 'allData',
  24529. }, {
  24530. boxLabel: '正确数据',
  24531. inputValue: 'okData',
  24532. }, {
  24533. boxLabel: '错误数据',
  24534. inputValue: 'errorData',
  24535. }
  24536. ],
  24537. listeners: {
  24538. change: 'scope.filterData',
  24539. },
  24540. }, {
  24541. xtype: "textfield",
  24542. readOnly: true,
  24543. fieldLabel: "条目数",
  24544. bind: "{dataCount}"
  24545. }]
  24546. },
  24547. xtype: 'yvgrid',
  24548. reference: 'dataGrid',
  24549. layout: 'fit',
  24550. pagination: false,
  24551. // pageSize: 50,
  24552. getRowClass: 'scope.getDataGridRowRecord',
  24553. columns: option.columns,
  24554. region: 'center',
  24555. split: true,
  24556. listeners: {
  24557. cellclick: "scope.dataGridClick",
  24558. },
  24559. selModel: {
  24560. // type: 'rowmodel',
  24561. mode: 'SINGLE',
  24562. },
  24563. }, {
  24564. tbar: {
  24565. xtype: "toolbar", items: [
  24566. {
  24567. xtype: 'label',
  24568. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24569. }, {
  24570. xtype: "textfield",
  24571. readOnly: true,
  24572. fieldLabel: "条目数",
  24573. bind: "{errMsgCount}"
  24574. }
  24575. ]
  24576. },
  24577. xtype: 'yvgrid',
  24578. reference: 'errGrid',
  24579. layout: 'fit',
  24580. pagination: false,
  24581. getRowClass: 'scope.getErrGridRowRecord',
  24582. height: "40%",
  24583. columns: [
  24584. { dataIndex: "errorId", header: "ID", hidden: true },
  24585. { dataIndex: "importID", header: "行号", width: 80 },
  24586. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24587. { dataIndex: "value", header: "值", width: 120 },
  24588. { dataIndex: "header", header: "字段名", width: 120 },
  24589. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24590. ],
  24591. region: 'south',
  24592. split: true,
  24593. listeners: {
  24594. itemclick: "scope.errGridClick"
  24595. },
  24596. selModel: {
  24597. // type: 'rowmodel',
  24598. mode: 'SINGLE',
  24599. },
  24600. },
  24601. ],
  24602. },
  24603. ],
  24604. referenceHolder: true,
  24605. };
  24606. };
  24607. //# sourceMappingURL=ExcelImportDialog.js.map
  24608. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24609. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24610. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24611. ret.report_id = reportId;
  24612. ret.report = report;
  24613. return ret;
  24614. }
  24615. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24616. var e_1, _a, e_2, _b;
  24617. var model = {
  24618. data: {
  24619. report_name: config.report_name,
  24620. query: {},
  24621. sum: {},
  24622. }
  24623. };
  24624. var json5 = window['YvanUI'].json5;
  24625. var report = config.report ? json5.parse(config.report) : {};
  24626. var conditionRows = [];
  24627. var sumRows = [];
  24628. model.data.has_sum = _$2.size(report.summary) > 0;
  24629. // query 查询条件
  24630. var newRow = false;
  24631. var currentRow = { xtype: 'cols', items: [], };
  24632. conditionRows.push(currentRow);
  24633. _$2.forEach(report.query, function (item) {
  24634. if (newRow) {
  24635. currentRow = { xtype: 'cols', items: [], };
  24636. conditionRows.push(currentRow);
  24637. }
  24638. var vj = json5.parse(item.conditionFieldExtend);
  24639. if (item.conditionFieldXtype) {
  24640. vj.xtype = item.conditionFieldXtype;
  24641. if (item.conditionFieldXtype === 'combo') {
  24642. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24643. }
  24644. if (item.conditionFieldXtype === 'datetimefield') {
  24645. //@ts-ignore
  24646. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24647. }
  24648. else if (item.conditionFieldXtype === 'datefield') {
  24649. //@ts-ignore
  24650. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24651. }
  24652. else {
  24653. model.data.query[item.conditionFieldBind] = '';
  24654. }
  24655. }
  24656. else {
  24657. // 没有组件类型,是个空占位符
  24658. vj.border = false;
  24659. }
  24660. if (item.conditionFieldBind) {
  24661. vj.bind = {
  24662. value: '{query.' + item.conditionFieldBind + '}'
  24663. };
  24664. }
  24665. if (item.conditionFieldFlex) {
  24666. vj.flex = item.conditionFieldFlex;
  24667. }
  24668. if (item.conditionFieldXtype) {
  24669. vj.fieldLabel = item.conditionFieldLabel;
  24670. }
  24671. if (item.fieldLabel) {
  24672. vj.fieldLabel = item.fieldLabel;
  24673. }
  24674. newRow = item.conditionFieldWrap || false;
  24675. currentRow.items.push(vj);
  24676. });
  24677. if (currentRow) {
  24678. currentRow.margin = '10 0 10 0';
  24679. }
  24680. // sum 汇总条件
  24681. newRow = true;
  24682. try {
  24683. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24684. var item = _d.value;
  24685. if (newRow) {
  24686. currentRow = {
  24687. xtype: 'cols',
  24688. defaultType: 'displayfield',
  24689. defaults: {
  24690. labelWidth: 70,
  24691. },
  24692. items: []
  24693. };
  24694. sumRows.push(currentRow);
  24695. }
  24696. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24697. if (item.sumFieldBind) {
  24698. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24699. model.data.sum[item.sumFieldBind] = '';
  24700. }
  24701. else {
  24702. // 没有组件类型,是个空占位符
  24703. vj.border = false;
  24704. }
  24705. if (item.sumFieldFlex) {
  24706. vj.flex = item.sumFieldFlex;
  24707. }
  24708. if (item.sumFieldLabel) {
  24709. vj.fieldLabel = item.sumFieldLabel;
  24710. }
  24711. // sumFieldBind: "zs"
  24712. // sumFieldExtend: "{}"
  24713. // sumFieldFlex: 1
  24714. // sumFieldLabel: "总数"
  24715. // sumFieldWrap: false
  24716. newRow = item.sumFieldWrap || false;
  24717. currentRow.items.push(vj);
  24718. }
  24719. }
  24720. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24721. finally {
  24722. try {
  24723. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24724. }
  24725. finally { if (e_1) throw e_1.error; }
  24726. }
  24727. if (currentRow) {
  24728. currentRow.margin = '10 0 10 0';
  24729. }
  24730. // column 结果字段
  24731. var columns = [];
  24732. try {
  24733. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24734. var item = _f.value;
  24735. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24736. if (item.xtype) {
  24737. if (item.xtype == 'checkbox') {
  24738. vj.xtype = 'checkcolumn';
  24739. vj.disabled = true;
  24740. }
  24741. else {
  24742. vj.xtype = item.xtype;
  24743. }
  24744. }
  24745. if (item.dataType) {
  24746. vj.dataType = item.dataType;
  24747. }
  24748. if (item.align) {
  24749. vj.align = item.align;
  24750. }
  24751. if (item.width) {
  24752. vj.width = item.width;
  24753. }
  24754. if (item.dict) {
  24755. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24756. }
  24757. columns.push(vj);
  24758. }
  24759. }
  24760. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24761. finally {
  24762. try {
  24763. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24764. }
  24765. finally { if (e_2) throw e_2.error; }
  24766. }
  24767. var vjson = {
  24768. bind: {
  24769. title: '{report_name}',
  24770. },
  24771. layout: 'fit',
  24772. referenceHolder: true,
  24773. items: [
  24774. {
  24775. layout: 'border',
  24776. border: false,
  24777. items: [
  24778. {
  24779. region: 'north',
  24780. border: false,
  24781. tbar: {
  24782. xtype: 'toolbar',
  24783. border: false,
  24784. items: [
  24785. {
  24786. xtype: 'button',
  24787. text: '查询',
  24788. reference: 'btnSearch',
  24789. iconCls: 'x-fa fa-search',
  24790. listeners: {
  24791. click: 'scope.reload',
  24792. },
  24793. },
  24794. {
  24795. xtype: 'button',
  24796. text: '关闭',
  24797. iconCls: 'x-fa fa-times',
  24798. listeners: {
  24799. click: 'system.closeMe()',
  24800. },
  24801. },
  24802. ],
  24803. },
  24804. defaults: {
  24805. margin: '8 0 0 0'
  24806. },
  24807. items: __spread(conditionRows, sumRows),
  24808. fix: ['system.enterToClick("btnSearch")'],
  24809. },
  24810. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24811. method: 'invoke',
  24812. url: '/report/Report@execute',
  24813. params: {
  24814. dataSource: report.dataSource,
  24815. pagination: report.grid.pagination || true,
  24816. report_id: config.report_id,
  24817. query: '{query}',
  24818. },
  24819. }, columns: columns }, report.grid),
  24820. ],
  24821. },
  24822. ],
  24823. };
  24824. return { model: model, vjson: vjson, report: report };
  24825. }
  24826. var ReportScope = /** @class */ (function (_super) {
  24827. __extends(ReportScope, _super);
  24828. function ReportScope(_a, invokeServerFn) {
  24829. var model = _a.model, vjson = _a.vjson;
  24830. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24831. _this.invokeServerFn = invokeServerFn;
  24832. return _this;
  24833. }
  24834. ReportScope.prototype.onLoad = function () {
  24835. // this.reload()
  24836. };
  24837. ReportScope.prototype.reload = function () {
  24838. var _this = this;
  24839. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24840. if (this.viewModel.get('has_sum')) {
  24841. this.invokeServerFn('/report/Report@executeSum', {
  24842. dataSource: this.report.dataSource,
  24843. report_id: this.report_id,
  24844. query: this.viewModel.get('query'),
  24845. }).then(function (res) {
  24846. if (!res.success) {
  24847. showErrorDialog$1(res.msg);
  24848. }
  24849. else {
  24850. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24851. }
  24852. });
  24853. }
  24854. this.refs.grid1.reload();
  24855. };
  24856. return ReportScope;
  24857. }(Scope));
  24858. //# sourceMappingURL=Report.js.map
  24859. var model$e = {
  24860. data: {
  24861. form: {
  24862. resource_parent: '',
  24863. resource_name: '',
  24864. resource_icon: '',
  24865. scope_url: '',
  24866. scope_params: '',
  24867. resource_order: '',
  24868. permission_code: '',
  24869. },
  24870. }
  24871. };
  24872. //# sourceMappingURL=RegisterModule.model.js.map
  24873. var vjson$d = {
  24874. title: '注册模块',
  24875. layout: 'fit',
  24876. width: "40%",
  24877. height: "50%",
  24878. fbar: {
  24879. xtype: 'toolbar',
  24880. items: [
  24881. {
  24882. xtype: "button",
  24883. text: "确定",
  24884. iconCls: 'x-fa fa-check',
  24885. listeners: {
  24886. click: 'scope.saveNode',
  24887. }
  24888. },
  24889. {
  24890. xtype: "button",
  24891. text: "关闭",
  24892. iconCls: 'x-fa fa-times',
  24893. listeners: {
  24894. click: 'system.closeMe()',
  24895. }
  24896. },
  24897. ]
  24898. },
  24899. items: [
  24900. {
  24901. layout: 'border',
  24902. items: [
  24903. {
  24904. region: 'west',
  24905. layout: 'fit',
  24906. xtype: 'tabpanel',
  24907. reference: 'tabs',
  24908. width: "50%",
  24909. split: true,
  24910. listeners: {
  24911. tabchange: 'scope.tabchange',
  24912. },
  24913. items: [
  24914. {
  24915. region: 'center',
  24916. layout: 'fit',
  24917. title: 'PC菜单',
  24918. key: "1",
  24919. items: [
  24920. {
  24921. xtype: 'treepanel',
  24922. layout: 'fit',
  24923. region: 'west',
  24924. rootVisible: false,
  24925. useArrows: true,
  24926. reference: 'tree1',
  24927. listeners: {
  24928. itemclick: "scope.tree1NodeClick",
  24929. }
  24930. },
  24931. ]
  24932. },
  24933. {
  24934. region: 'center',
  24935. layout: 'fit',
  24936. title: 'PDA菜单',
  24937. key: "2",
  24938. items: [
  24939. {
  24940. xtype: 'treepanel',
  24941. layout: 'fit',
  24942. region: 'west',
  24943. reference: 'tree2',
  24944. rootVisible: false,
  24945. useArrows: true,
  24946. listeners: {
  24947. itemclick: "scope.tree1NodeClick",
  24948. }
  24949. },
  24950. ]
  24951. },
  24952. ]
  24953. },
  24954. {
  24955. region: 'center',
  24956. xtype: 'form',
  24957. margin: '0 0 0 0',
  24958. split: true,
  24959. width: '50%',
  24960. items: [
  24961. {
  24962. xtype: 'cols',
  24963. items: [
  24964. {
  24965. xtype: 'textfield',
  24966. fieldLabel: '上级资源ID',
  24967. bind: {
  24968. readOnly: true,
  24969. disabled: true,
  24970. value: '{form.resource_parent}'
  24971. },
  24972. },
  24973. ],
  24974. },
  24975. {
  24976. xtype: 'cols',
  24977. items: [
  24978. {
  24979. xtype: 'textfield',
  24980. fieldLabel: '资源名称',
  24981. bind: {
  24982. value: '{form.resource_name}'
  24983. },
  24984. allowBlank: false,
  24985. },
  24986. ],
  24987. },
  24988. {
  24989. xtype: 'cols',
  24990. items: [
  24991. {
  24992. xtype: 'numberfield',
  24993. fieldLabel: '资源排序',
  24994. bind: {
  24995. value: '{form.resource_order}'
  24996. },
  24997. allowBlank: false,
  24998. },
  24999. ],
  25000. },
  25001. {
  25002. xtype: 'cols',
  25003. items: [
  25004. {
  25005. xtype: 'textfield',
  25006. fieldLabel: '功能URL',
  25007. bind: {
  25008. disabled: true,
  25009. value: '{form.scope_url}'
  25010. },
  25011. },
  25012. ]
  25013. },
  25014. {
  25015. xtype: 'cols',
  25016. items: [
  25017. {
  25018. xtype: 'textfield',
  25019. fieldLabel: '权限编码',
  25020. bind: {
  25021. value: '{form.permission_code}'
  25022. }
  25023. },
  25024. ],
  25025. },
  25026. {
  25027. xtype: 'cols',
  25028. items: [
  25029. {
  25030. xtype: 'textfield',
  25031. fieldLabel: '功能参数',
  25032. bind: {
  25033. value: '{form.scope_params}'
  25034. }
  25035. },
  25036. ],
  25037. },
  25038. ],
  25039. },
  25040. ],
  25041. },
  25042. ],
  25043. referenceHolder: true,
  25044. };
  25045. //# sourceMappingURL=RegisterModule.view.js.map
  25046. var RegisterModule = /** @class */ (function (_super) {
  25047. __extends(RegisterModule, _super);
  25048. function RegisterModule() {
  25049. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25050. }
  25051. RegisterModule.prototype.onLoad = function () {
  25052. this.reloadTree("PC");
  25053. };
  25054. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25055. var currTabKey = b.key;
  25056. if (currTabKey === '1') {
  25057. this.viewModel.set('form', '');
  25058. this.reloadTree("PC");
  25059. }
  25060. else {
  25061. this.viewModel.set('form', '');
  25062. this.reloadTree("PDA");
  25063. }
  25064. };
  25065. RegisterModule.prototype.reloadTree = function (type) {
  25066. var _this = this;
  25067. if ("PC" === type) {
  25068. this.setLoading(true);
  25069. getMenuTree({ type: "PC" }).then(function (res) {
  25070. if (res.success) {
  25071. _this.refs.tree1.store.setRootNode({
  25072. expanded: true,
  25073. children: res.data
  25074. });
  25075. }
  25076. }).finally(function () {
  25077. _this.setLoading(false);
  25078. });
  25079. }
  25080. else {
  25081. this.setLoading(true);
  25082. getMenuTree({ type: "PDA" }).then(function (res) {
  25083. if (res.success) {
  25084. _this.refs.tree2.store.setRoot({
  25085. expanded: true,
  25086. children: res.data
  25087. });
  25088. }
  25089. }).finally(function () {
  25090. _this.setLoading(false);
  25091. });
  25092. }
  25093. };
  25094. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25095. var id = _$2.split(node.data.id, '_')[1];
  25096. if (!id) {
  25097. return;
  25098. }
  25099. this.viewModel.set('form.resource_parent', id);
  25100. };
  25101. RegisterModule.prototype.saveNode = function () {
  25102. var _this = this;
  25103. var tabKey = this.refs.tabs.activeTab.key;
  25104. // 检验菜单数据
  25105. var param = this.viewModel.get('form');
  25106. if (!param.resource_parent) {
  25107. msg('请选择一个父节点');
  25108. return;
  25109. }
  25110. if (!param.resource_name) {
  25111. msg('资源名称不能为空');
  25112. return;
  25113. }
  25114. if (!param.scope_url) {
  25115. msg('功能URL不能为空');
  25116. return;
  25117. }
  25118. var type;
  25119. if (tabKey === '1') {
  25120. type = 'PC';
  25121. }
  25122. else {
  25123. type = 'PDA';
  25124. }
  25125. this.setLoading(true);
  25126. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25127. if (res.success) {
  25128. msg("注册成功");
  25129. _this.close();
  25130. }
  25131. }).finally(function () {
  25132. _this.setLoading(false);
  25133. });
  25134. };
  25135. return RegisterModule;
  25136. }(Scope));
  25137. //# sourceMappingURL=RegisterModule.js.map
  25138. var model$f = {
  25139. data: {
  25140. title: "模板选择",
  25141. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25142. moduleType: 1,
  25143. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25144. packagePath: "",
  25145. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25146. fileSavePath: "",
  25147. // 模块名称 "Dict"
  25148. moduleName: "NewModule",
  25149. // 页面标题 "字典维护"
  25150. pageTitle: "新模块",
  25151. // 单表查询
  25152. singleTable: {
  25153. sql: "select * from bas_dict",
  25154. // 新增或者删除所用的表
  25155. tableName: "",
  25156. // 是否分页查询
  25157. pagination: true,
  25158. // 是否需要删除
  25159. delete: true,
  25160. // 删除条件字段
  25161. deleteWhereColumn: "",
  25162. // 删除提示语
  25163. deleteTips: "确定要删除?",
  25164. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25165. editType: 2,
  25166. },
  25167. singleTableView: {
  25168. tableNameList: [
  25169. // { value: "aaa"},
  25170. ],
  25171. columnList: [
  25172. // { value: "aaa"},
  25173. ],
  25174. }
  25175. }
  25176. };
  25177. //# sourceMappingURL=CreateModule.model.js.map
  25178. var vjson$e = {
  25179. bind: {
  25180. title: '新建模块-{title}',
  25181. },
  25182. width: "55%",
  25183. height: "60%",
  25184. minWidth: 500,
  25185. minHeight: 400,
  25186. modal: true,
  25187. frame: true,
  25188. layout: 'card',
  25189. bbar: [
  25190. '->',
  25191. {
  25192. itemId: 'card-prev',
  25193. text: '&laquo; 上一步',
  25194. disabled: true,
  25195. listeners: {
  25196. click: 'scope.showPrevious',
  25197. },
  25198. },
  25199. {
  25200. itemId: 'card-next',
  25201. text: '下一步 &raquo;',
  25202. listeners: {
  25203. click: 'scope.showNext',
  25204. },
  25205. },
  25206. {
  25207. itemId: 'card-finish',
  25208. text: '立刻执行',
  25209. iconCls: 'x-fa fa-flash',
  25210. hidden: true,
  25211. listeners: {
  25212. click: 'scope.finish',
  25213. },
  25214. },
  25215. ],
  25216. items: [
  25217. {
  25218. vtitle: '模板选择',
  25219. reference: 'templateSelection',
  25220. layout: {
  25221. type: 'hbox',
  25222. pack: 'start',
  25223. align: 'stretch'
  25224. },
  25225. listeners: {
  25226. cardEnter: 'scope.templateEnter',
  25227. cardLevel: 'scope.templateLevel'
  25228. },
  25229. items: [
  25230. {
  25231. width: 150,
  25232. xtype: 'form',
  25233. border: false,
  25234. layout: {
  25235. type: 'vbox',
  25236. align: 'stretch'
  25237. },
  25238. defaults: {
  25239. border: false,
  25240. anchor: '100%',
  25241. margin: '5',
  25242. },
  25243. items: [
  25244. {
  25245. xtype: 'radiogroup',
  25246. bind: {
  25247. value: '{moduleType}'
  25248. },
  25249. layout: 'vbox',
  25250. defaults: {
  25251. border: false,
  25252. anchor: '100%',
  25253. margin: '5',
  25254. },
  25255. items: [
  25256. { boxLabel: '单表查询', inputValue: 1 },
  25257. { boxLabel: '主/明细查询', inputValue: 2 },
  25258. { boxLabel: '树/明细查询', inputValue: 3 },
  25259. { boxLabel: '卡片表单', inputValue: 4 },
  25260. { boxLabel: '主/详情查询', inputValue: 5 },
  25261. ]
  25262. },
  25263. ]
  25264. },
  25265. {
  25266. flex: 1,
  25267. region: 'center',
  25268. xtype: "panel",
  25269. border: false,
  25270. frame: true,
  25271. padding: "4px 8px",
  25272. html: "描述...",
  25273. }
  25274. ]
  25275. },
  25276. {
  25277. vtitle: '模块名称',
  25278. reference: 'moduleName',
  25279. layout: 'fit',
  25280. listeners: {
  25281. cardEnter: 'scope.moduleEnter',
  25282. cardLevel: 'scope.moduleLevel'
  25283. },
  25284. items: [
  25285. {
  25286. xtype: 'form',
  25287. border: false,
  25288. layout: {
  25289. type: 'vbox',
  25290. align: 'stretch'
  25291. },
  25292. defaults: {
  25293. border: false,
  25294. anchor: '100%',
  25295. margin: '5',
  25296. },
  25297. items: [
  25298. {
  25299. xtype: 'textfield',
  25300. fieldLabel: '包路径',
  25301. allowBlank: false,
  25302. bind: { value: '{packagePath}' },
  25303. },
  25304. {
  25305. xtype: 'textfield',
  25306. fieldLabel: '文件路径',
  25307. allowBlank: false,
  25308. bind: { value: '{fileSavePath}' },
  25309. },
  25310. {
  25311. xtype: 'textfield',
  25312. fieldLabel: '模块名',
  25313. allowBlank: false,
  25314. bind: { value: '{moduleName}' },
  25315. },
  25316. {
  25317. xtype: 'textfield',
  25318. fieldLabel: '菜单名',
  25319. allowBlank: false,
  25320. bind: { value: '{pageTitle}' },
  25321. },
  25322. ]
  25323. },
  25324. ]
  25325. },
  25326. {
  25327. vtitle: '确认结果',
  25328. reference: 'confirmResult',
  25329. layout: 'fit',
  25330. listeners: {
  25331. cardEnter: 'scope.optionEnter',
  25332. cardLevel: 'scope.optionLevel',
  25333. },
  25334. items: [
  25335. {
  25336. xtype: 'jsoneditor',
  25337. reference: 'jsoneditor'
  25338. }
  25339. ]
  25340. },
  25341. // ---------------------------------------------------------------------------------- 单表查询
  25342. {
  25343. vtitle: '查询SQL',
  25344. reference: 'singleTable_1',
  25345. layout: 'fit',
  25346. listeners: {
  25347. cardEnter: 'scope.editorEnter',
  25348. cardLevel: 'scope.editorLevel'
  25349. },
  25350. items: [
  25351. {
  25352. xtype: 'sqleditor',
  25353. }
  25354. ],
  25355. },
  25356. {
  25357. vtitle: '字段选项',
  25358. reference: 'singleTable_2',
  25359. layout: 'fit',
  25360. listeners: {
  25361. cardEnter: 'scope.columnEnter',
  25362. cardLevel: 'scope.columnLevel',
  25363. },
  25364. items: [
  25365. {
  25366. xtype: 'yvgrid',
  25367. border: false,
  25368. selModel: {
  25369. type: 'spreadsheet',
  25370. columnSelect: true,
  25371. pruneRemoved: false,
  25372. extensible: 'y'
  25373. },
  25374. plugins: {
  25375. clipboard: true,
  25376. selectionreplicator: true
  25377. },
  25378. reference: 'grid1',
  25379. idField: 'column_name',
  25380. hideFootbar: true,
  25381. tbar: {
  25382. xtype: 'toolbar',
  25383. items: [
  25384. {
  25385. xtype: 'button',
  25386. text: '添加',
  25387. iconCls: 'x-fa fa-plus-circle',
  25388. listeners: {
  25389. click: 'scope.addField'
  25390. }
  25391. },
  25392. {
  25393. xtype: 'button',
  25394. text: '删除',
  25395. iconCls: 'x-fa fa-minus-circle',
  25396. listeners: {
  25397. click: 'scope.removeField'
  25398. }
  25399. },
  25400. {
  25401. xtype: 'button',
  25402. text: '分析SQL',
  25403. iconCls: 'x-fa fa-refresh',
  25404. listeners: {
  25405. click: 'scope.parseSQL'
  25406. }
  25407. },
  25408. ]
  25409. },
  25410. columns: [
  25411. {
  25412. text: '字段名', dataIndex: 'column_name',
  25413. sortable: false,
  25414. menuDisabled: true,
  25415. width: 150,
  25416. editor: {
  25417. allowBlank: true,
  25418. selectOnFocus: false,
  25419. }
  25420. },
  25421. {
  25422. text: '字段中文', dataIndex: 'column_comment',
  25423. width: 150,
  25424. sortable: false,
  25425. menuDisabled: true,
  25426. editor: {
  25427. allowBlank: true,
  25428. selectOnFocus: false,
  25429. }
  25430. },
  25431. {
  25432. dataIndex: "column_useto",
  25433. // fix: ['system.getDict("column_useto")'],
  25434. header: "用途",
  25435. editor: {
  25436. xtype: 'combo',
  25437. allowBlank: false,
  25438. },
  25439. },
  25440. {
  25441. text: '主键', dataIndex: 'is_primary_key',
  25442. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25443. width: 48, resizable: false,
  25444. },
  25445. {
  25446. text: '必填', dataIndex: 'not_null',
  25447. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25448. width: 48, resizable: false,
  25449. },
  25450. {
  25451. text: '长度', dataIndex: 'column_size',
  25452. sortable: false, menuDisabled: true,
  25453. xtype: 'numbercolumn', format: '0',
  25454. editor: { allowBlank: true, selectOnFocus: true }
  25455. },
  25456. {
  25457. text: '字典', dataIndex: 'column_dict',
  25458. sortable: false, menuDisabled: true,
  25459. width: 200,
  25460. editor: {
  25461. allowBlank: true,
  25462. }
  25463. },
  25464. {
  25465. text: 'UI组件', dataIndex: 'column_ui',
  25466. sortable: false, menuDisabled: true,
  25467. // fix: ['system.getDict("column_ui")'],
  25468. width: 150,
  25469. editor: {
  25470. xtype: 'combo',
  25471. allowBlank: true,
  25472. }
  25473. },
  25474. {
  25475. dataIndex: 'data_type',
  25476. hidden: true,
  25477. },
  25478. ]
  25479. }
  25480. ],
  25481. },
  25482. {
  25483. vtitle: '其他选项',
  25484. reference: 'singleTable_3',
  25485. isEnd: true,
  25486. listeners: {
  25487. cardEnter: 'scope.extendEnter',
  25488. cardLevel: 'scope.extendLevel',
  25489. },
  25490. layout: 'fit',
  25491. items: [
  25492. {
  25493. xtype: 'form',
  25494. border: false,
  25495. layout: {
  25496. type: 'vbox',
  25497. align: 'stretch'
  25498. },
  25499. defaults: {
  25500. border: false,
  25501. anchor: '100%',
  25502. margin: '5',
  25503. },
  25504. items: [
  25505. {
  25506. xtype: 'checkbox',
  25507. fieldLabel: '需要分页',
  25508. labelWidth: 100,
  25509. bind: {
  25510. value: '{singleTable.pagination}',
  25511. },
  25512. },
  25513. {
  25514. xtype: 'combobox',
  25515. fieldLabel: '操作数据库表',
  25516. labelWidth: 100,
  25517. publishes: 'singleTable.tableName',
  25518. displayField: 'value',
  25519. valueField: 'value',
  25520. bind: {
  25521. data: '{singleTableView.tableNameList}',
  25522. value: '{singleTable.tableName}',
  25523. },
  25524. },
  25525. {
  25526. xtype: 'checkboxfield',
  25527. fieldLabel: '需要删除',
  25528. labelWidth: 100,
  25529. bind: {
  25530. value: '{singleTable.delete}',
  25531. },
  25532. },
  25533. {
  25534. xtype: 'combobox',
  25535. fieldLabel: '删除条件字段',
  25536. labelWidth: 100,
  25537. publishes: 'singleTable.deleteWhereColumn',
  25538. displayField: 'value',
  25539. valueField: 'value',
  25540. bind: {
  25541. data: '{singleTableView.columnList}',
  25542. hidden: '{!singleTable.delete}',
  25543. value: '{singleTable.deleteWhereColumn}',
  25544. },
  25545. },
  25546. {
  25547. xtype: 'textfield',
  25548. fieldLabel: '删除提示语句',
  25549. labelWidth: 100,
  25550. bind: {
  25551. hidden: '{!singleTable.delete}',
  25552. value: '{singleTable.deleteTips}',
  25553. },
  25554. },
  25555. {
  25556. fieldLabel: '新增与编辑',
  25557. labelWidth: 100,
  25558. xtype: 'radiogroup',
  25559. bind: {
  25560. value: '{singleTable.editType}'
  25561. },
  25562. layout: 'vbox',
  25563. defaults: {
  25564. border: false,
  25565. anchor: '100%',
  25566. margin: '5',
  25567. },
  25568. items: [
  25569. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25570. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25571. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25572. ]
  25573. },
  25574. ]
  25575. }
  25576. ]
  25577. },
  25578. // ---------------------------------------------------------------------------------- 主/明细查询
  25579. {
  25580. vtitle: '主表查询SQL',
  25581. reference: 'mainDetailTable_1',
  25582. layout: 'fit',
  25583. listeners: {},
  25584. items: [],
  25585. },
  25586. {
  25587. vtitle: '主表字段选项',
  25588. reference: 'mainDetailTable_2',
  25589. layout: 'fit',
  25590. listeners: {},
  25591. items: [],
  25592. },
  25593. {
  25594. vtitle: '主表其他选项',
  25595. reference: 'mainDetailTable_3',
  25596. layout: 'fit',
  25597. listeners: {},
  25598. items: [],
  25599. },
  25600. {
  25601. vtitle: '子表查询SQL',
  25602. reference: 'mainDetailTable_4',
  25603. layout: 'fit',
  25604. listeners: {},
  25605. items: [],
  25606. },
  25607. {
  25608. vtitle: '子表字段选项',
  25609. reference: 'mainDetailTable_5',
  25610. layout: 'fit',
  25611. listeners: {},
  25612. items: [],
  25613. },
  25614. {
  25615. vtitle: '子表其他选项',
  25616. reference: 'mainDetailTable_6',
  25617. isEnd: true,
  25618. layout: 'fit',
  25619. listeners: {},
  25620. items: [],
  25621. },
  25622. // ---------------------------------------------------------------------------------- 树/明细查询
  25623. // ---------------------------------------------------------------------------------- 卡片表单
  25624. {
  25625. vtitle: '表单字段',
  25626. reference: 'cardForm_1',
  25627. layout: 'fit',
  25628. listeners: {},
  25629. items: [],
  25630. },
  25631. {
  25632. vtitle: '表单初始化',
  25633. reference: 'cardForm_2',
  25634. isEnd: true,
  25635. layout: 'fit',
  25636. listeners: {},
  25637. items: [],
  25638. },
  25639. ]
  25640. };
  25641. //# sourceMappingURL=CreateModule.view.js.map
  25642. // noinspection TypeScriptCheckImport
  25643. function getSingleTableData(origin) {
  25644. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25645. var _a, _b, _c;
  25646. var data = {
  25647. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25648. package: _$2.replace(origin.packagePath, /\//g, "."),
  25649. groovyClass: origin.moduleName,
  25650. qClass: queryDslInfo.qClass,
  25651. qClassTable: queryDslInfo.qClassTable,
  25652. queryColumns: [],
  25653. insertColumns: [],
  25654. updateColumns: [],
  25655. updateWheres: [],
  25656. deleteWheres: [],
  25657. gridColumns: [],
  25658. sql: origin.sql,
  25659. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25660. addButton: origin.editType !== 1,
  25661. saveButton: origin.editType === 2,
  25662. deleteButton: true,
  25663. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25664. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25665. fileSavePath: origin.fileSavePath,
  25666. };
  25667. origin.columnList.forEach(function (column) {
  25668. var column_name = column.column_name, column_comment = column.column_comment, is_primary_key = column.is_primary_key, column_dict = column.column_dict, column_ui = column.column_ui;
  25669. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25670. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25671. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25672. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25673. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25674. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25675. if (query) {
  25676. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25677. }
  25678. if (insert) {
  25679. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25680. }
  25681. if (update) {
  25682. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25683. }
  25684. if (grid) {
  25685. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25686. if (column_dict) {
  25687. gridColumn.fix = { dictName: column_dict };
  25688. }
  25689. if (origin.editType == 2 && (insert || update)) {
  25690. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25691. if (column_dict) {
  25692. gridColumn.editor.fix = { dictName: column_dict };
  25693. }
  25694. }
  25695. data.gridColumns.push(gridColumn);
  25696. }
  25697. if (is_primary_key) {
  25698. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25699. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25700. }
  25701. });
  25702. return data;
  25703. });
  25704. }
  25705. // noinspection HttpUrlsUsage
  25706. var urlPrefix = "/static/studio-template/single_table";
  25707. function generateCode(data) {
  25708. return Promise.all([
  25709. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25710. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25711. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25712. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25713. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25714. ]).then(function (values) {
  25715. var groovy = handlebars.compile(values[0]);
  25716. var mybatis = handlebars.compile(values[1]);
  25717. var controller = handlebars.compile(values[2]);
  25718. var view = handlebars.compile(values[3]);
  25719. var model = handlebars.compile(values[4]);
  25720. var code = {
  25721. groovy: groovy(data),
  25722. mybatis: mybatis(data),
  25723. controller: controller(data),
  25724. view: view(data),
  25725. model: model(data),
  25726. };
  25727. return code;
  25728. });
  25729. }
  25730. //# sourceMappingURL=SingleTableCodegen.js.map
  25731. var CreateModule = /** @class */ (function (_super) {
  25732. __extends(CreateModule, _super);
  25733. function CreateModule() {
  25734. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25735. _this.columns = [];
  25736. return _this;
  25737. }
  25738. CreateModule.prototype.onLoad = function () {
  25739. this.refs.grid1.setData([]);
  25740. };
  25741. CreateModule.prototype.addField = function () {
  25742. this.refs.grid1.appendEditRow({
  25743. column_name: '',
  25744. column_comment: '',
  25745. is_primary_key: false,
  25746. not_null: true,
  25747. column_domain: '',
  25748. data_type: '',
  25749. column_size: 0,
  25750. decimal_digits: 0,
  25751. default_value: '',
  25752. column_dict: '',
  25753. column_ui: '',
  25754. column_note: '',
  25755. }, 0);
  25756. };
  25757. CreateModule.prototype.removeField = function () {
  25758. var _this = this;
  25759. var rows = [];
  25760. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25761. rows.push(r);
  25762. });
  25763. _$2.forEach(rows, function (r) {
  25764. _this.refs.grid1.getStore().remove(r);
  25765. });
  25766. };
  25767. CreateModule.prototype.parseSQL = function (sender) {
  25768. var _this = this;
  25769. var sql = this.viewModel.get('singleTable.sql');
  25770. sender.up('window').setLoading(true);
  25771. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25772. parseSqlApi(sql).then(function (parseResult) {
  25773. if (!parseResult.success) {
  25774. msg(parseResult.msg);
  25775. return;
  25776. }
  25777. var tableNameList = [];
  25778. var columnList = [];
  25779. var singleTableTableName;
  25780. var singleTableDeleteWhereColumn;
  25781. _this.refs.grid1.setData([]);
  25782. var rows = _this.refs.grid1.getDataRows();
  25783. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25784. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25785. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25786. return;
  25787. }
  25788. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25789. tableNameList.push({ value: tableName });
  25790. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25791. columnList.push({ value: columnName });
  25792. if (!singleTableTableName)
  25793. singleTableTableName = tableName;
  25794. if (!singleTableDeleteWhereColumn)
  25795. singleTableDeleteWhereColumn = columnName;
  25796. // 已经加过这个列了
  25797. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25798. if (rowExists) {
  25799. return;
  25800. }
  25801. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25802. if (columnRow) {
  25803. _this.refs.grid1.appendEditRow({
  25804. table_name: tableName,
  25805. column_name: columnRow.column_name,
  25806. column_comment: columnRow.column_comment,
  25807. column_useto: 2,
  25808. is_primary_key: columnRow.is_primary_key,
  25809. not_null: columnRow.not_null,
  25810. column_size: columnRow.column_size,
  25811. column_dict: columnRow.column_dict,
  25812. column_ui: columnRow.column_ui,
  25813. data_type: columnRow.data_type,
  25814. });
  25815. if (columnRow.is_primary_key)
  25816. singleTableDeleteWhereColumn = columnName;
  25817. }
  25818. else {
  25819. _this.refs.grid1.appendEditRow({
  25820. table_name: tableName,
  25821. column_name: columnName,
  25822. column_useto: 2,
  25823. });
  25824. }
  25825. });
  25826. _this.viewModel.set("singleTableView.columnList", columnList);
  25827. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25828. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25829. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25830. }).finally(function () {
  25831. sender.up('window').setLoading(false);
  25832. });
  25833. }).catch(function () {
  25834. sender.up('window').setLoading(false);
  25835. });
  25836. };
  25837. CreateModule.prototype.templateEnter = function (sender) {
  25838. };
  25839. CreateModule.prototype.templateLevel = function (sender, opt) {
  25840. if (!this.viewModel.get('moduleType')) {
  25841. msg('请选择模板类型');
  25842. opt.cancel = true;
  25843. return;
  25844. }
  25845. };
  25846. CreateModule.prototype.moduleEnter = function (sender) {
  25847. };
  25848. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25849. if (!sender.down('form').isValid()) {
  25850. opt.cancel = true;
  25851. return;
  25852. }
  25853. };
  25854. CreateModule.prototype.editorEnter = function (sender) {
  25855. var editor = sender.down('sqleditor');
  25856. editor.setValue(this.viewModel.get('singleTable.sql'));
  25857. };
  25858. CreateModule.prototype.editorLevel = function (sender, opt) {
  25859. var editor = sender.down('sqleditor');
  25860. var sql = editor.getValue();
  25861. if (!sql) {
  25862. msg('查询SQL语句必填');
  25863. opt.cancel = true;
  25864. return;
  25865. }
  25866. this.viewModel.set('singleTable.sql', sql);
  25867. };
  25868. CreateModule.prototype.columnEnter = function (sender) {
  25869. };
  25870. CreateModule.prototype.columnLevel = function (sender, opt) {
  25871. };
  25872. CreateModule.prototype.extendEnter = function (sender) {
  25873. };
  25874. CreateModule.prototype.extendLevel = function (sender, opt) {
  25875. };
  25876. // 确认结果 - Enter
  25877. CreateModule.prototype.optionEnter = function (sender) {
  25878. var _this = this;
  25879. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25880. var moduleType = this.viewModel.get("moduleType");
  25881. var data = this.viewModel.getData();
  25882. var code = "";
  25883. var origin = {};
  25884. if (moduleType === 1) {
  25885. var singleTable = data.singleTable;
  25886. var editColumns = this.refs.grid1.getDataRows();
  25887. origin.moduleType = data.moduleType;
  25888. origin.packagePath = data.packagePath;
  25889. origin.fileSavePath = data.fileSavePath;
  25890. origin.moduleName = data.moduleName;
  25891. origin.pageTitle = data.pageTitle;
  25892. if (singleTable) {
  25893. origin.sql = singleTable.sql;
  25894. origin.tableName = singleTable.tableName;
  25895. origin.pagination = singleTable.pagination;
  25896. origin.delete = singleTable.delete;
  25897. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25898. origin.deleteTips = singleTable.deleteTips;
  25899. origin.editType = singleTable.editType;
  25900. }
  25901. origin.columnList = [];
  25902. origin.queryColumns = [];
  25903. origin.insertColumns = [];
  25904. origin.updateColumns = [];
  25905. origin.gridColumns = [];
  25906. editColumns.forEach(function (column) {
  25907. var row = {
  25908. table_name: column.table_name,
  25909. column_name: column.column_name,
  25910. column_comment: column.column_comment,
  25911. is_primary_key: column.is_primary_key,
  25912. not_null: column.not_null,
  25913. column_size: column.column_size,
  25914. column_dict: column.column_dict,
  25915. column_ui: column.column_ui,
  25916. data_type: column.data_type,
  25917. column_type: column.column_type,
  25918. };
  25919. origin.columnList.push(row);
  25920. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25921. var column_name = column.column_name, column_useto = column.column_useto;
  25922. switch (column_useto) {
  25923. case 1:
  25924. origin.queryColumns.push(column_name);
  25925. break;
  25926. case 2:
  25927. origin.gridColumns.push(column_name);
  25928. break;
  25929. case 3:
  25930. origin.queryColumns.push(column_name);
  25931. origin.gridColumns.push(column_name);
  25932. break;
  25933. }
  25934. origin.insertColumns.push(column_name);
  25935. origin.updateColumns.push(column_name);
  25936. });
  25937. }
  25938. this.setLoading(true);
  25939. getSingleTableData(origin).then(function (data) {
  25940. code = JSON.stringify(data, null, 4);
  25941. window['lastTemplateData'] = code;
  25942. var editor = _this.refs.jsoneditor;
  25943. editor.setCode(code);
  25944. }).finally(function () { return _this.setLoading(false); });
  25945. };
  25946. // 确认结果 - Level
  25947. CreateModule.prototype.optionLevel = function (sender, opt) {
  25948. };
  25949. // 上一步
  25950. CreateModule.prototype.showPrevious = function () {
  25951. this.doCardNavigation(false);
  25952. };
  25953. // 下一步
  25954. CreateModule.prototype.showNext = function () {
  25955. this.doCardNavigation(true, true);
  25956. };
  25957. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25958. if (isNext === void 0) { isNext = true; }
  25959. if (isCancelable === void 0) { isCancelable = false; }
  25960. var layout = this._handle.getLayout();
  25961. var activeItem = layout.activeItem;
  25962. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25963. if (isNext)
  25964. this.prevCard = reference;
  25965. var activeCard;
  25966. if (reference === "templateSelection") {
  25967. if (isNext) {
  25968. activeCard = this.refs['moduleName'];
  25969. }
  25970. }
  25971. else if (reference === "moduleName") {
  25972. if (isNext) {
  25973. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25974. var moduleType = this.viewModel.get("moduleType");
  25975. switch (moduleType) {
  25976. case 1:
  25977. activeCard = this.refs['singleTable_1'];
  25978. break;
  25979. case 2:
  25980. activeCard = this.refs['mainDetailTable_1'];
  25981. break;
  25982. case 3:
  25983. // activeCard =
  25984. break;
  25985. case 4:
  25986. activeCard = this.refs['cardForm_1'];
  25987. break;
  25988. }
  25989. }
  25990. else {
  25991. activeCard = this.refs['templateSelection'];
  25992. }
  25993. }
  25994. else if (reference === "confirmResult") {
  25995. if (!isNext) {
  25996. activeCard = this.refs[this.prevCard];
  25997. }
  25998. }
  25999. else {
  26000. var name = reference.split('_')[0];
  26001. var idx = parseInt(reference.split('_')[1], 10);
  26002. if (isNext) {
  26003. if (isEnd) {
  26004. activeCard = this.refs['confirmResult'];
  26005. }
  26006. else {
  26007. idx += 1;
  26008. }
  26009. }
  26010. else {
  26011. idx -= 1;
  26012. }
  26013. if (idx <= 0) {
  26014. activeCard = this.refs['moduleName'];
  26015. }
  26016. else if (!activeCard) {
  26017. activeCard = this.refs[name + "_" + idx];
  26018. }
  26019. }
  26020. // 按钮状态
  26021. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26022. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26023. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26024. // 设置下一页显示
  26025. if (activeCard) {
  26026. var optCancel = { cancel: false };
  26027. // 发出 cardLevel 事件
  26028. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26029. if (isCancelable && optCancel.cancel) {
  26030. // 取消了
  26031. return;
  26032. }
  26033. layout.setActiveItem(activeCard);
  26034. this.viewModel.set('title', layout.activeItem.vtitle);
  26035. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26036. }
  26037. };
  26038. // 立刻执行
  26039. CreateModule.prototype.finish = function (sender) {
  26040. var _this = this;
  26041. var parent = sender.up('window');
  26042. var editor = this.refs.jsoneditor;
  26043. var data = JSON.parse(editor.getCode());
  26044. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26045. var moduleType = this.viewModel.get("moduleType");
  26046. if (moduleType === 1) {
  26047. this.setLoading(true);
  26048. generateCode(data).then(function (code) {
  26049. console.log("===> ", code);
  26050. _this.setLoading(true);
  26051. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26052. .then(function () {
  26053. msg("创建成功!");
  26054. parent.close();
  26055. handles$1.fileTree.reload();
  26056. }).finally(function () { return _this.setLoading(false); });
  26057. }).finally(function () { return _this.setLoading(false); });
  26058. }
  26059. };
  26060. return CreateModule;
  26061. }(Scope));
  26062. //# sourceMappingURL=CreateModule.js.map
  26063. function getModuleId(path) {
  26064. var separator = "/";
  26065. var sps = path.split(separator);
  26066. var joinSps = sps.join('$');
  26067. if (!joinSps) {
  26068. return "ROOT";
  26069. }
  26070. return joinSps;
  26071. }
  26072. /**
  26073. * Module数据转换成Tree数据
  26074. */
  26075. function modulesToTreeData(modules) {
  26076. var separator = "/";
  26077. var treeNodeMap = new Map();
  26078. var root = {
  26079. type: "Dir",
  26080. path: "",
  26081. expanded: true,
  26082. leaf: false,
  26083. children: [],
  26084. };
  26085. root.id = getModuleId(root.path);
  26086. treeNodeMap.set(root.path, root);
  26087. modules.forEach(function (module) {
  26088. var _a;
  26089. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26090. if (paths.length <= 0)
  26091. return;
  26092. var path = [];
  26093. var parent = root;
  26094. paths.forEach(function (dirName, idx) {
  26095. var parentPath = path.join(separator);
  26096. parent = treeNodeMap.get(parentPath);
  26097. path.push(dirName);
  26098. var currentPath = path.join(separator);
  26099. var child = treeNodeMap.get(currentPath);
  26100. if (child == null) {
  26101. // 获取当前path 绝对路径
  26102. var indexLength = module.absolutePath.indexOf(currentPath);
  26103. var currentAbsolutePath = "";
  26104. if (indexLength > 0) {
  26105. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26106. }
  26107. child = {
  26108. type: "Dir",
  26109. path: currentPath,
  26110. absolutePath: currentAbsolutePath,
  26111. leaf: false,
  26112. children: [],
  26113. text: dirName
  26114. };
  26115. child.id = getModuleId(child.path);
  26116. parent.children.push(child);
  26117. treeNodeMap.set(child.path, child);
  26118. }
  26119. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26120. var leaf = {
  26121. type: "Module",
  26122. path: module.path + separator + module.name,
  26123. absolutePath: module.absolutePath,
  26124. leaf: true,
  26125. text: module.name,
  26126. module: module,
  26127. };
  26128. leaf.id = getModuleId(leaf.path);
  26129. child.children.push(leaf);
  26130. treeNodeMap.set(leaf.path, leaf);
  26131. }
  26132. });
  26133. });
  26134. // 排序处理
  26135. treeNodeMap.forEach(function (module) {
  26136. if (module.children) {
  26137. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26138. module.children.length = 0;
  26139. children.forEach(function (item) { return module.children.push(item); });
  26140. }
  26141. });
  26142. return root;
  26143. }
  26144. function showDialog(sender, option) {
  26145. var _a, _b;
  26146. var win = new Ext.Window({
  26147. autoDestroy: true,
  26148. title: option.title,
  26149. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26150. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26151. resizable: false,
  26152. closable: true,
  26153. modal: true,
  26154. maximizable: false,
  26155. minimizable: false,
  26156. // constrainHeader: true,
  26157. constrain: true,
  26158. layout: 'fit',
  26159. animateTarget: sender,
  26160. buttonAlign: 'center',
  26161. items: [
  26162. {
  26163. xtype: "form",
  26164. layout: "hbox",
  26165. margin: '10px 20px',
  26166. border: 0,
  26167. items: option.items
  26168. }
  26169. ],
  26170. //窗口按钮
  26171. fbar: [
  26172. {
  26173. xtype: 'button', text: '保存', handler: function (btn) {
  26174. //窗口获取表单
  26175. var form = win.down('form');
  26176. var vaildSuccess = form.isValid();
  26177. if (!vaildSuccess) {
  26178. return;
  26179. }
  26180. option.submitFunc(form);
  26181. }
  26182. },
  26183. {
  26184. xtype: 'button', text: '取消', handler: function (btn) {
  26185. //窗口关闭
  26186. btn.up('window').close();
  26187. }
  26188. }
  26189. ],
  26190. });
  26191. win.show();
  26192. }
  26193. function showCreateFolderWin(sender, parentPath) {
  26194. showDialog(sender, {
  26195. title: '新建文件夹',
  26196. height: 150,
  26197. items: [
  26198. {
  26199. xtype: "textfield",
  26200. name: "filename",
  26201. fieldLabel: "文件夹名称",
  26202. allowBlank: false,
  26203. selectOnFocus: true,
  26204. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26205. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26206. labelWidth: 80,
  26207. width: "100%",
  26208. listeners: {
  26209. afterrender: function (sender) {
  26210. _$2.defer(function () {
  26211. sender.focus();
  26212. });
  26213. }
  26214. }
  26215. },
  26216. ],
  26217. submitFunc: function (form) {
  26218. var filename = form.down('textfield[name="filename"]').getValue();
  26219. createFolder(parentPath, filename).then(function (res) {
  26220. if (res.success) {
  26221. msg$1('创建成功');
  26222. handles$1.fileTree.reload();
  26223. form.up('window').close();
  26224. }
  26225. else {
  26226. showErrorDialog$1(res.msg);
  26227. }
  26228. }).catch(function (e) {
  26229. showErrorDialog$1(e.responseJSON.msg);
  26230. });
  26231. }
  26232. });
  26233. }
  26234. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26235. var dlg = new CreateModule();
  26236. dlg.showDialog(sender, {}, {
  26237. data: {
  26238. packagePath: path,
  26239. fileSavePath: absolutePath,
  26240. }
  26241. });
  26242. }
  26243. function registerModule$1(sender, path, name, icon) {
  26244. // 前缀 com/galaxis/wms 写死了
  26245. var dlg = new RegisterModule();
  26246. dlg.showDialog(sender, {}, {
  26247. data: {
  26248. form: {
  26249. scope_url: path.replace("com/galaxis/wms", "."),
  26250. resource_name: name,
  26251. resource_icon: icon,
  26252. }
  26253. }
  26254. });
  26255. }
  26256. function showCreateEmptyModule(sender, path) {
  26257. var win = new Ext.Window({
  26258. autoDestroy: true,
  26259. title: "新建空模块",
  26260. width: 400,
  26261. height: 150,
  26262. resizable: true,
  26263. closable: true,
  26264. maximizable: true,
  26265. minimizable: true,
  26266. plain: true,
  26267. // constrainHeader: true,
  26268. constrain: true,
  26269. layout: 'fit',
  26270. animateTarget: sender,
  26271. buttonAlign: 'center',
  26272. items: [
  26273. {
  26274. xtype: "form",
  26275. layout: "hbox",
  26276. margin: '10px 20px',
  26277. border: 0,
  26278. items: [
  26279. {
  26280. flex: 1,
  26281. layout: 'vbox',
  26282. items: [
  26283. {
  26284. xtype: "textfield",
  26285. name: "filename",
  26286. fieldLabel: "模块名",
  26287. flex: 1,
  26288. allowBlank: false,
  26289. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26290. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26291. labelWidth: 50,
  26292. width: "100%",
  26293. },
  26294. ]
  26295. },
  26296. ]
  26297. }
  26298. ],
  26299. //窗口按钮
  26300. buttons: [
  26301. {
  26302. xtype: 'button', text: '保存', handler: function (btn) {
  26303. //窗口获取表单
  26304. var form = win.down('form');
  26305. var vaildSuccess = form.isValid();
  26306. if (!vaildSuccess) {
  26307. return;
  26308. }
  26309. var filename = form.down('textfield[name="filename"]').getValue();
  26310. createEmptyModule(path, filename).then(function (res) {
  26311. if (res.success) {
  26312. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26313. handles$1.fileTree.reload();
  26314. win.close();
  26315. }
  26316. else {
  26317. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26318. }
  26319. }).catch(function (e) {
  26320. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26321. });
  26322. }
  26323. },
  26324. {
  26325. xtype: 'button', text: '取消', handler: function (btn) {
  26326. //窗口关闭
  26327. win.close();
  26328. }
  26329. }
  26330. ]
  26331. });
  26332. win.show();
  26333. }
  26334. //# sourceMappingURL=FileHelp.js.map
  26335. function initFileTree () {
  26336. Ext.define('com.yvan.studio.FileTree', {
  26337. extend: 'com.yvan.studio.StateTree',
  26338. xtype: 'filetree',
  26339. tooltip: '文件',
  26340. iconCls: 'x-fa fa-file',
  26341. rootVisible: false,
  26342. useArrows: true,
  26343. colspan: 2,
  26344. lines: true,
  26345. reference: 'filetree',
  26346. multiSelect: true,
  26347. getStateFilename: function () {
  26348. return getCurrentProject().uuid + "/filetree.json";
  26349. },
  26350. openNode: function () {
  26351. var selection = this.getSelection();
  26352. var _a = __read(selection, 1), record = _a[0];
  26353. if (!record) {
  26354. return;
  26355. }
  26356. var raw = record.raw;
  26357. if (raw.type === 'Dir') {
  26358. return;
  26359. }
  26360. if (raw.type === "Module" && raw.module) {
  26361. eventBus.publish(EventType.ModuleOpen, raw);
  26362. }
  26363. },
  26364. openInIdea: function () {
  26365. var _a = __read(this.getSelection(), 1), record = _a[0];
  26366. if (record) {
  26367. var data = record.data;
  26368. if (data.type === "Module") {
  26369. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26370. native.openInIdea(data.module.groovyFile.absolutePath);
  26371. }
  26372. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26373. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26374. }
  26375. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26376. native.openInIdea(data.module.jsViewFile.absolutePath);
  26377. }
  26378. return;
  26379. }
  26380. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26381. }
  26382. },
  26383. deleteSelection: function () {
  26384. var selection = this.getSelection();
  26385. var pathList = [];
  26386. _.forEach(selection, function (item) {
  26387. if (item.data.type === "Dir") {
  26388. pathList.push({ path: item.data.path, isFolder: true });
  26389. }
  26390. else {
  26391. pathList.push({ path: item.data.path, isFolder: false });
  26392. }
  26393. });
  26394. {
  26395. return;
  26396. }
  26397. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26398. //
  26399. // Ext.Msg.confirm('提示', title, (btn) => {
  26400. // if (btn === 'yes') {
  26401. // deleteFileOrFolder(raw.path, title, true)
  26402. // }
  26403. // })
  26404. // const title = '您确定要删除(' + raw.path + ')吗?'
  26405. // deleteFileOrFolder(raw.path, title, false)
  26406. },
  26407. listeners: {
  26408. itemverify: function () {
  26409. this.openNode();
  26410. },
  26411. afterrender: function (me) {
  26412. console.log('filetree_afterrender', 'reloadIfNeed');
  26413. moduleStore.registe(me.subscribeModule.bind(this));
  26414. moduleStore.reloadIfNeed("PC");
  26415. },
  26416. destroy: function (me) {
  26417. console.log('filetree_destroy');
  26418. moduleStore.unregiste(me.subscribeModule.bind(this));
  26419. },
  26420. itemcontextmenu: function (sender, node, element, idx, e) {
  26421. e.preventDefault();
  26422. var raw = node.raw;
  26423. var option = {};
  26424. if (raw.type === 'Dir') {
  26425. // 文件夹右键
  26426. option = {
  26427. shadow: 'frame', allowOtherMenus: true,
  26428. items: [
  26429. {
  26430. text: '新建空模块',
  26431. iconCls: 'x-fa fa-plus-circle',
  26432. handler: function (sender) {
  26433. showCreateEmptyModule(sender, raw.path);
  26434. }
  26435. },
  26436. {
  26437. text: '新建模块',
  26438. iconCls: 'x-fa fa-plus-circle',
  26439. handler: function (sender) {
  26440. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26441. }
  26442. },
  26443. '-',
  26444. {
  26445. text: '新建文件夹',
  26446. iconCls: 'x-fa fa-folder-o',
  26447. handler: function (sender) {
  26448. var parentPath = raw.path;
  26449. showCreateFolderWin(sender, parentPath);
  26450. }
  26451. },
  26452. {
  26453. text: '复制路径',
  26454. iconCls: 'x-fa fa-external-link',
  26455. handler: function (sender) {
  26456. native.clipboardSet(raw.path);
  26457. }
  26458. },
  26459. ]
  26460. };
  26461. }
  26462. else {
  26463. // 文件右键
  26464. option = {
  26465. shadow: 'frame', allowOtherMenus: true,
  26466. items: [
  26467. // {
  26468. // text: '重命名',
  26469. // iconCls: 'x-fa fa-terminal',
  26470. // handler(sender) {
  26471. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26472. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26473. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26474. // }
  26475. // },
  26476. // {
  26477. // text: '另存为',
  26478. // iconCls: 'x-fa fa-exchange',
  26479. // handler(sender) {
  26480. // console.error('没做')
  26481. // }
  26482. // },
  26483. {
  26484. text: '复制路径',
  26485. iconCls: 'x-fa fa-external-link',
  26486. handler: function (sender) {
  26487. native.clipboardSet(raw.path);
  26488. }
  26489. },
  26490. '-',
  26491. {
  26492. text: '注册模块',
  26493. iconCls: 'x-fa fa-sign-in',
  26494. handler: function (sender) {
  26495. registerModule$1(sender, raw.path);
  26496. }
  26497. },
  26498. ]
  26499. };
  26500. }
  26501. var treeMenu = new Ext.menu.Menu(option);
  26502. treeMenu.showAt(e.getXY());
  26503. },
  26504. },
  26505. tbar: [
  26506. {
  26507. xtype: 'button',
  26508. iconCls: 'x-fa fa-crosshairs',
  26509. tooltip: '选中当前打开的文件',
  26510. handler: function (sender) {
  26511. msg$1('没做');
  26512. }
  26513. },
  26514. {
  26515. xtype: 'button',
  26516. iconCls: 'x-fa fa-link',
  26517. tooltip: '在IDEA中打开',
  26518. handler: function (sender) {
  26519. var scope = sender.up("filetree");
  26520. scope.openInIdea();
  26521. }
  26522. },
  26523. {
  26524. xtype: 'button',
  26525. iconCls: 'x-fa fa-refresh',
  26526. tooltip: '刷新',
  26527. handler: function (sender) {
  26528. var scope = sender.up("filetree");
  26529. scope.reload();
  26530. }
  26531. },
  26532. {
  26533. xtype: 'button',
  26534. iconCls: 'x-fa fa-percent',
  26535. tooltip: '监控',
  26536. handler: function (sender) {
  26537. // handles.mainWindow.showPerform()
  26538. }
  26539. },
  26540. ],
  26541. initComponent: function () {
  26542. setFileTree(this);
  26543. this.superclass.initComponent.apply(this, arguments);
  26544. // super.initComponent.apply(this, arguments)
  26545. },
  26546. subscribeModule: function (res) {
  26547. if (typeof res === 'object') {
  26548. var rootNode = modulesToTreeData(res.data);
  26549. this.setRootNode(rootNode);
  26550. this.restoreState();
  26551. handles$1.mainWindow.modules = res.data;
  26552. }
  26553. else if (typeof res === 'boolean') {
  26554. this.setLoading(res);
  26555. }
  26556. },
  26557. reload: function () {
  26558. console.log('filetree_reloadForce');
  26559. moduleStore.reloadForce("PC").then(function (res) {
  26560. });
  26561. }
  26562. });
  26563. }
  26564. //# sourceMappingURL=FileTree.js.map
  26565. function initDbTree () {
  26566. var define = {
  26567. extend: 'com.yvan.studio.StateTree',
  26568. xtype: 'dbtree',
  26569. tooltip: '数据库',
  26570. iconCls: 'x-fa fa-database',
  26571. rootVisible: false,
  26572. useArrows: true,
  26573. reference: 'dbtree',
  26574. multiSelect: true,
  26575. getStateFilename: function () {
  26576. return getCurrentProject().uuid + "/dbtree.json";
  26577. },
  26578. tbar: [
  26579. {
  26580. xtype: 'button',
  26581. iconCls: 'x-fa fa-crosshairs',
  26582. tooltip: '选中当前打开的表',
  26583. handler: function (sender) {
  26584. var _a;
  26585. // 获取当前选中的活动标签 tableColumn_bas_car
  26586. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26587. if (!locatPath) {
  26588. return;
  26589. }
  26590. handles$1.dbTree.selectPath(locatPath);
  26591. }
  26592. },
  26593. {
  26594. xtype: 'button',
  26595. iconCls: 'x-fa fa-refresh',
  26596. tooltip: '刷新',
  26597. handler: function (sender) {
  26598. handles$1.dbTree.reload();
  26599. }
  26600. },
  26601. {
  26602. xtype: 'button',
  26603. iconCls: 'x-fa fa-cloud-download',
  26604. tooltip: '重新拉取生成元数据(耗时很长!)',
  26605. handler: function (sender) {
  26606. handles$1.dbTree.dbToMetaAndReload(sender);
  26607. }
  26608. },
  26609. // {
  26610. // xtype: 'button',
  26611. // iconCls: 'x-fa fa-files-o',
  26612. // tooltip: '数据同步',
  26613. // handler(sender) {
  26614. //
  26615. // }
  26616. // },
  26617. {
  26618. xtype: 'button',
  26619. iconCls: 'x-fa fa-exchange',
  26620. tooltip: '数据结构同步',
  26621. handler: function (sender) {
  26622. // handles.mainWindow.showDataSync(sender)
  26623. }
  26624. },
  26625. {
  26626. xtype: 'button',
  26627. iconCls: 'x-fa fa-window-maximize',
  26628. tooltip: 'SQL查询分析器',
  26629. handler: function (sender) {
  26630. // handles.mainWindow.showDbCodeTemplate(sender)
  26631. }
  26632. },
  26633. {
  26634. xtype: 'button',
  26635. iconCls: 'x-fa fa-cubes',
  26636. tooltip: '数据域管理',
  26637. handler: function (sender) {
  26638. // handles.mainWindow.showColumnDomain()
  26639. }
  26640. },
  26641. {
  26642. xtype: 'button',
  26643. iconCls: 'x-fa fa-edit',
  26644. tooltip: '修改结构',
  26645. handler: function (sender) {
  26646. var tree = sender.up("treepanel");
  26647. var selection = tree.getSelection();
  26648. var _a = __read(selection, 1), node = _a[0];
  26649. if (!node) {
  26650. msg$1('请选择一个表');
  26651. return;
  26652. }
  26653. var raw = node.data.raw;
  26654. if (node.get('type') === 'table') ;
  26655. else if (node.get('type') === 'column') ;
  26656. }
  26657. },
  26658. ],
  26659. listeners: {
  26660. afterrender: function (me) {
  26661. setDbTree(this);
  26662. // 找管理器订阅刷新的事件
  26663. instance$1.registe(this.refreshData.bind(this));
  26664. instance$1.reloadIfNeed(undefined);
  26665. },
  26666. destory: function (me) {
  26667. setDbTree(undefined);
  26668. instance$1.unregiste(this.refreshData.bind(this));
  26669. },
  26670. itemcontextmenu: function (sender, node, element, idx, e) {
  26671. var _this = this;
  26672. e.preventDefault();
  26673. var option = {};
  26674. var raw = node.raw.raw;
  26675. if (node.get('type') === 'column') {
  26676. option = {
  26677. shadow: 'frame', allowOtherMenus: true,
  26678. items: [
  26679. {
  26680. text: '设计结构',
  26681. iconCls: 'x-fa fa-edit',
  26682. handler: function (sender) {
  26683. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26684. }
  26685. },
  26686. ]
  26687. };
  26688. }
  26689. else if (node.get('type') === 'table') {
  26690. option = {
  26691. shadow: 'frame', allowOtherMenus: true,
  26692. items: [
  26693. {
  26694. text: '新建',
  26695. iconCls: 'x-fa fa-plus',
  26696. handler: function (sender) {
  26697. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26698. }
  26699. },
  26700. {
  26701. text: '设计结构',
  26702. iconCls: 'x-fa fa-edit',
  26703. handler: function (sender) {
  26704. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26705. }
  26706. },
  26707. {
  26708. text: '重命名',
  26709. iconCls: 'x-fa fa-pencil',
  26710. handler: function (sender) {
  26711. _this.renameTable(sender, node.data.raw);
  26712. }
  26713. },
  26714. '-',
  26715. {
  26716. text: '删除',
  26717. iconCls: 'x-fa fa-minus',
  26718. handler: function (sender) {
  26719. _this.removeTable(sender, node.data.raw);
  26720. }
  26721. },
  26722. ]
  26723. };
  26724. }
  26725. var treeMenu = new Ext.menu.Menu(option);
  26726. treeMenu.showAt(e.getXY());
  26727. }
  26728. },
  26729. // DbTreeStore 刷新时,会回调到这个方法
  26730. refreshData: function (isLoadingState) {
  26731. var me = this;
  26732. if (typeof isLoadingState === 'boolean') {
  26733. me.setLoading(isLoadingState);
  26734. return;
  26735. }
  26736. var rootNode = getDbTree(instance$1.apiResponse);
  26737. me.setRootNode(rootNode);
  26738. this.restoreState();
  26739. },
  26740. renameTable: function (sender, tableRow) {
  26741. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26742. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26743. if (!res.data)
  26744. return;
  26745. var window = Ext.create('Ext.window.Window', {
  26746. title: 'SQL 预览',
  26747. height: 400,
  26748. width: 600,
  26749. modal: true,
  26750. animateTarget: sender,
  26751. maximizable: true,
  26752. layout: 'fit',
  26753. items: {
  26754. xtype: 'sqleditor',
  26755. value: res.data,
  26756. },
  26757. buttons: [
  26758. {
  26759. xtype: 'button',
  26760. text: '执行',
  26761. iconCls: 'x-fa fa-save',
  26762. handler: function (sender) {
  26763. var editor = sender.up('window').down('sqleditor');
  26764. var ddl = editor.getValue();
  26765. window.setLoading(true);
  26766. instance$1.pushToDbCommit({
  26767. schema_name: tableRow.schema_name,
  26768. table_name: name,
  26769. old_table_name: tableRow.table_name,
  26770. ddl: ddl,
  26771. }).then(function () {
  26772. handles$1.dbTree.reload();
  26773. window.close();
  26774. }).finally(function () { return window.setLoading(false); });
  26775. },
  26776. },
  26777. {
  26778. xtype: 'button',
  26779. text: '取消',
  26780. iconCls: 'x-fa fa-times',
  26781. handler: function () {
  26782. window.close();
  26783. }
  26784. },
  26785. ]
  26786. }).show();
  26787. });
  26788. });
  26789. },
  26790. removeTable: function (sender, tableRow) {
  26791. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26792. if (!res.data)
  26793. return;
  26794. var window = Ext.create('Ext.window.Window', {
  26795. title: 'SQL 预览',
  26796. height: 400,
  26797. width: 600,
  26798. modal: true,
  26799. animateTarget: sender,
  26800. maximizable: true,
  26801. layout: 'fit',
  26802. items: {
  26803. xtype: 'sqleditor',
  26804. value: res.data,
  26805. },
  26806. buttons: [
  26807. {
  26808. xtype: 'button',
  26809. text: '执行',
  26810. iconCls: 'x-fa fa-save',
  26811. handler: function (sender) {
  26812. var editor = sender.up('window').down('sqleditor');
  26813. var ddl = editor.getValue();
  26814. window.setLoading(true);
  26815. instance$1.pushToDbCommit({
  26816. schema_name: tableRow.schema_name,
  26817. table_name: tableRow.table_name,
  26818. ddl: ddl
  26819. })
  26820. .then(function () {
  26821. handles$1.dbTree.reload();
  26822. window.close();
  26823. }).finally(function () { return window.setLoading(false); });
  26824. }
  26825. },
  26826. {
  26827. xtype: 'button',
  26828. text: '取消',
  26829. iconCls: 'x-fa fa-times',
  26830. handler: function () {
  26831. window.close();
  26832. }
  26833. }
  26834. ]
  26835. }).show();
  26836. });
  26837. },
  26838. // hideHeaders: true,
  26839. // columns: [
  26840. // {
  26841. // xtype: 'treecolumn',
  26842. // text: '名称',
  26843. // dataIndex: 'text',
  26844. // flex: 2,
  26845. // }, {
  26846. // text: '描述',
  26847. // dataIndex: 'comment',
  26848. // flex: 1,
  26849. // }
  26850. // ],
  26851. reload: function () {
  26852. // 强制刷新 DbManager
  26853. instance$1.reloadForce(undefined);
  26854. },
  26855. dbToMetaAndReload: function () {
  26856. // 从数据库结构重新生成元数据
  26857. instance$1.dbToMetaAndReload();
  26858. }
  26859. };
  26860. Ext.define('com.yvan.studio.DbTree', define);
  26861. }
  26862. /**
  26863. * 将数据构建成 dbTree 需要的格式
  26864. */
  26865. function getDbTree(apiResponse) {
  26866. var rootNode = {
  26867. children: [],
  26868. expanded: true,
  26869. id: "ROOT",
  26870. leaf: false,
  26871. };
  26872. _$2.forEach(apiResponse, function (schemaRow) {
  26873. var schemaNode = {
  26874. id: 'schema$' + schemaRow.schema_name,
  26875. type: "schema",
  26876. expanded: true,
  26877. leaf: false,
  26878. iconCls: 'x-fa fa-th-large ',
  26879. text: schemaRow.schema_name,
  26880. raw: __assign({}, schemaRow),
  26881. children: [],
  26882. };
  26883. delete schemaNode.raw.table_list;
  26884. rootNode.children.push(schemaNode);
  26885. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26886. var _a;
  26887. var tableNode = {
  26888. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26889. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26890. comment: tableRow.description,
  26891. type: "table",
  26892. iconCls: 'x-fa fa-table',
  26893. expanded: false,
  26894. leaf: false,
  26895. children: [],
  26896. raw: __assign({}, tableRow)
  26897. };
  26898. delete tableNode.raw.column_list;
  26899. schemaNode.children.push(tableNode);
  26900. _$2.forEach(tableRow.column_list, function (columnRow) {
  26901. var _a;
  26902. var iconCls = 'x-fa fa-square-o';
  26903. if (columnRow.is_primary_key) {
  26904. iconCls = 'x-fa fa-key';
  26905. }
  26906. else if (columnRow.not_null) {
  26907. iconCls = 'x-fa fa-check-square';
  26908. }
  26909. var columnNode = {
  26910. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26911. type: "column",
  26912. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26913. comment: columnRow.column_comment,
  26914. leaf: true,
  26915. iconCls: iconCls,
  26916. raw: __assign({}, columnRow)
  26917. };
  26918. tableNode.children.push(columnNode);
  26919. }); // column
  26920. }); // table
  26921. }); // schema
  26922. return rootNode;
  26923. }
  26924. //# sourceMappingURL=DbTree.js.map
  26925. var ReportGridController = /** @class */ (function () {
  26926. function ReportGridController() {
  26927. }
  26928. ReportGridController.prototype.onLoad = function (sender) {
  26929. this.reload();
  26930. setReport(this);
  26931. };
  26932. ReportGridController.prototype.showSingle = function (sender) {
  26933. var _this = this;
  26934. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26935. if (record) {
  26936. handles.mainWindow.showFormSingle(record.data, function () {
  26937. _this.reload();
  26938. });
  26939. }
  26940. };
  26941. ReportGridController.prototype.filterChanged = function (sender, value) {
  26942. console.log('filterChange', sender, value);
  26943. this.view.store.clearFilter();
  26944. if (value) {
  26945. this.view.store.filterBy(function (record) {
  26946. var code = _.lowerCase(record.get('report_name'));
  26947. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26948. return (code.includes(value) ||
  26949. dict_desc_py.includes(value));
  26950. });
  26951. }
  26952. };
  26953. ReportGridController.prototype.onClearClick = function () {
  26954. var _a, _b;
  26955. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26956. };
  26957. ReportGridController.prototype.reload = function () {
  26958. var me = this;
  26959. me.getView().setLoading(true);
  26960. reportListApi().then(function (res) {
  26961. _.forEach(res.data, function (r) {
  26962. r.report_enable = r.report_enable === 1;
  26963. });
  26964. me.getView().setStore(new Ext.data.Store({
  26965. fields: ['report_id', 'report_name', 'report_enable'],
  26966. data: res.data,
  26967. }));
  26968. }).finally(function () {
  26969. me.getView().setLoading(false);
  26970. });
  26971. };
  26972. ReportGridController.prototype.reportAdd = function () {
  26973. var _this = this;
  26974. prompt$2('请输入报表名称').then(function (name) {
  26975. createReportApi(name).then(function (res) {
  26976. if (res.success) {
  26977. msg$1('添加成功');
  26978. handles.mainWindow.showReport(res.data, name, function () {
  26979. _this.reload();
  26980. });
  26981. }
  26982. _this.reload();
  26983. });
  26984. });
  26985. };
  26986. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26987. e.preventDefault();
  26988. var me = sender.up('grid').ownerGrid.getController();
  26989. var option = {
  26990. shadow: 'frame', allowOtherMenus: true,
  26991. items: [
  26992. {
  26993. text: '添加',
  26994. iconCls: 'x-fa fa-plus-circle',
  26995. handler: function (sender) {
  26996. me.reportAdd();
  26997. }
  26998. },
  26999. {
  27000. text: '编辑',
  27001. iconCls: 'x-fa fa-edit',
  27002. handler: function (sender) {
  27003. me.reportEdit();
  27004. }
  27005. },
  27006. {
  27007. text: '删除',
  27008. iconCls: 'x-fa fa-minus-circle',
  27009. handler: function (sender) {
  27010. me.reportRemove();
  27011. }
  27012. },
  27013. '-',
  27014. {
  27015. text: '注册(至菜单)',
  27016. iconCls: 'x-fa fa-sign-in',
  27017. handler: function (sender) {
  27018. me.reportRegiste(sender);
  27019. }
  27020. },
  27021. {
  27022. text: '卸载',
  27023. iconCls: 'x-fa fa-sign-out',
  27024. handler: function (sender) {
  27025. console.error('没做');
  27026. }
  27027. },
  27028. ]
  27029. };
  27030. var treeMenu = new Ext.menu.Menu(option);
  27031. treeMenu.showAt(e.getXY());
  27032. };
  27033. ReportGridController.prototype.reportRegiste = function (sender) {
  27034. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27035. if (record) {
  27036. var reportName = record.get('report_name');
  27037. var reportId = record.get('report_id');
  27038. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27039. }
  27040. };
  27041. ReportGridController.prototype.reportRemove = function () {
  27042. var _this = this;
  27043. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27044. if (record) {
  27045. var reportName = record.get('report_name');
  27046. var reportId_1 = record.get('report_id');
  27047. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27048. delReportApi(reportId_1).then(function (res) {
  27049. if (res.success) {
  27050. msg$1('删除成功');
  27051. _this.reload();
  27052. }
  27053. });
  27054. });
  27055. }
  27056. };
  27057. ReportGridController.prototype.reportEdit = function () {
  27058. var _this = this;
  27059. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27060. if (record) {
  27061. var reportName = record.get('report_name');
  27062. var reportId = record.get('report_id');
  27063. handles.mainWindow.showReport(reportId, reportName, function () {
  27064. _this.reload();
  27065. });
  27066. }
  27067. };
  27068. ReportGridController.prototype.onDblClick = function (sender) {
  27069. this.reportEdit();
  27070. };
  27071. return ReportGridController;
  27072. }());
  27073. //# sourceMappingURL=ReportGridController.js.map
  27074. function initReportGrid () {
  27075. var controller = new ReportGridController();
  27076. Ext.define('com.yvan.studio.ReportGrid', {
  27077. extend: 'Ext.grid.Panel',
  27078. xtype: 'reportGrid',
  27079. controller: controller,
  27080. scope: controller,
  27081. referenceHolder: true,
  27082. tooltip: '查询报表',
  27083. iconCls: 'x-fa fa-bar-chart',
  27084. useArrows: true,
  27085. reference: 'reportgrid',
  27086. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27087. listeners: {
  27088. itemdblclick: 'onDblClick',
  27089. afterrender: 'onLoad',
  27090. },
  27091. viewConfig: {
  27092. enableTextSelection: true,
  27093. listeners: {
  27094. itemcontextmenu: 'onGridContextMenu',
  27095. },
  27096. },
  27097. tbar: {
  27098. xtype: 'toolbar',
  27099. items: [
  27100. {
  27101. xtype: 'button',
  27102. tooltip: '测试',
  27103. iconCls: 'x-fa fa-bars',
  27104. listeners: {
  27105. click: 'showSingle'
  27106. }
  27107. },
  27108. {
  27109. xtype: 'button',
  27110. tooltip: '刷新',
  27111. iconCls: 'x-fa fa-refresh',
  27112. listeners: {
  27113. click: 'reload'
  27114. }
  27115. },
  27116. {
  27117. xtype: 'button',
  27118. tooltip: '添加',
  27119. iconCls: 'x-fa fa-plus-circle',
  27120. listeners: {
  27121. click: 'reportAdd'
  27122. }
  27123. },
  27124. {
  27125. xtype: 'button',
  27126. tooltip: '删除',
  27127. iconCls: 'x-fa fa-minus-circle',
  27128. listeners: {
  27129. click: 'reportRemove'
  27130. }
  27131. },
  27132. {
  27133. xtype: 'textfield',
  27134. flex: 1,
  27135. reference: "txtFilter",
  27136. emptyText: '搜索过滤',
  27137. enableKeyEvents: true,
  27138. listeners: {
  27139. change: {
  27140. fn: 'filterChanged',
  27141. buffer: 50
  27142. }
  27143. }
  27144. },
  27145. ]
  27146. },
  27147. columns: [
  27148. {
  27149. text: 'ID', dataIndex: 'report_id',
  27150. hidden: true,
  27151. },
  27152. {
  27153. text: '报表名称', dataIndex: 'report_name',
  27154. flex: 1,
  27155. },
  27156. ]
  27157. });
  27158. }
  27159. //# sourceMappingURL=ReportGrid.js.map
  27160. /** 所有变量类型 */
  27161. var TypeEnum;
  27162. (function (TypeEnum) {
  27163. TypeEnum["string"] = "string";
  27164. TypeEnum["number"] = "number";
  27165. TypeEnum["object"] = "object";
  27166. TypeEnum["array"] = "array";
  27167. TypeEnum["function"] = "function";
  27168. TypeEnum["null"] = "null";
  27169. TypeEnum["boolean"] = "boolean";
  27170. TypeEnum["symbol"] = "symbol";
  27171. TypeEnum["json"] = "json";
  27172. TypeEnum["math"] = "math";
  27173. TypeEnum["regexp"] = "regexp";
  27174. TypeEnum["date"] = "date";
  27175. TypeEnum["undefined"] = "undefined";
  27176. TypeEnum["nan"] = "nan";
  27177. TypeEnum["reactNode"] = "react_node";
  27178. })(TypeEnum || (TypeEnum = {}));
  27179. /**
  27180. * 判断对象类型
  27181. * @param object 对象
  27182. */
  27183. var variableTypeOf = function (object) {
  27184. var typeStr = Object.prototype.toString.call(object);
  27185. var typeName;
  27186. switch (("" + typeStr).toLowerCase()) {
  27187. case '[object string]':
  27188. typeName = TypeEnum.string;
  27189. break;
  27190. case '[object number]':
  27191. if (Number.isNaN(object)) {
  27192. return TypeEnum.nan;
  27193. }
  27194. typeName = TypeEnum.number;
  27195. break;
  27196. case '[object object]':
  27197. if (object.$$typeof && object.props) {
  27198. var type = variableTypeOf(object.$$typeof);
  27199. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27200. return TypeEnum.reactNode;
  27201. }
  27202. }
  27203. typeName = TypeEnum.object;
  27204. break;
  27205. case '[object array]':
  27206. typeName = TypeEnum.array;
  27207. break;
  27208. case '[object function]':
  27209. typeName = TypeEnum.function;
  27210. break;
  27211. case '[object null]':
  27212. typeName = TypeEnum.null;
  27213. break;
  27214. case '[object boolean]':
  27215. typeName = TypeEnum.boolean;
  27216. break;
  27217. case '[object date]':
  27218. typeName = TypeEnum.date;
  27219. break;
  27220. // 不常用
  27221. case '[object symbol]':
  27222. typeName = TypeEnum.symbol;
  27223. break;
  27224. case '[object json]':
  27225. typeName = TypeEnum.json;
  27226. break;
  27227. case '[object math]':
  27228. typeName = TypeEnum.math;
  27229. break;
  27230. case '[object regexp]':
  27231. typeName = TypeEnum.regexp;
  27232. break;
  27233. // 貌似不会走的分支
  27234. case '[object undefined]':
  27235. typeName = TypeEnum.undefined;
  27236. break;
  27237. // 无法识别
  27238. default:
  27239. if (object === undefined) {
  27240. return TypeEnum.undefined;
  27241. }
  27242. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27243. typeName = TypeEnum.object;
  27244. }
  27245. return typeName;
  27246. };
  27247. //# sourceMappingURL=typeof.js.map
  27248. function initGroovyEditor () {
  27249. Ext.define('com.yvan.studio.GroovyEditor', {
  27250. extend: 'Ext.panel.Panel',
  27251. alias: 'widget.groovyeditor',
  27252. xtype: 'groovyeditor',
  27253. layout: 'fit',
  27254. border: false,
  27255. html: "<div class=\"editor\"/>",
  27256. config: {
  27257. value: ''
  27258. },
  27259. codeChange: undefined,
  27260. isChangeFromOuter: false,
  27261. getCode: function () {
  27262. if (this.editor) {
  27263. return this.editor.getValue();
  27264. }
  27265. else {
  27266. return this.code;
  27267. }
  27268. },
  27269. setCode: function (value) {
  27270. var _this = this;
  27271. this.code = value;
  27272. this.value = value;
  27273. _$2.defer(function () {
  27274. _this.isChangeFromOuter = true;
  27275. if (_this.editor) {
  27276. _this.editor.setValue(value);
  27277. }
  27278. });
  27279. },
  27280. applyPosition: function () {
  27281. var _this = this;
  27282. if (this.autoFocusMethod) {
  27283. if (this.editor) {
  27284. _$2.defer(function () {
  27285. if (_this.autoFocusStartLine) {
  27286. _this.editor.setPosition({
  27287. lineNumber: _this.autoFocusStartLine,
  27288. column: _this.autoFocusStartColumn
  27289. });
  27290. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27291. }
  27292. _this.editor.focus();
  27293. });
  27294. delete this.autoFocusMethod;
  27295. }
  27296. }
  27297. this.editor.layout();
  27298. },
  27299. getValue: function () {
  27300. return this.value;
  27301. },
  27302. setValue: function (value, fromEditor) {
  27303. var me = this;
  27304. if (me.value === value) {
  27305. // 值相等,不需要变化
  27306. return;
  27307. }
  27308. if (fromEditor !== true && me.editor) {
  27309. // 不是来源于编辑器的变化,才设置编辑器的值
  27310. me.editor.setValue(value);
  27311. }
  27312. // 通知mixins setValue
  27313. me.value = value;
  27314. me.fireEvent('change', value);
  27315. },
  27316. initComponent: function () {
  27317. var that = this;
  27318. this.superclass.initComponent.call(this, arguments);
  27319. that.on({
  27320. resize: function () {
  27321. if (that.editor) {
  27322. that.editor.layout();
  27323. }
  27324. },
  27325. destory: function () {
  27326. if (that.editor) {
  27327. that.editor.dispose();
  27328. delete that.editor;
  27329. }
  27330. },
  27331. afterrender: function (sender) {
  27332. var $dom = $(that.el.dom).find('.editor');
  27333. attach_3($dom[0], {
  27334. value: that.code
  27335. }).then(function (editor) {
  27336. that.editor = editor;
  27337. that.applyPosition();
  27338. that.editor.onDidChangeModelContent(function (e) {
  27339. that.fireEvent('change', that.editor, e);
  27340. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27341. that.codeChange(that.editor.getValue(), that.name, e);
  27342. }
  27343. that.isChangeFromOuter = false;
  27344. });
  27345. });
  27346. }
  27347. });
  27348. }
  27349. });
  27350. }
  27351. function attach_3(element, opts) {
  27352. return new Promise(function (resolve) {
  27353. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27354. enabled: false
  27355. } }));
  27356. editor.onKeyUp(function (e) {
  27357. // console.log(e)
  27358. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27359. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27360. }
  27361. });
  27362. resolve(editor);
  27363. });
  27364. }
  27365. //# sourceMappingURL=GroovyEditor.js.map
  27366. function initJsEditor$1 () {
  27367. Ext.define('com.yvan.studio.JsEditor', {
  27368. extend: 'Ext.panel.Panel',
  27369. alias: 'widget.jseditor',
  27370. xtype: 'jseditor',
  27371. layout: 'fit',
  27372. border: false,
  27373. html: "<div class=\"editor\"/>",
  27374. autoFocusMethod: true,
  27375. autoFocusStartLine: 0,
  27376. autoFocusStartColumn: 0,
  27377. codeChange: undefined,
  27378. funcArr: [],
  27379. modulePage: null,
  27380. isChangeFromOuter: false,
  27381. name: "",
  27382. /**
  27383. * 设置代码
  27384. */
  27385. setCode: function (value) {
  27386. var _this = this;
  27387. this.code = value;
  27388. _$2.defer(function () {
  27389. _this.isChangeFromOuter = true;
  27390. if (_this.editor) {
  27391. _this.editor.setValue(value);
  27392. if (_this.name === "controllerEditor") {
  27393. _this.funcArr = _this.getAllFunction();
  27394. }
  27395. }
  27396. });
  27397. },
  27398. getCode: function () {
  27399. var _a;
  27400. if (!this.editor) {
  27401. return this.code;
  27402. }
  27403. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27404. },
  27405. applyPosition: function () {
  27406. var _this = this;
  27407. if (this.autoFocusMethod) {
  27408. if (this.editor) {
  27409. _$2.defer(function () {
  27410. if (_this.autoFocusStartLine) {
  27411. _this.editor.setPosition({
  27412. lineNumber: _this.autoFocusStartLine,
  27413. column: _this.autoFocusStartColumn
  27414. });
  27415. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27416. }
  27417. _this.editor.focus();
  27418. });
  27419. delete this.autoFocusMethod;
  27420. }
  27421. }
  27422. this.editor.layout();
  27423. },
  27424. initComponent: function () {
  27425. var that = this;
  27426. this.superclass.initComponent.apply(this, arguments);
  27427. this.on({
  27428. resize: function (sender, width, height) {
  27429. if (that.editor) {
  27430. that.editor.layout();
  27431. }
  27432. },
  27433. destory: function () {
  27434. if (that.editor) {
  27435. that.editor.dispose();
  27436. delete that.editor;
  27437. }
  27438. },
  27439. afterrender: function () {
  27440. var $dom = $(that.el.dom).find('.editor');
  27441. attach_1($dom[0], {
  27442. value: that.code
  27443. }).then(function (editor) {
  27444. that.editor = editor;
  27445. that.applyPosition();
  27446. that.editor.onDidChangeModelContent(function (e) {
  27447. that.fireEvent('change', that.editor, e);
  27448. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27449. that.codeChange(that.editor.getValue(), that.name, e);
  27450. }
  27451. that.isChangeFromOuter = false;
  27452. });
  27453. });
  27454. }
  27455. });
  27456. },
  27457. getAllFunction: function () {
  27458. var funcArr = [];
  27459. var ast = window['YvanUI'].recast.parse(this.code);
  27460. if (ast && ast.program && ast.program.body) {
  27461. if (Array.isArray(ast.program.body)) {
  27462. for (var i = 0; i < ast.program.body.length; i++) {
  27463. var m = ast.program.body[i];
  27464. if (m.type === "ExportDefaultDeclaration") {
  27465. if (m.declaration.type === "ClassDeclaration") {
  27466. if (m.declaration.body.type === "ClassBody") {
  27467. if (Array.isArray(m.declaration.body.body)) {
  27468. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27469. var ob = m.declaration.body.body[j];
  27470. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27471. var funcItem = { name: ob.key.name, args: [] };
  27472. if (Array.isArray(ob.value.params)) {
  27473. for (var k = 0; k < ob.value.params.length; k++) {
  27474. var p = ob.value.params[k];
  27475. funcItem.args.push(p.name);
  27476. }
  27477. }
  27478. funcArr.push(funcItem);
  27479. }
  27480. }
  27481. }
  27482. }
  27483. }
  27484. }
  27485. }
  27486. }
  27487. }
  27488. return funcArr;
  27489. }
  27490. });
  27491. }
  27492. var isInited = false;
  27493. function attach_1(element, opts) {
  27494. return new Promise(function (resolve) {
  27495. var monaco = window['monaco'];
  27496. if (!isInited) {
  27497. isInited = true;
  27498. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27499. noSemanticValidation: true,
  27500. noSyntaxValidation: false
  27501. });
  27502. // compiler options
  27503. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27504. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27505. allowNonTsExtensions: true,
  27506. });
  27507. // extra libraries
  27508. var libSource = [
  27509. 'declare class Facts {',
  27510. ' /**',
  27511. ' * Returns the next fact',
  27512. ' */',
  27513. ' static next():string',
  27514. ' static next222():string',
  27515. '}',
  27516. "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ",
  27517. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27518. ].join('\n');
  27519. var libUri = 'file:///index.d.ts';
  27520. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27521. // When resolving definitions and references, the editor will try to use created models.
  27522. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27523. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27524. }
  27525. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27526. resolve(editor);
  27527. });
  27528. }
  27529. //# sourceMappingURL=JsEditor.js.map
  27530. function initJsonEditor$1 () {
  27531. Ext.define('com.yvan.studio.JsonEditor', {
  27532. extend: 'Ext.panel.Panel',
  27533. alias: 'widget.jsoneditor',
  27534. xtype: 'jsoneditor',
  27535. layout: 'fit',
  27536. border: false,
  27537. html: "<div class=\"editor\"/>",
  27538. autoFocusMethod: true,
  27539. autoFocusStartLine: 0,
  27540. autoFocusStartColumn: 0,
  27541. codeChange: undefined,
  27542. funcArr: [],
  27543. modulePage: null,
  27544. isChangeFromOuter: false,
  27545. name: "",
  27546. /**
  27547. * 设置代码
  27548. */
  27549. setCode: function (value) {
  27550. var _this = this;
  27551. this.code = value;
  27552. _$2.defer(function () {
  27553. _this.isChangeFromOuter = true;
  27554. if (_this.editor) {
  27555. _this.editor.setValue(value);
  27556. }
  27557. });
  27558. },
  27559. updateOptions: function (options) {
  27560. if (this.editor && options) {
  27561. this.editor.updateOptions(options);
  27562. }
  27563. },
  27564. setLanguage: function (lang) {
  27565. if (this.editor && lang) {
  27566. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27567. }
  27568. },
  27569. getCode: function () {
  27570. var _a;
  27571. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27572. },
  27573. applyPosition: function () {
  27574. var _this = this;
  27575. if (this.autoFocusMethod) {
  27576. if (this.editor) {
  27577. _$2.defer(function () {
  27578. if (_this.autoFocusStartLine) {
  27579. _this.editor.setPosition({
  27580. lineNumber: _this.autoFocusStartLine,
  27581. column: _this.autoFocusStartColumn
  27582. });
  27583. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27584. }
  27585. _this.editor.focus();
  27586. });
  27587. delete this.autoFocusMethod;
  27588. }
  27589. }
  27590. this.editor.layout();
  27591. },
  27592. initComponent: function () {
  27593. var that = this;
  27594. this.superclass.initComponent.apply(this, arguments);
  27595. this.on({
  27596. resize: function (sender, width, height) {
  27597. if (that.editor) {
  27598. that.editor.layout();
  27599. }
  27600. },
  27601. destory: function () {
  27602. if (that.editor) {
  27603. that.editor.dispose();
  27604. delete that.editor;
  27605. }
  27606. },
  27607. afterrender: function (sender) {
  27608. var $dom = $(that.el.dom).find('.editor');
  27609. attach_116($dom[0], {
  27610. value: that.code
  27611. }).then(function (editor) {
  27612. that.editor = editor;
  27613. that.applyPosition();
  27614. that.editor.onDidChangeModelContent(function (e) {
  27615. that.fireEvent('change', that.editor, e);
  27616. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27617. that.codeChange(that.editor.getValue(), that.name, e);
  27618. }
  27619. that.isChangeFromOuter = false;
  27620. });
  27621. });
  27622. }
  27623. });
  27624. },
  27625. });
  27626. }
  27627. function attach_116(element, opts) {
  27628. return new Promise(function (resolve) {
  27629. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27630. enabled: false
  27631. } }));
  27632. editor.onKeyUp(function (e) {
  27633. // console.log(e)
  27634. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27635. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27636. }
  27637. });
  27638. resolve(editor);
  27639. });
  27640. }
  27641. //# sourceMappingURL=JsonEditor.js.map
  27642. function initSqlEditor$1 () {
  27643. Ext.define('com.yvan.studio.SqlEditor', {
  27644. extend: 'Ext.panel.Panel',
  27645. alias: 'widget.sqleditor',
  27646. xtype: 'sqleditor',
  27647. layout: 'fit',
  27648. border: false,
  27649. html: "<div class=\"editor\"/>",
  27650. config: {
  27651. value: ''
  27652. },
  27653. codeChange: undefined,
  27654. isChangeFromOuter: false,
  27655. setCode: function (value) {
  27656. var _this = this;
  27657. this.code = value;
  27658. this.value = value;
  27659. _$2.defer(function () {
  27660. _this.isChangeFromOuter = true;
  27661. if (_this.editor) {
  27662. _this.editor.setValue(value);
  27663. }
  27664. });
  27665. },
  27666. getCode: function () {
  27667. return this.getValue();
  27668. },
  27669. updateOptions: function (options) {
  27670. if (this.editor && options) {
  27671. this.editor.updateOptions(options);
  27672. }
  27673. },
  27674. getValue: function () {
  27675. if (!this.editor) {
  27676. return this.code;
  27677. }
  27678. return this.editor.getValue();
  27679. },
  27680. applyPosition: function () {
  27681. var _this = this;
  27682. if (this.autoFocusMethod) {
  27683. if (this.editor) {
  27684. _$2.defer(function () {
  27685. if (_this.autoFocusStartLine) {
  27686. _this.editor.setPosition({
  27687. lineNumber: _this.autoFocusStartLine,
  27688. column: _this.autoFocusStartColumn
  27689. });
  27690. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27691. }
  27692. _this.editor.focus();
  27693. });
  27694. delete this.autoFocusMethod;
  27695. }
  27696. }
  27697. this.editor.layout();
  27698. },
  27699. setValue: function (value, fromEditor) {
  27700. this.setCode(value);
  27701. var me = this;
  27702. if (me.value === value) {
  27703. // 值相等,不需要变化
  27704. return;
  27705. }
  27706. if (fromEditor !== true && me.editor) {
  27707. // 不是来源于编辑器的变化,才设置编辑器的值
  27708. me.editor.setValue(value);
  27709. }
  27710. // 通知mixins setValue
  27711. me.value = value;
  27712. me.fireEvent('change', value);
  27713. },
  27714. initComponent: function () {
  27715. var that = this;
  27716. this.superclass.initComponent.call(this);
  27717. that.on({
  27718. resize: function () {
  27719. if (that.editor) {
  27720. that.editor.layout();
  27721. }
  27722. },
  27723. destory: function () {
  27724. if (that.editor) {
  27725. that.editor.dispose();
  27726. delete that.editor;
  27727. }
  27728. },
  27729. afterrender: function (sender) {
  27730. var $dom = $(that.el.dom).find('.editor');
  27731. attach_2($dom[0], {
  27732. value: that.code
  27733. }).then(function (editor) {
  27734. that.editor = editor;
  27735. that.applyPosition();
  27736. that.editor.onDidChangeModelContent(function (e) {
  27737. that.fireEvent('change', that.editor, e);
  27738. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27739. that.codeChange(that.editor.getValue(), that.name, e);
  27740. }
  27741. that.isChangeFromOuter = false;
  27742. });
  27743. });
  27744. }
  27745. });
  27746. }
  27747. });
  27748. }
  27749. function attach_2(element, opts) {
  27750. return new Promise(function (resolve) {
  27751. var monaco = window['monaco'];
  27752. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27753. enabled: false
  27754. } }));
  27755. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27756. // const sql = editor.getValue()
  27757. // if (_.trim(sql).length > 0) {
  27758. // editor.setValue(format(sql, {
  27759. // indent: ' ',
  27760. // uppercase: true,
  27761. // }))
  27762. // }
  27763. msg$1('没做');
  27764. });
  27765. editor.onKeyUp(function (e) {
  27766. // console.log(e)
  27767. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27768. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27769. }
  27770. });
  27771. resolve(editor);
  27772. });
  27773. }
  27774. //# sourceMappingURL=SqlEditor.js.map
  27775. function initTemplateEditor () {
  27776. Ext.define('com.yvan.studio.TemplateEditor', {
  27777. extend: 'Ext.panel.Panel',
  27778. alias: 'widget.templateeditor',
  27779. xtype: 'templateeditor',
  27780. layout: 'fit',
  27781. border: false,
  27782. html: "<div class=\"editor\"/>",
  27783. autoFocusMethod: true,
  27784. autoFocusStartLine: 0,
  27785. autoFocusStartColumn: 0,
  27786. codeChange: undefined,
  27787. funcArr: [],
  27788. modulePage: null,
  27789. isChangeFromOuter: false,
  27790. name: "",
  27791. /**
  27792. * 设置代码
  27793. */
  27794. setCode: function (value) {
  27795. var _this = this;
  27796. this.code = value;
  27797. _$2.defer(function () {
  27798. _this.isChangeFromOuter = true;
  27799. if (_this.editor) {
  27800. _this.editor.setValue(value);
  27801. }
  27802. });
  27803. },
  27804. getCode: function () {
  27805. var _a;
  27806. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27807. },
  27808. applyPosition: function () {
  27809. var _this = this;
  27810. if (this.autoFocusMethod) {
  27811. if (this.editor) {
  27812. _$2.defer(function () {
  27813. if (_this.autoFocusStartLine) {
  27814. _this.editor.setPosition({
  27815. lineNumber: _this.autoFocusStartLine,
  27816. column: _this.autoFocusStartColumn
  27817. });
  27818. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27819. }
  27820. _this.editor.focus();
  27821. });
  27822. delete this.autoFocusMethod;
  27823. }
  27824. }
  27825. this.editor.layout();
  27826. },
  27827. initComponent: function () {
  27828. var that = this;
  27829. this.superclass.initComponent.apply(this, arguments);
  27830. this.on({
  27831. resize: function (sender, width, height) {
  27832. if (that.editor) {
  27833. that.editor.layout();
  27834. }
  27835. },
  27836. destory: function () {
  27837. if (that.editor) {
  27838. that.editor.dispose();
  27839. delete that.editor;
  27840. }
  27841. },
  27842. afterrender: function (sender) {
  27843. var $dom = $(that.el.dom).find('.editor');
  27844. attach_117($dom[0], {
  27845. value: that.code
  27846. }).then(function (editor) {
  27847. that.editor = editor;
  27848. that.applyPosition();
  27849. that.editor.onDidChangeModelContent(function (e) {
  27850. that.fireEvent('change', that.editor, e);
  27851. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27852. that.codeChange(that.editor.getValue(), that.name, e);
  27853. }
  27854. that.isChangeFromOuter = false;
  27855. });
  27856. });
  27857. }
  27858. });
  27859. },
  27860. });
  27861. }
  27862. function attach_117(element, opts) {
  27863. return new Promise(function (resolve) {
  27864. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27865. enabled: false
  27866. } }));
  27867. editor.onKeyUp(function (e) {
  27868. // console.log(e)
  27869. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27870. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27871. }
  27872. });
  27873. resolve(editor);
  27874. });
  27875. }
  27876. //# sourceMappingURL=TemplateEditor.js.map
  27877. var DictStore = /** @class */ (function (_super) {
  27878. __extends(DictStore, _super);
  27879. function DictStore() {
  27880. return _super !== null && _super.apply(this, arguments) || this;
  27881. }
  27882. DictStore.prototype.getCacheKey = function (param) {
  27883. return "dict_data.json";
  27884. };
  27885. DictStore.prototype.invokeApi = function (param) {
  27886. return getDict(param);
  27887. };
  27888. DictStore.prototype.getDicts = function () {
  27889. return this.apiResponse.data.dict;
  27890. };
  27891. DictStore.prototype.getDictCodes = function () {
  27892. return new Promise(function (resolve) {
  27893. // reloadIfNeedPromise().then(() => {
  27894. // const result = []
  27895. // _.forEach(this.getDicts(), dictRow => {
  27896. // result.push({
  27897. // id: dictRow.dict_code,
  27898. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27899. // })
  27900. // })
  27901. // resolve(result)
  27902. // })
  27903. });
  27904. };
  27905. DictStore.prototype.saveDict = function (param) {
  27906. return saveDictApi(param);
  27907. };
  27908. DictStore.prototype.saveDictItems = function (param) {
  27909. return saveDictItemsApi(param);
  27910. };
  27911. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27912. var results = [];
  27913. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27914. if (dictItemRow.dict_code === dict_code) {
  27915. results.push(_$2.clone(dictItemRow));
  27916. }
  27917. });
  27918. return results;
  27919. };
  27920. return DictStore;
  27921. }(CacheStore));
  27922. var instance$2 = new DictStore();
  27923. //# sourceMappingURL=DictStore.js.map
  27924. var DictTreeController = /** @class */ (function () {
  27925. function DictTreeController() {
  27926. this._saveStateFlag = true;
  27927. }
  27928. DictTreeController.prototype.dictSave = function () {
  27929. var _this = this;
  27930. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27931. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27932. if (err) {
  27933. // 如果有异常就不保存
  27934. return;
  27935. }
  27936. // 进行业务上的逻辑校验,比如说必填校验等等
  27937. var hasError = false;
  27938. _$2.forEach(rows, function (row, i) {
  27939. if (isEmpty(row.dict_code)) {
  27940. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27941. hasError = true;
  27942. return false;
  27943. }
  27944. });
  27945. if (hasError) {
  27946. return;
  27947. }
  27948. // 设置当前界面为 "保存中..." 状态
  27949. this.view.setLoading(true);
  27950. instance$2.saveDict({
  27951. newRows: newRows,
  27952. modifyRows: modifyRows,
  27953. removeRecords: removeRecords,
  27954. }).then(function (res) {
  27955. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27956. msg$1(res.msg);
  27957. _this.reload();
  27958. }).finally(function () {
  27959. // 无论正常异常,关闭 "保存中..." 状态
  27960. _this.view.setLoading(false);
  27961. });
  27962. };
  27963. DictTreeController.prototype.dictItemSave = function () {
  27964. var _this = this;
  27965. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27966. var currentDictCode = undefined;
  27967. if (record) {
  27968. currentDictCode = record.get('dict_code');
  27969. }
  27970. if (!currentDictCode) {
  27971. msg$1('请选择一个字典');
  27972. return;
  27973. }
  27974. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27975. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27976. if (err) {
  27977. // 如果有异常就不保存
  27978. return;
  27979. }
  27980. // 进行业务上的逻辑校验,比如说必填校验等等
  27981. var hasError = false;
  27982. _$2.forEach(rows, function (row, i) {
  27983. if (!row.dict_value && row.dict_value !== 0) {
  27984. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27985. hasError = true;
  27986. return false;
  27987. }
  27988. });
  27989. if (hasError) {
  27990. return;
  27991. }
  27992. // 设置当前界面为 "保存中..." 状态
  27993. this.view.setLoading(true);
  27994. instance$2.saveDictItems({
  27995. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27996. newRows: newRows,
  27997. modifyRows: modifyRows,
  27998. removeRecords: removeRecords,
  27999. dict_code: currentDictCode
  28000. }).then(function (res) {
  28001. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28002. msg$1(res.msg);
  28003. _this.reload();
  28004. }).finally(function () {
  28005. // 无论正常异常,关闭 "保存中..." 状态
  28006. _this.view.setLoading(false);
  28007. });
  28008. };
  28009. DictTreeController.prototype.createDictEnum = function () {
  28010. var _this = this;
  28011. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28012. var currentDictCode = undefined;
  28013. if (record) {
  28014. currentDictCode = record.get('dict_code');
  28015. }
  28016. if (!currentDictCode) {
  28017. msg$1('请选择一个字典');
  28018. return;
  28019. }
  28020. // 设置当前界面为 "保存中..." 状态
  28021. this.view.setLoading(true);
  28022. createDictEnum({ dictCode: currentDictCode })
  28023. .then(function () { return _this.reload(); })
  28024. .finally(function () { return _this.view.setLoading(false); });
  28025. };
  28026. DictTreeController.prototype.onLoad = function () {
  28027. setDictTree(this);
  28028. this.grid1 = this.view.lookupReference('grid1');
  28029. this.grid2 = this.view.lookupReference('grid2');
  28030. this.grid1.setData([]);
  28031. this.grid2.setData([]);
  28032. // this.grid1.columns[0].hide()
  28033. this.grid2.columns[0].hide();
  28034. // 找管理器订阅刷新的事件
  28035. instance$2.registe(this.refreshData.bind(this));
  28036. // 非强制性刷新 DbManager
  28037. instance$2.reloadIfNeed(undefined);
  28038. };
  28039. DictTreeController.prototype.onDestory = function () {
  28040. instance$2.unregiste(this.refreshData.bind(this));
  28041. };
  28042. // dictStore 刷新时,会回调到这个方法
  28043. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28044. var me = this;
  28045. if (typeof isLoadingState === 'boolean') {
  28046. me.view.setLoading(isLoadingState);
  28047. return;
  28048. }
  28049. this.grid1.setData(instance$2.getDicts());
  28050. this.restoreState();
  28051. };
  28052. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28053. var _this = this;
  28054. _$2.defer(function () {
  28055. _this.saveState();
  28056. });
  28057. if (!record) {
  28058. this.grid2.setData([]);
  28059. return;
  28060. }
  28061. var dict_code = record.get('dict_code');
  28062. var data = instance$2.getDictItemByDictcode(dict_code);
  28063. this.grid2.setData(data);
  28064. };
  28065. DictTreeController.prototype.reload = function () {
  28066. var _this = this;
  28067. // 强制刷新 DbManager
  28068. instance$2.reloadForce(undefined).then(function (res) {
  28069. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28070. });
  28071. };
  28072. DictTreeController.prototype.dictAdd = function () {
  28073. this.grid1.appendEditRow({
  28074. _createFlag: true,
  28075. dict_code: '',
  28076. dict_desc: '',
  28077. }, 0);
  28078. };
  28079. DictTreeController.prototype.dictRemove = function () {
  28080. this.grid1.removeEditRow();
  28081. };
  28082. DictTreeController.prototype.dictItemAdd = function () {
  28083. var _a, _b;
  28084. var dict_code = (_b = (_a = this.grid1.selection) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.dict_code;
  28085. if (!dict_code) {
  28086. msg$1('请先保存字典');
  28087. return;
  28088. }
  28089. this.grid2.appendEditRow({
  28090. dict_code: dict_code,
  28091. dict_text: '',
  28092. dict_value: '',
  28093. }, 0);
  28094. };
  28095. DictTreeController.prototype.dictItemRemove = function () {
  28096. var _this = this;
  28097. var rows = [];
  28098. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28099. rows.push(r);
  28100. });
  28101. _$2.forEach(rows, function (r) {
  28102. _this.grid2.getStore().remove(r);
  28103. });
  28104. };
  28105. DictTreeController.prototype.clearSearch1 = function () {
  28106. this.grid1.store.clearFilter();
  28107. };
  28108. DictTreeController.prototype.search1 = function (sender) {
  28109. this.grid1.store.clearFilter();
  28110. this.getViewModel().set('grid1.selection', null);
  28111. this.grid1.fireEvent('itemselect');
  28112. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28113. if (!value) {
  28114. return;
  28115. }
  28116. this.grid1.store.filterBy(function (record) {
  28117. if (record.get('_createFlag')) {
  28118. return true;
  28119. }
  28120. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28121. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28122. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28123. return (dict_code.includes(value) ||
  28124. dict_desc.includes(value) ||
  28125. dict_desc_py.includes(value));
  28126. });
  28127. };
  28128. DictTreeController.prototype.clearSearch2 = function () {
  28129. this.grid2.store.clearFilter();
  28130. };
  28131. DictTreeController.prototype.search2 = function (sender) {
  28132. this.grid2.store.clearFilter();
  28133. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28134. if (!value) {
  28135. return;
  28136. }
  28137. this.grid2.store.filterBy(function (record) {
  28138. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28139. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28140. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28141. return (dict_text.includes(value) ||
  28142. dict_value === value ||
  28143. dict_text_py.includes(value));
  28144. });
  28145. };
  28146. DictTreeController.prototype.getStateFilename = function () {
  28147. return getCurrentProject().uuid + "/dicttree.json";
  28148. };
  28149. DictTreeController.prototype.restoreState = function () {
  28150. var _this = this;
  28151. var grid = this.grid1;
  28152. native.loadFile(this.getStateFilename(), function (content) {
  28153. if (!content)
  28154. return;
  28155. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28156. _this._saveStateFlag = false;
  28157. if (selection) {
  28158. var idx = grid.store.findExact('dict_code', selection);
  28159. if (idx >= 0) {
  28160. var record = grid.store.getAt(idx);
  28161. if (record) {
  28162. grid.setSelection([record]);
  28163. }
  28164. }
  28165. }
  28166. if (scrollPosition && scrollSize) {
  28167. var size = grid.scrollable.getSize();
  28168. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28169. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28170. }
  28171. }
  28172. setTimeout(function () {
  28173. _this._saveStateFlag = true;
  28174. }, 200);
  28175. });
  28176. };
  28177. DictTreeController.prototype.saveState = function () {
  28178. if (!this._saveStateFlag) {
  28179. return;
  28180. }
  28181. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28182. var selection = undefined;
  28183. if (record) {
  28184. selection = record.get('dict_code');
  28185. }
  28186. var scrollPosition = this.grid1.scrollable.position;
  28187. var scrollSize = this.grid1.scrollable.getSize();
  28188. native.saveFile(this.getStateFilename(), {
  28189. selection: selection,
  28190. scrollPosition: scrollPosition,
  28191. scrollSize: scrollSize
  28192. });
  28193. };
  28194. return DictTreeController;
  28195. }());
  28196. //# sourceMappingURL=DictTreeController.js.map
  28197. function initDict$1 () {
  28198. var controller = new DictTreeController();
  28199. Ext.define('com.yvan.studio.DictTree', {
  28200. extend: 'Ext.panel.Panel',
  28201. xtype: 'dicttree',
  28202. controller: controller,
  28203. scope: controller,
  28204. referenceHolder: true,
  28205. tooltip: '字典',
  28206. iconCls: 'x-fa fa-book',
  28207. rootVisible: false,
  28208. useArrows: true,
  28209. reference: 'dicttree',
  28210. layout: 'border',
  28211. listeners: {
  28212. afterrender: 'onLoad',
  28213. destory: 'onDestory',
  28214. },
  28215. items: [
  28216. {
  28217. region: 'center',
  28218. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28219. _mode: 'select',
  28220. tbar: [
  28221. {
  28222. xtype: 'button',
  28223. tooltip: '刷新',
  28224. iconCls: 'x-fa fa-refresh',
  28225. listeners: {
  28226. click: 'reload'
  28227. }
  28228. },
  28229. {
  28230. xtype: 'button',
  28231. tooltip: '添加',
  28232. iconCls: 'x-fa fa-plus-circle',
  28233. listeners: {
  28234. click: 'dictAdd'
  28235. }
  28236. },
  28237. {
  28238. xtype: 'button',
  28239. tooltip: '删除',
  28240. iconCls: 'x-fa fa-minus-circle',
  28241. bind: {
  28242. disabled: '{!grid1.selection}'
  28243. },
  28244. listeners: {
  28245. click: 'dictRemove'
  28246. }
  28247. },
  28248. {
  28249. xtype: 'button',
  28250. tooltip: '保存',
  28251. iconCls: 'x-fa fa-save',
  28252. bind: {
  28253. disabled: '{!grid1.ischanged}'
  28254. },
  28255. listeners: {
  28256. click: 'dictSave'
  28257. }
  28258. },
  28259. {
  28260. xtype: 'textfield',
  28261. hideClear: true,
  28262. triggers: {
  28263. clear: {
  28264. cls: 'x-form-clear-trigger',
  28265. handler: 'clearSearch1'
  28266. },
  28267. },
  28268. flex: 1,
  28269. emptyText: '搜索过滤',
  28270. enableKeyEvents: true,
  28271. listeners: {
  28272. keyup: {
  28273. fn: 'search1',
  28274. buffer: 50
  28275. }
  28276. }
  28277. },
  28278. ],
  28279. listeners: {
  28280. itemselect: 'grid1Selected',
  28281. },
  28282. idField: 'dict_code',
  28283. columns: [
  28284. {
  28285. text: '字典编号', dataIndex: 'dict_code',
  28286. menuDisabled: true, flex: 1,
  28287. editor: {
  28288. allowBlank: true,
  28289. selectOnFocus: false
  28290. }
  28291. },
  28292. {
  28293. text: '中文描述', dataIndex: 'dict_desc',
  28294. menuDisabled: true, flex: 1,
  28295. editor: {
  28296. allowBlank: true,
  28297. selectOnFocus: false
  28298. }
  28299. },
  28300. ]
  28301. },
  28302. {
  28303. region: 'south', height: '50%',
  28304. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28305. split: true,
  28306. _mode: 'edit1',
  28307. listeners: {},
  28308. tbar: [
  28309. {
  28310. xtype: 'button',
  28311. tooltip: '添加',
  28312. iconCls: 'x-fa fa-plus-circle',
  28313. bind: {
  28314. disabled: '{!grid1.selection}'
  28315. },
  28316. listeners: {
  28317. click: 'dictItemAdd'
  28318. }
  28319. },
  28320. {
  28321. xtype: 'button',
  28322. tooltip: '删除',
  28323. iconCls: 'x-fa fa-minus-circle',
  28324. bind: {
  28325. disabled: '{!grid1.selection}'
  28326. },
  28327. listeners: {
  28328. click: 'dictItemRemove'
  28329. }
  28330. },
  28331. {
  28332. xtype: 'button',
  28333. tooltip: '保存',
  28334. iconCls: 'x-fa fa-save',
  28335. bind: {
  28336. disabled: '{!grid2.ischanged}'
  28337. },
  28338. listeners: {
  28339. click: 'dictItemSave'
  28340. }
  28341. },
  28342. {
  28343. xtype: 'button',
  28344. tooltip: '刷新代码',
  28345. iconCls: 'x-fa fa-code',
  28346. bind: {
  28347. disabled: '{!grid1.selection}'
  28348. },
  28349. listeners: {
  28350. click: 'createDictEnum'
  28351. }
  28352. },
  28353. ],
  28354. columns: [
  28355. {
  28356. text: '字典项', dataIndex: 'dict_text',
  28357. menuDisabled: true, flex: 1,
  28358. editor: {
  28359. allowBlank: true,
  28360. selectOnFocus: false
  28361. }
  28362. },
  28363. {
  28364. text: '字典值', dataIndex: 'dict_value',
  28365. menuDisabled: true, flex: 1,
  28366. dataType: 'int',
  28367. editor: {
  28368. xtype: 'numberfield',
  28369. allowBlank: true,
  28370. selectOnFocus: false
  28371. }
  28372. },
  28373. {
  28374. text: '激活', dataIndex: 'is_enable',
  28375. xtype: 'checkcolumn', menuDisabled: true,
  28376. },
  28377. {
  28378. text: '变量名', dataIndex: 'var_name',
  28379. menuDisabled: true, flex: 1,
  28380. editor: {
  28381. allowBlank: true,
  28382. selectOnFocus: false
  28383. }
  28384. },
  28385. ]
  28386. }
  28387. ]
  28388. });
  28389. }
  28390. //# sourceMappingURL=DictTree.js.map
  28391. var model$g = {
  28392. data: {
  28393. form: {
  28394. path: "",
  28395. requestBody: "",
  28396. responseBody: "",
  28397. }
  28398. }
  28399. };
  28400. var vjson$f = {
  28401. title: '接口信息',
  28402. layout: 'fit',
  28403. width: 800,
  28404. height: 500,
  28405. items: [
  28406. {
  28407. xtype: 'form',
  28408. layout: {
  28409. type: 'vbox',
  28410. pack: 'start',
  28411. align: 'stretch'
  28412. },
  28413. defaults: {
  28414. border: false,
  28415. anchor: '100%',
  28416. margin: '5',
  28417. },
  28418. items: [
  28419. {
  28420. xtype: 'textfield',
  28421. fieldLabel: '接口路径',
  28422. bind: {
  28423. value: "{form.path}",
  28424. },
  28425. },
  28426. {
  28427. xtype: 'textareafield',
  28428. // height: 150,
  28429. flex: 2,
  28430. fieldLabel: '请求数据',
  28431. bind: {
  28432. value: "{form.requestBody}",
  28433. },
  28434. },
  28435. {
  28436. xtype: 'textareafield',
  28437. // height: 150,
  28438. flex: 5,
  28439. fieldLabel: '响应数据',
  28440. bind: {
  28441. value: "{form.responseBody}",
  28442. },
  28443. },
  28444. ]
  28445. }
  28446. ]
  28447. };
  28448. var ApiInfoDialog = /** @class */ (function (_super) {
  28449. __extends(ApiInfoDialog, _super);
  28450. function ApiInfoDialog() {
  28451. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28452. }
  28453. return ApiInfoDialog;
  28454. }(Scope));
  28455. //# sourceMappingURL=apiInfoDialog.js.map
  28456. var model$h = {
  28457. data: {
  28458. query: {
  28459. role_id: '',
  28460. resource_id: '',
  28461. },
  28462. form: {},
  28463. form2: {
  28464. key: "",
  28465. start_at: "",
  28466. end_at: "",
  28467. }
  28468. }
  28469. };
  28470. var vjson$g = {
  28471. title: '接口信息',
  28472. layout: 'fit',
  28473. items: [
  28474. {
  28475. layout: 'border',
  28476. border: false,
  28477. items: [
  28478. {
  28479. region: 'center',
  28480. layout: 'border',
  28481. items: [
  28482. {
  28483. region: 'north',
  28484. bind: {
  28485. title: '{form.title}',
  28486. },
  28487. xtype: 'form',
  28488. scrollable: true,
  28489. layout: {
  28490. type: 'vbox',
  28491. pack: 'start',
  28492. align: 'stretch'
  28493. },
  28494. defaults: {
  28495. border: false,
  28496. anchor: '100%',
  28497. margin: '5',
  28498. },
  28499. tbar: {
  28500. xtype: 'toolbar',
  28501. items: [
  28502. {
  28503. xtype: 'button',
  28504. text: '查询',
  28505. iconCls: 'x-fa fa-search',
  28506. listeners: {
  28507. click: 'scope.requestLogs'
  28508. },
  28509. },
  28510. {
  28511. xtype: 'button',
  28512. text: '保存',
  28513. iconCls: 'x-fa fa-save',
  28514. listeners: {},
  28515. },
  28516. {
  28517. xtype: 'button',
  28518. text: '禁用',
  28519. iconCls: 'x-fa fa-stop-circle',
  28520. bind: {},
  28521. listeners: {},
  28522. },
  28523. {
  28524. xtype: 'button',
  28525. text: '启用',
  28526. iconCls: 'x-fa fa-play-circle',
  28527. bind: {},
  28528. listeners: {},
  28529. },
  28530. ],
  28531. },
  28532. items: [
  28533. {
  28534. xtype: 'cols',
  28535. defaults: { labelWidth: 120 },
  28536. items: [
  28537. {
  28538. xtype: 'textfield',
  28539. fieldLabel: 'URL',
  28540. bind: {
  28541. value: '{form.api_url}',
  28542. },
  28543. readOnly: true,
  28544. },
  28545. {
  28546. xtype: 'textfield',
  28547. fieldLabel: '名称',
  28548. bind: {
  28549. value: '{form.api_name}',
  28550. },
  28551. readOnly: true,
  28552. },
  28553. ],
  28554. },
  28555. {
  28556. xtype: 'cols',
  28557. defaults: { labelWidth: 120 },
  28558. items: [
  28559. {
  28560. xtype: 'textfield',
  28561. fieldLabel: '实现类',
  28562. bind: {
  28563. value: '{form.api_class}',
  28564. },
  28565. readOnly: true,
  28566. },
  28567. {
  28568. border: false,
  28569. flex: 1
  28570. },
  28571. ]
  28572. },
  28573. {
  28574. xtype: 'cols',
  28575. defaults: { labelWidth: 120 },
  28576. items: [
  28577. {
  28578. xtype: 'textfield',
  28579. fieldLabel: '超时时间',
  28580. bind: {
  28581. value: '{form.timeout}',
  28582. },
  28583. readOnly: true,
  28584. },
  28585. {
  28586. border: false,
  28587. flex: 1
  28588. },
  28589. ]
  28590. },
  28591. {
  28592. xtype: 'cols',
  28593. defaults: { labelWidth: 120 },
  28594. items: [
  28595. {
  28596. xtype: 'textfield',
  28597. fieldLabel: 'Remote IP',
  28598. bind: {
  28599. value: '{form.remote_ip}',
  28600. },
  28601. readOnly: true,
  28602. },
  28603. {
  28604. border: false,
  28605. flex: 1
  28606. },
  28607. ]
  28608. },
  28609. {
  28610. xtype: 'cols',
  28611. defaults: { labelWidth: 120 },
  28612. items: [
  28613. {
  28614. xtype: 'textfield',
  28615. fieldLabel: '解析表单',
  28616. bind: {
  28617. value: '{form.chandi}',
  28618. },
  28619. readOnly: true,
  28620. },
  28621. {
  28622. border: false,
  28623. flex: 1
  28624. },
  28625. ]
  28626. },
  28627. ],
  28628. },
  28629. {
  28630. region: 'center',
  28631. // title: 'Request',
  28632. layout: 'border',
  28633. items: [
  28634. {
  28635. region: 'north',
  28636. xtype: 'form',
  28637. reference: 'form2',
  28638. split: true,
  28639. items: [
  28640. {
  28641. xtype: 'cols',
  28642. width: 700,
  28643. items: [
  28644. {
  28645. xtype: 'textfield',
  28646. fieldLabel: '关键字',
  28647. bind: {
  28648. value: "{form2.key}"
  28649. },
  28650. },
  28651. {
  28652. xtype: 'datefield',
  28653. fieldLabel: '开始时间',
  28654. bind: {
  28655. value: "{form2.start_at}"
  28656. },
  28657. },
  28658. {
  28659. xtype: 'datefield',
  28660. fieldLabel: '结束时间',
  28661. bind: {
  28662. value: "{form2.end_at}"
  28663. },
  28664. },
  28665. ]
  28666. }
  28667. ]
  28668. },
  28669. {
  28670. region: 'center',
  28671. xtype: 'yvgrid',
  28672. layout: 'fit',
  28673. reference: 'grid1',
  28674. pagination: true,
  28675. autoLoad: false,
  28676. selModel: {
  28677. selType: 'rowmodel',
  28678. mode: 'SINGLE',
  28679. },
  28680. dataSource: {
  28681. method: 'invoke',
  28682. url: '/sys/api/Api@requestLogs',
  28683. params: {
  28684. formData: '{form2}',
  28685. path: '{form.api_url}',
  28686. },
  28687. },
  28688. listeners: {
  28689. rowdblclick: 'scope.showDialog',
  28690. },
  28691. columns: [
  28692. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28693. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28694. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28695. { dataIndex: "size", header: "大小", width: 80 },
  28696. { dataIndex: "path", header: "path", flex: 1 },
  28697. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28698. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28699. ]
  28700. }
  28701. ]
  28702. },
  28703. ],
  28704. },
  28705. ],
  28706. },
  28707. ],
  28708. referenceHolder: true,
  28709. };
  28710. var Api = /** @class */ (function (_super) {
  28711. __extends(Api, _super);
  28712. function Api() {
  28713. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28714. }
  28715. Api.prototype.onLoad = function () {
  28716. _super.prototype.onLoad.call(this);
  28717. this.requestLogs();
  28718. };
  28719. Api.prototype.selectList = function (sender, selected, eOpts) {
  28720. this.viewModel.set("form", selected.data);
  28721. if (selected.data.api_type === '1') {
  28722. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28723. }
  28724. else {
  28725. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28726. }
  28727. };
  28728. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28729. var sel = [];
  28730. _$2.forEach(records, function (item) {
  28731. if (item.data.flg === 'Y') {
  28732. sel.push(item);
  28733. }
  28734. });
  28735. this.refs.methodGrid.selModel.select(sel);
  28736. };
  28737. Api.prototype.saveAll = function () {
  28738. var _this = this;
  28739. var _a, _b, _c;
  28740. var role_id = this.viewModel.get("query.role_id");
  28741. if (!role_id) {
  28742. msg$1("请先选择一个角色");
  28743. return;
  28744. }
  28745. var wh_id = this.viewModel.get("form.wh_id");
  28746. if (!wh_id) {
  28747. msg$1("请先选择一个仓库");
  28748. return;
  28749. }
  28750. var menus = this.refs.theTree.getChecked();
  28751. var rowsMenus = [];
  28752. _$2.forEach(menus, function (m) {
  28753. if (m.data.resource_id) {
  28754. rowsMenus.push(m.data.resource_id);
  28755. }
  28756. });
  28757. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28758. var methodsArry = (_c = (_b = this.refs.methodGrid.selModel.selected) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.map(function (r) { return r.data.resource_id; });
  28759. _$2.remove(mm, function (x) {
  28760. return methodsArry.includes(x.resource_id);
  28761. });
  28762. var rowsBtn = [];
  28763. _$2.forEach(mm, function (m) {
  28764. rowsBtn.push({ resource_id: m.resource_id });
  28765. });
  28766. this.setLoading(true);
  28767. invokeServer$1('/sys/role/Role@saveAll', {
  28768. wh_id: wh_id,
  28769. role_id: role_id,
  28770. rowsMenus: rowsMenus,
  28771. rowsBtn: rowsBtn,
  28772. }).then(function (res) {
  28773. msg$1(res.msg);
  28774. if (res.success) {
  28775. _this.reloadTree();
  28776. // this.viewModel.set('query.role_id', '')
  28777. _this.viewModel.set('query.resource_id', '');
  28778. _this.refs.methodGrid.reload();
  28779. }
  28780. }).finally(function () {
  28781. _this.setLoading(false);
  28782. });
  28783. };
  28784. Api.prototype.editRoleSuccess = function (sender, data) {
  28785. if (data.success) {
  28786. this.refs.roleGrid.reload();
  28787. this.viewModel.set("query.JIAOS_ID", "");
  28788. this.reloadTree();
  28789. this.viewModel.set("query.CAID_ID", "");
  28790. this.refs.methodGrid.reload();
  28791. }
  28792. };
  28793. Api.prototype.deleteRole = function (sender) {
  28794. var _this = this;
  28795. var role_id = this.viewModel.get("query.role_id");
  28796. if (!role_id) {
  28797. msg$1("请先选择一个角色");
  28798. return;
  28799. }
  28800. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28801. if (btn === 'yes') {
  28802. invokeServer$1('/sys/role/Role@deleteRole', {
  28803. role_id: role_id,
  28804. wh_id: window['whId']
  28805. }).then(function (res) {
  28806. msg$1(res.msg);
  28807. if (res.success) {
  28808. _this.refs.roleGrid.reload();
  28809. _this.viewModel.set("query.role_id", "");
  28810. _this.reloadTree();
  28811. _this.refs.methodGrid.reload();
  28812. }
  28813. });
  28814. }
  28815. });
  28816. };
  28817. Api.prototype.reloadTree = function () {
  28818. showErrorDialog$1('reloadTree 不存在');
  28819. };
  28820. Api.prototype.whChange = function (sender, value) {
  28821. this.viewModel.set("form.wh_id", value);
  28822. this.reloadTree();
  28823. this.refs.methodGrid.reload();
  28824. };
  28825. Api.prototype.requestLogs = function () {
  28826. var path = this.viewModel.get("form.api_url");
  28827. if (!path)
  28828. return;
  28829. this.refs.grid1.reload();
  28830. };
  28831. Api.prototype.showDialog = function (sender) {
  28832. var _a, _b;
  28833. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  28834. if (!rows || rows.length <= 0)
  28835. return;
  28836. var dialog = new ApiInfoDialog();
  28837. dialog.showDialog(null, {}, {
  28838. data: {
  28839. form: __assign({}, rows[0])
  28840. }
  28841. });
  28842. };
  28843. return Api;
  28844. }(Scope));
  28845. //# sourceMappingURL=ApiPage.js.map
  28846. var Controller = /** @class */ (function () {
  28847. function Controller() {
  28848. }
  28849. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28850. var _a, _b, _c, _d, _e, _f, _g, _h;
  28851. // @ts-ignore
  28852. var rows = (_b = (_a = this.getReferences()['roleGrid'].selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  28853. if (!rows || rows.length <= 0)
  28854. return;
  28855. var apiPage = new Api();
  28856. apiPage.showPage({
  28857. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28858. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28859. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28860. }, {
  28861. data: {
  28862. form: __assign({}, rows[0])
  28863. }
  28864. });
  28865. };
  28866. return Controller;
  28867. }());
  28868. var controller = new Controller();
  28869. function initApiTree () {
  28870. Ext.define('com.yvan.studio.ApiGrid', {
  28871. extend: 'Ext.Panel',
  28872. xtype: 'apigrid',
  28873. controller: controller,
  28874. scope: controller,
  28875. referenceHolder: true,
  28876. layout: 'fit',
  28877. items: [
  28878. {
  28879. width: 400,
  28880. split: true,
  28881. xtype: 'yvgrid',
  28882. reference: 'roleGrid',
  28883. border: false,
  28884. pagination: false,
  28885. autoLoad: true,
  28886. remoteFilter: false,
  28887. selModel: {
  28888. selType: 'rowmodel',
  28889. mode: 'SINGLE',
  28890. },
  28891. tbar: {
  28892. xtype: 'toolbar',
  28893. items: [
  28894. {
  28895. xtype: 'button',
  28896. text: '新增',
  28897. iconCls: 'x-fa fa-plus-circle',
  28898. listeners: {},
  28899. },
  28900. {
  28901. xtype: 'button',
  28902. text: '删除',
  28903. iconCls: 'x-fa fa-trash',
  28904. bind: {
  28905. disabled: '{roleGrid.selection==null}',
  28906. },
  28907. listeners: {},
  28908. },
  28909. ],
  28910. },
  28911. dataSource: {
  28912. url: '/sys/api/Api@getApiList',
  28913. method: 'invoke',
  28914. params: {},
  28915. },
  28916. listeners: {
  28917. itemdblclick: "selectList",
  28918. },
  28919. columns: [
  28920. {
  28921. dataIndex: 'api_name',
  28922. header: '接口名称',
  28923. filter: { type: 'string' },
  28924. flex: 1,
  28925. },
  28926. ],
  28927. },
  28928. ]
  28929. });
  28930. }
  28931. //# sourceMappingURL=ApiTree.js.map
  28932. var model$i = {
  28933. data: {
  28934. iframeSrc: ''
  28935. }
  28936. };
  28937. var vjson$h = {
  28938. layout: 'fit',
  28939. border: false,
  28940. iconCls: 'x-fa fa-newspaper-o',
  28941. referenceHolder: true,
  28942. items: [
  28943. {
  28944. // title: 'view.design',
  28945. xtype: 'uxiframe',
  28946. layout: 'fit',
  28947. // cls: 'module_page_iframe',
  28948. reference: 'iframe',
  28949. listeners: {
  28950. afterrender: 'scope.iframeRender'
  28951. }
  28952. },
  28953. ]
  28954. };
  28955. var Iframe = /** @class */ (function (_super) {
  28956. __extends(Iframe, _super);
  28957. function Iframe(path) {
  28958. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28959. _this.path = "";
  28960. _this.path = path;
  28961. return _this;
  28962. }
  28963. Iframe.prototype.iframeRender = function (sender) {
  28964. var $dom = $(sender.el.dom).find('iframe');
  28965. var iframe = $dom[0];
  28966. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28967. iframe.onload = function () {
  28968. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28969. };
  28970. };
  28971. return Iframe;
  28972. }(Scope));
  28973. //# sourceMappingURL=Iframe.js.map
  28974. var Controller$1 = /** @class */ (function () {
  28975. function Controller() {
  28976. }
  28977. Controller.prototype.onDblClick = function (sender, record) {
  28978. var data = record.raw;
  28979. if (data.text === "运行报表") {
  28980. this.openIframe("/xxl-job/index", "运行报表");
  28981. }
  28982. else if (data.text === "任务管理") {
  28983. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28984. }
  28985. else if (data.text === "调度日志") {
  28986. this.openIframe("/xxl-job/joblog", "调度日志");
  28987. }
  28988. else if (data.text === "执行器管理") {
  28989. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28990. }
  28991. };
  28992. Controller.prototype.openIframe = function (path, title) {
  28993. var page = new Iframe(path);
  28994. page.showPage({
  28995. title: title,
  28996. id: 'xxljob__' + path.replaceAll("/", "_"),
  28997. path: 'xxljob__' + path.replaceAll("/", "_"),
  28998. }, {});
  28999. };
  29000. Controller.prototype.onLoad = function () {
  29001. var me = this;
  29002. me.getView().setRootNode({
  29003. expanded: true,
  29004. leaf: false,
  29005. children: [
  29006. { leaf: true, text: '运行报表' },
  29007. { leaf: true, text: '任务管理' },
  29008. { leaf: true, text: '调度日志' },
  29009. { leaf: true, text: '执行器管理' },
  29010. ]
  29011. });
  29012. };
  29013. return Controller;
  29014. }());
  29015. var controller$1 = new Controller$1();
  29016. function initTaskTree () {
  29017. Ext.define('com.yvan.studio.TaskTree', {
  29018. extend: 'Ext.tree.Panel',
  29019. xtype: 'tasktree',
  29020. controller: controller$1,
  29021. scope: controller$1,
  29022. reference: 'roleGrid',
  29023. tooltip: '表单定义',
  29024. iconCls: 'x-fa fa-bar-chart',
  29025. useArrows: true,
  29026. rootVisible: false,
  29027. colspan: 2,
  29028. lines: true,
  29029. multiSelect: false,
  29030. referenceHolder: true,
  29031. // openNode() {
  29032. // const selection = this.getSelection()
  29033. // const [record] = selection
  29034. // if (!record) {
  29035. // return
  29036. // }
  29037. //
  29038. // const {raw} = record;
  29039. // if (raw.type === 'Dir') {
  29040. // return
  29041. // }
  29042. // if (raw.type === "Module" && raw.module) {
  29043. // // eventBus.publish(EventType.ModuleOpen, raw)
  29044. // }
  29045. // },
  29046. listeners: {
  29047. itemdblclick: 'onDblClick',
  29048. afterrender: "onLoad",
  29049. },
  29050. });
  29051. }
  29052. //# sourceMappingURL=TaskTree.js.map
  29053. var model$j = {
  29054. data: {
  29055. form: {
  29056. address: "",
  29057. level: "",
  29058. logger: "",
  29059. message: "",
  29060. nodeName: "",
  29061. serverName: "",
  29062. thread: "",
  29063. whId: "",
  29064. userId: "",
  29065. }
  29066. }
  29067. };
  29068. var vjson$i = {
  29069. title: '接口信息',
  29070. layout: 'fit',
  29071. width: 800,
  29072. height: 600,
  29073. items: [
  29074. {
  29075. xtype: 'form',
  29076. layout: {
  29077. type: 'vbox',
  29078. pack: 'start',
  29079. align: 'stretch'
  29080. },
  29081. defaults: {
  29082. border: false,
  29083. anchor: '100%',
  29084. margin: '5',
  29085. },
  29086. items: [
  29087. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29088. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29089. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29090. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29091. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29092. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29093. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29094. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29095. {
  29096. xtype: 'textareafield',
  29097. flex: 5,
  29098. fieldLabel: '响应数据',
  29099. bind: {
  29100. value: "{form.message}",
  29101. },
  29102. },
  29103. ]
  29104. }
  29105. ]
  29106. };
  29107. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29108. __extends(ApiInfoDialog, _super);
  29109. function ApiInfoDialog() {
  29110. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29111. }
  29112. return ApiInfoDialog;
  29113. }(Scope));
  29114. //# sourceMappingURL=LogPageDialog.js.map
  29115. var model$k = {
  29116. data: {
  29117. form2: {}
  29118. }
  29119. };
  29120. var vjson$j = {
  29121. title: '日志查询',
  29122. layout: 'fit',
  29123. width: "70%",
  29124. height: "80%",
  29125. items: [
  29126. {
  29127. region: 'center',
  29128. xtype: 'yvgrid',
  29129. layout: 'fit',
  29130. reference: 'grid1',
  29131. pagination: false,
  29132. autoLoad: false,
  29133. selModel: {
  29134. selType: 'rowmodel',
  29135. mode: 'SINGLE',
  29136. },
  29137. dataSource: {
  29138. method: 'invoke',
  29139. url: '/sys/api/Api@aroundLogs',
  29140. params: {
  29141. formData: '{form2}',
  29142. },
  29143. },
  29144. listeners: {
  29145. rowdblclick: 'scope.showDialog2',
  29146. },
  29147. columns: [
  29148. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29149. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29150. { dataIndex: "thread", header: "thread", width: 150 },
  29151. { dataIndex: "message", header: "message", flex: 1 },
  29152. ]
  29153. }
  29154. ]
  29155. };
  29156. var AroundLog = /** @class */ (function (_super) {
  29157. __extends(AroundLog, _super);
  29158. function AroundLog() {
  29159. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29160. }
  29161. AroundLog.prototype.onLoad = function () {
  29162. _super.prototype.onLoad.call(this);
  29163. this.queryLog();
  29164. };
  29165. AroundLog.prototype.queryLog = function () {
  29166. this.refs.grid1.reload();
  29167. };
  29168. AroundLog.prototype.showDialog2 = function () {
  29169. var _a, _b;
  29170. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  29171. if (!rows || rows.length <= 0)
  29172. return;
  29173. var dialog = new ApiInfoDialog$1();
  29174. dialog.showDialog(null, {}, {
  29175. data: {
  29176. form: __assign({}, rows[0])
  29177. }
  29178. });
  29179. };
  29180. return AroundLog;
  29181. }(Scope));
  29182. //# sourceMappingURL=AroundLog.js.map
  29183. var model$l = {
  29184. data: {
  29185. form2: {
  29186. key: "",
  29187. start_at: "",
  29188. end_at: "",
  29189. }
  29190. }
  29191. };
  29192. var vjson$k = {
  29193. title: '日志查询',
  29194. layout: 'fit',
  29195. tbar: {
  29196. xtype: 'toolbar',
  29197. items: [
  29198. {
  29199. xtype: 'button',
  29200. text: '刷新',
  29201. listeners: {
  29202. click: 'scope.queryLog'
  29203. },
  29204. },
  29205. {
  29206. xtype: 'button',
  29207. text: '周围日志',
  29208. bind: {},
  29209. listeners: {
  29210. click: 'scope.aroundLogs'
  29211. },
  29212. },
  29213. ],
  29214. },
  29215. items: [
  29216. {
  29217. region: 'center',
  29218. xtype: 'yvgrid',
  29219. layout: 'fit',
  29220. reference: 'grid1',
  29221. pagination: true,
  29222. autoLoad: false,
  29223. selModel: {
  29224. selType: 'rowmodel',
  29225. mode: 'SINGLE',
  29226. },
  29227. dataSource: {
  29228. method: 'invoke',
  29229. url: '/sys/api/Api@queryLog',
  29230. params: {
  29231. formData: '{form2}',
  29232. path: '{form.api_url}',
  29233. },
  29234. },
  29235. listeners: {
  29236. rowdblclick: 'scope.showDialog',
  29237. },
  29238. columns: [
  29239. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29240. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29241. { dataIndex: "thread", header: "thread", width: 150 },
  29242. { dataIndex: "message", header: "message", flex: 1 },
  29243. ]
  29244. }
  29245. ]
  29246. };
  29247. var LogPage = /** @class */ (function (_super) {
  29248. __extends(LogPage, _super);
  29249. function LogPage() {
  29250. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29251. }
  29252. LogPage.prototype.onLoad = function () {
  29253. _super.prototype.onLoad.call(this);
  29254. this.queryLog();
  29255. };
  29256. LogPage.prototype.queryLog = function () {
  29257. this.refs.grid1.reload();
  29258. };
  29259. LogPage.prototype.showDialog = function () {
  29260. var _a, _b;
  29261. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  29262. if (!rows || rows.length <= 0)
  29263. return;
  29264. var dialog = new ApiInfoDialog$1();
  29265. dialog.showDialog(null, {}, {
  29266. data: {
  29267. form: __assign({}, rows[0])
  29268. }
  29269. });
  29270. };
  29271. LogPage.prototype.aroundLogs = function () {
  29272. var _a, _b;
  29273. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  29274. if (!rows || rows.length <= 0)
  29275. return;
  29276. var dialog = new AroundLog();
  29277. dialog.showDialog(null, {}, {
  29278. data: {
  29279. form2: __assign({}, rows[0])
  29280. }
  29281. });
  29282. };
  29283. return LogPage;
  29284. }(Scope));
  29285. //# sourceMappingURL=LogPage.js.map
  29286. var Controller$2 = /** @class */ (function () {
  29287. function Controller() {
  29288. }
  29289. Controller.prototype.queryLog = function () {
  29290. var form2 = this.getViewModel().get("form2");
  29291. var logPage = new LogPage();
  29292. logPage.showPage({}, {
  29293. data: {
  29294. form2: __assign({}, form2)
  29295. }
  29296. });
  29297. };
  29298. return Controller;
  29299. }());
  29300. var controller$2 = new Controller$2();
  29301. function initLogsTree () {
  29302. Ext.define('com.yvan.studio.LogsTree', {
  29303. extend: 'Ext.panel.Panel',
  29304. xtype: 'logstree',
  29305. controller: controller$2,
  29306. scope: controller$2,
  29307. viewModel: {
  29308. data: {
  29309. form2: {
  29310. key: "",
  29311. start_at: "",
  29312. end_at: "",
  29313. }
  29314. }
  29315. },
  29316. reference: 'logstree',
  29317. tooltip: '表单定义',
  29318. iconCls: 'x-fa fa-bar-chart',
  29319. useArrows: true,
  29320. rootVisible: false,
  29321. colspan: 2,
  29322. lines: true,
  29323. multiSelect: false,
  29324. referenceHolder: true,
  29325. items: [
  29326. {
  29327. region: 'north',
  29328. xtype: 'form',
  29329. reference: 'form2',
  29330. split: true,
  29331. items: [
  29332. {
  29333. xtype: 'textfield',
  29334. fieldLabel: '关键字',
  29335. bind: {
  29336. value: "{form2.key}"
  29337. },
  29338. },
  29339. {
  29340. xtype: 'datefield',
  29341. fieldLabel: '开始时间',
  29342. bind: {
  29343. value: "{form2.start_at}"
  29344. },
  29345. },
  29346. {
  29347. xtype: 'datefield',
  29348. fieldLabel: '结束时间',
  29349. bind: {
  29350. value: "{form2.end_at}"
  29351. },
  29352. },
  29353. ]
  29354. },
  29355. {
  29356. xtype: "cols",
  29357. items: [
  29358. {
  29359. xtype: "box",
  29360. },
  29361. {
  29362. xtype: "button",
  29363. text: '查询',
  29364. listeners: {
  29365. click: 'queryLog'
  29366. },
  29367. },
  29368. {
  29369. xtype: "box",
  29370. },
  29371. ]
  29372. },
  29373. ],
  29374. });
  29375. }
  29376. //# sourceMappingURL=LogsTree.js.map
  29377. var model$m = {
  29378. data: {
  29379. // opsId: "",
  29380. // name: "",
  29381. running: false,
  29382. }
  29383. };
  29384. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29385. var vjson$l = {
  29386. bind: {
  29387. title: '运维-{name}',
  29388. },
  29389. layout: 'fit',
  29390. items: [
  29391. {
  29392. layout: 'border',
  29393. items: [
  29394. {
  29395. region: 'north',
  29396. items: [
  29397. {
  29398. xtype: 'toolbar',
  29399. border: false,
  29400. items: [
  29401. {
  29402. xtype: 'button',
  29403. text: '执行',
  29404. iconCls: 'x-fa fa-play',
  29405. bind: {
  29406. hidden: "{running}",
  29407. },
  29408. listeners: {
  29409. click: 'scope.start'
  29410. }
  29411. },
  29412. {
  29413. xtype: 'button',
  29414. text: '停止',
  29415. iconCls: 'x-fa fa-stop',
  29416. bind: {
  29417. hidden: "{!running}",
  29418. },
  29419. listeners: {
  29420. click: 'scope.stop'
  29421. }
  29422. },
  29423. ],
  29424. },
  29425. ]
  29426. },
  29427. {
  29428. region: 'center',
  29429. reference: 'terminal',
  29430. xtype: 'terminal',
  29431. },
  29432. ],
  29433. },
  29434. ],
  29435. };
  29436. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29437. var DevOpsTerminal = /** @class */ (function (_super) {
  29438. __extends(DevOpsTerminal, _super);
  29439. function DevOpsTerminal() {
  29440. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29441. _this.websocket = undefined;
  29442. return _this;
  29443. }
  29444. DevOpsTerminal.prototype.onLoad = function () {
  29445. this.load();
  29446. };
  29447. DevOpsTerminal.prototype.onDestroy = function () {
  29448. if (this.websocket) {
  29449. this.websocket.close();
  29450. this.websocket = undefined;
  29451. }
  29452. };
  29453. DevOpsTerminal.prototype.load = function () {
  29454. var _this = this;
  29455. var opsId = this.viewModel.get('opsId');
  29456. this.setLoading(true);
  29457. devOpsById(opsId).then(function (res) {
  29458. _this.viewModel.set('devOps', res.data);
  29459. }).finally(function () {
  29460. _this.setLoading(false);
  29461. });
  29462. };
  29463. DevOpsTerminal.prototype.start = function () {
  29464. var me = this;
  29465. var running = this.viewModel.get('running');
  29466. var devOps = this.viewModel.get('devOps');
  29467. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29468. return;
  29469. var devopsServer = "ws://122.9.140.63:9999";
  29470. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29471. this.websocket.addEventListener('open', function () {
  29472. me.viewModel.set('running', true);
  29473. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29474. });
  29475. this.websocket.addEventListener('message', function (event) {
  29476. me.refs.terminal.write(event.data);
  29477. });
  29478. this.websocket.addEventListener('close', function () {
  29479. me.stop();
  29480. });
  29481. this.websocket.addEventListener('error', function () {
  29482. me.stop();
  29483. });
  29484. };
  29485. DevOpsTerminal.prototype.stop = function () {
  29486. if (this.websocket) {
  29487. this.websocket.close();
  29488. this.websocket = undefined;
  29489. }
  29490. this.viewModel.set('running', false);
  29491. };
  29492. return DevOpsTerminal;
  29493. }(Scope));
  29494. //# sourceMappingURL=DevOpsTerminal.js.map
  29495. var Controller$3 = /** @class */ (function () {
  29496. function Controller() {
  29497. }
  29498. Controller.prototype.onLoad = function (sender) {
  29499. this.reload();
  29500. };
  29501. Controller.prototype.reload = function () {
  29502. var me = this;
  29503. // @ts-ignore
  29504. var view = me.getView();
  29505. view.setLoading(true);
  29506. devOpsList().then(function (res) {
  29507. view.setStore(new Ext.data.Store({
  29508. fields: ['ops_id', 'host', 'name'],
  29509. data: res.data,
  29510. }));
  29511. }).finally(function () {
  29512. view.setLoading(false);
  29513. });
  29514. };
  29515. Controller.prototype.onDblClick = function (sender) {
  29516. this.devOpsTerminal();
  29517. };
  29518. Controller.prototype.devOpsTerminal = function () {
  29519. // @ts-ignore
  29520. var view = this.getView();
  29521. var _a = __read(view.getSelection(), 1), record = _a[0];
  29522. if (record) {
  29523. var name = record.get('name');
  29524. var opsId = record.get('ops_id');
  29525. var instance = new DevOpsTerminal();
  29526. instance.showPage({
  29527. id: 'ops_' + opsId,
  29528. path: 'ops_' + opsId,
  29529. }, {
  29530. data: {
  29531. opsId: opsId,
  29532. name: name,
  29533. }
  29534. });
  29535. instance.dialogSuccess = function () {
  29536. };
  29537. }
  29538. };
  29539. return Controller;
  29540. }());
  29541. var controller$3 = new Controller$3();
  29542. function initDevOpsTree () {
  29543. Ext.define('com.yvan.studio.DevOpsGrid', {
  29544. extend: 'Ext.grid.Panel',
  29545. xtype: 'devopsgrid',
  29546. controller: controller$3,
  29547. scope: controller$3,
  29548. referenceHolder: true,
  29549. tooltip: '运维',
  29550. iconCls: 'x-fa fa-terminal',
  29551. useArrows: true,
  29552. reference: 'devopsgrid',
  29553. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29554. listeners: {
  29555. afterrender: 'onLoad',
  29556. itemdblclick: 'onDblClick',
  29557. },
  29558. viewConfig: {
  29559. // listeners: {
  29560. // itemcontextmenu: 'onGridContextMenu',
  29561. // },
  29562. },
  29563. tbar: {
  29564. xtype: 'toolbar',
  29565. items: [
  29566. {
  29567. xtype: 'button',
  29568. tooltip: '刷新',
  29569. iconCls: 'x-fa fa-refresh',
  29570. listeners: {
  29571. click: 'reload'
  29572. }
  29573. },
  29574. {
  29575. xtype: 'textfield',
  29576. flex: 1,
  29577. emptyText: '搜索过滤',
  29578. enableKeyEvents: true,
  29579. listeners: {
  29580. change: {
  29581. fn: 'filterChanged',
  29582. buffer: 50
  29583. }
  29584. }
  29585. },
  29586. ]
  29587. },
  29588. columns: [
  29589. {
  29590. text: 'ID', dataIndex: 'report_id',
  29591. hidden: true,
  29592. },
  29593. {
  29594. text: '服务器',
  29595. dataIndex: 'host',
  29596. width: 100,
  29597. menuDisabled: true,
  29598. },
  29599. {
  29600. text: '操作名称',
  29601. dataIndex: 'name',
  29602. flex: 1,
  29603. menuDisabled: true,
  29604. },
  29605. ]
  29606. });
  29607. }
  29608. //# sourceMappingURL=DevOpsTree.js.map
  29609. function initTerminal () {
  29610. Ext.define('com.yvan.studio.Terminal', {
  29611. extend: 'Ext.panel.Panel',
  29612. alias: 'widget.terminal',
  29613. xtype: 'terminal',
  29614. layout: 'fit',
  29615. border: false,
  29616. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29617. config: {},
  29618. write: function (str) {
  29619. if (this.term) {
  29620. this.term.write(str);
  29621. }
  29622. },
  29623. initComponent: function () {
  29624. var that = this;
  29625. this.superclass.initComponent.call(this, arguments);
  29626. that.on({
  29627. resize: function () {
  29628. var _a;
  29629. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29630. that.fitAddon.fit();
  29631. }
  29632. },
  29633. destory: function () {
  29634. if (that.term) {
  29635. that.term.dispose();
  29636. delete that.term;
  29637. }
  29638. if (that.fitAddon) {
  29639. that.fitAddon.dispose();
  29640. delete that.fitAddon;
  29641. }
  29642. },
  29643. afterrender: function (sender) {
  29644. _.defer(function () {
  29645. var $dom = $(that.el.dom).find('.terminal');
  29646. that.term = new xterm.Terminal({
  29647. // cursorBlink: false,
  29648. // cursorStyle: 'bar', // block underline bar
  29649. // enableBold: false,
  29650. // bellStyle: "sound",
  29651. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29652. // scrollback: 10000,
  29653. // tabStopWidth: 4,
  29654. disableStdin: true,
  29655. theme: {
  29656. // foreground: "#111",
  29657. // background: "#fdfdfd",
  29658. // background: "#fafafa",
  29659. },
  29660. });
  29661. that.fitAddon = new xtermAddonFit.FitAddon();
  29662. that.term.loadAddon(that.fitAddon);
  29663. that.term.open($dom[0]);
  29664. that.fitAddon.fit();
  29665. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29666. });
  29667. }
  29668. });
  29669. }
  29670. });
  29671. }
  29672. //# sourceMappingURL=Terminal.js.map
  29673. var vjson$m = {
  29674. title: '接口统计',
  29675. layout: 'fit',
  29676. items: [
  29677. {
  29678. title: '接口统计',
  29679. xtype: 'yvgrid',
  29680. enableLocking: false,
  29681. reference: 'grid1',
  29682. pagination: false,
  29683. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29684. tbar: {
  29685. xtype: 'form',
  29686. items: [
  29687. {
  29688. xtype: 'cols',
  29689. items: [
  29690. {
  29691. xtype: 'textfield',
  29692. fieldLabel: '搜索',
  29693. listeners: {
  29694. change: 'scope.requestFilterChange'
  29695. }
  29696. },
  29697. ]
  29698. },
  29699. ]
  29700. },
  29701. columns: [
  29702. { text: '地址', dataIndex: 'url', flex: 1 },
  29703. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29704. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29705. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29706. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29707. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29708. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29709. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29710. ],
  29711. leadingBufferZone: 8,
  29712. trailingBufferZone: 8,
  29713. viewConfig: {
  29714. listeners: {
  29715. expandbody: 'scope.onChildExpand'
  29716. }
  29717. },
  29718. listeners: {
  29719. itemdblclick: 'scope.itemClick1'
  29720. },
  29721. plugins: {
  29722. rowwidget: {
  29723. widget: {
  29724. xtype: 'yvgrid',
  29725. hideFootbar: true,
  29726. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29727. listeners: {
  29728. itemdblclick: 'scope.itemClick1'
  29729. },
  29730. columns: [
  29731. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29732. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29733. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29734. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29735. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29736. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29737. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29738. ]
  29739. }
  29740. }
  29741. }
  29742. },
  29743. ]
  29744. };
  29745. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29746. var model$n = {
  29747. data: {
  29748. count: 0,
  29749. dataSourceName: '',
  29750. sql: "",
  29751. histogram: '',
  29752. maxCost: 0,
  29753. minCost: 0,
  29754. avgCost: '',
  29755. sumCost: 0,
  29756. histogramInfos: [
  29757. // count: 1
  29758. // gteCost: 20
  29759. // ltCost: 50
  29760. // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = ?\norder by sys_resource.resource_order asc"
  29761. // topN: [
  29762. // cost: 24
  29763. // occurrenceTime: "1648004895171"
  29764. // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = 3\norder by sys_resource.resource_order asc"
  29765. // ]
  29766. ]
  29767. }
  29768. };
  29769. //# sourceMappingURL=PerformDialog.model.js.map
  29770. var vjson$n = {
  29771. title: '性能统计详情',
  29772. height: 400,
  29773. width: 800,
  29774. modal: true,
  29775. layout: 'fit',
  29776. items: [
  29777. {
  29778. xtype: 'tabpanel',
  29779. items: [
  29780. {
  29781. title: '摘要',
  29782. key: "1",
  29783. layout: 'border',
  29784. items: [
  29785. {
  29786. region: 'north',
  29787. border: false,
  29788. defaults: {
  29789. margin: '8 0 0 0'
  29790. },
  29791. items: [
  29792. {
  29793. xtype: 'cols',
  29794. defaultType: 'displayfield',
  29795. defaults: {
  29796. labelWidth: 70,
  29797. },
  29798. items: [
  29799. {
  29800. fieldLabel: 'count',
  29801. bind: {
  29802. value: '{count}'
  29803. }
  29804. },
  29805. {
  29806. fieldLabel: 'maxCost',
  29807. bind: {
  29808. value: '{maxCost}'
  29809. }
  29810. },
  29811. {
  29812. fieldLabel: 'minCost',
  29813. bind: {
  29814. value: '{minCost}'
  29815. }
  29816. },
  29817. {
  29818. fieldLabel: 'avgCost',
  29819. bind: {
  29820. value: '{avgCost}'
  29821. }
  29822. },
  29823. {
  29824. fieldLabel: 'sumCost',
  29825. bind: {
  29826. value: '{sumCost}'
  29827. }
  29828. },
  29829. ]
  29830. },
  29831. {
  29832. xtype: 'cols',
  29833. items: [
  29834. {
  29835. flex: 5,
  29836. border: false,
  29837. items: [
  29838. {
  29839. xtype: 'segmentedbutton',
  29840. reference: 'histogram',
  29841. allowToggle: false,
  29842. border: false,
  29843. items: []
  29844. }
  29845. ]
  29846. },
  29847. ]
  29848. },
  29849. ],
  29850. },
  29851. {
  29852. region: 'center',
  29853. xtype: 'sqleditor',
  29854. reference: 'sqlEditor',
  29855. },
  29856. ]
  29857. },
  29858. {
  29859. title: '直方图',
  29860. key: "2",
  29861. }
  29862. ]
  29863. }
  29864. ]
  29865. };
  29866. //# sourceMappingURL=PerformDialog.view.js.map
  29867. var PerformDialog = /** @class */ (function (_super) {
  29868. __extends(PerformDialog, _super);
  29869. function PerformDialog() {
  29870. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29871. }
  29872. PerformDialog.prototype.onLoad = function () {
  29873. var _this = this;
  29874. var sql = this.viewModel.get('sql');
  29875. var sql2 = sqlFormat.format(sql, {
  29876. indent: ' ',
  29877. uppercase: true,
  29878. });
  29879. var histogramInfos = this.viewModel.get('histogramInfos');
  29880. var vs = _$2.map(histogramInfos, function (v) {
  29881. if (v.ltCost > 2100000000) {
  29882. return {
  29883. text: "[" + v.gteCost + ", \u221E):" + v.count
  29884. };
  29885. }
  29886. return {
  29887. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29888. };
  29889. });
  29890. this.refs.sqlEditor.setCode(sql2);
  29891. _$2.forEach(vs, function (v) {
  29892. _this.refs.histogram.add(v);
  29893. });
  29894. };
  29895. return PerformDialog;
  29896. }(Scope));
  29897. //# sourceMappingURL=PerformDialog.js.map
  29898. var model$o = {
  29899. data: {}
  29900. };
  29901. var PerformStats = /** @class */ (function (_super) {
  29902. __extends(PerformStats, _super);
  29903. function PerformStats() {
  29904. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29905. _this.requestFilterChange = _.debounce(function (sender, value) {
  29906. var store = _this.refs.grid1.store;
  29907. store.clearFilter();
  29908. if (value) {
  29909. store.filterBy(function (record, id) {
  29910. var text = toString(record.get('url'));
  29911. // 用拼音筛选的方式
  29912. return text.includes(value);
  29913. });
  29914. }
  29915. }, 100);
  29916. return _this;
  29917. }
  29918. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29919. widget.setData(record.data.children);
  29920. };
  29921. PerformStats.prototype.itemClick1 = function (sender, record) {
  29922. console.log('itemClick1', record.data);
  29923. new PerformDialog().showDialog(sender, {}, {
  29924. data: record.data
  29925. });
  29926. };
  29927. PerformStats.prototype.onLoad = function () {
  29928. var _this = this;
  29929. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29930. .then(function (_a) {
  29931. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29932. var resData = reqRes.data;
  29933. var jdbcData = jdbcRes.data;
  29934. _.forEach(jdbcData, function (item) {
  29935. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29936. });
  29937. _.forEach(resData, function (item) {
  29938. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29939. if (_.isArray(item.sqls)) {
  29940. item.children = _.map(item.sqls, function (sql) {
  29941. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29942. }).filter(function (v) { return !!v; });
  29943. }
  29944. item.jdbcCount = _.size(item.children);
  29945. });
  29946. _this.refs.grid1.setData(resData);
  29947. // this.refs.grid2.setData(jdbcData)
  29948. });
  29949. };
  29950. return PerformStats;
  29951. }(Scope));
  29952. //# sourceMappingURL=InterfaceStatistics.js.map
  29953. var vjson$o = {
  29954. title: '性能统计',
  29955. layout: 'fit',
  29956. items: [
  29957. {
  29958. title: '数据库统计',
  29959. xtype: 'yvgrid',
  29960. enableLocking: false,
  29961. reference: 'grid2',
  29962. pagination: false,
  29963. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29964. tbar: {
  29965. xtype: 'form',
  29966. items: [
  29967. {
  29968. xtype: 'cols',
  29969. items: [
  29970. {
  29971. fieldLabel: '搜索',
  29972. listeners: {
  29973. change: 'scope.jdbcFilterChange'
  29974. }
  29975. },
  29976. ]
  29977. },
  29978. ]
  29979. },
  29980. listeners: {
  29981. itemdblclick: 'scope.itemClick1'
  29982. },
  29983. columns: [
  29984. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29985. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29986. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29987. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29988. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29989. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29990. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29991. ]
  29992. },
  29993. ]
  29994. };
  29995. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29996. var model$p = {
  29997. data: {}
  29998. };
  29999. var PerformStats$1 = /** @class */ (function (_super) {
  30000. __extends(PerformStats, _super);
  30001. function PerformStats() {
  30002. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  30003. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  30004. var store = _this.refs.grid2.store;
  30005. store.clearFilter();
  30006. if (value) {
  30007. store.filterBy(function (record, id) {
  30008. var text = toString(record.get('sql'));
  30009. // 用拼音筛选的方式
  30010. return text.includes(value);
  30011. });
  30012. }
  30013. }, 100);
  30014. return _this;
  30015. }
  30016. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30017. widget.setData(record.data.children);
  30018. };
  30019. PerformStats.prototype.itemClick1 = function (sender, record) {
  30020. console.log('itemClick1', record.data);
  30021. new PerformDialog().showDialog(sender, {}, {
  30022. data: record.data
  30023. });
  30024. };
  30025. PerformStats.prototype.onLoad = function () {
  30026. var _this = this;
  30027. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30028. .then(function (_a) {
  30029. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30030. var resData = reqRes.data;
  30031. var jdbcData = jdbcRes.data;
  30032. _.forEach(jdbcData, function (item) {
  30033. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30034. });
  30035. _.forEach(resData, function (item) {
  30036. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30037. if (_.isArray(item.sqls)) {
  30038. item.children = _.map(item.sqls, function (sql) {
  30039. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30040. }).filter(function (v) { return !!v; });
  30041. }
  30042. item.jdbcCount = _.size(item.children);
  30043. });
  30044. _this.refs.grid2.setData(jdbcData);
  30045. });
  30046. };
  30047. return PerformStats;
  30048. }(Scope));
  30049. //# sourceMappingURL=DatabaseStatistics.js.map
  30050. var Controller$4 = /** @class */ (function () {
  30051. function Controller() {
  30052. }
  30053. Controller.prototype.onDblClick = function (sender, record) {
  30054. var data = record.raw;
  30055. if (data.text === "接口统计") {
  30056. var page = new PerformStats();
  30057. page.showPage({
  30058. title: "接口统计",
  30059. id: '_InterfaceStatistics',
  30060. path: '_InterfaceStatistics',
  30061. }, {});
  30062. }
  30063. else if (data.text === "数据库统计") {
  30064. var page = new PerformStats$1();
  30065. page.showPage({
  30066. title: "数据库统计",
  30067. id: '_DatabaseStatistics',
  30068. path: '_DatabaseStatistics',
  30069. }, {});
  30070. }
  30071. };
  30072. Controller.prototype.onLoad = function () {
  30073. var me = this;
  30074. //@ts-ignore
  30075. var view = me.getView();
  30076. view.setRootNode({
  30077. expanded: true,
  30078. leaf: false,
  30079. children: [
  30080. { leaf: true, text: '接口统计' },
  30081. { leaf: true, text: '数据库统计' },
  30082. ]
  30083. });
  30084. };
  30085. return Controller;
  30086. }());
  30087. var controller$4 = new Controller$4();
  30088. function initMonitorTree () {
  30089. Ext.define('com.yvan.studio.MonitorTree', {
  30090. extend: 'Ext.tree.Panel',
  30091. xtype: 'monitortree',
  30092. controller: controller$4,
  30093. scope: controller$4,
  30094. reference: 'roleGrid',
  30095. tooltip: '表单定义',
  30096. iconCls: 'x-fa fa-bar-chart',
  30097. useArrows: true,
  30098. rootVisible: false,
  30099. colspan: 2,
  30100. lines: true,
  30101. multiSelect: false,
  30102. referenceHolder: true,
  30103. // openNode() {
  30104. // const selection = this.getSelection()
  30105. // const [record] = selection
  30106. // if (!record) {
  30107. // return
  30108. // }
  30109. //
  30110. // const {raw} = record;
  30111. // if (raw.type === 'Dir') {
  30112. // return
  30113. // }
  30114. // if (raw.type === "Module" && raw.module) {
  30115. // // eventBus.publish(EventType.ModuleOpen, raw)
  30116. // }
  30117. // },
  30118. listeners: {
  30119. itemdblclick: 'onDblClick',
  30120. afterrender: "onLoad",
  30121. },
  30122. });
  30123. }
  30124. //# sourceMappingURL=MonitorTree.js.map
  30125. var Controller$5 = /** @class */ (function () {
  30126. function Controller() {
  30127. }
  30128. return Controller;
  30129. }());
  30130. var controller$5 = new Controller$5();
  30131. function initHomeTree () {
  30132. Ext.define('com.yvan.studio.HomeTree', {
  30133. extend: 'Ext.Panel',
  30134. xtype: 'hometree',
  30135. controller: controller$5,
  30136. scope: controller$5,
  30137. referenceHolder: true,
  30138. bodyCls: 'home',
  30139. // layout: 'fit',
  30140. tbar: {
  30141. xtype: 'toolbar',
  30142. items: [
  30143. {
  30144. xtype: 'button',
  30145. iconCls: 'x-fa fa-exchange',
  30146. text: '数据结构同步',
  30147. handler: function (sender) {
  30148. handles$1.mainWindow.showDataSync(sender);
  30149. }
  30150. },
  30151. {
  30152. xtype: 'button',
  30153. iconCls: 'x-fa fa-cubes',
  30154. text: '数据域管理',
  30155. handler: function (sender) {
  30156. handles$1.mainWindow.showColumnDomain();
  30157. }
  30158. },
  30159. ],
  30160. },
  30161. // items: [
  30162. //
  30163. // ],
  30164. layout: {
  30165. type: 'vbox',
  30166. pack: 'start',
  30167. align: 'stretch',
  30168. },
  30169. items: [
  30170. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30171. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30172. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30173. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30174. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30175. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30176. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30177. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30178. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30179. ],
  30180. });
  30181. }
  30182. //# sourceMappingURL=HomeTree.js.map
  30183. var WidgetStore = /** @class */ (function (_super) {
  30184. __extends(WidgetStore, _super);
  30185. function WidgetStore() {
  30186. return _super !== null && _super.apply(this, arguments) || this;
  30187. }
  30188. WidgetStore.prototype.getCacheKey = function (param) {
  30189. return "widget_data.json";
  30190. };
  30191. /*invokeApi(param: any): Promise<any> {
  30192. return new Promise<any>(resolve => {
  30193. //@ts-ignore
  30194. require(["../../widget/all"], function (res) {
  30195. const widgetList = res.default
  30196. resolve(widgetList)
  30197. })
  30198. })
  30199. }*/
  30200. WidgetStore.prototype.invokeApi = function (param) {
  30201. return widgetListApi(param);
  30202. };
  30203. return WidgetStore;
  30204. }(CacheStore));
  30205. var instance$3 = new WidgetStore();
  30206. //# sourceMappingURL=WidgetStore.js.map
  30207. var WidgetGridController = /** @class */ (function () {
  30208. function WidgetGridController() {
  30209. }
  30210. WidgetGridController.prototype.onLoad = function (sender) {
  30211. var me = this;
  30212. setWidget(me);
  30213. instance$3.registe(me.reloadData.bind(this));
  30214. instance$3.reloadIfNeed(undefined);
  30215. };
  30216. WidgetGridController.prototype.widgetAdd = function (sender) {
  30217. var me = this;
  30218. var win = new Ext.Window({
  30219. autoDestroy: true,
  30220. title: "新建弹框",
  30221. width: 400,
  30222. height: 220,
  30223. resizable: true,
  30224. closable: true,
  30225. maximizable: true,
  30226. minimizable: true,
  30227. plain: true,
  30228. // constrainHeader: true,
  30229. constrain: true,
  30230. layout: 'fit',
  30231. animateTarget: sender,
  30232. buttonAlign: 'center',
  30233. items: [
  30234. {
  30235. xtype: "form",
  30236. layout: "hbox",
  30237. margin: '10px 20px',
  30238. border: 0,
  30239. items: [
  30240. {
  30241. flex: 1,
  30242. layout: 'vbox',
  30243. items: [
  30244. {
  30245. xtype: "textfield",
  30246. name: "widgetcode",
  30247. fieldLabel: "弹窗文件",
  30248. flex: 1,
  30249. allowBlank: false,
  30250. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30251. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30252. labelWidth: 80,
  30253. width: "100%",
  30254. },
  30255. {
  30256. xtype: "textfield",
  30257. name: "widgetname",
  30258. fieldLabel: "弹窗名称",
  30259. flex: 1,
  30260. allowBlank: false,
  30261. labelWidth: 80,
  30262. width: "100%",
  30263. },
  30264. ]
  30265. },
  30266. ]
  30267. }
  30268. ],
  30269. //窗口按钮
  30270. buttons: [
  30271. {
  30272. xtype: 'button', text: '保存', handler: function (btn) {
  30273. //窗口获取表单
  30274. var form = win.down('form');
  30275. var vaildSuccess = form.isValid();
  30276. if (!vaildSuccess) {
  30277. return;
  30278. }
  30279. var title = form.down('textfield[name="widgetname"]').getValue();
  30280. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30281. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30282. if (res.success) {
  30283. msg$1('添加成功');
  30284. // 添加
  30285. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30286. me.reload();
  30287. });
  30288. win.close();
  30289. }
  30290. });
  30291. }
  30292. },
  30293. {
  30294. xtype: 'button', text: '取消', handler: function (btn) {
  30295. //窗口关闭
  30296. win.close();
  30297. }
  30298. }
  30299. ]
  30300. });
  30301. win.show();
  30302. };
  30303. WidgetGridController.prototype.widgetRemove = function (sender) {
  30304. var _this = this;
  30305. //@ts-ignore
  30306. var record = this.getView().selection.data;
  30307. if (!record) {
  30308. msg$1('请选择一行');
  30309. return;
  30310. }
  30311. var widgetPath = record.widget_path;
  30312. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30313. if (btn === 'yes') {
  30314. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30315. if (res.success) {
  30316. msg$1(res.msg);
  30317. _this.reload();
  30318. }
  30319. });
  30320. }
  30321. });
  30322. };
  30323. WidgetGridController.prototype.widgetEdit = function (record) {
  30324. var _this = this;
  30325. if (record) {
  30326. var widgetPath = record.widget_path;
  30327. var widgetName = record.widget_name;
  30328. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30329. _this.reload();
  30330. });
  30331. }
  30332. };
  30333. WidgetGridController.prototype.onDestory = function (sender) {
  30334. var me = this;
  30335. setWidget(undefined);
  30336. instance$3.unregiste(me.reloadData.bind(this));
  30337. };
  30338. WidgetGridController.prototype.reloadData = function (res) {
  30339. var me = this;
  30340. //@ts-ignore
  30341. var view = me.getView();
  30342. if (typeof res === 'object') {
  30343. // const data = []
  30344. // _.forOwn(res, (v, k) => {
  30345. // data.push({
  30346. // widget_path: k,
  30347. // widget_name: v.title,
  30348. // vjson : v
  30349. // })
  30350. // })
  30351. view.setStore(new Ext.data.Store({
  30352. fields: ['widget_path', 'widget_name'],
  30353. data: res.data,
  30354. }));
  30355. }
  30356. else if (typeof res === 'boolean') {
  30357. view.setLoading(res);
  30358. }
  30359. };
  30360. WidgetGridController.prototype.reload = function () {
  30361. instance$3.reloadForce(undefined);
  30362. };
  30363. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30364. //@ts-ignore
  30365. this.view.store.clearFilter();
  30366. if (value) {
  30367. //@ts-ignore
  30368. this.view.store.filterBy(function (record) {
  30369. var widget_path = record.get('widget_path');
  30370. var widget_name = record.get('widget_name');
  30371. return (window['system'].pinyinMatch(widget_name, value) ||
  30372. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30373. });
  30374. }
  30375. };
  30376. WidgetGridController.prototype.onClearClick = function () {
  30377. var _a, _b;
  30378. //@ts-ignore
  30379. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30380. };
  30381. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30382. this.widgetEdit(record.data);
  30383. };
  30384. return WidgetGridController;
  30385. }());
  30386. //# sourceMappingURL=WidgetGridController.js.map
  30387. function initWidget () {
  30388. var controller = new WidgetGridController();
  30389. Ext.define('com.yvan.studio.WidgetGrid', {
  30390. extend: 'Ext.grid.Panel',
  30391. xtype: 'widgetgrid',
  30392. controller: controller,
  30393. scope: controller,
  30394. referenceHolder: true,
  30395. tooltip: '检索窗口',
  30396. iconCls: 'x-fa fa-search',
  30397. useArrows: true,
  30398. reference: 'widgetgrid',
  30399. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30400. listeners: {
  30401. itemdblclick: 'onDblClick',
  30402. afterrender: 'onLoad',
  30403. destory: 'onDestory',
  30404. },
  30405. viewConfig: {
  30406. listeners: {
  30407. itemcontextmenu: 'onGridContextMenu',
  30408. },
  30409. },
  30410. tbar: [
  30411. {
  30412. xtype: 'button',
  30413. tooltip: '刷新',
  30414. iconCls: 'x-fa fa-refresh',
  30415. listeners: {
  30416. click: 'reload'
  30417. }
  30418. },
  30419. {
  30420. xtype: 'button',
  30421. tooltip: '添加',
  30422. iconCls: 'x-fa fa-plus-circle',
  30423. listeners: {
  30424. click: 'widgetAdd'
  30425. }
  30426. },
  30427. {
  30428. xtype: 'button',
  30429. tooltip: '删除',
  30430. iconCls: 'x-fa fa-minus-circle',
  30431. listeners: {
  30432. click: 'widgetRemove'
  30433. }
  30434. },
  30435. ],
  30436. fbar: [
  30437. {
  30438. xtype: 'textfield',
  30439. flex: 1,
  30440. reference: "txtFilter",
  30441. emptyText: '搜索过滤',
  30442. enableKeyEvents: true,
  30443. listeners: {
  30444. change: {
  30445. fn: 'filterChanged',
  30446. buffer: 50
  30447. }
  30448. }
  30449. },
  30450. ],
  30451. columns: [
  30452. {
  30453. text: '弹窗文件', dataIndex: 'widget_path',
  30454. menuDisabled: true, flex: 1,
  30455. },
  30456. {
  30457. text: '弹窗名称', dataIndex: 'widget_name',
  30458. menuDisabled: true, flex: 1,
  30459. },
  30460. ]
  30461. });
  30462. }
  30463. //# sourceMappingURL=WidgetGrid.js.map
  30464. var WhLayoutController = /** @class */ (function () {
  30465. function WhLayoutController() {
  30466. }
  30467. WhLayoutController.prototype.onLoad = function (sender) {
  30468. var _this = this;
  30469. var me = this;
  30470. setWhLayout(me);
  30471. _$2.defer(function () {
  30472. _this.reload();
  30473. });
  30474. };
  30475. WhLayoutController.prototype.reload = function () {
  30476. //@ts-ignore
  30477. var view = this.getView();
  30478. view.setLoading(true);
  30479. loadWhLayoutAll().then(function (res) {
  30480. view.setStore(new Ext.data.Store({
  30481. fields: ['layout_code', 'layout_name'],
  30482. data: res.data,
  30483. }));
  30484. }).finally(function () {
  30485. view.setLoading(false);
  30486. });
  30487. };
  30488. WhLayoutController.prototype.add = function () {
  30489. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30490. };
  30491. WhLayoutController.prototype.edit = function (data) {
  30492. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30493. };
  30494. WhLayoutController.prototype.remove = function () {
  30495. var _this = this;
  30496. var _a;
  30497. //@ts-ignore
  30498. var view = this.getView();
  30499. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30500. if (!record) {
  30501. msg$1('请选择一行数据');
  30502. return;
  30503. }
  30504. var layoutCode = record.layout_code;
  30505. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30506. if (btn === 'yes') {
  30507. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30508. if (res.success) {
  30509. msg$1(res.msg);
  30510. _this.reload();
  30511. }
  30512. });
  30513. }
  30514. });
  30515. };
  30516. WhLayoutController.prototype.onDblClick = function () {
  30517. var _a;
  30518. //@ts-ignore
  30519. var view = this.getView();
  30520. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30521. if (!record) {
  30522. msg$1('请选择一行数据');
  30523. return;
  30524. }
  30525. this.edit(record);
  30526. };
  30527. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30528. //@ts-ignore
  30529. this.view.store.clearFilter();
  30530. if (value) {
  30531. //@ts-ignore
  30532. this.view.store.filterBy(function (record) {
  30533. var widget_path = record.get('widget_path');
  30534. var widget_name = record.get('widget_name');
  30535. return (window['system'].pinyinMatch(widget_name, value) ||
  30536. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30537. });
  30538. }
  30539. };
  30540. WhLayoutController.prototype.onClearClick = function () {
  30541. var _a, _b;
  30542. //@ts-ignore
  30543. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30544. };
  30545. return WhLayoutController;
  30546. }());
  30547. //# sourceMappingURL=WhLayoutController.js.map
  30548. function initWhLayout () {
  30549. var controller = new WhLayoutController();
  30550. Ext.define('com.yvan.studio.WhLayout', {
  30551. extend: 'Ext.grid.Panel',
  30552. xtype: 'whlayout',
  30553. alias: 'widget.whlayout',
  30554. controller: controller,
  30555. scope: controller,
  30556. referenceHolder: true,
  30557. tooltip: '检索窗口',
  30558. iconCls: 'x-fa fa-search',
  30559. useArrows: true,
  30560. reference: 'whlayout',
  30561. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30562. listeners: {
  30563. itemdblclick: 'onDblClick',
  30564. afterrender: 'onLoad',
  30565. destory: 'onDestory',
  30566. },
  30567. viewConfig: {
  30568. listeners: {
  30569. itemcontextmenu: 'onGridContextMenu',
  30570. },
  30571. },
  30572. tbar: [
  30573. {
  30574. xtype: 'button',
  30575. tooltip: '刷新',
  30576. iconCls: 'x-fa fa-refresh',
  30577. listeners: {
  30578. click: 'reload'
  30579. }
  30580. },
  30581. {
  30582. xtype: 'button',
  30583. tooltip: '添加',
  30584. iconCls: 'x-fa fa-plus-circle',
  30585. listeners: {
  30586. click: 'add'
  30587. }
  30588. },
  30589. {
  30590. xtype: 'button',
  30591. tooltip: '删除',
  30592. iconCls: 'x-fa fa-minus-circle',
  30593. listeners: {
  30594. click: 'remove'
  30595. }
  30596. },
  30597. ],
  30598. fbar: [
  30599. {
  30600. xtype: 'textfield',
  30601. flex: 1,
  30602. reference: "txtFilter",
  30603. emptyText: '搜索过滤',
  30604. enableKeyEvents: true,
  30605. listeners: {
  30606. change: {
  30607. fn: 'filterChanged',
  30608. buffer: 50
  30609. }
  30610. }
  30611. },
  30612. ],
  30613. columns: [
  30614. {
  30615. text: '图编号', dataIndex: 'layout_code',
  30616. menuDisabled: true, flex: 1,
  30617. },
  30618. {
  30619. text: '图名称', dataIndex: 'layout_name',
  30620. menuDisabled: true, flex: 1,
  30621. },
  30622. ]
  30623. });
  30624. }
  30625. //# sourceMappingURL=WhLayout.js.map
  30626. var BpmnTreeController = /** @class */ (function () {
  30627. function BpmnTreeController() {
  30628. }
  30629. BpmnTreeController.prototype.onLoad = function (sender) {
  30630. this.reload();
  30631. };
  30632. BpmnTreeController.prototype.reload = function () {
  30633. var me = this;
  30634. me.getView().setLoading(true);
  30635. exporerList().then(function (res) {
  30636. // handles.mainWindow.modules = res.data
  30637. // const rootNode = modulesToTreeData(res.data)
  30638. var rootNode = res.data.tree;
  30639. me.getView().setRootNode({
  30640. expanded: true,
  30641. leaf: false,
  30642. children: rootNode
  30643. });
  30644. // const lastId = window.location.hash.substring(1);
  30645. // file.selectPath(lastId)
  30646. // if (lastId) {
  30647. // const node = getModuleById(rootNode, lastId)
  30648. // if (node) {
  30649. // showDesign(node.id, node.path, node.text, node.module)
  30650. // }
  30651. // }
  30652. // this.restoreState()
  30653. }).finally(function () {
  30654. me.getView().setLoading(false);
  30655. });
  30656. };
  30657. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30658. var _this = this;
  30659. e.preventDefault();
  30660. var raw = node.raw;
  30661. //const me = sender.up("treepanel").scope
  30662. var option;
  30663. if (raw.exporerType === 1) ;
  30664. else if (raw.exporerType === 21) {
  30665. if (raw.type === 'Dir') {
  30666. option = {
  30667. shadow: 'frame', allowOtherMenus: true,
  30668. items: [
  30669. {
  30670. text: '添加',
  30671. iconCls: 'x-fa fa-plus-circle',
  30672. handler: function (sender) {
  30673. var dirPath = raw.dirPath;
  30674. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30675. }
  30676. },
  30677. '-',
  30678. {
  30679. text: '新建文件夹',
  30680. iconCls: 'x-fa fa-folder-o',
  30681. handler: function (sender) {
  30682. }
  30683. }
  30684. ]
  30685. };
  30686. }
  30687. else if (raw.type === 'Model') {
  30688. option = {
  30689. shadow: 'frame', allowOtherMenus: true,
  30690. items: [
  30691. {
  30692. text: '编辑',
  30693. iconCls: 'x-fa fa-edit',
  30694. handler: function (sender) {
  30695. }
  30696. },
  30697. {
  30698. text: '删除',
  30699. iconCls: 'x-fa fa-minus-circle',
  30700. handler: function (sender) {
  30701. }
  30702. },
  30703. '-',
  30704. {
  30705. text: '注册(至菜单)',
  30706. iconCls: 'x-fa fa-sign-in',
  30707. handler: function (sender) {
  30708. }
  30709. },
  30710. {
  30711. text: '新建文件夹',
  30712. iconCls: 'x-fa fa-folder-o',
  30713. handler: function (sender) {
  30714. }
  30715. }
  30716. ]
  30717. };
  30718. }
  30719. }
  30720. else if (raw.exporerType === 22) {
  30721. if (raw.type === 'Dir') {
  30722. option = {
  30723. shadow: 'frame', allowOtherMenus: true,
  30724. items: [
  30725. {
  30726. text: '添加',
  30727. iconCls: 'x-fa fa-plus-circle',
  30728. handler: function (sender) {
  30729. var dirPath = raw.dirPath;
  30730. handles$1.mainWindow.showFormBill();
  30731. }
  30732. },
  30733. '-',
  30734. {
  30735. text: '新建文件夹',
  30736. iconCls: 'x-fa fa-folder-o',
  30737. handler: function (sender) {
  30738. }
  30739. }
  30740. ]
  30741. };
  30742. }
  30743. else if (raw.type === 'Model') {
  30744. option = {
  30745. shadow: 'frame', allowOtherMenus: true,
  30746. items: [
  30747. {
  30748. text: '编辑',
  30749. iconCls: 'x-fa fa-edit',
  30750. handler: function (sender) {
  30751. }
  30752. },
  30753. {
  30754. text: '删除',
  30755. iconCls: 'x-fa fa-minus-circle',
  30756. handler: function (sender) {
  30757. }
  30758. },
  30759. '-',
  30760. {
  30761. text: '注册(至菜单)',
  30762. iconCls: 'x-fa fa-sign-in',
  30763. handler: function (sender) {
  30764. }
  30765. },
  30766. {
  30767. text: '新建文件夹',
  30768. iconCls: 'x-fa fa-folder-o',
  30769. handler: function (sender) {
  30770. }
  30771. }
  30772. ]
  30773. };
  30774. }
  30775. }
  30776. else if (raw.exporerType === 3) ;
  30777. else if (raw.exporerType === 50) {
  30778. option = {
  30779. shadow: 'frame', allowOtherMenus: true,
  30780. items: [
  30781. {
  30782. text: '新建流程',
  30783. iconCls: 'x-fa fa-new',
  30784. handler: function (sender) {
  30785. _this.bpmnAdd(sender);
  30786. }
  30787. },
  30788. ]
  30789. };
  30790. }
  30791. else if (raw.exporerType === 51) {
  30792. option = {
  30793. shadow: 'frame', allowOtherMenus: true,
  30794. items: [
  30795. {
  30796. text: '新建流程',
  30797. iconCls: 'x-fa fa-new',
  30798. handler: function (sender) {
  30799. _this.bpmnAdd(sender);
  30800. }
  30801. },
  30802. {
  30803. text: '删除',
  30804. iconCls: 'x-fa fa-minus-circle',
  30805. handler: function (sender) {
  30806. _this.bpmnDelete(sender, raw);
  30807. }
  30808. },
  30809. ]
  30810. };
  30811. }
  30812. else {
  30813. throw Error('暂时不支持!');
  30814. }
  30815. if (option) {
  30816. var treeMenu = new Ext.menu.Menu(option);
  30817. treeMenu.showAt(e.getXY());
  30818. }
  30819. };
  30820. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30821. var _this = this;
  30822. prompt$2('输入工作流名称').then(function (name) {
  30823. createBpmn("", name).then(function (res) {
  30824. if (res.success) {
  30825. msg$1('添加成功');
  30826. }
  30827. _this.reload();
  30828. });
  30829. });
  30830. };
  30831. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30832. var _this = this;
  30833. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30834. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30835. if (res.success) {
  30836. msg$1('添加成功');
  30837. }
  30838. _this.reload();
  30839. });
  30840. });
  30841. };
  30842. BpmnTreeController.prototype.reportAdd = function (sender) {
  30843. var _this = this;
  30844. prompt$2('请输入报表名称').then(function (name) {
  30845. createReportApi(name).then(function (res) {
  30846. if (res.success) {
  30847. msg$1('添加成功');
  30848. handles$1.mainWindow.showReport(res.data, name, function () {
  30849. _this.reload();
  30850. });
  30851. }
  30852. _this.reload();
  30853. });
  30854. });
  30855. };
  30856. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30857. if (record) {
  30858. var reportName = record.get('report_name');
  30859. var reportId = record.get('report_id');
  30860. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30861. }
  30862. };
  30863. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30864. var _this = this;
  30865. if (record) {
  30866. var reportName = record.get('report_name');
  30867. var reportId_1 = record.get('report_id');
  30868. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30869. delReportApi(reportId_1).then(function (res) {
  30870. if (res.success) {
  30871. msg$1('删除成功');
  30872. _this.reload();
  30873. }
  30874. });
  30875. });
  30876. }
  30877. };
  30878. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30879. var _this = this;
  30880. if (!record || record.type !== 'Module') {
  30881. return;
  30882. }
  30883. var reportName = record.text;
  30884. var reportId = record.target;
  30885. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30886. _this.reload();
  30887. });
  30888. };
  30889. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30890. var data = record.raw;
  30891. if (data.type !== 'Module' && data.type !== 'Dir') {
  30892. return;
  30893. }
  30894. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30895. if (data.exporerType === 10) { // 表单
  30896. // this.reportEdit(sender, data)
  30897. handles$1.mainWindow.showReport();
  30898. }
  30899. else if (data.exporerType === 21) {
  30900. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30901. }
  30902. else if (data.exporerType === 22) {
  30903. handles$1.mainWindow.showFormBill();
  30904. }
  30905. else if (data.exporerType === 30) {
  30906. handles$1.mainWindow.showWidgetDesign();
  30907. }
  30908. else if (data.exporerType === 51) {
  30909. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30910. }
  30911. else {
  30912. throw Error('暂时不支持!');
  30913. }
  30914. };
  30915. return BpmnTreeController;
  30916. }());
  30917. var controller$6 = new BpmnTreeController();
  30918. function initBpmnTree () {
  30919. Ext.define('com.yvan.studio.BpmnTree', {
  30920. extend: 'Ext.tree.Panel',
  30921. //extend: 'com.yvan.studio.StateTree',
  30922. xtype: 'bpmntree',
  30923. controller: controller$6,
  30924. scope: controller$6,
  30925. tooltip: '表单定义',
  30926. iconCls: 'x-fa fa-random',
  30927. useArrows: true,
  30928. rootVisible: false,
  30929. colspan: 2,
  30930. lines: true,
  30931. multiSelect: true,
  30932. reload: function () {
  30933. this.controller.reload.call(this, arguments);
  30934. },
  30935. openNode: function () {
  30936. var selection = this.getSelection();
  30937. var _a = __read(selection, 1), record = _a[0];
  30938. if (!record) {
  30939. return;
  30940. }
  30941. var raw = record.raw;
  30942. if (raw.type === 'Dir') {
  30943. return;
  30944. }
  30945. if (raw.type === "Module" && raw.module) ;
  30946. },
  30947. listeners: {
  30948. itemdblclick: 'onDblClick',
  30949. afterrender: 'onLoad',
  30950. // itemverify() {
  30951. // this.openNode()
  30952. // },
  30953. itemcontextmenu: 'onLisenContextMenu'
  30954. },
  30955. tbar: {
  30956. xtype: 'toolbar',
  30957. items: [
  30958. {
  30959. xtype: 'button',
  30960. tooltip: '刷新',
  30961. iconCls: 'x-fa fa-refresh',
  30962. listeners: {
  30963. click: 'reload'
  30964. }
  30965. },
  30966. /*{
  30967. xtype: 'button',
  30968. tooltip: '添加',
  30969. iconCls: 'x-fa fa-plus-circle',
  30970. menu: [
  30971. {
  30972. text: '类别',
  30973. listeners: {
  30974. click: 'classAdd'
  30975. }
  30976. },
  30977. {
  30978. text: '查询',
  30979. listeners: {
  30980. click: 'reportAdd'
  30981. }
  30982. },
  30983. '-',
  30984. {
  30985. text: '单表定义',
  30986. listeners: {
  30987. click: 'singleTableAdd'
  30988. }
  30989. },
  30990. {
  30991. text: '多表定义',
  30992. listeners: {
  30993. click: 'complexTableAdd'
  30994. }
  30995. },
  30996. {
  30997. text: '查询窗口定义',
  30998. listeners: {
  30999. click: 'widgetAdd'
  31000. }
  31001. },
  31002. ],
  31003. },
  31004. {
  31005. xtype: 'button',
  31006. tooltip: '删除',
  31007. iconCls: 'x-fa fa-minus-circle',
  31008. listeners: {
  31009. click: 'reportRemove'
  31010. }
  31011. },*/
  31012. {
  31013. xtype: 'textfield',
  31014. flex: 1,
  31015. reference: "txtFilter",
  31016. emptyText: '搜索过滤',
  31017. enableKeyEvents: true,
  31018. listeners: {
  31019. change: {
  31020. fn: 'filterChanged',
  31021. buffer: 50
  31022. }
  31023. }
  31024. },
  31025. ]
  31026. },
  31027. });
  31028. }
  31029. //# sourceMappingURL=BpmnTree.js.map
  31030. function initToolBox () {
  31031. Ext.define('com.yvan.studio.ToolBox', {
  31032. extend: 'Ext.panel.Panel',
  31033. xtype: 'toolbox',
  31034. tooltip: '工具箱',
  31035. layout: 'fit',
  31036. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31037. border: false,
  31038. beforeRender: function () {
  31039. console.log('beforeRender', this);
  31040. },
  31041. afterRender: function () {
  31042. var $dom = $(this.body.dom).children('div');
  31043. $dom.append(createComponent());
  31044. $dom.css("height", '100%');
  31045. // @ts-ignore
  31046. $('#_toolbox_list').find('li').each(function () {
  31047. var id = $(this).children(':first').attr('drag_id');
  31048. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31049. setDrag(this, node);
  31050. });
  31051. }
  31052. });
  31053. }
  31054. function setDrag(el, node) {
  31055. new Ext.drag.Source({
  31056. element: el,
  31057. proxy: {
  31058. type: 'placeholder',
  31059. getElement: function (info) {
  31060. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31061. return Ext.getBody().createChild({
  31062. html: html
  31063. });
  31064. }
  31065. },
  31066. listeners: {
  31067. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31068. dragend: delegateDragend.bind(getDesignInstance(), node),
  31069. },
  31070. sourceVjson: node.code,
  31071. dragType: node.dragType
  31072. });
  31073. }
  31074. function createComponent() {
  31075. var template = [];
  31076. for (var i = 0; i < codeLines.length; i++) {
  31077. var item = codeLines[i];
  31078. if (!item.dragHtml) {
  31079. continue;
  31080. }
  31081. var $ele = $("<li>" + item.dragHtml + "</li>");
  31082. $ele.children(':first').attr('drag_id', item.id);
  31083. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31084. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31085. }
  31086. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31087. return html;
  31088. }
  31089. var codeLines = [
  31090. {
  31091. id: '$label',
  31092. value: layoutOrXtypeNameMap.label + ' - label',
  31093. icon: "fa fa-font",
  31094. dragType: "col-item",
  31095. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31096. code: {
  31097. xtype: 'label',
  31098. text: '文本' + _$2.uniqueId('_l')
  31099. }
  31100. },
  31101. {
  31102. id: '$text',
  31103. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31104. icon: "fa fa-edit",
  31105. dragType: "col-item",
  31106. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31107. code: {
  31108. xtype: 'textfield',
  31109. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31110. }
  31111. },
  31112. {
  31113. id: '$textarea',
  31114. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31115. icon: "fa fa-edit",
  31116. dragType: "col-item",
  31117. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31118. code: {
  31119. xtype: 'textareafield',
  31120. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31121. }
  31122. },
  31123. {
  31124. id: '$number',
  31125. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31126. icon: "fa fa-edit",
  31127. dragType: "col-item",
  31128. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31129. code: {
  31130. xtype: 'numberfield',
  31131. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31132. }
  31133. },
  31134. {
  31135. id: '$combo',
  31136. value: layoutOrXtypeNameMap.combo + ' - combo',
  31137. icon: "fa fa-angle-double-down",
  31138. dragType: "col-item",
  31139. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31140. code: {
  31141. xtype: 'combo',
  31142. fieldLabel: '请选择',
  31143. data: [
  31144. { id: 'id1', text: '选项1' },
  31145. { id: 'id2', text: '选项2' },
  31146. { id: 'id3', text: '选项3' },
  31147. ],
  31148. }
  31149. },
  31150. {
  31151. id: '$datebox',
  31152. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31153. icon: "fa fa-calendar",
  31154. dragType: "col-item",
  31155. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31156. code: {
  31157. xtype: "datefield",
  31158. fieldLabel: '日期',
  31159. }
  31160. },
  31161. {
  31162. id: '$searchbox',
  31163. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31164. icon: "fa fa-search",
  31165. dragType: "col-item",
  31166. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31167. code: {
  31168. xtype: 'searchfield',
  31169. fieldLabel: '搜索框',
  31170. }
  31171. },
  31172. {
  31173. id: '$combogrid',
  31174. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31175. icon: "fa fa-table",
  31176. dragType: "col-item",
  31177. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31178. code: {
  31179. xtype: 'combogrid',
  31180. fieldLabel: '下拉表'
  31181. }
  31182. },
  31183. {
  31184. id: '$combotree',
  31185. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31186. icon: "fa fa-tree",
  31187. dragType: "col-item",
  31188. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31189. code: {
  31190. xtype: 'combotree',
  31191. fieldLabel: '下拉树',
  31192. displayField: 'text',
  31193. rootVisible: false
  31194. }
  31195. },
  31196. {
  31197. id: '$button',
  31198. value: layoutOrXtypeNameMap.button + ' - button',
  31199. icon: 'fa fa-sign-in',
  31200. dragType: "col-item",
  31201. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31202. code: {
  31203. text: '按钮',
  31204. iconCls: 'x-fa fa-bars',
  31205. xtype: 'button'
  31206. }
  31207. },
  31208. {
  31209. id: '$checkbox',
  31210. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31211. icon: 'fa fa-check-square',
  31212. dragType: "col-item",
  31213. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31214. code: {
  31215. xtype: 'checkbox',
  31216. boxLabel: '勾选框',
  31217. hideLabel: true,
  31218. margin: '0 0 0 15',
  31219. flex: 0,
  31220. }
  31221. },
  31222. {
  31223. id: '$checkboxgroup',
  31224. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31225. icon: 'fa fa-check-square',
  31226. dragType: "col-item",
  31227. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31228. code: {
  31229. xtype: 'checkboxgroup',
  31230. fieldLabel: '勾选组',
  31231. items: [
  31232. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31233. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31234. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31235. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31236. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31237. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31238. ]
  31239. }
  31240. },
  31241. {
  31242. id: '$radio',
  31243. value: layoutOrXtypeNameMap.radio + ' - radio',
  31244. icon: 'fa fa-dot-circle-o',
  31245. dragType: "col-item",
  31246. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31247. code: {
  31248. xtype: "radio",
  31249. fieldLabel: "请选择",
  31250. }
  31251. },
  31252. {
  31253. id: '$radiogroup',
  31254. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31255. icon: 'fa fa-dot-circle-o',
  31256. dragType: "col-item",
  31257. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31258. code: {
  31259. xtype: "radiogroup",
  31260. fieldLabel: "请选择",
  31261. items: [
  31262. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31263. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31264. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31265. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31266. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31267. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31268. ]
  31269. }
  31270. },
  31271. {
  31272. id: '$cols',
  31273. value: layoutOrXtypeNameMap.cols + ' - cols',
  31274. icon: 'fa fa-list-alt',
  31275. dragType: "cols-container",
  31276. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31277. code: {
  31278. xtype: 'cols',
  31279. items: [
  31280. {
  31281. xtype: 'textfield',
  31282. fieldLabel: '输入框',
  31283. },
  31284. ],
  31285. }
  31286. },
  31287. {
  31288. id: '$container',
  31289. value: layoutOrXtypeNameMap.container + ' - container',
  31290. icon: 'fa fa-flag',
  31291. dragType: "col-item",
  31292. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31293. code: {
  31294. xtype: 'container',
  31295. border: false,
  31296. layout: 'hbox',
  31297. }
  31298. },
  31299. {
  31300. id: '$fit',
  31301. value: layoutOrXtypeNameMap.fit + ' - fit',
  31302. icon: 'fa fa-flag',
  31303. dragType: "rows-container",
  31304. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31305. code: {
  31306. border: false,
  31307. layout: 'fit',
  31308. items: [
  31309. {
  31310. xtype: 'container',
  31311. border: false,
  31312. layout: 'hbox',
  31313. }
  31314. ]
  31315. }
  31316. },
  31317. ];
  31318. // @ts-ignore
  31319. // export default ToolBoxCmp
  31320. //# sourceMappingURL=ToolBox.js.map
  31321. var that = undefined;
  31322. function initPropertyDesign () {
  31323. Ext.define('com.yvan.studio.PropertyDesign', {
  31324. extend: 'Ext.panel.Panel',
  31325. xtype: 'propertydesign',
  31326. name: "PropertyDesign",
  31327. tooltip: '属性',
  31328. iconCls: 'x-fa fa-newspaper-o',
  31329. reference: 'propertygrid',
  31330. layout: 'border',
  31331. border: false,
  31332. moduleId: null,
  31333. currentComponentVJson: null,
  31334. currentComponentPropertyEditSource: null,
  31335. vjson: null,
  31336. propertyHandle: null,
  31337. moduleSubscribe: null,
  31338. items: [
  31339. new Ext.grid.property.Grid({
  31340. sortableColumns: false,
  31341. region: 'center',
  31342. listeners: {
  31343. propertychange: function (source, propName, value, oldValue, eOpts) {
  31344. value = _.trim(value);
  31345. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31346. return item.label === propName;
  31347. });
  31348. if (a.type === 'listeners') {
  31349. if (value) {
  31350. if (that.currentComponentVJson.listeners) {
  31351. that.currentComponentVJson.listeners[propName] = value;
  31352. }
  31353. else {
  31354. var t = {};
  31355. t[propName] = value;
  31356. that.currentComponentVJson.listeners = t;
  31357. }
  31358. }
  31359. else {
  31360. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31361. if (!value1) {
  31362. delete that.currentComponentVJson.listeners[key];
  31363. }
  31364. else if (key === propName) {
  31365. delete that.currentComponentVJson.listeners[key];
  31366. }
  31367. });
  31368. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31369. delete that.currentComponentVJson.listeners;
  31370. }
  31371. }
  31372. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31373. vjson: that.vjson,
  31374. from: that.name,
  31375. ignoreRenderUI: true
  31376. });
  31377. }
  31378. else if (a.type === 'fix') {
  31379. if (!value) {
  31380. delete that.currentComponentVJson[propName];
  31381. }
  31382. else {
  31383. that.currentComponentVJson[propName] = value.split("\r\n");
  31384. }
  31385. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31386. vjson: that.vjson,
  31387. from: that.name,
  31388. ignoreRenderUI: true
  31389. });
  31390. }
  31391. else if (a.type === 'bind') {
  31392. var bind_1 = that.currentComponentVJson.bind;
  31393. if (typeof bind_1 === 'string' && a.id === "value") {
  31394. if (value) {
  31395. that.currentComponentVJson.bind = value;
  31396. }
  31397. else {
  31398. delete that.currentComponentVJson.bind;
  31399. }
  31400. }
  31401. else {
  31402. // 转成bind对象
  31403. if (typeof bind_1 === 'string') {
  31404. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31405. }
  31406. if (value) {
  31407. if (bind_1) {
  31408. bind_1[a.id] = value;
  31409. }
  31410. else {
  31411. var t = {};
  31412. t[a.id] = value;
  31413. that.currentComponentVJson.bind = t;
  31414. }
  31415. }
  31416. else {
  31417. _.forOwn(bind_1, function (value1, key) {
  31418. if (!value1) {
  31419. delete bind_1[key];
  31420. }
  31421. else if (key === a.id) {
  31422. delete bind_1[key];
  31423. }
  31424. });
  31425. if (Object.keys(bind_1).length <= 0) {
  31426. delete that.currentComponentVJson.bind;
  31427. }
  31428. }
  31429. }
  31430. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31431. vjson: that.vjson,
  31432. from: that.name,
  31433. ignoreRenderUI: true
  31434. });
  31435. }
  31436. else if (a.type === 'boolean') {
  31437. if (!value) {
  31438. delete that.currentComponentVJson[propName];
  31439. }
  31440. else if (value === 'false') {
  31441. that.currentComponentVJson[propName] = false;
  31442. }
  31443. else if (value === 'true') {
  31444. that.currentComponentVJson[propName] = true;
  31445. }
  31446. else {
  31447. that.currentComponentVJson[propName] = value;
  31448. }
  31449. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31450. vjson: that.vjson,
  31451. from: that.name
  31452. });
  31453. }
  31454. else {
  31455. that.currentComponentVJson[propName] = value;
  31456. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31457. vjson: that.vjson,
  31458. from: that.name
  31459. });
  31460. }
  31461. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31462. },
  31463. }
  31464. })
  31465. ],
  31466. listeners: {
  31467. // afterrender() {
  31468. // this.propertyHandle.setSource({
  31469. // "(name)": "My Object",
  31470. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31471. // "Available": false, // boolean type
  31472. // "Version": .01, // decimal type
  31473. // "Description": "A test object"
  31474. // });
  31475. // }
  31476. },
  31477. initComponent: function () {
  31478. var _this = this;
  31479. this.propertyHandle = this.items[0];
  31480. setPropertyPanel(this);
  31481. that = this;
  31482. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31483. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31484. _this.setVjson(moduleId, from, ignoreRenderUI);
  31485. });
  31486. return this.superclass.initComponent.apply(this, arguments);
  31487. },
  31488. setVjson: function (moduleId, from, ignoreRenderUI) {
  31489. var _this = this;
  31490. // if (this.moduleId === null && moduleId) {
  31491. // this.moduleId = moduleId
  31492. // }
  31493. if (moduleId !== this.moduleId || from === this.name) {
  31494. return;
  31495. }
  31496. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31497. if (!moduleObj) {
  31498. return;
  31499. }
  31500. this.vjson = moduleObj.moduleObj.vjson;
  31501. this.setPropertyAndEventSource();
  31502. if (this.componentSelectionChangeSubscribe) {
  31503. this.componentSelectionChangeSubscribe.cancel();
  31504. this.componentSelectionChangeSubscribe = null;
  31505. }
  31506. if (this.updateVjsonChangeSubscribe) {
  31507. this.updateVjsonChangeSubscribe.cancel();
  31508. this.updateVjsonChangeSubscribe = null;
  31509. }
  31510. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31511. var id = _a.id, from = _a.from;
  31512. _this.onComponentSelectionChange(id, from);
  31513. });
  31514. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31515. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31516. _this.updateVjson(vjson, from, ignoreRenderUI);
  31517. });
  31518. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31519. this.onComponentSelectionChange(id, from);
  31520. },
  31521. updateVjson: function (vjson, from, ignoreRenderUI) {
  31522. if (!vjson || from === this.name) {
  31523. return;
  31524. }
  31525. this.vjson = vjson;
  31526. this.setPropertyAndEventSource();
  31527. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31528. this.onComponentSelectionChange(id, from);
  31529. },
  31530. onComponentSelectionChange: function (id, from) {
  31531. if (from !== this.name) {
  31532. this.currentComponentVJson = findInCode(this.vjson, id);
  31533. this.setPropertyAndEventSource();
  31534. }
  31535. },
  31536. setPropertyAndEventSource: function () {
  31537. var _this = this;
  31538. this.propertyHandle.setSource({});
  31539. if (!this.currentComponentVJson) {
  31540. return;
  31541. }
  31542. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31543. var v = xtype;
  31544. // 选中的对象可能是组
  31545. if (!v) {
  31546. if (_.has(this.currentComponentVJson, "cols")) {
  31547. v = "cols";
  31548. }
  31549. else if (_.has(this.currentComponentVJson, "rows")) {
  31550. v = "rows";
  31551. }
  31552. }
  31553. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31554. if (!pd) {
  31555. // 这个组件没有属性
  31556. this.propertyHandle.setSource({});
  31557. return;
  31558. }
  31559. var funcArr = this.getAllfuncs();
  31560. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31561. // disabled: true,
  31562. displayField: 'name',
  31563. valueField: 'name',
  31564. store: funcArr,
  31565. }); };
  31566. // ====================== 属性
  31567. var elements = [];
  31568. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31569. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31570. var props = pd.getPropsByGroup(group);
  31571. if (props.length <= 0)
  31572. return; //没有这一组属性
  31573. // 显示 group 的中文名
  31574. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31575. if (caption[i] === '绑定') {
  31576. _.each(props, function (prop) {
  31577. elements.push({
  31578. label: "_" + prop.name,
  31579. type: "bind",
  31580. id: prop.name,
  31581. desc: prop.desc,
  31582. editor: new Ext.form.field.Text()
  31583. });
  31584. });
  31585. }
  31586. else {
  31587. _.each(props, function (prop) {
  31588. if (_.isArray(prop.type)) {
  31589. elements.push({
  31590. label: prop.name,
  31591. type: "combo",
  31592. options: prop.type,
  31593. id: prop.name,
  31594. desc: prop.desc
  31595. });
  31596. return;
  31597. }
  31598. switch (prop.type) {
  31599. case 'boolean': {
  31600. elements.push({
  31601. label: prop.name,
  31602. id: prop.name,
  31603. desc: prop.desc,
  31604. type: 'boolean',
  31605. editor: new Ext.form.field.ComboBox({
  31606. displayField: 'text',
  31607. valueField: 'id',
  31608. store: new Ext.data.Store({
  31609. field: ['id', 'text'],
  31610. data: [
  31611. { id: 'true', text: 'True' },
  31612. { id: 'false', text: 'False' },
  31613. ]
  31614. })
  31615. }),
  31616. });
  31617. break;
  31618. }
  31619. case 'number': {
  31620. elements.push({
  31621. label: prop.name,
  31622. type: "number",
  31623. id: prop.name,
  31624. isNum: true,
  31625. desc: prop.desc,
  31626. editor: new Ext.form.field.Number()
  31627. });
  31628. break;
  31629. }
  31630. case 'string': {
  31631. elements.push({
  31632. label: prop.name,
  31633. type: "string",
  31634. id: prop.name,
  31635. desc: prop.desc,
  31636. editor: new Ext.form.field.Text()
  31637. });
  31638. break;
  31639. }
  31640. case 'listeners': {
  31641. elements.push({
  31642. label: prop.name,
  31643. type: "listeners",
  31644. id: prop.name,
  31645. desc: prop.desc,
  31646. editor: createFuncEditor()
  31647. });
  31648. break;
  31649. }
  31650. case 'fix': {
  31651. elements.push({
  31652. label: prop.name,
  31653. type: "fix",
  31654. id: prop.name,
  31655. desc: prop.desc,
  31656. editor: new Ext.form.field.Text()
  31657. });
  31658. break;
  31659. }
  31660. case 'object': {
  31661. break;
  31662. }
  31663. // case 'dataSource' : {
  31664. // break;
  31665. // }
  31666. case 'valid': {
  31667. break;
  31668. }
  31669. default:
  31670. elements.push({
  31671. label: prop.name,
  31672. type: prop.type,
  31673. id: prop.name,
  31674. desc: prop.desc,
  31675. editor: new Ext.form.field.Text({ disabled: true })
  31676. });
  31677. console.error('不支持的编辑类型', prop);
  31678. }
  31679. });
  31680. }
  31681. });
  31682. this.currentComponentPropertyEditSource = elements;
  31683. var panel1Source = {};
  31684. var panel1SourceConfig = {};
  31685. _.each(elements, function (item) {
  31686. var _a;
  31687. if (item.type === "listeners") {
  31688. var listeners = _this.currentComponentVJson.listeners;
  31689. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31690. }
  31691. else if (item.type === "fix") {
  31692. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31693. }
  31694. else if (item.type === "bind") {
  31695. var bind = _this.currentComponentVJson.bind;
  31696. if (typeof bind === 'string' && item.id === 'value') {
  31697. panel1Source[item.label] = bind;
  31698. }
  31699. else {
  31700. panel1Source[item.label] = bind ? bind[item.id] : '';
  31701. }
  31702. }
  31703. else {
  31704. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31705. }
  31706. panel1Source[item.label] = panel1Source[item.label] || '';
  31707. panel1SourceConfig[item.label] = { editor: item.editor };
  31708. });
  31709. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31710. },
  31711. getAllfuncs: function () {
  31712. var _a, _b;
  31713. var arr = (_b = (_a = handles$1.mainWindow.activeModulePage.refs) === null || _a === void 0 ? void 0 : _a.controllerEditor) === null || _b === void 0 ? void 0 : _b.funcArr;
  31714. var scopeFuncs = [];
  31715. _.forEach(arr, function (item) {
  31716. scopeFuncs.push({ name: "scope." + item.name });
  31717. });
  31718. return scopeFuncs;
  31719. }
  31720. });
  31721. }
  31722. //# sourceMappingURL=PropertyDesign.js.map
  31723. function initViewOutlineTree () {
  31724. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31725. extend: 'Ext.tree.Panel',
  31726. xtype: 'viewoutlinetree',
  31727. name: "ViewOutlineTree",
  31728. tooltip: '设计大纲',
  31729. iconCls: 'x-fa fa-list',
  31730. rootVisible: false,
  31731. useArrows: true,
  31732. allowDeselect: true,
  31733. colspan: 2,
  31734. lines: false,
  31735. reference: 'viewoutlinetree',
  31736. multiSelect: true,
  31737. _saveStateFlag: true,
  31738. keyMapEnabled: true,
  31739. moduleId: null,
  31740. vjson: null,
  31741. columns: [
  31742. {
  31743. xtype: 'treecolumn',
  31744. text: '布局',
  31745. dataIndex: 'layoutNameDesc',
  31746. flex: 2,
  31747. sortable: true
  31748. }, {
  31749. text: '组件',
  31750. dataIndex: 'xtype',
  31751. flex: 1,
  31752. sortable: true,
  31753. align: 'center',
  31754. }
  31755. ],
  31756. listeners: {
  31757. itemcontextmenu: function (sender, node, element, idx, e) {
  31758. e.preventDefault();
  31759. this.rightClickTreeNode(sender, node, element, idx, e);
  31760. },
  31761. select: function (sender, node, index, e) {
  31762. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31763. },
  31764. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31765. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31766. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31767. }
  31768. }
  31769. },
  31770. initComponent: function () {
  31771. var _this = this;
  31772. setViewoutlinetree(this);
  31773. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31774. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31775. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31776. });
  31777. return this.superclass.initComponent.apply(this, arguments);
  31778. },
  31779. clear: function () {
  31780. this.setRootNode(null);
  31781. },
  31782. onChangModule: function (moduleId, oldModuleId, from) {
  31783. if (!moduleId || moduleId !== this.moduleId) {
  31784. return;
  31785. }
  31786. if (moduleStore.getModuleObject(moduleId)) {
  31787. this.setVjson(moduleId, from);
  31788. }
  31789. },
  31790. setVjson: function (moduleId, from, ignoreRenderUI) {
  31791. var _this = this;
  31792. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31793. return;
  31794. }
  31795. this.moduleId = moduleId;
  31796. // if (from === this.name) {
  31797. // return
  31798. // }
  31799. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31800. this.setTreeValue();
  31801. if (this.componentSelectionChangeSubscribe) {
  31802. this.componentSelectionChangeSubscribe.cancel();
  31803. this.componentSelectionChangeSubscribe = null;
  31804. }
  31805. if (this.setVjsonChangeSubscribe) {
  31806. this.setVjsonChangeSubscribe.cancel();
  31807. this.setVjsonChangeSubscribe = null;
  31808. }
  31809. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31810. var id = _a.id, from = _a.from;
  31811. return _this.onComponentSelectionChange(id, from);
  31812. });
  31813. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31814. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31815. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31816. });
  31817. },
  31818. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31819. if (!vjson || from === this.name) {
  31820. return;
  31821. }
  31822. this.vjson = vjson;
  31823. this.setTreeValue();
  31824. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31825. if (id) {
  31826. this.selectPath(id);
  31827. }
  31828. },
  31829. onComponentSelectionChange: function (id, from) {
  31830. if (from !== this.name) {
  31831. if (id) {
  31832. this.selectPath(id);
  31833. }
  31834. else {
  31835. this.setTreeValue();
  31836. }
  31837. }
  31838. },
  31839. setTreeValue: function () {
  31840. var outlineVj = {};
  31841. _.forOwn(this.vjson, function (obj, key) {
  31842. if (key !== 'viewModel' && key !== 'store') {
  31843. outlineVj[key] = _.cloneDeep(obj);
  31844. }
  31845. });
  31846. getLayoutOutline(outlineVj);
  31847. this.setRootNode(outlineVj);
  31848. },
  31849. rightClickTreeNode: function (sender, node, element, idx, e) {
  31850. var raw = node.data;
  31851. var option = {};
  31852. // 右键
  31853. option = {
  31854. shadow: 'frame',
  31855. allowOtherMenus: true,
  31856. items: []
  31857. };
  31858. var switchType = raw.layoutName;
  31859. if (raw.layoutName === 'north' ||
  31860. raw.layoutName === 'south' ||
  31861. raw.layoutName === 'west' ||
  31862. raw.layoutName === 'east' ||
  31863. raw.layoutName === 'center' ||
  31864. raw.layoutName === 'tbar' ||
  31865. raw.layoutName === 'fbar') {
  31866. switchType = raw.xtype || raw.layout;
  31867. }
  31868. var itemArr = [];
  31869. var hasTbar = false, hasFbar = false, hasBody = false;
  31870. if (raw.hasOwnProperty("children")) {
  31871. _.forEach(raw.children, function (value) {
  31872. if (value.layoutName === 'tbar') {
  31873. hasTbar = true;
  31874. }
  31875. else if (value.layoutName === 'fbar') {
  31876. hasFbar = true;
  31877. }
  31878. else {
  31879. hasBody = true;
  31880. }
  31881. });
  31882. }
  31883. switch (switchType) {
  31884. case 'fit':
  31885. if (!hasTbar) {
  31886. itemArr.push('tbar');
  31887. }
  31888. if (!hasFbar) {
  31889. itemArr.push('fbar');
  31890. }
  31891. if (!hasBody) {
  31892. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31893. }
  31894. option.items = this.menuNew(itemArr, raw);
  31895. break;
  31896. case 'border':
  31897. if (!hasTbar) {
  31898. itemArr.push('tbar');
  31899. }
  31900. if (!hasFbar) {
  31901. itemArr.push('fbar');
  31902. }
  31903. itemArr.push('cnsew');
  31904. option.items = this.menuNew(itemArr, raw);
  31905. break;
  31906. // case 'tbar':
  31907. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31908. // break;
  31909. // case 'fbar':
  31910. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31911. // break;
  31912. case 'tabpanel':
  31913. if (!hasTbar) {
  31914. itemArr.push('tbar');
  31915. }
  31916. if (!hasFbar) {
  31917. itemArr.push('fbar');
  31918. }
  31919. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31920. option.items = this.menuNew(itemArr, raw);
  31921. break;
  31922. case 'yvgrid':
  31923. if (!hasTbar) {
  31924. itemArr.push('tbar');
  31925. }
  31926. option.items = this.menuNew(itemArr, raw);
  31927. break;
  31928. case 'tree':
  31929. if (!hasTbar) {
  31930. itemArr.push('tbar');
  31931. }
  31932. if (!hasFbar) {
  31933. itemArr.push('fbar');
  31934. }
  31935. option.items = this.menuNew(itemArr, raw);
  31936. break;
  31937. case 'fieldset':
  31938. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31939. break;
  31940. case 'form':
  31941. if (!hasTbar) {
  31942. itemArr.push('tbar');
  31943. }
  31944. if (!hasFbar) {
  31945. itemArr.push('fbar');
  31946. }
  31947. itemArr.push('form', 'fieldset', 'cols');
  31948. option.items = this.menuNew(itemArr, raw);
  31949. break;
  31950. case 'toolbar':
  31951. itemArr.push('button', 'textfield', 'label', 'combo');
  31952. option.items = this.menuNew(itemArr, raw);
  31953. break;
  31954. // case 'fbar':
  31955. // itemArr.push('button', 'textfield', 'label', 'combo')
  31956. // option.items = this.menuNew(itemArr, raw)
  31957. // break
  31958. default:
  31959. option.items = this.menuNew(itemArr, raw);
  31960. break;
  31961. }
  31962. var treeMenu = new Ext.menu.Menu(option);
  31963. treeMenu.showAt(e.getXY());
  31964. },
  31965. newItem: function (viewType, raw, region) {
  31966. var itemVjson = {};
  31967. switch (viewType) {
  31968. case 'fit':
  31969. itemVjson.layout = 'fit';
  31970. itemVjson.items = [];
  31971. break;
  31972. case 'border':
  31973. itemVjson.layout = 'border';
  31974. itemVjson.items = [];
  31975. break;
  31976. case 'toolbar':
  31977. itemVjson.xtype = 'toolbar';
  31978. itemVjson.title = 'toolbar';
  31979. itemVjson.items = [
  31980. {
  31981. xtype: 'button',
  31982. text: 'button'
  31983. }
  31984. ];
  31985. break;
  31986. case 'tabpanel':
  31987. itemVjson.xtype = 'tabpanel';
  31988. itemVjson.layout = 'fit';
  31989. itemVjson.items = [];
  31990. break;
  31991. case 'yvgrid':
  31992. itemVjson.xtype = 'yvgrid';
  31993. itemVjson.layout = 'fit';
  31994. itemVjson.pagination = false;
  31995. itemVjson.columns = [
  31996. {
  31997. dataIndex: "skuId",
  31998. header: "SKU_ID",
  31999. },
  32000. ];
  32001. break;
  32002. case 'tree':
  32003. itemVjson.xtype = 'treepanel';
  32004. itemVjson.layout = 'fit';
  32005. break;
  32006. case 'fieldset':
  32007. case 'form':
  32008. itemVjson.xtype = viewType;
  32009. itemVjson.title = viewType;
  32010. itemVjson.items = [
  32011. {
  32012. xtype: 'cols',
  32013. items: [
  32014. {
  32015. xtype: 'textfield',
  32016. fieldLabel: '输入框'
  32017. }
  32018. ]
  32019. }
  32020. ];
  32021. break;
  32022. case 'cols':
  32023. itemVjson.xtype = 'cols';
  32024. itemVjson.items = [
  32025. {
  32026. xtype: 'textfield',
  32027. fieldLabel: '输入框'
  32028. }
  32029. ];
  32030. break;
  32031. case 'button':
  32032. itemVjson.xtype = 'button';
  32033. itemVjson.text = '按钮';
  32034. itemVjson.iconCls = 'x-fa fa-plus';
  32035. break;
  32036. case 'textfield':
  32037. itemVjson.xtype = 'textfield';
  32038. itemVjson.fieldLabel = '输入框';
  32039. break;
  32040. case 'combo':
  32041. itemVjson.xtype = 'combo';
  32042. itemVjson.fieldLabel = '下拉框';
  32043. break;
  32044. case 'label':
  32045. itemVjson.xtype = 'label';
  32046. itemVjson.text = '文本';
  32047. break;
  32048. }
  32049. var target = findInCode(this.vjson, raw.id);
  32050. if (region) {
  32051. if (region === 'tbar' || region === 'fbar') {
  32052. target[region] = itemVjson;
  32053. }
  32054. else {
  32055. itemVjson.region = region;
  32056. itemVjson.split = true;
  32057. if (region === 'north' || region === 'south') {
  32058. itemVjson.height = '30%';
  32059. itemVjson.collapsible = true;
  32060. }
  32061. else if (region === 'west' || region === 'east') {
  32062. itemVjson.width = '30%';
  32063. itemVjson.collapsible = true;
  32064. }
  32065. target.items.push(itemVjson);
  32066. }
  32067. }
  32068. else {
  32069. if (target.xtype === 'tabpanel') {
  32070. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32071. }
  32072. target.items.push(itemVjson);
  32073. }
  32074. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32075. },
  32076. menuNew: function (typeArr, raw, region) {
  32077. var that = this;
  32078. var reArr = [];
  32079. typeArr.forEach(function (value) {
  32080. if (value === 'cnsew') {
  32081. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32082. }
  32083. else if (value === 'tbar' || value === 'fbar') {
  32084. reArr.push(that.menuNewTFBar(value, raw));
  32085. }
  32086. else {
  32087. reArr.push({
  32088. text: '新建' + layoutOrXtypeNameMap[value],
  32089. iconCls: 'x-fa fa-plus',
  32090. handler: function (sender) {
  32091. that.newItem(value, raw, region);
  32092. }
  32093. });
  32094. }
  32095. reArr.push("-");
  32096. });
  32097. if (region) {
  32098. reArr.pop();
  32099. return reArr;
  32100. }
  32101. reArr.push({
  32102. text: '高级属性',
  32103. iconCls: 'x-fa fa-cog',
  32104. handler: function (sender) {
  32105. var vj = findInCode(that.vjson, raw.id);
  32106. that.advancedSettingWindow(vj);
  32107. }
  32108. }, {
  32109. text: '上移',
  32110. iconCls: 'x-fa fa-trash',
  32111. handler: function (sender) {
  32112. that.moveCmp(raw.id, 'up');
  32113. }
  32114. }, {
  32115. text: '置顶',
  32116. iconCls: 'x-fa fa-trash',
  32117. handler: function (sender) {
  32118. that.moveCmp(raw.id, 'top');
  32119. }
  32120. }, {
  32121. text: '置底',
  32122. iconCls: 'x-fa fa-trash',
  32123. handler: function (sender) {
  32124. that.moveCmp(raw.id, 'bottom');
  32125. }
  32126. }, {
  32127. text: '下移',
  32128. iconCls: 'x-fa fa-trash',
  32129. handler: function (sender) {
  32130. that.moveCmp(raw.id, 'down');
  32131. }
  32132. }, {
  32133. text: '删除',
  32134. iconCls: 'x-fa fa-trash',
  32135. handler: function (sender) {
  32136. deletVjsonById(that.vjson, raw.id);
  32137. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32138. }
  32139. });
  32140. return reArr;
  32141. },
  32142. menuNewCNSEW: function (raw) {
  32143. var that = this;
  32144. var arr = ['center', 'north', 'south', 'west', 'east'];
  32145. if (raw.hasOwnProperty("children")) {
  32146. _.forEach(raw.children, function (value) {
  32147. _.remove(arr, function (it) {
  32148. return it === value.layoutName;
  32149. });
  32150. });
  32151. }
  32152. var reArr = [];
  32153. arr.forEach(function (value) {
  32154. reArr.push({
  32155. text: layoutOrXtypeNameMap[value],
  32156. iconCls: 'x-fa fa-plus',
  32157. menu: {
  32158. showSeparator: true,
  32159. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32160. }
  32161. });
  32162. reArr.push("-");
  32163. });
  32164. reArr.pop();
  32165. return reArr;
  32166. },
  32167. menuNewTFBar: function (barType, raw) {
  32168. var that = this;
  32169. var reObj = {
  32170. text: layoutOrXtypeNameMap[barType],
  32171. iconCls: 'x-fa fa-plus',
  32172. menu: {
  32173. showSeparator: true,
  32174. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32175. }
  32176. };
  32177. return reObj;
  32178. },
  32179. moveCmp: function (id, moveType) {
  32180. var arr = findArrayContainer(this.vjson, id);
  32181. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32182. if (index < 0) {
  32183. return;
  32184. }
  32185. switch (moveType) {
  32186. case 'up':
  32187. if (index > 0) {
  32188. var o = arr[index];
  32189. arr[index] = arr[index - 1];
  32190. arr[index - 1] = o;
  32191. }
  32192. else {
  32193. return;
  32194. }
  32195. break;
  32196. case 'down':
  32197. if (index < arr.length - 1) {
  32198. var o = arr[index];
  32199. arr[index] = arr[index + 1];
  32200. arr[index + 1] = o;
  32201. }
  32202. else {
  32203. return;
  32204. }
  32205. break;
  32206. case 'top':
  32207. if (index > 0) {
  32208. var o = arr[index];
  32209. arr[index] = arr[0];
  32210. arr[0] = o;
  32211. }
  32212. else {
  32213. return;
  32214. }
  32215. break;
  32216. case 'bottom':
  32217. if (index < arr.length - 1) {
  32218. var o = arr[index];
  32219. arr[index] = arr[arr.length - 1];
  32220. arr[arr.length - 1] = o;
  32221. }
  32222. else {
  32223. return;
  32224. }
  32225. break;
  32226. }
  32227. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32228. }
  32229. });
  32230. }
  32231. //# sourceMappingURL=ViewOutlineTree.js.map
  32232. function init$2 () {
  32233. window['native'] = native;
  32234. native.init();
  32235. init();
  32236. instance.getAllDomain().finally(function () {
  32237. });
  32238. initStateTree();
  32239. initDashboard();
  32240. initFileTree();
  32241. initDbTree();
  32242. initReportGrid();
  32243. initGroovyEditor();
  32244. initJsEditor$1();
  32245. initJsonEditor$1();
  32246. initSqlEditor$1();
  32247. initTemplateEditor();
  32248. initDict$1();
  32249. initBpmnTree();
  32250. initToolBox();
  32251. initPropertyDesign();
  32252. initViewOutlineTree();
  32253. initWidget();
  32254. initWhLayout();
  32255. initApiTree();
  32256. initTaskTree();
  32257. initLogsTree();
  32258. initDevOpsTree();
  32259. initTerminal();
  32260. initMonitorTree();
  32261. initHomeTree();
  32262. }
  32263. var studio = {
  32264. init: init$2,
  32265. handles: handles$1,
  32266. Workbench: Workbench
  32267. };
  32268. //# sourceMappingURL=index.js.map
  32269. exports.axios = axios;
  32270. exports.qs = Qs;
  32271. exports.lodash = _$2;
  32272. exports.jquery = $$2;
  32273. exports.moment = moment$1;
  32274. exports.recast = recast;
  32275. exports.XLSX = XLSX;
  32276. exports.Defaults = Defaults;
  32277. exports.ExcelImportDialog = ExcelImportDialog;
  32278. exports.Lib = Lib;
  32279. exports.LibParam = LibParam;
  32280. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32281. exports.ReportScope = ReportScope;
  32282. exports.SIMPLE_RE = SIMPLE_RE;
  32283. exports.Scope = Scope;
  32284. exports.ScopeEngine = ScopeEngine;
  32285. exports.SystemEventFu = SystemEventFu;
  32286. exports.ajax = ajax;
  32287. exports.baseConfigProcess = baseConfigProcess;
  32288. exports.baseConfigProcessList = baseConfigProcessList;
  32289. exports.buildPlus = buildPlus;
  32290. exports.buildReportScope = buildReportScope;
  32291. exports.calcExpress = calcExpress;
  32292. exports.calcObject = calcObject;
  32293. exports.calcObjectFlat = calcObjectFlat;
  32294. exports.clearViewModel = clearViewModel;
  32295. exports.clearViewModelByLookup = clearViewModelByLookup;
  32296. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32297. exports.clearViewModelValues = clearViewModelValues;
  32298. exports.commitMe = commitMe;
  32299. exports.confirm = confirm;
  32300. exports.createAjax = createAjax;
  32301. exports.createUUID = createUUID;
  32302. exports.deepTravJson = deepTravJson;
  32303. exports.downLoad = downLoad;
  32304. exports.evalFunction = evalFunction;
  32305. exports.extend = extend;
  32306. exports.flatRow = flatRow;
  32307. exports.getApiConvert = getApiConvert;
  32308. exports.getGridEditRows = getGridEditRows;
  32309. exports.getParentGrid = getParentGrid;
  32310. exports.getPinyin = getPinyin;
  32311. exports.getRegList = getRegList;
  32312. exports.getRegParamList = getRegParamList;
  32313. exports.getScopeOnCreate = getScopeOnCreate;
  32314. exports.init = init$1;
  32315. exports.insertGridRow = insertGridRow;
  32316. exports.invokeServer = invokeServer$1;
  32317. exports.isDesignMode = isDesignMode;
  32318. exports.isEmpty = isEmpty;
  32319. exports.json5 = dist;
  32320. exports.keywordFilter = keywordFilter;
  32321. exports.lookupFn = lookupFn;
  32322. exports.lookupScope = lookupScope;
  32323. exports.mergeViewModel = mergeViewModel;
  32324. exports.moveDownGridRow = moveDownGridRow;
  32325. exports.moveUpGridRow = moveUpGridRow;
  32326. exports.msg = msg$1;
  32327. exports.msgError = msgError;
  32328. exports.normId = normId;
  32329. exports.pinyinMatch = pinyinMatch;
  32330. exports.prompt = prompt$2;
  32331. exports.raiseClick = raiseClick;
  32332. exports.reloadGrid = reloadGrid;
  32333. exports.removeGridRow = removeGridRow;
  32334. exports.replaceNA = replaceNA;
  32335. exports.saveGridRow = saveGridRow;
  32336. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32337. exports.setComboStore = setComboStore;
  32338. exports.showErrorDialog = showErrorDialog$1;
  32339. exports.showInfoDialog = showInfoDialog;
  32340. exports.showWidget = showWidget;
  32341. exports.sqlUrlTransform = sqlUrlTransform;
  32342. exports.stopEvent = stopEvent;
  32343. exports.studio = studio;
  32344. exports.toPlainObject = toPlainObject;
  32345. exports.toString = toString;
  32346. exports.tryEnable = tryEnable;
  32347. exports.tryVarSimple = tryVarSimple;
  32348. exports.tryWriteByExpress = tryWriteByExpress;
  32349. exports.tryWriteObject = tryWriteObject;
  32350. exports.watch = watch;
  32351. Object.defineProperty(exports, '__esModule', { value: true });
  32352. });
  32353. //# sourceMappingURL=yvan-ext.js.map