yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728
  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 $body = $$2('body');
  2192. $body.find('[xtype=tooltip]').remove();
  2193. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2194. ' <div class="yvan-msg-content">' +
  2195. _$2.escape(message) +
  2196. '</div></div>');
  2197. $body.append($w);
  2198. var iframeWidth = $w.parent().width();
  2199. var iframeHeight = $w.parent().height();
  2200. var windowWidth = $w.width();
  2201. var windowHeight = $w.height();
  2202. var setWidth = (iframeWidth - windowWidth) / 2;
  2203. var setHeight = (iframeHeight - windowHeight) / 2;
  2204. if (iframeHeight < windowHeight || setHeight < 0) {
  2205. setHeight = 0;
  2206. }
  2207. if (iframeWidth < windowWidth || setWidth < 0) {
  2208. setWidth = 0;
  2209. }
  2210. $w.css({ left: setWidth, top: setHeight });
  2211. setTimeout(function () {
  2212. $w.remove();
  2213. }, 3000);
  2214. }
  2215. //# sourceMappingURL=message.js.map
  2216. localforage.config({
  2217. name: "studio",
  2218. storeName: "item",
  2219. });
  2220. function getItem(key, callback) {
  2221. localforage.getItem(key).then(function (value) {
  2222. if (callback) {
  2223. callback(value);
  2224. }
  2225. });
  2226. }
  2227. function setItem(key, value, callback) {
  2228. localforage.setItem(key, value).then(function (val) {
  2229. if (callback) {
  2230. callback();
  2231. }
  2232. });
  2233. }
  2234. var native = {
  2235. /**
  2236. * 读取文件
  2237. */
  2238. loadFile: function (fileName, callback) {
  2239. console.log('loadFile', fileName);
  2240. getItem('NATIVE_' + fileName, callback);
  2241. },
  2242. /**
  2243. * 保存文件
  2244. */
  2245. saveFile: function (fileName, content) {
  2246. console.log('saveFile', fileName, content);
  2247. setItem('NATIVE_' + fileName, content);
  2248. },
  2249. openInIdea: function (path) {
  2250. msg(path);
  2251. },
  2252. /**
  2253. * 初始化 native 工具类
  2254. */
  2255. init: function () {
  2256. var ClipboardJS = window['ClipboardJS'];
  2257. if (!ClipboardJS) {
  2258. msg('没有引入 ClipboardJS');
  2259. return;
  2260. }
  2261. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2262. var clipboard = new ClipboardJS('.__btnClipboard');
  2263. },
  2264. /**
  2265. * 设置剪切板
  2266. */
  2267. clipboardSet: function (c) {
  2268. var $btn = $('.__btnClipboard');
  2269. $btn.attr('data-clipboard-text', c);
  2270. $btn.trigger("click");
  2271. },
  2272. };
  2273. /**
  2274. * 判断变量是否有值 value === null || value === undefined
  2275. * @param value 目标变量
  2276. */
  2277. var noValue = function (value) {
  2278. return value === null || value === undefined;
  2279. };
  2280. //# sourceMappingURL=Utils.js.map
  2281. function initStateTree () {
  2282. Ext.define('com.yvan.studio.StateTree', {
  2283. extend: 'Ext.tree.Panel',
  2284. _saveStateFlag: true,
  2285. _filterText: '',
  2286. fbar: [
  2287. {
  2288. xtype: 'textfield',
  2289. flex: 1,
  2290. emptyText: '搜索过滤',
  2291. enableKeyEvents: true,
  2292. listeners: {
  2293. change: function (sender) {
  2294. var tree = sender.up("treepanel");
  2295. tree.filterByText(this.getRawValue());
  2296. },
  2297. keyup: function (sender, e) {
  2298. var tree = sender.up("treepanel");
  2299. if (e.ESC === e.getKey()) {
  2300. sender.setValue('');
  2301. tree.filterByText('');
  2302. }
  2303. }
  2304. }
  2305. },
  2306. ],
  2307. getStateFilename: function () {
  2308. throw Error('没有实现这个函数');
  2309. },
  2310. initComponent: function () {
  2311. var me = this;
  2312. this.on({
  2313. afterrender: function () {
  2314. var _this = this;
  2315. // 回车后打开节点
  2316. $(me.el.dom).keydown(function (event) {
  2317. if (event.keyCode === 13) {
  2318. event.preventDefault();
  2319. _this.fireEvent('itemverify');
  2320. return;
  2321. }
  2322. });
  2323. },
  2324. afteritemexpand: {
  2325. fn: function (node, index, item, eOpts) {
  2326. this.saveState();
  2327. },
  2328. buffer: 100,
  2329. },
  2330. afteritemcollapse: {
  2331. fn: function (node, index, item, eOpts) {
  2332. this.saveState();
  2333. },
  2334. buffer: 100,
  2335. },
  2336. itemdblclick: function (sender, record) {
  2337. this.fireEvent('itemverify');
  2338. },
  2339. itemclick: {
  2340. fn: function (node, index, item, eOpts) {
  2341. this.saveState();
  2342. },
  2343. buffer: 100,
  2344. }
  2345. });
  2346. this.superclass.superclass.initComponent.apply(this, arguments);
  2347. },
  2348. restoreState: function () {
  2349. var _this = this;
  2350. native.loadFile(this.getStateFilename(), function (content) {
  2351. if (!content)
  2352. return;
  2353. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2354. _this._saveStateFlag = false;
  2355. if (_.isArray(expands)) {
  2356. _.forEach(expands, function (p) {
  2357. _this.expandPath(p);
  2358. });
  2359. }
  2360. if (_.isArray(selections) && selections[0]) {
  2361. try {
  2362. _this.selectPath(selections[0]);
  2363. }
  2364. catch (e) {
  2365. }
  2366. }
  2367. if (scrollPosition && scrollSize) {
  2368. var size = _this.scrollable.getSize();
  2369. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2370. try {
  2371. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2372. }
  2373. catch (e) {
  2374. }
  2375. }
  2376. }
  2377. setTimeout(function () {
  2378. _this._saveStateFlag = true;
  2379. }, 200);
  2380. });
  2381. },
  2382. saveState: function () {
  2383. if (!this._saveStateFlag) {
  2384. return;
  2385. }
  2386. if (this._filterText) {
  2387. // 有筛选,不保存展开状态
  2388. return;
  2389. }
  2390. var expands = [];
  2391. var selections = [];
  2392. var selection = this.getSelection();
  2393. _.forEach(selection, function (item) {
  2394. selections.push(item.getPath());
  2395. });
  2396. var data = this.getStore().data;
  2397. _.forEach(data.items, function (item) {
  2398. if (item.data.expanded === true) {
  2399. expands.push(item.getPath());
  2400. }
  2401. });
  2402. var scrollPosition = this.scrollable.position;
  2403. var scrollSize = this.scrollable.getSize();
  2404. native.saveFile(this.getStateFilename(), {
  2405. selections: selections,
  2406. expands: expands,
  2407. scrollPosition: scrollPosition,
  2408. scrollSize: scrollSize
  2409. });
  2410. },
  2411. filterByText: function (text) {
  2412. this._filterText = text;
  2413. this._filterBy(this, text, 'text');
  2414. },
  2415. _filterBy: _.debounce(function (me, text, by) {
  2416. var view = me.getView();
  2417. me.store.clearFilter();
  2418. if (!me._filterText) {
  2419. // 没有筛选内容,还原状态
  2420. var selections = me.getSelection();
  2421. var selectionPaths_1 = [];
  2422. _.forEach(me.getSelection(), function (item) {
  2423. selectionPaths_1.push(item.getPath());
  2424. });
  2425. me.collapseAll();
  2426. me.restoreState();
  2427. _.forEach(selectionPaths_1, function (path) {
  2428. me.expandPath(path);
  2429. });
  2430. me.setSelection(selections);
  2431. return;
  2432. }
  2433. // 递归查找所有需要可见的节点 id 数组
  2434. var nodesAndParents = [];
  2435. var expandPaths = [];
  2436. me.getRootNode().cascadeBy(function (tree, view) {
  2437. var currNode = this;
  2438. currNode.collapse();
  2439. if (currNode && currNode.data[by] &&
  2440. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2441. // 展开到匹配的路径
  2442. // me.expandPath(currNode.getPath());
  2443. expandPaths.push(currNode.getPath());
  2444. // 沿途父节点全部设定为可见
  2445. while (currNode.parentNode) {
  2446. nodesAndParents.push(currNode.id);
  2447. currNode = currNode.parentNode;
  2448. }
  2449. }
  2450. }, null, [me, view]);
  2451. me.store.filterBy(function (r) {
  2452. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2453. });
  2454. _.forEach(expandPaths, function (path) {
  2455. me.expandPath(path);
  2456. });
  2457. }, 1000),
  2458. });
  2459. }
  2460. //# sourceMappingURL=StateTree.js.map
  2461. function initDashboard () {
  2462. Ext.define('com.yvan.studio.Dashboard', {
  2463. extend: 'Ext.panel.Panel',
  2464. alias: 'widget.dashboard',
  2465. xtype: 'dashboard',
  2466. html: ''
  2467. });
  2468. }
  2469. //# sourceMappingURL=dashboard.js.map
  2470. var handles$1 = {
  2471. mainWindow: undefined,
  2472. fileTree: undefined,
  2473. dbTree: undefined,
  2474. viewoutlinetree: undefined,
  2475. statusbar: undefined,
  2476. dictTree: undefined,
  2477. property: undefined,
  2478. dbcode: undefined,
  2479. report: undefined,
  2480. widget: undefined,
  2481. whLayout: undefined,
  2482. };
  2483. window['handles'] = handles$1;
  2484. function setDictTree(value) {
  2485. handles$1.dictTree = value;
  2486. }
  2487. function setMainWindow(value) {
  2488. handles$1.mainWindow = value;
  2489. }
  2490. function setReport(value) {
  2491. handles$1.report = value;
  2492. }
  2493. function setStatusbar(statusbar) {
  2494. handles$1.statusbar = statusbar;
  2495. }
  2496. function setFileTree(value) {
  2497. handles$1.fileTree = value;
  2498. }
  2499. function setDbTree(value) {
  2500. handles$1.dbTree = value;
  2501. }
  2502. function setWidget(value) {
  2503. handles$1.widget = value;
  2504. }
  2505. function setWhLayout(value) {
  2506. handles$1.whLayout = value;
  2507. }
  2508. function setViewoutlinetree(value) {
  2509. handles$1.viewoutlinetree = value;
  2510. }
  2511. function setPropertyPanel(value) {
  2512. handles$1.property = value;
  2513. }
  2514. function setDbCode(value) {
  2515. handles$1.dbcode = value;
  2516. }
  2517. //# sourceMappingURL=Handles.js.map
  2518. /**
  2519. * 调用方法
  2520. */
  2521. function invokeMethod(fn, sender, args) {
  2522. if (typeof fn === 'function') {
  2523. fn.apply.apply(fn, __spread([sender], args));
  2524. }
  2525. }
  2526. /**
  2527. * 判断事件是否为有效的输入字符
  2528. * @param e
  2529. */
  2530. function isChartEvent(e) {
  2531. if (e.key === 'Shift' ||
  2532. e.key === 'Control' ||
  2533. e.key === 'Alt' ||
  2534. e.key === 'Escape' ||
  2535. e.key === 'ArrowRight' ||
  2536. e.key === 'Tab' ||
  2537. e.key === 'ArrowLeft') {
  2538. return false;
  2539. }
  2540. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2541. // 0-9
  2542. return true;
  2543. }
  2544. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2545. // a-z
  2546. return true;
  2547. }
  2548. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2549. // 小键盘 0-9
  2550. return true;
  2551. }
  2552. return false;
  2553. }
  2554. if (!window["time_offset"]) {
  2555. window["time_offset"] = 0;
  2556. }
  2557. function syncDate(date) {
  2558. if (date && date.setTime && date.getTime) {
  2559. date.setTime(date.getTime() + window["time_offset"]);
  2560. }
  2561. return date;
  2562. }
  2563. //# sourceMappingURL=utils.js.map
  2564. function isDesignMode(control, config) {
  2565. var _a, _b;
  2566. if (window["IS_DESIGN_MODE"]) {
  2567. return true;
  2568. }
  2569. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2570. return true;
  2571. }
  2572. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2573. return true;
  2574. }
  2575. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2576. return true;
  2577. }
  2578. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2579. return true;
  2580. }
  2581. return false;
  2582. }
  2583. function toString(value) {
  2584. if (typeof value === 'undefined' || value === null) {
  2585. return "";
  2586. }
  2587. if (typeof value === 'number' && isNaN(value)) {
  2588. return "";
  2589. }
  2590. if (value == 'N/A') {
  2591. return "";
  2592. }
  2593. return ("" + value);
  2594. }
  2595. function isEmpty(value) {
  2596. if (typeof value === 'undefined' || value === null) {
  2597. return true;
  2598. }
  2599. if (typeof value === 'number' && isNaN(value)) {
  2600. return true;
  2601. }
  2602. if (value == 'N/A') {
  2603. return true;
  2604. }
  2605. return ("" + value).trim().length <= 0;
  2606. }
  2607. function createUUID() {
  2608. //@ts-ignore
  2609. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2610. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2611. });
  2612. }
  2613. function getRegList() {
  2614. var regList = _$2.get(window, 'yvanLib.regList');
  2615. if (!regList) {
  2616. regList = [];
  2617. _$2.set(window, 'yvanLib.regList', regList);
  2618. }
  2619. return regList;
  2620. }
  2621. function getRegParamList(methodName) {
  2622. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2623. if (!regParamList) {
  2624. regParamList = {};
  2625. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2626. }
  2627. if (!_$2.has(regParamList, methodName)) {
  2628. regParamList[methodName] = [];
  2629. }
  2630. return regParamList[methodName];
  2631. }
  2632. /**
  2633. * 模拟点击按钮
  2634. */
  2635. function raiseClick(buttonHandle) {
  2636. if (!buttonHandle) {
  2637. return false;
  2638. }
  2639. if (buttonHandle.disabled) {
  2640. // 按钮是禁止状态
  2641. return false;
  2642. }
  2643. if (buttonHandle.hidden) {
  2644. // 按钮是隐藏状态
  2645. return false;
  2646. }
  2647. // 按钮点击
  2648. buttonHandle.click();
  2649. return true;
  2650. }
  2651. /**
  2652. * 标注系统全局函数的参数
  2653. * @param title 函数名称
  2654. * @param type 函数类型
  2655. * @param allowEmpty 可否为空
  2656. */
  2657. function LibParam(title, type, allowEmpty) {
  2658. if (allowEmpty === void 0) { allowEmpty = false; }
  2659. return function (target, methodName, paramsIndex) {
  2660. var systemFnArgs = getRegParamList(methodName);
  2661. systemFnArgs[paramsIndex] = {
  2662. type: type,
  2663. title: title,
  2664. name: methodName,
  2665. allowEmpty: allowEmpty,
  2666. };
  2667. };
  2668. }
  2669. /**
  2670. * 标注函数变成"系统全局函数"
  2671. */
  2672. function Lib(registe) {
  2673. return function (target, propertyKey, descriptor) {
  2674. var libList = getRegList();
  2675. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2676. if (registe.type === 'system') {
  2677. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2678. }
  2679. else if (registe.type === 'format') {
  2680. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2681. }
  2682. return target;
  2683. };
  2684. }
  2685. /**
  2686. * 解析事件
  2687. * 'scope.私有方法名'
  2688. * 'system.系统函数名'
  2689. * 'format.格式化名'
  2690. */
  2691. function lookupFn(scope, event, errorWho) {
  2692. if (isDesignMode(scope, undefined)) {
  2693. return Ext.emptyFn;
  2694. }
  2695. if (!_$2.startsWith(event, 'scope.') &&
  2696. !_$2.startsWith(event, 'system.') &&
  2697. !_$2.startsWith(event, 'format.')) {
  2698. console.error('无法识别的事件响应类型', event);
  2699. throw new TypeError('无法识别的事件响应类型');
  2700. }
  2701. // 为 eval 准备环境
  2702. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2703. var data = scope.viewModel.data;
  2704. var keys = [];
  2705. var values = [];
  2706. _$2.forOwn(data, function (value, key) {
  2707. var idxKey = key.indexOf('//');
  2708. if (idxKey >= 0) {
  2709. keys.push(key.substr(0, idxKey));
  2710. }
  2711. else {
  2712. keys.push(key);
  2713. }
  2714. values.push(value);
  2715. });
  2716. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2717. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2718. if (typeof funcResult !== 'function') {
  2719. console.error('无法识别的事件响应类型', event, func, errorWho);
  2720. throw new TypeError('无法识别的事件响应类型');
  2721. }
  2722. return funcResult;
  2723. }
  2724. /**
  2725. * 从 ext.element 获取 scope 对象
  2726. */
  2727. function lookupScope(extHandle) {
  2728. if (!extHandle) {
  2729. // @ts-ignore
  2730. return;
  2731. }
  2732. if (extHandle.isScope) {
  2733. return extHandle;
  2734. }
  2735. if (extHandle.column) {
  2736. // 列上的组件
  2737. return extHandle.column.lookupReferenceHolder().yvanScope;
  2738. }
  2739. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2740. if (typeof extHandle.lookupViewModel === 'function') {
  2741. var vm = extHandle.lookupViewModel();
  2742. return vm.yvanScope;
  2743. }
  2744. return;
  2745. }
  2746. //# sourceMappingURL=lib.js.map
  2747. /**
  2748. * 全局 ajax 方法
  2749. */
  2750. var ajax = {};
  2751. /**
  2752. * 计算拼音的函数
  2753. */
  2754. var pinyinFunc = function (str) { return (str); };
  2755. exports.scopeOnLoad = null;
  2756. exports.apiConvert = undefined;
  2757. var baseConfigProcessList = [];
  2758. /**
  2759. * 在基类添加 Config 的处理方法
  2760. */
  2761. function baseConfigProcess(option) {
  2762. return function (target, propertyKey) {
  2763. baseConfigProcessList.push(target[propertyKey]);
  2764. };
  2765. }
  2766. // let designMode: boolean = false
  2767. //
  2768. // export function isDesignMode(): boolean {
  2769. // return designMode
  2770. // }
  2771. //
  2772. // export function setDesignMode(v: boolean) {
  2773. // designMode = v
  2774. // }
  2775. /**
  2776. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2777. */
  2778. function serverInvokeUrlTransform(url, option) {
  2779. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2780. }
  2781. /**
  2782. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2783. */
  2784. function sqlUrlTransform(url) {
  2785. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2786. }
  2787. /**
  2788. * YvanUI 全局扩展配置
  2789. */
  2790. function extend(option) {
  2791. if (option.ajax) {
  2792. ajax.func = option.ajax;
  2793. }
  2794. if (option.serverInvokeUrlTransform) {
  2795. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2796. }
  2797. if (option.sqlUrlTransform) {
  2798. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2799. }
  2800. if (option.pinyinFunction) {
  2801. pinyinFunc = option.pinyinFunction;
  2802. }
  2803. if (option.scopeOnLoad) {
  2804. exports.scopeOnLoad = option.scopeOnLoad;
  2805. }
  2806. if (option.scopeOnCreate) {
  2807. exports.scopeOnCreate = option.scopeOnCreate;
  2808. }
  2809. if (option.apiConvert) {
  2810. exports.apiConvert = option.apiConvert;
  2811. }
  2812. // if (typeof option.designMode !== 'undefined') {
  2813. // setDesignMode(option.designMode)
  2814. // }
  2815. }
  2816. function getApiConvert() {
  2817. return exports.apiConvert;
  2818. }
  2819. function getScopeOnCreate() {
  2820. return exports.scopeOnCreate;
  2821. }
  2822. function getPinyin(v) {
  2823. return pinyinFunc(v);
  2824. }
  2825. /**
  2826. * 适用于 Select / Tree 等,作筛选的通用方法.
  2827. * 1.首字母模糊匹配(不区分大小写)
  2828. * 2.标识的模糊匹配(不区分大小写)
  2829. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2830. */
  2831. function keywordFilter(keyword, label, value) {
  2832. if (!keyword) {
  2833. return true;
  2834. }
  2835. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2836. // const labelPy = _.toLower(getPinyin(label))
  2837. //@ts-ignore
  2838. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2839. value = _$2.toLower(_$2.trim(value));
  2840. var found = 0;
  2841. _$2.some(ws, function (word) {
  2842. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2843. found++;
  2844. return;
  2845. }
  2846. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2847. found++;
  2848. return;
  2849. }
  2850. });
  2851. return found >= ws.length;
  2852. }
  2853. //# sourceMappingURL=config.js.map
  2854. var Scope = /** @class */ (function () {
  2855. function Scope(_a) {
  2856. var model = _a.model, vjson = _a.vjson;
  2857. /**
  2858. * 业务模块的唯一编号
  2859. */
  2860. this.id = _$2.uniqueId('scope_');
  2861. this.IS_DESIGN_MODE = false;
  2862. /**
  2863. * onload 运行完成之后才会设置本标记为 true
  2864. */
  2865. this.isLoadFinish = false;
  2866. this._isLoading = false;
  2867. this.model = model;
  2868. if (typeof vjson.layout === 'undefined') {
  2869. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  2870. var ret = buildPlus({ model: model, vjson: vjson });
  2871. model = ret.model;
  2872. vjson = ret.vjson;
  2873. }
  2874. this.originalVjson = _$2.cloneDeep(vjson);
  2875. this.vjson = this.originalVjson; // this.buildVjson()
  2876. var extScope = getScopeOnCreate();
  2877. if (typeof extScope === 'function') {
  2878. extScope({ vjson: vjson, model: model }, this);
  2879. }
  2880. }
  2881. Scope.prototype._addWatch = function (tplExpress, fn) {
  2882. if (!this._watchList) {
  2883. this._watchList = [];
  2884. }
  2885. this._watchList.push({ watch: tplExpress, fn: fn });
  2886. };
  2887. Scope.prototype._applyWatchList = function () {
  2888. var _this = this;
  2889. _$2.forEach(this._watchList, function (item) {
  2890. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  2891. });
  2892. };
  2893. Object.defineProperty(Scope.prototype, "isScope", {
  2894. get: function () {
  2895. return true;
  2896. },
  2897. enumerable: true,
  2898. configurable: true
  2899. });
  2900. /**
  2901. * 产生一个当前模块有效的唯一id
  2902. * @param key 唯一编号
  2903. */
  2904. Scope.prototype.uid = function (key) {
  2905. return this.id + key;
  2906. };
  2907. /**
  2908. * 对话框"保存"成功.
  2909. * 关闭对话框,并响应 success 方法
  2910. * @param data 要傳回的數據(可以為空)
  2911. */
  2912. Scope.prototype.dialogSuccess = function (data) {
  2913. this._handle.fireEvent('success', this, data);
  2914. var sender = this._handle.config.animateTarget;
  2915. var scope = lookupScope(sender);
  2916. if (typeof this['success'] === 'function') {
  2917. this['success'].call(scope, sender, data);
  2918. }
  2919. this.close();
  2920. };
  2921. /**
  2922. * 设置等待状态
  2923. * @param value
  2924. * @param msg
  2925. */
  2926. Scope.prototype.setLoading = function (value) {
  2927. var _a;
  2928. var scope = this;
  2929. this._isLoading = value;
  2930. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  2931. };
  2932. Scope.prototype.getLoading = function () {
  2933. return this._isLoading;
  2934. };
  2935. /**
  2936. * 以对话框模式打开当前模块
  2937. * @param sender 发送者(按钮或Scope对象)
  2938. * @param vjsonOption 界面覆盖选项(可以为空)
  2939. * @param dataOption 数据覆盖选项(可以为空)
  2940. */
  2941. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  2942. var _a;
  2943. var that = this;
  2944. var vmodel = _$2.defaultsDeep({
  2945. //
  2946. }, dataOption, that.model);
  2947. this.viewModel = new Ext.app.ViewModel(vmodel);
  2948. this.viewModel.yvanScope = this;
  2949. this._applyWatchList();
  2950. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  2951. var config = _$2.defaultsDeep({
  2952. animateTarget: sender,
  2953. viewModel: this.viewModel,
  2954. yvanScope: this,
  2955. referenceHolder: true,
  2956. }, vjsonOption, that.vjson, windows);
  2957. if (config.height === 'unset') {
  2958. delete config.height;
  2959. }
  2960. if (config.width === 'unset') {
  2961. delete config.width;
  2962. }
  2963. // const holder = sender?.lookupReferenceHolder()
  2964. // delete config.constrain
  2965. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  2966. if (topScope) {
  2967. config.constrain = true;
  2968. this.topScope = topScope;
  2969. }
  2970. var win = new Ext.Window(config);
  2971. // if (holder) {
  2972. // holder.add(win)
  2973. // }
  2974. if (topScope) {
  2975. topScope._handle.add(win);
  2976. }
  2977. win.addListener('beforerender', function (sender) {
  2978. // 记录句柄
  2979. if (sender && !that._handle) {
  2980. that._handle = sender;
  2981. }
  2982. });
  2983. win.addListener('afterrender', function (sender) {
  2984. // 调用onLoad回调
  2985. try {
  2986. that._onLoad();
  2987. }
  2988. catch (e) {
  2989. console.error('errorAt onLoad', e);
  2990. }
  2991. window['cw'] = that;
  2992. });
  2993. win.addListener('destroy', this._destroy.bind(this));
  2994. win.show();
  2995. };
  2996. /**
  2997. * 以标签模式打开当前模块
  2998. * @param vjsonOption 界面覆盖选项(可以为空)
  2999. * @param dataOption 数据覆盖选项(可以为空)
  3000. */
  3001. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3002. var _this = this;
  3003. var that = this;
  3004. this._vjsonOption = vjsonOption;
  3005. this._dataOption = dataOption;
  3006. var vmodel = _$2.defaultsDeep({
  3007. data: {}
  3008. }, dataOption, that.model);
  3009. this.viewModel = new Ext.app.ViewModel(vmodel);
  3010. this.viewModel.yvanScope = this;
  3011. this._applyWatchList();
  3012. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3013. // 根级不能设置id
  3014. delete that.vjson.id;
  3015. var config = _$2.defaultsDeep({
  3016. viewModel: this.viewModel,
  3017. yvanScope: this,
  3018. referenceHolder: true,
  3019. }, vjsonOption, that.vjson);
  3020. var tt = Ext.getCmp('TT');
  3021. var handle = tt.addScope(this, config, function (handle) {
  3022. handle.addListener('added', function (sender) {
  3023. // 记录句柄
  3024. if (sender && !that._handle) {
  3025. that._handle = sender;
  3026. }
  3027. });
  3028. handle.addListener('afterrender', function (sender) {
  3029. // 调用onLoad回调
  3030. try {
  3031. that._onLoad();
  3032. }
  3033. catch (e) {
  3034. console.error('errorAt onLoad', e);
  3035. }
  3036. });
  3037. handle.addListener('destroy', _this._destroy.bind(_this));
  3038. });
  3039. return handle;
  3040. };
  3041. /**
  3042. * 直接渲染到元素
  3043. * @param element 渲染目标
  3044. * @param vjsonOption 界面覆盖选项(可以为空)
  3045. * @param dataOption 数据覆盖选项(可以为空)
  3046. */
  3047. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3048. var that = this;
  3049. this._vjsonOption = vjsonOption;
  3050. this._dataOption = dataOption;
  3051. var vmodel = _$2.defaultsDeep({
  3052. data: {}
  3053. }, that.model, dataOption);
  3054. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3055. this.viewModel = new Ext.app.ViewModel(vmodel);
  3056. this.viewModel.yvanScope = this;
  3057. this._applyWatchList();
  3058. var config = _$2.defaultsDeep({
  3059. viewModel: this.viewModel,
  3060. yvanScope: this,
  3061. referenceHolder: true,
  3062. renderTo: element,
  3063. listeners: {
  3064. afterrender: function (sender) {
  3065. var _a;
  3066. // 记录句柄
  3067. if (sender && !that._handle) {
  3068. that._handle = sender;
  3069. }
  3070. // 调用onLoad回调
  3071. that._onLoad();
  3072. // 如果vjson中配置了 afterrender ,需要恢复状态
  3073. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3074. },
  3075. },
  3076. }, vjsonOption, that.vjson);
  3077. new Ext.container.Viewport(config);
  3078. };
  3079. Scope.prototype.showDesigner = function (designer, option) {
  3080. var that = this;
  3081. var vmodel = _$2.defaultsDeep({
  3082. data: {
  3083. IS_DESIGN_MODE: true,
  3084. }
  3085. }, that.model);
  3086. this.IS_DESIGN_MODE = true;
  3087. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3088. this.viewModel = new Ext.app.ViewModel(vmodel);
  3089. this.viewModel.yvanScope = this;
  3090. this._applyWatchList();
  3091. var config = _$2.defaultsDeep({
  3092. viewModel: this.viewModel,
  3093. yvanScope: this,
  3094. referenceHolder: true,
  3095. listeners: {
  3096. afterrender: function (sender) {
  3097. var _a;
  3098. // 记录句柄
  3099. if (sender && !that._handle) {
  3100. that._handle = sender;
  3101. }
  3102. // 调用onLoad回调
  3103. that._onLoad();
  3104. // 如果vjson中配置了 afterrender ,需要恢复状态
  3105. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3106. },
  3107. },
  3108. }, that.vjson);
  3109. designer.removeAll(true);
  3110. designer.add(config);
  3111. };
  3112. /**
  3113. * 关闭对话框(或标签页)
  3114. */
  3115. Scope.prototype.close = function () {
  3116. this._handle.close();
  3117. };
  3118. Object.defineProperty(Scope.prototype, "data", {
  3119. /**
  3120. * 获取 viewModel 里包含的数据(只读)
  3121. */
  3122. get: function () {
  3123. return this.viewModel.getData();
  3124. },
  3125. enumerable: true,
  3126. configurable: true
  3127. });
  3128. /**
  3129. * 设置 viewModel 中的数据
  3130. * 可以是 key, value 模式
  3131. * 也可以是 {key:value} 模式
  3132. */
  3133. Scope.prototype.set = function (path, value) {
  3134. return this.viewModel.set(path, value);
  3135. };
  3136. /**
  3137. * 寻找模块内所有的 xtype 对应的对象
  3138. * @param xtypeKey
  3139. */
  3140. Scope.prototype.down = function (xtypeKey) {
  3141. return this._handle.down(xtypeKey);
  3142. };
  3143. Object.defineProperty(Scope.prototype, "refs", {
  3144. /**
  3145. * 获取所有设置过 Reference 名称的组件
  3146. */
  3147. get: function () {
  3148. var _a, _b;
  3149. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3150. },
  3151. enumerable: true,
  3152. configurable: true
  3153. });
  3154. Scope.prototype._destroy = function () {
  3155. var that = this;
  3156. that.onDestroy();
  3157. delete that._watchList;
  3158. delete that._handle;
  3159. this.isLoadFinish = false;
  3160. };
  3161. /**
  3162. * 私有渲染完成后的回调
  3163. */
  3164. Scope.prototype._onLoad = function () {
  3165. var _this = this;
  3166. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3167. exports.scopeOnLoad(this);
  3168. }
  3169. this.onLoad();
  3170. _$2.defer(function () {
  3171. _this.isLoadFinish = true;
  3172. });
  3173. };
  3174. /**
  3175. * 默认 渲染完成之后调用的函数
  3176. */
  3177. Scope.prototype.onLoad = function () {
  3178. };
  3179. /**
  3180. * 组件卸载之后的回调
  3181. */
  3182. Scope.prototype.onDestroy = function () {
  3183. };
  3184. return Scope;
  3185. }());
  3186. /**
  3187. * 观察装饰器,viewModel 属性更改时触发成员方法
  3188. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3189. */
  3190. function watch(tplExpress, deep) {
  3191. if (deep === void 0) { deep = false; }
  3192. return function (target, propertyKey, pd) {
  3193. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3194. return target[propertyKey];
  3195. };
  3196. }
  3197. // 获取vjson的hash值
  3198. function getVjsonHash(str) {
  3199. var hash = 3465217896, i, ch;
  3200. for (i = str.length - 1; i >= 0; i--) {
  3201. ch = str.charCodeAt(i);
  3202. hash ^= ((hash << 5) + ch + (hash >> 2));
  3203. }
  3204. return (hash & 0x7FFFFFFF) + "";
  3205. }
  3206. function buildPlus(_a) {
  3207. var model = _a.model, vjson = _a.vjson;
  3208. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3209. {
  3210. layout: 'border',
  3211. // tbar: vjson.action,
  3212. items: vjson.items,
  3213. },
  3214. ] });
  3215. if (_$2.isArray(vjson.action)) {
  3216. vjsonNew.items[0].tbar = vjson.action;
  3217. }
  3218. return { model: model, vjson: vjsonNew };
  3219. }
  3220. //# sourceMappingURL=Scope.js.map
  3221. var model = {
  3222. data: {
  3223. leftTabTitle: ''
  3224. }
  3225. };
  3226. //# sourceMappingURL=Workbench.model.js.map
  3227. var vjson = {
  3228. frame: false,
  3229. layout: 'border',
  3230. width: '100%',
  3231. height: '100%',
  3232. border: false,
  3233. defaults: {
  3234. border: false
  3235. },
  3236. items: [
  3237. {
  3238. region: 'north',
  3239. height: 60,
  3240. cls: 'main-header',
  3241. reference: 'mainTop',
  3242. layout: 'hbox',
  3243. items: [
  3244. {
  3245. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3246. flex: 1,
  3247. border: false
  3248. },
  3249. {
  3250. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3251. menu: [
  3252. {
  3253. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3254. reference: 'commonSetting'
  3255. },
  3256. {
  3257. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3258. listeners: {
  3259. // click: 'scope.ready_api_click'
  3260. }
  3261. },
  3262. ]
  3263. },
  3264. {
  3265. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3266. cls: 'header-menu',
  3267. menu: [
  3268. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3269. ]
  3270. },
  3271. ]
  3272. },
  3273. {
  3274. region: 'west',
  3275. bind: {
  3276. title: '{leftTabTitle}',
  3277. },
  3278. titleAlign: 'center',
  3279. border: true, split: true, width: 340, collapsible: true,
  3280. reference: 'leftTab',
  3281. xtype: 'tabpanel',
  3282. tabPosition: 'left',
  3283. tabRotation: 0,
  3284. tabBar: {
  3285. border: false
  3286. },
  3287. listeners: {
  3288. tabchange: 'scope.leftTabChange',
  3289. },
  3290. items: [
  3291. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3292. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3293. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3294. { tooltip: '表单转换', iconCls: 'x-fa fa-exchange', },
  3295. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3296. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3297. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3298. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3299. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3300. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3301. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3302. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3303. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3304. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3305. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3306. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3307. ]
  3308. },
  3309. {
  3310. region: 'east',
  3311. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3312. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3313. },
  3314. {
  3315. region: 'center',
  3316. split: true, border: true,
  3317. xtype: 'maintab', reference: 'tt', id: 'TT',
  3318. plain: true,
  3319. listeners: {
  3320. restorypage: 'scope.openScope',
  3321. tabchange: 'scope.tabchange'
  3322. },
  3323. items: []
  3324. },
  3325. ],
  3326. };
  3327. //# sourceMappingURL=Workbench.view.js.map
  3328. /**
  3329. * 获取当前打开的项目资料
  3330. */
  3331. function getCurrentProject() {
  3332. // const value = sessionStorage.getItem('CurrentProject');
  3333. // if (value) {
  3334. // project = JSON.parse(value)
  3335. // if (!project.url) {
  3336. // project = undefined
  3337. // }
  3338. // }
  3339. // return project
  3340. return {
  3341. uuid: '00000000',
  3342. name: '本服项目',
  3343. url: '',
  3344. };
  3345. }
  3346. /**
  3347. * 设置当前打开的项目资料(全局)
  3348. */
  3349. function setCurrentProject(value) {
  3350. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3351. }
  3352. //# sourceMappingURL=Project.js.map
  3353. // ------------------------------------------------------------------------------------------ types
  3354. /** 订阅消息key类型 */
  3355. var EventType;
  3356. (function (EventType) {
  3357. /** FileTree打开Module */
  3358. EventType["ModuleOpen"] = "ModuleOpen";
  3359. /** ModulePage 创建 */
  3360. EventType["ModulePageCreate"] = "ModulePageCreate";
  3361. /** ModuleItem内容变化 */
  3362. EventType["ModuleItemChange"] = "ModuleItemChange";
  3363. /** ModuleItem的 jsView 内容变化 */
  3364. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3365. /** 设置 vjson */
  3366. EventType["SetVjson"] = "SetVjson";
  3367. /** 更新 vjson */
  3368. EventType["UpdateVjson"] = "UpdateVjson";
  3369. /** 更新 组件vjson */
  3370. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3371. /** Component 选中内容变化 */
  3372. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3373. /** Component 选中内容变化 */
  3374. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3375. /** Component 删除事件 */
  3376. EventType["ComponentDelete"] = "ComponentDelete";
  3377. /** MainTab 选中改变事件 */
  3378. EventType["MainTabChange"] = "MainTabChange";
  3379. /** ModuleTab 选中改变事件 */
  3380. EventType["ModuleTabChange"] = "ModuleTabChange";
  3381. /** 保存事件 */
  3382. EventType["SaveCall"] = "SaveCall";
  3383. /** 撤销 */
  3384. EventType["Undo"] = "Undo";
  3385. /** 还原 */
  3386. EventType["Redo"] = "Redo";
  3387. /** 剪切 */
  3388. EventType["Cut"] = "Cut";
  3389. /** 复制 */
  3390. EventType["Copy"] = "Copy";
  3391. /** 粘贴 */
  3392. EventType["Paste"] = "Paste";
  3393. /** 全选 */
  3394. EventType["SelectAll"] = "SelectAll";
  3395. /** 读取剪切板 */
  3396. EventType["ClipboardRead"] = "ClipboardRead";
  3397. /** 检查模块更新 */
  3398. EventType["RunCheckModule"] = "RunCheckModule";
  3399. /** 停止检查模块更新 */
  3400. EventType["StopCheckModule"] = "StopCheckModule";
  3401. })(EventType || (EventType = {}));
  3402. // ------------------------------------------------------------------------------------------ impls
  3403. var EventBus = /** @class */ (function () {
  3404. function EventBus() {
  3405. /** 事件数据 */
  3406. this.store = {};
  3407. /** 事件订阅者注册表 */
  3408. this.observeStoreTable = {};
  3409. this.init();
  3410. }
  3411. EventBus.prototype.init = function () {
  3412. var _this = this;
  3413. // 更改store值就会自动publish消息 - 实现
  3414. this.store = new Proxy({}, {
  3415. get: function (target, key) {
  3416. return target[key];
  3417. },
  3418. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3419. set: function (target, key, data) {
  3420. if (noValue(key))
  3421. return false;
  3422. target[key] = data;
  3423. // 消息通知订阅者
  3424. var observerArr = _this.observeStoreTable[key];
  3425. if (noValue(observerArr) || observerArr.length <= 0)
  3426. return true;
  3427. observerArr.forEach(function (handler) {
  3428. //try {
  3429. handler(data, key);
  3430. // } catch (err) {
  3431. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3432. // }
  3433. });
  3434. return true;
  3435. },
  3436. });
  3437. };
  3438. /** 取消注册订阅者 */
  3439. EventBus.prototype.unregisterObserver = function (key, handler) {
  3440. var _this = this;
  3441. var observerArr = this.observeStoreTable[key];
  3442. if (noValue(observerArr) || observerArr.length <= 0)
  3443. return;
  3444. if (noValue(handler)) {
  3445. this.observeStoreTable[key] = [];
  3446. }
  3447. else {
  3448. observerArr.forEach(function (obsHandler, index) {
  3449. if (obsHandler !== handler)
  3450. return;
  3451. _this.observeStoreTable[key].splice(index, 1);
  3452. });
  3453. }
  3454. };
  3455. /** 注册订阅者 */
  3456. EventBus.prototype.registerObserver = function (key, handler) {
  3457. var observerArr = this.observeStoreTable[key];
  3458. if (noValue(observerArr) || observerArr.length <= 0) {
  3459. observerArr = [];
  3460. this.observeStoreTable[key] = observerArr;
  3461. }
  3462. observerArr.push(handler);
  3463. // if (noValue(key)) return;
  3464. // const sourceValue = this.store[key];
  3465. // if (noValue(sourceValue)) return;
  3466. // handler(sourceValue, key);
  3467. };
  3468. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3469. EventBus.prototype.getStore = function () {
  3470. return this.store;
  3471. };
  3472. /**
  3473. * 取消订阅
  3474. * @param key 订阅的消息key
  3475. * @param handler 指定取消的监听函数
  3476. */
  3477. EventBus.prototype.unsubscribe = function (key, handler) {
  3478. var _this = this;
  3479. if (key instanceof Array) {
  3480. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3481. }
  3482. else {
  3483. this.unregisterObserver(key, handler);
  3484. }
  3485. };
  3486. /**
  3487. * 消息订阅
  3488. * @param key 订阅的消息key
  3489. * @param handler 监听函数
  3490. */
  3491. EventBus.prototype.subscribe = function (key, handler) {
  3492. var _this = this;
  3493. var cancelSubscribe = {
  3494. key: key,
  3495. cancel: function () {
  3496. },
  3497. };
  3498. if (key instanceof Array) {
  3499. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3500. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3501. }
  3502. else {
  3503. this.registerObserver(key, handler);
  3504. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3505. }
  3506. return cancelSubscribe;
  3507. };
  3508. /**
  3509. * 消息订阅(只订阅一次)
  3510. * @param key 订阅的消息key
  3511. * @param handler 监听函数
  3512. */
  3513. EventBus.prototype.subscribeOnce = function (key, handler) {
  3514. var cancelSubscribe = this.subscribe(key, function (data) {
  3515. // try {
  3516. handler(data, key);
  3517. // } catch (err) {
  3518. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3519. // }
  3520. cancelSubscribe.cancel();
  3521. });
  3522. };
  3523. /**
  3524. * 发送消息(触发订阅监听函数)
  3525. * @param key 消息key
  3526. * @param eventData 消息值
  3527. */
  3528. EventBus.prototype.publish = function (key, eventData) {
  3529. var _this = this;
  3530. if (key instanceof Array) {
  3531. key.forEach(function (k) { return _this.store[k] = eventData; });
  3532. }
  3533. else {
  3534. this.store[key] = eventData;
  3535. }
  3536. };
  3537. return EventBus;
  3538. }());
  3539. // ------------------------------------------------------------------------------------------ use
  3540. var eventBus = new EventBus();
  3541. //# sourceMappingURL=EventBus.js.map
  3542. var model$1 = {
  3543. data: {
  3544. dataSync_isStart: false,
  3545. dataSync: {
  3546. skipError: false,
  3547. clearData: false,
  3548. tables: []
  3549. },
  3550. dataSyncResult: {
  3551. jobId: ''
  3552. },
  3553. dataSource1: '',
  3554. dataSource2: '',
  3555. schema1: '',
  3556. schema2: '',
  3557. hasDiff: false,
  3558. }
  3559. };
  3560. //# sourceMappingURL=DbSync.model.js.map
  3561. var vjson$1 = {
  3562. title: '数据库同步',
  3563. layout: 'fit',
  3564. items: [
  3565. {
  3566. reference: 'wizard1',
  3567. layout: 'card',
  3568. items: [
  3569. {
  3570. reference: 'first',
  3571. layout: 'fit',
  3572. bbar: [
  3573. '->',
  3574. {
  3575. xtype: 'button',
  3576. iconCls: 'x-fa fa-road',
  3577. text: '结构同步 &raquo;',
  3578. bind: {
  3579. disabled: '{!hasDiff}'
  3580. },
  3581. listeners: {
  3582. click: 'scope.structCopyTo',
  3583. }
  3584. },
  3585. {
  3586. xtype: 'button',
  3587. iconCls: 'x-fa fa-files-o',
  3588. text: '数据同步 &raquo;',
  3589. bind: {
  3590. disabled: '{!hasDiff}'
  3591. },
  3592. listeners: {
  3593. click: 'scope.dataCopyTo',
  3594. }
  3595. },
  3596. {
  3597. xtype: 'button',
  3598. iconCls: 'x-fa fa-sort-alpha-desc',
  3599. text: '索引同步 &raquo;',
  3600. bind: {
  3601. disabled: '{!hasDiff}'
  3602. },
  3603. listeners: {
  3604. click: 'scope.indexCopyTo',
  3605. }
  3606. },
  3607. {
  3608. xtype: 'button',
  3609. iconCls: 'x-fa fa-product-hunt',
  3610. text: '存储过程同步 &raquo;',
  3611. bind: {
  3612. disabled: '{!hasDiff}'
  3613. },
  3614. listeners: {
  3615. click: 'scope.procedureCopyTo',
  3616. }
  3617. },
  3618. ],
  3619. items: [
  3620. {
  3621. title: '数据库对比',
  3622. reference: 'grid1',
  3623. xtype: 'yvgrid',
  3624. pagination: false,
  3625. border: false,
  3626. cellTip: true,
  3627. selModel: {
  3628. type: 'checkboxmodel',
  3629. mode: 'MULTI',
  3630. },
  3631. tbar: {
  3632. xtype: 'toolbar',
  3633. items: [
  3634. {
  3635. xtype: 'combo',
  3636. fieldLabel: '源数据库',
  3637. bind: {
  3638. value: '{dataSource1}'
  3639. },
  3640. dataSource: 'scope.getDataBaseName'
  3641. },
  3642. {
  3643. xtype: 'combo',
  3644. fieldLabel: '目标数据库',
  3645. bind: {
  3646. value: '{dataSource2}'
  3647. },
  3648. dataSource: 'scope.getDataBaseName'
  3649. },
  3650. {
  3651. xtype: 'button',
  3652. iconCls: 'x-fa fa-flash',
  3653. text: '对比',
  3654. bind: {
  3655. disabled: '{!dataSource1 || !dataSource2}'
  3656. },
  3657. listeners: {
  3658. click: 'scope.diff',
  3659. }
  3660. },
  3661. {
  3662. xtype: 'button',
  3663. iconCls: 'x-fa fa-cloud-download',
  3664. text: '重新拉取结构(耗时!)',
  3665. bind: {
  3666. disabled: '{!dataSource1 || !dataSource2}'
  3667. },
  3668. listeners: {
  3669. click: 'scope.dbToMeta',
  3670. }
  3671. },
  3672. ]
  3673. },
  3674. columns: [
  3675. {
  3676. dataIndex: 'table_name1',
  3677. header: '源表',
  3678. width: 300,
  3679. },
  3680. {
  3681. dataIndex: 'table_name2',
  3682. header: '目标表',
  3683. width: 300,
  3684. },
  3685. {
  3686. dataIndex: 'diff',
  3687. header: '对比结果',
  3688. width: 100,
  3689. },
  3690. {
  3691. xtype: 'actioncolumn',
  3692. width: 30,
  3693. sortable: false,
  3694. menuDisabled: true,
  3695. items: [
  3696. {
  3697. iconCls: 'x-fa fa-bars',
  3698. text: '打开',
  3699. handler: 'scope.showDetail',
  3700. }
  3701. ]
  3702. },
  3703. {
  3704. dataIndex: 'remark',
  3705. header: '详情',
  3706. width: 200,
  3707. sortable: true,
  3708. },
  3709. ],
  3710. },
  3711. ]
  3712. },
  3713. {
  3714. reference: 'ddl',
  3715. layout: {
  3716. type: 'vbox',
  3717. pack: 'start',
  3718. align: 'stretch'
  3719. },
  3720. items: [
  3721. {
  3722. xtype: 'sqleditor',
  3723. reference: 'ddleditor',
  3724. flex: 1,
  3725. },
  3726. {
  3727. xtype: 'toolbar',
  3728. items: [
  3729. '->',
  3730. {
  3731. xtype: 'button',
  3732. text: '&laquo; 上一步',
  3733. listeners: {
  3734. click: 'scope.back'
  3735. }
  3736. },
  3737. {
  3738. xtype: 'button',
  3739. iconCls: 'x-fa fa-flash',
  3740. text: '执行',
  3741. listeners: {
  3742. click: 'scope.executeDDL'
  3743. }
  3744. },
  3745. ]
  3746. }
  3747. ]
  3748. },
  3749. {
  3750. reference: 'ddl_idx',
  3751. layout: {
  3752. type: 'vbox',
  3753. pack: 'start',
  3754. align: 'stretch'
  3755. },
  3756. items: [
  3757. {
  3758. xtype: 'sqleditor',
  3759. reference: 'ddleditor_idx',
  3760. flex: 1,
  3761. },
  3762. {
  3763. xtype: 'toolbar',
  3764. items: [
  3765. '->',
  3766. {
  3767. xtype: 'button',
  3768. text: '&laquo; 上一步',
  3769. listeners: {
  3770. click: 'scope.back'
  3771. }
  3772. },
  3773. {
  3774. xtype: 'button',
  3775. iconCls: 'x-fa fa-flash',
  3776. text: '执行',
  3777. listeners: {
  3778. click: 'scope.executeDDLIdx'
  3779. }
  3780. },
  3781. ]
  3782. }
  3783. ]
  3784. },
  3785. {
  3786. reference: 'ddl_procedure',
  3787. layout: {
  3788. type: 'vbox',
  3789. pack: 'start',
  3790. align: 'stretch'
  3791. },
  3792. items: [
  3793. {
  3794. xtype: 'sqleditor',
  3795. reference: 'ddleditor_procedure',
  3796. flex: 1,
  3797. },
  3798. {
  3799. xtype: 'toolbar',
  3800. items: [
  3801. '->',
  3802. {
  3803. xtype: 'button',
  3804. text: '&laquo; 上一步',
  3805. listeners: {
  3806. click: 'scope.back'
  3807. }
  3808. },
  3809. {
  3810. xtype: 'button',
  3811. iconCls: 'x-fa fa-flash',
  3812. text: '执行',
  3813. listeners: {
  3814. click: 'scope.executeProcedureSQL'
  3815. }
  3816. },
  3817. ]
  3818. }
  3819. ]
  3820. },
  3821. {
  3822. reference: 'datacopy',
  3823. xtype: 'yvgrid',
  3824. pagination: false,
  3825. tbar: {
  3826. xtype: 'toolbar',
  3827. items: [
  3828. {
  3829. xtype: 'checkbox',
  3830. fieldLabel: '忽略错误',
  3831. bind: {
  3832. value: '{dataSync.skipError}'
  3833. },
  3834. },
  3835. {
  3836. xtype: 'checkbox',
  3837. fieldLabel: '清空数据',
  3838. bind: {
  3839. value: '{dataSync.clearData}'
  3840. },
  3841. },
  3842. {
  3843. xtype: 'button',
  3844. iconCls: 'x-fa fa-play-circle',
  3845. text: '开始',
  3846. bind: {
  3847. disabled: '{dataSync_isStart}'
  3848. },
  3849. listeners: { click: 'scope.dataSync_start' }
  3850. },
  3851. {
  3852. xtype: 'button',
  3853. iconCls: 'x-fa fa-stop-circle',
  3854. text: '停止',
  3855. bind: {
  3856. disabled: '{!dataSync_isStart}'
  3857. },
  3858. listeners: { click: 'scope.dataSync_stop' }
  3859. },
  3860. ]
  3861. },
  3862. columns: [
  3863. {
  3864. dataIndex: 'tableName', header: '表名',
  3865. width: 300,
  3866. },
  3867. {
  3868. dataIndex: 'dataCount', header: '总记录数',
  3869. width: 150,
  3870. },
  3871. {
  3872. dataIndex: 'currentIdx', header: '当前记录数',
  3873. width: 150,
  3874. },
  3875. {
  3876. dataIndex: 'syncCount', header: '同步数',
  3877. width: 150,
  3878. },
  3879. {
  3880. dataIndex: 'deleteCount', header: '删除',
  3881. width: 150,
  3882. },
  3883. {
  3884. dataIndex: 'syncProgress', header: '进度',
  3885. width: 150, dataType: 'int', formatter: 'percentRenderer'
  3886. },
  3887. ]
  3888. }
  3889. ]
  3890. }
  3891. ]
  3892. };
  3893. //# sourceMappingURL=DbSync.view.js.map
  3894. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  3895. function createEmptyModule(path, filename) {
  3896. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  3897. }
  3898. function createFolder(parentPath, filename) {
  3899. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  3900. }
  3901. function getModuleFileContent(module) {
  3902. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  3903. }
  3904. function saveFile(fileFullPath, fileContent) {
  3905. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3906. // @ts-ignore
  3907. system.msg("保存成功");
  3908. return res;
  3909. });
  3910. }
  3911. function getQueryDslInfo(tableName) {
  3912. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  3913. args: [
  3914. { tableName: tableName }
  3915. ]
  3916. }).catch(function (e) {
  3917. var _a, _b;
  3918. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  3919. showErrorDialog(msg);
  3920. console.error(msg, e);
  3921. });
  3922. }
  3923. function invokeServer(url, param) {
  3924. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  3925. return request.post(url, {
  3926. args: [
  3927. param
  3928. ]
  3929. }).catch(function (e) {
  3930. var _a, _b;
  3931. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  3932. showErrorDialog(msg);
  3933. console.error(msg, e);
  3934. });
  3935. }
  3936. function parseSqlApi(sql) {
  3937. return request.post(getBaseUrl() + "@parseSqlApi", {
  3938. args: [sql]
  3939. }).catch(function (e) {
  3940. var _a, _b;
  3941. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  3942. showErrorDialog(msg);
  3943. console.error(msg, e);
  3944. });
  3945. }
  3946. function saveModuleFiles(param) {
  3947. return request.post(getBaseUrl() + "@saveModuleFiles", {
  3948. args: [
  3949. param
  3950. ]
  3951. }).catch(function (e) {
  3952. var _a, _b;
  3953. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  3954. showErrorDialog(msg);
  3955. console.error(msg, e);
  3956. });
  3957. }
  3958. function createQueryDSLFile(_a) {
  3959. var schema_name = _a.schema_name, table_name = _a.table_name;
  3960. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  3961. args: [{ schema_name: schema_name, table_name: table_name }]
  3962. }).catch(function (e) {
  3963. var _a, _b;
  3964. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  3965. showErrorDialog(msg);
  3966. console.error(msg, e);
  3967. });
  3968. }
  3969. function dbToMeta(param) {
  3970. if (typeof param === 'undefined') {
  3971. param = { datasource: 'master' };
  3972. }
  3973. else if (typeof param.datasource === 'undefined') {
  3974. param.datasource = 'master';
  3975. }
  3976. return request.post(getBaseUrl() + "@dbToMeta", {
  3977. args: [
  3978. param
  3979. ]
  3980. }).catch(function (e) {
  3981. var _a, _b;
  3982. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  3983. showErrorDialog(msg);
  3984. console.error(msg, e);
  3985. });
  3986. }
  3987. function getColumnDomainApi(param) {
  3988. if (typeof param === 'undefined') {
  3989. param = { datasource: 'master' };
  3990. }
  3991. else if (typeof param.datasource === 'undefined') {
  3992. param.datasource = 'master';
  3993. }
  3994. return request.post(getBaseUrl() + "@getColumnDomain", {
  3995. args: [
  3996. param
  3997. ]
  3998. }).catch(function (e) {
  3999. var _a, _b;
  4000. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4001. showErrorDialog(msg);
  4002. console.error(msg, e);
  4003. });
  4004. }
  4005. function getMateData(param) {
  4006. if (typeof param === 'undefined') {
  4007. param = { datasource: 'master' };
  4008. }
  4009. else if (typeof param.datasource === 'undefined') {
  4010. param.datasource = 'master';
  4011. }
  4012. return request.post(getBaseUrl() + "@getMateData", {
  4013. args: [
  4014. param
  4015. ]
  4016. }).catch(function (e) {
  4017. var _a, _b;
  4018. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4019. showErrorDialog(msg);
  4020. console.error(msg, e);
  4021. });
  4022. }
  4023. function getMateDataByTableName(param) {
  4024. if (typeof param === 'undefined') {
  4025. param = { datasource: 'master' };
  4026. }
  4027. else if (typeof param.datasource === 'undefined') {
  4028. param.datasource = 'master';
  4029. }
  4030. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4031. args: [
  4032. param
  4033. ]
  4034. }).catch(function (e) {
  4035. var _a, _b;
  4036. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4037. showErrorDialog(msg);
  4038. console.error(msg, e);
  4039. });
  4040. }
  4041. function saveMetaTableChanges(param) {
  4042. if (typeof param === 'undefined') {
  4043. param = { datasource: 'master' };
  4044. }
  4045. else if (typeof param.datasource === 'undefined') {
  4046. param.datasource = 'master';
  4047. }
  4048. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4049. args: [
  4050. param
  4051. ]
  4052. }).catch(function (e) {
  4053. var _a, _b;
  4054. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4055. showErrorDialog(msg);
  4056. console.error(msg, e);
  4057. });
  4058. }
  4059. function getModifyTableDDL(param) {
  4060. if (typeof param === 'undefined') {
  4061. param = { datasource: 'master' };
  4062. }
  4063. else if (typeof param.datasource === 'undefined') {
  4064. param.datasource = 'master';
  4065. }
  4066. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4067. args: [
  4068. param
  4069. ]
  4070. }).catch(function (e) {
  4071. var _a, _b;
  4072. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4073. showErrorDialog(msg);
  4074. console.error(msg, e);
  4075. });
  4076. }
  4077. function pushToDbCommitApi(param) {
  4078. if (typeof param === 'undefined') {
  4079. param = { datasource: 'master' };
  4080. }
  4081. else if (typeof param.datasource === 'undefined') {
  4082. param.datasource = 'master';
  4083. }
  4084. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4085. args: [
  4086. param
  4087. ]
  4088. }).catch(function (e) {
  4089. var _a, _b;
  4090. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4091. showErrorDialog(msg);
  4092. console.error(msg, e);
  4093. });
  4094. }
  4095. /**
  4096. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4097. */
  4098. function saveMetaExBuildDDL(param) {
  4099. if (typeof param === 'undefined') {
  4100. param = { datasource: 'master' };
  4101. }
  4102. else if (typeof param.datasource === 'undefined') {
  4103. param.datasource = 'master';
  4104. }
  4105. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4106. args: [
  4107. param
  4108. ]
  4109. }).catch(function (e) {
  4110. var _a, _b;
  4111. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4112. showErrorDialog(msg);
  4113. console.error(msg, e);
  4114. });
  4115. }
  4116. function registerResource(params) {
  4117. return request.post(getBaseUrl() + "@registerResource", {
  4118. args: [params]
  4119. }).catch(function (e) {
  4120. var _a, _b;
  4121. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4122. showErrorDialog(msg);
  4123. console.error(msg, e);
  4124. });
  4125. }
  4126. function getMenuTree(params) {
  4127. return request.post(getBaseUrl() + "@getMenuTree", {
  4128. args: [params]
  4129. }).catch(function (e) {
  4130. var _a, _b;
  4131. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4132. showErrorDialog(msg);
  4133. console.error(msg, e);
  4134. });
  4135. }
  4136. function moduleTree() {
  4137. return request.post(getBaseUrl() + "@moduleTree")
  4138. .catch(function (e) {
  4139. var _a, _b;
  4140. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4141. showErrorDialog(msg);
  4142. console.error(msg, e);
  4143. });
  4144. }
  4145. function dropTableDDL(schemaName, tableName) {
  4146. return request.post(getBaseUrl() + "@dropTableDDL", {
  4147. args: [
  4148. { schemaName: schemaName, tableName: tableName },
  4149. ]
  4150. }).catch(function (e) {
  4151. var _a, _b;
  4152. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4153. showErrorDialog(msg);
  4154. console.error(msg, e);
  4155. });
  4156. }
  4157. function renameTableDDL(schemaName, tableName, reTableName) {
  4158. return request.post(getBaseUrl() + "@renameTableDDL", {
  4159. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4160. }).catch(function (e) {
  4161. var _a, _b;
  4162. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4163. showErrorDialog(msg);
  4164. console.error(msg, e);
  4165. });
  4166. }
  4167. function executeModifyProcedureSQL(param) {
  4168. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4169. args: [
  4170. param,
  4171. ]
  4172. }).catch(function (e) {
  4173. var _a, _b;
  4174. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4175. showErrorDialog(msg);
  4176. console.error(msg, e);
  4177. });
  4178. }
  4179. function parseDynamicSqlApi(sql, dataSource) {
  4180. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4181. args: [
  4182. { sql: sql, dataSource: dataSource },
  4183. ]
  4184. }).catch(function (e) {
  4185. var _a, _b;
  4186. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4187. showErrorDialog(msg);
  4188. console.error(msg, e);
  4189. });
  4190. }
  4191. function exporerList() {
  4192. return request.post(getBaseUrl() + "@exporerList", {
  4193. args: [{}]
  4194. }).catch(function (e) {
  4195. var _a, _b;
  4196. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4197. showErrorDialog(msg);
  4198. console.error(msg, e);
  4199. });
  4200. }
  4201. function reportListApi() {
  4202. return request.post(getBaseUrl() + "@reportList", {
  4203. args: []
  4204. }).catch(function (e) {
  4205. var _a, _b;
  4206. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4207. showErrorDialog(msg);
  4208. console.error(msg, e);
  4209. });
  4210. }
  4211. function reportByIdApi(reportId) {
  4212. return request.post(getBaseUrl() + "@reportById", {
  4213. args: [
  4214. { reportId: reportId },
  4215. ]
  4216. }).catch(function (e) {
  4217. var _a, _b;
  4218. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4219. showErrorDialog(msg);
  4220. console.error(msg, e);
  4221. });
  4222. }
  4223. function createReportApi(reportName) {
  4224. return request.post(getBaseUrl() + "@createReport", {
  4225. args: [
  4226. { reportName: reportName },
  4227. ]
  4228. }).catch(function (e) {
  4229. var _a, _b;
  4230. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4231. showErrorDialog(msg);
  4232. console.error(msg, e);
  4233. });
  4234. }
  4235. function saveReportApi(param) {
  4236. return request.post(getBaseUrl() + "@saveReport", {
  4237. args: [
  4238. param,
  4239. ]
  4240. }).catch(function (e) {
  4241. var _a, _b;
  4242. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4243. showErrorDialog(msg);
  4244. console.error(msg, e);
  4245. });
  4246. }
  4247. function delReportApi(report_id) {
  4248. return request.post(getBaseUrl() + "@delReport", {
  4249. args: [{ report_id: report_id },]
  4250. }).catch(function (e) {
  4251. var _a, _b;
  4252. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4253. showErrorDialog(msg);
  4254. console.error(msg, e);
  4255. });
  4256. }
  4257. function getDict(param) {
  4258. if (typeof param === 'undefined') {
  4259. param = { datasource: 'master' };
  4260. }
  4261. else if (typeof param.datasource === 'undefined') {
  4262. param.datasource = 'master';
  4263. }
  4264. return request.post(getBaseUrl() + "@getDict", {
  4265. args: [
  4266. param
  4267. ]
  4268. });
  4269. }
  4270. function saveDictApi(param) {
  4271. if (typeof param === 'undefined') {
  4272. param = { datasource: 'master' };
  4273. }
  4274. else if (typeof param.datasource === 'undefined') {
  4275. param.datasource = 'master';
  4276. }
  4277. return request.post(getBaseUrl() + "@saveDict", {
  4278. args: [
  4279. param
  4280. ]
  4281. }).catch(function (e) {
  4282. var _a, _b;
  4283. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4284. showErrorDialog(msg);
  4285. console.error(msg, e);
  4286. });
  4287. }
  4288. function saveDictItemsApi(param) {
  4289. if (typeof param === 'undefined') {
  4290. param = { datasource: 'master' };
  4291. }
  4292. else if (typeof param.datasource === 'undefined') {
  4293. param.datasource = 'master';
  4294. }
  4295. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4296. args: [
  4297. param
  4298. ]
  4299. }).catch(function (e) {
  4300. var _a, _b;
  4301. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4302. showErrorDialog(msg);
  4303. console.error(msg, e);
  4304. });
  4305. }
  4306. function createDictEnum(param) {
  4307. return request.post(getBaseUrl() + "@createDictEnum", {
  4308. args: [
  4309. param
  4310. ]
  4311. }).catch(function (e) {
  4312. var _a, _b;
  4313. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4314. showErrorDialog(msg);
  4315. console.error(msg, e);
  4316. });
  4317. }
  4318. function loadSqlContentApi(url) {
  4319. return request.post(getBaseUrl() + "@loadSqlContent", {
  4320. args: [
  4321. {
  4322. url: GLOBAL_NAMESPACE_PREFIX + url,
  4323. }
  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) || 'loadSqlContentApi ERROR!';
  4328. showErrorDialog(msg);
  4329. console.error(msg, e);
  4330. });
  4331. }
  4332. function saveSqlContentApi(url, content) {
  4333. return request.post(getBaseUrl() + "@saveSqlContent", {
  4334. args: [
  4335. {
  4336. url: GLOBAL_NAMESPACE_PREFIX + url,
  4337. content: content,
  4338. }
  4339. ]
  4340. }).catch(function (e) {
  4341. var _a, _b;
  4342. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4343. showErrorDialog(msg);
  4344. console.error(msg, e);
  4345. });
  4346. }
  4347. function readBpmn(param) {
  4348. return request.post(getBaseUrl() + "@readBpmn", {
  4349. args: [param]
  4350. }).catch(function (e) {
  4351. var _a, _b;
  4352. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4353. showErrorDialog(msg);
  4354. console.error(msg, e);
  4355. });
  4356. }
  4357. function createBpmn(path, filename) {
  4358. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4359. var _a, _b;
  4360. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4361. showErrorDialog(msg);
  4362. console.error(msg, e);
  4363. });
  4364. }
  4365. function saveBpmn(fileFullPath, fileContent) {
  4366. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4367. // @ts-ignore
  4368. system.msg("保存成功");
  4369. return res;
  4370. });
  4371. }
  4372. function deleteBpmn(path, filename) {
  4373. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4374. var _a, _b;
  4375. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4376. showErrorDialog(msg);
  4377. console.error(msg, e);
  4378. });
  4379. }
  4380. function createDevForm(param) {
  4381. return request.post(getBaseUrl() + "@createDevForm", {
  4382. args: [param]
  4383. }).catch(function (e) {
  4384. var _a, _b;
  4385. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4386. showErrorDialog(msg);
  4387. console.error(msg, e);
  4388. });
  4389. }
  4390. function readDevForm(param) {
  4391. return request.post(getBaseUrl() + "@readDevForm", {
  4392. args: [param]
  4393. }).catch(function (e) {
  4394. var _a, _b;
  4395. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4396. showErrorDialog(msg);
  4397. console.error(msg, e);
  4398. });
  4399. }
  4400. function calcColumnForm(param) {
  4401. return request.post(getBaseUrl() + "@calcColumnForm", {
  4402. args: [param]
  4403. }).catch(function (e) {
  4404. var _a, _b;
  4405. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4406. showErrorDialog(msg);
  4407. console.error(msg, e);
  4408. });
  4409. }
  4410. function widgetListApi(param) {
  4411. return request.post(getBaseUrl() + "@widgetListApi", {
  4412. args: [param]
  4413. }).catch(function (e) {
  4414. var _a, _b;
  4415. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4416. showErrorDialog(msg);
  4417. console.error(msg, e);
  4418. });
  4419. }
  4420. function readWidget(param) {
  4421. return request.post(getBaseUrl() + "@readWidget", {
  4422. args: [param]
  4423. }).catch(function (e) {
  4424. var _a, _b;
  4425. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4426. showErrorDialog(msg);
  4427. console.error(msg, e);
  4428. });
  4429. }
  4430. function saveWidget(param) {
  4431. return request.post(getBaseUrl() + "@saveWidget", {
  4432. args: [param]
  4433. }).catch(function (e) {
  4434. var _a, _b;
  4435. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4436. showErrorDialog(msg);
  4437. console.error(msg, e);
  4438. });
  4439. }
  4440. function deleteWidget(param) {
  4441. return request.post(getBaseUrl() + "@deleteWidget", {
  4442. args: [param]
  4443. }).catch(function (e) {
  4444. var _a, _b;
  4445. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4446. showErrorDialog(msg);
  4447. console.error(msg, e);
  4448. });
  4449. }
  4450. function getDataBaseNameApi() {
  4451. return request.post(getBaseUrl() + "@getDataBaseName", {
  4452. args: []
  4453. }).catch(function (e) {
  4454. var _a, _b;
  4455. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4456. showErrorDialog(msg);
  4457. console.error(msg, e);
  4458. });
  4459. }
  4460. function getDiffDDLApi(param) {
  4461. return request.post(getBaseUrl() + "@getDiffDDL", {
  4462. args: [
  4463. param
  4464. ]
  4465. }).catch(function (e) {
  4466. var _a, _b;
  4467. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4468. showErrorDialog(msg);
  4469. console.error(msg, e);
  4470. });
  4471. }
  4472. function dataSyncApi(param) {
  4473. return request.post(getBaseUrl() + "@dataSync", {
  4474. args: [
  4475. param
  4476. ]
  4477. }).catch(function (e) {
  4478. var _a, _b;
  4479. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4480. showErrorDialog(msg);
  4481. console.error(msg, e);
  4482. });
  4483. }
  4484. function dataSyncInfoApi(param) {
  4485. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4486. args: [
  4487. param
  4488. ]
  4489. }).catch(function (e) {
  4490. var _a, _b;
  4491. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4492. showErrorDialog(msg);
  4493. console.error(msg, e);
  4494. });
  4495. }
  4496. function saveColumnDomain(param) {
  4497. if (typeof param === 'undefined') {
  4498. param = { datasource: 'master' };
  4499. }
  4500. else if (typeof param.datasource === 'undefined') {
  4501. param.datasource = 'master';
  4502. }
  4503. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4504. args: [
  4505. param
  4506. ]
  4507. }).catch(function (e) {
  4508. var _a, _b;
  4509. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4510. showErrorDialog('发生错误:' + msg);
  4511. console.error(msg, e);
  4512. });
  4513. }
  4514. function devOpsList() {
  4515. return request.post(getBaseUrl() + "@devOpsList", {
  4516. args: [{}]
  4517. }).catch(function (e) {
  4518. var _a, _b;
  4519. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4520. showErrorDialog('发生错误:' + msg);
  4521. console.error(msg, e);
  4522. });
  4523. }
  4524. function devOpsById(opsId) {
  4525. return request.post(getBaseUrl() + "@devOpsById", {
  4526. args: [{ opsId: opsId }]
  4527. }).catch(function (e) {
  4528. var _a, _b;
  4529. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4530. showErrorDialog('发生错误:' + msg);
  4531. console.error(msg, e);
  4532. });
  4533. }
  4534. function metricsRequestApi() {
  4535. return request.get("/api/metrics/request")
  4536. .catch(function (e) {
  4537. var _a, _b;
  4538. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4539. showErrorDialog('发生错误:' + msg);
  4540. console.error(msg, e);
  4541. });
  4542. }
  4543. function metricsJdbcApi() {
  4544. return request.get("/api/metrics/jdbc")
  4545. .catch(function (e) {
  4546. var _a, _b;
  4547. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4548. showErrorDialog('发生错误:' + msg);
  4549. console.error(msg, e);
  4550. });
  4551. }
  4552. function executeDDL(param) {
  4553. return request.post(getBaseUrl() + "@executeDDL", {
  4554. args: [
  4555. param,
  4556. ]
  4557. }).catch(function (e) {
  4558. var _a, _b;
  4559. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4560. showErrorDialog('发生错误:' + msg);
  4561. console.error(msg, e);
  4562. });
  4563. }
  4564. function getModifyIdxDDL(param) {
  4565. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4566. args: [
  4567. param,
  4568. ]
  4569. }).catch(function (e) {
  4570. var _a, _b;
  4571. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4572. showErrorDialog('发生错误:' + msg);
  4573. console.error(msg, e);
  4574. });
  4575. }
  4576. function getModifyProcedureSQL(param) {
  4577. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4578. args: [
  4579. param,
  4580. ]
  4581. }).catch(function (e) {
  4582. var _a, _b;
  4583. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4584. showErrorDialog('发生错误:' + msg);
  4585. console.error(msg, e);
  4586. });
  4587. }
  4588. function saveWhLayout(param) {
  4589. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4590. args: [
  4591. param,
  4592. ]
  4593. }).catch(function (e) {
  4594. var _a, _b;
  4595. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4596. showErrorDialog('发生错误:' + msg);
  4597. console.error(msg, e);
  4598. });
  4599. }
  4600. function deleteWhLayout(param) {
  4601. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4602. args: [
  4603. param,
  4604. ]
  4605. }).catch(function (e) {
  4606. var _a, _b;
  4607. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4608. showErrorDialog('发生错误:' + msg);
  4609. console.error(msg, e);
  4610. });
  4611. }
  4612. function loadWhLayoutAll() {
  4613. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4614. args: []
  4615. }).catch(function (e) {
  4616. var _a, _b;
  4617. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4618. showErrorDialog('发生错误:' + msg);
  4619. console.error(msg, e);
  4620. });
  4621. }
  4622. function loadWhLayout(param) {
  4623. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4624. args: [
  4625. param,
  4626. ]
  4627. }).catch(function (e) {
  4628. var _a, _b;
  4629. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  4630. showErrorDialog('发生错误:' + msg);
  4631. console.error(msg, e);
  4632. });
  4633. }
  4634. var baseUrl = "/api/com/yvan/studio/FileManager";
  4635. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  4636. function getBaseUrl() {
  4637. // return getCurrentProject().url + baseUrl
  4638. return baseUrl;
  4639. }
  4640. function getLayoutUrl() {
  4641. // return getCurrentProject().url + baseUrl
  4642. return layoutUrl;
  4643. }
  4644. var Request = /** @class */ (function () {
  4645. function Request(axiosInstance) {
  4646. this.axiosInstance = axiosInstance;
  4647. }
  4648. // 全局响应数据转换处理
  4649. Request.transformResponse = function (response) {
  4650. var _a;
  4651. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  4652. };
  4653. Request.prototype.get = function (url, config) {
  4654. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  4655. };
  4656. Request.prototype.delete = function (url, config) {
  4657. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  4658. };
  4659. Request.prototype.head = function (url, config) {
  4660. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  4661. };
  4662. Request.prototype.options = function (url, config) {
  4663. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  4664. };
  4665. Request.prototype.post = function (url, data, config) {
  4666. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4667. };
  4668. Request.prototype.put = function (url, data, config) {
  4669. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4670. };
  4671. Request.prototype.patch = function (url, data, config) {
  4672. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4673. };
  4674. Request.prototype.request = function (config) {
  4675. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  4676. };
  4677. return Request;
  4678. }());
  4679. /** 创建一个axios实例对象 */
  4680. function axiosCreate(config) {
  4681. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  4682. }
  4683. var axiosInstance;
  4684. function init() {
  4685. axiosInstance = axiosCreate({
  4686. validateStatus: function (status) { return (status >= 200 && status < 400); },
  4687. });
  4688. request = new Request(axiosInstance);
  4689. }
  4690. var request;
  4691. //# sourceMappingURL=Api.js.map
  4692. /**
  4693. * 对比两个列 是否存在不一致
  4694. */
  4695. function compareColumn(t1, c1, t2, c2) {
  4696. if (typeof c2 === 'undefined') {
  4697. return 'column_name';
  4698. }
  4699. if (c1.column_name !== c2.column_name) {
  4700. return 'column_name';
  4701. }
  4702. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  4703. return 'default_value';
  4704. }
  4705. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  4706. return 'column_comment';
  4707. }
  4708. if (c1.is_primary_key !== c2.is_primary_key) {
  4709. return 'is_primary_key';
  4710. }
  4711. if (c1.not_null !== c2.not_null) {
  4712. return 'not_null';
  4713. }
  4714. var symbol1 = getDataTypeSymbol(t1, c1);
  4715. var symbol2 = getDataTypeSymbol(t2, c2);
  4716. if (symbol1 !== symbol2) {
  4717. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  4718. return 'data_type';
  4719. }
  4720. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  4721. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  4722. // 只关注长度
  4723. if (c1.column_size != c2.column_size) {
  4724. return 'column_size';
  4725. }
  4726. }
  4727. else {
  4728. // 其他情况,长度和精度都要关注
  4729. if (c1.column_size != c2.column_size) {
  4730. return 'column_size';
  4731. }
  4732. if (c1.decimal_digits !== c2.decimal_digits) {
  4733. return 'decimal_digits';
  4734. }
  4735. }
  4736. }
  4737. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  4738. var symbol1 = getDataTypeSymbol(tableInfo, column);
  4739. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  4740. if (symbol1 !== symbol2) {
  4741. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  4742. return 'data_type';
  4743. }
  4744. if (is_fix_size) {
  4745. // 字段域吧大小限制住了
  4746. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  4747. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  4748. // 只关注长度
  4749. if (column.column_size != domain.column_size) {
  4750. return 'column_size';
  4751. }
  4752. }
  4753. else {
  4754. // 其他情况,长度和精度都要关注
  4755. if (column.column_size != domain.column_size) {
  4756. return 'column_size';
  4757. }
  4758. if (column.decimal_digits !== domain.decimal_digits) {
  4759. return 'decimal_digits';
  4760. }
  4761. }
  4762. }
  4763. }
  4764. function checkColumn(table, col) {
  4765. if (isEmpty(col.column_name)) {
  4766. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  4767. }
  4768. if (isKeyword(col.column_name)) {
  4769. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  4770. }
  4771. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  4772. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  4773. }
  4774. return undefined;
  4775. }
  4776. function applyDomain(dbType, domain) {
  4777. var editRow = {
  4778. data_type: domain[dbType + '_datatype'],
  4779. };
  4780. domain = _$2.cloneDeep(domain);
  4781. if (!editRow.data_type) {
  4782. throw Error('字段域没有定义数据类型!');
  4783. }
  4784. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  4785. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  4786. if (match) {
  4787. // 类型里面包含括号
  4788. var sz = parseInt(match[2]);
  4789. if (isNaN(sz)) {
  4790. throw Error('字段域的定义错误:' + editRow.data_type);
  4791. }
  4792. domain.is_fix_size = true;
  4793. editRow.data_type = match[1];
  4794. domain.column_size = sz;
  4795. domain.decimal_digits = 0;
  4796. }
  4797. else {
  4798. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  4799. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  4800. if (match2) {
  4801. // 类型里面包含括号
  4802. var sz = parseInt(match2[2]);
  4803. if (isNaN(sz)) {
  4804. throw Error('字段域的定义错误:' + editRow.data_type);
  4805. }
  4806. var dg = parseInt(match2[3]);
  4807. if (isNaN(dg)) {
  4808. throw Error('字段域的定义错误:' + editRow.data_type);
  4809. }
  4810. domain.is_fix_size = true;
  4811. editRow.data_type = match[1];
  4812. domain.column_size = sz;
  4813. domain.decimal_digits = dg;
  4814. }
  4815. }
  4816. if (domain.domain_column_ui) {
  4817. _$2.extend(editRow, {
  4818. column_ui: domain.domain_column_ui,
  4819. });
  4820. }
  4821. if (domain.domain_column_dict) {
  4822. _$2.extend(editRow, {
  4823. column_dict: domain.domain_column_dict,
  4824. });
  4825. }
  4826. if (domain.is_fix_size) {
  4827. _$2.extend(editRow, {
  4828. column_size: domain.column_size,
  4829. decimal_digits: domain.decimal_digits
  4830. });
  4831. }
  4832. if (domain.is_fix_default_value) {
  4833. _$2.extend(editRow, {
  4834. default_value: domain.default_value,
  4835. });
  4836. }
  4837. return editRow;
  4838. }
  4839. /**
  4840. * 获取字段类型代号(用于做跨数据库数据类型对比)
  4841. */
  4842. function getDataTypeSymbol(table, col) {
  4843. if (table.db_type === 'oracle') {
  4844. switch (col.data_type) {
  4845. case 'number':
  4846. if (col.column_size <= 10 && !col.decimal_digits) {
  4847. return 'integer';
  4848. }
  4849. else if (col.column_size <= 19 && !col.decimal_digits) {
  4850. return 'long';
  4851. }
  4852. return 'bigdecimal';
  4853. case 'char':
  4854. if (col.column_size > 3000) {
  4855. return 'clob';
  4856. }
  4857. return 'char';
  4858. case 'integer':
  4859. return 'integer';
  4860. case 'varchar':
  4861. case 'varchar2':
  4862. if (col.column_size > 3000) {
  4863. return 'clob';
  4864. }
  4865. return 'varchar';
  4866. case 'clob':
  4867. return 'clob';
  4868. case 'blob':
  4869. return 'blob';
  4870. case 'date':
  4871. case 'timestamp':
  4872. case 'timestamp(6)':
  4873. case 'timestamp with local time zone':
  4874. case 'timestamp(6) with local time zone':
  4875. case 'timestamp(6) with time zone':
  4876. return 'timestamp';
  4877. }
  4878. return "undefined";
  4879. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  4880. }
  4881. if (table.db_type === 'pgsql') {
  4882. switch (col.data_type) {
  4883. case 'int4':
  4884. return 'integer';
  4885. case 'int8':
  4886. return 'long';
  4887. case 'char':
  4888. return 'char';
  4889. case 'varchar':
  4890. case 'varchar2':
  4891. if (col.column_size > 3000) {
  4892. return 'clob';
  4893. }
  4894. return 'varchar';
  4895. case 'numeric':
  4896. if (col.column_size <= 10 && !col.decimal_digits) {
  4897. return 'integer';
  4898. }
  4899. else if (col.column_size <= 19 && !col.decimal_digits) {
  4900. return 'long';
  4901. }
  4902. return 'bigdecimal';
  4903. case 'timestamp':
  4904. case 'timestamptz':
  4905. return 'timestamp';
  4906. case 'bytea':
  4907. return 'blob';
  4908. }
  4909. return "undefined";
  4910. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  4911. }
  4912. throw Error('未知数据库类型:' + table.db_type);
  4913. }
  4914. /**
  4915. * 判断对象名称是不是数据库关键字(保留字)
  4916. */
  4917. function isKeyword(word) {
  4918. if (!word || typeof word !== 'string') {
  4919. return false;
  4920. }
  4921. var kk = ['access',
  4922. 'add',
  4923. 'all',
  4924. 'alter',
  4925. 'and',
  4926. 'any',
  4927. 'as',
  4928. 'asc',
  4929. 'audit',
  4930. 'between',
  4931. 'by',
  4932. 'char',
  4933. 'check',
  4934. 'cluster',
  4935. 'column',
  4936. 'comment',
  4937. 'compress',
  4938. 'connect',
  4939. 'create',
  4940. 'current',
  4941. 'date',
  4942. 'decimal',
  4943. 'default',
  4944. 'delete',
  4945. 'desc',
  4946. 'distinct',
  4947. 'drop',
  4948. 'else',
  4949. 'exclusive',
  4950. 'exists',
  4951. 'file',
  4952. 'float',
  4953. 'for',
  4954. 'from',
  4955. 'grant',
  4956. 'group',
  4957. 'having',
  4958. 'identified',
  4959. 'immediate',
  4960. 'in',
  4961. 'increment',
  4962. 'index',
  4963. 'initial',
  4964. 'insert',
  4965. 'integer',
  4966. 'intersect',
  4967. 'into',
  4968. 'is',
  4969. 'level',
  4970. 'like',
  4971. 'lock',
  4972. 'long',
  4973. 'maxextents',
  4974. 'minus',
  4975. 'mlslabel',
  4976. 'mode',
  4977. 'modify',
  4978. 'noaudit',
  4979. 'nocompress',
  4980. 'not',
  4981. 'nowait',
  4982. 'null',
  4983. 'number',
  4984. 'of',
  4985. 'offline',
  4986. 'on',
  4987. 'online',
  4988. 'option',
  4989. 'or',
  4990. 'order',
  4991. 'p',
  4992. 'ctfree',
  4993. 'prior',
  4994. 'privileges',
  4995. 'public',
  4996. 'raw',
  4997. 'rename',
  4998. 'resource',
  4999. 'revoke',
  5000. 'row',
  5001. 'rowid',
  5002. 'rownum',
  5003. 'rows',
  5004. 'select',
  5005. 'session',
  5006. 'set',
  5007. 'share',
  5008. 'size',
  5009. 'smallint',
  5010. 'start',
  5011. 'successful',
  5012. 'synonym',
  5013. 'sysdate',
  5014. 'table',
  5015. 'then',
  5016. 'to',
  5017. 'trigger',
  5018. 'uid',
  5019. 'union',
  5020. 'unique',
  5021. 'update',
  5022. 'user',
  5023. 'validate',
  5024. 'values',
  5025. 'varchar',
  5026. 'varchar2',
  5027. 'view',
  5028. 'whenever',
  5029. 'where',
  5030. 'with'];
  5031. return _$2.includes(kk, word.toLowerCase());
  5032. }
  5033. //# sourceMappingURL=DbUtils.js.map
  5034. var DbSync = /** @class */ (function (_super) {
  5035. __extends(DbSync, _super);
  5036. function DbSync() {
  5037. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5038. }
  5039. DbSync.prototype.onLoad = function () {
  5040. };
  5041. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5042. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5043. getDataBaseNameApi().then(function (res) {
  5044. successCallback(res.data.map(function (name) {
  5045. return {
  5046. id: name, text: name
  5047. };
  5048. }));
  5049. });
  5050. };
  5051. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5052. showInfoDialog(record.get('remark'));
  5053. };
  5054. DbSync.prototype.diff = function () {
  5055. var _this = this;
  5056. var promise1 = getMateData({
  5057. datasource: this.viewModel.get('dataSource1')
  5058. });
  5059. var promise2 = getMateData({
  5060. datasource: this.viewModel.get('dataSource2')
  5061. });
  5062. this.viewModel.set('schema1', '');
  5063. this.viewModel.set('schema2', '');
  5064. this.refs.grid1.setLoading(true);
  5065. Promise.all([promise1, promise2]).then(function (_a) {
  5066. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5067. var rows = [];
  5068. if (_$2.size(res1) > 0) {
  5069. // res1 起码有一个 schema
  5070. _this.viewModel.set('schema1', res1[0].schema_name);
  5071. _this.viewModel.set('schema2', res2[0].schema_name);
  5072. if (!_this.viewModel.get('schema1')) {
  5073. msg$1('datasource1 最起码需要一张表');
  5074. return;
  5075. }
  5076. if (!_this.viewModel.get('schema2')) {
  5077. msg$1('datasource2 最起码需要一张表');
  5078. return;
  5079. }
  5080. _$2.forEach(res1[0].table_list, function (table1) {
  5081. var _a;
  5082. 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; });
  5083. if (table1.schema_name) {
  5084. _this.viewModel.set('schema1', table1.schema_name);
  5085. }
  5086. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5087. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5088. }
  5089. var row = {
  5090. table_name1: table1.table_name,
  5091. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5092. table_info: table1
  5093. };
  5094. if (!table2) {
  5095. row.diff = '不一致';
  5096. row.remark = '目标表缺失';
  5097. }
  5098. else if (table1.column_list.length !== table2.column_list.length) {
  5099. row.diff = '不一致';
  5100. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5101. }
  5102. else {
  5103. row.diff = '一致';
  5104. var remark_1 = [];
  5105. _$2.forEach(table1.column_list, function (col1) {
  5106. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5107. if (!col2) {
  5108. row.diff = '不一致';
  5109. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5110. }
  5111. else {
  5112. var colDiff = compareColumn(table1, col1, table2, col2);
  5113. if (colDiff) {
  5114. row.diff = '不一致';
  5115. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5116. }
  5117. }
  5118. });
  5119. row.remark = remark_1.join('\n');
  5120. }
  5121. rows.push(row);
  5122. });
  5123. }
  5124. _this.refs.grid1.setData(rows);
  5125. _this.viewModel.set('hasDiff', true);
  5126. }).finally(function () {
  5127. _this.refs.grid1.setLoading(false);
  5128. });
  5129. };
  5130. DbSync.prototype.structCopyTo = function () {
  5131. var _this = this;
  5132. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5133. msg$1('选择数据源!');
  5134. return;
  5135. }
  5136. var recordList = this.refs.grid1.getSelection();
  5137. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5138. if (_$2.size(tableNameList) <= 0) {
  5139. msg$1('请选择要同步的表');
  5140. return;
  5141. }
  5142. var error = undefined;
  5143. _$2.forEach(tableNameList, function (tableInfo) {
  5144. _$2.forEach(tableInfo.column_list, function (col) {
  5145. error = checkColumn(tableInfo, col);
  5146. return false;
  5147. });
  5148. if (error) {
  5149. return false;
  5150. }
  5151. });
  5152. if (error) {
  5153. msg$1(error);
  5154. return;
  5155. }
  5156. var schema1 = this.viewModel.get('schema1');
  5157. var schema2 = this.viewModel.get('schema2');
  5158. if (!schema1 || !schema2) {
  5159. msg$1('无法识别 schema 名称');
  5160. return;
  5161. }
  5162. this.refs.grid1.setLoading(true);
  5163. getDiffDDLApi({
  5164. datasource1: this.viewModel.get('dataSource1'),
  5165. datasource2: this.viewModel.get('dataSource2'),
  5166. schema1: this.viewModel.get('schema1'),
  5167. schema2: this.viewModel.get('schema2'),
  5168. tables: tableNameList,
  5169. }).then(function (res) {
  5170. if (res.success) {
  5171. _this.refs.ddleditor.setCode(res.data);
  5172. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5173. }
  5174. }).finally(function () {
  5175. _this.refs.grid1.setLoading(false);
  5176. });
  5177. };
  5178. DbSync.prototype.indexCopyTo = function () {
  5179. var _this = this;
  5180. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5181. msg$1('选择数据源!');
  5182. return;
  5183. }
  5184. var recordList = this.refs.grid1.getSelection();
  5185. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5186. if (_$2.size(tableNameList) <= 0) {
  5187. msg$1('请选择要同步的表');
  5188. return;
  5189. }
  5190. var schema1 = this.viewModel.get('schema1');
  5191. var schema2 = this.viewModel.get('schema2');
  5192. if (!schema1 || !schema2) {
  5193. msg$1('无法识别 schema 名称');
  5194. return;
  5195. }
  5196. this.refs.grid1.setLoading(true);
  5197. getModifyIdxDDL({
  5198. datasource1: this.viewModel.get('dataSource1'),
  5199. datasource2: this.viewModel.get('dataSource2'),
  5200. schema1: this.viewModel.get('schema1'),
  5201. schema2: this.viewModel.get('schema2'),
  5202. tables: tableNameList,
  5203. }).then(function (res) {
  5204. if (res.success) {
  5205. _this.refs.ddleditor_idx.setCode(res.data);
  5206. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5207. }
  5208. }).finally(function () {
  5209. _this.refs.grid1.setLoading(false);
  5210. });
  5211. };
  5212. DbSync.prototype.procedureCopyTo = function () {
  5213. var _this = this;
  5214. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5215. msg$1('选择数据源!');
  5216. return;
  5217. }
  5218. var schema1 = this.viewModel.get('schema1');
  5219. var schema2 = this.viewModel.get('schema2');
  5220. if (!schema1 || !schema2) {
  5221. msg$1('无法识别 schema 名称');
  5222. return;
  5223. }
  5224. this.refs.grid1.setLoading(true);
  5225. getModifyProcedureSQL({
  5226. datasource1: this.viewModel.get('dataSource1'),
  5227. datasource2: this.viewModel.get('dataSource2'),
  5228. schema1: this.viewModel.get('schema1'),
  5229. schema2: this.viewModel.get('schema2'),
  5230. }).then(function (res) {
  5231. if (res.success) {
  5232. _this.refs.ddleditor_procedure.setCode(res.data);
  5233. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5234. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5235. }
  5236. }).finally(function () {
  5237. _this.refs.grid1.setLoading(false);
  5238. });
  5239. };
  5240. DbSync.prototype.dataSync_start = function () {
  5241. var _this = this;
  5242. this.viewModel.set('dataSync_isStart', true);
  5243. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5244. this.refs.datacopy.setLoading(true);
  5245. dataSyncApi(dataSync)
  5246. .then(function (res) {
  5247. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5248. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5249. })
  5250. .finally(function () {
  5251. _this.refs.datacopy.setLoading(false);
  5252. });
  5253. };
  5254. DbSync.prototype.dataSync_process = function () {
  5255. var _this = this;
  5256. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5257. dataSyncInfoApi({ jobId: jobId })
  5258. .then(function (res) {
  5259. if (_$2.isArray(res.tableSyncInfos)) {
  5260. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5261. _this.refs.datacopy.setData(res.tableSyncInfos);
  5262. try {
  5263. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5264. }
  5265. catch (e) {
  5266. }
  5267. }
  5268. if (res.endTime) {
  5269. // 已经结束
  5270. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5271. if (res.success) {
  5272. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5273. }
  5274. else {
  5275. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5276. }
  5277. _this.dataSync_stop();
  5278. }
  5279. })
  5280. .catch(function (e) {
  5281. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5282. console.error(e);
  5283. // this.dataSync_stop()
  5284. })
  5285. .finally(function () {
  5286. _this.refs.datacopy.setLoading(false);
  5287. });
  5288. };
  5289. DbSync.prototype.dataSync_stop = function () {
  5290. this.viewModel.set('dataSync_isStart', false);
  5291. clearInterval(this.dataSyncInterval);
  5292. delete this.dataSyncInterval;
  5293. };
  5294. DbSync.prototype.dataCopyTo = function () {
  5295. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5296. msg$1('选择数据源!');
  5297. return;
  5298. }
  5299. var recordList = this.refs.grid1.getSelection();
  5300. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5301. if (_$2.size(tableNameList) <= 0) {
  5302. msg$1('请选择要同步的表');
  5303. return;
  5304. }
  5305. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5306. this.viewModel.set('dataSync.tables', tableNameList);
  5307. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5308. };
  5309. DbSync.prototype.next = function () {
  5310. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5311. };
  5312. DbSync.prototype.back = function () {
  5313. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5314. };
  5315. DbSync.prototype.dbToMeta = function () {
  5316. var _this = this;
  5317. var dataSource1 = this.viewModel.get('dataSource1');
  5318. var dataSource2 = this.viewModel.get('dataSource2');
  5319. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5320. var promise1 = dbToMeta({ datasource: dataSource1 });
  5321. var promise2 = dbToMeta({ datasource: dataSource2 });
  5322. _this.refs.grid1.setLoading(true);
  5323. Promise.all([promise1, promise2]).then(function (_a) {
  5324. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5325. _this.diff();
  5326. }).catch(function (res) {
  5327. _this.refs.grid1.setLoading(false);
  5328. showErrorDialog$1(res);
  5329. });
  5330. });
  5331. };
  5332. DbSync.prototype.executeDDL = function () {
  5333. var _this = this;
  5334. var code = this.refs.ddleditor.getValue();
  5335. var dataSource2 = this.viewModel.get('dataSource2');
  5336. var target_schema_name = this.viewModel.get('schema2');
  5337. var recordList = this.refs.grid1.getSelection();
  5338. var table_infos = _$2.map(recordList, function (r) {
  5339. return r.get('table_info');
  5340. });
  5341. this.setLoading(true);
  5342. pushToDbCommitApi({
  5343. datasource: dataSource2,
  5344. ddl: code,
  5345. table_infos: table_infos,
  5346. target_schema_name: target_schema_name,
  5347. }).then(function (res) {
  5348. if (res === null || res === void 0 ? void 0 : res.success) {
  5349. msg$1('执行成功');
  5350. _this.back();
  5351. _this.diff();
  5352. return;
  5353. }
  5354. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5355. }).finally(function () {
  5356. _this.setLoading(false);
  5357. });
  5358. };
  5359. DbSync.prototype.executeDDLIdx = function () {
  5360. var _this = this;
  5361. var code = this.refs.ddleditor_idx.getValue();
  5362. var dataSource2 = this.viewModel.get('dataSource2');
  5363. this.setLoading(true);
  5364. executeDDL({
  5365. datasource: dataSource2,
  5366. ddl: code,
  5367. }).then(function (res) {
  5368. if (res === null || res === void 0 ? void 0 : res.success) {
  5369. msg$1('执行成功');
  5370. _this.back();
  5371. return;
  5372. }
  5373. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5374. }).finally(function () {
  5375. _this.setLoading(false);
  5376. });
  5377. };
  5378. DbSync.prototype.executeProcedureSQL = function () {
  5379. var _this = this;
  5380. this.setLoading(true);
  5381. executeModifyProcedureSQL({
  5382. datasource1: this.viewModel.get('dataSource1'),
  5383. datasource2: this.viewModel.get('dataSource2'),
  5384. schema1: this.viewModel.get('schema1'),
  5385. schema2: this.viewModel.get('schema2'),
  5386. }).then(function (res) {
  5387. if (res === null || res === void 0 ? void 0 : res.success) {
  5388. msg$1('执行成功');
  5389. _this.back();
  5390. return;
  5391. }
  5392. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5393. }).finally(function () {
  5394. _this.setLoading(false);
  5395. });
  5396. };
  5397. return DbSync;
  5398. }(Scope));
  5399. //# sourceMappingURL=DbSync.js.map
  5400. var model$2 = {
  5401. data: {}
  5402. };
  5403. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5404. var vjson$2 = {
  5405. title: '示例代码',
  5406. layout: 'fit',
  5407. items: [
  5408. {
  5409. layout: 'border',
  5410. items: [
  5411. {
  5412. region: 'north',
  5413. split: true,
  5414. height: 200,
  5415. title: '表格数据',
  5416. reference: 'dataeditor',
  5417. xtype: 'jsoneditor',
  5418. listeners: {
  5419. change: 'scope.dataChanged'
  5420. },
  5421. },
  5422. {
  5423. region: 'west',
  5424. split: true,
  5425. width: 230,
  5426. title: '模板',
  5427. reference: 'tree1',
  5428. xtype: 'treepanel',
  5429. rootVisible: false,
  5430. useArrows: true,
  5431. colspan: 2,
  5432. lines: true,
  5433. multiSelect: false,
  5434. listeners: {
  5435. itemclick: 'scope.templateChange',
  5436. },
  5437. },
  5438. {
  5439. region: 'center',
  5440. title: '参考代码',
  5441. reference: 'preview',
  5442. xtype: 'jsoneditor',
  5443. },
  5444. ]
  5445. }
  5446. ]
  5447. };
  5448. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5449. var rootNode = {
  5450. id: 'ROOT',
  5451. type: "ROOT",
  5452. path: "",
  5453. expanded: true,
  5454. leaf: false,
  5455. children: [
  5456. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5457. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5458. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5459. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5460. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5461. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5462. ],
  5463. };
  5464. var TemplateDev = /** @class */ (function (_super) {
  5465. __extends(TemplateDev, _super);
  5466. function TemplateDev() {
  5467. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5468. _this.dataChanged = _$2.debounce(function () {
  5469. var me = _this;
  5470. if (me.refs.tree1.selection) {
  5471. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5472. }
  5473. }, 50);
  5474. return _this;
  5475. }
  5476. TemplateDev.prototype.onDestroy = function () {
  5477. setDbCode(undefined);
  5478. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5479. };
  5480. TemplateDev.prototype.onLoad = function () {
  5481. setDbCode(this);
  5482. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5483. this.refs.tree1.setRootNode(rootNode);
  5484. getColumnDomainApi({}).then(function (_a) {
  5485. var data = _a.data;
  5486. return window['dev_column_domain'] = data;
  5487. });
  5488. };
  5489. TemplateDev.prototype.dbTreeNodeChange = function () {
  5490. var me = handles$1.dbcode;
  5491. var tables = [];
  5492. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5493. var raw = _$2.cloneDeep(r.get('raw'));
  5494. raw.id = r.get('id');
  5495. if (r.get('type') === 'table') {
  5496. tables.push(raw);
  5497. return;
  5498. }
  5499. if (r.get('type') === 'column') {
  5500. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5501. if (!tableInfo) {
  5502. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5503. tables.push(tableInfo);
  5504. }
  5505. if (!tableInfo.column_list) {
  5506. tableInfo.column_list = [raw];
  5507. }
  5508. else {
  5509. tableInfo.column_list.push(raw);
  5510. }
  5511. }
  5512. });
  5513. // 对于没有选择列的表格,默认加上所有列
  5514. _$2.forEach(tables, function (tableInfo) {
  5515. if (typeof tableInfo.column_list === 'undefined') {
  5516. tableInfo.column_list = [];
  5517. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5518. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5519. });
  5520. }
  5521. });
  5522. var code = JSON.stringify(tables, null, ' ');
  5523. me.refs.dataeditor.setCode(code);
  5524. };
  5525. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5526. var url = record.data.url;
  5527. var rd = _$2.uniqueId('db_code_request');
  5528. if (url) {
  5529. var data = void 0;
  5530. try {
  5531. data = JSON.parse(this.refs.dataeditor.getCode());
  5532. }
  5533. catch (e) {
  5534. return;
  5535. }
  5536. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5537. // if (typeof node.default === "function") {
  5538. // const v = toString(node.default(data))
  5539. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5540. // this.refs.preview.setLanguage("plaintext")
  5541. // this.refs.preview.setCode(v)
  5542. // }
  5543. // })
  5544. showErrorDialog$1('没做这里');
  5545. }
  5546. };
  5547. return TemplateDev;
  5548. }(Scope));
  5549. //# sourceMappingURL=DbCodeTemplate.js.map
  5550. var model$3 = {
  5551. data: {
  5552. hasChanged: false,
  5553. }
  5554. };
  5555. //# sourceMappingURL=DbDomain.model.js.map
  5556. var vjson$3 = {
  5557. bind: {
  5558. title: '字段域{grid1.ischanged?" *":""}',
  5559. },
  5560. layout: 'fit',
  5561. items: [
  5562. {
  5563. layout: 'border',
  5564. items: [
  5565. {
  5566. region: 'center',
  5567. xtype: 'yvgrid',
  5568. selModel: {
  5569. type: 'spreadsheet',
  5570. columnSelect: true,
  5571. pruneRemoved: false,
  5572. extensible: 'y'
  5573. },
  5574. plugins: {
  5575. clipboard: true,
  5576. selectionreplicator: true
  5577. },
  5578. reference: 'grid1',
  5579. pagination: false,
  5580. tbar: {
  5581. xtype: 'toolbar',
  5582. items: [
  5583. {
  5584. xtype: 'button',
  5585. text: '添加',
  5586. iconCls: 'x-fa fa-plus-circle',
  5587. listeners: {
  5588. click: 'scope.addField'
  5589. }
  5590. },
  5591. {
  5592. xtype: 'button',
  5593. text: '删除',
  5594. iconCls: 'x-fa fa-minus-circle',
  5595. listeners: {
  5596. click: 'scope.removeField'
  5597. }
  5598. },
  5599. {
  5600. xtype: 'button',
  5601. text: '保存',
  5602. iconCls: 'x-fa fa-save',
  5603. bind: {
  5604. disabled: '{!grid1.ischanged}'
  5605. },
  5606. listeners: {
  5607. click: 'scope.save'
  5608. }
  5609. },
  5610. ]
  5611. },
  5612. listeners: {
  5613. editfinish: 'scope.gridEditFinish',
  5614. },
  5615. columns: [
  5616. {
  5617. text: '字段域名称', dataIndex: 'domain_name',
  5618. sortable: false,
  5619. menuDisabled: true,
  5620. locked: true,
  5621. editor: {
  5622. selectOnFocus: true
  5623. }
  5624. },
  5625. {
  5626. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  5627. sortable: false, menuDisabled: true,
  5628. editor: {
  5629. selectOnFocus: true
  5630. }
  5631. },
  5632. {
  5633. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  5634. sortable: false, menuDisabled: true,
  5635. editor: {
  5636. selectOnFocus: true
  5637. }
  5638. },
  5639. {
  5640. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  5641. sortable: false, menuDisabled: true,
  5642. editor: {
  5643. selectOnFocus: true
  5644. }
  5645. },
  5646. {
  5647. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  5648. sortable: false, menuDisabled: true,
  5649. editor: {
  5650. selectOnFocus: true
  5651. }
  5652. },
  5653. {
  5654. text: 'Java类型', dataIndex: 'java_datatype',
  5655. sortable: false, menuDisabled: true,
  5656. editor: {
  5657. selectOnFocus: true
  5658. }
  5659. },
  5660. {
  5661. text: '固定长度', dataIndex: 'is_fix_size',
  5662. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5663. width: 88, resizable: false,
  5664. },
  5665. {
  5666. text: '长度', dataIndex: 'column_size',
  5667. sortable: false, menuDisabled: true, dataType: 'int',
  5668. xtype: 'numbercolumn', format: '0',
  5669. editor: { selectOnFocus: true }
  5670. },
  5671. {
  5672. text: '小数位', dataIndex: 'decimal_digits',
  5673. sortable: false, menuDisabled: true, dataType: 'int',
  5674. xtype: 'numbercolumn', format: '0',
  5675. editor: { selectOnFocus: true }
  5676. },
  5677. {
  5678. text: '字典', dataIndex: 'domain_column_dict',
  5679. sortable: false, menuDisabled: true,
  5680. // fix: ['system.getDict("DICT")'],
  5681. width: 200,
  5682. editor: {
  5683. xtype: 'combo',
  5684. listConfig: {
  5685. minWidth: 350
  5686. },
  5687. }
  5688. },
  5689. {
  5690. text: '固定默认值', dataIndex: 'is_fix_default_value',
  5691. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5692. width: 88, resizable: false,
  5693. },
  5694. {
  5695. text: '默认值', dataIndex: 'default_value',
  5696. sortable: false, menuDisabled: true,
  5697. editor: {
  5698. selectOnFocus: true
  5699. }
  5700. },
  5701. {
  5702. text: 'UI建议', dataIndex: 'domain_column_ui',
  5703. sortable: false, menuDisabled: true,
  5704. // fix: ['system.getDict("column_ui")'],
  5705. editor: {
  5706. xtype: 'combo',
  5707. allowBlank: true,
  5708. listConfig: {
  5709. minWidth: 200
  5710. },
  5711. }
  5712. },
  5713. {
  5714. text: '详细描述', dataIndex: 'domain_note',
  5715. sortable: false, menuDisabled: true,
  5716. editor: {}
  5717. },
  5718. {
  5719. text: '责任人', dataIndex: 'domain_person',
  5720. sortable: false, menuDisabled: true,
  5721. editor: {
  5722. selectOnFocus: true
  5723. }
  5724. },
  5725. {
  5726. text: '版本', dataIndex: 'domain_version',
  5727. sortable: false, menuDisabled: true,
  5728. editor: {
  5729. selectOnFocus: true
  5730. }
  5731. },
  5732. ]
  5733. }
  5734. ]
  5735. },
  5736. ]
  5737. };
  5738. //# sourceMappingURL=DbDomain.view.js.map
  5739. var CacheStore = /** @class */ (function () {
  5740. function CacheStore() {
  5741. // 订阅
  5742. this.subscribeList = [];
  5743. this.apiResponse = undefined;
  5744. }
  5745. /**
  5746. * 订阅结果集
  5747. */
  5748. CacheStore.prototype.registe = function (fn) {
  5749. this.subscribeList.push(fn);
  5750. };
  5751. /**
  5752. * 取消订阅
  5753. */
  5754. CacheStore.prototype.unregiste = function (fn) {
  5755. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  5756. };
  5757. /**
  5758. * 尝试取数据(先读缓存)
  5759. */
  5760. CacheStore.prototype.reloadIfNeed = function (param) {
  5761. var _this = this;
  5762. if (typeof this.apiResponse === 'undefined') {
  5763. // 从未有获取过值
  5764. var cacheKey = this.getCacheKey(param);
  5765. if (cacheKey) {
  5766. // 可以从缓存读
  5767. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  5768. native.loadFile(fileName, function (res) {
  5769. if (res) {
  5770. // 缓存有值
  5771. _this.apiResponse = res;
  5772. _this.notifyRefresh();
  5773. }
  5774. else {
  5775. // 缓存没值
  5776. _this.reloadForce(param).then(function (res) {
  5777. });
  5778. }
  5779. });
  5780. }
  5781. else {
  5782. // 不能从缓存读
  5783. this.reloadForce(param).then(function (res) {
  5784. });
  5785. }
  5786. return true;
  5787. }
  5788. return false;
  5789. };
  5790. /**
  5791. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  5792. */
  5793. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  5794. var _this = this;
  5795. return new Promise(function (resolve, reject) {
  5796. if (typeof _this.apiResponse === 'undefined') {
  5797. // 从未有获取过值
  5798. var cacheKey = _this.getCacheKey(param);
  5799. if (cacheKey) {
  5800. // 可以从缓存读
  5801. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  5802. native.loadFile(fileName, function (res) {
  5803. if (res) {
  5804. // 缓存有值
  5805. _this.apiResponse = res;
  5806. _this.notifyRefresh();
  5807. resolve(_this.apiResponse);
  5808. }
  5809. else {
  5810. // 缓存没值
  5811. _this.reloadForce(param).then(function (res) {
  5812. resolve(_this.apiResponse);
  5813. });
  5814. }
  5815. });
  5816. }
  5817. else {
  5818. // 不能从缓存读
  5819. _this.reloadForce(param).then(function (res) {
  5820. resolve(_this.apiResponse);
  5821. });
  5822. }
  5823. }
  5824. else {
  5825. // 有值,获取过
  5826. resolve(_this.apiResponse);
  5827. }
  5828. });
  5829. };
  5830. /**
  5831. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5832. */
  5833. CacheStore.prototype.reloadForce = function (param) {
  5834. var _this = this;
  5835. _$2.forEach(this.subscribeList, function (fn) {
  5836. fn(true);
  5837. });
  5838. return this.invokeApi(param)
  5839. .then(function (res) {
  5840. _this.apiResponse = res;
  5841. var cacheKey = _this.getCacheKey(param);
  5842. if (cacheKey) {
  5843. // 可以保存到缓存
  5844. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  5845. native.saveFile(fileName, res);
  5846. }
  5847. // 通知订阅者刷新
  5848. _this.notifyRefresh();
  5849. })
  5850. .finally(function () {
  5851. _$2.forEach(_this.subscribeList, function (fn) {
  5852. fn(false);
  5853. });
  5854. });
  5855. };
  5856. /**
  5857. * 通知组件,isLoading状态被更改
  5858. */
  5859. CacheStore.prototype.notifyLoading = function (isLoading) {
  5860. var _this = this;
  5861. _$2.forEach(this.subscribeList, function (fn) {
  5862. fn(_this.apiResponse);
  5863. });
  5864. };
  5865. /**
  5866. * 通知数据更改,需要刷新
  5867. */
  5868. CacheStore.prototype.notifyRefresh = function () {
  5869. var _this = this;
  5870. _$2.forEach(this.subscribeList, function (fn) {
  5871. fn(_this.apiResponse);
  5872. });
  5873. };
  5874. return CacheStore;
  5875. }());
  5876. //# sourceMappingURL=CacheStore.js.map
  5877. // 字段域数据
  5878. var columnDomain = undefined;
  5879. var DomainStore = /** @class */ (function (_super) {
  5880. __extends(DomainStore, _super);
  5881. function DomainStore() {
  5882. return _super !== null && _super.apply(this, arguments) || this;
  5883. }
  5884. DomainStore.prototype.getCacheKey = function (param) {
  5885. return "domain_data.json";
  5886. };
  5887. DomainStore.prototype.invokeApi = function (param) {
  5888. return getColumnDomainApi();
  5889. };
  5890. /**
  5891. * 设置全局可访问的 字段域数据
  5892. */
  5893. DomainStore.prototype.getColumnDomainComboData = function () {
  5894. var _this = this;
  5895. return new Promise(function (resolve) {
  5896. _this.reloadIfNeedPromise(undefined).then(function (res) {
  5897. resolve(_this.apiResponse.data.map(function (v) {
  5898. return { id: v.domain_id, text: v.domain_name };
  5899. }));
  5900. });
  5901. });
  5902. };
  5903. /**
  5904. * 设置全局可访问的 字段域数据
  5905. */
  5906. DomainStore.prototype.getColumnDomainById = function (value) {
  5907. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  5908. };
  5909. DomainStore.prototype.getAllDomain = function () {
  5910. return new Promise(function (resolve, reject) {
  5911. getColumnDomainApi()
  5912. .then(function (res) {
  5913. if (res.success) {
  5914. columnDomain = res.data;
  5915. resolve(res.data);
  5916. }
  5917. else {
  5918. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  5919. console.error('getColumnDomain', res.msg);
  5920. }
  5921. })
  5922. .catch(function (e) {
  5923. window['showErrorDialog']('getColumnDomain error!');
  5924. console.error('getColumnDomain', e);
  5925. reject(e);
  5926. });
  5927. });
  5928. };
  5929. return DomainStore;
  5930. }(CacheStore));
  5931. var instance = new DomainStore();
  5932. //# sourceMappingURL=DomainStore.js.map
  5933. var DbDomain = /** @class */ (function (_super) {
  5934. __extends(DbDomain, _super);
  5935. function DbDomain() {
  5936. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  5937. }
  5938. DbDomain.prototype.onLoad = function () {
  5939. var _this = this;
  5940. instance.getAllDomain().then(function (data) {
  5941. _this.refs.grid1.setData(data);
  5942. });
  5943. };
  5944. DbDomain.prototype.gridEditFinish = function () {
  5945. this.viewModel.set('hasChanged', true);
  5946. };
  5947. DbDomain.prototype.addField = function () {
  5948. this.refs.grid1.appendEditRow({
  5949. domainName: '',
  5950. pgSqlDataType: '',
  5951. mysqlDataType: '',
  5952. oracleDataType: '',
  5953. sqlserverDataType: '',
  5954. javaDataType: '',
  5955. isFixSize: true,
  5956. size: '',
  5957. decimalDigits: '',
  5958. isFixDefaultValue: false,
  5959. defaultValue: null,
  5960. domainColumnDict: '',
  5961. domainColumnUI: '',
  5962. note: '',
  5963. domainPerson: '',
  5964. domainVersion: '',
  5965. }, 0);
  5966. };
  5967. DbDomain.prototype.removeField = function () {
  5968. var _this = this;
  5969. var rows = [];
  5970. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  5971. rows.push(r);
  5972. });
  5973. _.forEach(rows, function (r) {
  5974. _this.refs.grid1.getStore().remove(r);
  5975. });
  5976. };
  5977. DbDomain.prototype.save = function () {
  5978. var _this = this;
  5979. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  5980. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  5981. if (err) {
  5982. // 如果有异常就不保存
  5983. return;
  5984. }
  5985. // 进行业务上的逻辑校验,比如说必填校验等等
  5986. var hasError = false;
  5987. _.forEach(rows, function (row, i) {
  5988. if (isEmpty(row.domain_name)) {
  5989. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  5990. hasError = true;
  5991. return false;
  5992. }
  5993. if (isEmpty(row.pgsql_datatype) ||
  5994. isEmpty(row.mysql_datatype) ||
  5995. isEmpty(row.oracle_datatype) ||
  5996. isEmpty(row.sqlserver_datatype)) {
  5997. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  5998. hasError = true;
  5999. return false;
  6000. }
  6001. });
  6002. if (hasError) {
  6003. return;
  6004. }
  6005. // 设置当前界面为 "保存中..." 状态
  6006. this.setLoading(true);
  6007. saveColumnDomain({
  6008. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6009. newRows: newRows,
  6010. modifyRows: modifyRows,
  6011. removeRecords: removeRecords,
  6012. }).then(function (res) {
  6013. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6014. system.msg(res.msg);
  6015. instance.reloadForce({}).then(function () {
  6016. instance.getAllDomain().then(function (data) {
  6017. _this.refs.grid1.setData(data);
  6018. });
  6019. }).finally(function () {
  6020. // 无论正常异常,关闭 "保存中..." 状态
  6021. _this.setLoading(false);
  6022. });
  6023. }).catch(function (e) {
  6024. // 无论正常异常,关闭 "保存中..." 状态
  6025. _this.setLoading(false);
  6026. });
  6027. };
  6028. return DbDomain;
  6029. }(Scope));
  6030. //# sourceMappingURL=DbDomain.js.map
  6031. var model$4 = {
  6032. data: {
  6033. report_id: '',
  6034. report_name: '',
  6035. report_enable: false,
  6036. report: {
  6037. dataSource: '',
  6038. grid: {
  6039. pagination: true,
  6040. },
  6041. query: [],
  6042. columns: [],
  6043. summary: [],
  6044. },
  6045. querySql: '',
  6046. summarySql: '',
  6047. createAt: '',
  6048. createBy: '',
  6049. updateAt: '',
  6050. updateBy: '',
  6051. }
  6052. };
  6053. //# sourceMappingURL=ReportDesign.model.js.map
  6054. var vjson$4 = {
  6055. bind: {
  6056. title: '报表-{report_name}',
  6057. },
  6058. layout: 'fit',
  6059. items: [
  6060. {
  6061. layout: 'border',
  6062. items: [
  6063. {
  6064. region: 'north',
  6065. items: [
  6066. {
  6067. xtype: 'toolbar',
  6068. border: false,
  6069. items: [
  6070. {
  6071. xtype: 'button',
  6072. text: '刷新',
  6073. iconCls: 'x-fa fa-refresh',
  6074. listeners: {
  6075. click: 'scope.load'
  6076. }
  6077. },
  6078. {
  6079. xtype: 'button',
  6080. text: '保存',
  6081. iconCls: 'x-fa fa-save',
  6082. listeners: {
  6083. click: 'scope.save'
  6084. }
  6085. },
  6086. {
  6087. xtype: 'button',
  6088. text: '预览',
  6089. iconCls: 'x-fa fa-play-circle-o',
  6090. listeners: {
  6091. click: 'scope.preview'
  6092. }
  6093. },
  6094. {
  6095. xtype: 'textfield',
  6096. fieldLabel: '报表名称',
  6097. flex: 1,
  6098. bind: {
  6099. value: '{report_name}'
  6100. }
  6101. },
  6102. {
  6103. xtype: 'checkbox',
  6104. fieldLabel: '启用报表',
  6105. checkedValue: 1,
  6106. uncheckedValue: 0,
  6107. bind: {
  6108. value: '{report_enable}'
  6109. }
  6110. },
  6111. {
  6112. xtype: 'checkbox',
  6113. fieldLabel: '启用分页',
  6114. bind: {
  6115. value: '{report.grid.pagination}'
  6116. }
  6117. },
  6118. {
  6119. xtype: 'textfield',
  6120. fieldLabel: '数据源',
  6121. flex: 1,
  6122. bind: {
  6123. value: '{report.dataSource}'
  6124. }
  6125. },
  6126. ]
  6127. }
  6128. ]
  6129. },
  6130. {
  6131. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6132. items: [
  6133. {
  6134. title: 'SQL和查询条件',
  6135. layout: 'border',
  6136. border: false,
  6137. items: [
  6138. {
  6139. region: 'north',
  6140. height: 200,
  6141. border: false,
  6142. split: true,
  6143. xtype: 'yvgrid',
  6144. reference: 'gridCondition',
  6145. pagination: false,
  6146. hideFootbar: true,
  6147. plugins: {
  6148. clipboard: true,
  6149. selectionreplicator: true
  6150. },
  6151. selModel: {
  6152. type: 'spreadsheet',
  6153. columnSelect: false,
  6154. pruneRemoved: false,
  6155. extensible: 'y'
  6156. },
  6157. tbar: {
  6158. xtype: 'toolbar',
  6159. border: false,
  6160. items: [
  6161. {
  6162. xtype: 'button',
  6163. text: '添加条件',
  6164. iconCls: 'x-fa fa-plus-circle',
  6165. listeners: {
  6166. click: 'scope.addCondition'
  6167. }
  6168. },
  6169. {
  6170. xtype: 'button',
  6171. text: '删除条件',
  6172. iconCls: 'x-fa fa-minus-circle',
  6173. listeners: {
  6174. click: 'scope.removeCondition'
  6175. }
  6176. },
  6177. '-',
  6178. {
  6179. xtype: 'button',
  6180. text: '自动分析条件变量',
  6181. iconCls: 'x-fa fa-code-fork',
  6182. listeners: {
  6183. click: 'scope.calcCondition'
  6184. }
  6185. },
  6186. {
  6187. xtype: 'button',
  6188. text: '上移',
  6189. iconCls: 'x-fa fa-arrow-up',
  6190. listeners: {
  6191. click: 'scope.moveUp'
  6192. }
  6193. },
  6194. {
  6195. xtype: 'button',
  6196. text: '下移',
  6197. iconCls: 'x-fa fa-arrow-down',
  6198. listeners: {
  6199. click: 'scope.moveDown'
  6200. }
  6201. },
  6202. ]
  6203. },
  6204. columns: [
  6205. {
  6206. text: '条件变量',
  6207. dataIndex: 'conditionFieldBind',
  6208. width: 140,
  6209. sortable: false,
  6210. menuDisabled: true,
  6211. editor: {
  6212. selectOnFocus: true
  6213. },
  6214. },
  6215. {
  6216. text: '中文标题',
  6217. dataIndex: 'conditionFieldLabel',
  6218. width: 120,
  6219. sortable: false,
  6220. menuDisabled: true,
  6221. editor: {
  6222. selectOnFocus: true
  6223. },
  6224. },
  6225. {
  6226. text: '编辑类型',
  6227. dataIndex: 'conditionFieldXtype',
  6228. width: 80,
  6229. sortable: false,
  6230. menuDisabled: true,
  6231. editor: {
  6232. xtype: 'combo',
  6233. typeAhead: true,
  6234. triggerAction: 'all',
  6235. selectOnFocus: true,
  6236. store: [
  6237. ['textfield', 'textfield'],
  6238. ['combo', 'combo'],
  6239. ['datefield', 'datefield'],
  6240. ['datetimefield', 'datetimefield'],
  6241. ['numberfield', 'numberfield'],
  6242. ['multiplesearch', 'multiplesearch'],
  6243. ]
  6244. }
  6245. },
  6246. {
  6247. text: '权重',
  6248. dataIndex: 'conditionFieldFlex',
  6249. align: 'right',
  6250. width: 60,
  6251. sortable: false,
  6252. menuDisabled: true,
  6253. editor: {
  6254. xtype: 'numberfield',
  6255. selectOnFocus: false,
  6256. minValue: 0,
  6257. maxValue: 10
  6258. },
  6259. },
  6260. {
  6261. text: '字典',
  6262. dataIndex: 'conditionFieldDict',
  6263. width: 160,
  6264. sortable: false,
  6265. menuDisabled: true,
  6266. editor: {
  6267. selectOnFocus: false
  6268. },
  6269. },
  6270. {
  6271. xtype: 'checkcolumn',
  6272. dataIndex: "conditionFieldWrap", header: "换行",
  6273. width: 65,
  6274. sortable: false,
  6275. menuDisabled: true,
  6276. },
  6277. {
  6278. text: '扩展参数',
  6279. dataIndex: 'conditionFieldExtend',
  6280. sortable: false,
  6281. menuDisabled: true,
  6282. editor: {
  6283. selectOnFocus: false
  6284. },
  6285. },
  6286. ]
  6287. },
  6288. {
  6289. region: 'center',
  6290. xtype: 'sqleditor',
  6291. layout: 'fit',
  6292. reference: 'sqlEditor',
  6293. split: true,
  6294. },
  6295. ]
  6296. },
  6297. {
  6298. title: '查询结果字段',
  6299. xtype: 'yvgrid',
  6300. reference: 'gridColumn',
  6301. pagination: false,
  6302. hideFootbar: true,
  6303. border: false,
  6304. plugins: {
  6305. clipboard: true,
  6306. selectionreplicator: true
  6307. },
  6308. selModel: {
  6309. type: 'spreadsheet',
  6310. columnSelect: false,
  6311. pruneRemoved: false,
  6312. extensible: 'y'
  6313. },
  6314. tbar: {
  6315. xtype: 'toolbar',
  6316. items: [
  6317. {
  6318. xtype: 'button',
  6319. text: '添加',
  6320. iconCls: 'x-fa fa-plus-circle',
  6321. listeners: {
  6322. click: 'scope.addColumn'
  6323. }
  6324. },
  6325. {
  6326. xtype: 'button',
  6327. text: '删除',
  6328. iconCls: 'x-fa fa-minus-circle',
  6329. listeners: {
  6330. click: 'scope.removeColumn'
  6331. }
  6332. },
  6333. '-',
  6334. {
  6335. xtype: 'button',
  6336. text: '自动分析',
  6337. iconCls: 'x-fa fa-code-fork',
  6338. listeners: {
  6339. click: 'scope.calcColumn'
  6340. }
  6341. },
  6342. {
  6343. xtype: 'button',
  6344. text: '上移',
  6345. iconCls: 'x-fa fa-arrow-up',
  6346. listeners: {
  6347. click: 'scope.moveUp'
  6348. }
  6349. },
  6350. {
  6351. xtype: 'button',
  6352. text: '下移',
  6353. iconCls: 'x-fa fa-arrow-down',
  6354. listeners: {
  6355. click: 'scope.moveDown'
  6356. }
  6357. },
  6358. ]
  6359. },
  6360. columns: [
  6361. { xtype: 'rownumberer' },
  6362. {
  6363. text: '字段',
  6364. dataIndex: 'dataIndex',
  6365. width: 140,
  6366. sortable: false,
  6367. menuDisabled: true,
  6368. editor: {
  6369. selectOnFocus: true
  6370. },
  6371. },
  6372. {
  6373. text: '标题',
  6374. dataIndex: 'header',
  6375. width: 120,
  6376. sortable: false,
  6377. menuDisabled: true,
  6378. editor: {
  6379. selectOnFocus: true
  6380. },
  6381. },
  6382. {
  6383. text: '显示类型',
  6384. dataIndex: 'xtype',
  6385. width: 90,
  6386. sortable: false,
  6387. menuDisabled: true,
  6388. editor: {
  6389. xtype: 'combo',
  6390. typeAhead: true,
  6391. triggerAction: 'all',
  6392. selectOnFocus: true,
  6393. store: [
  6394. ['', ''],
  6395. ['rownum', 'rownum'],
  6396. ['button', 'button'],
  6397. ['checkbox', 'checkbox'],
  6398. ['progres', 'progres'],
  6399. ]
  6400. }
  6401. },
  6402. {
  6403. text: '数据类型',
  6404. dataIndex: 'dataType',
  6405. width: 90,
  6406. sortable: false,
  6407. menuDisabled: true,
  6408. editor: {
  6409. xtype: 'combo',
  6410. typeAhead: true,
  6411. triggerAction: 'all',
  6412. selectOnFocus: true,
  6413. store: [
  6414. ['', ''],
  6415. ['string', 'string'],
  6416. ['number', 'number'],
  6417. ['date', 'date'],
  6418. ]
  6419. }
  6420. },
  6421. {
  6422. text: '宽度',
  6423. dataIndex: 'width',
  6424. align: 'right',
  6425. width: 60,
  6426. sortable: false,
  6427. menuDisabled: true,
  6428. editor: {
  6429. xtype: 'numberfield',
  6430. selectOnFocus: true,
  6431. minValue: 0,
  6432. maxValue: 1000
  6433. },
  6434. },
  6435. {
  6436. text: '权重',
  6437. dataIndex: 'flex',
  6438. align: 'right',
  6439. width: 60,
  6440. sortable: false,
  6441. menuDisabled: true,
  6442. editor: {
  6443. xtype: 'numberfield',
  6444. selectOnFocus: true,
  6445. minValue: 0,
  6446. maxValue: 10
  6447. },
  6448. },
  6449. {
  6450. text: '字典',
  6451. dataIndex: 'dict',
  6452. sortable: false,
  6453. menuDisabled: true,
  6454. width: 120,
  6455. editor: {
  6456. selectOnFocus: true,
  6457. },
  6458. },
  6459. {
  6460. text: '对齐',
  6461. dataIndex: 'align',
  6462. width: 60,
  6463. sortable: false,
  6464. menuDisabled: true,
  6465. editor: {
  6466. xtype: 'combo',
  6467. typeAhead: true,
  6468. triggerAction: 'all',
  6469. selectOnFocus: false,
  6470. store: [
  6471. ['', ''],
  6472. ['start', 'start'],
  6473. ['center', 'center'],
  6474. ['end', 'end'],
  6475. ]
  6476. },
  6477. },
  6478. {
  6479. text: '过滤',
  6480. dataIndex: 'filterable',
  6481. xtype: 'checkcolumn',
  6482. width: 50,
  6483. resizable: false,
  6484. sortable: false,
  6485. menuDisabled: true,
  6486. },
  6487. {
  6488. text: '隐藏',
  6489. dataIndex: 'hidden',
  6490. xtype: 'checkcolumn',
  6491. width: 50,
  6492. resizable: false,
  6493. sortable: false,
  6494. menuDisabled: true,
  6495. },
  6496. {
  6497. text: '排序',
  6498. dataIndex: 'sortable',
  6499. xtype: 'checkcolumn',
  6500. width: 50,
  6501. resizable: false,
  6502. sortable: false,
  6503. menuDisabled: true,
  6504. },
  6505. {
  6506. text: '扩展参数',
  6507. dataIndex: 'fieldExtend',
  6508. sortable: false,
  6509. menuDisabled: true,
  6510. editor: {
  6511. selectOnFocus: false
  6512. },
  6513. },
  6514. ],
  6515. },
  6516. {
  6517. title: '汇总和汇总逻辑',
  6518. layout: 'border',
  6519. border: false,
  6520. items: [
  6521. {
  6522. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6523. reference: 'gridSum',
  6524. pagination: false,
  6525. hideFootbar: true,
  6526. height: 200,
  6527. split: true,
  6528. border: false,
  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.addSum'
  6549. }
  6550. },
  6551. {
  6552. xtype: 'button',
  6553. text: '删除',
  6554. iconCls: 'x-fa fa-minus-circle',
  6555. listeners: {
  6556. click: 'scope.removeSum'
  6557. }
  6558. },
  6559. '-',
  6560. {
  6561. xtype: 'button',
  6562. text: '自动分析',
  6563. iconCls: 'x-fa fa-code-fork',
  6564. listeners: {
  6565. click: 'scope.calcSum'
  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: 'sumFieldBind',
  6590. width: 140,
  6591. sortable: false,
  6592. menuDisabled: true,
  6593. editor: {
  6594. selectOnFocus: true
  6595. },
  6596. },
  6597. {
  6598. text: '标题',
  6599. dataIndex: 'sumFieldLabel',
  6600. width: 120,
  6601. sortable: false,
  6602. menuDisabled: true,
  6603. editor: {
  6604. selectOnFocus: true
  6605. },
  6606. },
  6607. {
  6608. text: '权重',
  6609. dataIndex: 'sumFieldFlex',
  6610. align: 'right',
  6611. width: 60,
  6612. sortable: false,
  6613. menuDisabled: true,
  6614. editor: {
  6615. xtype: 'numberfield',
  6616. selectOnFocus: false,
  6617. allowBlank: true,
  6618. minValue: 0,
  6619. maxValue: 10
  6620. },
  6621. },
  6622. {
  6623. xtype: 'checkcolumn',
  6624. dataIndex: "sumFieldWrap", header: "换行",
  6625. sortable: false,
  6626. menuDisabled: true,
  6627. width: 65,
  6628. },
  6629. {
  6630. text: '扩展参数',
  6631. dataIndex: 'sumFieldExtend',
  6632. sortable: false,
  6633. menuDisabled: true,
  6634. editor: {
  6635. selectOnFocus: false
  6636. },
  6637. },
  6638. ]
  6639. },
  6640. {
  6641. region: 'center',
  6642. xtype: 'sqleditor',
  6643. layout: 'fit',
  6644. reference: 'sqlSumEditor',
  6645. },
  6646. ]
  6647. },
  6648. ]
  6649. }
  6650. ]
  6651. }
  6652. ]
  6653. }; //
  6654. //
  6655. //# sourceMappingURL=ReportDesign.view.js.map
  6656. var DbStore = /** @class */ (function (_super) {
  6657. __extends(DbStore, _super);
  6658. function DbStore() {
  6659. return _super !== null && _super.apply(this, arguments) || this;
  6660. }
  6661. DbStore.prototype.getCacheKey = function (param) {
  6662. return "db_data.json";
  6663. };
  6664. DbStore.prototype.invokeApi = function (param) {
  6665. return getMateData(param);
  6666. };
  6667. /**
  6668. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  6669. */
  6670. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  6671. return new Promise(function (resolve, reject) {
  6672. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  6673. resolve(res1);
  6674. // TODO 好像不需要,先跳过
  6675. // reloadByTableName(schema_name, table_name).then(res2 => {
  6676. // resolve(res1)
  6677. // }).catch(e => {
  6678. // reject(e)
  6679. // })
  6680. }).catch(function (e) {
  6681. reject(e);
  6682. });
  6683. });
  6684. };
  6685. /**
  6686. * 保存元数据至表格
  6687. */
  6688. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  6689. var _this = this;
  6690. return new Promise(function (resolve, reject) {
  6691. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  6692. // 保存后重新刷新
  6693. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  6694. resolve({
  6695. data: res2,
  6696. msg: res1.msg
  6697. });
  6698. }).catch(function (e) {
  6699. reject(e);
  6700. });
  6701. }).catch(function (e) {
  6702. reject(e);
  6703. });
  6704. });
  6705. };
  6706. /**
  6707. * 预览生成的 DDL 语句
  6708. */
  6709. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  6710. return new Promise(function (resolve, reject) {
  6711. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  6712. .then(function (res) {
  6713. resolve(res);
  6714. });
  6715. });
  6716. };
  6717. /**
  6718. * 执行 DDL
  6719. */
  6720. DbStore.prototype.pushToDbCommit = function (arg) {
  6721. return new Promise(function (resolve, reject) {
  6722. pushToDbCommitApi(arg).then(function (res) {
  6723. resolve(res);
  6724. }).catch(function (e) {
  6725. reject(e);
  6726. });
  6727. });
  6728. };
  6729. /**
  6730. * 重读某一个表格的 meta 元数据
  6731. */
  6732. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  6733. var _this = this;
  6734. return new Promise(function (resolve, reject) {
  6735. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  6736. if (!res[0] || !res[0].table_list[0]) {
  6737. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  6738. return;
  6739. }
  6740. var tableRow = _this.getTableByName(schema_name, table_name);
  6741. if (!tableRow) {
  6742. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  6743. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  6744. if (!schemaRow) {
  6745. showErrorDialog$1('没有找到 schema:' + schema_name);
  6746. return;
  6747. }
  6748. schemaRow.table_list.push(res[0].table_list[0]);
  6749. }
  6750. else {
  6751. // 找到了目标表格,就吧 table 所有属性都赋值过去
  6752. Object.assign(tableRow, res[0].table_list[0]);
  6753. }
  6754. // 所有界面通知一遍刷新
  6755. _this.notifyRefresh();
  6756. resolve(res);
  6757. }).catch(function (e) {
  6758. reject(e);
  6759. });
  6760. });
  6761. };
  6762. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  6763. var result = undefined;
  6764. _$2.forEach(this.apiResponse, function (schemaRow) {
  6765. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  6766. if (tableRow) {
  6767. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  6768. if (columnRow) {
  6769. result = columnRow;
  6770. return false;
  6771. }
  6772. }
  6773. });
  6774. return result;
  6775. };
  6776. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  6777. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  6778. if (!schemaRow) {
  6779. showErrorDialog$1('没有找到 schema:' + schemaName);
  6780. return;
  6781. }
  6782. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  6783. if (!schemaRow) {
  6784. showErrorDialog$1('没有找到 table:' + tableName);
  6785. return;
  6786. }
  6787. return tableRow;
  6788. };
  6789. /**
  6790. * 添加一个新表格
  6791. */
  6792. DbStore.prototype.appendNewTable = function (tableInfo) {
  6793. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  6794. if (!schemaRow) {
  6795. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  6796. return;
  6797. }
  6798. schemaRow.table_list.push(tableInfo);
  6799. };
  6800. /**
  6801. * 从数据库结构重新生成元数据
  6802. */
  6803. DbStore.prototype.dbToMetaAndReload = function () {
  6804. var _this = this;
  6805. this.notifyLoading(true);
  6806. dbToMeta().then(function () {
  6807. _this.reloadForce(undefined);
  6808. }).catch(function (e) {
  6809. _this.notifyLoading(false);
  6810. });
  6811. };
  6812. DbStore.prototype.getSchemaDbType = function (schemaName) {
  6813. var dbType = undefined;
  6814. _$2.forEach(this.apiResponse, function (schemaRow) {
  6815. if (schemaRow.schema_name === schemaName) {
  6816. dbType = schemaRow.db_type;
  6817. return false;
  6818. }
  6819. });
  6820. return dbType;
  6821. };
  6822. return DbStore;
  6823. }(CacheStore));
  6824. function syncQueryDSL(_a) {
  6825. var schema_name = _a.schema_name, table_name = _a.table_name;
  6826. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  6827. }
  6828. var instance$1 = new DbStore();
  6829. // // 字段域数据
  6830. // let columnDomain = undefined
  6831. // // 元数据
  6832. // let apiResponse = []
  6833. //
  6834. // // 订阅
  6835. // const subscribeList = []
  6836. // /**
  6837. // * 获取全部元数据
  6838. // */
  6839. // export function getApiResponse() {
  6840. // return apiResponse
  6841. // }
  6842. //
  6843. // export function getColumnDomain() {
  6844. // return columnDomain
  6845. // }
  6846. // window['getApiResponse'] = getApiResponse
  6847. // window['getColumnDomain'] = getColumnDomain
  6848. // window['getDbTreeStore'] = function () {
  6849. // return apiResponse
  6850. // }
  6851. //
  6852. // /**
  6853. // * 订阅结果集
  6854. // */
  6855. // export function subscribe(fn) {
  6856. // subscribeList.push(fn)
  6857. // }
  6858. //
  6859. // /**
  6860. // * 取消订阅
  6861. // */
  6862. // export function describe(fn) {
  6863. // _.remove(subscribeList, item => item === fn)
  6864. // }
  6865. //
  6866. // /**
  6867. // * 刷新,如果前端从来没有取到过结果的话
  6868. // * 如果强制刷新成功,就返回 true
  6869. // * 如果没有被强制刷新,返回 false
  6870. // */
  6871. // export function reloadIfNeed() {
  6872. // if (_.size(apiResponse) <= 0) {
  6873. // reloadForce()
  6874. // return true
  6875. // }
  6876. // return false
  6877. // }
  6878. //
  6879. // export function reloadIfNeedPromise() {
  6880. // return new Promise((resolve, reject) => {
  6881. // if (_.size(apiResponse) <= 0) {
  6882. // // 从未有获取过值
  6883. // reloadForce().then(res => {
  6884. // resolve(apiResponse)
  6885. // })
  6886. // return
  6887. // }
  6888. // resolve(apiResponse)
  6889. // return
  6890. // })
  6891. // }
  6892. //
  6893. // /**
  6894. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6895. // */
  6896. // export function reloadForce() {
  6897. // _.forEach(subscribeList, fn => {
  6898. // fn(true)
  6899. // })
  6900. //
  6901. // return getMateData().then((content) => {
  6902. // apiResponse = content
  6903. // _.forEach(subscribeList, fn => {
  6904. // fn(apiResponse)
  6905. // })
  6906. // }).finally(() => {
  6907. // _.forEach(subscribeList, fn => {
  6908. // fn(false)
  6909. // })
  6910. // })
  6911. // }
  6912. //
  6913. // /**
  6914. // * 通知刷新元数据
  6915. // */
  6916. // export function notifyRefresh() {
  6917. // _.forEach(subscribeList, fn => {
  6918. // fn(apiResponse)
  6919. // })
  6920. // }
  6921. // export function getAllDomain() {
  6922. // return new Promise((resolve, reject) => {
  6923. // getColumnDomainApi()
  6924. // .then(res => {
  6925. // if (res.success) {
  6926. // columnDomain = res.data
  6927. // resolve(res.data)
  6928. // } else {
  6929. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  6930. // console.error('getColumnDomain', res.msg)
  6931. // }
  6932. //
  6933. // })
  6934. // .catch(e => {
  6935. // showErrorDialog('getColumnDomain error!')
  6936. // console.error('getColumnDomain', e)
  6937. // reject(e)
  6938. // })
  6939. // })
  6940. // }
  6941. //# sourceMappingURL=DbStore.js.map
  6942. var PROJECT_DICT_CACHE = {};
  6943. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  6944. /**
  6945. *项目运行时构建
  6946. **/
  6947. function createRuntime() {
  6948. {
  6949. // 已经构建过了
  6950. return new Promise(function (resolve) {
  6951. resolve();
  6952. });
  6953. }
  6954. }
  6955. //# sourceMappingURL=ProjectRuntime.js.map
  6956. function ReportRunner(reportId, setLoadingFn) {
  6957. return new Promise(function (resolve) {
  6958. setLoadingFn(true);
  6959. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  6960. // const {model, vjson, report} = buildVjson(res.data)
  6961. // const ret = new ReportScope({model, vjson})
  6962. // ret.report_id = reportId
  6963. // ret.report = report
  6964. // resolve(ret)
  6965. var _b = __read(_a, 1), res = _b[0];
  6966. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  6967. resolve(ret);
  6968. }).finally(function () {
  6969. setLoadingFn(false);
  6970. });
  6971. });
  6972. }
  6973. //# sourceMappingURL=ReportRunner.js.map
  6974. //gridCondition
  6975. //gridColumn
  6976. //gridSum
  6977. //sqlSumEditor
  6978. //sqlEditor
  6979. var ReportDesign = /** @class */ (function (_super) {
  6980. __extends(ReportDesign, _super);
  6981. function ReportDesign() {
  6982. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  6983. }
  6984. ReportDesign.prototype.onLoad = function () {
  6985. this.load();
  6986. };
  6987. ReportDesign.prototype.save = function (sender) {
  6988. var _this = this;
  6989. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  6990. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  6991. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  6992. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  6993. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  6994. var report = this.viewModel.get('report');
  6995. var data = {
  6996. report_id: this.viewModel.get('report_id'),
  6997. report_name: this.viewModel.get('report_name'),
  6998. report_enable: this.viewModel.get('report_enable'),
  6999. query_sql: this.viewModel.get('querySql'),
  7000. summary_sql: this.viewModel.get('summarySql'),
  7001. report: json5.stringify(report, null, ' '),
  7002. };
  7003. sender.setLoading(true);
  7004. saveReportApi(data).then(function (res) {
  7005. if (res.success) {
  7006. msg$1('保存成功');
  7007. _this.dialogSuccess(data);
  7008. _this.load();
  7009. }
  7010. }).finally(function () {
  7011. sender.setLoading(false);
  7012. });
  7013. };
  7014. ReportDesign.prototype.preview = function (sender) {
  7015. var reportId = this.viewModel.get('report_id');
  7016. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7017. handles.mainWindow.showReportPreview(reportId, scope);
  7018. });
  7019. };
  7020. ReportDesign.prototype.load = function () {
  7021. var _this = this;
  7022. var reportId = this.viewModel.get('report_id');
  7023. this.setLoading(true);
  7024. reportByIdApi(reportId).then(function (res) {
  7025. 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;
  7026. if (report) {
  7027. report = json5.parse(report);
  7028. }
  7029. else {
  7030. report = {};
  7031. }
  7032. _this.viewModel.set('report_enable', report_enable);
  7033. _this.viewModel.set('report_name', report_name);
  7034. _this.viewModel.set('querySql', query_sql || '');
  7035. _this.viewModel.set('summarySql', summary_sql || '');
  7036. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7037. var query = _this.viewModel.get('report.query') || [];
  7038. var columns = _this.viewModel.get('report.columns') || [];
  7039. var summary = _this.viewModel.get('report.summary') || [];
  7040. var querySql = _this.viewModel.get('querySql');
  7041. var summarySql = _this.viewModel.get('summarySql');
  7042. _this.refs.gridCondition.setData(query);
  7043. _this.refs.gridColumn.setData(columns);
  7044. _this.refs.gridSum.setData(summary);
  7045. _this.refs.sqlEditor.setCode(querySql);
  7046. _this.refs.sqlSumEditor.setCode(summarySql);
  7047. }).finally(function () {
  7048. _this.setLoading(false);
  7049. });
  7050. };
  7051. ReportDesign.prototype.addCondition = function () {
  7052. this.refs.gridCondition.appendEditRow({
  7053. conditionFieldBind: '',
  7054. conditionFieldLabel: '',
  7055. conditionFieldXtype: 'textfield',
  7056. conditionFieldFlex: 1,
  7057. conditionFieldDict: '',
  7058. conditionFieldWrap: false,
  7059. conditionFieldExtend: '{}',
  7060. }, 'conditionFieldBind');
  7061. };
  7062. ReportDesign.prototype.removeCondition = function () {
  7063. var _this = this;
  7064. var rows = [];
  7065. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7066. rows.push(r);
  7067. });
  7068. _.forEach(rows, function (r) {
  7069. _this.refs.gridCondition.getStore().remove(r);
  7070. });
  7071. };
  7072. ReportDesign.prototype.moveUp = function (sender) {
  7073. var grid = sender.up('grid');
  7074. grid.rowMoveUp();
  7075. };
  7076. ReportDesign.prototype.moveDown = function (sender) {
  7077. var grid = sender.up('grid');
  7078. grid.rowMoveDown();
  7079. };
  7080. ReportDesign.prototype.calcCondition = function () {
  7081. var _this = this;
  7082. var sql = this.refs.sqlEditor.getCode();
  7083. var re = sql.matchAll(/#{(.+?)}/gi);
  7084. var rows = this.refs.gridCondition.getDataRows();
  7085. this.refs.gridCondition.setLoading(true);
  7086. Promise.all([
  7087. parseDynamicSqlApi(sql),
  7088. instance$1.reloadIfNeedPromise(),
  7089. ]).then(function (_a) {
  7090. var e_1, _b;
  7091. var _c = __read(_a, 1), res1 = _c[0];
  7092. if (res1.success) {
  7093. var tables_1 = [];
  7094. _.forEach(res1.data, function (parseItem) {
  7095. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7096. if (tableName && !_.includes(tables_1, tableName)) {
  7097. tables_1.push(tableName);
  7098. }
  7099. });
  7100. var _loop_1 = function (m) {
  7101. var e_2, _a;
  7102. var columnName = m[1];
  7103. // 没有这个列才添加
  7104. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7105. var meta = undefined;
  7106. try {
  7107. 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()) {
  7108. var tableName = tables_2_1.value;
  7109. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7110. if (meta) {
  7111. break;
  7112. }
  7113. }
  7114. }
  7115. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7116. finally {
  7117. try {
  7118. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7119. }
  7120. finally { if (e_2) throw e_2.error; }
  7121. }
  7122. if (meta) {
  7123. // 找到元数据
  7124. var r = {
  7125. conditionFieldBind: meta.column_name,
  7126. conditionFieldLabel: meta.column_comment,
  7127. conditionFieldXtype: 'textfield',
  7128. conditionFieldFlex: 1,
  7129. conditionFieldDict: '',
  7130. conditionFieldWrap: false,
  7131. conditionFieldExtend: '{}',
  7132. };
  7133. if (meta.column_ui === 'combo' && meta.column_dict) {
  7134. r.conditionFieldXtype = 'combo';
  7135. r.conditionFieldDict = meta.column_dict;
  7136. }
  7137. else if (meta.column_ui === "checkbox") {
  7138. r.conditionFieldXtype = 'checkbox';
  7139. }
  7140. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7141. r.conditionFieldXtype = 'numberfield';
  7142. }
  7143. _this.refs.gridCondition.appendEditRow(r);
  7144. }
  7145. else {
  7146. // 没找到元数据,直接添加
  7147. _this.refs.gridCondition.appendEditRow({
  7148. conditionFieldBind: columnName,
  7149. conditionFieldLabel: '',
  7150. conditionFieldXtype: 'textfield',
  7151. conditionFieldFlex: 1,
  7152. conditionFieldDict: '',
  7153. conditionFieldWrap: false,
  7154. conditionFieldExtend: '{}',
  7155. });
  7156. }
  7157. }
  7158. };
  7159. try {
  7160. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7161. var m = re_1_1.value;
  7162. _loop_1(m);
  7163. }
  7164. }
  7165. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7166. finally {
  7167. try {
  7168. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7169. }
  7170. finally { if (e_1) throw e_1.error; }
  7171. }
  7172. }
  7173. }).finally(function () {
  7174. _this.refs.gridCondition.setLoading(false);
  7175. });
  7176. };
  7177. ReportDesign.prototype.addColumn = function () {
  7178. this.refs.gridColumn.appendEditRow({
  7179. dataIndex: '',
  7180. header: '',
  7181. xtype: '',
  7182. dataType: '',
  7183. width: '',
  7184. dict: '',
  7185. align: '',
  7186. filterable: true,
  7187. hidden: false,
  7188. sortable: true,
  7189. fieldExtend: '{}',
  7190. }, 'header');
  7191. };
  7192. ReportDesign.prototype.removeColumn = function () {
  7193. var _this = this;
  7194. var rows = [];
  7195. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7196. rows.push(r);
  7197. });
  7198. _.forEach(rows, function (r) {
  7199. _this.refs.gridColumn.getStore().remove(r);
  7200. });
  7201. };
  7202. ReportDesign.prototype.calcColumn = function () {
  7203. var _this = this;
  7204. var sql = this.refs.sqlEditor.getCode();
  7205. this.refs.gridColumn.setLoading(true);
  7206. var rows = this.refs.gridColumn.getDataRows();
  7207. Promise.all([
  7208. parseDynamicSqlApi(sql),
  7209. instance$1.reloadIfNeedPromise(),
  7210. ]).then(function (_a) {
  7211. var _b = __read(_a, 1), res1 = _b[0];
  7212. if (res1.success) {
  7213. _.forEach(res1.data, function (parseItem) {
  7214. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7215. // 是否找到重复字段
  7216. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7217. if (exists) {
  7218. if ((columnTypeName || "").toLowerCase() === "number") {
  7219. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7220. if (record) {
  7221. record.set("dataType", "number");
  7222. record.set("align", "end");
  7223. }
  7224. }
  7225. return;
  7226. }
  7227. if (tableName) {
  7228. // 解出表格名和字段名
  7229. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7230. if (meta) {
  7231. // 找到了元数据
  7232. var r = {
  7233. dataIndex: meta.column_name,
  7234. header: meta.column_comment,
  7235. xtype: '',
  7236. dataType: '',
  7237. width: '',
  7238. dict: '',
  7239. align: '',
  7240. filterable: true,
  7241. hidden: false,
  7242. sortable: true,
  7243. fieldExtend: '{}',
  7244. };
  7245. if (meta.column_ui === 'combo' && meta.column_dict) {
  7246. r.dict = meta.column_dict;
  7247. }
  7248. else if (meta.column_ui === "checkbox") {
  7249. r.xtype = 'checkbox';
  7250. }
  7251. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7252. r.dataType = meta.data_type;
  7253. r.align = 'end';
  7254. }
  7255. if ((columnTypeName || "").toLowerCase() === "number") {
  7256. r.dataType = "number";
  7257. r.align = 'end';
  7258. }
  7259. _this.refs.gridColumn.appendEditRow(r);
  7260. return;
  7261. }
  7262. }
  7263. if (columnName) {
  7264. // 解出字段名
  7265. var r = {
  7266. dataIndex: columnName,
  7267. header: columnName,
  7268. xtype: '',
  7269. dataType: '',
  7270. width: '',
  7271. dict: '',
  7272. align: '',
  7273. filterable: true,
  7274. hidden: false,
  7275. sortable: true,
  7276. fieldExtend: '{}',
  7277. };
  7278. if ((columnTypeName || "").toLowerCase() === "number") {
  7279. r.dataType = "number";
  7280. r.align = 'end';
  7281. }
  7282. _this.refs.gridColumn.appendEditRow(r);
  7283. }
  7284. });
  7285. }
  7286. }).finally(function () {
  7287. _this.refs.gridColumn.setLoading(false);
  7288. });
  7289. };
  7290. ReportDesign.prototype.addSum = function () {
  7291. this.refs.gridSum.appendEditRow({
  7292. sumFieldBind: '',
  7293. sumFieldLabel: '',
  7294. sumFieldFlex: 1,
  7295. sumFieldWrap: false,
  7296. sumFieldExtend: '{}',
  7297. }, 'sumFieldBind');
  7298. };
  7299. ReportDesign.prototype.removeSum = function () {
  7300. var _this = this;
  7301. var rows = [];
  7302. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7303. rows.push(r);
  7304. });
  7305. _.forEach(rows, function (r) {
  7306. _this.refs.gridSum.getStore().remove(r);
  7307. });
  7308. };
  7309. ReportDesign.prototype.calcSum = function () {
  7310. var _this = this;
  7311. var sql = this.refs.sqlSumEditor.getCode();
  7312. var rows = this.refs.gridSum.getDataRows();
  7313. this.refs.gridSum.setLoading(true);
  7314. parseDynamicSqlApi(sql).then(function (res1) {
  7315. if (res1.success) {
  7316. _.forEach(res1.data, function (parseItem) {
  7317. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7318. // 是否找到重复字段
  7319. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7320. return;
  7321. }
  7322. if (columnName) {
  7323. // 解出字段名
  7324. _this.refs.gridSum.appendEditRow({
  7325. sumFieldBind: columnName,
  7326. sumFieldLabel: columnName,
  7327. sumFieldFlex: 1,
  7328. sumFieldWrap: false,
  7329. sumFieldExtend: '{}',
  7330. });
  7331. }
  7332. });
  7333. }
  7334. }).finally(function () {
  7335. _this.refs.gridSum.setLoading(false);
  7336. });
  7337. };
  7338. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7339. get: function () {
  7340. return this.viewModel.get('report_id');
  7341. },
  7342. enumerable: true,
  7343. configurable: true
  7344. });
  7345. return ReportDesign;
  7346. }(Scope));
  7347. //# sourceMappingURL=ReportDesign.js.map
  7348. var model$5 = {
  7349. data: {
  7350. originalTableInfo: {
  7351. table_name: '',
  7352. description: '',
  7353. },
  7354. hasChanged: false,
  7355. schema_name: undefined,
  7356. table_name: undefined,
  7357. column_name: undefined,
  7358. tableInfo: {
  7359. schema_name: '',
  7360. table_name: '',
  7361. description: '',
  7362. biz_category: '',
  7363. note: '',
  7364. archive_enable: false,
  7365. archive_cron: '',
  7366. archive_condition: '',
  7367. column_list: []
  7368. },
  7369. },
  7370. formulas: {
  7371. shouldSave: function (get) {
  7372. // console.log("-->", get('grid1.ischanged'))
  7373. return get('grid1.ischanged')
  7374. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7375. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7376. },
  7377. },
  7378. };
  7379. //# sourceMappingURL=DbColumn.model.js.map
  7380. var vjson$5 = {
  7381. bind: {
  7382. title: '{tableName}{shouldSave?" *":""}',
  7383. },
  7384. layout: 'fit',
  7385. items: [
  7386. {
  7387. layout: 'border',
  7388. tbar: {
  7389. xtype: 'toolbar',
  7390. items: [
  7391. // {
  7392. // xtype: 'button',
  7393. // text: '拉取库结构',
  7394. // iconCls: 'x-fa fa-cloud-download',
  7395. // listeners: {
  7396. // click: 'scope.pullFromDb'
  7397. // }
  7398. // },
  7399. {
  7400. xtype: 'button',
  7401. text: '保存至数据库',
  7402. iconCls: 'x-fa fa-save',
  7403. bind: {
  7404. disabled: '{!shouldSave}'
  7405. },
  7406. listeners: {
  7407. click: 'scope.pushToDb'
  7408. }
  7409. },
  7410. '-',
  7411. {
  7412. xtype: 'button',
  7413. text: '刷新 QueryDSL',
  7414. iconCls: 'x-fa fa-refresh',
  7415. listeners: {
  7416. click: 'scope.syncQueryDSL'
  7417. }
  7418. },
  7419. {
  7420. xtype: 'button',
  7421. text: '生成 DDL',
  7422. iconCls: 'x-fa fa-file-text',
  7423. listeners: {
  7424. click: 'scope.buildDDL'
  7425. }
  7426. }
  7427. ]
  7428. },
  7429. items: [
  7430. {
  7431. region: 'center',
  7432. xtype: 'tabpanel',
  7433. items: [
  7434. {
  7435. title: '字段',
  7436. xtype: 'yvgrid',
  7437. selModel: {
  7438. type: 'spreadsheet',
  7439. columnSelect: true,
  7440. pruneRemoved: false,
  7441. extensible: 'y'
  7442. },
  7443. enableLocking: false,
  7444. idField: 'column_name',
  7445. plugins: {
  7446. clipboard: true,
  7447. selectionreplicator: true
  7448. },
  7449. reference: 'grid1',
  7450. pagination: false,
  7451. // hideFootbar: true,
  7452. tbar: {
  7453. xtype: 'form',
  7454. items: [
  7455. {
  7456. xtype: 'cols',
  7457. items: [
  7458. {
  7459. xtype: 'textfield',
  7460. fieldLabel: '表格名',
  7461. reference: 'text_table_name',
  7462. readOnly: true,
  7463. bind: {
  7464. value: '{tableInfo.table_name}'
  7465. }
  7466. },
  7467. {
  7468. xtype: 'textfield',
  7469. fieldLabel: '描述',
  7470. // readOnly: true,
  7471. bind: {
  7472. value: '{tableInfo.description}'
  7473. }
  7474. },
  7475. ]
  7476. },
  7477. {
  7478. xtype: 'toolbar',
  7479. items: [
  7480. {
  7481. xtype: 'button',
  7482. text: '添加',
  7483. iconCls: 'x-fa fa-plus-circle',
  7484. listeners: {
  7485. click: 'scope.addField'
  7486. }
  7487. },
  7488. {
  7489. xtype: 'button',
  7490. text: '删除',
  7491. iconCls: 'x-fa fa-minus-circle',
  7492. listeners: {
  7493. click: 'scope.removeField'
  7494. }
  7495. },
  7496. ]
  7497. },
  7498. ]
  7499. },
  7500. listeners: {
  7501. editbefore: 'scope.gridEditBefore'
  7502. },
  7503. columns: [
  7504. {
  7505. text: '字段名', dataIndex: 'column_name',
  7506. sortable: false,
  7507. menuDisabled: true,
  7508. width: 120,
  7509. editor: {
  7510. allowBlank: true,
  7511. selectOnFocus: false
  7512. }
  7513. },
  7514. {
  7515. text: '字段中文', dataIndex: 'column_comment',
  7516. width: 130,
  7517. sortable: false,
  7518. menuDisabled: true,
  7519. editor: {
  7520. allowBlank: true,
  7521. selectOnFocus: false
  7522. }
  7523. },
  7524. {
  7525. text: '主键', dataIndex: 'is_primary_key',
  7526. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7527. width: 48, resizable: false,
  7528. },
  7529. {
  7530. text: '必填', dataIndex: 'not_null',
  7531. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7532. width: 48, resizable: false,
  7533. },
  7534. {
  7535. text: '字段域', dataIndex: 'column_domain',
  7536. sortable: false, menuDisabled: true,
  7537. width: 148,
  7538. fix: ['system.getDict("column_domain")'],
  7539. editor: {
  7540. xtype: 'combo',
  7541. allowBlank: true,
  7542. selectOnFocus: true,
  7543. fix: ['system.getDict("column_domain")'],
  7544. listConfig: {
  7545. minWidth: 200
  7546. },
  7547. listeners: {
  7548. change: 'scope.columnDomainChange',
  7549. }
  7550. }
  7551. },
  7552. {
  7553. text: '数据类型', dataIndex: 'data_type',
  7554. sortable: false, menuDisabled: true,
  7555. editor: { allowBlank: true, selectOnFocus: true }
  7556. },
  7557. {
  7558. text: '长度', dataIndex: 'column_size',
  7559. sortable: false, menuDisabled: true,
  7560. xtype: 'numbercolumn', format: '0',
  7561. editor: { allowBlank: true, selectOnFocus: true }
  7562. },
  7563. {
  7564. text: '小数位', dataIndex: 'decimal_digits',
  7565. sortable: false, menuDisabled: true,
  7566. xtype: 'numbercolumn', format: '0',
  7567. editor: { allowBlank: true, selectOnFocus: true }
  7568. },
  7569. {
  7570. text: '默认值', dataIndex: 'default_value',
  7571. sortable: false, menuDisabled: true,
  7572. editor: { allowBlank: true, selectOnFocus: true }
  7573. },
  7574. {
  7575. text: '字典', dataIndex: 'column_dict',
  7576. sortable: false, menuDisabled: true,
  7577. // fix: ['system.getDict("DICT")'],
  7578. width: 200,
  7579. editor: {
  7580. xtype: 'combo',
  7581. allowBlank: true,
  7582. listConfig: {
  7583. minWidth: 350
  7584. },
  7585. }
  7586. },
  7587. {
  7588. text: 'UI建议', dataIndex: 'column_ui',
  7589. sortable: false, menuDisabled: true,
  7590. // fix: ['system.getDict("column_ui")'],
  7591. editor: {
  7592. xtype: 'combo',
  7593. allowBlank: true,
  7594. listConfig: {
  7595. minWidth: 200
  7596. },
  7597. }
  7598. },
  7599. {
  7600. text: '详细描述', dataIndex: 'column_note',
  7601. sortable: false, menuDisabled: true,
  7602. editor: { allowBlank: true, }
  7603. },
  7604. ]
  7605. },
  7606. {
  7607. title: '高级属性',
  7608. xtype: 'form',
  7609. items: [
  7610. // {
  7611. // xtype: 'textfield',
  7612. // fieldLabel: '表格名',
  7613. // bind: {
  7614. // value: '{tableName}'
  7615. // }
  7616. // },
  7617. // {
  7618. // xtype: 'textfield',
  7619. // fieldLabel: '中文含义',
  7620. // bind: {
  7621. // value: '{tableInfo.description}'
  7622. // }
  7623. // },
  7624. {
  7625. xtype: 'combo',
  7626. fieldLabel: '业务类型',
  7627. bind: {
  7628. value: '{tableInfo.biz_category}'
  7629. },
  7630. store: [
  7631. '基础资料',
  7632. '系统',
  7633. '账目与库存',
  7634. '单据',
  7635. '指令',
  7636. '规则与流程',
  7637. '开发辅助',
  7638. ]
  7639. },
  7640. {
  7641. xtype: 'textfield',
  7642. fieldLabel: '详细描述',
  7643. bind: {
  7644. value: '{tableInfo.note}'
  7645. },
  7646. },
  7647. {
  7648. xtype: 'checkbox',
  7649. fieldLabel: '允许归档',
  7650. bind: "{tableInfo.archive_enable}",
  7651. },
  7652. {
  7653. xtype: 'textfield',
  7654. fieldLabel: '归档周期',
  7655. bind: {
  7656. value: '{tableInfo.archive_cron}',
  7657. hidden: '{!tableInfo.archive_enable}',
  7658. }
  7659. },
  7660. {
  7661. xtype: 'textfield',
  7662. fieldLabel: '归档条件',
  7663. bind: {
  7664. value: '{tableInfo.archive_condition}',
  7665. hidden: '{!tableInfo.archive_enable}',
  7666. }
  7667. },
  7668. ]
  7669. },
  7670. ]
  7671. }
  7672. ]
  7673. },
  7674. ]
  7675. };
  7676. //# sourceMappingURL=DbColumn.view.js.map
  7677. var DbColumn = /** @class */ (function (_super) {
  7678. __extends(DbColumn, _super);
  7679. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  7680. var _this = _super.call(this, {
  7681. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  7682. vjson: vjson$5
  7683. }) || this;
  7684. _this.isCreate = false;
  7685. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  7686. return _this;
  7687. }
  7688. DbColumn.prototype.onLoad = function () {
  7689. var _this = this;
  7690. var _a, _b, _c, _d, _e, _f, _g, _h;
  7691. console.log('me', this);
  7692. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  7693. this.refs.grid1.autoSizeColumns();
  7694. // this.refs.grid1.columns[0].hide()
  7695. // 自动定位到选定的列
  7696. if (this.viewModel.get('column_name')) {
  7697. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  7698. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  7699. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  7700. return;
  7701. }
  7702. }
  7703. }
  7704. instance.getColumnDomainComboData().then(function () {
  7705. _this.checkDomain();
  7706. });
  7707. 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 : "");
  7708. 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 : "");
  7709. if (this.isCreate)
  7710. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  7711. };
  7712. DbColumn.prototype.checkDomain = function () {
  7713. // 走查一遍 domain
  7714. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  7715. var dbType = this.viewModel.get('tableInfo.db_type');
  7716. var diffColumnName = [];
  7717. var tableInfo = this.viewModel.get('tableInfo');
  7718. this.refs.grid1.store.data.items.forEach(function (record) {
  7719. var data = record.data;
  7720. var column_domain = data.column_domain;
  7721. var domain = instance.getColumnDomainById(column_domain);
  7722. if (!domain) {
  7723. // 没有找到 domain
  7724. return;
  7725. }
  7726. var editRow = applyDomain(dbType, domain);
  7727. // 字段跟领域做对比
  7728. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  7729. if (typeof compareResult === 'string') {
  7730. // 不一样的情况下,要改成一致
  7731. _$2.forOwn(editRow, function (value, key) {
  7732. // 改成与 domain 一致
  7733. record.set(key, value);
  7734. });
  7735. diffColumnName.push(data.column_name + '.' + compareResult);
  7736. }
  7737. });
  7738. if (diffColumnName.length > 0) {
  7739. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  7740. }
  7741. };
  7742. DbColumn.prototype.addField = function () {
  7743. this.refs.grid1.appendEditRow({
  7744. column_name: '',
  7745. column_comment: '',
  7746. is_primary_key: false,
  7747. not_null: true,
  7748. column_domain: '',
  7749. data_type: '',
  7750. column_size: 0,
  7751. decimal_digits: 0,
  7752. default_value: '',
  7753. column_dict: '',
  7754. column_ui: '',
  7755. column_note: '',
  7756. }, 'column_name');
  7757. };
  7758. DbColumn.prototype.removeField = function () {
  7759. var _this = this;
  7760. var rows = [];
  7761. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  7762. rows.push(r);
  7763. });
  7764. _$2.forEach(rows, function (r) {
  7765. _this.refs.grid1.getStore().remove(r);
  7766. });
  7767. };
  7768. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  7769. instance.getColumnDomainComboData().then(function (data) {
  7770. editor.cmp.columns[5].getEditor().setStore({ data: data });
  7771. });
  7772. // 被字段域锁定的内容,不允许修改
  7773. var record = context.record, field = context.field;
  7774. var domainId = record.get('column_domain');
  7775. if (!domainId) {
  7776. return;
  7777. }
  7778. var domain = instance.getColumnDomainById(domainId);
  7779. if (!domain) {
  7780. msg$1('没有找到字段域' + domainId);
  7781. return;
  7782. }
  7783. if (field === "data_type") {
  7784. // 字段类型不允许修改
  7785. context.cancel = true;
  7786. return;
  7787. }
  7788. if (domain.is_fix_size &&
  7789. (field === "column_size" ||
  7790. field === "decimal_digits")) {
  7791. // 锁定长度的情况下,大小不允许修改
  7792. context.cancel = true;
  7793. return;
  7794. }
  7795. if (domain.is_fix_default_value && field === "default_value") {
  7796. // 锁定默认值的情况下,默认值不允许修改
  7797. context.cancel = true;
  7798. return;
  7799. }
  7800. };
  7801. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  7802. if (!newValue) {
  7803. return;
  7804. }
  7805. var grid = editor.up('grid').ownerGrid;
  7806. var domain = instance.getColumnDomainById(newValue);
  7807. if (!domain) {
  7808. msg$1('没有找到 domain:' + newValue);
  7809. return;
  7810. }
  7811. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  7812. var dbType = this.viewModel.get('tableInfo.db_type');
  7813. var editRow = applyDomain(dbType, domain);
  7814. grid.setEditRow(editRow);
  7815. };
  7816. DbColumn.prototype.pullFromDb = function () {
  7817. };
  7818. DbColumn.prototype.pushToDb = function (sender) {
  7819. var _this = this;
  7820. // 设置当前界面为 "保存中..." 状态
  7821. var me = this;
  7822. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  7823. this.viewModel.set('tableInfo.table_name', table_name);
  7824. this.viewModel.set('tableInfo.schema_name', schema_name);
  7825. var tableInfo = this.viewModel.get('tableInfo');
  7826. var column_list = this.refs.grid1.getDataRows();
  7827. var hasError = false;
  7828. if (column_list.length <= 0) {
  7829. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  7830. hasError = true;
  7831. }
  7832. var columnNameExistsCheck = {};
  7833. _$2.forEach(column_list, function (row, i) {
  7834. var checkResult = checkColumn(tableInfo, row);
  7835. if (typeof checkResult !== 'undefined') {
  7836. msg$1(checkResult);
  7837. hasError = true;
  7838. _this.refs.grid1.beginEdit(i, 'column_name');
  7839. return false;
  7840. }
  7841. if (!row.column_domain || row.column_domain === '0') {
  7842. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  7843. hasError = true;
  7844. _this.refs.grid1.beginEdit(i, 'column_domain');
  7845. return false;
  7846. }
  7847. if (isEmpty(row.data_type)) {
  7848. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  7849. hasError = true;
  7850. _this.refs.grid1.beginEdit(i, 'data_type');
  7851. return false;
  7852. }
  7853. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  7854. // 列名已存在
  7855. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  7856. hasError = true;
  7857. _this.refs.grid1.beginEdit(i, 'column_name');
  7858. return false;
  7859. }
  7860. columnNameExistsCheck[row.column_name] = true;
  7861. });
  7862. if (hasError)
  7863. return;
  7864. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  7865. me.setLoading(true);
  7866. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  7867. .then(function (res) {
  7868. var _a;
  7869. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  7870. // 返回 DDL 就要显示出来
  7871. var window_1 = Ext.create('Ext.window.Window', {
  7872. title: 'SQL 预览',
  7873. height: 400,
  7874. width: 600,
  7875. modal: true,
  7876. animateTarget: sender,
  7877. maximizable: true,
  7878. layout: 'fit',
  7879. items: {
  7880. xtype: 'sqleditor',
  7881. value: res.data.ddl
  7882. },
  7883. buttons: [
  7884. {
  7885. xtype: 'button',
  7886. text: '执行',
  7887. iconCls: 'x-fa fa-save',
  7888. handler: function (sender) {
  7889. var editor = sender.up('window').down('sqleditor');
  7890. var ddl = editor.getValue();
  7891. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  7892. }
  7893. },
  7894. {
  7895. xtype: 'button',
  7896. text: '取消',
  7897. iconCls: 'x-fa fa-times',
  7898. handler: function () {
  7899. window_1.close();
  7900. }
  7901. }
  7902. ]
  7903. }).show();
  7904. return;
  7905. }
  7906. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  7907. var tableRow = instance$1.getTableByName(schema_name, table_name);
  7908. if (!tableRow) {
  7909. // throw Error('没有找到 table', schemaName, tableName, columnName)
  7910. console.log('这是一个新 table');
  7911. instance$1.appendNewTable(tableInfo);
  7912. }
  7913. _this.viewModel.set('schema_name', schema_name);
  7914. _this.viewModel.set('table_name', table_name);
  7915. _this.viewModel.set('tableInfo', tableInfo);
  7916. _this.refs.grid1.setData(tableInfo.column_list);
  7917. if (tableRow)
  7918. Object.assign(tableRow, tableInfo);
  7919. msg$1('保存成功');
  7920. _this.viewModel.set('hasChanged', false);
  7921. })
  7922. .finally(function () {
  7923. me.setLoading(false);
  7924. });
  7925. };
  7926. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  7927. var _this = this;
  7928. window.setLoading(true);
  7929. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  7930. .then(function (res) {
  7931. var _a, _b, _c, _d;
  7932. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  7933. // 保存成功就提示一下,并重新载入数据
  7934. msg$1(res.msg);
  7935. instance$1.reloadForce(undefined);
  7936. var tableRow = instance$1.getTableByName(schema_name, table_name);
  7937. if (!tableRow) {
  7938. // throw Error('没有找到 table', schemaName, tableName, columnName)
  7939. console.log('这是一个新 table');
  7940. instance$1.appendNewTable(tableInfo);
  7941. }
  7942. _this.viewModel.set('schema_name', schema_name);
  7943. _this.viewModel.set('table_name', table_name);
  7944. _this.viewModel.set('tableInfo', tableInfo);
  7945. _this.refs.grid1.setData(tableInfo.column_list);
  7946. if (tableRow)
  7947. Object.assign(tableRow, tableInfo);
  7948. instance$1.notifyRefresh();
  7949. window.close();
  7950. _this.viewModel.set('hasChanged', false);
  7951. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  7952. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  7953. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  7954. })
  7955. .finally(function () {
  7956. // 无论正常异常,关闭 "保存中..." 状态
  7957. window.setLoading(false);
  7958. });
  7959. };
  7960. DbColumn.prototype.syncQueryDSL = function () {
  7961. var _this = this;
  7962. var tableInfo = this.viewModel.get("tableInfo");
  7963. this.setLoading(true);
  7964. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  7965. .then(function () {
  7966. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  7967. })
  7968. .finally(function () {
  7969. _this.setLoading(false);
  7970. });
  7971. };
  7972. DbColumn.prototype.buildDDL = function () {
  7973. };
  7974. return DbColumn;
  7975. }(Scope));
  7976. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  7977. model.data.schema_name = schemaName;
  7978. model.data.table_name = tableName;
  7979. model.data.column_name = columnName;
  7980. if (isCreateTable) {
  7981. var dbType = instance$1.getSchemaDbType(schemaName);
  7982. if (!dbType) {
  7983. throw Error('无法识别数据库类型' + schemaName);
  7984. }
  7985. model.data.tableInfo.schema_name = model.data.schema_name;
  7986. model.data.tableInfo.table_name = model.data.table_name;
  7987. model.data.tableInfo.db_type = dbType;
  7988. model.data.tableInfo.column_list = [];
  7989. model.data.tableInfo.is_create = true;
  7990. return model;
  7991. }
  7992. var tableRow = instance$1.getTableByName(schemaName, tableName);
  7993. if (!tableRow) {
  7994. throw Error('没有找到 table' + schemaName + tableName + columnName);
  7995. }
  7996. model.data.tableInfo = _$2.cloneDeep(tableRow);
  7997. model.data.tableInfo.is_create = false;
  7998. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  7999. return model;
  8000. }
  8001. //# sourceMappingURL=DbColumn.js.map
  8002. var model$6 = {
  8003. data: {
  8004. id: '',
  8005. path: '',
  8006. form: {
  8007. title: '',
  8008. sqlId: '',
  8009. }
  8010. }
  8011. };
  8012. //# sourceMappingURL=WidgetDesign.model.js.map
  8013. var vjson$6 = {
  8014. bind: {
  8015. title: '{title}',
  8016. },
  8017. layout: 'fit',
  8018. items: [
  8019. {
  8020. layout: 'border',
  8021. items: [
  8022. {
  8023. region: 'center',
  8024. layout: 'border',
  8025. items: [
  8026. {
  8027. region: 'north',
  8028. items: [
  8029. {
  8030. xtype: 'toolbar',
  8031. border: false,
  8032. items: [
  8033. {
  8034. xtype: 'button',
  8035. text: '刷新',
  8036. iconCls: 'x-fa fa-refresh',
  8037. listeners: {
  8038. click: 'scope.load'
  8039. }
  8040. },
  8041. {
  8042. xtype: 'button',
  8043. text: '保存',
  8044. iconCls: 'x-fa fa-save',
  8045. listeners: {
  8046. click: 'scope.widgetSave'
  8047. }
  8048. },
  8049. {
  8050. xtype: 'button',
  8051. text: '预览',
  8052. iconCls: 'x-fa fa-play-circle-o',
  8053. listeners: {
  8054. //click: 'scope.preview'
  8055. }
  8056. },
  8057. {
  8058. xtype: 'textfield',
  8059. fieldLabel: '弹窗文件',
  8060. reference: "wPath",
  8061. labelWidth: 80,
  8062. //width: 200,
  8063. bind: {
  8064. value: '{widgetPath}',
  8065. },
  8066. readOnly: true,
  8067. },
  8068. {
  8069. xtype: 'textfield',
  8070. fieldLabel: '弹窗名称',
  8071. reference: "wTitle",
  8072. labelWidth: 80,
  8073. //width: 200,
  8074. bind: {
  8075. value: '{form.title}',
  8076. },
  8077. readOnly: true,
  8078. },
  8079. {
  8080. xtype: 'textfield',
  8081. fieldLabel: 'sqlId',
  8082. bind: {
  8083. value: '{form.sqlId}',
  8084. },
  8085. readOnly: true,
  8086. },
  8087. ]
  8088. },
  8089. ]
  8090. },
  8091. {
  8092. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8093. items: [
  8094. {
  8095. title: "SQL和条件",
  8096. layout: 'border',
  8097. border: false,
  8098. items: [
  8099. {
  8100. region: 'north',
  8101. height: 200,
  8102. xtype: 'yvgrid',
  8103. reference: "grid2",
  8104. split: true,
  8105. selModel: {
  8106. selType: 'rowmodel',
  8107. mode: 'SINGLE',
  8108. },
  8109. store: {},
  8110. pagination: false,
  8111. hideFootbar: true,
  8112. tbar: {
  8113. xtype: 'toolbar',
  8114. items: [
  8115. {
  8116. xtype: 'button',
  8117. text: '添加',
  8118. iconCls: 'x-fa fa-plus-circle',
  8119. listeners: {}
  8120. },
  8121. {
  8122. xtype: 'button',
  8123. text: '删除',
  8124. iconCls: 'x-fa fa-minus-circle',
  8125. listeners: {
  8126. click: 'scope.delCondition'
  8127. }
  8128. },
  8129. '-',
  8130. {
  8131. xtype: 'button',
  8132. text: '上移',
  8133. iconCls: 'x-fa fa-refresh',
  8134. listeners: {
  8135. //click: 'scope.saveAll'
  8136. }
  8137. },
  8138. {
  8139. xtype: 'button',
  8140. text: '下移',
  8141. iconCls: 'x-fa fa-refresh',
  8142. listeners: {
  8143. //click: 'scope.saveAll'
  8144. }
  8145. },
  8146. '-',
  8147. {
  8148. xtype: 'button',
  8149. text: '自动分析',
  8150. iconCls: 'x-fa fa-refresh',
  8151. listeners: {
  8152. click: 'scope.calcCondition'
  8153. }
  8154. },
  8155. ]
  8156. },
  8157. columns: [
  8158. {
  8159. text: '条件变量',
  8160. dataIndex: 'conditionFieldBind',
  8161. width: 140,
  8162. sortable: false,
  8163. menuDisabled: true,
  8164. editor: {
  8165. selectOnFocus: true
  8166. },
  8167. },
  8168. {
  8169. text: '中文标题',
  8170. dataIndex: 'conditionFieldLabel',
  8171. width: 120,
  8172. sortable: false,
  8173. menuDisabled: true,
  8174. editor: {
  8175. selectOnFocus: true
  8176. },
  8177. },
  8178. {
  8179. text: '编辑类型',
  8180. dataIndex: 'xtype',
  8181. sortable: false,
  8182. menuDisabled: true,
  8183. editor: {
  8184. xtype: 'combo',
  8185. typeAhead: true,
  8186. triggerAction: 'all',
  8187. selectOnFocus: true,
  8188. store: [
  8189. ['textfield', 'textfield'],
  8190. ['combo', 'combo'],
  8191. ['datefield', 'datefield'],
  8192. ['datetimefield', 'datetimefield'],
  8193. ['numberfield', 'numberfield'],
  8194. ['multiplesearch', 'multiplesearch'],
  8195. ]
  8196. }
  8197. },
  8198. {
  8199. text: '权重',
  8200. dataIndex: 'conditionFieldFlex',
  8201. align: 'right',
  8202. sortable: false,
  8203. menuDisabled: true,
  8204. editor: {
  8205. xtype: 'numberfield',
  8206. selectOnFocus: false,
  8207. minValue: 0,
  8208. maxValue: 10
  8209. },
  8210. },
  8211. {
  8212. text: '字典',
  8213. dataIndex: 'conditionFieldDict',
  8214. width: 160,
  8215. sortable: false,
  8216. menuDisabled: true,
  8217. editor: {
  8218. selectOnFocus: false
  8219. },
  8220. },
  8221. {
  8222. xtype: 'checkcolumn',
  8223. dataIndex: "conditionFieldWrap", header: "换行",
  8224. width: 65,
  8225. sortable: false,
  8226. menuDisabled: true,
  8227. },
  8228. ]
  8229. },
  8230. {
  8231. region: 'center',
  8232. xtype: 'sqleditor',
  8233. layout: 'fit',
  8234. reference: 'sqlEditor',
  8235. split: true,
  8236. bind: {
  8237. value: "{form.sql}"
  8238. },
  8239. },
  8240. ]
  8241. },
  8242. {
  8243. title: "结果字段定义",
  8244. border: false,
  8245. xtype: 'yvgrid',
  8246. reference: "grid3",
  8247. selModel: {
  8248. selType: 'rowmodel',
  8249. mode: 'SINGLE',
  8250. },
  8251. store: {},
  8252. pagination: false,
  8253. hideFootbar: true,
  8254. tbar: {
  8255. xtype: 'toolbar',
  8256. items: [
  8257. {
  8258. xtype: 'button',
  8259. text: '添加',
  8260. iconCls: 'x-fa fa-plus-circle',
  8261. listeners: {}
  8262. },
  8263. {
  8264. xtype: 'button',
  8265. text: '删除',
  8266. iconCls: 'x-fa fa-minus-circle',
  8267. listeners: {
  8268. click: 'scope.delColumn'
  8269. }
  8270. },
  8271. '-',
  8272. {
  8273. xtype: 'button',
  8274. text: '上移',
  8275. iconCls: 'x-fa fa-refresh',
  8276. listeners: {
  8277. //click: 'scope.saveAll'
  8278. }
  8279. },
  8280. {
  8281. xtype: 'button',
  8282. text: '下移',
  8283. iconCls: 'x-fa fa-refresh',
  8284. listeners: {
  8285. //click: 'scope.saveAll'
  8286. }
  8287. },
  8288. '-',
  8289. {
  8290. xtype: 'button',
  8291. text: '自动分析',
  8292. iconCls: 'x-fa fa-refresh',
  8293. listeners: {
  8294. click: 'scope.calcColumn'
  8295. }
  8296. },
  8297. ]
  8298. },
  8299. columns: [
  8300. { xtype: 'rownumberer' },
  8301. {
  8302. text: '字段',
  8303. dataIndex: 'dataIndex',
  8304. width: 140,
  8305. sortable: false,
  8306. menuDisabled: true,
  8307. editor: {
  8308. selectOnFocus: true
  8309. },
  8310. },
  8311. {
  8312. text: '标题',
  8313. dataIndex: 'header',
  8314. width: 120,
  8315. sortable: false,
  8316. menuDisabled: true,
  8317. editor: {
  8318. selectOnFocus: true
  8319. },
  8320. },
  8321. {
  8322. text: '显示类型',
  8323. dataIndex: 'xtype',
  8324. width: 90,
  8325. sortable: false,
  8326. menuDisabled: true,
  8327. editor: {
  8328. xtype: 'combo',
  8329. typeAhead: true,
  8330. triggerAction: 'all',
  8331. selectOnFocus: true,
  8332. store: [
  8333. ['', ''],
  8334. ['rownum', 'rownum'],
  8335. ['button', 'button'],
  8336. ['checkbox', 'checkbox'],
  8337. ['progres', 'progres'],
  8338. ]
  8339. }
  8340. },
  8341. {
  8342. text: '数据类型',
  8343. dataIndex: 'dataType',
  8344. width: 90,
  8345. sortable: false,
  8346. menuDisabled: true,
  8347. editor: {
  8348. xtype: 'combo',
  8349. typeAhead: true,
  8350. triggerAction: 'all',
  8351. selectOnFocus: true,
  8352. store: [
  8353. ['', ''],
  8354. ['string', 'string'],
  8355. ['number', 'number'],
  8356. ['date', 'date'],
  8357. ]
  8358. }
  8359. },
  8360. {
  8361. text: '数据字典',
  8362. dataIndex: 'dict',
  8363. sortable: false,
  8364. menuDisabled: true,
  8365. width: 120,
  8366. editor: {
  8367. selectOnFocus: true,
  8368. },
  8369. },
  8370. ],
  8371. },
  8372. ]
  8373. },
  8374. ]
  8375. },
  8376. ]
  8377. }
  8378. ]
  8379. }; //
  8380. //
  8381. //# sourceMappingURL=WidgetDesign.view.js.map
  8382. var WidgetDesign = /** @class */ (function (_super) {
  8383. __extends(WidgetDesign, _super);
  8384. function WidgetDesign(widgetPath, widgetName) {
  8385. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8386. _this.widgetPath = widgetPath;
  8387. _this.widgetName = widgetName;
  8388. return _this;
  8389. }
  8390. WidgetDesign.prototype.onLoad = function () {
  8391. if (this.widgetPath) {
  8392. this.loadForm(this.widgetPath);
  8393. this.viewModel.set("widgetPath", this.widgetPath);
  8394. this.refs.wTitle.setReadOnly(true);
  8395. this.refs.wPath.setReadOnly(true);
  8396. }
  8397. else {
  8398. this.refs.wTitle.setReadOnly(false);
  8399. this.refs.wPath.setReadOnly(false);
  8400. }
  8401. };
  8402. WidgetDesign.prototype.load = function () {
  8403. var widgetPath = this.viewModel.get("widgetPath");
  8404. if (widgetPath) {
  8405. this.loadForm(widgetPath);
  8406. }
  8407. };
  8408. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8409. var _this = this;
  8410. var me = this;
  8411. me.setLoading(true);
  8412. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8413. msg$1(res.msg);
  8414. if (res.success) {
  8415. _this.viewModel.set("widgetPath", widgetPath);
  8416. me.refs.grid3.getStore().removeAll();
  8417. if (res.data.form.columns) {
  8418. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8419. }
  8420. _this.viewModel.set("form.title", res.data.form.title);
  8421. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8422. // set sql
  8423. _this.refs.sqlEditor.setCode(res.data.sql);
  8424. }
  8425. }).finally(function () {
  8426. me.setLoading(false);
  8427. });
  8428. };
  8429. WidgetDesign.prototype.widgetAdd = function (sender) {
  8430. var _this = this;
  8431. var title = this.viewModel.get("form.title");
  8432. if (title) {
  8433. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8434. if (btn == 'yes') {
  8435. alert(1);
  8436. }
  8437. else {
  8438. alert(2);
  8439. }
  8440. });
  8441. }
  8442. else {
  8443. var me_1 = this;
  8444. var win_1 = new Ext.Window({
  8445. autoDestroy: true,
  8446. title: "新建弹框",
  8447. width: 400,
  8448. height: 220,
  8449. resizable: true,
  8450. closable: true,
  8451. maximizable: true,
  8452. minimizable: true,
  8453. plain: true,
  8454. // constrainHeader: true,
  8455. constrain: true,
  8456. layout: 'fit',
  8457. animateTarget: sender,
  8458. buttonAlign: 'center',
  8459. items: [
  8460. {
  8461. xtype: "form",
  8462. layout: "hbox",
  8463. margin: '10px 20px',
  8464. border: 0,
  8465. items: [
  8466. {
  8467. flex: 1,
  8468. layout: 'vbox',
  8469. items: [
  8470. {
  8471. xtype: "textfield",
  8472. name: "widgetcode",
  8473. fieldLabel: "弹框编号",
  8474. flex: 1,
  8475. allowBlank: false,
  8476. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8477. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8478. labelWidth: 50,
  8479. width: "100%",
  8480. },
  8481. {
  8482. xtype: "textfield",
  8483. name: "widgetname",
  8484. fieldLabel: "弹框名称",
  8485. flex: 1,
  8486. allowBlank: false,
  8487. labelWidth: 50,
  8488. width: "100%",
  8489. },
  8490. ]
  8491. },
  8492. ]
  8493. }
  8494. ],
  8495. //窗口按钮
  8496. buttons: [
  8497. {
  8498. xtype: 'button', text: '保存', handler: function (btn) {
  8499. //窗口获取表单
  8500. var form = win_1.down('form');
  8501. var vaildSuccess = form.isValid();
  8502. if (!vaildSuccess) {
  8503. return;
  8504. }
  8505. var title = form.down('textfield[name="widgetname"]').getValue();
  8506. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8507. me_1.viewModel.set("form.title", title);
  8508. me_1.viewModel.set("widgetPath", widgetPath);
  8509. var formdata = _this.viewModel.get("form");
  8510. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8511. if (res.success) {
  8512. msg$1('添加成功');
  8513. }
  8514. me_1.loadForm(widgetPath);
  8515. win_1.close();
  8516. });
  8517. }
  8518. },
  8519. {
  8520. xtype: 'button', text: '取消', handler: function (btn) {
  8521. //窗口关闭
  8522. win_1.close();
  8523. }
  8524. }
  8525. ]
  8526. });
  8527. win_1.show();
  8528. }
  8529. };
  8530. WidgetDesign.prototype.widgetSave = function () {
  8531. var _this = this;
  8532. var _a, _b;
  8533. var widgetPath = this.viewModel.get("widgetPath");
  8534. if (!widgetPath) {
  8535. msg$1("请选择或添加弹框后再保存!");
  8536. return;
  8537. }
  8538. var title = this.viewModel.get("form.title");
  8539. if (!title) {
  8540. msg$1("请选择或添加弹框后再保存!");
  8541. return;
  8542. }
  8543. // 获取条件
  8544. 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) {
  8545. delete r.id;
  8546. return r;
  8547. });
  8548. this.viewModel.set("form.conditions", conditions);
  8549. // 获取查询列
  8550. 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) {
  8551. delete r.id;
  8552. if (r.dict) {
  8553. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8554. }
  8555. return r;
  8556. });
  8557. this.viewModel.set("form.columns", columns);
  8558. // sql
  8559. var sql = this.refs.sqlEditor.getCode();
  8560. this.viewModel.set("form.sql", sql);
  8561. var form = this.viewModel.get("form");
  8562. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8563. msg$1(res.msg);
  8564. if (res.success) {
  8565. msg$1('保存成功');
  8566. _this.loadForm(widgetPath);
  8567. }
  8568. }).catch(function (res) {
  8569. });
  8570. };
  8571. WidgetDesign.prototype.delCondition = function () {
  8572. var _a;
  8573. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8574. };
  8575. WidgetDesign.prototype.delColumn = function () {
  8576. var _a;
  8577. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8578. };
  8579. WidgetDesign.prototype.calcCondition = function () {
  8580. var _this = this;
  8581. var sql = this.refs.sqlEditor.getCode();
  8582. var re = sql.matchAll(/#{(.+?)}/gi);
  8583. var rows = this.refs.grid2.getDataRows();
  8584. this.refs.grid2.setLoading(true);
  8585. parseDynamicSqlApi(sql).then(function (res) {
  8586. var e_1, _a;
  8587. if (res.success) {
  8588. var tables_1 = [];
  8589. _.forEach(res.data, function (parseItem) {
  8590. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8591. if (tableName && !_.includes(tables_1, tableName)) {
  8592. tables_1.push(tableName);
  8593. }
  8594. });
  8595. var _loop_1 = function (m) {
  8596. var e_2, _a;
  8597. var columnName = m[1];
  8598. // 没有这个列才添加
  8599. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8600. var meta = undefined;
  8601. try {
  8602. 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()) {
  8603. var tableName = tables_2_1.value;
  8604. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8605. if (meta) {
  8606. break;
  8607. }
  8608. }
  8609. }
  8610. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8611. finally {
  8612. try {
  8613. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8614. }
  8615. finally { if (e_2) throw e_2.error; }
  8616. }
  8617. if (meta) {
  8618. // 没找到元数据,直接添加
  8619. _this.refs.grid2.appendEditRow({
  8620. conditionFieldBind: columnName,
  8621. conditionFieldLabel: meta.column_comment,
  8622. conditionFieldXtype: 'textfield',
  8623. conditionFieldFlex: 1,
  8624. conditionFieldDict: '',
  8625. conditionFieldWrap: false,
  8626. });
  8627. }
  8628. else {
  8629. _this.refs.grid2.appendEditRow({
  8630. conditionFieldBind: columnName,
  8631. conditionFieldLabel: '',
  8632. conditionFieldXtype: 'textfield',
  8633. conditionFieldFlex: 1,
  8634. conditionFieldDict: '',
  8635. conditionFieldWrap: false,
  8636. });
  8637. }
  8638. }
  8639. };
  8640. try {
  8641. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  8642. var m = re_1_1.value;
  8643. _loop_1(m);
  8644. }
  8645. }
  8646. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  8647. finally {
  8648. try {
  8649. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  8650. }
  8651. finally { if (e_1) throw e_1.error; }
  8652. }
  8653. }
  8654. }).finally(function () {
  8655. _this.refs.grid2.setLoading(false);
  8656. });
  8657. };
  8658. WidgetDesign.prototype.calcColumn = function () {
  8659. var _this = this;
  8660. var sql = this.refs.sqlEditor.getCode();
  8661. var rows = this.refs.grid3.getDataRows();
  8662. this.refs.grid3.setLoading(true);
  8663. parseDynamicSqlApi(sql).then(function (res) {
  8664. _.forEach(res.data, function (parseItem) {
  8665. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  8666. // 是否找到重复字段
  8667. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  8668. if (exists) {
  8669. return;
  8670. }
  8671. if (tableName) {
  8672. // 解出表格名和字段名
  8673. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8674. if (meta) {
  8675. // 找到了元数据
  8676. var r = {
  8677. dataIndex: meta.column_name,
  8678. header: meta.column_comment,
  8679. xtype: '',
  8680. dataType: 'string',
  8681. dict: '',
  8682. };
  8683. if (meta.column_ui === 'combo' && meta.column_dict) {
  8684. r.dict = meta.column_dict;
  8685. }
  8686. else if (meta.column_ui === "checkbox") {
  8687. r.xtype = 'checkbox';
  8688. }
  8689. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  8690. r.dataType = meta.data_type;
  8691. }
  8692. _this.refs.grid3.appendEditRow(r);
  8693. return;
  8694. }
  8695. }
  8696. if (columnName) {
  8697. // 解出字段名
  8698. var r = {
  8699. dataIndex: columnName,
  8700. header: columnName,
  8701. xtype: '',
  8702. dataType: 'string',
  8703. dict: '',
  8704. };
  8705. _this.refs.grid3.appendEditRow(r);
  8706. }
  8707. });
  8708. }).finally(function () {
  8709. _this.refs.grid3.setLoading(false);
  8710. });
  8711. };
  8712. return WidgetDesign;
  8713. }(Scope));
  8714. //# sourceMappingURL=WidgetDesign.js.map
  8715. var model$7 = {
  8716. data: {
  8717. // spreadsheet: false,
  8718. // multSelect: false,
  8719. // showCheckColumn: false,
  8720. // checkColumncheckOnly: false,
  8721. // disableSelection: false,
  8722. vjson: {
  8723. reference: '',
  8724. pagination: false,
  8725. pageSize: false,
  8726. pageSizeOption: false,
  8727. hideFootbar: false,
  8728. hideRefresh: false,
  8729. hideExport: false,
  8730. hideAutoSize: false,
  8731. hideClearFilter: false,
  8732. hideSaveGridUIConfig: false,
  8733. hideClearGridUIConfig: false,
  8734. selectMode: '',
  8735. cellediting_clicksToEdit: 1,
  8736. columnLines: false,
  8737. rowLines: false,
  8738. border: false,
  8739. autoLoad: false,
  8740. remoteSort: false,
  8741. remoteFilter: false,
  8742. enableLocking: false,
  8743. enableColumnHide: false,
  8744. enableColumnMove: false,
  8745. gridfilters: false,
  8746. enableColumnResize: false,
  8747. sortOnClick: false,
  8748. hidden: false,
  8749. cls: '',
  8750. dataSource: {
  8751. url: '',
  8752. params: {
  8753. formData: '{form}',
  8754. },
  8755. },
  8756. listeners: {
  8757. beforeselect: '',
  8758. selectionchange: '',
  8759. itemclick: '',
  8760. itemdblclick: '',
  8761. cellClick: '',
  8762. celldblclick: '',
  8763. afterrender: '',
  8764. destory: '',
  8765. }
  8766. },
  8767. }
  8768. };
  8769. //# sourceMappingURL=YvgridDesign.model.js.map
  8770. var vjson$7 = {
  8771. title: '表格-高级',
  8772. height: 450,
  8773. width: 970,
  8774. layout: 'fit',
  8775. modal: true,
  8776. items: [
  8777. {
  8778. xtype: 'tabpanel',
  8779. items: [
  8780. {
  8781. title: '属性',
  8782. xtype: 'form',
  8783. scrollable: true,
  8784. items: [
  8785. {
  8786. xtype: 'cols',
  8787. items: [
  8788. {
  8789. xtype: 'textfield',
  8790. fieldLabel: '引用名',
  8791. tooltip: 'reference',
  8792. bind: '{vjson.reference}',
  8793. },
  8794. ]
  8795. },
  8796. {
  8797. xtype: 'cols',
  8798. border: false,
  8799. items: [
  8800. // 允许分页、页大小、页大小选项
  8801. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  8802. // 多选、显示勾选、自动勾选、
  8803. // 单击编辑、列分割线、行分割线、边框
  8804. // 数据源自动加载、后端排序、后端过滤
  8805. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  8806. {
  8807. xtype: 'checkbox',
  8808. fieldLabel: '允许分页',
  8809. bind: {
  8810. value: "{vjson.pagination}"
  8811. }
  8812. },
  8813. {
  8814. xtype: 'numberfield',
  8815. fieldLabel: '页大小',
  8816. bind: '{vjson.pageSize}',
  8817. },
  8818. {
  8819. xtype: 'textfield',
  8820. fieldLabel: '页大小选项',
  8821. flex: 2,
  8822. bind: '{vjson.pageSizeOption}',
  8823. },
  8824. ]
  8825. },
  8826. {
  8827. layout: 'hbox',
  8828. border: false,
  8829. items: [
  8830. {
  8831. xtype: 'combo',
  8832. fieldLabel: '选择模式',
  8833. flex: 4,
  8834. data: [
  8835. { id: 'spreadsheet', text: 'Excel模式' },
  8836. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  8837. { id: 'checkColumn', text: '勾选框' },
  8838. { id: 'row_mulity', text: '行选择-允许多选' },
  8839. { id: 'row_single', text: '行选择-单选' },
  8840. { id: 'disableSelection', text: '禁用' },
  8841. ],
  8842. bind: {
  8843. value: '{vjson.selectMode}'
  8844. }
  8845. }
  8846. ]
  8847. },
  8848. {
  8849. layout: 'hbox',
  8850. border: false,
  8851. defaults: {
  8852. xtype: 'checkbox',
  8853. margin: '0 15 0 0',
  8854. },
  8855. items: [
  8856. {
  8857. xtype: 'container',
  8858. margin: '3',
  8859. border: false,
  8860. width: 80,
  8861. },
  8862. {
  8863. boxLabel: '隐藏底部',
  8864. bind: {
  8865. value: "{vjson.hideFootbar}"
  8866. }
  8867. },
  8868. {
  8869. boxLabel: '隐藏刷新',
  8870. bind: {
  8871. value: "{vjson.hideRefresh}"
  8872. }
  8873. },
  8874. {
  8875. boxLabel: '隐藏导出',
  8876. bind: {
  8877. value: "{vjson.hideExport}"
  8878. }
  8879. },
  8880. {
  8881. boxLabel: '隐藏自动调宽',
  8882. bind: {
  8883. value: "{vjson.hideAutoSize}"
  8884. }
  8885. },
  8886. {
  8887. boxLabel: '隐藏清空筛选',
  8888. bind: {
  8889. value: "{vjson.hideClearFilter}"
  8890. }
  8891. },
  8892. {
  8893. boxLabel: '隐藏保存布局',
  8894. bind: {
  8895. value: "{vjson.hideSaveGridUIConfig}"
  8896. }
  8897. },
  8898. {
  8899. boxLabel: '隐藏重置布局',
  8900. bind: {
  8901. value: "{vjson.hideClearGridUIConfig}"
  8902. }
  8903. },
  8904. ]
  8905. },
  8906. {
  8907. layout: 'hbox',
  8908. border: false,
  8909. defaults: {
  8910. xtype: 'checkbox',
  8911. margin: '0 15 0 0',
  8912. },
  8913. items: [
  8914. {
  8915. xtype: 'container',
  8916. margin: '3',
  8917. border: false,
  8918. width: 80
  8919. },
  8920. {
  8921. boxLabel: '单击编辑',
  8922. bind: {
  8923. value: "{vjson.cellediting_clicksToEdit}"
  8924. }
  8925. },
  8926. {
  8927. boxLabel: '列分隔线',
  8928. bind: {
  8929. value: "{vjson.columnLines}"
  8930. }
  8931. },
  8932. {
  8933. boxLabel: '行分隔线',
  8934. bind: {
  8935. value: "{vjson.rowLines}"
  8936. }
  8937. },
  8938. {
  8939. boxLabel: '边框',
  8940. bind: {
  8941. value: "{vjson.border}"
  8942. }
  8943. },
  8944. ]
  8945. },
  8946. {
  8947. layout: 'hbox',
  8948. border: false,
  8949. defaults: {
  8950. xtype: 'checkbox',
  8951. margin: '0 15 0 0',
  8952. },
  8953. items: [
  8954. {
  8955. xtype: 'container',
  8956. margin: '3',
  8957. border: false,
  8958. width: 80
  8959. },
  8960. {
  8961. boxLabel: '数据源自动加载',
  8962. bind: {
  8963. value: "{vjson.autoLoad}"
  8964. }
  8965. },
  8966. {
  8967. boxLabel: '后端排序',
  8968. bind: {
  8969. value: "{vjson.remoteSort}"
  8970. }
  8971. },
  8972. {
  8973. boxLabel: '后端过滤',
  8974. bind: {
  8975. value: "{vjson.remoteFilter}"
  8976. }
  8977. },
  8978. ]
  8979. },
  8980. {
  8981. layout: 'hbox',
  8982. border: false,
  8983. defaults: {
  8984. xtype: 'checkbox',
  8985. margin: '0 15 0 0',
  8986. },
  8987. items: [
  8988. {
  8989. xtype: 'container',
  8990. margin: '3',
  8991. border: false,
  8992. width: 80
  8993. },
  8994. {
  8995. boxLabel: '自定义锁定',
  8996. bind: {
  8997. value: "{vjson.enableLocking}"
  8998. }
  8999. },
  9000. {
  9001. boxLabel: '自定义隐藏',
  9002. bind: {
  9003. value: "{vjson.enableColumnHide}"
  9004. }
  9005. },
  9006. {
  9007. boxLabel: '用户拖拽字段',
  9008. bind: {
  9009. value: "{vjson.enableColumnMove}"
  9010. }
  9011. },
  9012. {
  9013. boxLabel: '自定义筛选',
  9014. bind: {
  9015. value: "{vjson.gridfilters}"
  9016. }
  9017. },
  9018. {
  9019. boxLabel: '用户拖拽字段宽度',
  9020. bind: {
  9021. value: "{vjson.enableColumnResize}"
  9022. }
  9023. },
  9024. {
  9025. boxLabel: '点击列头排序',
  9026. bind: {
  9027. value: "{vjson.sortOnClick}"
  9028. }
  9029. },
  9030. {
  9031. xtype: 'checkbox',
  9032. boxLabel: '隐藏',
  9033. bind: {
  9034. value: "{vjson.hidden}"
  9035. }
  9036. },
  9037. ]
  9038. },
  9039. {
  9040. xtype: 'cols',
  9041. items: [
  9042. {
  9043. xtype: 'textfield',
  9044. fieldLabel: '样式',
  9045. bind: '{vjson.cls}',
  9046. flex: 4
  9047. },
  9048. ]
  9049. },
  9050. ]
  9051. },
  9052. {
  9053. title: '字段',
  9054. xtype: 'yvgrid',
  9055. reference: 'grid1',
  9056. pagination: false,
  9057. hideFootbar: true,
  9058. plugins: {
  9059. clipboard: true,
  9060. selectionreplicator: true
  9061. },
  9062. selModel: {
  9063. type: 'spreadsheet',
  9064. columnSelect: true,
  9065. pruneRemoved: false,
  9066. extensible: 'y'
  9067. },
  9068. listeners: {
  9069. editfinish: 'scope.gridEditFinish',
  9070. },
  9071. tbar: {
  9072. xtype: 'toolbar',
  9073. items: [
  9074. {
  9075. xtype: 'button',
  9076. text: '添加',
  9077. iconCls: 'x-fa fa-plus-circle',
  9078. listeners: {
  9079. click: 'scope.addColumn'
  9080. }
  9081. },
  9082. {
  9083. xtype: 'button',
  9084. text: '删除',
  9085. iconCls: 'x-fa fa-minus-circle',
  9086. listeners: {
  9087. click: 'scope.removeColumn'
  9088. }
  9089. },
  9090. '-',
  9091. {
  9092. xtype: 'button',
  9093. text: '自动分析',
  9094. iconCls: 'x-fa fa-code-fork',
  9095. listeners: {
  9096. click: 'scope.calcColumn'
  9097. }
  9098. },
  9099. {
  9100. xtype: 'button',
  9101. text: '上移',
  9102. iconCls: 'x-fa fa-arrow-up',
  9103. listeners: {
  9104. click: 'scope.moveUp'
  9105. }
  9106. },
  9107. {
  9108. xtype: 'button',
  9109. text: '下移',
  9110. iconCls: 'x-fa fa-arrow-down',
  9111. listeners: {
  9112. click: 'scope.moveDown'
  9113. }
  9114. },
  9115. ]
  9116. },
  9117. columns: [
  9118. { xtype: 'rownumberer' },
  9119. {
  9120. text: '字段',
  9121. dataIndex: 'dataIndex',
  9122. width: 140,
  9123. sortable: false,
  9124. menuDisabled: true,
  9125. editor: {
  9126. selectOnFocus: true,
  9127. },
  9128. },
  9129. {
  9130. text: '标题',
  9131. dataIndex: 'header',
  9132. width: 120,
  9133. sortable: false,
  9134. menuDisabled: true,
  9135. editor: {
  9136. selectOnFocus: true,
  9137. },
  9138. },
  9139. {
  9140. text: '类型',
  9141. dataIndex: 'xtype',
  9142. width: 100,
  9143. sortable: false,
  9144. menuDisabled: true,
  9145. editor: {
  9146. xtype: 'combo',
  9147. typeAhead: true,
  9148. triggerAction: 'all',
  9149. selectOnFocus: false,
  9150. listConfig: {
  9151. minWidth: 200
  9152. },
  9153. store: [
  9154. ['', '默认'],
  9155. ['rownum', 'rownum'],
  9156. ['checkcolumn', 'checkcolumn'],
  9157. ]
  9158. },
  9159. },
  9160. {
  9161. text: '数据类型',
  9162. dataIndex: 'dataType',
  9163. width: 100,
  9164. sortable: false,
  9165. menuDisabled: true,
  9166. editor: {
  9167. xtype: 'combo',
  9168. selectOnFocus: true,
  9169. listConfig: {
  9170. minWidth: 200
  9171. },
  9172. store: [
  9173. ['', '默认'],
  9174. ['string', 'string'],
  9175. ['number', 'number'],
  9176. ['date', 'date'],
  9177. ]
  9178. },
  9179. },
  9180. {
  9181. text: '编辑模式',
  9182. dataIndex: 'editor',
  9183. width: 100,
  9184. sortable: false,
  9185. menuDisabled: true,
  9186. editor: {
  9187. xtype: 'combo',
  9188. selectOnFocus: true,
  9189. listConfig: {
  9190. minWidth: 200
  9191. },
  9192. store: [
  9193. ['', ''],
  9194. ['textfield', 'textfield'],
  9195. ['numberfield', 'numberfield'],
  9196. ['combo', 'combo'],
  9197. ['combogrid', 'combogrid'],
  9198. ['datefield', 'datefield'],
  9199. ]
  9200. },
  9201. },
  9202. {
  9203. text: '宽度',
  9204. dataIndex: 'width',
  9205. align: 'right',
  9206. width: 100,
  9207. sortable: false,
  9208. menuDisabled: true,
  9209. editor: {
  9210. xtype: 'numberfield',
  9211. selectOnFocus: true,
  9212. minValue: 0,
  9213. maxValue: 1000
  9214. },
  9215. },
  9216. {
  9217. text: '权重',
  9218. dataIndex: 'flex',
  9219. align: 'right',
  9220. width: 90,
  9221. sortable: false,
  9222. menuDisabled: true,
  9223. editor: {
  9224. xtype: 'numberfield',
  9225. selectOnFocus: true,
  9226. minValue: 0,
  9227. maxValue: 10
  9228. },
  9229. },
  9230. {
  9231. text: '字典',
  9232. dataIndex: 'dict',
  9233. sortable: false,
  9234. menuDisabled: true,
  9235. width: 210,
  9236. editor: {
  9237. selectOnFocus: true,
  9238. },
  9239. },
  9240. {
  9241. text: '对齐',
  9242. dataIndex: 'align',
  9243. width: 90,
  9244. sortable: false,
  9245. menuDisabled: true,
  9246. editor: {
  9247. xtype: 'combo',
  9248. selectOnFocus: true,
  9249. listConfig: {
  9250. minWidth: 120
  9251. },
  9252. store: [
  9253. ['start', 'start'],
  9254. ['center', 'center'],
  9255. ['end', 'end'],
  9256. ]
  9257. },
  9258. },
  9259. {
  9260. text: '必填',
  9261. dataIndex: 'notAllowBlank',
  9262. width: 50,
  9263. resizable: false,
  9264. sortable: false,
  9265. menuDisabled: true,
  9266. xtype: 'checkcolumn',
  9267. },
  9268. {
  9269. text: '禁用',
  9270. dataIndex: 'disabled',
  9271. width: 50,
  9272. resizable: false,
  9273. sortable: false,
  9274. menuDisabled: true,
  9275. xtype: 'checkcolumn',
  9276. },
  9277. {
  9278. text: '禁菜',
  9279. dataIndex: 'menuDisabled',
  9280. width: 50,
  9281. resizable: false,
  9282. sortable: false,
  9283. menuDisabled: true,
  9284. xtype: 'checkcolumn',
  9285. },
  9286. {
  9287. text: '过滤',
  9288. dataIndex: 'filterable',
  9289. xtype: 'checkcolumn',
  9290. width: 50,
  9291. resizable: false,
  9292. sortable: false,
  9293. menuDisabled: true,
  9294. },
  9295. {
  9296. text: '隐藏',
  9297. dataIndex: 'hidden',
  9298. xtype: 'checkcolumn',
  9299. width: 50,
  9300. resizable: false,
  9301. sortable: false,
  9302. menuDisabled: true,
  9303. },
  9304. {
  9305. text: '可隐',
  9306. dataIndex: 'hideable',
  9307. xtype: 'checkcolumn',
  9308. width: 50,
  9309. resizable: false,
  9310. sortable: false,
  9311. menuDisabled: true,
  9312. },
  9313. {
  9314. text: '调宽',
  9315. dataIndex: 'resizable',
  9316. xtype: 'checkcolumn',
  9317. width: 50,
  9318. resizable: false,
  9319. sortable: false,
  9320. menuDisabled: true,
  9321. },
  9322. {
  9323. text: '排序',
  9324. dataIndex: 'sortable',
  9325. xtype: 'checkcolumn',
  9326. width: 50,
  9327. resizable: false,
  9328. sortable: false,
  9329. menuDisabled: true,
  9330. },
  9331. {
  9332. text: '适宽',
  9333. dataIndex: 'autoSize',
  9334. xtype: 'checkcolumn',
  9335. width: 50,
  9336. resizable: false,
  9337. sortable: false,
  9338. menuDisabled: true,
  9339. },
  9340. ],
  9341. },
  9342. {
  9343. title: '数据源',
  9344. layout: 'border',
  9345. listeners: {
  9346. activate: 'scope.dataSourceActivate'
  9347. },
  9348. items: [
  9349. {
  9350. region: 'north',
  9351. xtype: 'toolbar',
  9352. border: false,
  9353. items: [
  9354. {
  9355. xtype: 'textfield',
  9356. fieldLabel: '数据源',
  9357. flex: 1,
  9358. bind: {
  9359. value: '{vjson.dataSource.url}'
  9360. }
  9361. },
  9362. {
  9363. xtype: 'button',
  9364. text: '保存',
  9365. iconCls: 'x-fa fa-save',
  9366. listeners: {
  9367. click: 'scope.dataSourceSave'
  9368. }
  9369. },
  9370. {
  9371. xtype: 'button',
  9372. text: '读取',
  9373. iconCls: 'x-fa fa-folder-open',
  9374. listeners: {
  9375. click: 'scope.reloadSqlContent'
  9376. }
  9377. },
  9378. ]
  9379. },
  9380. {
  9381. region: 'center',
  9382. xtype: 'sqleditor',
  9383. layout: 'fit',
  9384. reference: 'sqlEditor',
  9385. },
  9386. {
  9387. region: 'south',
  9388. xtype: 'jsoneditor',
  9389. height: 200,
  9390. split: true,
  9391. collapsible: true,
  9392. title: '参数',
  9393. reference: 'sqlParams',
  9394. }
  9395. ]
  9396. },
  9397. {
  9398. title: '事件',
  9399. xtype: 'form',
  9400. scrollable: true,
  9401. margin: '10',
  9402. defaults: {
  9403. width: '100%',
  9404. labelAlign: 'top',
  9405. },
  9406. items: [
  9407. {
  9408. xtype: 'textfield',
  9409. fieldLabel: '选中前触发 beforeSelect',
  9410. bind: {
  9411. value: '{vjson.listeners.beforeselect}'
  9412. },
  9413. },
  9414. {
  9415. xtype: 'textfield',
  9416. fieldLabel: '选择范围改变 selectionChange',
  9417. bind: {
  9418. value: '{vjson.listeners.selectionchange}'
  9419. },
  9420. },
  9421. {
  9422. xtype: 'textfield',
  9423. fieldLabel: '行点击 itemClick',
  9424. bind: {
  9425. value: '{vjson.listeners.itemclick}'
  9426. },
  9427. },
  9428. {
  9429. xtype: 'textfield',
  9430. fieldLabel: '行双击 itemDblClick',
  9431. bind: {
  9432. value: '{vjson.listeners.itemdblclick}'
  9433. },
  9434. },
  9435. {
  9436. xtype: 'textfield',
  9437. fieldLabel: '单元格点击 cellClick',
  9438. bind: {
  9439. value: '{vjson.listeners.cellClick}'
  9440. },
  9441. },
  9442. {
  9443. xtype: 'textfield',
  9444. fieldLabel: '单元格双击 cellDblClick',
  9445. bind: {
  9446. value: '{vjson.listeners.celldblclick}'
  9447. },
  9448. },
  9449. {
  9450. xtype: 'textfield',
  9451. fieldLabel: '渲染后触发 afterrender',
  9452. bind: {
  9453. value: '{vjson.listeners.afterrender}'
  9454. },
  9455. },
  9456. {
  9457. xtype: 'textfield',
  9458. fieldLabel: '销毁后触发 destory',
  9459. bind: {
  9460. value: '{vjson.listeners.destory}'
  9461. },
  9462. },
  9463. ]
  9464. },
  9465. ],
  9466. }
  9467. ],
  9468. fbar: [
  9469. {
  9470. text: '应用', iconCls: 'x-fa fa-save',
  9471. listeners: {
  9472. click: 'scope.save'
  9473. }
  9474. },
  9475. '-',
  9476. {
  9477. text: '确定', iconCls: 'x-fa fa-check-circle',
  9478. listeners: {
  9479. click: 'scope.saveClose'
  9480. }
  9481. },
  9482. {
  9483. text: '取消', iconCls: 'x-fa fa-times-circle',
  9484. listeners: {
  9485. click: 'system.closeMe()'
  9486. }
  9487. },
  9488. ]
  9489. };
  9490. //# sourceMappingURL=YvgridDesign.view.js.map
  9491. var idPrefix = "_ds_";
  9492. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  9493. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  9494. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  9495. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  9496. var layoutOrXtypeNameMap = {
  9497. fit: 'fit布局',
  9498. border: 'border布局',
  9499. center: '中部',
  9500. north: '上部',
  9501. south: '下部',
  9502. west: '左部',
  9503. east: '右部',
  9504. yvgrid: '表格',
  9505. tree: '树',
  9506. tabpanel: '标签页',
  9507. form: '表单',
  9508. fieldset: '字段组',
  9509. tbar: '顶部工具栏',
  9510. fbar: '底部工具栏',
  9511. toolbar: '工具栏',
  9512. cols: '列容器',
  9513. rows: '行容器',
  9514. textfield: '文本框',
  9515. textareafield: '长文本框',
  9516. numberfield: '数字框',
  9517. label: "文本",
  9518. combo: "下拉框",
  9519. combobox: "下拉框",
  9520. combotree: "下拉树",
  9521. combogrid: "下拉表",
  9522. datefield: "日期框",
  9523. searchfield: "搜索框",
  9524. button: "按钮",
  9525. checkbox: "勾选",
  9526. checkboxgroup: "勾选组",
  9527. radio: "点选",
  9528. radiogroup: "点选组",
  9529. container: "占位"
  9530. };
  9531. /**
  9532. * 从 VJSON 中找到 rows/cols 的数组
  9533. */
  9534. function findArrayContainer(vjson, id) {
  9535. var parentVJson = getSuperVjson(vjson, id);
  9536. if (_$2.isArray(parentVJson)) {
  9537. return parentVJson;
  9538. }
  9539. if (parentVJson.hasOwnProperty('items')) {
  9540. return parentVJson.items;
  9541. }
  9542. }
  9543. /**
  9544. * 根据id查找上级vjson
  9545. * @param vjson 原始 vjson 视图
  9546. * @param targetId 子元素的id
  9547. */
  9548. function getSuperVjson(vjson, targetId) {
  9549. return deepTravFindSuper(vjson, vjson, targetId);
  9550. }
  9551. /**
  9552. * 根据id查找上级vjson id
  9553. * @param vjson 原始 vjson 视图
  9554. * @param targetId 子元素的id
  9555. */
  9556. function getSuperVjsonId(vjson, targetId) {
  9557. var vj = getSuperVjson(vjson, targetId);
  9558. return vj.id;
  9559. }
  9560. function deepTravFindSuper(superVjson, vjson, targetId) {
  9561. var rObj = null;
  9562. _$2.forOwn(vjson, function (value, key) {
  9563. if (rObj) {
  9564. return;
  9565. }
  9566. if (typeof value !== "object") {
  9567. return;
  9568. }
  9569. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  9570. if (key !== 'items') {
  9571. return;
  9572. }
  9573. }
  9574. else {
  9575. // 模型、数据、数据源不扫描
  9576. if (key === 'data' ||
  9577. key === 'dataSource' ||
  9578. key === 'suggest' ||
  9579. key === 'options' ||
  9580. key === 'config' ||
  9581. key === 'columns' ||
  9582. key === 'viewModel' ||
  9583. key === 'store') {
  9584. return;
  9585. }
  9586. }
  9587. //事件不扫描
  9588. if (key === "on" && _$2.isObject(value)) {
  9589. return;
  9590. }
  9591. if (key.startsWith("on") && _$2.size(key) > 2) {
  9592. return;
  9593. }
  9594. if (value.id === targetId) {
  9595. if (_$2.isArray(vjson)) {
  9596. rObj = superVjson;
  9597. }
  9598. else {
  9599. rObj = vjson;
  9600. }
  9601. return;
  9602. }
  9603. rObj = deepTravFindSuper(vjson, value, targetId);
  9604. });
  9605. return rObj;
  9606. }
  9607. /**
  9608. * 深度遍历 vjson
  9609. * @param vjson 视图JSON
  9610. * @param resolver 分析函数
  9611. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  9612. */
  9613. function deepTravVJson(vjson, resolver, propDeep) {
  9614. if (propDeep === void 0) { propDeep = false; }
  9615. var markerList = [];
  9616. deepTrav1(vjson, resolver, markerList, propDeep);
  9617. return markerList;
  9618. }
  9619. function deepTrav1(obj, resolver, marker, propDeep) {
  9620. if (propDeep === void 0) { propDeep = false; }
  9621. var isMarker = resolver(obj);
  9622. if (marker && isMarker === true) {
  9623. marker.unshift({ id: 0, keyName: '', object: obj });
  9624. }
  9625. _$2.forOwn(obj, function (value, key) {
  9626. if (typeof value !== 'object') {
  9627. return;
  9628. }
  9629. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  9630. if (key !== 'items' && key !== 'children') {
  9631. return;
  9632. }
  9633. }
  9634. else {
  9635. // 模型、数据、数据源不扫描
  9636. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  9637. return;
  9638. }
  9639. if (!propDeep &&
  9640. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  9641. key === 'listeners' || key === 'bind')) {
  9642. return;
  9643. }
  9644. }
  9645. //事件不扫描
  9646. if (key === 'on' && _$2.isObject(value)) {
  9647. return;
  9648. }
  9649. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  9650. return;
  9651. }
  9652. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  9653. if (marker && isMarkerChild === true) {
  9654. isMarker = true;
  9655. marker.unshift({ id: obj.id, keyName: key, object: value });
  9656. }
  9657. });
  9658. // @ts-ignore 删除作废对象
  9659. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  9660. return isMarker;
  9661. }
  9662. /**
  9663. * 在代码中找到 reference 对应的对象
  9664. */
  9665. function findInCode(code, id) {
  9666. try {
  9667. deepTravVJson(code, function (child) {
  9668. if (child.id === id) {
  9669. throw child;
  9670. }
  9671. });
  9672. return undefined;
  9673. }
  9674. catch (err) {
  9675. return err;
  9676. }
  9677. }
  9678. function replaceVjsonById(vjson, itemVjson, itemId) {
  9679. if (!itemVjson || (!itemVjson.id && !itemId)) {
  9680. msgError('无法定位组件!');
  9681. debugger;
  9682. return;
  9683. }
  9684. var id = itemId || itemVjson.id;
  9685. deepTravVJson(vjson, function (obj) {
  9686. if (obj.id == id) {
  9687. _$2.assign(obj, itemVjson, { id: id });
  9688. }
  9689. });
  9690. }
  9691. function deepTravDeleteVjson(obj, targetId) {
  9692. var isDelete = false;
  9693. _$2.forOwn(obj, function (value, key) {
  9694. if (isDelete) {
  9695. return;
  9696. }
  9697. if (typeof value !== 'object') {
  9698. return;
  9699. }
  9700. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  9701. if (key !== 'items') {
  9702. return;
  9703. }
  9704. }
  9705. else {
  9706. // 模型、数据、数据源不扫描
  9707. if (key === 'data' ||
  9708. key === 'dataSource' ||
  9709. key === 'suggest' ||
  9710. key === 'options' ||
  9711. key === 'config' ||
  9712. key === 'columns' ||
  9713. key === 'viewModel' ||
  9714. key === 'store') {
  9715. return;
  9716. }
  9717. }
  9718. //事件不扫描
  9719. if (key === 'on' && _$2.isObject(value)) {
  9720. return;
  9721. }
  9722. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  9723. return;
  9724. }
  9725. if (value.id === targetId) {
  9726. isDelete = true;
  9727. /** 如果是数组的元素*/
  9728. if (_$2.isArray(obj)) {
  9729. obj.splice(key, 1);
  9730. }
  9731. else {
  9732. delete obj[key];
  9733. }
  9734. return;
  9735. }
  9736. isDelete = deepTravDeleteVjson(value, targetId);
  9737. });
  9738. return isDelete;
  9739. }
  9740. /**
  9741. * 根据id删除Vjson 会删除因删除元素造成的空对象
  9742. * @param obj 原始 vjson 视图
  9743. * @param targetId 子元素的id
  9744. */
  9745. function deletVjsonById(vjson, targetId) {
  9746. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  9747. // if (_.isArray(obj)) {
  9748. // if (obj.length <= 0) {
  9749. // let T: any = {
  9750. // view: "template",
  9751. // template: "拖动任何组件到此处",
  9752. // role: "placeholder",
  9753. // id: webix.uid()
  9754. // }
  9755. // obj.push(T);
  9756. // }
  9757. // }
  9758. return isDeleted;
  9759. }
  9760. function removeDesignProp(vjson) {
  9761. deepTravVJson(vjson, function (obj) {
  9762. if (obj.hasOwnProperty('id')) {
  9763. delete obj.id;
  9764. }
  9765. if (obj.hasOwnProperty("designMode")) {
  9766. delete obj.designMode;
  9767. }
  9768. });
  9769. if (vjson.hasOwnProperty("cls")) {
  9770. delete vjson.cls;
  9771. }
  9772. if (vjson.hasOwnProperty("viewModel")) {
  9773. delete vjson.viewModel;
  9774. }
  9775. if (vjson.hasOwnProperty("store")) {
  9776. delete vjson.store;
  9777. }
  9778. }
  9779. function getLayoutOutline(vjson) {
  9780. deepTravVJson(vjson, function (obj) {
  9781. if (!Array.isArray(obj)) {
  9782. _$2.forOwn(obj, function (value, key) {
  9783. if (key === 'id' || key === 'region' || key === 'layoutName'
  9784. || key === 'text' || key === 'fieldLabel' || key === 'title'
  9785. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  9786. if (key === 'region'
  9787. || (key === 'xtype' && !_$2.has(obj, 'region'))
  9788. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  9789. if (!_$2.has(obj, 'layoutName')) {
  9790. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  9791. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  9792. // console.log(obj.layoutName, obj.layoutNameDesc)
  9793. }
  9794. }
  9795. }
  9796. else {
  9797. if (key === 'items') {
  9798. obj.children = obj[key];
  9799. }
  9800. if (key === 'tbar') {
  9801. var t = obj[key];
  9802. t.layoutName = key;
  9803. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  9804. // console.log(t.layoutName, t.layoutNameDesc)
  9805. if (_$2.has(obj, "items")) {
  9806. obj.items.splice(0, 0, t);
  9807. }
  9808. else if (_$2.has(obj, "children")) {
  9809. obj.children.splice(0, 0, t);
  9810. }
  9811. else {
  9812. obj.children = [t];
  9813. }
  9814. }
  9815. if (key === 'fbar') {
  9816. var t = obj[key];
  9817. t.layoutName = key;
  9818. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  9819. // console.log(t.layoutName, t.layoutNameDesc)
  9820. if (_$2.has(obj, "items")) {
  9821. obj.items.push(t);
  9822. }
  9823. else if (_$2.has(obj, "children")) {
  9824. obj.children.push(t);
  9825. }
  9826. else {
  9827. obj.children = [t];
  9828. }
  9829. }
  9830. delete obj[key];
  9831. }
  9832. });
  9833. if (!obj.hasOwnProperty("children")) {
  9834. obj.leaf = true;
  9835. }
  9836. if (!obj.hasOwnProperty("expanded")) {
  9837. obj.expanded = true;
  9838. }
  9839. }
  9840. });
  9841. return vjson;
  9842. }
  9843. //# sourceMappingURL=ViewHelper.js.map
  9844. var checkFlags = {};
  9845. // ------------------------------------------------------------------------------------------ impls
  9846. function jsViewToVJson(modulePage, jsView) {
  9847. if (!jsView)
  9848. return {};
  9849. jsView = jsView.replace(/^\s*export\s+default/, "");
  9850. jsView = _$2.trim(jsView) || "{}";
  9851. try {
  9852. var json = dist.parse(jsView);
  9853. return modulePage.addViewId(json);
  9854. }
  9855. catch (e) {
  9856. //@ts-ignore
  9857. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9858. }
  9859. }
  9860. function stringToJsonObj(jsonStr) {
  9861. if (!jsonStr)
  9862. return {};
  9863. try {
  9864. return dist.parse(jsonStr);
  9865. }
  9866. catch (e) {
  9867. return {};
  9868. }
  9869. }
  9870. /**
  9871. * 获取view.js 文件 string
  9872. */
  9873. function vjsonTojsView(vjson) {
  9874. var reVjson = _$2.cloneDeep(vjson);
  9875. removeDesignProp(reVjson);
  9876. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9877. }
  9878. var ModuleStore = /** @class */ (function (_super) {
  9879. __extends(ModuleStore, _super);
  9880. function ModuleStore() {
  9881. var _this = _super.call(this) || this;
  9882. _this.store = {};
  9883. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9884. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9885. _this.addModule(id, module, modulePage);
  9886. });
  9887. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9888. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9889. _this.onMainTabChange(moduleId, oldModuleId, from);
  9890. });
  9891. return _this;
  9892. }
  9893. ModuleStore.prototype.getCacheKey = function (param) {
  9894. return "filetree_data.json";
  9895. };
  9896. ModuleStore.prototype.invokeApi = function (param) {
  9897. return moduleTree();
  9898. };
  9899. ModuleStore.prototype.reloadModule = function (id) {
  9900. var moduleObject = this.store[id];
  9901. if (!moduleObject)
  9902. return;
  9903. var module = moduleObject.module;
  9904. getModuleFileContent(module).then(function (_a) {
  9905. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9906. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9907. moduleObject.lastModifyTime = lastModifyTime;
  9908. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9909. // 触发事件 ModuleItemChange
  9910. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9911. moduleObject.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: "reloadModule" });
  9912. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9913. });
  9914. };
  9915. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9916. var _this = this;
  9917. getModuleFileContent(module).then(function (_a) {
  9918. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9919. var moduleObject = {
  9920. id: id, module: module,
  9921. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9922. lastModifyTime: lastModifyTime,
  9923. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9924. modulePage: modulePage,
  9925. moduleEventBus: modulePage.moduleEventBus
  9926. };
  9927. _this.store[id] = moduleObject;
  9928. // 触发事件 ModuleItemChange
  9929. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9930. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9931. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9932. });
  9933. };
  9934. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9935. if (this.store[moduleId]) {
  9936. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9937. }
  9938. };
  9939. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9940. var moduleObject = this.store[id];
  9941. moduleObject.fileContent.jsController = codeValue;
  9942. };
  9943. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9944. var moduleObject = this.store[id];
  9945. moduleObject.fileContent.jsView = codeValue;
  9946. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9947. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: from });
  9948. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9949. };
  9950. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9951. var moduleObject = this.store[id];
  9952. moduleObject.fileContent.jsModel = codeValue;
  9953. };
  9954. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9955. var moduleObject = this.store[id];
  9956. moduleObject.fileContent.groovy = codeValue;
  9957. };
  9958. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  9959. var moduleObject = this.store[id];
  9960. moduleObject.fileContent.mybatis = codeValue;
  9961. };
  9962. ModuleStore.prototype.getModuleObject = function (id) {
  9963. return this.store[id];
  9964. };
  9965. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  9966. if (checkFlags[moduleId] === 1) {
  9967. // @ts-ignore
  9968. system.msg("正在检测文件是否有外部修改,请稍后操作");
  9969. }
  9970. eventBus.publish(EventType.StopCheckModule, {});
  9971. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  9972. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  9973. saveFile(fileFullPath, fileContent).then(function (res) {
  9974. if (res.data && res.data.lastModified) {
  9975. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  9976. }
  9977. }).finally(function () {
  9978. eventBus.publish(EventType.RunCheckModule, {});
  9979. });
  9980. };
  9981. ModuleStore.prototype.check = function (moduleId) {
  9982. {
  9983. return;
  9984. }
  9985. };
  9986. return ModuleStore;
  9987. }(CacheStore));
  9988. // ------------------------------------------------------------------------------------------ use
  9989. var moduleStore = new ModuleStore();
  9990. //# sourceMappingURL=ModuleStore.js.map
  9991. var VjsonExchange = /** @class */ (function () {
  9992. function VjsonExchange(vjson) {
  9993. this.pendingSet = true;
  9994. this.vjsonOrigin = _$2.cloneDeep(vjson);
  9995. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  9996. }
  9997. /**
  9998. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  9999. * @param propName
  10000. * @param value
  10001. */
  10002. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10003. if (this.pendingSet) {
  10004. return;
  10005. }
  10006. // selectMode
  10007. // pageSizeOption
  10008. // cellediting_clicksToEdit
  10009. msg$1('' + propName + '=' + value);
  10010. _$2.set(this.vjson, propName, value);
  10011. };
  10012. /**
  10013. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10014. */
  10015. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10016. var _a, _b, _c;
  10017. if (this.pendingSet) {
  10018. return;
  10019. }
  10020. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10021. // 如果不使用默认属性,就直接设定 undefined
  10022. var vs = {
  10023. dataIndex: undefined,
  10024. header: undefined,
  10025. xtype: '',
  10026. width: undefined,
  10027. flex: undefined,
  10028. align: 'start',
  10029. editor: undefined,
  10030. dataType: 'string',
  10031. dict: undefined,
  10032. disabled: false,
  10033. menuDisabled: false,
  10034. notAllowBlank: false,
  10035. filterable: true,
  10036. hidden: false,
  10037. hideable: true,
  10038. resizable: true,
  10039. sortable: true,
  10040. autoSize: true,
  10041. };
  10042. var raw = record.get('raw');
  10043. if (raw === undefined || raw == null) {
  10044. raw = {};
  10045. record.set('raw', raw);
  10046. }
  10047. var setRaw = function (propName, value) {
  10048. if (typeof value === 'undefined' || value == null) {
  10049. msg$1("delete columns[" + rowIdx + "]." + propName);
  10050. delete raw[propName];
  10051. return;
  10052. }
  10053. var defaultValue = vs[propName];
  10054. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10055. // 要设的值,与默认值相同,就直接删除这个属性
  10056. msg$1("delete columns[" + rowIdx + "]." + propName);
  10057. delete raw[propName];
  10058. return;
  10059. }
  10060. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10061. _$2.set(raw, propName, value);
  10062. };
  10063. if (!vs.hasOwnProperty(propName)) {
  10064. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10065. return;
  10066. }
  10067. else if (propName === 'dict') {
  10068. if (value) {
  10069. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10070. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10071. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10072. }
  10073. }
  10074. else {
  10075. setRaw('fix', undefined);
  10076. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10077. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10078. delete raw.editor.fix;
  10079. }
  10080. }
  10081. }
  10082. else if (propName === 'xtype') {
  10083. if (!value) {
  10084. setRaw('xtype', undefined);
  10085. }
  10086. else {
  10087. setRaw('xtype', value);
  10088. }
  10089. }
  10090. else if (propName === 'notAllowBlank') {
  10091. setRaw('editor.allowBlank', !value);
  10092. }
  10093. else if (propName === 'editor') {
  10094. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10095. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10096. value = undefined;
  10097. }
  10098. // editor.xtype
  10099. if (!value) {
  10100. // 不需要编辑器
  10101. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10102. msg$1("delete columns[" + rowIdx + "].editor");
  10103. delete raw.editor;
  10104. record.set('notAllowBlank', false);
  10105. }
  10106. }
  10107. else {
  10108. setRaw('editor.xtype', value);
  10109. var dict = record.get('dict');
  10110. if (value === 'combo' && dict) {
  10111. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10112. }
  10113. }
  10114. }
  10115. else if (propName === 'width') {
  10116. var width = value;
  10117. var flex = record.get('flex');
  10118. if (!width && !flex) {
  10119. setRaw('width', undefined);
  10120. setRaw('flex', undefined);
  10121. record.set('flex', undefined);
  10122. record.set('width', undefined);
  10123. return;
  10124. }
  10125. else if (!!width) {
  10126. setRaw('flex', undefined);
  10127. record.set('flex', undefined);
  10128. setRaw('width', width);
  10129. return;
  10130. }
  10131. }
  10132. else if (propName === 'flex') {
  10133. var width = record.get('width');
  10134. var flex = value;
  10135. if (!width && !flex) {
  10136. setRaw('width', undefined);
  10137. setRaw('flex', undefined);
  10138. record.set('flex', undefined);
  10139. record.set('width', undefined);
  10140. return;
  10141. }
  10142. else if (!!flex) {
  10143. setRaw('width', undefined);
  10144. record.set('width', undefined);
  10145. setRaw('flex', flex);
  10146. return;
  10147. }
  10148. }
  10149. else {
  10150. // 其他属性,作为同名属性,与 raw 同步
  10151. setRaw(propName, value);
  10152. }
  10153. };
  10154. /**
  10155. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10156. */
  10157. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10158. var _this = this;
  10159. var vs = [
  10160. 'reference', 'pagination', 'pageSize',
  10161. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10162. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10163. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10164. 'listeners.beforeselect',
  10165. 'listeners.selectionchange',
  10166. 'listeners.itemclick',
  10167. 'listeners.itemdblclick',
  10168. 'listeners.cellClick',
  10169. 'listeners.celldblclick',
  10170. 'listeners.afterrender',
  10171. 'listeners.destory',
  10172. ];
  10173. _$2.forEach(vs, function (v) {
  10174. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10175. });
  10176. };
  10177. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10178. var me = this;
  10179. return function (value) {
  10180. me.setPropValue(propName, value);
  10181. };
  10182. };
  10183. VjsonExchange.prototype.parseModel = function () {
  10184. var _this = this;
  10185. 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;
  10186. //@ts-ignore
  10187. var df = YvanUI.Defaults.grid;
  10188. var vjson = _$2.assign({}, df, this.vjson);
  10189. var model = {
  10190. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10191. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10192. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10193. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10194. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10195. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10196. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10197. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10198. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10199. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10200. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10201. selectMode: 'spreadsheet',
  10202. cellediting_clicksToEdit: true,
  10203. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10204. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10205. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10206. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10207. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10208. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10209. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10210. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10211. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10212. gridfilters: true,
  10213. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10214. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10215. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10216. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10217. columns: [],
  10218. listeners: {
  10219. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10220. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10221. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10222. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10223. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10224. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10225. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10226. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10227. }
  10228. };
  10229. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10230. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10231. }
  10232. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10233. if (_$2.get(vjson, 'disableSelection') == true) {
  10234. model.selectMode = 'disableSelection';
  10235. }
  10236. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10237. model.selectMode = 'spreadsheet';
  10238. }
  10239. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10240. model.selectMode = 'onlyCheckColumn';
  10241. }
  10242. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10243. model.selectMode = 'checkColumn';
  10244. }
  10245. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10246. model.selectMode = 'row_mulity';
  10247. }
  10248. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10249. model.selectMode = 'row_single';
  10250. }
  10251. else {
  10252. model.selectMode = 'row_single';
  10253. }
  10254. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10255. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10256. model.dataSource = {
  10257. url: _$2.get(vjson, 'dataSource.url'),
  10258. //@ts-ignore
  10259. params: _$2.get(vjson, 'dataSource.params')
  10260. };
  10261. }
  10262. _$2.forEach(vjson.columns, function (column) {
  10263. model.columns.push(_this.parseColumn(column));
  10264. });
  10265. return model;
  10266. };
  10267. VjsonExchange.prototype.parseColumn = function (column) {
  10268. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10269. var model = {
  10270. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10271. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10272. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10273. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10274. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10275. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10276. editor: '',
  10277. editParam: '',
  10278. dict: '',
  10279. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10280. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10281. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10282. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10283. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10284. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10285. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10286. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10287. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10288. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10289. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10290. raw: _$2.cloneDeep(column),
  10291. };
  10292. // width / flex 只能留一个属性, 或者全不留
  10293. if (model.width <= 0 && model.flex <= 0) {
  10294. delete model.width;
  10295. delete model.flex;
  10296. }
  10297. else if (model.width > 0) {
  10298. delete model.flex;
  10299. }
  10300. else {
  10301. delete model.width;
  10302. }
  10303. // editor
  10304. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10305. model.editor = _$2.get(column, 'editor.xtype');
  10306. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10307. if (!model.editor) {
  10308. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10309. model.editor = 'textfield';
  10310. }
  10311. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10312. msg$1('不可识别的 editor.xtype=' + model.editor);
  10313. console.error('不可识别的 editor.xtype', column);
  10314. }
  10315. if (_$2.get(column, 'editor.allowBlank') === false) {
  10316. model.notAllowBlank = true;
  10317. }
  10318. }
  10319. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10320. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10321. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10322. if (match && match[1]) {
  10323. model.dict = match[1];
  10324. }
  10325. }
  10326. return model;
  10327. };
  10328. return VjsonExchange;
  10329. }());
  10330. //
  10331. //# sourceMappingURL=YvgridExchange.js.map
  10332. var YvgridDesign = /** @class */ (function (_super) {
  10333. __extends(YvgridDesign, _super);
  10334. function YvgridDesign(moduleId) {
  10335. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10336. _this.moduleId = '';
  10337. _this.name = 'YvgridDesign';
  10338. _this.dataSourceIsActived = false;
  10339. _this.setModuleId(moduleId);
  10340. return _this;
  10341. }
  10342. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10343. var _this = this;
  10344. this.moduleId = moduleId;
  10345. if (this.componentSelectionChangeSubscribe) {
  10346. this.componentSelectionChangeSubscribe.cancel();
  10347. this.componentSelectionChangeSubscribe = null;
  10348. }
  10349. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10350. var id = _a.id, from = _a.from;
  10351. _this.onComponentSelectionChange(id, from);
  10352. });
  10353. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10354. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10355. if (vj.xtype !== 'yvgrid') {
  10356. throw Error('非 yvgrid 组件');
  10357. }
  10358. this.vjsonExchange = new VjsonExchange(vj);
  10359. };
  10360. YvgridDesign.prototype.onLoad = function () {
  10361. var _this = this;
  10362. var model = this.vjsonExchange.parseModel();
  10363. this.vjsonExchange.pendingSet = true;
  10364. mergeViewModel(this.viewModel, "vjson", model, false);
  10365. this.refs.grid1.setData(model.columns);
  10366. this.vjsonExchange.attachViewModel(this.viewModel);
  10367. _$2.defer(function () {
  10368. _this.vjsonExchange.pendingSet = false;
  10369. });
  10370. };
  10371. YvgridDesign.prototype.moveUp = function (sender) {
  10372. var grid = sender.up('grid');
  10373. grid.rowMoveUp();
  10374. };
  10375. YvgridDesign.prototype.moveDown = function (sender) {
  10376. var grid = sender.up('grid');
  10377. grid.rowMoveDown();
  10378. };
  10379. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10380. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10381. };
  10382. YvgridDesign.prototype.reloadSqlContent = function () {
  10383. var _this = this;
  10384. var url = this.viewModel.get('vjson.dataSource.url');
  10385. if (url) {
  10386. loadSqlContentApi(url).then(function (res) {
  10387. _this.refs.sqlEditor.setCode('');
  10388. if (res.success) {
  10389. _this.refs.sqlEditor.setCode(res.data.content);
  10390. }
  10391. }).catch(function () {
  10392. _this.refs.sqlEditor.setCode('');
  10393. });
  10394. }
  10395. };
  10396. YvgridDesign.prototype.dataSourceSave = function () {
  10397. var url = this.viewModel.get('vjson.dataSource.url');
  10398. if (!url) {
  10399. msg$1('必须填写 groovy/SQL 模块路径');
  10400. return;
  10401. }
  10402. var content = this.refs.sqlEditor.getCode();
  10403. saveSqlContentApi(url, content).then(function (res) {
  10404. if (res.success) {
  10405. msg$1('保存成功');
  10406. }
  10407. else {
  10408. msg$1(res.msg);
  10409. }
  10410. });
  10411. };
  10412. YvgridDesign.prototype.dataSourceActivate = function () {
  10413. if (!this.dataSourceIsActived) {
  10414. // 激活
  10415. this.reloadSqlContent();
  10416. var params = this.viewModel.get('vjson.dataSource.params');
  10417. if (_$2.isObject(params)) {
  10418. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10419. }
  10420. this.dataSourceIsActived = true;
  10421. }
  10422. };
  10423. // 外部控件选择发生改变
  10424. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10425. if (!id || from === this.name) {
  10426. return;
  10427. }
  10428. this.setVjson(id);
  10429. };
  10430. YvgridDesign.prototype.setVjson = function (id) {
  10431. // 找到对应的组件 判断是不是表格
  10432. };
  10433. YvgridDesign.prototype.save = function () {
  10434. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10435. if (this.dataSourceIsActived) {
  10436. var url = this.viewModel.get('vjson.dataSource.url');
  10437. // 解析 params
  10438. var paramsString = this.refs.sqlParams.getCode('');
  10439. var params = undefined;
  10440. if (paramsString) {
  10441. try {
  10442. params = window['YvanUI'].json5.parse(paramsString);
  10443. }
  10444. catch (e) {
  10445. msg$1('dataSource.params 格式非法,请检查');
  10446. return;
  10447. }
  10448. }
  10449. if (typeof params === 'undefined') {
  10450. params = this.viewModel.get('vjson.dataSource.params');
  10451. }
  10452. if (url) {
  10453. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10454. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10455. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10456. }
  10457. else {
  10458. delete this.vjsonExchange.vjson['dataSource'];
  10459. }
  10460. }
  10461. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10462. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10463. from: this.name,
  10464. ignoreRenderUI: false
  10465. });
  10466. };
  10467. YvgridDesign.prototype.saveClose = function () {
  10468. this.save();
  10469. this.close();
  10470. };
  10471. YvgridDesign.prototype.addColumn = function () {
  10472. this.refs.grid1.appendEditRow({
  10473. dataIndex: '',
  10474. header: '',
  10475. xtype: '',
  10476. width: 80,
  10477. align: '',
  10478. editor: '',
  10479. editParam: '',
  10480. dict: '',
  10481. disabled: false,
  10482. notAllowBlank: false,
  10483. menuDisabled: false,
  10484. filterable: false,
  10485. hidden: false,
  10486. hideable: true,
  10487. resizable: true,
  10488. sortable: true,
  10489. locked: false,
  10490. lockable: false,
  10491. autoSize: true,
  10492. raw: undefined,
  10493. }, 'header');
  10494. };
  10495. YvgridDesign.prototype.removeColumn = function () {
  10496. var _this = this;
  10497. var rows = [];
  10498. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10499. rows.push(r);
  10500. });
  10501. _$2.forEach(rows, function (r) {
  10502. _this.refs.grid1.getStore().remove(r);
  10503. });
  10504. };
  10505. YvgridDesign.prototype.calcColumn = function () {
  10506. msg$1('暂未实现');
  10507. };
  10508. YvgridDesign.prototype.onDestroy = function () {
  10509. if (this.componentSelectionChangeSubscribe) {
  10510. this.componentSelectionChangeSubscribe.cancel();
  10511. this.componentSelectionChangeSubscribe = null;
  10512. }
  10513. };
  10514. return YvgridDesign;
  10515. }(Scope));
  10516. //# sourceMappingURL=YvgridDesign.js.map
  10517. // export const idPrefix = "_ds_"
  10518. var _designInstance;
  10519. function setDesignInstance(instance) {
  10520. _designInstance = instance;
  10521. }
  10522. function getDesignInstance() {
  10523. return _designInstance;
  10524. }
  10525. function delegateDragmove(node, source, info) {
  10526. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10527. //@ts-ignore
  10528. _designInstance.dragmove(node, source, info);
  10529. }
  10530. }
  10531. function delegateDragend(node, source, info) {
  10532. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10533. //@ts-ignore
  10534. _designInstance.dragend(node, source, info);
  10535. }
  10536. }
  10537. //# sourceMappingURL=DropHelper.js.map
  10538. var YvanUI$1 = window['YvanUI'];
  10539. var _$1 = window["_"];
  10540. var Ext$1 = window['Ext'];
  10541. var $$1 = window["$"];
  10542. var historySize = 100;
  10543. var ViewDesign = /** @class */ (function () {
  10544. function ViewDesign(moduleId, reference) {
  10545. var _this = this;
  10546. this.name = "ViewDesign";
  10547. this.expandedVjsonObjArray = [];
  10548. // 编辑历史
  10549. this.undoVjsonList = [];
  10550. // 撤销历史
  10551. this.redoVjsonList = [];
  10552. // 订阅事件列表
  10553. this.subscribeList = [];
  10554. // private getOuterCopyValueTimer: any = null
  10555. /**
  10556. * 唯一编号
  10557. */
  10558. this.id = _$1.uniqueId("_dv");
  10559. this.moduleId = moduleId;
  10560. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10561. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10562. this.designReference = reference;
  10563. this.designElement = reference.ariaEl.dom;
  10564. this.$overlay.appendTo(this.designElement);
  10565. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10566. // 添加到撤销
  10567. this.lastVjson = _$1.cloneDeep(this.vjson);
  10568. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10569. event.stopPropagation();
  10570. event.preventDefault();
  10571. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10572. });
  10573. this.$overlay.on('click', '.studio_mask', function (event) {
  10574. event.stopPropagation();
  10575. event.preventDefault();
  10576. _this.clearSelection();
  10577. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10578. _$1.defer(function () {
  10579. _this.$overlay.focus();
  10580. });
  10581. });
  10582. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10583. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10584. this.$overlay.on('copy', this.onCopy.bind(this));
  10585. this.$overlay.on('paste', this.onPaste.bind(this));
  10586. this.$overlay.on('focus', this.onfocus.bind(this));
  10587. // this.$overlay.on('mouseenter', ()=>{
  10588. // clearTimeout(this.getOuterCopyValueTimer);
  10589. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10590. // })
  10591. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10592. _this.onMousemove(event);
  10593. }, 300, { maxWait: 500 }).bind(this));
  10594. window.addEventListener('message', this.onMessageEvent.bind(this));
  10595. this.subscribe();
  10596. setDesignInstance(this);
  10597. }
  10598. // todo ======== 方法 ==========
  10599. ViewDesign.prototype.subscribe = function () {
  10600. var _this = this;
  10601. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10602. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10603. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10604. _this.setVjson(vjson, from, ignoreRenderUI);
  10605. }));
  10606. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10607. var id = _a.id, from = _a.from;
  10608. _this.onComponentSelectionChange(id, from);
  10609. }));
  10610. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10611. var id = _a.id, from = _a.from;
  10612. _this.onComponentDelete(id, from);
  10613. }));
  10614. };
  10615. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10616. if (vjson === void 0) { vjson = this.vjson; }
  10617. if (from === void 0) { from = this.name; }
  10618. this.vjson = vjson;
  10619. if (from !== "undo" && from !== "redo") {
  10620. if (this.undoVjsonList.length >= 100) {
  10621. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10622. }
  10623. this.undoVjsonList.push(this.lastVjson);
  10624. }
  10625. this.lastVjson = _$1.cloneDeep(vjson);
  10626. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10627. };
  10628. /**
  10629. * 覆盖层点击事件
  10630. */
  10631. ViewDesign.prototype.overlayClickFunction = function (event) {
  10632. if (!event.altKey && !event.shiftKey) {
  10633. var target = this.findElByXY(event.clientX, event.clientY);
  10634. if (target) {
  10635. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10636. var extHandle = Ext$1.get(target).component;
  10637. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10638. rect.x = position.x;
  10639. rect.y = position.y;
  10640. this.clearSelection();
  10641. this.appendMaskbox(rect, extHandle.id);
  10642. }
  10643. }
  10644. };
  10645. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10646. if (dragType === void 0) { dragType = ""; }
  10647. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10648. var ele = document.elementsFromPoint(x, y);
  10649. if (ele.length <= 1) {
  10650. return;
  10651. }
  10652. var target = null;
  10653. for (var i = 0; i < ele.length; i++) {
  10654. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10655. 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) {
  10656. switch (dragType) {
  10657. case "cols-container":
  10658. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10659. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10660. target = ele[i];
  10661. }
  10662. break;
  10663. case "col-item":
  10664. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10665. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10666. target = ele[i];
  10667. }
  10668. break;
  10669. case "rows-container":
  10670. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10671. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10672. target = ele[i];
  10673. }
  10674. break;
  10675. case "row-item":
  10676. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10677. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10678. target = ele[i];
  10679. }
  10680. break;
  10681. default:
  10682. target = ele[i];
  10683. break;
  10684. }
  10685. if (target) {
  10686. break;
  10687. }
  10688. }
  10689. }
  10690. return target;
  10691. };
  10692. /**
  10693. * 清空选择项
  10694. */
  10695. ViewDesign.prototype.clearSelection = function () {
  10696. // $(this.designElement).removeClass('selected');
  10697. // // $(this.designElement).find('.selected').removeClass('selected')
  10698. // $(this.designElement).find('.ds_mask')
  10699. // .not('.mask_not_hide')
  10700. // .remove();
  10701. $$1('.studio_mask').remove();
  10702. // $(this.designElement).find('.selected').each(function () {
  10703. // $(this).removeClass('selected');
  10704. // // const extHandle = Ext.get(this).component
  10705. // // if (extHandle) {
  10706. // // extHandle.removeCls('selected')
  10707. // // }
  10708. // })
  10709. };
  10710. /**
  10711. * 添加遮罩层
  10712. */
  10713. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10714. var that = this;
  10715. if (vjsonId) {
  10716. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10717. }
  10718. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10719. // return item === cj.xtype
  10720. // }) >= 0
  10721. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10722. 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>");
  10723. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10724. this.$mask.css({
  10725. position: 'absolute',
  10726. top: top, left: left, width: width, height: height,
  10727. border: '2px dashed #1890ff',
  10728. zIndex: 100,
  10729. });
  10730. this.$mask.appendTo(this.$overlay);
  10731. this.$mask.on("click", ".ds_del", function (e) {
  10732. e.stopPropagation();
  10733. e.preventDefault();
  10734. that.deleteComponent(vjsonId);
  10735. });
  10736. // 点击选中父级
  10737. this.$mask.on('click', '.ds_parent', function (e) {
  10738. e.stopPropagation();
  10739. e.preventDefault();
  10740. that.selectParent(vjsonId);
  10741. });
  10742. var sel = document.getElementById(vjsonId);
  10743. var sVjosn = findInCode(this.vjson, vjsonId);
  10744. // 限制可以拖动的组件
  10745. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10746. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10747. this.dragSource = new Ext$1.drag.Source({
  10748. element: this.$mask[0],
  10749. constrain: this.$overlay[0],
  10750. listeners: {
  10751. dragmove: this.dragmove.bind(that, this.vjson),
  10752. dragend: this.dragend.bind(that, this.vjson)
  10753. },
  10754. startRect: rect,
  10755. sourceVjson: findInCode(this.vjson, vjsonId),
  10756. sourceVjsonId: vjsonId,
  10757. dragType: dragType
  10758. });
  10759. }
  10760. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10761. };
  10762. /**
  10763. * 选中某个选项
  10764. */
  10765. ViewDesign.prototype.setSelection = function (id) {
  10766. var _a, _b;
  10767. if (!this.designElement) {
  10768. return;
  10769. }
  10770. // 清空选中内容
  10771. this.clearSelection();
  10772. if (!id) {
  10773. return;
  10774. }
  10775. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10776. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10777. rect.x = position.x;
  10778. rect.y = position.y;
  10779. this.appendMaskbox(rect, id);
  10780. };
  10781. /**
  10782. * 删除组件
  10783. * @param id
  10784. */
  10785. ViewDesign.prototype.deleteComponent = function (id) {
  10786. deletVjsonById(this.vjson, id);
  10787. this.moduleObject.modulePage.currentComponentSelectId = null;
  10788. this.setVjson();
  10789. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10790. this.clearSelection();
  10791. };
  10792. ViewDesign.prototype.selectParent = function (id) {
  10793. var pid = getSuperVjsonId(this.vjson, id);
  10794. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10795. this.setSelection(pid);
  10796. };
  10797. // todo ====== 拖拽事件 ======
  10798. ViewDesign.prototype.dragmove = function (node, source, info) {
  10799. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10800. if (!target) {
  10801. return;
  10802. }
  10803. var rect = target.getBoundingClientRect();
  10804. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10805. var extHandle = Ext$1.get(target).component;
  10806. if (!extHandle) {
  10807. return;
  10808. }
  10809. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10810. rect.x = position.x;
  10811. rect.y = position.y;
  10812. this.appendDirection(rect, extHandle.id, direction);
  10813. };
  10814. ViewDesign.prototype.dragend = function (node, source, info) {
  10815. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10816. if (!target) {
  10817. return;
  10818. }
  10819. var rect = target.getBoundingClientRect();
  10820. var extHandle = Ext$1.get(target).component;
  10821. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10822. if (!extHandle) {
  10823. return;
  10824. }
  10825. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10826. this.removeDirection();
  10827. };
  10828. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10829. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10830. var cv = findInCode(this.vjson, vjsonId);
  10831. if (this.$direction) {
  10832. $$1('#direction' + this.id).remove();
  10833. }
  10834. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10835. //
  10836. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10837. if (direction) {
  10838. if (direction === "top") {
  10839. // direction = 'center'
  10840. height = height / 4;
  10841. }
  10842. else if (direction === "bottom") {
  10843. // direction = 'center'
  10844. top = top + height / 4 * 3;
  10845. height = height / 4;
  10846. }
  10847. else if (direction === "left") {
  10848. width = width / 4;
  10849. }
  10850. else if (direction === "right") {
  10851. left = left + width / 4 * 3;
  10852. width = width / 4;
  10853. }
  10854. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10855. this.$direction.css({
  10856. position: 'absolute',
  10857. top: top, left: left, width: width, height: height,
  10858. // border: '2px dashed #1890ff',
  10859. background: 'rgba(40,224,218,0.75)',
  10860. zIndex: 100,
  10861. });
  10862. this.$direction.appendTo(this.$overlay);
  10863. // }
  10864. }
  10865. };
  10866. ViewDesign.prototype.removeDirection = function () {
  10867. if (this.$direction) {
  10868. this.$direction.remove();
  10869. this.$direction = null;
  10870. }
  10871. };
  10872. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10873. var arrS;
  10874. if (sourceVjId) {
  10875. arrS = findArrayContainer(this.vjson, sourceVjId);
  10876. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10877. var indexS = _$1.findIndex(arrS, function (v) {
  10878. return v.id === sourceVjId;
  10879. });
  10880. if (indexS < 0) {
  10881. return;
  10882. }
  10883. }
  10884. delete sourceVjson.id;
  10885. var vjsonT = findInCode(this.vjson, targetVjId);
  10886. var arrT = findArrayContainer(this.vjson, targetVjId);
  10887. var indexT = _$1.findIndex(arrT, function (v) {
  10888. return v.id === targetVjId;
  10889. });
  10890. if (indexT < 0) {
  10891. return;
  10892. }
  10893. switch (direction) {
  10894. case 'top':
  10895. case 'left':
  10896. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10897. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10898. vjsonT.items.splice(0, 0, sourceVjson);
  10899. }
  10900. else {
  10901. arrT.splice(indexT, 0, sourceVjson);
  10902. }
  10903. break;
  10904. case 'bottom':
  10905. case 'right':
  10906. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10907. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10908. vjsonT.items.push(sourceVjson);
  10909. }
  10910. else {
  10911. arrT.splice(indexT + 1, 0, sourceVjson);
  10912. }
  10913. break;
  10914. case 'center':
  10915. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10916. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10917. vjsonT.items.push(sourceVjson);
  10918. }
  10919. else {
  10920. arrT.splice(indexT, 1, sourceVjson);
  10921. }
  10922. break;
  10923. }
  10924. if (sourceVjId) {
  10925. deletVjsonById(this.vjson, sourceVjId);
  10926. sourceVjson.id = sourceVjId;
  10927. }
  10928. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10929. };
  10930. // todo ======== 事件 ==========
  10931. // 接收 postMessage 事件分发
  10932. ViewDesign.prototype.onMessageEvent = function (event) {
  10933. var _a, _b;
  10934. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10935. if (fucName && typeof this[fucName] === 'function') {
  10936. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10937. }
  10938. };
  10939. // 接收外部选中组件事件
  10940. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10941. if (from !== this.name) {
  10942. this.setSelection(id);
  10943. }
  10944. };
  10945. // 接收外部组件删除事件
  10946. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10947. if (from !== this.name) {
  10948. this.deleteComponent(id);
  10949. }
  10950. };
  10951. // 组件被选中
  10952. ViewDesign.prototype.onComponentSelect = function (args) {
  10953. if (args[2] != this.moduleId) {
  10954. return;
  10955. }
  10956. if (args[0]) {
  10957. var rect = args[0];
  10958. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10959. rect.x = position.x;
  10960. rect.y = position.y;
  10961. this.clearSelection();
  10962. this.appendMaskbox(rect, args[1]);
  10963. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  10964. }
  10965. };
  10966. ViewDesign.prototype.onComponentInfo = function (_a) {
  10967. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  10968. if (moduleId != this.moduleId) {
  10969. return;
  10970. }
  10971. if (rect) {
  10972. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10973. rect.x = position.x;
  10974. rect.y = position.y;
  10975. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10976. var cv_1 = findInCode(this.vjson, vjsonId);
  10977. if (this.$direction) {
  10978. $$1('#direction' + this.id).remove();
  10979. }
  10980. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  10981. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  10982. if (direction) {
  10983. if (direction === "top") {
  10984. direction = 'center';
  10985. //height = height/3
  10986. }
  10987. else if (direction === "bottom") {
  10988. direction = 'center';
  10989. // top=top+height/3*2
  10990. // height = height/3
  10991. }
  10992. else if (direction === "left") {
  10993. width = width / 3;
  10994. }
  10995. else if (direction === "right") {
  10996. left = left + width / 3 * 2;
  10997. width = width / 3;
  10998. }
  10999. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11000. this.$direction.css({
  11001. position: 'absolute',
  11002. top: top, left: left, width: width, height: height,
  11003. // border: '2px dashed #1890ff',
  11004. background: 'rgba(74,106,201,0.42)',
  11005. zIndex: 100,
  11006. });
  11007. this.$direction.appendTo(this.$overlay);
  11008. }
  11009. }
  11010. console.log("direction", direction);
  11011. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11012. // rect.x = position.x
  11013. // rect.y = position.y
  11014. // this.clearSelection()
  11015. // this.appendMaskbox(rect, args[1])
  11016. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11017. }
  11018. };
  11019. ViewDesign.prototype.onUndo = function () {
  11020. if (this.undoVjsonList.length > 0) {
  11021. if (this.redoVjsonList.length >= 100) {
  11022. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11023. }
  11024. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11025. this.vjson = this.undoVjsonList.pop();
  11026. // this.setVjson(this.vjson, "", false, "undo")
  11027. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11028. }
  11029. };
  11030. ViewDesign.prototype.onRedo = function () {
  11031. if (this.redoVjsonList.length > 0) {
  11032. if (this.undoVjsonList.length >= 100) {
  11033. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11034. }
  11035. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11036. this.vjson = this.redoVjsonList.pop();
  11037. // this.setVjson(this.vjson, "", false, "redo")
  11038. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11039. }
  11040. };
  11041. ViewDesign.prototype.onKeyPress = function (event) {
  11042. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11043. // if (this.backStep()) {
  11044. // event.stopPropagation()
  11045. // event.preventDefault()
  11046. // return
  11047. // }
  11048. // }
  11049. //
  11050. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11051. // if (this.recoverStep()) {
  11052. // event.stopPropagation()
  11053. // event.preventDefault()
  11054. // return
  11055. // }
  11056. // }
  11057. // if (event.key === 'ArrowUp') {
  11058. // if (this.selectParent()) {
  11059. // event.stopPropagation()
  11060. // event.preventDefault()
  11061. // return;
  11062. // }
  11063. // }
  11064. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11065. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11066. event.stopPropagation();
  11067. event.preventDefault();
  11068. return;
  11069. }
  11070. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11071. // if (this.copyView()) {
  11072. // event.stopPropagation()
  11073. // event.preventDefault()
  11074. // return;
  11075. // }
  11076. // }
  11077. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11078. // if (this.copyView(true)) {
  11079. // event.stopPropagation()
  11080. // event.preventDefault()
  11081. // return;
  11082. // }
  11083. // }
  11084. //
  11085. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11086. // if (this.selectRoot()) {
  11087. // event.stopPropagation()
  11088. // event.preventDefault()
  11089. // return;
  11090. // }
  11091. //
  11092. };
  11093. ViewDesign.prototype.onCopy = function (event) {
  11094. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11095. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11096. if (copyVjson) {
  11097. removeDesignProp(copyVjson);
  11098. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11099. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11100. }
  11101. }
  11102. };
  11103. ViewDesign.prototype.onPaste = function (event) {
  11104. debugger;
  11105. };
  11106. ViewDesign.prototype.onfocus = function () {
  11107. console.log("getCopy");
  11108. console.log("document.activeElement", document.activeElement.id);
  11109. // clearTimeout(this.getOuterCopyValueTimer);
  11110. // native.clipboardRead()
  11111. };
  11112. ViewDesign.prototype.onMousemove = function (event) {
  11113. var _a;
  11114. if (document.activeElement.id === this.$overlay[0].id) {
  11115. // console.log(event.clientX, event.clientY)
  11116. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11117. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11118. // this.iframeWindow.postMessage({
  11119. // method: 'overlayGetInfo',
  11120. // args: [position, this.moduleId]
  11121. // }, '*')
  11122. }
  11123. }
  11124. };
  11125. ViewDesign.prototype.onDestroy = function () {
  11126. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11127. for (var i = 0; i < this.subscribeList.length; i++) {
  11128. this.subscribeList[i].cancel();
  11129. }
  11130. };
  11131. // todo ======== 工具方法 ==========
  11132. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11133. if (relative === void 0) { relative = null; }
  11134. if (from === "main" && to === "overlay") {
  11135. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11136. var x = overlayRect.x;
  11137. var y = overlayRect.y;
  11138. if (relative) {
  11139. var relativeRect = relative.getBoundingClientRect();
  11140. console.log("main->", relativeRect.x, relativeRect.y);
  11141. x = x - relativeRect.x;
  11142. y = y - relativeRect.y;
  11143. }
  11144. pos.x = pos.x - x;
  11145. pos.y = pos.y - y;
  11146. }
  11147. else if (from === "overlay" && to === "main") {
  11148. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11149. var x = overlayRect.x;
  11150. var y = overlayRect.y;
  11151. if (relative) {
  11152. var relativeRect = relative.getBoundingClientRect();
  11153. console.log("iframe->", relativeRect.x, relativeRect.y);
  11154. x = x - relativeRect.x;
  11155. y = y - relativeRect.y;
  11156. }
  11157. pos.x = pos.x + x;
  11158. pos.y = pos.y + y;
  11159. }
  11160. return pos;
  11161. };
  11162. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11163. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11164. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11165. return "center";
  11166. }
  11167. // col-item 只能放左右
  11168. if (dragType === "col-item" || dragType === "") {
  11169. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11170. if (x > rect.x && x < rect.x + rect.width / 3) {
  11171. return "left";
  11172. }
  11173. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11174. return "right";
  11175. }
  11176. }
  11177. }
  11178. // cols-container 只能放上下
  11179. if (dragType === "cols-container" || dragType === "") {
  11180. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11181. if (y > rect.y && y < rect.y + rect.height / 3) {
  11182. return "top";
  11183. }
  11184. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11185. return "bottom";
  11186. }
  11187. }
  11188. }
  11189. return "";
  11190. };
  11191. return ViewDesign;
  11192. }());
  11193. //
  11194. //# sourceMappingURL=ViewDesign.js.map
  11195. var model$8 = {
  11196. data: {
  11197. iframeSrc: ''
  11198. }
  11199. };
  11200. //# sourceMappingURL=ModulePage.model.js.map
  11201. var vjson$8 = {
  11202. layout: 'fit',
  11203. border: false,
  11204. iconCls: 'x-fa fa-newspaper-o',
  11205. referenceHolder: true,
  11206. items: [
  11207. {
  11208. layout: 'border',
  11209. border: false,
  11210. items: [
  11211. {
  11212. region: 'center',
  11213. xtype: 'tabpanel',
  11214. border: false,
  11215. tabPosition: 'bottom',
  11216. reference: 'tabPanel',
  11217. listeners: {
  11218. tabchange: 'scope.tabchange'
  11219. },
  11220. defaults: {
  11221. border: false,
  11222. },
  11223. items: [
  11224. {
  11225. title: 'controller.js',
  11226. xtype: 'jseditor',
  11227. reference: 'controllerEditor',
  11228. },
  11229. {
  11230. title: 'view.design',
  11231. xtype: 'designer',
  11232. reference: 'designer',
  11233. listeners: {
  11234. afterrender: 'scope.previewRender'
  11235. },
  11236. },
  11237. {
  11238. title: 'view.js',
  11239. xtype: 'jseditor',
  11240. reference: 'viewEditor',
  11241. },
  11242. {
  11243. title: 'model.js',
  11244. xtype: 'jseditor',
  11245. reference: 'modelEditor',
  11246. },
  11247. {
  11248. title: 'groovy',
  11249. xtype: 'groovyeditor',
  11250. reference: 'groovyEditor',
  11251. },
  11252. {
  11253. title: 'SQL',
  11254. xtype: 'sqleditor',
  11255. reference: 'sqlEditor',
  11256. }
  11257. ]
  11258. }
  11259. ]
  11260. }
  11261. ]
  11262. };
  11263. //# sourceMappingURL=ModulePage.view.js.map
  11264. var ModulePage = /** @class */ (function (_super) {
  11265. __extends(ModulePage, _super);
  11266. function ModulePage(moduleId, module) {
  11267. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11268. _this.name = "ModulePage";
  11269. _this.viewDesign = null;
  11270. _this.maxViewId = 0;
  11271. _this.moduleEventBus = new EventBus();
  11272. _this.codeChange = _$2.debounce(function (code, from, e) {
  11273. try {
  11274. switch (from) {
  11275. case _this.refs.controllerEditor.name:
  11276. moduleStore.updateJsController(_this.moduleId, code, from);
  11277. break;
  11278. case _this.refs.viewEditor.name:
  11279. moduleStore.updateJsView(_this.moduleId, code, from);
  11280. break;
  11281. case _this.refs.modelEditor.name:
  11282. moduleStore.updateJsModel(_this.moduleId, code, from);
  11283. break;
  11284. case _this.refs.groovyEditor.name:
  11285. moduleStore.updateGroovy(_this.moduleId, code, from);
  11286. break;
  11287. case _this.refs.sqlEditor.name:
  11288. moduleStore.updateMybatis(_this.moduleId, code, from);
  11289. break;
  11290. }
  11291. }
  11292. catch (e) {
  11293. }
  11294. }, 500, { maxWait: 10000 });
  11295. _this.moduleId = moduleId;
  11296. _this.module = module;
  11297. _this.cancelSubscribe = [];
  11298. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11299. _this.initEditor(moduleItem);
  11300. }));
  11301. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11302. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11303. _this.previewReRender();
  11304. }));
  11305. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11306. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11307. _this.updateVjson(vjson, from, ignoreRenderUI);
  11308. }));
  11309. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11310. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11311. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11312. }));
  11313. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11314. var id = _a.id, from = _a.from;
  11315. _this.onComponentSelectionChange(id, from);
  11316. }));
  11317. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11318. _this.onUndo();
  11319. }));
  11320. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11321. _this.onRedo();
  11322. }));
  11323. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11324. _this.currentCopyVjson = stringToJsonObj(value);
  11325. }));
  11326. return _this;
  11327. }
  11328. ModulePage.prototype.onLoad = function () {
  11329. var _this = this;
  11330. // this.refs.preview.src = href
  11331. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11332. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11333. _this.saveCall();
  11334. }));
  11335. this.activeEditor = this.refs.controllerEditor;
  11336. this.refs.controllerEditor.modulePage = this;
  11337. this.refs.viewEditor.modulePage = this;
  11338. this.refs.modelEditor.modulePage = this;
  11339. this.refs.groovyEditor.modulePage = this;
  11340. this.refs.sqlEditor.modulePage = this;
  11341. this.refs.controllerEditor.name = "controllerEditor";
  11342. this.refs.viewEditor.name = "viewEditor";
  11343. this.refs.modelEditor.name = "modelEditor";
  11344. this.refs.groovyEditor.name = "groovyEditor";
  11345. this.refs.sqlEditor.name = "sqlEditor";
  11346. this.refs.controllerEditor.codeChange = this.codeChange;
  11347. this.refs.viewEditor.codeChange = this.codeChange;
  11348. this.refs.modelEditor.codeChange = this.codeChange;
  11349. this.refs.groovyEditor.codeChange = this.codeChange;
  11350. this.refs.sqlEditor.codeChange = this.codeChange;
  11351. };
  11352. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11353. if (!cmpVjson || from === this.name) {
  11354. return;
  11355. }
  11356. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11357. replaceVjsonById(vj, cmpVjson);
  11358. this.updateVjson(vj, from, ignoreRenderUI);
  11359. };
  11360. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11361. var _this = this;
  11362. var _a, _b;
  11363. if (!vjson || from === this.name) {
  11364. return;
  11365. }
  11366. this.addViewId(vjson);
  11367. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11368. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11369. (_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);
  11370. this.previewReRender();
  11371. _$2.defer(function () {
  11372. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11373. });
  11374. };
  11375. ModulePage.prototype.previewRender = function (sender) {
  11376. var _this = this;
  11377. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11378. if (!this.designScope) {
  11379. this.designScope = new Scope({
  11380. vjson: vjson,
  11381. model: {
  11382. data: {}
  11383. }
  11384. });
  11385. }
  11386. else {
  11387. this.designScope.vjson = vjson;
  11388. }
  11389. this.designScope.showDesigner(sender, {
  11390. moduleId: this.moduleId,
  11391. });
  11392. if (this.viewDesign) {
  11393. return;
  11394. }
  11395. _$2.defer(function () {
  11396. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11397. handles$1.mainWindow.setLoading(false);
  11398. });
  11399. };
  11400. ModulePage.prototype.previewReRender = function () {
  11401. var designer = this.refs.designer;
  11402. this.previewRender(designer);
  11403. };
  11404. ModulePage.prototype.initEditor = function (moduleItem) {
  11405. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11406. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11407. return;
  11408. (_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);
  11409. (_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);
  11410. (_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);
  11411. (_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);
  11412. (_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);
  11413. };
  11414. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11415. this.currentComponentSelectId = id;
  11416. };
  11417. ModulePage.prototype.onUndo = function () {
  11418. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11419. this.viewDesign.onUndo();
  11420. }
  11421. };
  11422. ModulePage.prototype.onRedo = function () {
  11423. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11424. this.viewDesign.onRedo();
  11425. }
  11426. };
  11427. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11428. this.activeEditor = newCard;
  11429. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11430. };
  11431. ModulePage.prototype.saveCall = function () {
  11432. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11433. moduleStore.saveFile(this.moduleId, "jsView");
  11434. }
  11435. else if (this.activeEditor === this.refs.controllerEditor) {
  11436. moduleStore.saveFile(this.moduleId, "jsController");
  11437. }
  11438. else if (this.activeEditor === this.refs.modelEditor) {
  11439. moduleStore.saveFile(this.moduleId, "jsModel");
  11440. }
  11441. else if (this.activeEditor === this.refs.groovyEditor) {
  11442. moduleStore.saveFile(this.moduleId, "groovy");
  11443. }
  11444. else if (this.activeEditor === this.refs.sqlEditor) {
  11445. moduleStore.saveFile(this.moduleId, "mybatis");
  11446. }
  11447. };
  11448. ModulePage.prototype.check = function () {
  11449. moduleStore.check(this.moduleId);
  11450. };
  11451. /**
  11452. * 为vjson添加id
  11453. * @param vjson
  11454. * @param isAll
  11455. */
  11456. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11457. var _this = this;
  11458. if (isAll === void 0) { isAll = false; }
  11459. var maxIdTag = 0;
  11460. // 先提取当前的最大id
  11461. deepTravVJson(vjson, function (obj) {
  11462. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11463. return;
  11464. }
  11465. if (obj.id && obj.id.indexOf(idPrefix)) {
  11466. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11467. if (sutr.length > 0) {
  11468. var tid = sutr.replace(idPrefix, "");
  11469. var idNum = parseInt(tid);
  11470. if (idNum && maxIdTag < idNum) {
  11471. maxIdTag = idNum;
  11472. }
  11473. }
  11474. }
  11475. });
  11476. // 标记最大的id号,避免重复
  11477. this.maxViewId = maxIdTag;
  11478. deepTravVJson(vjson, function (obj) {
  11479. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11480. return;
  11481. }
  11482. if (!obj.hasOwnProperty('id')) {
  11483. obj.id = _this.createViewId();
  11484. }
  11485. if (!obj.hasOwnProperty('designMode')) {
  11486. obj.designMode = true;
  11487. }
  11488. // if (obj.xtype == "tabview" && obj.activeTab) {
  11489. // // 设置默认的选项
  11490. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11491. // if (typeof obj.activeTab === 'number') {
  11492. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11493. // } else if (typeof obj.activeTab === 'string') {
  11494. // this._tabViewSelect[obj.id] = obj.activeTab
  11495. // }
  11496. //
  11497. // }
  11498. // }
  11499. if (isAll && obj.hasOwnProperty("view")) ;
  11500. });
  11501. return vjson;
  11502. };
  11503. /**
  11504. * 为组件创建 ID
  11505. */
  11506. ModulePage.prototype.createViewId = function () {
  11507. this.maxViewId++;
  11508. return this.id + idPrefix + this.maxViewId;
  11509. };
  11510. ModulePage.prototype.onDestroy = function () {
  11511. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11512. this.cancelSubscribe[i].cancel();
  11513. }
  11514. _super.prototype.onDestroy.call(this);
  11515. };
  11516. return ModulePage;
  11517. }(Scope));
  11518. //# sourceMappingURL=ModulePage.js.map
  11519. var camundaModdleDescriptor = {
  11520. "name": "Camunda",
  11521. "uri": "http://camunda.org/schema/1.0/bpmn",
  11522. "prefix": "camunda",
  11523. "xml": {
  11524. "tagAlias": "lowerCase"
  11525. },
  11526. "associations": [],
  11527. "types": [
  11528. {
  11529. "name": "Definitions",
  11530. "isAbstract": true,
  11531. "extends": [
  11532. "bpmn:Definitions"
  11533. ],
  11534. "properties": [
  11535. {
  11536. "name": "diagramRelationId",
  11537. "isAttr": true,
  11538. "type": "String"
  11539. }
  11540. ]
  11541. },
  11542. {
  11543. "name": "InOutBinding",
  11544. "superClass": [
  11545. "Element"
  11546. ],
  11547. "isAbstract": true,
  11548. "properties": [
  11549. {
  11550. "name": "source",
  11551. "isAttr": true,
  11552. "type": "String"
  11553. },
  11554. {
  11555. "name": "sourceExpression",
  11556. "isAttr": true,
  11557. "type": "String"
  11558. },
  11559. {
  11560. "name": "target",
  11561. "isAttr": true,
  11562. "type": "String"
  11563. },
  11564. {
  11565. "name": "businessKey",
  11566. "isAttr": true,
  11567. "type": "String"
  11568. },
  11569. {
  11570. "name": "local",
  11571. "isAttr": true,
  11572. "type": "Boolean",
  11573. "default": false
  11574. },
  11575. {
  11576. "name": "variables",
  11577. "isAttr": true,
  11578. "type": "String"
  11579. }
  11580. ]
  11581. },
  11582. {
  11583. "name": "In",
  11584. "superClass": [
  11585. "InOutBinding"
  11586. ],
  11587. "meta": {
  11588. "allowedIn": [
  11589. "bpmn:CallActivity",
  11590. "bpmn:SignalEventDefinition"
  11591. ]
  11592. }
  11593. },
  11594. {
  11595. "name": "Out",
  11596. "superClass": [
  11597. "InOutBinding"
  11598. ],
  11599. "meta": {
  11600. "allowedIn": [
  11601. "bpmn:CallActivity"
  11602. ]
  11603. }
  11604. },
  11605. {
  11606. "name": "AsyncCapable",
  11607. "isAbstract": true,
  11608. "extends": [
  11609. "bpmn:Activity",
  11610. "bpmn:Gateway",
  11611. "bpmn:Event"
  11612. ],
  11613. "properties": [
  11614. {
  11615. "name": "async",
  11616. "isAttr": true,
  11617. "type": "Boolean",
  11618. "default": false
  11619. },
  11620. {
  11621. "name": "asyncBefore",
  11622. "isAttr": true,
  11623. "type": "Boolean",
  11624. "default": false
  11625. },
  11626. {
  11627. "name": "asyncAfter",
  11628. "isAttr": true,
  11629. "type": "Boolean",
  11630. "default": false
  11631. },
  11632. {
  11633. "name": "exclusive",
  11634. "isAttr": true,
  11635. "type": "Boolean",
  11636. "default": true
  11637. }
  11638. ]
  11639. },
  11640. {
  11641. "name": "JobPriorized",
  11642. "isAbstract": true,
  11643. "extends": [
  11644. "bpmn:Process",
  11645. "camunda:AsyncCapable"
  11646. ],
  11647. "properties": [
  11648. {
  11649. "name": "jobPriority",
  11650. "isAttr": true,
  11651. "type": "String"
  11652. }
  11653. ]
  11654. },
  11655. {
  11656. "name": "SignalEventDefinitionExtension",
  11657. "isAbstract": true,
  11658. "extends": [
  11659. "bpmn:SignalEventDefinition"
  11660. ],
  11661. "properties": [
  11662. {
  11663. "name": "async",
  11664. "isAttr": true,
  11665. "type": "Boolean",
  11666. "default": false
  11667. }
  11668. ]
  11669. },
  11670. {
  11671. "name": "ErrorEventDefinitionExtension",
  11672. "isAbstract": true,
  11673. "extends": [
  11674. "bpmn:ErrorEventDefinition"
  11675. ],
  11676. "properties": [
  11677. {
  11678. "name": "errorCodeVariable",
  11679. "isAttr": true,
  11680. "type": "String"
  11681. },
  11682. {
  11683. "name": "errorMessageVariable",
  11684. "isAttr": true,
  11685. "type": "String"
  11686. }
  11687. ]
  11688. },
  11689. {
  11690. "name": "ErrorEventDefinition",
  11691. "superClass": [
  11692. "bpmn:ErrorEventDefinition",
  11693. "Element"
  11694. ],
  11695. "properties": [
  11696. {
  11697. "name": "expression",
  11698. "isAttr": true,
  11699. "type": "String"
  11700. }
  11701. ],
  11702. "meta": {
  11703. "allowedIn": ["bpmn:ServiceTask"]
  11704. }
  11705. },
  11706. {
  11707. "name": "Error",
  11708. "isAbstract": true,
  11709. "extends": [
  11710. "bpmn:Error"
  11711. ],
  11712. "properties": [
  11713. {
  11714. "name": "camunda:errorMessage",
  11715. "isAttr": true,
  11716. "type": "String"
  11717. }
  11718. ]
  11719. },
  11720. {
  11721. "name": "PotentialStarter",
  11722. "superClass": [
  11723. "Element"
  11724. ],
  11725. "properties": [
  11726. {
  11727. "name": "resourceAssignmentExpression",
  11728. "type": "bpmn:ResourceAssignmentExpression"
  11729. }
  11730. ]
  11731. },
  11732. {
  11733. "name": "FormSupported",
  11734. "isAbstract": true,
  11735. "extends": [
  11736. "bpmn:StartEvent",
  11737. "bpmn:UserTask"
  11738. ],
  11739. "properties": [
  11740. {
  11741. "name": "formHandlerClass",
  11742. "isAttr": true,
  11743. "type": "String"
  11744. },
  11745. {
  11746. "name": "formKey",
  11747. "isAttr": true,
  11748. "type": "String"
  11749. },
  11750. {
  11751. "name": "formRef",
  11752. "isAttr": true,
  11753. "type": "String"
  11754. },
  11755. {
  11756. "name": "formRefBinding",
  11757. "isAttr": true,
  11758. "type": "String"
  11759. },
  11760. {
  11761. "name": "formRefVersion",
  11762. "isAttr": true,
  11763. "type": "String"
  11764. }
  11765. ]
  11766. },
  11767. {
  11768. "name": "TemplateSupported",
  11769. "isAbstract": true,
  11770. "extends": [
  11771. "bpmn:Collaboration",
  11772. "bpmn:Process",
  11773. "bpmn:FlowElement"
  11774. ],
  11775. "properties": [
  11776. {
  11777. "name": "modelerTemplate",
  11778. "isAttr": true,
  11779. "type": "String"
  11780. },
  11781. {
  11782. "name": "modelerTemplateVersion",
  11783. "isAttr": true,
  11784. "type": "Integer"
  11785. }
  11786. ]
  11787. },
  11788. {
  11789. "name": "Initiator",
  11790. "isAbstract": true,
  11791. "extends": ["bpmn:StartEvent"],
  11792. "properties": [
  11793. {
  11794. "name": "initiator",
  11795. "isAttr": true,
  11796. "type": "String"
  11797. }
  11798. ]
  11799. },
  11800. {
  11801. "name": "ScriptTask",
  11802. "isAbstract": true,
  11803. "extends": [
  11804. "bpmn:ScriptTask"
  11805. ],
  11806. "properties": [
  11807. {
  11808. "name": "resultVariable",
  11809. "isAttr": true,
  11810. "type": "String"
  11811. },
  11812. {
  11813. "name": "resource",
  11814. "isAttr": true,
  11815. "type": "String"
  11816. }
  11817. ]
  11818. },
  11819. {
  11820. "name": "Process",
  11821. "isAbstract": true,
  11822. "extends": [
  11823. "bpmn:Process"
  11824. ],
  11825. "properties": [
  11826. {
  11827. "name": "candidateStarterGroups",
  11828. "isAttr": true,
  11829. "type": "String"
  11830. },
  11831. {
  11832. "name": "candidateStarterUsers",
  11833. "isAttr": true,
  11834. "type": "String"
  11835. },
  11836. {
  11837. "name": "versionTag",
  11838. "isAttr": true,
  11839. "type": "String"
  11840. },
  11841. {
  11842. "name": "historyTimeToLive",
  11843. "isAttr": true,
  11844. "type": "String"
  11845. },
  11846. {
  11847. "name": "isStartableInTasklist",
  11848. "isAttr": true,
  11849. "type": "Boolean",
  11850. "default": true
  11851. }
  11852. ]
  11853. },
  11854. {
  11855. "name": "EscalationEventDefinitionExtension",
  11856. "isAbstract": true,
  11857. "extends": [
  11858. "bpmn:EscalationEventDefinition"
  11859. ],
  11860. "properties": [
  11861. {
  11862. "name": "escalationCodeVariable",
  11863. "isAttr": true,
  11864. "type": "String"
  11865. }
  11866. ]
  11867. },
  11868. {
  11869. "name": "FormalExpression",
  11870. "isAbstract": true,
  11871. "extends": [
  11872. "bpmn:FormalExpression"
  11873. ],
  11874. "properties": [
  11875. {
  11876. "name": "resource",
  11877. "isAttr": true,
  11878. "type": "String"
  11879. }
  11880. ]
  11881. },
  11882. {
  11883. "name": "Assignable",
  11884. "extends": ["bpmn:UserTask"],
  11885. "properties": [
  11886. {
  11887. "name": "assignee",
  11888. "isAttr": true,
  11889. "type": "String"
  11890. },
  11891. {
  11892. "name": "candidateUsers",
  11893. "isAttr": true,
  11894. "type": "String"
  11895. },
  11896. {
  11897. "name": "candidateGroups",
  11898. "isAttr": true,
  11899. "type": "String"
  11900. },
  11901. {
  11902. "name": "dueDate",
  11903. "isAttr": true,
  11904. "type": "String"
  11905. },
  11906. {
  11907. "name": "followUpDate",
  11908. "isAttr": true,
  11909. "type": "String"
  11910. },
  11911. {
  11912. "name": "priority",
  11913. "isAttr": true,
  11914. "type": "String"
  11915. }
  11916. ]
  11917. },
  11918. {
  11919. "name": "CallActivity",
  11920. "extends": ["bpmn:CallActivity"],
  11921. "properties": [
  11922. {
  11923. "name": "calledElementBinding",
  11924. "isAttr": true,
  11925. "type": "String",
  11926. "default": "latest"
  11927. },
  11928. {
  11929. "name": "calledElementVersion",
  11930. "isAttr": true,
  11931. "type": "String"
  11932. },
  11933. {
  11934. "name": "calledElementVersionTag",
  11935. "isAttr": true,
  11936. "type": "String"
  11937. },
  11938. {
  11939. "name": "calledElementTenantId",
  11940. "isAttr": true,
  11941. "type": "String"
  11942. },
  11943. {
  11944. "name": "caseRef",
  11945. "isAttr": true,
  11946. "type": "String"
  11947. },
  11948. {
  11949. "name": "caseBinding",
  11950. "isAttr": true,
  11951. "type": "String",
  11952. "default": "latest"
  11953. },
  11954. {
  11955. "name": "caseVersion",
  11956. "isAttr": true,
  11957. "type": "String"
  11958. },
  11959. {
  11960. "name": "caseTenantId",
  11961. "isAttr": true,
  11962. "type": "String"
  11963. },
  11964. {
  11965. "name": "variableMappingClass",
  11966. "isAttr": true,
  11967. "type": "String"
  11968. },
  11969. {
  11970. "name": "variableMappingDelegateExpression",
  11971. "isAttr": true,
  11972. "type": "String"
  11973. }
  11974. ]
  11975. },
  11976. {
  11977. "name": "ServiceTaskLike",
  11978. "extends": [
  11979. "bpmn:ServiceTask",
  11980. "bpmn:BusinessRuleTask",
  11981. "bpmn:SendTask",
  11982. "bpmn:MessageEventDefinition"
  11983. ],
  11984. "properties": [
  11985. {
  11986. "name": "expression",
  11987. "isAttr": true,
  11988. "type": "String"
  11989. },
  11990. {
  11991. "name": "class",
  11992. "isAttr": true,
  11993. "type": "String"
  11994. },
  11995. {
  11996. "name": "delegateExpression",
  11997. "isAttr": true,
  11998. "type": "String"
  11999. },
  12000. {
  12001. "name": "resultVariable",
  12002. "isAttr": true,
  12003. "type": "String"
  12004. }
  12005. ]
  12006. },
  12007. {
  12008. "name": "DmnCapable",
  12009. "extends": [
  12010. "bpmn:BusinessRuleTask"
  12011. ],
  12012. "properties": [
  12013. {
  12014. "name": "decisionRef",
  12015. "isAttr": true,
  12016. "type": "String"
  12017. },
  12018. {
  12019. "name": "decisionRefBinding",
  12020. "isAttr": true,
  12021. "type": "String",
  12022. "default": "latest"
  12023. },
  12024. {
  12025. "name": "decisionRefVersion",
  12026. "isAttr": true,
  12027. "type": "String"
  12028. },
  12029. {
  12030. "name": "mapDecisionResult",
  12031. "isAttr": true,
  12032. "type": "String",
  12033. "default": "resultList"
  12034. },
  12035. {
  12036. "name": "decisionRefTenantId",
  12037. "isAttr": true,
  12038. "type": "String"
  12039. }
  12040. ]
  12041. },
  12042. {
  12043. "name": "ExternalCapable",
  12044. "extends": [
  12045. "camunda:ServiceTaskLike"
  12046. ],
  12047. "properties": [
  12048. {
  12049. "name": "type",
  12050. "isAttr": true,
  12051. "type": "String"
  12052. },
  12053. {
  12054. "name": "topic",
  12055. "isAttr": true,
  12056. "type": "String"
  12057. }
  12058. ]
  12059. },
  12060. {
  12061. "name": "TaskPriorized",
  12062. "extends": [
  12063. "bpmn:Process",
  12064. "camunda:ExternalCapable"
  12065. ],
  12066. "properties": [
  12067. {
  12068. "name": "taskPriority",
  12069. "isAttr": true,
  12070. "type": "String"
  12071. }
  12072. ]
  12073. },
  12074. {
  12075. "name": "Properties",
  12076. "superClass": [
  12077. "Element"
  12078. ],
  12079. "meta": {
  12080. "allowedIn": ["*"]
  12081. },
  12082. "properties": [
  12083. {
  12084. "name": "values",
  12085. "type": "Property",
  12086. "isMany": true
  12087. }
  12088. ]
  12089. },
  12090. {
  12091. "name": "Property",
  12092. "superClass": [
  12093. "Element"
  12094. ],
  12095. "properties": [
  12096. {
  12097. "name": "id",
  12098. "type": "String",
  12099. "isAttr": true
  12100. },
  12101. {
  12102. "name": "name",
  12103. "type": "String",
  12104. "isAttr": true
  12105. },
  12106. {
  12107. "name": "value",
  12108. "type": "String",
  12109. "isAttr": true
  12110. }
  12111. ]
  12112. },
  12113. {
  12114. "name": "Connector",
  12115. "superClass": [
  12116. "Element"
  12117. ],
  12118. "meta": {
  12119. "allowedIn": [
  12120. "camunda:ServiceTaskLike"
  12121. ]
  12122. },
  12123. "properties": [
  12124. {
  12125. "name": "inputOutput",
  12126. "type": "InputOutput"
  12127. },
  12128. {
  12129. "name": "connectorId",
  12130. "type": "String"
  12131. }
  12132. ]
  12133. },
  12134. {
  12135. "name": "InputOutput",
  12136. "superClass": [
  12137. "Element"
  12138. ],
  12139. "meta": {
  12140. "allowedIn": [
  12141. "bpmn:FlowNode",
  12142. "camunda:Connector"
  12143. ]
  12144. },
  12145. "properties": [
  12146. {
  12147. "name": "inputOutput",
  12148. "type": "InputOutput"
  12149. },
  12150. {
  12151. "name": "connectorId",
  12152. "type": "String"
  12153. },
  12154. {
  12155. "name": "inputParameters",
  12156. "isMany": true,
  12157. "type": "InputParameter"
  12158. },
  12159. {
  12160. "name": "outputParameters",
  12161. "isMany": true,
  12162. "type": "OutputParameter"
  12163. }
  12164. ]
  12165. },
  12166. {
  12167. "name": "InputOutputParameter",
  12168. "properties": [
  12169. {
  12170. "name": "name",
  12171. "isAttr": true,
  12172. "type": "String"
  12173. },
  12174. {
  12175. "name": "value",
  12176. "isBody": true,
  12177. "type": "String"
  12178. },
  12179. {
  12180. "name": "definition",
  12181. "type": "InputOutputParameterDefinition"
  12182. }
  12183. ]
  12184. },
  12185. {
  12186. "name": "InputOutputParameterDefinition",
  12187. "isAbstract": true
  12188. },
  12189. {
  12190. "name": "List",
  12191. "superClass": ["InputOutputParameterDefinition"],
  12192. "properties": [
  12193. {
  12194. "name": "items",
  12195. "isMany": true,
  12196. "type": "InputOutputParameterDefinition"
  12197. }
  12198. ]
  12199. },
  12200. {
  12201. "name": "Map",
  12202. "superClass": ["InputOutputParameterDefinition"],
  12203. "properties": [
  12204. {
  12205. "name": "entries",
  12206. "isMany": true,
  12207. "type": "Entry"
  12208. }
  12209. ]
  12210. },
  12211. {
  12212. "name": "Entry",
  12213. "properties": [
  12214. {
  12215. "name": "key",
  12216. "isAttr": true,
  12217. "type": "String"
  12218. },
  12219. {
  12220. "name": "value",
  12221. "isBody": true,
  12222. "type": "String"
  12223. },
  12224. {
  12225. "name": "definition",
  12226. "type": "InputOutputParameterDefinition"
  12227. }
  12228. ]
  12229. },
  12230. {
  12231. "name": "Value",
  12232. "superClass": [
  12233. "InputOutputParameterDefinition"
  12234. ],
  12235. "properties": [
  12236. {
  12237. "name": "id",
  12238. "isAttr": true,
  12239. "type": "String"
  12240. },
  12241. {
  12242. "name": "name",
  12243. "isAttr": true,
  12244. "type": "String"
  12245. },
  12246. {
  12247. "name": "value",
  12248. "isBody": true,
  12249. "type": "String"
  12250. }
  12251. ]
  12252. },
  12253. {
  12254. "name": "Script",
  12255. "superClass": ["InputOutputParameterDefinition"],
  12256. "properties": [
  12257. {
  12258. "name": "scriptFormat",
  12259. "isAttr": true,
  12260. "type": "String"
  12261. },
  12262. {
  12263. "name": "resource",
  12264. "isAttr": true,
  12265. "type": "String"
  12266. },
  12267. {
  12268. "name": "value",
  12269. "isBody": true,
  12270. "type": "String"
  12271. }
  12272. ]
  12273. },
  12274. {
  12275. "name": "Field",
  12276. "superClass": ["Element"],
  12277. "meta": {
  12278. "allowedIn": [
  12279. "camunda:ServiceTaskLike",
  12280. "camunda:ExecutionListener",
  12281. "camunda:TaskListener"
  12282. ]
  12283. },
  12284. "properties": [
  12285. {
  12286. "name": "name",
  12287. "isAttr": true,
  12288. "type": "String"
  12289. },
  12290. {
  12291. "name": "expression",
  12292. "type": "String"
  12293. },
  12294. {
  12295. "name": "stringValue",
  12296. "isAttr": true,
  12297. "type": "String"
  12298. },
  12299. {
  12300. "name": "string",
  12301. "type": "String"
  12302. }
  12303. ]
  12304. },
  12305. {
  12306. "name": "InputParameter",
  12307. "superClass": ["InputOutputParameter"]
  12308. },
  12309. {
  12310. "name": "OutputParameter",
  12311. "superClass": ["InputOutputParameter"]
  12312. },
  12313. {
  12314. "name": "Collectable",
  12315. "isAbstract": true,
  12316. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12317. "superClass": ["camunda:AsyncCapable"],
  12318. "properties": [
  12319. {
  12320. "name": "collection",
  12321. "isAttr": true,
  12322. "type": "String"
  12323. },
  12324. {
  12325. "name": "elementVariable",
  12326. "isAttr": true,
  12327. "type": "String"
  12328. }
  12329. ]
  12330. },
  12331. {
  12332. "name": "FailedJobRetryTimeCycle",
  12333. "superClass": ["Element"],
  12334. "meta": {
  12335. "allowedIn": [
  12336. "camunda:AsyncCapable",
  12337. "bpmn:MultiInstanceLoopCharacteristics"
  12338. ]
  12339. },
  12340. "properties": [
  12341. {
  12342. "name": "body",
  12343. "isBody": true,
  12344. "type": "String"
  12345. }
  12346. ]
  12347. },
  12348. {
  12349. "name": "ExecutionListener",
  12350. "superClass": ["Element"],
  12351. "meta": {
  12352. "allowedIn": [
  12353. "bpmn:Task",
  12354. "bpmn:ServiceTask",
  12355. "bpmn:UserTask",
  12356. "bpmn:BusinessRuleTask",
  12357. "bpmn:ScriptTask",
  12358. "bpmn:ReceiveTask",
  12359. "bpmn:ManualTask",
  12360. "bpmn:ExclusiveGateway",
  12361. "bpmn:SequenceFlow",
  12362. "bpmn:ParallelGateway",
  12363. "bpmn:InclusiveGateway",
  12364. "bpmn:EventBasedGateway",
  12365. "bpmn:StartEvent",
  12366. "bpmn:IntermediateCatchEvent",
  12367. "bpmn:IntermediateThrowEvent",
  12368. "bpmn:EndEvent",
  12369. "bpmn:BoundaryEvent",
  12370. "bpmn:CallActivity",
  12371. "bpmn:SubProcess",
  12372. "bpmn:Process"
  12373. ]
  12374. },
  12375. "properties": [
  12376. {
  12377. "name": "expression",
  12378. "isAttr": true,
  12379. "type": "String"
  12380. },
  12381. {
  12382. "name": "class",
  12383. "isAttr": true,
  12384. "type": "String"
  12385. },
  12386. {
  12387. "name": "delegateExpression",
  12388. "isAttr": true,
  12389. "type": "String"
  12390. },
  12391. {
  12392. "name": "event",
  12393. "isAttr": true,
  12394. "type": "String"
  12395. },
  12396. {
  12397. "name": "script",
  12398. "type": "Script"
  12399. },
  12400. {
  12401. "name": "fields",
  12402. "type": "Field",
  12403. "isMany": true
  12404. }
  12405. ]
  12406. },
  12407. {
  12408. "name": "TaskListener",
  12409. "superClass": ["Element"],
  12410. "meta": {
  12411. "allowedIn": [
  12412. "bpmn:UserTask"
  12413. ]
  12414. },
  12415. "properties": [
  12416. {
  12417. "name": "expression",
  12418. "isAttr": true,
  12419. "type": "String"
  12420. },
  12421. {
  12422. "name": "class",
  12423. "isAttr": true,
  12424. "type": "String"
  12425. },
  12426. {
  12427. "name": "delegateExpression",
  12428. "isAttr": true,
  12429. "type": "String"
  12430. },
  12431. {
  12432. "name": "event",
  12433. "isAttr": true,
  12434. "type": "String"
  12435. },
  12436. {
  12437. "name": "script",
  12438. "type": "Script"
  12439. },
  12440. {
  12441. "name": "fields",
  12442. "type": "Field",
  12443. "isMany": true
  12444. },
  12445. {
  12446. "name": "id",
  12447. "type": "String",
  12448. "isAttr": true
  12449. },
  12450. {
  12451. "name": "eventDefinitions",
  12452. "type": "bpmn:TimerEventDefinition",
  12453. "isMany": true
  12454. }
  12455. ]
  12456. },
  12457. {
  12458. "name": "FormProperty",
  12459. "superClass": ["Element"],
  12460. "meta": {
  12461. "allowedIn": [
  12462. "bpmn:StartEvent",
  12463. "bpmn:UserTask"
  12464. ]
  12465. },
  12466. "properties": [
  12467. {
  12468. "name": "id",
  12469. "type": "String",
  12470. "isAttr": true
  12471. },
  12472. {
  12473. "name": "name",
  12474. "type": "String",
  12475. "isAttr": true
  12476. },
  12477. {
  12478. "name": "type",
  12479. "type": "String",
  12480. "isAttr": true
  12481. },
  12482. {
  12483. "name": "required",
  12484. "type": "String",
  12485. "isAttr": true
  12486. },
  12487. {
  12488. "name": "readable",
  12489. "type": "String",
  12490. "isAttr": true
  12491. },
  12492. {
  12493. "name": "writable",
  12494. "type": "String",
  12495. "isAttr": true
  12496. },
  12497. {
  12498. "name": "variable",
  12499. "type": "String",
  12500. "isAttr": true
  12501. },
  12502. {
  12503. "name": "expression",
  12504. "type": "String",
  12505. "isAttr": true
  12506. },
  12507. {
  12508. "name": "datePattern",
  12509. "type": "String",
  12510. "isAttr": true
  12511. },
  12512. {
  12513. "name": "default",
  12514. "type": "String",
  12515. "isAttr": true
  12516. },
  12517. {
  12518. "name": "values",
  12519. "type": "Value",
  12520. "isMany": true
  12521. }
  12522. ]
  12523. },
  12524. {
  12525. "name": "FormData",
  12526. "superClass": ["Element"],
  12527. "meta": {
  12528. "allowedIn": [
  12529. "bpmn:StartEvent",
  12530. "bpmn:UserTask"
  12531. ]
  12532. },
  12533. "properties": [
  12534. {
  12535. "name": "fields",
  12536. "type": "FormField",
  12537. "isMany": true
  12538. },
  12539. {
  12540. "name": "businessKey",
  12541. "type": "String",
  12542. "isAttr": true
  12543. }
  12544. ]
  12545. },
  12546. {
  12547. "name": "FormField",
  12548. "superClass": ["Element"],
  12549. "properties": [
  12550. {
  12551. "name": "id",
  12552. "type": "String",
  12553. "isAttr": true
  12554. },
  12555. {
  12556. "name": "label",
  12557. "type": "String",
  12558. "isAttr": true
  12559. },
  12560. {
  12561. "name": "type",
  12562. "type": "String",
  12563. "isAttr": true
  12564. },
  12565. {
  12566. "name": "datePattern",
  12567. "type": "String",
  12568. "isAttr": true
  12569. },
  12570. {
  12571. "name": "defaultValue",
  12572. "type": "String",
  12573. "isAttr": true
  12574. },
  12575. {
  12576. "name": "properties",
  12577. "type": "Properties"
  12578. },
  12579. {
  12580. "name": "validation",
  12581. "type": "Validation"
  12582. },
  12583. {
  12584. "name": "values",
  12585. "type": "Value",
  12586. "isMany": true
  12587. }
  12588. ]
  12589. },
  12590. {
  12591. "name": "Validation",
  12592. "superClass": ["Element"],
  12593. "properties": [
  12594. {
  12595. "name": "constraints",
  12596. "type": "Constraint",
  12597. "isMany": true
  12598. }
  12599. ]
  12600. },
  12601. {
  12602. "name": "Constraint",
  12603. "superClass": ["Element"],
  12604. "properties": [
  12605. {
  12606. "name": "name",
  12607. "type": "String",
  12608. "isAttr": true
  12609. },
  12610. {
  12611. "name": "config",
  12612. "type": "String",
  12613. "isAttr": true
  12614. }
  12615. ]
  12616. },
  12617. {
  12618. "name": "ConditionalEventDefinitionExtension",
  12619. "isAbstract": true,
  12620. "extends": [
  12621. "bpmn:ConditionalEventDefinition"
  12622. ],
  12623. "properties": [
  12624. {
  12625. "name": "variableName",
  12626. "isAttr": true,
  12627. "type": "String"
  12628. },
  12629. {
  12630. "name": "variableEvents",
  12631. "isAttr": true,
  12632. "type": "String"
  12633. }
  12634. ]
  12635. }
  12636. ],
  12637. "emumerations": []
  12638. };
  12639. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12640. /**
  12641. * This is a sample file that should be replaced with the actual translation.
  12642. *
  12643. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12644. * translations and labels to translate.
  12645. */
  12646. var translations = {
  12647. // Labels
  12648. 'Activate the global connect tool': '激活全局连接工具',
  12649. 'Append {type}': '追加 {type}',
  12650. 'Append EndEvent': '追加 结束事件 ',
  12651. 'Append Task': '追加 任务',
  12652. 'Append Gateway': '追加 网关',
  12653. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12654. 'Add Lane above': '在上面添加道',
  12655. 'Divide into two Lanes': '分割成两个道',
  12656. 'Divide into three Lanes': '分割成三个道',
  12657. 'Add Lane below': '在下面添加道',
  12658. 'Append compensation activity': '追加补偿活动',
  12659. 'Change type': '修改类型',
  12660. 'Connect using Association': '使用关联连接',
  12661. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12662. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12663. 'Remove': '移除',
  12664. 'Activate the hand tool': '激活抓手工具',
  12665. 'Activate the lasso tool': '激活套索工具',
  12666. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12667. 'Create expanded SubProcess': '创建扩展子过程',
  12668. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12669. 'Create Pool/Participant': '创建池/参与者',
  12670. 'Parallel Multi Instance': '并行多重事件',
  12671. 'Sequential Multi Instance': '时序多重事件',
  12672. 'DataObjectReference': '数据对象参考',
  12673. 'DataStoreReference': '数据存储参考',
  12674. 'Loop': '循环',
  12675. 'Ad-hoc': '即席',
  12676. 'Create {type}': '创建 {type}',
  12677. 'Create Task': '创建任务',
  12678. 'Create StartEvent': '创建开始事件',
  12679. 'Create EndEvent': '创建结束事件',
  12680. 'Create Group': '创建组',
  12681. 'Task': '任务',
  12682. 'Send Task': '发送任务',
  12683. 'Receive Task': '接收任务',
  12684. 'User Task': '用户任务',
  12685. 'Manual Task': '手工任务',
  12686. 'Business Rule Task': '业务规则任务',
  12687. 'Service Task': '服务任务',
  12688. 'Script Task': '脚本任务',
  12689. 'Call Activity': '调用活动',
  12690. 'Sub Process (collapsed)': '子流程(折叠的)',
  12691. 'Sub Process (expanded)': '子流程(展开的)',
  12692. 'Start Event': '开始事件',
  12693. 'StartEvent': '开始事件',
  12694. 'Intermediate Throw Event': '中间事件',
  12695. 'End Event': '结束事件',
  12696. 'EndEvent': '结束事件',
  12697. 'Create Gateway': '创建网关',
  12698. 'GateWay': '网关',
  12699. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12700. 'Message Start Event': '消息开始事件',
  12701. 'Timer Start Event': '定时开始事件',
  12702. 'Conditional Start Event': '条件开始事件',
  12703. 'Signal Start Event': '信号开始事件',
  12704. 'Error Start Event': '错误开始事件',
  12705. 'Escalation Start Event': '升级开始事件',
  12706. 'Compensation Start Event': '补偿开始事件',
  12707. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12708. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12709. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12710. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12711. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12712. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12713. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12714. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12715. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12716. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12717. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12718. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12719. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12720. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12721. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12722. 'Message End Event': '消息结束事件',
  12723. 'Escalation End Event': '定时结束事件',
  12724. 'Error End Event': '错误结束事件',
  12725. 'Cancel End Event': '取消结束事件',
  12726. 'Compensation End Event': '补偿结束事件',
  12727. 'Signal End Event': '信号结束事件',
  12728. 'Terminate End Event': '终止结束事件',
  12729. 'Message Boundary Event': '消息边界事件',
  12730. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12731. 'Timer Boundary Event': '定时边界事件',
  12732. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12733. 'Escalation Boundary Event': '升级边界事件',
  12734. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12735. 'Conditional Boundary Event': '条件边界事件',
  12736. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12737. 'Error Boundary Event': '错误边界事件',
  12738. 'Cancel Boundary Event': '取消边界事件',
  12739. 'Signal Boundary Event': '信号边界事件',
  12740. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12741. 'Compensation Boundary Event': '补偿边界事件',
  12742. 'Exclusive Gateway': '互斥网关',
  12743. 'Parallel Gateway': '并行网关',
  12744. 'Inclusive Gateway': '相容网关',
  12745. 'Complex Gateway': '复杂网关',
  12746. 'Event based Gateway': '事件网关',
  12747. 'Transaction': '转运',
  12748. 'Sub Process': '子流程',
  12749. 'Event Sub Process': '事件子流程',
  12750. 'Collapsed Pool': '折叠池',
  12751. 'Expanded Pool': '展开池',
  12752. // Errors
  12753. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12754. 'no shape type specified': '没有指定的形状类型',
  12755. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12756. 'out of bounds release': 'out of bounds release',
  12757. 'more than {count} child lanes': '子道大于{count} ',
  12758. 'element required': '元素不能为空',
  12759. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12760. 'no diagram to display': '没有可展示的流程图',
  12761. 'no process or collaboration to display': '没有可展示的流程/协作',
  12762. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12763. 'already rendered {element}': '{element} 已被渲染',
  12764. 'failed to import {element}': '导入{element}失败',
  12765. // 属性面板的参数
  12766. 'Id': '编号',
  12767. 'Name': '名称',
  12768. 'General': '常规',
  12769. 'Details': '详情',
  12770. 'Message Name': '消息名称',
  12771. 'Message': '消息',
  12772. 'Initiator': '创建者',
  12773. 'Asynchronous Continuations': '持续异步',
  12774. 'Asynchronous Before': '异步前',
  12775. 'Asynchronous After': '异步后',
  12776. 'Job Configuration': '工作配置',
  12777. 'Exclusive': '排除',
  12778. 'Job Priority': '工作优先级',
  12779. 'Retry Time Cycle': '重试时间周期',
  12780. 'Documentation': '文档',
  12781. 'Element Documentation': '元素文档',
  12782. 'History Configuration': '历史配置',
  12783. 'History Time To Live': '历史的生存时间',
  12784. 'Forms': '表单',
  12785. 'Form Key': '表单key',
  12786. 'Form Fields': '表单字段',
  12787. 'Business Key': '业务key',
  12788. 'Form Field': '表单字段',
  12789. 'ID': '编号',
  12790. 'Type': '类型',
  12791. 'Label': '名称',
  12792. 'Default Value': '默认值',
  12793. 'Validation': '校验',
  12794. 'Add Constraint': '添加约束',
  12795. 'Config': '配置',
  12796. 'Properties': '属性',
  12797. 'Add Property': '添加属性',
  12798. 'Value': '值',
  12799. 'Add': '添加',
  12800. 'Values': '值',
  12801. 'Add Value': '添加值',
  12802. 'Listeners': '监听器',
  12803. 'Execution Listener': '执行监听',
  12804. 'Event Type': '事件类型',
  12805. 'Listener Type': '监听器类型',
  12806. 'Java Class': 'Java类',
  12807. 'Expression': '表达式',
  12808. 'Must provide a value': '必须提供一个值',
  12809. 'Delegate Expression': '代理表达式',
  12810. 'Script': '脚本',
  12811. 'Script Format': '脚本格式',
  12812. 'Script Type': '脚本类型',
  12813. 'Inline Script': '内联脚本',
  12814. 'External Script': '外部脚本',
  12815. 'Resource': '资源',
  12816. 'Field Injection': '字段注入',
  12817. 'Extensions': '扩展',
  12818. 'Input/Output': '输入/输出',
  12819. 'Input Parameters': '输入参数',
  12820. 'Output Parameters': '输出参数',
  12821. 'Parameters': '参数',
  12822. 'Output Parameter': '输出参数',
  12823. 'Timer Definition Type': '定时器定义类型',
  12824. 'Timer Definition': '定时器定义',
  12825. 'Date': '日期',
  12826. 'Duration': '持续',
  12827. 'Cycle': '循环',
  12828. 'Signal': '信号',
  12829. 'Signal Name': '信号名称',
  12830. 'Escalation': '升级',
  12831. 'Error': '错误',
  12832. 'Link Name': '链接名称',
  12833. 'Condition': '条件名称',
  12834. 'Variable Name': '变量名称',
  12835. 'Variable Event': '变量事件',
  12836. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12837. 'Wait for Completion': '等待完成',
  12838. 'Activity Ref': '活动参考',
  12839. 'Version Tag': '版本标签',
  12840. 'Executable': '可执行文件',
  12841. 'External Task Configuration': '扩展任务配置',
  12842. 'Task Priority': '任务优先级',
  12843. 'External': '外部',
  12844. 'Connector': '连接器',
  12845. 'Must configure Connector': '必须配置连接器',
  12846. 'Connector Id': '连接器编号',
  12847. 'Implementation': '实现方式',
  12848. 'Field Injections': '字段注入',
  12849. 'Fields': '字段',
  12850. 'Result Variable': '结果变量',
  12851. 'Topic': '主题',
  12852. 'Configure Connector': '配置连接器',
  12853. 'Input Parameter': '输入参数',
  12854. 'Assignee': '代理人',
  12855. 'Candidate Users': '候选用户',
  12856. 'Candidate Groups': '候选组',
  12857. 'Due Date': '到期时间',
  12858. 'Follow Up Date': '跟踪日期',
  12859. 'Priority': '优先级',
  12860. // eslint-disable-next-line no-template-curly-in-string
  12861. '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',
  12862. // eslint-disable-next-line no-template-curly-in-string
  12863. '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',
  12864. 'Variables': '变量',
  12865. 'Candidate Starter Configuration': '候选开始配置',
  12866. 'Task Listener': '任务监听器',
  12867. 'Candidate Starter Groups': '候选开始组',
  12868. 'Candidate Starter Users': '候选开始用户',
  12869. 'Tasklist Configuration': '任务列表配置',
  12870. 'Startable': '启动',
  12871. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12872. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12873. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12874. 'CallActivity Type': '调用活动类型',
  12875. 'Condition Type': '条件类型',
  12876. 'Create UserTask': '创建用户任务',
  12877. 'Create CallActivity': '创建调用活动',
  12878. 'Called Element': '调用元素',
  12879. 'Create DataObjectReference': '创建数据对象引用',
  12880. 'Create DataStoreReference': '创建数据存储引用',
  12881. 'Multi Instance': '多实例',
  12882. 'Loop Cardinality': '实例数量',
  12883. Collection: '任务参与人列表',
  12884. 'Element Variable': '元素变量',
  12885. 'Completion Condition': '完成条件'
  12886. };
  12887. //# sourceMappingURL=translations.js.map
  12888. function customTranslate(template, replacements) {
  12889. replacements = replacements || {};
  12890. // Translate
  12891. template = translations[template] || template;
  12892. // Replace
  12893. return template.replace(/{([^}]+)}/g, function (_, key) {
  12894. return replacements[key] || '{' + key + '}';
  12895. });
  12896. }
  12897. //# sourceMappingURL=customTranslate.js.map
  12898. var vjson$9 = {
  12899. title: '导入流程',
  12900. layout: 'fit',
  12901. width: 400,
  12902. height: 400,
  12903. items: [
  12904. {
  12905. layout: 'border',
  12906. items: [
  12907. {
  12908. xtype: 'form',
  12909. items: [
  12910. // {
  12911. // xtype: 'cols',
  12912. // items: [
  12913. // {
  12914. // xtype: 'textfield',
  12915. // allowBlank: false,
  12916. // fieldLabel: '流程名称',
  12917. // bind: '{name}'
  12918. // },
  12919. // ],
  12920. // },
  12921. {
  12922. xtype: 'cols',
  12923. items: [
  12924. {
  12925. xtype: 'filefield',
  12926. name: 'deployFile',
  12927. fieldLabel: '文件名称',
  12928. // labelWidth: '100%',
  12929. msgTarget: 'side',
  12930. reference: 'MOBANB_FILE',
  12931. fileUpload: true,
  12932. allowBlank: false,
  12933. // flex: 1,
  12934. // width: '100%',
  12935. buttonText: '请选择文件位置',
  12936. listeners: {
  12937. change: 'scope.fileChange'
  12938. }
  12939. // bind: '{FILE}'
  12940. },
  12941. ]
  12942. }
  12943. ],
  12944. region: 'center',
  12945. split: true,
  12946. },
  12947. ],
  12948. },
  12949. ],
  12950. fbar: {
  12951. xtype: 'toolbar',
  12952. items: [
  12953. {
  12954. xtype: 'button',
  12955. text: '保存',
  12956. iconCls: 'x-fa fa-save',
  12957. listeners: {
  12958. click: 'scope.save',
  12959. },
  12960. }
  12961. ],
  12962. },
  12963. };
  12964. //# sourceMappingURL=ImportBpmn.view.js.map
  12965. var model$9 = {
  12966. data: {
  12967. name: '',
  12968. file_content: ''
  12969. }
  12970. };
  12971. //# sourceMappingURL=ImportBpmn.model.js.map
  12972. var ImportBpmn = /** @class */ (function (_super) {
  12973. __extends(ImportBpmn, _super);
  12974. function ImportBpmn() {
  12975. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  12976. }
  12977. ImportBpmn.prototype.onLoad = function () {
  12978. };
  12979. ImportBpmn.prototype.save = function (sender) {
  12980. if (this.data.file_content) {
  12981. this.dialogSuccess(this.data);
  12982. }
  12983. else {
  12984. Ext.Msg.alert('提示', "请先上传文件");
  12985. }
  12986. };
  12987. ImportBpmn.prototype.fileChange = function (e) {
  12988. var _this = this;
  12989. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  12990. var file = e.fileInputEl.dom.files[0]; //获取文件
  12991. var reader = new FileReader();
  12992. reader.readAsText(file, "UTF-8");
  12993. reader.onload = function () {
  12994. _this.data.file_content = reader.result;
  12995. };
  12996. };
  12997. return ImportBpmn;
  12998. }(Scope));
  12999. //# sourceMappingURL=ImportBpmn.js.map
  13000. var model$a = {
  13001. data: {
  13002. form_id: '',
  13003. form_name: '',
  13004. save_dir_path: '',
  13005. absolute_path: '',
  13006. form: {
  13007. id: '',
  13008. code: '',
  13009. name: '',
  13010. table: '',
  13011. controller: '',
  13012. groovy: '',
  13013. fields: [],
  13014. buttons: [],
  13015. },
  13016. }
  13017. };
  13018. //# sourceMappingURL=ConfigStrategy.model.js.map
  13019. var vjson$a = {
  13020. title: '配置适配策略',
  13021. layout: 'fit',
  13022. items: [
  13023. {
  13024. layout: 'border',
  13025. items: [
  13026. {
  13027. region: 'center',
  13028. xtype: 'yvgrid',
  13029. pagination: false,
  13030. hideFootbar: true,
  13031. plugins: {
  13032. clipboard: true,
  13033. selectionreplicator: true
  13034. },
  13035. tbar: {
  13036. xtype: 'toolbar',
  13037. items: [
  13038. {
  13039. xtype: 'button',
  13040. text: '添加策略',
  13041. iconCls: 'x-fa fa-plus-circle',
  13042. listeners: {
  13043. click: 'scope.addStrategy'
  13044. }
  13045. },
  13046. {
  13047. xtype: 'button',
  13048. text: '删除',
  13049. iconCls: 'x-fa fa-minus-circle',
  13050. listeners: {}
  13051. },
  13052. '-',
  13053. {
  13054. xtype: 'button',
  13055. text: '上移',
  13056. iconCls: 'x-fa fa-arrow-up',
  13057. listeners: {}
  13058. },
  13059. {
  13060. xtype: 'button',
  13061. text: '下移',
  13062. iconCls: 'x-fa fa-arrow-down',
  13063. listeners: {}
  13064. },
  13065. ]
  13066. },
  13067. columns: [
  13068. { xtype: 'rownumberer' },
  13069. {
  13070. header: '优先级',
  13071. dataIndex: 'priority',
  13072. width: 140,
  13073. sortable: false,
  13074. menuDisabled: true,
  13075. editor: {
  13076. selectOnFocus: true
  13077. },
  13078. },
  13079. {
  13080. header: '策略编号',
  13081. dataIndex: 'strategy_code',
  13082. width: 140,
  13083. sortable: false,
  13084. menuDisabled: true,
  13085. editor: {
  13086. selectOnFocus: true
  13087. },
  13088. },
  13089. {
  13090. header: '策略名称',
  13091. dataIndex: 'strategy_name',
  13092. width: 140,
  13093. sortable: false,
  13094. menuDisabled: true,
  13095. editor: {
  13096. selectOnFocus: true
  13097. },
  13098. },
  13099. {
  13100. header: "条件表达式",
  13101. dataIndex: "strategy_exp",
  13102. },
  13103. ],
  13104. },
  13105. {
  13106. title: '适配条件',
  13107. region: 'south',
  13108. height: '50%',
  13109. xtype: 'form',
  13110. items: [
  13111. {
  13112. xtype: 'cols',
  13113. items: [
  13114. {
  13115. xtype: 'rows',
  13116. items: [
  13117. {
  13118. xtype: 'textfield',
  13119. fieldLabel: "仓库",
  13120. },
  13121. {
  13122. xtype: 'textfield',
  13123. fieldLabel: "货主",
  13124. },
  13125. {
  13126. xtype: 'textfield',
  13127. fieldLabel: "项目",
  13128. },
  13129. {
  13130. xtype: 'textfield',
  13131. fieldLabel: "行政区划",
  13132. },
  13133. {
  13134. xtype: 'textfield',
  13135. fieldLabel: "客户",
  13136. },
  13137. {
  13138. xtype: 'textfield',
  13139. fieldLabel: "商品",
  13140. }
  13141. ]
  13142. },
  13143. {
  13144. xtype: 'rows',
  13145. margin: '8 0 0 10',
  13146. items: [
  13147. {
  13148. xtype: 'label',
  13149. html: '自定义表达式',
  13150. },
  13151. {
  13152. xtype: 'textarea',
  13153. }
  13154. ]
  13155. }
  13156. ]
  13157. }
  13158. ]
  13159. }
  13160. ]
  13161. }
  13162. ]
  13163. };
  13164. //
  13165. //# sourceMappingURL=ConfigStrategy.view.js.map
  13166. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13167. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13168. // import ReportRunner from "./ReportRunner";
  13169. var ConfigStrategy = /** @class */ (function (_super) {
  13170. __extends(ConfigStrategy, _super);
  13171. function ConfigStrategy() {
  13172. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13173. }
  13174. ConfigStrategy.prototype.onLoad = function () {
  13175. this.load();
  13176. };
  13177. ConfigStrategy.prototype.load = function () {
  13178. var _this = this;
  13179. var form_id = this.viewModel.get("form_id");
  13180. var absolute_path = this.viewModel.get("absolute_path");
  13181. var save_dir_path = this.viewModel.get("save_dir_path");
  13182. if (absolute_path && form_id) {
  13183. this.setLoading(true);
  13184. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13185. if (res.success) {
  13186. // 基础属性
  13187. _this.viewModel.set('form', res.data.form);
  13188. // 字段定义
  13189. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13190. // 按钮
  13191. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13192. }
  13193. }).finally(function () {
  13194. _this.setLoading(false);
  13195. });
  13196. }
  13197. };
  13198. ConfigStrategy.prototype.saveAll = function () {
  13199. var _this = this;
  13200. var save_dir_path = this.viewModel.get("save_dir_path");
  13201. if (!save_dir_path) {
  13202. msg("save_dir_path error");
  13203. return;
  13204. }
  13205. var form_id = this.viewModel.get("form_id");
  13206. var absolute_path = this.viewModel.get("absolute_path");
  13207. // 表格校验
  13208. if (!this.refs.form1.isValid()) {
  13209. msg("请检查表单必填项!");
  13210. return;
  13211. }
  13212. // 字段数据
  13213. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13214. delete item.id;
  13215. if (item.hide) {
  13216. delete item.hide_text;
  13217. }
  13218. else {
  13219. item.hide = item.hide_text;
  13220. delete item.hide_text;
  13221. }
  13222. if (item.readonly) {
  13223. delete item.readonly_text;
  13224. }
  13225. else {
  13226. item.readonly = item.readonly_text;
  13227. delete item.readonly_text;
  13228. }
  13229. if (item.disabled) {
  13230. delete item.disabled_text;
  13231. }
  13232. else {
  13233. item.disabled = item.disabled_text;
  13234. delete item.disabled_text;
  13235. }
  13236. if (item.required) {
  13237. delete item.required_text;
  13238. }
  13239. else {
  13240. item.required = item.required_text;
  13241. delete item.required_text;
  13242. }
  13243. return item;
  13244. });
  13245. this.viewModel.set("form.fields", gridColumnRows);
  13246. // 按钮数据
  13247. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13248. delete item.id;
  13249. return item;
  13250. });
  13251. this.viewModel.set("form.buttons", gridBtnRows);
  13252. // 查询条件
  13253. // 策略
  13254. var form = this.viewModel.get("form");
  13255. this.setLoading(true);
  13256. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13257. if (res.success) {
  13258. msg('保存成功');
  13259. handles$1.mainWindow.refs['exporerTree'].reload();
  13260. }
  13261. }).finally(function () {
  13262. _this.setLoading(false);
  13263. });
  13264. };
  13265. ConfigStrategy.prototype.addColumn = function () {
  13266. this.refs.gridColumn.getStore().add({});
  13267. };
  13268. ConfigStrategy.prototype.removeColumn = function () {
  13269. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13270. };
  13271. ConfigStrategy.prototype.calcColumn = function (sender) {
  13272. var _this = this;
  13273. var table = this.viewModel.get("form.table");
  13274. if (!table) {
  13275. msg("表名不存在!");
  13276. return;
  13277. }
  13278. this.setLoading(true);
  13279. calcColumnForm({ table: table }).then(function (res) {
  13280. if (res.success) {
  13281. msg(res.msg);
  13282. if (res.data.columns.length > 0) {
  13283. _$2.forEach(res.data.columns, function (it) {
  13284. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13285. });
  13286. }
  13287. }
  13288. }).finally(function () {
  13289. _this.setLoading(false);
  13290. });
  13291. };
  13292. ConfigStrategy.prototype.addButton = function () {
  13293. this.refs.gridButton.getStore().add({});
  13294. };
  13295. ConfigStrategy.prototype.moveUp = function (sender) {
  13296. var grid = sender.up('grid');
  13297. grid.rowMoveUp();
  13298. };
  13299. ConfigStrategy.prototype.moveDown = function (sender) {
  13300. var grid = sender.up('grid');
  13301. grid.rowMoveDown();
  13302. };
  13303. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13304. var win = new Ext.Window({
  13305. autoDestroy: true,
  13306. title: "添加(编辑)策略",
  13307. width: 400,
  13308. height: 300,
  13309. resizable: true,
  13310. closable: true,
  13311. maximizable: true,
  13312. minimizable: true,
  13313. plain: true,
  13314. // constrainHeader: true,
  13315. constrain: true,
  13316. layout: 'fit',
  13317. animateTarget: sender,
  13318. buttonAlign: 'center',
  13319. items: [
  13320. {
  13321. xtype: "form",
  13322. layout: "hbox",
  13323. margin: '10px 20px',
  13324. border: 0,
  13325. items: [
  13326. {
  13327. flex: 1,
  13328. layout: 'vbox',
  13329. items: [
  13330. {
  13331. xtype: "numberfield",
  13332. fieldLabel: "优先级",
  13333. flex: 1,
  13334. allowBlank: false,
  13335. labelWidth: 50,
  13336. width: "100%",
  13337. },
  13338. {
  13339. xtype: "textfield",
  13340. fieldLabel: "策略名称",
  13341. flex: 1,
  13342. allowBlank: false,
  13343. labelWidth: 50,
  13344. width: "100%",
  13345. },
  13346. {
  13347. xtype: "textfield",
  13348. fieldLabel: "策略编号",
  13349. flex: 1,
  13350. allowBlank: false,
  13351. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13352. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13353. labelWidth: 50,
  13354. width: "100%",
  13355. },
  13356. {
  13357. xtype: "textfield",
  13358. fieldLabel: "仓库ID",
  13359. flex: 1,
  13360. allowBlank: false,
  13361. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13362. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13363. labelWidth: 50,
  13364. width: "100%",
  13365. },
  13366. ]
  13367. },
  13368. ]
  13369. }
  13370. ],
  13371. //窗口按钮
  13372. buttons: [
  13373. {
  13374. xtype: 'button', text: '保存', handler: function (btn) {
  13375. //窗口获取表单
  13376. var form = win.down('form');
  13377. var vaildSuccess = form.isValid();
  13378. if (!vaildSuccess) {
  13379. return;
  13380. }
  13381. var filename = form.down('textfield[name="filename"]').getValue();
  13382. }
  13383. },
  13384. {
  13385. xtype: 'button', text: '取消', handler: function (btn) {
  13386. //窗口关闭
  13387. win.close();
  13388. }
  13389. }
  13390. ]
  13391. });
  13392. win.show();
  13393. };
  13394. return ConfigStrategy;
  13395. }(Scope));
  13396. //# sourceMappingURL=ConfigStrategy.js.map
  13397. var buildVjson = function () {
  13398. return {
  13399. bind: {
  13400. title: '流程编辑-{text}',
  13401. },
  13402. layout: 'fit',
  13403. items: [{
  13404. layout: 'border',
  13405. tbar: {
  13406. xtype: 'toolbar',
  13407. items: [
  13408. {
  13409. xtype: 'button',
  13410. text: '撤销',
  13411. listeners: {
  13412. click: "scope.undo"
  13413. }
  13414. },
  13415. {
  13416. xtype: 'button',
  13417. text: '还原',
  13418. listeners: {
  13419. click: "scope.redo"
  13420. }
  13421. },
  13422. {
  13423. xtype: 'button',
  13424. text: '保存',
  13425. listeners: {
  13426. click: "scope.save"
  13427. }
  13428. },
  13429. {
  13430. xtype: 'button',
  13431. text: '导入BPM',
  13432. listeners: {
  13433. click: "scope.importBpm"
  13434. }
  13435. },
  13436. {
  13437. xtype: 'button',
  13438. text: '配置适配策略',
  13439. listeners: {
  13440. click: "scope.configStrategy"
  13441. }
  13442. },
  13443. {
  13444. fieldLabel: '选择配置分支',
  13445. xtype: 'combogrid',
  13446. },
  13447. ]
  13448. },
  13449. items: [
  13450. {
  13451. xtype: "panel",
  13452. region: 'center',
  13453. reference: "bpmn_view",
  13454. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13455. },
  13456. {
  13457. split: true,
  13458. xtype: "panel",
  13459. region: 'east',
  13460. width: '30%',
  13461. reference: "bpmn_properties",
  13462. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13463. }
  13464. ],
  13465. }],
  13466. listeners: {
  13467. afterrender: 'scope.onViewRender'
  13468. }
  13469. };
  13470. };
  13471. var BpmnDesign = /** @class */ (function (_super) {
  13472. __extends(BpmnDesign, _super);
  13473. function BpmnDesign() {
  13474. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13475. _this.bpmnModeler = null;
  13476. _this.bpmnModelerName = "";
  13477. return _this;
  13478. }
  13479. BpmnDesign.prototype.onLoad = function () {
  13480. var _this = this;
  13481. _super.prototype.onLoad.call(this);
  13482. this.setLoading(true);
  13483. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13484. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13485. if (res && res.success && res.data && res.data.bpmn) {
  13486. var diagramXML = res.data.bpmn;
  13487. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13488. var elements = _this.bpmnModeler._definitions.rootElements;
  13489. if (Array.isArray(elements) && elements.length > 0) {
  13490. elements[0].name = _this.bpmnModelerName;
  13491. }
  13492. }).catch(function (err) {
  13493. msgError(err);
  13494. });
  13495. }
  13496. else {
  13497. msgError(res.msg);
  13498. }
  13499. }).finally(function () {
  13500. _this.setLoading(false);
  13501. });
  13502. };
  13503. BpmnDesign.prototype.onViewRender = function (sender) {
  13504. var customTranslateModule = {
  13505. translate: ['value', customTranslate]
  13506. };
  13507. this.bpmnModeler = new BpmnModeler({
  13508. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13509. propertiesPanel: {
  13510. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13511. },
  13512. additionalModules: [
  13513. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13514. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13515. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13516. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13517. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13518. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13519. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13520. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13521. customTranslateModule,
  13522. ],
  13523. moddleExtensions: {
  13524. camunda: camundaModdleDescriptor
  13525. },
  13526. keyboard: { bindTo: document } // 使用键盘快捷键
  13527. });
  13528. };
  13529. //开启快捷键
  13530. //modeler.get('keyboard').bind(document);
  13531. //关闭快捷键
  13532. //modeler.get('keyboard').unbind();
  13533. BpmnDesign.prototype.undo = function (sender) {
  13534. this.bpmnModeler.get('commandStack').undo();
  13535. };
  13536. BpmnDesign.prototype.redo = function (sender) {
  13537. this.bpmnModeler.get('commandStack').redo();
  13538. };
  13539. BpmnDesign.prototype.save = function (sender) {
  13540. var _this = this;
  13541. this.setLoading(true);
  13542. this.bpmnModeler.saveXML().then(function (resBpm) {
  13543. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13544. if (res.success) {
  13545. msg$1("保存成功");
  13546. }
  13547. else {
  13548. msgError(res.msg);
  13549. }
  13550. }).catch(function (e) {
  13551. var _a, _b;
  13552. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13553. msgError(msg);
  13554. }).finally(function () {
  13555. _this.setLoading(false);
  13556. });
  13557. }).catch(function (e) {
  13558. msgError(e);
  13559. _this.setLoading(false);
  13560. });
  13561. };
  13562. BpmnDesign.prototype.importBpm = function (sender) {
  13563. var _this = this;
  13564. var dlg = new ImportBpmn();
  13565. //@ts-ignore
  13566. dlg.success = function (sen, data) {
  13567. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13568. var elements = _this.bpmnModeler._definitions.rootElements;
  13569. if (Array.isArray(elements) && elements.length > 0) {
  13570. elements[0].name = _this.bpmnModelerName;
  13571. }
  13572. }).catch(function (err) {
  13573. msgError(err);
  13574. });
  13575. };
  13576. dlg.showDialog(sender, {}, {});
  13577. // this.bpmnModeler.importXML()
  13578. };
  13579. BpmnDesign.prototype.configStrategy = function (sender) {
  13580. var configStrategy = new ConfigStrategy();
  13581. configStrategy.showDialog(sender, {}, {});
  13582. };
  13583. return BpmnDesign;
  13584. }(Scope));
  13585. //# sourceMappingURL=BpmnDesign.js.map
  13586. var model$b = {
  13587. data: {
  13588. id: '',
  13589. path: '',
  13590. form: {
  13591. title: '',
  13592. sqlId: '',
  13593. }
  13594. }
  13595. };
  13596. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13597. var vjson$b = {
  13598. bind: {
  13599. title: '{title}',
  13600. },
  13601. layout: 'fit',
  13602. items: [
  13603. {
  13604. layout: 'border',
  13605. items: [
  13606. {
  13607. region: 'center',
  13608. reference: 'editor',
  13609. html: '<div class="geEditor"></div>',
  13610. listeners: {
  13611. afterrender: 'scope.editorInit'
  13612. }
  13613. },
  13614. ]
  13615. }
  13616. ]
  13617. }; //
  13618. //
  13619. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13620. var WidgetDesign$1 = /** @class */ (function (_super) {
  13621. __extends(WidgetDesign, _super);
  13622. function WidgetDesign(layoutCode, layoutName) {
  13623. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13624. _this.layoutCode = layoutCode;
  13625. _this.layoutName = layoutName;
  13626. return _this;
  13627. }
  13628. WidgetDesign.prototype.onLoad = function () {
  13629. this.viewModel.set('layoutCode', this.layoutCode);
  13630. this.viewModel.set('layoutName', this.layoutName);
  13631. if (this.layoutCode) {
  13632. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13633. }
  13634. else {
  13635. this.viewModel.set('title', '新建图纸');
  13636. }
  13637. };
  13638. WidgetDesign.prototype.reload = function () {
  13639. var _this = this;
  13640. this.setLoading(true);
  13641. loadWhLayout({
  13642. layoutCode: this.layoutCode,
  13643. layoutName: this.layoutName,
  13644. }).then(function (res) {
  13645. if (res.success) {
  13646. var xml = res.data.layoutContent;
  13647. var doc = mxUtils.parseXml(xml);
  13648. var graph = _this.editorUi.editor.graph;
  13649. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13650. }
  13651. }).finally(function () {
  13652. _this.setLoading(false);
  13653. });
  13654. };
  13655. WidgetDesign.prototype.editorInit = function (sender) {
  13656. var that = this;
  13657. var dom = $(sender.el.dom).find('.geEditor')[0];
  13658. //@ts-ignore
  13659. require(['mxgraph'], function () {
  13660. var editorUiInit = EditorUi.prototype.init;
  13661. EditorUi.prototype.init = function () {
  13662. editorUiInit.apply(this, arguments);
  13663. this.actions.get('save').funct = that.onFileSave.bind(that);
  13664. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13665. this.actions.get('open').visible = false;
  13666. this.actions.get('new').visible = false;
  13667. this.actions.get('preview').visible = false;
  13668. this.actions.get('print').visible = false;
  13669. this.actions.get('pageSetup').visible = false;
  13670. this.actions.get('help').visible = false;
  13671. this.actions.get('export').visible = false;
  13672. this.actions.get('about').visible = false;
  13673. this.menus.menus.help.setEnabled(false);
  13674. that.editorUi = this;
  13675. if (that.layoutCode) {
  13676. that.reload();
  13677. }
  13678. };
  13679. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13680. var mxLanguage = 'zh';
  13681. mxResources.loadDefaultBundle = false;
  13682. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13683. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13684. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13685. // Fixes possible asynchronous requests
  13686. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13687. // Adds bundle text to resources
  13688. mxResources.parse(xhr[0].getText());
  13689. // Configures the default graph theme
  13690. var themes = new Object();
  13691. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13692. // Main
  13693. new EditorUi(new Editor(false, themes), dom);
  13694. }, function () {
  13695. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13696. });
  13697. });
  13698. };
  13699. WidgetDesign.prototype.onDestroy = function () {
  13700. var _a;
  13701. try {
  13702. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13703. }
  13704. catch (e) {
  13705. }
  13706. };
  13707. WidgetDesign.prototype.onFileSaveAs = function () {
  13708. var _this = this;
  13709. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13710. .then(function (_a) {
  13711. var code = _a.code, name = _a.name;
  13712. _this.layoutCode = code;
  13713. _this.layoutName = name;
  13714. _this.onSave();
  13715. });
  13716. };
  13717. WidgetDesign.prototype.onSave = function () {
  13718. var _this = this;
  13719. var layoutContent = this.editorUi.getEditBlankXml();
  13720. var layoutCode = this.layoutCode;
  13721. var layoutName = this.layoutName;
  13722. if (!layoutCode || !layoutName) {
  13723. msg$1('图形编号和图形名称必填');
  13724. return;
  13725. }
  13726. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13727. this.setLoading(true);
  13728. saveWhLayout({
  13729. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13730. }).then(function (res) {
  13731. msg$1(res.msg);
  13732. handles$1.whLayout.reload();
  13733. }).finally(function () {
  13734. _this.setLoading(false);
  13735. });
  13736. };
  13737. WidgetDesign.prototype.onFileSave = function () {
  13738. if (!this.layoutCode || !this.layoutName) {
  13739. this.onFileSaveAs();
  13740. }
  13741. else {
  13742. this.onSave();
  13743. }
  13744. };
  13745. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13746. var code = _a.code, name = _a.name;
  13747. return new Promise(function (resolve, reject) {
  13748. var viewModel = new Ext.app.ViewModel({
  13749. data: {
  13750. code: code !== null && code !== void 0 ? code : '',
  13751. name: name !== null && name !== void 0 ? name : '',
  13752. }
  13753. });
  13754. var dlg = Ext.create('Ext.window.Window', {
  13755. title: '保存',
  13756. viewModel: viewModel,
  13757. layout: {
  13758. type: "vbox",
  13759. pack: "start",
  13760. align: "stretch"
  13761. },
  13762. items: [
  13763. {
  13764. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13765. bind: '{code}'
  13766. },
  13767. {
  13768. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13769. bind: '{name}'
  13770. }
  13771. ],
  13772. fbar: [
  13773. {
  13774. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13775. click: function () {
  13776. var code = viewModel.get('code');
  13777. var name = viewModel.get('name');
  13778. resolve({ code: code, name: name });
  13779. dlg.close();
  13780. }
  13781. }
  13782. },
  13783. {
  13784. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13785. click: function () {
  13786. dlg.close();
  13787. }
  13788. }
  13789. },
  13790. ]
  13791. });
  13792. dlg.show();
  13793. });
  13794. };
  13795. return WidgetDesign;
  13796. }(Scope));
  13797. //@ts-ignore
  13798. require.config({
  13799. path: {},
  13800. shim: {}
  13801. });
  13802. //# sourceMappingURL=WhLayoutDesign.js.map
  13803. // init()
  13804. var Workbench = /** @class */ (function (_super) {
  13805. __extends(Workbench, _super);
  13806. // activeModulePage: ModulePage = null
  13807. function Workbench() {
  13808. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13809. _this.name = "MainWindow";
  13810. _this.modules = [];
  13811. _this.yvgridDesign = null;
  13812. return _this;
  13813. }
  13814. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13815. if (newCard) {
  13816. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13817. }
  13818. else {
  13819. this.viewModel.set('leftTabTitle', '未选中');
  13820. }
  13821. };
  13822. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13823. get: function () {
  13824. var _a;
  13825. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13826. },
  13827. enumerable: true,
  13828. configurable: true
  13829. });
  13830. Workbench.prototype.documentKeydown = function (event) {
  13831. if (event.ctrlKey || event.metaKey) {
  13832. if (event.key.toLowerCase() === 's') {
  13833. eventBus.publish(EventType.SaveCall, {});
  13834. event.stopPropagation();
  13835. event.preventDefault();
  13836. }
  13837. else if (event.key.toLowerCase() === 'z') {
  13838. if (event.shiftKey) {
  13839. eventBus.publish(EventType.Redo, {});
  13840. event.stopPropagation();
  13841. event.preventDefault();
  13842. }
  13843. else {
  13844. eventBus.publish(EventType.Undo, {});
  13845. event.stopPropagation();
  13846. event.preventDefault();
  13847. }
  13848. }
  13849. }
  13850. };
  13851. Workbench.prototype.onLoad = function () {
  13852. var _this = this;
  13853. window["tt"] = this.refs['tt'];
  13854. window["vm"] = this.viewModel;
  13855. $('#loading').remove();
  13856. setMainWindow(this);
  13857. setStatusbar(this.down('statusbar'));
  13858. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13859. var currentProject = getCurrentProject();
  13860. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13861. // handles.fileTree.reload()
  13862. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13863. _this.showModule(rawData);
  13864. });
  13865. eventBus.subscribe(EventType.Undo, function () {
  13866. _this.onUndo();
  13867. });
  13868. eventBus.subscribe(EventType.Redo, function () {
  13869. _this.onRedo();
  13870. });
  13871. eventBus.subscribe(EventType.Cut, function (_a) {
  13872. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13873. _this.onCut(a, b, c, d);
  13874. });
  13875. eventBus.subscribe(EventType.Copy, function (_a) {
  13876. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13877. _this.onCopy(a, b, c, d);
  13878. });
  13879. eventBus.subscribe(EventType.Paste, function (_a) {
  13880. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13881. _this.onPaste(a, b, c, d);
  13882. });
  13883. eventBus.subscribe(EventType.SelectAll, function () {
  13884. _this.onSelectAll();
  13885. });
  13886. eventBus.subscribe(EventType.SelectAll, function () {
  13887. _this.onSelectAll();
  13888. });
  13889. eventBus.subscribe(EventType.RunCheckModule, function () {
  13890. _this.runCheckModule();
  13891. });
  13892. eventBus.subscribe(EventType.StopCheckModule, function () {
  13893. _this.stopCheckModule();
  13894. });
  13895. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13896. _this.onCompoentContextMenu(args);
  13897. });
  13898. this.runCheckModule();
  13899. };
  13900. Workbench.prototype.onCompoentContextMenu = function (args) {
  13901. var _this = this;
  13902. if (!this.yvgridDesign) {
  13903. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13904. this.yvgridDesign.showDialog(null, {}, {});
  13905. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13906. this.yvgridDesign.onDestroy = function () {
  13907. fn_1();
  13908. _this.yvgridDesign = null;
  13909. };
  13910. }
  13911. };
  13912. Workbench.prototype.runCheckModule = function () {
  13913. var _this = this;
  13914. if (this.checkTimer) {
  13915. return;
  13916. }
  13917. this.checkTimer = setInterval(function () {
  13918. var _a;
  13919. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13920. _this.activeModulePage.check();
  13921. }
  13922. }, 5000);
  13923. };
  13924. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13925. var dlg = new WidgetDesign(widgetPath, widgetName);
  13926. dlg.showPage({
  13927. id: 'widget_' + widgetPath,
  13928. path: 'widget_' + widgetPath,
  13929. }, {
  13930. data: {
  13931. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13932. }
  13933. });
  13934. dlg.dialogSuccess = successCallback;
  13935. };
  13936. Workbench.prototype.stopCheckModule = function () {
  13937. clearInterval(this.checkTimer);
  13938. this.checkTimer = null;
  13939. };
  13940. Workbench.prototype.showDataSync = function () {
  13941. var ins = new DbSync();
  13942. ins.showPage({
  13943. id: 'db_sync__',
  13944. path: 'db_sync__',
  13945. }, {
  13946. data: {}
  13947. });
  13948. };
  13949. /**
  13950. * 打开一个项目
  13951. */
  13952. Workbench.prototype.openProject = function (project) {
  13953. setCurrentProject(project);
  13954. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  13955. handles$1.fileTree.reload();
  13956. };
  13957. /**
  13958. * 打开模板开发面板
  13959. */
  13960. Workbench.prototype.showTemplateDev = function () {
  13961. var ins = new TemplateDev();
  13962. ins.showPage({
  13963. id: 'template_dev__',
  13964. path: 'template_dev__',
  13965. }, {
  13966. data: {}
  13967. });
  13968. };
  13969. Workbench.prototype.openScope = function () {
  13970. };
  13971. /**
  13972. * 显示字段域管理器
  13973. */
  13974. Workbench.prototype.showColumnDomain = function () {
  13975. var instance = new DbDomain();
  13976. instance.showPage({
  13977. id: 'domain__',
  13978. path: 'domain__',
  13979. }, {
  13980. data: {}
  13981. });
  13982. };
  13983. /**
  13984. * 显示性能统计
  13985. */
  13986. Workbench.prototype.showPerform = function () {
  13987. // const instance = new PerformStats()
  13988. // instance.showPage({
  13989. // id: 'perform__',
  13990. // path: 'perform__',
  13991. //
  13992. // }, {
  13993. // data: {}
  13994. // })
  13995. };
  13996. /**
  13997. * 显示数据库代码模板库
  13998. */
  13999. Workbench.prototype.showDbCodeTemplate = function () {
  14000. // const instance = new DbCodeTemplate()
  14001. // instance.showPage({
  14002. // id: 'dbcode__',
  14003. // path: 'dbcode__',
  14004. //
  14005. // }, {
  14006. // data: {}
  14007. // })
  14008. };
  14009. /**
  14010. * 显示数据库代码模板库
  14011. */
  14012. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14013. var instance = new ReportDesign();
  14014. instance.showPage({
  14015. id: 'report_' + report_id,
  14016. path: 'report_' + report_id,
  14017. }, {
  14018. data: {
  14019. report_id: report_id,
  14020. report_name: report_name,
  14021. }
  14022. });
  14023. instance.dialogSuccess = success;
  14024. };
  14025. /**
  14026. * 显示报表
  14027. */
  14028. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14029. instance.showPage({
  14030. id: 'REPORT__' + report_id,
  14031. path: 'REPORT__' + report_id,
  14032. }, {
  14033. data: {
  14034. report_id: report_id,
  14035. }
  14036. });
  14037. var reportName = instance.viewModel.get('report_name');
  14038. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14039. };
  14040. /**
  14041. * 显示运维页面
  14042. */
  14043. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14044. // const instance = new DevOpsTerminal()
  14045. // instance.showPage({
  14046. // id: 'ops_' + opsId,
  14047. // path: 'ops_' + opsId,
  14048. //
  14049. // }, {
  14050. // data: {
  14051. // opsId: opsId,
  14052. // name: name,
  14053. // }
  14054. // })
  14055. // instance.dialogSuccess = success
  14056. };
  14057. /**
  14058. * 显示表结构
  14059. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14060. * columnName 可以为空
  14061. */
  14062. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14063. var id = 'tableColumn_' + tableName;
  14064. var isCreateTable = false;
  14065. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14066. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14067. if (!tableName) {
  14068. id = _$2.uniqueId('new_table');
  14069. tableName = id;
  14070. isCreateTable = true;
  14071. }
  14072. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14073. instance.showPage({
  14074. id: id,
  14075. path: id,
  14076. locatPath: locatPath
  14077. }, {
  14078. data: {
  14079. tableName: tableName,
  14080. columnName: columnName
  14081. }
  14082. });
  14083. };
  14084. /**
  14085. * 打开某个模块
  14086. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14087. */
  14088. Workbench.prototype.showModule = function (rawData) {
  14089. var id = rawData.id, path = rawData.path;
  14090. var separator = '/';
  14091. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14092. var module = this.modules[idx];
  14093. var pageId = path.replaceAll('/', '_');
  14094. console.log('open module', module);
  14095. var instance = new ModulePage(id, module);
  14096. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14097. instance.showPage({
  14098. id: 'module_' + pageId,
  14099. path: path,
  14100. title: module.name
  14101. }, {
  14102. data: {}
  14103. });
  14104. };
  14105. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14106. var bpmnDesign = new BpmnDesign();
  14107. bpmnDesign.showPage({}, {
  14108. data: {
  14109. absolutePath: absolutePath,
  14110. id: id,
  14111. text: text
  14112. }
  14113. });
  14114. };
  14115. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14116. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14117. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14118. layoutDesign.showPage({
  14119. id: id,
  14120. path: id,
  14121. }, {
  14122. data: {}
  14123. });
  14124. };
  14125. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14126. var _a;
  14127. // this.activeModulePage = newCard.yvanScope
  14128. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14129. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14130. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14131. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14132. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14133. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14134. eventBus.publish(EventType.MainTabChange, {
  14135. moduleId: newCard.yvanScope.moduleId,
  14136. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14137. from: this.name
  14138. });
  14139. };
  14140. Workbench.prototype.onUndo = function () {
  14141. var _a;
  14142. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14143. };
  14144. Workbench.prototype.onRedo = function () {
  14145. var _a;
  14146. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14147. };
  14148. Workbench.prototype.onCut = function (a, b, c, d) {
  14149. var _a;
  14150. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14151. };
  14152. Workbench.prototype.onCopy = function (a, b, c, d) {
  14153. var _a;
  14154. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14155. };
  14156. Workbench.prototype.onPaste = function (a, b, c, d) {
  14157. var _a;
  14158. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14159. };
  14160. Workbench.prototype.onSelectAll = function () {
  14161. var _a;
  14162. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14163. };
  14164. return Workbench;
  14165. }(Scope));
  14166. (function (FuncDomain) {
  14167. FuncDomain["SCOPE"] = "scope";
  14168. FuncDomain["SYSTEM"] = "system";
  14169. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14170. (function (BizMode) {
  14171. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14172. BizMode[BizMode["query"] = 1] = "query";
  14173. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14174. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14175. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14176. })(exports.BizMode || (exports.BizMode = {}));
  14177. (function (BizFormat) {
  14178. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14179. BizFormat[BizFormat["button"] = 1] = "button";
  14180. BizFormat[BizFormat["progress"] = 2] = "progress";
  14181. BizFormat[BizFormat["date"] = 3] = "date";
  14182. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14183. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14184. })(exports.BizFormat || (exports.BizFormat = {}));
  14185. (function (BizUnique) {
  14186. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14187. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14188. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14189. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14190. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14191. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14192. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14193. })(exports.BizUnique || (exports.BizUnique = {}));
  14194. var ScopeEngine = /** @class */ (function () {
  14195. function ScopeEngine() {
  14196. }
  14197. ScopeEngine.getBizFile = function (director) {
  14198. return new Promise(function (resolve, reject) {
  14199. debugger;
  14200. });
  14201. };
  14202. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14203. return new Promise(function (resolve, reject) {
  14204. var requireArr = [];
  14205. var requireKeyArr = [];
  14206. _$2.forOwn(billFile.domains, function (v, k) {
  14207. requireArr.push(v.domain);
  14208. requireKeyArr.push(k);
  14209. if (v.layout) {
  14210. requireArr.push(v.layout);
  14211. requireKeyArr.push(k + "_layout");
  14212. }
  14213. });
  14214. requireArr.push(billFile.layout);
  14215. requireKeyArr.push("layout");
  14216. requireArr.push(billFile.converter);
  14217. requireKeyArr.push("converter");
  14218. // @ts-ignore
  14219. require(requireArr, function () {
  14220. var requireReArr = [];
  14221. for (var _i = 0; _i < arguments.length; _i++) {
  14222. requireReArr[_i] = arguments[_i];
  14223. }
  14224. if (requireReArr.length <= 0) {
  14225. reject(new Error("没有加载到相关的文件!"));
  14226. }
  14227. var domains = {};
  14228. for (var i = 0; i < requireReArr.length - 2; i++) {
  14229. if (requireKeyArr[i].endsWith("_layout")) {
  14230. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14231. domains[key_d].layout = requireReArr[i].default;
  14232. }
  14233. else {
  14234. domains[requireKeyArr[i]] = requireReArr[i].default;
  14235. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14236. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14237. }
  14238. }
  14239. var bizFile = {
  14240. bill: billFile,
  14241. domains: domains,
  14242. layout: requireReArr[requireReArr.length - 2].default,
  14243. converter: requireReArr[requireReArr.length - 1].default,
  14244. };
  14245. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14246. scope.billSetting = bizFile;
  14247. resolve(scope);
  14248. });
  14249. });
  14250. };
  14251. ScopeEngine.buildScopeFromPath = function (path) {
  14252. return new Promise(function (resolve, reject) {
  14253. // @ts-ignore
  14254. require([path], function (bill) {
  14255. bill = bill.default;
  14256. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14257. resolve(scope);
  14258. }).catch(function (e) {
  14259. reject(e);
  14260. });
  14261. });
  14262. });
  14263. };
  14264. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14265. var controller = {};
  14266. var vjson = {
  14267. layout: 'fit',
  14268. title: bizFile.bill.name,
  14269. items: []
  14270. };
  14271. var model = {};
  14272. if (bizFile.layout.layout === "fit") {
  14273. vjson.items = bizFile.layout.items;
  14274. }
  14275. else if (bizFile.layout.layout === "border") {
  14276. vjson.items = [bizFile.layout];
  14277. }
  14278. var domainsVjson = {};
  14279. _$2.forOwn(bizFile.domains, function (v, k) {
  14280. var domainVjson = null;
  14281. var buttons = bizFile.domains[k].buttons;
  14282. if (bizFile.bill.domains[k].mode === "form") {
  14283. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14284. if (Array.isArray(buttons) && buttons.length > 0) {
  14285. if (bizFile.bill.domains[k].type === "header") {
  14286. vjson.tbar = {
  14287. xtype: 'toolbar',
  14288. items: ScopeEngine.buildButton(controller, buttons)
  14289. };
  14290. }
  14291. else {
  14292. domainVjson.items.push({
  14293. xtype: "cols",
  14294. items: ScopeEngine.buildButton(controller, buttons)
  14295. });
  14296. }
  14297. }
  14298. }
  14299. else if (bizFile.bill.domains[k].mode === "table") {
  14300. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14301. if (Array.isArray(buttons) && buttons.length > 0) {
  14302. if (bizFile.bill.domains[k].type === "header") {
  14303. vjson.tbar = {
  14304. xtype: 'toolbar',
  14305. items: ScopeEngine.buildButton(controller, buttons)
  14306. };
  14307. }
  14308. else {
  14309. domainVjson.tbar = {
  14310. xtype: 'toolbar',
  14311. items: ScopeEngine.buildButton(controller, buttons)
  14312. };
  14313. }
  14314. }
  14315. }
  14316. if (domainVjson) {
  14317. domainsVjson[k] = domainVjson;
  14318. }
  14319. });
  14320. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14321. var scope = new Scope({ model: model, vjson: vjson });
  14322. scope['bill_define'] = bizFile;
  14323. _$2.merge(scope, controller);
  14324. console.log('bill_define', vjson, scope, scope['bill_define']);
  14325. return scope;
  14326. };
  14327. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14328. var fieldGroups = {};
  14329. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14330. var field = bizFile.domains[domainKey].fields[i];
  14331. var item = { sort: field.form_sort };
  14332. item.xtype = field.xtype;
  14333. item.fieldLabel = field.column_desc;
  14334. item.bind = {
  14335. value: "{" + domainKey + "." + field.column_name + "}",
  14336. };
  14337. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14338. // if (field.disabled !== "true" && field.disabled !== "false") {
  14339. // item.bind.disabled = eval(field.disabled)
  14340. // } else {
  14341. // item.disabled = (field.disabled === "true")
  14342. // }
  14343. // if (field.readonly !== "true" && field.readonly !== "false") {
  14344. // item.bind.disabled = eval(field.readonly)
  14345. // } else {
  14346. // item.readonly = (field.readonly === "true")
  14347. // }
  14348. // if (field.required !== "true" && field.required !== "false") {
  14349. // item.bind.required = eval(field.required)
  14350. // } else {
  14351. // item.required = (field.required === "true")
  14352. // }
  14353. // if (field.hide !== "true" && field.hide !== "false") {
  14354. // item.bind.hidden = eval(field.hide)
  14355. // } else {
  14356. // item.hidden = (field.hide === "true")
  14357. // }
  14358. // item.flex = field.
  14359. if (field.dict) {
  14360. item.fix = eval(field.dict);
  14361. }
  14362. // _.set(formModel, "", "")
  14363. item.field = field;
  14364. if (field.form_group) {
  14365. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14366. fieldGroups[field.form_group] = [item];
  14367. }
  14368. else {
  14369. fieldGroups[field.form_group].push(item);
  14370. }
  14371. }
  14372. }
  14373. var formVjson = {
  14374. xtype: "form",
  14375. title: bizFile.domains[domainKey].name,
  14376. items: []
  14377. };
  14378. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14379. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14380. if (items) {
  14381. var fieldsetVjson = {
  14382. xtype: "fieldset",
  14383. title: k,
  14384. items: items
  14385. };
  14386. formVjson.items.push(fieldsetVjson);
  14387. }
  14388. });
  14389. return formVjson;
  14390. };
  14391. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14392. // const vjson = { xtype: "grid", items: []}
  14393. var gridVjson = {
  14394. xtype: "yvgrid",
  14395. columns: [],
  14396. split: true,
  14397. reference: domainKey,
  14398. listeners: {
  14399. itemdblclick: function () {
  14400. },
  14401. },
  14402. };
  14403. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14404. var field = bizFile.domains[domainKey].fields[i];
  14405. gridVjson.columns.push({
  14406. dataIndex: field.column_name,
  14407. header: field.column_desc,
  14408. });
  14409. }
  14410. return gridVjson;
  14411. };
  14412. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14413. var colGroups = [{
  14414. xtype: "cols",
  14415. items: []
  14416. }];
  14417. var colGroup = colGroups[0];
  14418. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14419. for (var i = 0; i < fieldGroup.length; i++) {
  14420. var field = fieldGroup[i];
  14421. if (field.field.form_newline === "true") {
  14422. if (colGroup.items.length > 0) {
  14423. colGroup = {
  14424. xtype: "cols",
  14425. items: [field]
  14426. };
  14427. colGroups.push(colGroup);
  14428. }
  14429. }
  14430. else {
  14431. colGroup.items.push(field);
  14432. }
  14433. delete field.field;
  14434. }
  14435. return colGroups;
  14436. };
  14437. ScopeEngine.buildButton = function (controller, buttons) {
  14438. var buttonsVjson = [];
  14439. var _loop_1 = function (i) {
  14440. var item = buttons[i];
  14441. var button = {
  14442. xtype: "button",
  14443. text: item.btn_name,
  14444. iconCls: item.icon
  14445. };
  14446. if (item.hidden === "true" || item.hidden === "false") {
  14447. button.hidden = (item.hidden === "true");
  14448. }
  14449. if (item.listeners) {
  14450. var listeners_1 = {};
  14451. _$2.forOwn(item.listeners, function (v, k) {
  14452. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14453. listeners_1[k] = v;
  14454. }
  14455. else {
  14456. try {
  14457. listeners_1[k] = eval(v);
  14458. }
  14459. catch (e) {
  14460. throw e;
  14461. }
  14462. }
  14463. });
  14464. button.listeners = listeners_1;
  14465. }
  14466. buttonsVjson.push(button);
  14467. };
  14468. for (var i = 0; i < buttons.length; i++) {
  14469. _loop_1(i);
  14470. }
  14471. return buttonsVjson;
  14472. };
  14473. ScopeEngine.buildListeners = function (controller, item) {
  14474. if (!item.hasOwnProperty("listeners")) {
  14475. return;
  14476. }
  14477. _$2.forOwn(item.listeners, function (v, k) {
  14478. if (v && typeof v === "string") {
  14479. if (v.indexOf(".") > -1) {
  14480. var strArr = v.split(".");
  14481. if (strArr.length != 2) {
  14482. console.error(item.listeners, "语法解析错误,请检查!");
  14483. }
  14484. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14485. switch (funcDomain) {
  14486. case exports.FuncDomain.SCOPE:
  14487. controller[k] = findCustFunc(item, k);
  14488. break;
  14489. case exports.FuncDomain.SYSTEM:
  14490. break;
  14491. default:
  14492. throw new Error("错误的函数域定义");
  14493. }
  14494. }
  14495. else {
  14496. var func = eval(v);
  14497. if (typeof func === 'function') {
  14498. controller[k] = func;
  14499. }
  14500. throw new Error("解析自定义函数出错");
  14501. }
  14502. }
  14503. });
  14504. var findCustFunc = function (item, funcName) {
  14505. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14506. throw new Error("没有找到相关的函数定义");
  14507. }
  14508. var func = eval(item[funcName]);
  14509. if (typeof func === 'function') {
  14510. return func;
  14511. }
  14512. throw new Error("解析自定义函数出错");
  14513. };
  14514. };
  14515. /**
  14516. * 只检索 items 的模式,深度遍历 vjson
  14517. */
  14518. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14519. if (Array.isArray(vjson)) {
  14520. for (var i = 0; i < vjson.length; i++) {
  14521. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14522. }
  14523. }
  14524. else {
  14525. _$2.forOwn(vjson, function (v, k) {
  14526. if (k !== "domain") {
  14527. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14528. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14529. }
  14530. }
  14531. else {
  14532. delete vjson.domain;
  14533. _$2.merge(vjson, domainsVjson[v]);
  14534. }
  14535. });
  14536. }
  14537. };
  14538. return ScopeEngine;
  14539. }());
  14540. //# sourceMappingURL=ScopeEngine.js.map
  14541. function initComponent () {
  14542. var ct = Ext.Component.prototype.constructor;
  14543. Ext.Component.override({
  14544. constructor: function (config) {
  14545. if (!isDesignMode(this, config)) {
  14546. var me_1 = this;
  14547. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14548. _$2.each(baseConfigProcessList, function (process) {
  14549. process.call(me_1, me_1, config);
  14550. });
  14551. }
  14552. ct.call(this, config);
  14553. }
  14554. });
  14555. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14556. Ext.picker.Date.override({
  14557. initComponent: function () {
  14558. var me = this;
  14559. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14560. _initComponent.call(me);
  14561. },
  14562. selectToday: function () {
  14563. var me = this, btn = me.todayBtn, handler = me.handler;
  14564. if (btn && !btn.disabled) {
  14565. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14566. me.fireEvent('select', me, me.value);
  14567. if (handler) {
  14568. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14569. }
  14570. me.onSelect();
  14571. }
  14572. return me;
  14573. },
  14574. });
  14575. }
  14576. //# sourceMappingURL=component.js.map
  14577. function initMainTab () {
  14578. Ext.define('Yvan.MainTab', {
  14579. extend: 'Ext.tab.Panel',
  14580. xtype: 'maintab',
  14581. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14582. closeTabText: '关闭',
  14583. closeOthersTabsText: '关闭其他',
  14584. closeAllTabsText: '关闭所有'
  14585. }),
  14586. constructor: function (config) {
  14587. var me = this;
  14588. var newConfig = _$2.defaultsDeep({
  14589. // 强制属性
  14590. }, config);
  14591. this.superclass.constructor.call(me, newConfig);
  14592. },
  14593. initComponent: function () {
  14594. var me = this;
  14595. this.on({
  14596. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14597. _$2.defer(function () {
  14598. me.changeHash(newCard.id);
  14599. window['cp'] = newCard.yvanScope;
  14600. });
  14601. $$2(window).trigger('tabChange', {
  14602. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14603. });
  14604. },
  14605. afterrender: function () {
  14606. _$2.defer(function () {
  14607. me.tryRestoryPage();
  14608. });
  14609. }
  14610. });
  14611. this.superclass.initComponent.call(me);
  14612. },
  14613. tryRestoryPage: function () {
  14614. var me = this;
  14615. var hash = '' + window.location.hash;
  14616. if (hash && hash.indexOf('page=') > 0) {
  14617. if (hash.startsWith('#')) {
  14618. hash = hash.substr(1);
  14619. }
  14620. if (hash) {
  14621. var page = Qs.parse(hash).page;
  14622. if (page) {
  14623. // this.openScope(page)
  14624. me.fireEvent('restorypage', page);
  14625. }
  14626. }
  14627. }
  14628. },
  14629. changeHash: function (id) {
  14630. window.location.hash = Qs.stringify({ page: id });
  14631. },
  14632. /**
  14633. * 添加一个业务模块实例到选项卡
  14634. * @param scopeInstance 业务对象实例
  14635. * @param config ExtJS配置对象
  14636. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14637. */
  14638. addScope: function (scopeInstance, config, panelInitCallback) {
  14639. scopeInstance.topScope = scopeInstance;
  14640. var me = this;
  14641. if (config.path) {
  14642. for (var i = 0; i < this.items.items.length; i++) {
  14643. // 找到当前 tabs 里有没有已经打开过
  14644. var tab = this.items.items[i];
  14645. if (_$2.isEqual(tab.path, config.path)) {
  14646. // 激活
  14647. this.setActiveTab(tab);
  14648. return tab;
  14649. }
  14650. }
  14651. }
  14652. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14653. if (typeof panelInitCallback === 'function') {
  14654. panelInitCallback(newPanel);
  14655. }
  14656. // 添加业务模块
  14657. var newTab = this.add(newPanel);
  14658. this.setActiveTab(newTab);
  14659. newTab.on({
  14660. destroy: function (sender) {
  14661. me.changeHash('');
  14662. delete window['cp'];
  14663. }
  14664. });
  14665. return newTab;
  14666. }
  14667. });
  14668. }
  14669. //# sourceMappingURL=MainTab.js.map
  14670. /**
  14671. * 构建所有组件的公共属性
  14672. * @param config 原始config
  14673. * @param dragType 组件模式
  14674. * 不填,代表不能在设计时被拖拽
  14675. * row-container 是一个rows容器
  14676. * col-container 是一个cols容器
  14677. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14678. * row-item rows中的一行,比如 tree / grid / panel 等等
  14679. */
  14680. function baseConfig(config, dragType) {
  14681. // if (isDesignMode(config, undefined) && dragType) {
  14682. if (typeof config === 'object') {
  14683. var cc = '';
  14684. switch (dragType) {
  14685. case "cols-container":
  14686. cc = 'design_cols_container';
  14687. break;
  14688. case "col-item":
  14689. cc = 'design_col_item';
  14690. break;
  14691. case "rows-container":
  14692. cc = 'design_rows_container';
  14693. break;
  14694. case "row-item":
  14695. cc = 'design_row_item';
  14696. break;
  14697. }
  14698. if (typeof config.cls === 'string') {
  14699. _$2.extend(config, {
  14700. cls: [config.cls, 'yvan_design', cc]
  14701. });
  14702. }
  14703. else if (_$2.isArray(config.cls)) {
  14704. _$2.extend(config, {
  14705. cls: __spread(config.cls, ['yvan_design', cc])
  14706. });
  14707. }
  14708. else {
  14709. _$2.extend(config, {
  14710. cls: ['yvan_design', cc]
  14711. });
  14712. }
  14713. }
  14714. return config;
  14715. }
  14716. //# sourceMappingURL=base.js.map
  14717. function initPanel () {
  14718. /**
  14719. *
  14720. */
  14721. var ct = Ext.panel.Panel.prototype.constructor;
  14722. Ext.panel.Panel.override({
  14723. constructor: function (config) {
  14724. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14725. ct.call(this, newConfig);
  14726. }
  14727. });
  14728. var ss = Ext.form.FieldContainer.prototype;
  14729. Ext.form.FieldContainer.override({
  14730. config: __assign({}, fieldContainer)
  14731. });
  14732. }
  14733. //# sourceMappingURL=panel.js.map
  14734. function initGridColumn () {
  14735. var ct = Ext.grid.column.Column.prototype.constructor;
  14736. Ext.grid.column.Column.override({
  14737. constructor: function (config) {
  14738. var scope = lookupScope(config.$initParent.$initParent);
  14739. var newConfig = _$2.defaults({}, config, column);
  14740. if (typeof newConfig.summaryRenderer === 'string') {
  14741. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14742. if (typeof newConfig.summaryRenderer === 'function') {
  14743. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14744. }
  14745. }
  14746. if (config.formatter === 'datetime') {
  14747. newConfig.fix = ['system.formatDate()'];
  14748. delete newConfig.formatter;
  14749. }
  14750. // 在 grid.constructor 已经转换过了
  14751. // if (typeof newConfig.renderer === 'string') {
  14752. // newConfig.renderer = lookupFn(scope, config.renderer)
  14753. // if (typeof newConfig.renderer === 'function') {
  14754. // newConfig.renderer = newConfig.renderer.bind(scope)
  14755. // }
  14756. // }
  14757. ct.call(this, newConfig);
  14758. }
  14759. });
  14760. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14761. Ext.grid.column.Action.override({
  14762. constructor: function (config) {
  14763. var scope = lookupScope(config.$initParent.$initParent);
  14764. _$2.forEach(config.items, function (item) {
  14765. if (typeof item.handler === 'string') {
  14766. item.handler = lookupFn(scope, item.handler);
  14767. if (typeof item.handler === 'function') {
  14768. item.handler = item.handler.bind(scope);
  14769. }
  14770. }
  14771. });
  14772. ctAction.call(this, config);
  14773. }
  14774. });
  14775. var ck = Ext.grid.column.Check.prototype.constructor;
  14776. Ext.grid.column.Check.override({
  14777. constructor: function (config) {
  14778. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14779. var grid = sender.view.grid.ownerGrid;
  14780. var column = grid.getColumns()[sender.fullColumnIndex];
  14781. var context = {
  14782. event: e,
  14783. column: column,
  14784. field: sender.dataIndex,
  14785. value: checked,
  14786. record: record,
  14787. rowIdx: rowIndex
  14788. };
  14789. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14790. });
  14791. ck.call(this, config);
  14792. }
  14793. });
  14794. // 227573
  14795. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14796. // Ext.define('Yvan.ColumnOverride', {
  14797. // override: 'Ext.grid.column.Column',
  14798. //
  14799. // config: {
  14800. // enableSortOnClick: false,
  14801. // },
  14802. //
  14803. // // /**@Overrides*/
  14804. // onTitleElClick: function (e, t, sortOnClick) {
  14805. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14806. // if (!$(e.target).is('.x-column-header-trigger')) {
  14807. // // 不是点击菜单的情况下,让列自适应宽度
  14808. // this.autoSize()
  14809. // }
  14810. // return onTitleElClick.call(this, e, t, false)
  14811. // }
  14812. // });
  14813. }
  14814. //# sourceMappingURL=gridcolumn.js.map
  14815. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14816. /**
  14817. * 判断目标字符串与关键字是否重叠
  14818. * @param target 目标字符串
  14819. * @param keyword 搜索关键字
  14820. */
  14821. function pinyinMatch(target, keyword) {
  14822. if (typeof target != 'string' || typeof keyword != 'string') {
  14823. return false;
  14824. }
  14825. if (!keyword || !target) {
  14826. return false;
  14827. }
  14828. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14829. keyword = _$2.toLower(keyword);
  14830. var pos1 = _$2.toLower(target).indexOf(keyword);
  14831. if (pos1 >= 0) {
  14832. return true;
  14833. }
  14834. var len = _$2.intersection(keyword.split('')).length;
  14835. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14836. return true;
  14837. }
  14838. return false;
  14839. }
  14840. /**
  14841. * 对某个表达式进行求值
  14842. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14843. *
  14844. * @example
  14845. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14846. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14847. *
  14848. * @param data 数据环境对象
  14849. * @param express 表达式对象
  14850. */
  14851. function calcExpress(data, express) {
  14852. var result = express;
  14853. if (SIMPLE_RE.test(express)) {
  14854. // '{foo}' 简单表达式
  14855. var path = express.substring(1, express.length - 1);
  14856. var ret = _$2.get(data, path);
  14857. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14858. }
  14859. while (true) {
  14860. var mlist = result.match(/{(.*?)}/);
  14861. if (!mlist) {
  14862. break;
  14863. }
  14864. var pathC = mlist[0]; // {query.a}
  14865. var path = mlist[1]; // query.a
  14866. var value = _$2.get(data, path);
  14867. result = result.replaceAll(pathC, value || '');
  14868. }
  14869. return result;
  14870. }
  14871. /**
  14872. * 对个对象进行表达式求值,不用回调
  14873. * @example
  14874. * 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}'] })
  14875. *
  14876. * {
  14877. * a: '{query.a}',
  14878. * b: {
  14879. * b1: '{query.b1}',
  14880. * b2: '{query.b2}',
  14881. * },
  14882. * c: 'aa',
  14883. * d: [
  14884. * '{query.d1}',
  14885. * '{query.d2}'
  14886. * ]
  14887. * }
  14888. *
  14889. * 计算结果为
  14890. * {
  14891. * a: 'aValue',
  14892. * b: {
  14893. * b1: 'b1Value',
  14894. * b2: 'b2Value'
  14895. * },
  14896. * c: 'aa'
  14897. * d: [
  14898. * '1',
  14899. * '2'
  14900. * ]
  14901. * }
  14902. *
  14903. * @param data
  14904. * @param paramObject
  14905. */
  14906. function calcObjectFlat(data, paramObject) {
  14907. var result = _$2.cloneDeep(paramObject);
  14908. if (typeof paramObject === 'string') {
  14909. return calcExpress(data, paramObject);
  14910. }
  14911. var trav = function (param) {
  14912. _$2.forOwn(param, function (value, key) {
  14913. if (_$2.isPlainObject(value)) {
  14914. // 深度递归,对子对象进行求解
  14915. trav(value);
  14916. }
  14917. else if (_$2.isString(value)) {
  14918. // 字符串直接用 calcExpress 表达式求解
  14919. param[key] = calcExpress(data, param[key]);
  14920. }
  14921. else if (_$2.isArray(value)) {
  14922. // 数组求解
  14923. _$2.each(value, function (v, idx) {
  14924. value[idx] = calcExpress(data, v);
  14925. });
  14926. }
  14927. });
  14928. };
  14929. trav(result);
  14930. return result;
  14931. }
  14932. /**
  14933. * 合併 data 到當前的 ViewModel 對象
  14934. */
  14935. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  14936. var newRow = {};
  14937. if (isFlat == false) {
  14938. newRow = data;
  14939. }
  14940. else {
  14941. flatObject(newRow, '', data);
  14942. }
  14943. if (!propertyName) {
  14944. _$2.forOwn(newRow, function (value, key) {
  14945. viewModel.set(key, value);
  14946. });
  14947. }
  14948. else {
  14949. _$2.forOwn(newRow, function (value, key) {
  14950. viewModel.set(propertyName + "." + key, value);
  14951. });
  14952. }
  14953. }
  14954. /**
  14955. * 转换内联结构的行,到平面结构
  14956. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  14957. *
  14958. * @param array
  14959. * @param flatOption
  14960. * @return {[]}
  14961. */
  14962. function flatRow(array) {
  14963. var ret = [];
  14964. _$2.forEach(array, function (row) {
  14965. var newRow = {};
  14966. flatObject(newRow, '', row);
  14967. ret.push(newRow);
  14968. });
  14969. return ret;
  14970. }
  14971. function flatObject(parentObj, parentProp, obj) {
  14972. _$2.forOwn(obj, function (value, key) {
  14973. var fullKey = parentProp ? parentProp + '_' + key : key;
  14974. if (_$2.isArray(value)) {
  14975. parentObj[fullKey] = _$2.map(value, function (row) {
  14976. var newRow = {};
  14977. flatObject(newRow, '', row);
  14978. return newRow;
  14979. });
  14980. }
  14981. else {
  14982. if (typeof value === 'object') {
  14983. flatObject(parentObj, fullKey, value);
  14984. }
  14985. else {
  14986. parentObj[fullKey] = value;
  14987. }
  14988. }
  14989. });
  14990. }
  14991. /**
  14992. * 替换内部结构中,所有 N/A
  14993. */
  14994. function replaceNA(obj) {
  14995. if (obj === 'N/A') {
  14996. return '';
  14997. }
  14998. if (_$2.isArray(obj)) {
  14999. _$2.forEach(obj, function (value, idx) {
  15000. if (value === 'N/A') {
  15001. obj[idx] = '';
  15002. }
  15003. else {
  15004. replaceNA(value);
  15005. }
  15006. });
  15007. }
  15008. else if (_$2.isPlainObject(obj)) {
  15009. _$2.forOwn(obj, function (value, key) {
  15010. if (value === 'N/A') {
  15011. obj[key] = '';
  15012. }
  15013. else {
  15014. replaceNA(value);
  15015. }
  15016. });
  15017. }
  15018. }
  15019. /**
  15020. * 根据表达式进入写值
  15021. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15022. * express="test-{query.a}" 写值就会失败
  15023. *
  15024. * @example
  15025. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15026. * 写值成功
  15027. *
  15028. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15029. * 写值失败
  15030. *
  15031. * @param viewModel VM对象
  15032. * @param express 表达式对象
  15033. * @param value 目标值
  15034. */
  15035. function tryWriteByExpress(viewModel, express, value) {
  15036. if (SIMPLE_RE.test(express)) {
  15037. // '{foo}' 简单表达式
  15038. express = express.substring(1, express.length - 1);
  15039. viewModel.set(express, value);
  15040. }
  15041. }
  15042. /**
  15043. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15044. * @example
  15045. * 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]})
  15046. *
  15047. * expressObject:
  15048. * {
  15049. * a: '{query.a}',
  15050. * b: {
  15051. * b1: '{query.b1}',
  15052. * b2: '{query.b2}',
  15053. * },
  15054. * c: 'aa',
  15055. * d: [
  15056. * '{query.a}',
  15057. * '{query.b2}'
  15058. * ]
  15059. * }
  15060. *
  15061. * valueObject:
  15062. * {
  15063. * a: 'aValue',
  15064. * b: {
  15065. * b1: 'b1Value',
  15066. * b2: 'b2Value'
  15067. * },
  15068. * c: 'aa'
  15069. * c: [
  15070. * 'aValue',
  15071. * 'b2Value'
  15072. * ]
  15073. * }
  15074. *
  15075. * 系统会尝试回写
  15076. * viewModel.set('query.a', 'aValue')
  15077. * viewModel.set('query.b1', 'b1Value')
  15078. * viewModel.set('query.b2', 'b2Value')
  15079. *
  15080. * @param expressObject 含表达式的对象
  15081. * @param valueObject 表达式计算完成之后的结果对象
  15082. * @param writeFn 写入的方法 (path, value)=>void
  15083. */
  15084. function tryWriteObject(expressObject, valueObject, writeFn) {
  15085. var trav = function (pathPrefix) {
  15086. var parent = expressObject;
  15087. if (_$2.size(pathPrefix) > 1) {
  15088. parent = _$2.get(parent, pathPrefix.substring(1));
  15089. }
  15090. _$2.forOwn(parent, function (value, key) {
  15091. if (_$2.isPlainObject(value)) {
  15092. // 深度递归,对子对象进行求解
  15093. trav(pathPrefix + "." + key);
  15094. }
  15095. else if (_$2.isString(value)) {
  15096. // 字符串直接用 calcExpress 表达式求解
  15097. if (SIMPLE_RE.test(value)) {
  15098. // If we have '{foo}' alone it is a literal 简单表达式
  15099. var targetPath = value.substring(1, value.length - 1);
  15100. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15101. if (!writeFn) {
  15102. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15103. }
  15104. else {
  15105. writeFn(targetPath, targetValue);
  15106. }
  15107. }
  15108. }
  15109. else if (_$2.isArray(value)) {
  15110. _$2.each(value, function (v, idx) {
  15111. if (SIMPLE_RE.test(v)) {
  15112. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15113. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15114. if (!writeFn) {
  15115. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15116. }
  15117. else {
  15118. writeFn(targetPath, targetValue);
  15119. }
  15120. }
  15121. });
  15122. }
  15123. });
  15124. };
  15125. trav("");
  15126. }
  15127. /**
  15128. * 尝试去掉变量两边括号
  15129. * {a} => a
  15130. * a => a
  15131. */
  15132. function tryVarSimple(value) {
  15133. if (SIMPLE_RE.test(value)) {
  15134. // If we have '{foo}' alone it is a literal 简单表达式
  15135. return value.substring(1, value.length - 1);
  15136. }
  15137. return value;
  15138. }
  15139. /**
  15140. * 对多个表达式进行求值. 异步回调的方式返回
  15141. * {
  15142. * a: 1,
  15143. * b: '{someBind}',
  15144. * c: ['a', 'b', 'c'],
  15145. * d: ['a', 'b', '{someBind}'],
  15146. * e: {
  15147. * y: 1,
  15148. * z: 2
  15149. * },
  15150. * f: {
  15151. * y: 1,
  15152. * z: '{someBind}'
  15153. * }
  15154. * }
  15155. *
  15156. * // Will produce
  15157. * {
  15158. * b: value,
  15159. * d: ['a', 'b', value],
  15160. * f: {
  15161. * y: 1,
  15162. * z: value
  15163. * }
  15164. * }
  15165. * @param viewModel scope.viewModel对象
  15166. * @param paramObject 求值对象
  15167. */
  15168. function calcObject(viewModel, paramObject) {
  15169. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15170. return new Promise(function (resolve) {
  15171. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15172. schedule.destroy();
  15173. // 从 Ext.data.Model 对象转换为 js-object 对象
  15174. ret = toPlainObject(ret);
  15175. resolve(ret);
  15176. }, viewModel, { single: true });
  15177. });
  15178. }
  15179. /**
  15180. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15181. * @param config 组件构造函数传入的 config 配置文件
  15182. */
  15183. function getParentGrid(config) {
  15184. var _a;
  15185. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15186. }
  15187. /**
  15188. * 解析
  15189. * {
  15190. * condition: "{skuId}",
  15191. * errorMsg: "无法编辑",
  15192. * notice: 'msg'
  15193. * }
  15194. */
  15195. function tryEnable(data, enableSetting) {
  15196. if (!enableSetting) {
  15197. // 没有这一段配置,可以编辑
  15198. return true;
  15199. }
  15200. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15201. if (!evalFunction(data, condition)) {
  15202. // 没有达成 condition 条件
  15203. // 计算 msg 消息内容
  15204. var msgContent = calcExpress(data, errorMsg);
  15205. if (msgContent) {
  15206. if (!notice || notice === 'msg') {
  15207. // 进行提示
  15208. msg$1(msgContent);
  15209. }
  15210. }
  15211. return false;
  15212. }
  15213. return true;
  15214. }
  15215. /**
  15216. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15217. * @param sender 目标对象
  15218. * @param config 目标对象的配置(在构造函数之前也可以)
  15219. * @param getDictFn 获取字典的方法
  15220. * @param bizKey 传入字典的参数
  15221. * @param multiValueSeparator 多个字典值的分割符号
  15222. */
  15223. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15224. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15225. // sender 和 config为空的时候获取值、
  15226. if (_$2.isArray(getDictFn)) {
  15227. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15228. var realArray_1 = getDictFn;
  15229. getDictFn = function () {
  15230. return realArray_1;
  15231. };
  15232. }
  15233. if (!sender) {
  15234. return new Promise(function (resolve, reject) {
  15235. getDictFn(bizKey, function (r) {
  15236. resolve({ config: config, r: r });
  15237. });
  15238. });
  15239. }
  15240. if (sender.xtype === 'combotree') {
  15241. getDictFn(bizKey, function (r) {
  15242. if (sender.store) {
  15243. // 异步回传
  15244. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15245. }
  15246. else {
  15247. // 同步回传
  15248. config.store = new Ext.data.TreeStore({ root: r });
  15249. }
  15250. });
  15251. return;
  15252. }
  15253. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15254. getDictFn(bizKey, function (r) {
  15255. var _a, _b;
  15256. if (sender.store) {
  15257. // 异步回传
  15258. sender.setStore(new Ext.data.Store(r));
  15259. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15260. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15261. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15262. if (typeof realValue !== 'undefined') {
  15263. sender.setValue(realValue);
  15264. }
  15265. }
  15266. else {
  15267. // 同步回传
  15268. config.store = new Ext.data.Store(r);
  15269. }
  15270. });
  15271. return;
  15272. }
  15273. else if (sender.xtype === 'gridcolumn') {
  15274. var grid = getParentGrid(config);
  15275. var editor_1 = config.editor, renderer = config.renderer;
  15276. getDictFn(bizKey, function (r) {
  15277. if (sender.store) {
  15278. // 已经渲染出来了, 用方法进行修改
  15279. var editor_2 = sender.getEditor();
  15280. if (editor_2 && editor_2.xtype === 'combo') {
  15281. var valueField_1 = r.field[0];
  15282. var displayField_1 = r.field[1];
  15283. editor_2.valueField = valueField_1;
  15284. editor_2.setDisplayField(displayField_1);
  15285. editor_2.setStore(new Ext.data.Store(r));
  15286. }
  15287. sender.setFilter({
  15288. type: 'list',
  15289. options: _$2.map(r.data, function (r) { return ({
  15290. id: '' + r.id,
  15291. text: r.text,
  15292. }); })
  15293. });
  15294. }
  15295. else {
  15296. // 没有渲染之前,修改 config 即可
  15297. if (editor_1 && editor_1.xtype === 'combo') {
  15298. // 带编辑模式
  15299. editor_1.store = new Ext.data.Store(r);
  15300. }
  15301. config.filter = {
  15302. type: 'list',
  15303. options: _$2.map(r.data, function (r) { return ({
  15304. id: '' + r.id,
  15305. text: r.text,
  15306. }); })
  15307. };
  15308. }
  15309. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15310. var renderer = function (value, metaData) {
  15311. if (metaData === void 0) { metaData = false; }
  15312. if (!value && value != 0) {
  15313. return '';
  15314. }
  15315. var valueField = r.field[metaData === true ? 1 : 0];
  15316. var displayField = r.field[metaData === true ? 0 : 1];
  15317. var separator = multiValueSeparator;
  15318. if (separator) {
  15319. var arr = value.split(separator);
  15320. var displayValue_1 = "";
  15321. var _loop_1 = function (i) {
  15322. var itv = arr[i];
  15323. if (i > 0) {
  15324. displayValue_1 += separator;
  15325. }
  15326. _$2.each(r.data, function (row) {
  15327. // 从 valueField 找到要显示的 displayField
  15328. if (row[valueField] == itv) {
  15329. displayValue_1 += row[displayField];
  15330. return false;
  15331. }
  15332. else {
  15333. if (i >= r.data.length - 1) {
  15334. displayValue_1 += itv;
  15335. }
  15336. }
  15337. });
  15338. };
  15339. for (var i = 0; i < arr.length; i++) {
  15340. _loop_1(i);
  15341. }
  15342. return displayValue_1;
  15343. }
  15344. _$2.each(r.data, function (row) {
  15345. // 从 valueField 找到要显示的 displayField
  15346. if (row[valueField] == value) {
  15347. value = row[displayField];
  15348. return false;
  15349. }
  15350. });
  15351. return value;
  15352. };
  15353. var dictForExcel = {};
  15354. var valueField = r.field[0];
  15355. var displayField = r.field[1];
  15356. _$2.each(r.data, function (row) {
  15357. // 从 valueField 找到要显示的 displayField
  15358. var key = row[valueField];
  15359. if (key != '' && typeof key != "undefined" && key != null) {
  15360. dictForExcel[key] = row[displayField];
  15361. }
  15362. });
  15363. if (sender.rendered) {
  15364. // 已经渲染出来了, 对列进行渲染
  15365. sender.renderer = renderer;
  15366. sender.dictForExcel = dictForExcel;
  15367. sender.getView().refresh();
  15368. }
  15369. else {
  15370. sender.renderer = renderer;
  15371. sender.dictForExcel = dictForExcel;
  15372. config.renderer = renderer;
  15373. config.dictForExcel = dictForExcel;
  15374. }
  15375. });
  15376. return;
  15377. }
  15378. throw new TypeError("无法识别的组件类型");
  15379. }
  15380. /**
  15381. * 调用服务器 Ajax
  15382. */
  15383. function invokeServer$1(url) {
  15384. var args = [];
  15385. for (var _i = 1; _i < arguments.length; _i++) {
  15386. args[_i - 1] = arguments[_i];
  15387. }
  15388. // @ts-ignore
  15389. return ajax.func({
  15390. url: url,
  15391. method: 'invoke',
  15392. args: args
  15393. });
  15394. }
  15395. function clearViewModelValues(viewModel, propertyName) {
  15396. if (!propertyName) {
  15397. var dd_1 = viewModel.getData();
  15398. _$2.forOwn(dd_1, function (value, key) {
  15399. viewModel.set(key, '');
  15400. });
  15401. return;
  15402. }
  15403. var dd = _$2.get(viewModel.getData(), propertyName);
  15404. _$2.forOwn(dd, function (value, key) {
  15405. viewModel.set(propertyName + '.' + key, '');
  15406. });
  15407. }
  15408. function reloadGrid(scope, gridRefName) {
  15409. var _a;
  15410. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15411. }
  15412. /**
  15413. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15414. */
  15415. function toPlainObject(obj) {
  15416. if (obj.isModel) {
  15417. obj = obj.data;
  15418. }
  15419. _$2.forOwn(obj, function (v, k) {
  15420. // Ext.data.Model.constructor
  15421. if (!v) {
  15422. return;
  15423. }
  15424. if (v.isModel) {
  15425. v = v.data;
  15426. }
  15427. if (typeof v === 'object') {
  15428. obj[k] = toPlainObject(v);
  15429. }
  15430. else {
  15431. obj[k] = v;
  15432. }
  15433. });
  15434. return obj;
  15435. }
  15436. function confirm(msg, sender) {
  15437. return new Promise(function (resolve) {
  15438. var _a, _b;
  15439. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15440. var config = {
  15441. title: '请确认',
  15442. modal: true,
  15443. animateTarget: sender,
  15444. // resizable: false,
  15445. // constrainHeader: true,
  15446. // constrain: true,
  15447. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15448. layout: {
  15449. type: 'hbox',
  15450. pack: 'start',
  15451. align: 'stretch'
  15452. },
  15453. items: [
  15454. {
  15455. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15456. border: false,
  15457. },
  15458. {
  15459. flex: 1,
  15460. border: false,
  15461. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(msg) + "</div>"
  15462. }
  15463. ],
  15464. buttons: [
  15465. {
  15466. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15467. handler: function () {
  15468. resolve();
  15469. win.close();
  15470. }
  15471. },
  15472. {
  15473. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15474. handler: function () {
  15475. win.close();
  15476. }
  15477. }
  15478. ],
  15479. keyMapEnabled: true,
  15480. keyMap: {
  15481. ENTER: function () {
  15482. resolve();
  15483. win.close();
  15484. }
  15485. }
  15486. };
  15487. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15488. config.constrain = true;
  15489. }
  15490. var win = new Ext.Window(config);
  15491. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15492. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15493. }
  15494. win.show();
  15495. });
  15496. }
  15497. /**
  15498. * 任何符号字符串都替换成下换线
  15499. */
  15500. function normId(value) {
  15501. return _$2.replace(value, /[^\w]/g, '_');
  15502. }
  15503. /**
  15504. *
  15505. * @param sender
  15506. * @param propertyName
  15507. * @param gridRefName
  15508. */
  15509. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15510. var _a, _b;
  15511. var scope = lookupScope(sender);
  15512. clearViewModelValues(scope.viewModel, propertyName);
  15513. if (!gridRefName) {
  15514. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15515. }
  15516. else {
  15517. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15518. }
  15519. }
  15520. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15521. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15522. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15523. var value = _$2.trim(sender.rawValue);
  15524. raiseClick(eOpts.handle);
  15525. }
  15526. }, 150);
  15527. function saveGridRow(grid1) {
  15528. var _a;
  15529. var config = grid1.config;
  15530. var scope = lookupScope(grid1);
  15531. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15532. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15533. // "表格保存"的相关配置
  15534. var dbSaveConfig = {
  15535. columns: [],
  15536. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15537. saveRowValues: saveRowValues,
  15538. path: scope.originalVjson.__custom_path,
  15539. };
  15540. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15541. if (err) {
  15542. // 如果有异常就不保存
  15543. return;
  15544. }
  15545. // 构建"表格保存"的相关配置
  15546. for (var i = 0; i < config.columns.length; i++) {
  15547. var c = config.columns[i];
  15548. var v = {
  15549. dataIndex: c.dataIndex,
  15550. header: c.header,
  15551. dbColumn: c.dbColumn,
  15552. serverCreateValue: c.serverCreateValue,
  15553. dbIsDeleteKey: c.dbIsDeleteKey,
  15554. dbIsUpdateKey: c.dbIsUpdateKey,
  15555. dbUpdateEnable: c.dbUpdateEnable,
  15556. serverValueConvert: c.dbUpdateEnable,
  15557. };
  15558. if (c.editor) {
  15559. v.editor = {
  15560. xtype: c.editor.xtype,
  15561. required: c.editor.required,
  15562. };
  15563. }
  15564. dbSaveConfig.columns.push(v);
  15565. }
  15566. // 进行业务上的逻辑校验
  15567. var hasError = false;
  15568. _$2.forEach(rows, function (row, i) {
  15569. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15570. var c = config.columns[i_1];
  15571. var value = row[c.dataIndex];
  15572. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15573. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15574. hasError = true;
  15575. return false;
  15576. }
  15577. if (c.xtype === 'checkcolumn') {
  15578. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15579. row[c.dataIndex] = c.uncheckedValue;
  15580. }
  15581. if (value === true && typeof c.checkedValue !== 'undefined') {
  15582. row[c.dataIndex] = c.checkedValue;
  15583. }
  15584. }
  15585. }
  15586. });
  15587. if (hasError) {
  15588. return;
  15589. }
  15590. // 设置当前界面为 "保存中..." 状态
  15591. grid1.setLoading(true);
  15592. invokeServer$1('/Dev@batchSave', {
  15593. newRows: newRows,
  15594. modifyRows: modifyRows,
  15595. removeRecords: removeRecords,
  15596. config: dbSaveConfig,
  15597. }).then(function (res) {
  15598. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15599. msg$1(res.msg);
  15600. grid1.reload();
  15601. }).catch(function (e) {
  15602. console.error(e);
  15603. showErrorDialog$1(_$2.toString(e));
  15604. }).finally(function () {
  15605. // 无论正常异常,关闭 "保存中..." 状态
  15606. grid1.setLoading(false);
  15607. });
  15608. }
  15609. function insertGridRow(grid1) {
  15610. var config = grid1.config;
  15611. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15612. var insertRow = {};
  15613. _$2.forEach(config.columns, function (c) {
  15614. var fn = c.createValue;
  15615. if (_$2.startsWith(fn, 'scope.') ||
  15616. _$2.startsWith(fn, 'system.')) {
  15617. var scope = lookupScope(grid1);
  15618. var fn2 = lookupFn(scope, fn, c);
  15619. if (_$2.isFunction(fn2)) {
  15620. var newValue = fn2();
  15621. if (!_$2.isUndefined(newValue)) {
  15622. insertRow[c.dataIndex] = newValue;
  15623. }
  15624. }
  15625. }
  15626. else if (_$2.isString(fn) && fn) {
  15627. insertRow[c.dataIndex] = fn;
  15628. }
  15629. });
  15630. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15631. }
  15632. function commitMe(sender) {
  15633. var window = sender.up('window');
  15634. var scope = lookupScope(sender);
  15635. if (typeof scope['commit'] === 'function') {
  15636. scope['commit']().then(function (res) {
  15637. window.close();
  15638. });
  15639. }
  15640. }
  15641. function removeGridRow(grid1) {
  15642. var _a;
  15643. var config = grid1.config;
  15644. var rows = [];
  15645. if (grid1.selModel.selType === "rowmodel") {
  15646. rows.push(grid1.selection);
  15647. }
  15648. else {
  15649. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15650. rows.push(r);
  15651. });
  15652. }
  15653. if (rows.length > 1) {
  15654. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15655. if (_$2.isUndefined(batchRemoveConfirm)) {
  15656. //不需要提示
  15657. _$2.forEach(rows, function (r) {
  15658. grid1.getStore().remove(r);
  15659. });
  15660. }
  15661. else {
  15662. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15663. confirm(tip).then(function () {
  15664. _$2.forEach(rows, function (r) {
  15665. grid1.getStore().remove(r);
  15666. });
  15667. });
  15668. }
  15669. }
  15670. else if (rows.length === 1) {
  15671. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15672. if (_$2.isUndefined(singleRemoveConfirm)) {
  15673. //不需要提示
  15674. grid1.getStore().remove(rows[0]);
  15675. }
  15676. else {
  15677. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15678. _$2.forEach(config.columns, function (c) {
  15679. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15680. });
  15681. confirm(tip_1).then(function () {
  15682. grid1.getStore().remove(rows[0]);
  15683. });
  15684. }
  15685. }
  15686. else {
  15687. msg$1('请选择要删除的数据!');
  15688. }
  15689. }
  15690. function moveUpGridRow(grid) {
  15691. grid.rowMoveUp();
  15692. }
  15693. function moveDownGridRow(grid) {
  15694. grid.rowMoveDown();
  15695. }
  15696. var SystemEventFu = /** @class */ (function () {
  15697. function SystemEventFu() {
  15698. }
  15699. SystemEventFu.prototype.moveUpGridRow = function () {
  15700. return function (sender) {
  15701. var grid1 = sender.up('yvgrid');
  15702. moveUpGridRow(grid1);
  15703. };
  15704. };
  15705. SystemEventFu.prototype.commitMe = function () {
  15706. return function (sender) {
  15707. commitMe(sender);
  15708. };
  15709. };
  15710. SystemEventFu.prototype.moveDownGridRow = function () {
  15711. return function (sender) {
  15712. var grid1 = sender.up('yvgrid');
  15713. moveDownGridRow(grid1);
  15714. };
  15715. };
  15716. SystemEventFu.prototype.saveGridRow = function () {
  15717. return function (sender) {
  15718. var grid1 = sender.up('yvgrid');
  15719. saveGridRow(grid1);
  15720. };
  15721. };
  15722. SystemEventFu.prototype.insertGridRow = function () {
  15723. return function (sender) {
  15724. var grid1 = sender.up('yvgrid');
  15725. insertGridRow(grid1);
  15726. };
  15727. };
  15728. SystemEventFu.prototype.removeGridRow = function () {
  15729. return function (sender) {
  15730. var grid1 = sender.up('yvgrid');
  15731. removeGridRow(grid1);
  15732. };
  15733. };
  15734. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15735. return function (sender, config) {
  15736. if (!config.listeners) {
  15737. config.listeners = {};
  15738. }
  15739. config.listeners.afterrender = function (sender) {
  15740. var scope = lookupScope(sender);
  15741. // $(sender.el.dom).on('keydown', (e) => {
  15742. // const xtype = Ext.fly(e.target).component.xtype
  15743. // if (xtype === 'textfield' && e.keyCode === 13) {
  15744. // Ext.defer(() => {
  15745. // raiseClick(scope.refs[btnReferenceName])
  15746. // })
  15747. // e.preventDefault()
  15748. // e.stopPropagation()
  15749. // return false
  15750. // }
  15751. // })
  15752. $(sender.el.dom).on('keyup', function (e) {
  15753. var tt = Ext.fly(e.target).component;
  15754. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15755. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15756. ![10, 13, 20, 40].includes(e.keyCode)) {
  15757. return;
  15758. }
  15759. e.preventDefault();
  15760. e.stopPropagation();
  15761. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15762. return;
  15763. });
  15764. };
  15765. };
  15766. };
  15767. SystemEventFu.prototype.confirm = function (text, fn) {
  15768. return function (sender) {
  15769. var scope = lookupScope(sender);
  15770. var msg = calcExpress(scope.viewModel.data, text);
  15771. confirm(msg, sender).then(function () {
  15772. fn.call(scope, sender);
  15773. });
  15774. };
  15775. };
  15776. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15777. return function (sender) {
  15778. var scope = lookupScope(sender);
  15779. var grid = scope.refs[gridRefName];
  15780. if (grid) {
  15781. var records = grid.getSelectionModel().getLastSelected();
  15782. grid.store.remove(records);
  15783. }
  15784. };
  15785. };
  15786. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15787. //可以是 scope.XX / system.XX / string / lookup表达式
  15788. writeTarget) {
  15789. return function (sender) {
  15790. if (!invokeUrl) {
  15791. return;
  15792. }
  15793. var scope = lookupScope(sender);
  15794. scope.setLoading(true);
  15795. var data = scope.viewModel.data;
  15796. if (invokeParam) {
  15797. data = calcObjectFlat(data, invokeParam);
  15798. }
  15799. invokeServer$1(invokeUrl, data).then(function (res) {
  15800. if (res.success) {
  15801. if (typeof writeTarget === "string") {
  15802. _$2.forOwn(res.data, function (v, k) {
  15803. scope.viewModel.set(writeTarget + "." + k, v);
  15804. });
  15805. }
  15806. else if (typeof writeTarget === 'function') {
  15807. writeTarget.call(scope, res.data);
  15808. }
  15809. else if (typeof writeTarget === 'object') {
  15810. var ret = calcObjectFlat(res.data, writeTarget);
  15811. _$2.forOwn(ret, function (v, k) {
  15812. scope.viewModel.set(k, v);
  15813. });
  15814. }
  15815. }
  15816. else {
  15817. showErrorDialog$1(res.msg || '未知错误', sender);
  15818. }
  15819. }).catch(function (e) {
  15820. var _a, _b;
  15821. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15822. showErrorDialog$1(msg || e.toString(), sender);
  15823. }).finally(function () {
  15824. scope.setLoading(false);
  15825. });
  15826. };
  15827. };
  15828. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15829. return function (sender) {
  15830. var scope = lookupScope(sender);
  15831. scope.setLoading(true);
  15832. var data = scope.viewModel.data;
  15833. if (arg0) {
  15834. data = calcObjectFlat(data, arg0);
  15835. }
  15836. invokeServer$1(groovyUrl, data).then(function (res) {
  15837. if (res.success) {
  15838. if (res.msg) {
  15839. msg(res.msg);
  15840. }
  15841. if (typeof successCallback === 'function') {
  15842. successCallback.call(scope, sender, res.data);
  15843. }
  15844. }
  15845. else {
  15846. showErrorDialog$1(res.msg || '未知错误', sender);
  15847. }
  15848. }).catch(function (e) {
  15849. var _a, _b;
  15850. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15851. showErrorDialog$1(msg || e.toString(), sender);
  15852. }).finally(function () {
  15853. scope.setLoading(false);
  15854. });
  15855. };
  15856. };
  15857. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15858. return function (sender) {
  15859. var scope = lookupScope(sender);
  15860. var form = scope.down('form');
  15861. if (form) {
  15862. // 如果下级有表单,就做表单校验
  15863. var valid = form.isValid();
  15864. if (!valid) {
  15865. return;
  15866. }
  15867. }
  15868. scope.setLoading(true);
  15869. var data = scope.viewModel.data;
  15870. if (arg0) {
  15871. data = calcObjectFlat(data, arg0);
  15872. }
  15873. invokeServer$1(groovyUrl, data).then(function (res) {
  15874. if (res.success) {
  15875. if (res.msg) {
  15876. msg(res.msg);
  15877. }
  15878. scope.dialogSuccess(res);
  15879. }
  15880. else {
  15881. showErrorDialog$1(res.msg || '未知错误', sender);
  15882. }
  15883. }).catch(function (e) {
  15884. var _a, _b;
  15885. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15886. showErrorDialog$1(msg || e.toString(), sender);
  15887. }).finally(function () {
  15888. scope.setLoading(false);
  15889. });
  15890. };
  15891. };
  15892. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  15893. return function (sender) {
  15894. var scope = lookupScope(sender);
  15895. if (lookupObject) {
  15896. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  15897. }
  15898. else {
  15899. scope.dialogSuccess();
  15900. }
  15901. };
  15902. };
  15903. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  15904. return function (sender) {
  15905. var scope = lookupScope(sender);
  15906. clearViewModelValues(scope.viewModel, propertyName);
  15907. };
  15908. };
  15909. SystemEventFu.prototype.getGrid = function (url) {
  15910. return function (sender, config) {
  15911. if (config.xtype == "combogridmulti") {
  15912. // @ts-ignore
  15913. require([url], function (grid) {
  15914. _$2.forOwn(grid.default, function (v, k) {
  15915. sender[k] = v;
  15916. sender.config[k] = v;
  15917. if (sender.rendered) {
  15918. // 已经渲染出来了,重新调用 reload 强制刷新
  15919. sender.reload();
  15920. }
  15921. });
  15922. });
  15923. }
  15924. else {
  15925. // @ts-ignore
  15926. require([url], function (grid) {
  15927. sender.grid = grid.default;
  15928. config.grid = grid.default;
  15929. });
  15930. }
  15931. };
  15932. };
  15933. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  15934. return function (sender) {
  15935. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  15936. };
  15937. };
  15938. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  15939. return function (sender) {
  15940. var _a, _b;
  15941. var scope = lookupScope(sender);
  15942. if (!gridRefName) {
  15943. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15944. }
  15945. else {
  15946. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15947. }
  15948. };
  15949. };
  15950. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  15951. return function (sender) {
  15952. var scope = lookupScope(sender);
  15953. var data = scope.viewModel.data;
  15954. var param = calcObjectFlat(data, lookupForData);
  15955. // @ts-ignore
  15956. require([url], function (module) {
  15957. var ScopeClass = module.default;
  15958. var scope = new ScopeClass();
  15959. scope.success = successCallback;
  15960. scope.showDialog(sender, {}, { data: param });
  15961. });
  15962. };
  15963. };
  15964. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  15965. return function (sender, queryValue) {
  15966. showWidget(widgetUrl, lookup, sender, queryValue);
  15967. };
  15968. };
  15969. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  15970. return function (sender) {
  15971. clearViewModelByLookup(sender, lookup);
  15972. };
  15973. };
  15974. SystemEventFu.prototype.closeMe = function (callBack) {
  15975. return function (sender) {
  15976. var scope = lookupScope(sender);
  15977. scope.close();
  15978. if (callBack) {
  15979. callBack.call(sender);
  15980. }
  15981. };
  15982. };
  15983. // 未完成
  15984. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  15985. return function (sender) {
  15986. var scope = lookupScope(sender);
  15987. var data = scope.viewModel.data;
  15988. var billSetting = scope.billSetting;
  15989. var param = calcObjectFlat(data, lookupForData);
  15990. return new Promise(function (resolve, reject) {
  15991. var sf = function (scope) {
  15992. scope.success = function (dlgScope, dlgSender, reData) {
  15993. };
  15994. scope.showDialog(sender, {}, { data: param });
  15995. };
  15996. // @ts-ignore
  15997. require([url], function (module) {
  15998. // 业务描述文件
  15999. if (url.endsWith(".bill")) {
  16000. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16001. sf(scope);
  16002. });
  16003. }
  16004. else { //原生yvanui文件
  16005. var ScopeClass = module.default;
  16006. var scope_1 = new ScopeClass();
  16007. sf(scope_1);
  16008. }
  16009. });
  16010. });
  16011. };
  16012. };
  16013. __decorate([
  16014. Lib({
  16015. title: '为某个表格,上移行',
  16016. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16017. }),
  16018. __metadata("design:type", Function),
  16019. __metadata("design:paramtypes", []),
  16020. __metadata("design:returntype", void 0)
  16021. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16022. __decorate([
  16023. Lib({
  16024. title: '为某个表格,上移行',
  16025. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16026. }),
  16027. __metadata("design:type", Function),
  16028. __metadata("design:paramtypes", []),
  16029. __metadata("design:returntype", void 0)
  16030. ], SystemEventFu.prototype, "commitMe", null);
  16031. __decorate([
  16032. Lib({
  16033. title: '为某个表格,下移行',
  16034. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16035. }),
  16036. __metadata("design:type", Function),
  16037. __metadata("design:paramtypes", []),
  16038. __metadata("design:returntype", void 0)
  16039. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16040. __decorate([
  16041. Lib({
  16042. title: '为某个表格,批量保存至数据库',
  16043. author: '罗一帆',
  16044. createAt: '2022-07-19',
  16045. updateAt: '2022-07-19',
  16046. type: 'system',
  16047. category: '表格',
  16048. }),
  16049. __metadata("design:type", Function),
  16050. __metadata("design:paramtypes", []),
  16051. __metadata("design:returntype", void 0)
  16052. ], SystemEventFu.prototype, "saveGridRow", null);
  16053. __decorate([
  16054. Lib({
  16055. title: '为某个表格插入数据行',
  16056. author: '罗一帆',
  16057. createAt: '2022-07-19',
  16058. updateAt: '2022-07-19',
  16059. type: 'system',
  16060. category: '表格',
  16061. }),
  16062. __metadata("design:type", Function),
  16063. __metadata("design:paramtypes", []),
  16064. __metadata("design:returntype", void 0)
  16065. ], SystemEventFu.prototype, "insertGridRow", null);
  16066. __decorate([
  16067. Lib({
  16068. title: '为某个表格删除所选数据行',
  16069. author: '罗一帆',
  16070. createAt: '2022-07-19',
  16071. updateAt: '2022-07-19',
  16072. type: 'system',
  16073. category: '表格',
  16074. }),
  16075. __metadata("design:type", Function),
  16076. __metadata("design:paramtypes", []),
  16077. __metadata("design:returntype", void 0)
  16078. ], SystemEventFu.prototype, "removeGridRow", null);
  16079. __decorate([
  16080. Lib({
  16081. title: '按下回车键之后默认是否按下某个按钮',
  16082. author: '罗一帆',
  16083. createAt: '2021-07-02',
  16084. updateAt: '2021-07-02',
  16085. type: 'system',
  16086. category: '字典',
  16087. }),
  16088. __metadata("design:type", Function),
  16089. __metadata("design:paramtypes", [Object]),
  16090. __metadata("design:returntype", void 0)
  16091. ], SystemEventFu.prototype, "enterToClick", null);
  16092. __decorate([
  16093. Lib({
  16094. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16095. author: '罗一帆',
  16096. createAt: '2021-07-06',
  16097. updateAt: '2021-07-06',
  16098. type: 'system',
  16099. category: '对话框',
  16100. }),
  16101. __param(0, LibParam('对话框的确认文字', 'string')),
  16102. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16103. __metadata("design:type", Function),
  16104. __metadata("design:paramtypes", [Object, Object]),
  16105. __metadata("design:returntype", void 0)
  16106. ], SystemEventFu.prototype, "confirm", null);
  16107. __decorate([
  16108. Lib({
  16109. title: '删除表格当前的选中行(前端删除)',
  16110. author: '罗一帆',
  16111. createAt: '2021-07-08',
  16112. updateAt: '2021-07-08',
  16113. type: 'system',
  16114. category: '表格',
  16115. }),
  16116. __param(0, LibParam('表格引用名', 'refs')),
  16117. __metadata("design:type", Function),
  16118. __metadata("design:paramtypes", [Object]),
  16119. __metadata("design:returntype", void 0)
  16120. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16121. __decorate([
  16122. Lib({
  16123. title: '查询表单,如果 url 为空值,就取消查询',
  16124. author: '罗一帆',
  16125. createAt: '2021-07-06',
  16126. updateAt: '2021-07-06',
  16127. type: 'system',
  16128. category: '表单',
  16129. }),
  16130. __param(0, LibParam('后端服务路径', 'string')),
  16131. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16132. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16133. __metadata("design:type", Function),
  16134. __metadata("design:paramtypes", [String, Object, Object]),
  16135. __metadata("design:returntype", void 0)
  16136. ], SystemEventFu.prototype, "loadForm", null);
  16137. __decorate([
  16138. Lib({
  16139. title: '提交(不做校验、不关闭窗体)',
  16140. author: '罗一帆',
  16141. createAt: '2021-07-02',
  16142. updateAt: '2021-07-02',
  16143. type: 'system',
  16144. category: '表单',
  16145. }),
  16146. __param(0, LibParam('后端服务路径', 'string')),
  16147. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16148. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16149. __metadata("design:type", Function),
  16150. __metadata("design:paramtypes", [String, Object, Object]),
  16151. __metadata("design:returntype", void 0)
  16152. ], SystemEventFu.prototype, "commit", null);
  16153. __decorate([
  16154. Lib({
  16155. title: '提交表单',
  16156. author: '罗一帆',
  16157. createAt: '2021-07-02',
  16158. updateAt: '2021-07-02',
  16159. type: 'system',
  16160. category: '表单',
  16161. }),
  16162. __param(0, LibParam('后端服务路径', 'string')),
  16163. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16164. __metadata("design:type", Function),
  16165. __metadata("design:paramtypes", [String, Object]),
  16166. __metadata("design:returntype", void 0)
  16167. ], SystemEventFu.prototype, "formCommit", null);
  16168. __decorate([
  16169. Lib({
  16170. title: '对话框成功回调',
  16171. author: '罗一帆',
  16172. createAt: '2021-07-02',
  16173. updateAt: '2021-07-02',
  16174. type: 'system',
  16175. category: '对话框',
  16176. }),
  16177. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16178. __metadata("design:type", Function),
  16179. __metadata("design:paramtypes", [Object]),
  16180. __metadata("design:returntype", void 0)
  16181. ], SystemEventFu.prototype, "dialogSuccess", null);
  16182. __decorate([
  16183. Lib({
  16184. title: '清空 viewModel 某个属性',
  16185. author: '罗一帆',
  16186. createAt: '2021-07-02',
  16187. updateAt: '2021-07-02',
  16188. type: 'system',
  16189. category: '表单',
  16190. }),
  16191. __param(0, LibParam('属性路径', 'viewModel', true)),
  16192. __metadata("design:type", Function),
  16193. __metadata("design:paramtypes", [String]),
  16194. __metadata("design:returntype", void 0)
  16195. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16196. __decorate([
  16197. Lib({
  16198. title: '从其他资源获取表格设置',
  16199. author: '罗一帆',
  16200. createAt: '2021-07-02',
  16201. updateAt: '2021-07-02',
  16202. type: 'system',
  16203. category: '表单',
  16204. }),
  16205. __param(0, LibParam('定义文件', 'module')),
  16206. __metadata("design:type", Function),
  16207. __metadata("design:paramtypes", [Object]),
  16208. __metadata("design:returntype", void 0)
  16209. ], SystemEventFu.prototype, "getGrid", null);
  16210. __decorate([
  16211. Lib({
  16212. title: '清空 viewModel 某个属性,并刷新表格',
  16213. author: '罗一帆',
  16214. createAt: '2021-07-02',
  16215. updateAt: '2021-07-02',
  16216. type: 'system',
  16217. category: '表单',
  16218. }),
  16219. __param(0, LibParam('清空的属性', 'viewModel')),
  16220. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16221. __metadata("design:type", Function),
  16222. __metadata("design:paramtypes", [String, String]),
  16223. __metadata("design:returntype", void 0)
  16224. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16225. __decorate([
  16226. Lib({
  16227. title: '刷新表格',
  16228. author: '罗一帆',
  16229. createAt: '2021-07-02',
  16230. updateAt: '2021-07-02',
  16231. type: 'system',
  16232. category: '表单',
  16233. }),
  16234. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16235. __metadata("design:type", Function),
  16236. __metadata("design:paramtypes", [String]),
  16237. __metadata("design:returntype", void 0)
  16238. ], SystemEventFu.prototype, "reloadGrid", null);
  16239. __decorate([
  16240. Lib({
  16241. title: '显示对话框',
  16242. author: '罗一帆',
  16243. createAt: '2021-07-02',
  16244. updateAt: '2021-07-02',
  16245. type: 'system',
  16246. category: '对话框',
  16247. }),
  16248. __param(0, LibParam('业务模块名', 'module')),
  16249. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16250. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16251. __metadata("design:type", Function),
  16252. __metadata("design:paramtypes", [String, Object, Object]),
  16253. __metadata("design:returntype", void 0)
  16254. ], SystemEventFu.prototype, "showDialog", null);
  16255. __decorate([
  16256. Lib({
  16257. title: '弹出查找框(不借助 search)',
  16258. author: '罗一帆',
  16259. createAt: '2021-07-02',
  16260. updateAt: '2021-07-02',
  16261. type: 'system',
  16262. category: '对话框',
  16263. }),
  16264. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16265. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16266. __metadata("design:type", Function),
  16267. __metadata("design:paramtypes", [Object, Object]),
  16268. __metadata("design:returntype", void 0)
  16269. ], SystemEventFu.prototype, "showWidget", null);
  16270. __decorate([
  16271. Lib({
  16272. title: '根据 lookup 清空 viewModel',
  16273. author: '罗一帆',
  16274. createAt: '2021-07-05',
  16275. updateAt: '2021-07-05',
  16276. type: 'system',
  16277. category: '表单',
  16278. }),
  16279. __param(0, LibParam('设值表达式', 'lookup')),
  16280. __metadata("design:type", Function),
  16281. __metadata("design:paramtypes", [Object]),
  16282. __metadata("design:returntype", void 0)
  16283. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16284. __decorate([
  16285. Lib({
  16286. title: '关闭对话框',
  16287. author: '罗一帆',
  16288. createAt: '2021-07-05',
  16289. updateAt: '2021-07-05',
  16290. type: 'system',
  16291. category: '对话框',
  16292. }),
  16293. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16294. __metadata("design:type", Function),
  16295. __metadata("design:paramtypes", [Object]),
  16296. __metadata("design:returntype", void 0)
  16297. ], SystemEventFu.prototype, "closeMe", null);
  16298. __decorate([
  16299. Lib({
  16300. title: '打开对话框并返回数据',
  16301. author: '余亮',
  16302. createAt: '2022-07-07',
  16303. updateAt: '2022-07-07',
  16304. type: 'system',
  16305. category: '对话框',
  16306. }),
  16307. __param(0, LibParam('业务模块名', 'module')),
  16308. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16309. __param(2, LibParam('结果映射关系', 'string', true)),
  16310. __metadata("design:type", Function),
  16311. __metadata("design:paramtypes", [String, Object, Object]),
  16312. __metadata("design:returntype", void 0)
  16313. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16314. return SystemEventFu;
  16315. }());
  16316. /**
  16317. * 清空 viewmodel 里下属的所有属性
  16318. * @param viewModel VM对象
  16319. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16320. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16321. */
  16322. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16323. var data = viewModel.data;
  16324. if (propertyKey) {
  16325. data = _$2.get(data, propertyKey);
  16326. }
  16327. _$2.forOwn(data, function (value, key) {
  16328. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16329. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16330. return;
  16331. }
  16332. viewModel.set(targetKey, '');
  16333. });
  16334. }
  16335. function clearViewModelByLookup(sender, lookup) {
  16336. if (_$2.isPlainObject(lookup)) {
  16337. var parentScope_1 = lookupScope(sender);
  16338. _$2.forOwn(lookup, function (value, key) {
  16339. if (SIMPLE_RE.test(value)) {
  16340. // '{foo}' 简单表达式
  16341. var path = value.substring(1, value.length - 1);
  16342. if (path !== 'queryValue') {
  16343. parentScope_1.viewModel.set(path, '');
  16344. }
  16345. }
  16346. });
  16347. }
  16348. }
  16349. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16350. if (vjson === void 0) { vjson = {}; }
  16351. var parentScope = lookupScope(sender);
  16352. var me = sender;
  16353. // @ts-ignore
  16354. require([widgetUrl], function (widgetScope) {
  16355. var WidgetScopeClass = widgetScope.default;
  16356. widgetScope = new WidgetScopeClass();
  16357. // 传递进 widget.model 的数据
  16358. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16359. widgetScope.parentScope = parentScope;
  16360. widgetScope.searchWidgetSuccess = function (data) {
  16361. if (typeof lookup === 'string') {
  16362. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16363. me.setValue(data[lookup]);
  16364. return;
  16365. }
  16366. /**
  16367. * lookup: {
  16368. * // 扩展到 viewModel 的值做更改
  16369. * WH_CODE: "{queryValue}",
  16370. * WH_NAME: "{query.WH_NAME}",
  16371. * }
  16372. */
  16373. if (_$2.isPlainObject(lookup)) {
  16374. var parentScope_2 = lookupScope(sender);
  16375. tryWriteObject(lookup, data, function (path, value) {
  16376. if (path === 'queryValue') {
  16377. me.setValue(value);
  16378. }
  16379. else {
  16380. parentScope_2.viewModel.set(path, value);
  16381. }
  16382. });
  16383. }
  16384. return true;
  16385. };
  16386. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16387. });
  16388. }
  16389. /**
  16390. * 停止事件的默认行为
  16391. * @param e
  16392. */
  16393. function stopEvent(e) {
  16394. e.preventDefault();
  16395. e.stopPropagation();
  16396. // @ts-ignore
  16397. window.event.cancelBubble = true;
  16398. e.returnValue = false;
  16399. e.cancelBubble = true;
  16400. }
  16401. /**
  16402. * 屏幕中央显示一个黑框提示
  16403. */
  16404. function msg$1(content) {
  16405. msg(content);
  16406. }
  16407. /**
  16408. * 错误对话框的强提醒
  16409. */
  16410. function showErrorDialog$1(msg, sender) {
  16411. showErrorDialog(msg, sender);
  16412. }
  16413. /**
  16414. * 错误对话框的强提醒
  16415. */
  16416. function showInfoDialog(msg, sender) {
  16417. showInfoDialogSimple(msg, sender);
  16418. }
  16419. /**
  16420. * 错误对话框的强提醒
  16421. */
  16422. function prompt$2(message, defaultValue, multiLine) {
  16423. if (defaultValue === void 0) { defaultValue = ""; }
  16424. if (multiLine === void 0) { multiLine = false; }
  16425. return prompt$1(message, defaultValue, multiLine);
  16426. }
  16427. /**
  16428. * 用于计算 express 表达式
  16429. */
  16430. function evalFunction(data, express) {
  16431. var keys = [];
  16432. var values = [];
  16433. _$2.forOwn(data, function (value, key) {
  16434. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16435. if (match) {
  16436. key = key.substring(0, match.index);
  16437. }
  16438. keys.push(key);
  16439. values.push(value);
  16440. });
  16441. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16442. try {
  16443. return func.apply(void 0, __spread(values));
  16444. }
  16445. catch (e) {
  16446. return;
  16447. }
  16448. }
  16449. /**
  16450. * 获取表格编辑的行数据
  16451. */
  16452. function getGridEditRows(grid) {
  16453. return grid.getGridEditRows();
  16454. }
  16455. //# sourceMappingURL=systemLib.js.map
  16456. var SystemLib = /*#__PURE__*/Object.freeze({
  16457. __proto__: null,
  16458. SIMPLE_RE: SIMPLE_RE,
  16459. pinyinMatch: pinyinMatch,
  16460. calcExpress: calcExpress,
  16461. calcObjectFlat: calcObjectFlat,
  16462. mergeViewModel: mergeViewModel,
  16463. flatRow: flatRow,
  16464. replaceNA: replaceNA,
  16465. tryWriteByExpress: tryWriteByExpress,
  16466. tryWriteObject: tryWriteObject,
  16467. tryVarSimple: tryVarSimple,
  16468. calcObject: calcObject,
  16469. getParentGrid: getParentGrid,
  16470. tryEnable: tryEnable,
  16471. setComboStore: setComboStore,
  16472. invokeServer: invokeServer$1,
  16473. clearViewModelValues: clearViewModelValues,
  16474. reloadGrid: reloadGrid,
  16475. toPlainObject: toPlainObject,
  16476. confirm: confirm,
  16477. normId: normId,
  16478. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16479. saveGridRow: saveGridRow,
  16480. insertGridRow: insertGridRow,
  16481. commitMe: commitMe,
  16482. removeGridRow: removeGridRow,
  16483. moveUpGridRow: moveUpGridRow,
  16484. moveDownGridRow: moveDownGridRow,
  16485. SystemEventFu: SystemEventFu,
  16486. clearViewModel: clearViewModel,
  16487. clearViewModelByLookup: clearViewModelByLookup,
  16488. showWidget: showWidget,
  16489. stopEvent: stopEvent,
  16490. msg: msg$1,
  16491. showErrorDialog: showErrorDialog$1,
  16492. showInfoDialog: showInfoDialog,
  16493. prompt: prompt$2,
  16494. evalFunction: evalFunction,
  16495. getGridEditRows: getGridEditRows
  16496. });
  16497. function initTree () {
  16498. Ext.define('Yvan.Tree', {
  16499. extend: 'Ext.tree.Panel',
  16500. alias: 'widget.yvtree',
  16501. xtype: 'yvtree',
  16502. constructor: function (config) {
  16503. var newConfig = _$2.defaultsDeep({
  16504. // 强制性属性
  16505. }, baseConfig(config, 'row-item'), config, tree);
  16506. _$2.assign(newConfig, {
  16507. tbar: [
  16508. {
  16509. xtype: 'textfield',
  16510. // triggerCls: 'x-form-clear-trigger',
  16511. flex: 1,
  16512. emptyText: '搜索过滤',
  16513. enableKeyEvents: true,
  16514. listeners: {
  16515. change: function (sender) {
  16516. var tree = sender.up("treepanel");
  16517. tree.filterByText(this.getRawValue());
  16518. },
  16519. keyup: function (sender, e) {
  16520. var tree = sender.up("treepanel");
  16521. if (e.ESC === e.getKey()) {
  16522. sender.setValue('');
  16523. tree.filterByText('');
  16524. }
  16525. }
  16526. }
  16527. },
  16528. ],
  16529. });
  16530. if (!newConfig.hideRefresh) {
  16531. newConfig.tbar.push({
  16532. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16533. listeners: {
  16534. click: function (sender) {
  16535. var scope = sender.up("yvtree");
  16536. scope.reload();
  16537. }
  16538. }
  16539. });
  16540. }
  16541. if (!newConfig.hideExpand) {
  16542. newConfig.tbar.push({
  16543. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16544. listeners: {
  16545. click: function (sender) {
  16546. var scope = sender.up("yvtree");
  16547. scope.expandAll();
  16548. }
  16549. }
  16550. });
  16551. }
  16552. if (!newConfig.hideCollapse) {
  16553. newConfig.tbar.push({
  16554. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16555. listeners: {
  16556. click: function (sender) {
  16557. var scope = sender.up("yvtree");
  16558. scope.collapseAll();
  16559. }
  16560. }
  16561. });
  16562. }
  16563. this.superclass.constructor.call(this, newConfig);
  16564. },
  16565. /**
  16566. * 在根节点上增加一个节点,会触发 addNode 事件
  16567. * @param props
  16568. */
  16569. addRoot: function (props) {
  16570. var me = this;
  16571. var tableNode = me.getRootNode();
  16572. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16573. if (_$2.isFunction(props)) {
  16574. props = props.call(this, parent);
  16575. }
  16576. _$2.forOwn(props, function (value, key) {
  16577. fieldNode.set(key, value);
  16578. });
  16579. var node = tableNode.appendChild(fieldNode);
  16580. me.ensureVisible(node);
  16581. me.setSelection(node);
  16582. me.fireEvent('addNode', me, {
  16583. parent: tableNode,
  16584. node: node,
  16585. });
  16586. },
  16587. addLast: function (props) {
  16588. var me = this;
  16589. var sel = me.selModel.getSelection();
  16590. if (!sel || sel.length <= 0) {
  16591. msg('请选择一个要添加的同级节点路径');
  16592. return;
  16593. }
  16594. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16595. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16596. if (_$2.isFunction(props)) {
  16597. props = props.call(this, parent);
  16598. }
  16599. _$2.forOwn(props, function (value, key) {
  16600. fieldNode.set(key, value);
  16601. });
  16602. var node = parent.appendChild(fieldNode);
  16603. me.ensureVisible(node);
  16604. me.setSelection(node);
  16605. me.fireEvent('addNode', me, {
  16606. parent: parent,
  16607. node: node,
  16608. });
  16609. },
  16610. addChildren: function (props) {
  16611. var me = this;
  16612. var sel = me.selModel.getSelection();
  16613. if (!sel || sel.length <= 0) {
  16614. msg('请选择一个要添加子节点的路径');
  16615. return;
  16616. }
  16617. var parent = sel[0];
  16618. if (_$2.isFunction(props)) {
  16619. props = props.call(this, parent);
  16620. }
  16621. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16622. _$2.forOwn(props, function (value, key) {
  16623. fieldNode.set(key, value);
  16624. });
  16625. var node = parent.appendChild(fieldNode);
  16626. parent.expand();
  16627. me.ensureVisible(node);
  16628. me.setSelection(node);
  16629. me.fireEvent('addNode', me, {
  16630. parent: parent,
  16631. node: node,
  16632. });
  16633. },
  16634. initComponent: function () {
  16635. var me = this;
  16636. var config = me.config;
  16637. var scope = lookupScope(this);
  16638. if (!isDesignMode(scope, config)) {
  16639. // 转换 dataSource 属性
  16640. convertDataSource(me, scope, config);
  16641. }
  16642. this.superclass.initComponent.call(this);
  16643. this.on({
  16644. afterrender: function (sender) {
  16645. var me = this;
  16646. var config = this.config;
  16647. var dataSource = config.dataSource;
  16648. if (config.autoLoad) {
  16649. if (config.dataSourceCallbackFn) {
  16650. me.reload();
  16651. }
  16652. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16653. me.reload();
  16654. }
  16655. }
  16656. }
  16657. });
  16658. },
  16659. _setDataReal: function (value) {
  16660. var me = this;
  16661. // me.setStore(new Ext.data.TreeStore({
  16662. // root: {
  16663. // expanded: true,
  16664. // // children: value
  16665. // children: [
  16666. // {
  16667. // id: '1', text: 'A',
  16668. // children: [
  16669. // {id: '1', text: 'A',},
  16670. // {id: '2', text: 'B'},
  16671. // ]
  16672. // },
  16673. // {id: '2', text: 'B'},
  16674. // ]
  16675. // }
  16676. // }))
  16677. me.store.setRoot({
  16678. expanded: true,
  16679. children: value
  16680. });
  16681. // me.store = new Ext.data.TreeStore({
  16682. // root: {
  16683. // expanded: true,
  16684. // // children: value
  16685. // children: [
  16686. // {
  16687. // id: '1', text: 'A',
  16688. // children: [
  16689. // {id: '1', text: 'A',},
  16690. // {id: '2', text: 'B'},
  16691. // ]
  16692. // },
  16693. // {id: '2', text: 'B'},
  16694. // ]
  16695. // }
  16696. // })
  16697. },
  16698. /**
  16699. * 重新载入数据(重新计算参数)
  16700. */
  16701. reload: function (reloadParams) {
  16702. if (reloadParams === void 0) { reloadParams = {}; }
  16703. var me = this;
  16704. var config = me.config;
  16705. if (config.dataSourceCallbackFn) {
  16706. // 函数请求刷新
  16707. var scope_1 = lookupScope(this);
  16708. // me.setLoading(true)
  16709. config.dataSourceCallbackFn.call(scope_1, me, {
  16710. successCallback: function (value) {
  16711. me._setDataReal(value);
  16712. // me.setLoading(false)
  16713. me.fireEvent('dataLoadComplete', me, true, value);
  16714. },
  16715. failCallback: function (error) {
  16716. // me.setLoading(false)
  16717. me.fireEvent('dataLoadComplete', me, false, error);
  16718. }
  16719. });
  16720. return;
  16721. }
  16722. var scope = lookupScope(me);
  16723. var dataSource = config.dataSource;
  16724. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16725. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16726. me.setLoading(true);
  16727. invokeServer$1(dataSource.url, params)
  16728. .then(function (res) {
  16729. me._setDataReal(res.data);
  16730. me.fireEvent('dataLoadComplete', me, res);
  16731. })
  16732. .finally(function () {
  16733. me.setLoading(false);
  16734. });
  16735. }
  16736. },
  16737. filterByText: function (text) {
  16738. this._filterText = text;
  16739. this._filterBy(this, text, 'text');
  16740. },
  16741. _filterBy: _$2.debounce(function (me, text, by) {
  16742. var view = me.getView();
  16743. me.store.clearFilter();
  16744. if (!me._filterText) {
  16745. // 没有筛选内容,还原状态
  16746. var selections = me.getSelection();
  16747. var selectionPaths_1 = [];
  16748. _$2.forEach(me.getSelection(), function (item) {
  16749. selectionPaths_1.push(item.getPath());
  16750. });
  16751. me.collapseAll();
  16752. _$2.forEach(selectionPaths_1, function (path) {
  16753. me.expandPath(path);
  16754. });
  16755. me.setSelection(selections);
  16756. return;
  16757. }
  16758. // 递归查找所有需要可见的节点 id 数组
  16759. var nodesAndParents = [];
  16760. var expandPaths = [];
  16761. me.getRootNode().cascadeBy(function (tree, view) {
  16762. var currNode = this;
  16763. currNode.collapse();
  16764. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16765. // 展开到匹配的路径
  16766. // me.expandPath(currNode.getPath());
  16767. expandPaths.push(currNode.getPath());
  16768. // 沿途父节点全部设定为可见
  16769. while (currNode.parentNode) {
  16770. nodesAndParents.push(currNode.id);
  16771. currNode = currNode.parentNode;
  16772. }
  16773. }
  16774. }, null, [me, view]);
  16775. me.store.filterBy(function (r) {
  16776. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16777. });
  16778. _$2.forEach(expandPaths, function (path) {
  16779. me.expandPath(path);
  16780. });
  16781. }, 1000),
  16782. });
  16783. }
  16784. function convertDataSource(sender, scope, newConfig) {
  16785. if (typeof newConfig.store !== 'undefined') {
  16786. // 有 store 属性的情况下,不做任何事
  16787. return;
  16788. }
  16789. if (typeof newConfig.dataSource === 'undefined') {
  16790. // 没有定义 dataSource 的情况下,不做任何事
  16791. return;
  16792. }
  16793. var dataSource = newConfig.dataSource;
  16794. if (typeof dataSource === 'string') {
  16795. // dataSource 是字符串的情况下,找到成员函数
  16796. dataSource = lookupFn(scope, dataSource);
  16797. }
  16798. if (typeof dataSource === 'function') {
  16799. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16800. newConfig.store = new Ext.data.TreeStore({
  16801. root: {
  16802. expanded: true,
  16803. children: []
  16804. }
  16805. });
  16806. newConfig.dataSourceCallbackFn = dataSource;
  16807. return;
  16808. }
  16809. // throw new TypeError('无法识别的调用方法')
  16810. }
  16811. //# sourceMappingURL=yvtree.js.map
  16812. /**
  16813. * 构建一个 grid 支持的 dataSource
  16814. */
  16815. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16816. if (reloadParams === void 0) { reloadParams = {}; }
  16817. if (isExcelExport === void 0) { isExcelExport = false; }
  16818. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16819. var _a;
  16820. var me = grid;
  16821. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16822. var storeOption = {};
  16823. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16824. if (dataSource.sqlId) {
  16825. dataSource.method = 'invoke';
  16826. dataSource.url = '/Dev@executeSQL';
  16827. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16828. // sqlId 是 @ 开头,代表直接带中文名
  16829. var scope_1 = lookupScope(grid);
  16830. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16831. params.sqlId = dataSource.sqlId.substring(1);
  16832. }
  16833. else {
  16834. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16835. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16836. params.path = path;
  16837. params.sqlId = sqlId;
  16838. }
  16839. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16840. }
  16841. var fields_1 = [];
  16842. _$2.forEach(grid.columns, function (col) {
  16843. var c = {};
  16844. if (col.dataIndex) {
  16845. c.name = col.dataIndex;
  16846. fields_1.push(c);
  16847. }
  16848. if (col.dataType) {
  16849. c.type = col.dataType;
  16850. }
  16851. });
  16852. // 默认支持 gridInvoke
  16853. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16854. //@ts-ignore
  16855. storeOption = {
  16856. fields: fields_1,
  16857. remoteSort: config.remoteSort,
  16858. remoteFilter: config.remoteFilter,
  16859. autoLoad: true,
  16860. pageSize: me.store.pageSize || config.pageSize,
  16861. proxy: {
  16862. type: 'jsonAjax',
  16863. $owner: me,
  16864. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16865. extraParams: extraParams,
  16866. reader: {
  16867. type: 'json',
  16868. rootProperty: 'data',
  16869. totalProperty: 'pagination.total',
  16870. successProperty: 'success',
  16871. messageProperty: 'msg',
  16872. transform: function (data) {
  16873. if (typeof window['ajaxProcess'] === 'function') {
  16874. window['ajaxProcess'](data);
  16875. }
  16876. if (typeof grid._transform === 'function') {
  16877. // 系统转换函数
  16878. grid._transform(data.data);
  16879. }
  16880. if (grid.dataTransform) {
  16881. if (typeof grid.dataTransform === 'string') {
  16882. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  16883. }
  16884. return grid.dataTransform.call(scope, grid, data);
  16885. }
  16886. return data;
  16887. }
  16888. }
  16889. },
  16890. listeners: {
  16891. load: function (store, records, successful, operation) {
  16892. var _a, _b, _c;
  16893. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  16894. if (rep.pagination) {
  16895. grid.dbInfo = rep.pagination.dbInfo;
  16896. grid.exportDataSql = rep.pagination.exportDataSql;
  16897. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  16898. }
  16899. 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;
  16900. if (isExcelExport) {
  16901. if (typeof excelExportCallBack === 'function') {
  16902. excelExportCallBack(rep);
  16903. }
  16904. else if (excelExportCallBack) {
  16905. console.error("导出回调方法错误!");
  16906. }
  16907. me.fireEvent('excelDataLoadComplete', me, successful, records);
  16908. }
  16909. else {
  16910. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  16911. // 自动选中第一行
  16912. var data = grid.getStore().data;
  16913. if (data.length > 0) {
  16914. grid.setSelection(data.items[0]);
  16915. }
  16916. }
  16917. me.fireEvent('dataLoadComplete', me, successful, records);
  16918. }
  16919. }
  16920. }
  16921. };
  16922. }
  16923. else if (exports.apiConvert) {
  16924. // 外部扩展的 apiConvert
  16925. //@ts-ignore
  16926. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams);
  16927. }
  16928. else {
  16929. throw new TypeError("不支持的 API 请求方式");
  16930. }
  16931. if (isExcelExport) {
  16932. var excelStore = new Ext.data.Store(storeOption);
  16933. excelStore.load();
  16934. }
  16935. else {
  16936. if (me.groupField) {
  16937. console.log('groupField', storeOption.groupField);
  16938. storeOption.groupField = me.groupField;
  16939. }
  16940. me.setStore(new Ext.data.Store(storeOption));
  16941. }
  16942. }
  16943. function initStores () {
  16944. Ext.define('Yvan.JsonAjaxProxy', {
  16945. extend: 'Ext.data.proxy.Ajax',
  16946. alias: 'proxy.jsonAjax',
  16947. actionMethods: {
  16948. create: "POST",
  16949. read: "POST",
  16950. update: "POST",
  16951. destroy: "POST"
  16952. },
  16953. timeout: storeAjax.timeout,
  16954. buildRequest: function (operation) {
  16955. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  16956. var me = this;
  16957. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  16958. var scope = lookupScope($owner);
  16959. var gridParam = me.getParams(operation);
  16960. var customParam = {};
  16961. // 提取 srot 元素
  16962. if (gridParam.sort) {
  16963. var sort = JSON.parse(gridParam.sort);
  16964. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  16965. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  16966. customParam.sortModel = [];
  16967. _$2.forEach(sort, function (s) {
  16968. customParam.sortModel.push({
  16969. colId: s.property,
  16970. sort: _$2.toLower(s.direction)
  16971. });
  16972. });
  16973. delete gridParam.sort;
  16974. }
  16975. // 提取筛选元素
  16976. if (gridParam.filter) {
  16977. var filter = JSON.parse(gridParam.filter);
  16978. console.log('gridParam.filter', gridParam.filter);
  16979. // "[{"operator":"like","value":"1","property":"id"}]"
  16980. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  16981. customParam.filterModel = {};
  16982. _$2.forEach(filter, function (s) {
  16983. var newFilterItem = {};
  16984. if (s.operator === 'like') {
  16985. newFilterItem.filterType = 'text';
  16986. newFilterItem.type = 'contains';
  16987. newFilterItem.filter = s.value;
  16988. }
  16989. else {
  16990. // 无法识别的筛选类型
  16991. newFilterItem.filterType = 'dict';
  16992. newFilterItem.type = 'in';
  16993. newFilterItem.filter = s.value;
  16994. }
  16995. customParam.filterModel[s.property] = newFilterItem;
  16996. });
  16997. delete gridParam.filter;
  16998. }
  16999. // 被 grid.constructor 作为方法存在
  17000. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17001. var params = _$2.defaultsDeep(gridParam, extraParams);
  17002. // var request = this.superclass.buildRequest.apply(this, arguments);
  17003. var request = new Ext.data.Request({
  17004. params: {},
  17005. action: operation.getAction(),
  17006. records: operation.getRecords(),
  17007. url: me.buildUrl(),
  17008. jsonData: __assign({ args: [
  17009. params
  17010. ] }, customParam),
  17011. proxy: me
  17012. });
  17013. operation.setRequest(request);
  17014. return request;
  17015. },
  17016. afterRequest: function (req, res) {
  17017. // Extend.afterExtRequest(req, res)
  17018. }
  17019. });
  17020. Ext.define('Ext.ux.data.MyReader', {
  17021. extend: 'Ext.data.reader.Json',
  17022. xtype: 'yvgridreader',
  17023. useSimpleAccessors: false,
  17024. });
  17025. }
  17026. //# sourceMappingURL=stores.js.map
  17027. function initBehaviorEdit(config) {
  17028. var _a, _b, _c;
  17029. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17030. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17031. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17032. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17033. if (dbTableName) {
  17034. // 生成增删查改
  17035. var tbar = [
  17036. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17037. click: 'system.saveGridRow()'
  17038. }, bind: {
  17039. disabled: '{!' + config.reference + '.ischanged}'
  17040. } }, saveButtonConfig),
  17041. '-',
  17042. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17043. click: 'system.insertGridRow()'
  17044. } }, addButtonConfig),
  17045. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17046. click: 'system.removeGridRow()'
  17047. } }, deleteButtonConfig),
  17048. ];
  17049. if (_$2.isArray(config.tbar)) {
  17050. config.tbar = __spread(tbar, [
  17051. '-'
  17052. ], config.tbar);
  17053. }
  17054. else if (_$2.isPlainObject(config.tbar)) {
  17055. config.tbar = {
  17056. border: false,
  17057. layout: {
  17058. type: 'vbox',
  17059. align: 'stretch'
  17060. },
  17061. items: [
  17062. {
  17063. xtype: 'toolbar',
  17064. border: false,
  17065. items: tbar
  17066. },
  17067. config.tbar,
  17068. ]
  17069. };
  17070. }
  17071. else if (_$2.isUndefined(config.tbar)) {
  17072. config.tbar = tbar;
  17073. }
  17074. else {
  17075. console.error("can't build tbar property!", config.tbar);
  17076. }
  17077. }
  17078. }
  17079. //# sourceMappingURL=grid_behavior.js.map
  17080. function initGridDialog(config) {
  17081. var detailDialog = _$2.get(config, 'detailDialog');
  17082. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17083. if (_$2.isPlainObject(detailDialog)) {
  17084. var tbar = [
  17085. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17086. click: 'system.showGridRowDetail()',
  17087. }, bind: {
  17088. disabled: '{!' + config.reference + '.selection}'
  17089. } }, detailButtonConfig)
  17090. ];
  17091. if (_$2.isArray(config.tbar)) {
  17092. config.tbar = __spread(config.tbar, [
  17093. '-'
  17094. ], tbar);
  17095. }
  17096. else if (_$2.isPlainObject(config.tbar)) {
  17097. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17098. config.tbar.items = __spread(config.tbar.items);
  17099. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17100. if (!toolbar) {
  17101. config.tbar.items = __spread(config.tbar.items, [
  17102. {
  17103. xtype: 'toolbar',
  17104. border: false,
  17105. items: tbar
  17106. },
  17107. ]);
  17108. }
  17109. else {
  17110. toolbar.items = __spread(toolbar.items, [
  17111. '-'
  17112. ], tbar);
  17113. }
  17114. }
  17115. else {
  17116. config.tbar = {
  17117. border: false,
  17118. layout: {
  17119. type: 'vbox',
  17120. align: 'stretch'
  17121. },
  17122. items: [
  17123. {
  17124. xtype: 'toolbar',
  17125. border: false,
  17126. items: tbar
  17127. },
  17128. config.tbar,
  17129. ]
  17130. };
  17131. }
  17132. }
  17133. else if (_$2.isUndefined(config.tbar)) {
  17134. config.tbar = tbar;
  17135. }
  17136. else {
  17137. console.error("can't build tbar property!", config.tbar);
  17138. }
  17139. }
  17140. }
  17141. var SystemEventFu$1 = /** @class */ (function () {
  17142. function SystemEventFu() {
  17143. }
  17144. SystemEventFu.prototype.showGridRowDetail = function () {
  17145. return function (sender) {
  17146. var grid1 = sender.up('yvgrid');
  17147. showGridRowDetail(grid1);
  17148. };
  17149. };
  17150. __decorate([
  17151. Lib({
  17152. title: '为某个表格所选数据行, 显示其对话框',
  17153. author: '罗一帆',
  17154. createAt: '2022-07-27',
  17155. updateAt: '2022-07-27',
  17156. type: 'system',
  17157. category: '表格',
  17158. }),
  17159. __metadata("design:type", Function),
  17160. __metadata("design:paramtypes", []),
  17161. __metadata("design:returntype", void 0)
  17162. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17163. return SystemEventFu;
  17164. }());
  17165. function showGridRowDetail(grid1, isEdit) {
  17166. if (isEdit === void 0) { isEdit = true; }
  17167. var _a, _b, _c;
  17168. if (!grid1.selection) {
  17169. msg$1('请选中要展示的数据行!');
  17170. return;
  17171. }
  17172. var record = grid1.selection;
  17173. if (_$2.isArray(record)) {
  17174. record = record[0];
  17175. }
  17176. if (!record) {
  17177. msg$1('请选中要展示的数据行!');
  17178. return;
  17179. }
  17180. var config = grid1._originVJson;
  17181. var detailDialog = config.detailDialog;
  17182. var vjson = {};
  17183. var parentScope = lookupScope(grid1);
  17184. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17185. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17186. _$2.defaultsDeep(vjson, {
  17187. // 强制属性
  17188. layout: 'fit',
  17189. __custom_path: __custom_path,
  17190. __custom_version: __custom_version,
  17191. fbar: __spread([
  17192. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17193. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17194. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17195. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17196. }, detailDialog, {
  17197. // 默认属性
  17198. width: 800,
  17199. height: 450,
  17200. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17201. });
  17202. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17203. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17204. vjson.items.push(tabpanel);
  17205. if (tabpanel) {
  17206. // 有多个选项卡,按每个选项卡进行过滤
  17207. _$2.forEach(tabpanel.items, function (tab) {
  17208. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17209. if (tabColumns.length > 0) {
  17210. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17211. _$2.extend(tab, tabVjson);
  17212. }
  17213. });
  17214. }
  17215. }
  17216. else {
  17217. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17218. }
  17219. var model = {
  17220. data: {
  17221. _edit: isEdit,
  17222. _editType: isEdit ? '编辑' : '添加',
  17223. }
  17224. };
  17225. _$2.forOwn(record.data, function (value, key) {
  17226. if (key === 'id') {
  17227. // 忽略 ID 属性
  17228. return;
  17229. }
  17230. if (_$2.startsWith(key, '_')) {
  17231. // 忽略 _ 开头的所有属性
  17232. return;
  17233. }
  17234. model.data[key] = value;
  17235. });
  17236. console.log(vjson);
  17237. var scope = new Scope({ vjson: vjson, model: model, });
  17238. //@ts-ignore
  17239. scope.commit = function () {
  17240. return new Promise(function (resolve) {
  17241. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17242. if (_$2.startsWith(key, '_')) {
  17243. // _origin 等属性可以被忽略
  17244. return;
  17245. }
  17246. if (key === 'id') {
  17247. // id 属性被忽略
  17248. return;
  17249. }
  17250. record.set(key, value);
  17251. });
  17252. resolve();
  17253. });
  17254. };
  17255. scope.showDialog(grid1, {}, {});
  17256. }
  17257. function buildForm(columns, tabpanel, detailDialog) {
  17258. var vjson = __assign({ border: false, layout: {
  17259. type: 'vbox',
  17260. pack: 'start',
  17261. align: 'stretch'
  17262. }, defaults: {
  17263. border: false,
  17264. anchor: '100%',
  17265. margin: '5',
  17266. }, scrollable: true, items: [] }, detailDialog.form);
  17267. var emptyFieldset = [];
  17268. var fieldsetList = [];
  17269. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17270. _$2.forEach(columns, function (c) {
  17271. var fieldset = _$2.get(c, 'form.fieldset');
  17272. if (fieldset) {
  17273. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17274. if (idx < 0) {
  17275. fieldsetList.push({
  17276. fieldset: fieldset,
  17277. columns: [c]
  17278. });
  17279. }
  17280. else {
  17281. fieldsetList[idx].columns.push(c);
  17282. }
  17283. }
  17284. else {
  17285. emptyFieldset.push(c);
  17286. }
  17287. });
  17288. _$2.forEach(fieldsetList, function (fs) {
  17289. var fieldSetVjson = {
  17290. xtype: 'fieldset',
  17291. title: fs.fieldset,
  17292. items: []
  17293. };
  17294. buildFieldItems(fieldSetVjson.items, fs.columns);
  17295. vjson.items.push(fieldSetVjson);
  17296. });
  17297. buildFieldItems(vjson.items, emptyFieldset);
  17298. return vjson;
  17299. }
  17300. // 构建字段组
  17301. function buildFieldItems(items, columns) {
  17302. var _a, _b, _c, _d, _e;
  17303. var row = {
  17304. xtype: 'cols',
  17305. items: []
  17306. };
  17307. for (var i = 0; i < columns.length; i++) {
  17308. var column = columns[i];
  17309. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17310. delete row.xtype;
  17311. row.layout = column.form.rowlayout;
  17312. }
  17313. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17314. row.items.push({ border: false, flex: column.form.prefix });
  17315. }
  17316. var fieldVjson = buildField(column, row.items.length);
  17317. if (!fieldVjson) {
  17318. continue;
  17319. }
  17320. row.items.push(fieldVjson);
  17321. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17322. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17323. }
  17324. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17325. items.push(row);
  17326. row = {
  17327. xtype: 'cols',
  17328. items: []
  17329. };
  17330. }
  17331. }
  17332. if (row.items.length > 0) {
  17333. items.push(row);
  17334. }
  17335. }
  17336. // 构建字段
  17337. function buildField(column, colIdx) {
  17338. var ret;
  17339. if (column.xtype === 'checkcolumn') {
  17340. ret = _$2.defaultsDeep({
  17341. xtype: 'checkbox',
  17342. uncheckedValue: column.uncheckedValue,
  17343. checkedValue: column.checkedValue,
  17344. boxLabel: column.header,
  17345. bind: {
  17346. value: '{' + column.dataIndex + '}'
  17347. }
  17348. }, column.form);
  17349. if (colIdx == 0) {
  17350. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17351. ret.margin = '0 0 0 85';
  17352. }
  17353. }
  17354. else {
  17355. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17356. fieldLabel: column.header,
  17357. bind: {
  17358. value: '{' + column.dataIndex + '}'
  17359. },
  17360. });
  17361. }
  17362. if (!ret.xtype) {
  17363. return;
  17364. }
  17365. if (!ret.dict && ret.xtype === 'combo') {
  17366. ret.dict = column.dict;
  17367. }
  17368. // 删除辅助属性
  17369. delete ret.order;
  17370. delete ret.wrap;
  17371. return ret;
  17372. }
  17373. //# sourceMappingURL=grid_dialog.js.map
  17374. var model$c = {
  17375. data: {}
  17376. };
  17377. //# sourceMappingURL=GridColumnCustom.model.js.map
  17378. var vjson$c = {
  17379. title: '自定义表格属性',
  17380. layout: 'fit',
  17381. width: 980,
  17382. height: 500,
  17383. fbar: [
  17384. {
  17385. xtype: "button",
  17386. text: "保存",
  17387. iconCls: 'x-fa fa-save',
  17388. listeners: {
  17389. click: 'scope.commit',
  17390. }
  17391. },
  17392. {
  17393. xtype: "button",
  17394. text: "关闭",
  17395. iconCls: 'x-fa fa-times',
  17396. listeners: {
  17397. click: 'system.closeMe()',
  17398. }
  17399. },
  17400. ],
  17401. items: [
  17402. {
  17403. region: 'center',
  17404. xtype: 'tabpanel',
  17405. items: [
  17406. {
  17407. title: '基本信息', reference: 'basic',
  17408. layout: {
  17409. type: 'vbox',
  17410. pack: 'start',
  17411. align: 'stretch'
  17412. },
  17413. defaults: {
  17414. border: false,
  17415. anchor: '100%',
  17416. margin: '5',
  17417. },
  17418. scrollable: true,
  17419. items: [
  17420. {
  17421. xtype: 'cols',
  17422. items: [
  17423. {
  17424. fieldLabel: '路径',
  17425. bind: { value: '{__custom_path}' },
  17426. xtype: 'textfield',
  17427. flex: 2,
  17428. },
  17429. {
  17430. fieldLabel: '版本',
  17431. bind: { value: '{__custom_version}' },
  17432. xtype: 'textfield',
  17433. },
  17434. ]
  17435. },
  17436. {
  17437. xtype: 'cols',
  17438. items: [
  17439. {
  17440. fieldLabel: '配置点',
  17441. bind: { value: '{__custom_point}' },
  17442. xtype: 'textfield',
  17443. },
  17444. {
  17445. fieldLabel: 'reference',
  17446. bind: { value: '{reference}' },
  17447. xtype: 'textfield',
  17448. },
  17449. {
  17450. fieldLabel: '编辑模式',
  17451. bind: { value: '{_mode}' },
  17452. xtype: 'combo',
  17453. dict: 'GRID_MODE',
  17454. },
  17455. ]
  17456. },
  17457. {
  17458. layout: 'hbox',
  17459. defaults: {
  17460. margin: '0 0 0 15',
  17461. },
  17462. items: [
  17463. {
  17464. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17465. bind: {
  17466. value: "{hideFootbar}"
  17467. }
  17468. },
  17469. {
  17470. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17471. bind: {
  17472. value: "{hideRefresh}"
  17473. }
  17474. },
  17475. {
  17476. boxLabel: '隐藏导出', xtype: 'checkbox',
  17477. bind: {
  17478. value: "{hideExport}"
  17479. }
  17480. },
  17481. {
  17482. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17483. bind: {
  17484. value: "{hideAutoSize}"
  17485. }
  17486. },
  17487. {
  17488. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17489. bind: {
  17490. value: "{hideClearFilter}"
  17491. }
  17492. },
  17493. {
  17494. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17495. bind: {
  17496. value: "{hideSaveGridUIConfig}"
  17497. }
  17498. },
  17499. {
  17500. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17501. bind: {
  17502. value: "{hideClearGridUIConfig}"
  17503. }
  17504. },
  17505. ]
  17506. },
  17507. {
  17508. layout: 'hbox',
  17509. defaults: {
  17510. margin: '0 0 0 15',
  17511. },
  17512. items: [
  17513. {
  17514. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17515. bind: { value: '{autoLoad}' },
  17516. margin: '0 0 0 85',
  17517. },
  17518. {
  17519. boxLabel: '分页模式', xtype: 'checkbox',
  17520. bind: { value: '{pagination}' },
  17521. },
  17522. {
  17523. boxLabel: '显示行序号', xtype: 'checkbox',
  17524. bind: { value: '{show_rownum}' },
  17525. },
  17526. {
  17527. boxLabel: '后端排序', xtype: 'checkbox',
  17528. bind: {
  17529. value: "{remoteSort}"
  17530. }
  17531. },
  17532. {
  17533. boxLabel: '后端过滤', xtype: 'checkbox',
  17534. bind: {
  17535. value: "{remoteFilter}"
  17536. }
  17537. },
  17538. {
  17539. boxLabel: '隐藏', xtype: 'checkbox',
  17540. bind: {
  17541. value: "{hidden}"
  17542. }
  17543. },
  17544. ]
  17545. },
  17546. {
  17547. layout: 'hbox',
  17548. defaults: {
  17549. margin: '0 0 0 15',
  17550. },
  17551. items: [
  17552. {
  17553. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17554. bind: {
  17555. value: "{enableColumnHide}"
  17556. }
  17557. },
  17558. {
  17559. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17560. bind: {
  17561. value: "{enableColumnMove}"
  17562. }
  17563. },
  17564. {
  17565. boxLabel: '自定义筛选', xtype: 'checkbox',
  17566. bind: {
  17567. value: "{gridfilters}"
  17568. }
  17569. },
  17570. {
  17571. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17572. bind: {
  17573. value: "{enableColumnResize}"
  17574. }
  17575. },
  17576. {
  17577. boxLabel: '点击列头排序', xtype: 'checkbox',
  17578. bind: {
  17579. value: "{sortOnClick}"
  17580. }
  17581. },
  17582. ]
  17583. },
  17584. {
  17585. xtype: 'cols',
  17586. items: [
  17587. {
  17588. fieldLabel: 'dbTableName',
  17589. labelWidth: 110,
  17590. bind: { value: '{behavior.dbTableName}' },
  17591. xtype: 'textfield',
  17592. },
  17593. {
  17594. fieldLabel: 'theid',
  17595. bind: { value: '{theid}' },
  17596. xtype: 'textfield',
  17597. },
  17598. {
  17599. fieldLabel: '添加行聚焦',
  17600. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17601. xtype: 'textfield',
  17602. },
  17603. ]
  17604. },
  17605. {
  17606. xtype: 'cols',
  17607. items: [
  17608. {
  17609. fieldLabel: '批量删除提示',
  17610. labelWidth: 110,
  17611. bind: { value: '{behavior.batchRemoveConfirm}' },
  17612. xtype: 'textfield',
  17613. },
  17614. {
  17615. fieldLabel: '删除提示',
  17616. bind: { value: '{behavior.singleRemoveConfirm}' },
  17617. xtype: 'textfield',
  17618. },
  17619. {
  17620. fieldLabel: '触发刷新',
  17621. labelWidth: 110,
  17622. bind: { value: '{behavior.selectToReload}' },
  17623. xtype: 'textfield',
  17624. },
  17625. ]
  17626. },
  17627. ]
  17628. },
  17629. {
  17630. title: '字段', reference: 'grid1',
  17631. xtype: 'yvgrid',
  17632. pagination: false,
  17633. _mode: 'edit',
  17634. listeners: {
  17635. buttonclick: 'scope.grid1Buttonclick',
  17636. },
  17637. hideFootbar: true,
  17638. tbar: [
  17639. {
  17640. xtype: 'button',
  17641. text: '添加',
  17642. iconCls: 'x-fa fa-plus-circle',
  17643. listeners: {
  17644. click: 'scope.addField'
  17645. }
  17646. },
  17647. {
  17648. xtype: 'button',
  17649. text: '删除',
  17650. iconCls: 'x-fa fa-minus-circle',
  17651. listeners: {
  17652. click: 'scope.removeField'
  17653. }
  17654. },
  17655. '-',
  17656. {
  17657. xtype: 'button',
  17658. text: '自动分析',
  17659. iconCls: 'x-fa fa-code-fork',
  17660. listeners: {
  17661. click: 'scope.calcField'
  17662. }
  17663. },
  17664. {
  17665. xtype: 'button',
  17666. text: '上移',
  17667. iconCls: 'x-fa fa-arrow-up',
  17668. listeners: {
  17669. click: 'scope.moveUp'
  17670. }
  17671. },
  17672. {
  17673. xtype: 'button',
  17674. text: '下移',
  17675. iconCls: 'x-fa fa-arrow-down',
  17676. listeners: {
  17677. click: 'scope.moveDown'
  17678. }
  17679. },
  17680. ],
  17681. store: {},
  17682. columns: [
  17683. {
  17684. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17685. editor: { xtype: 'textfield' }
  17686. },
  17687. {
  17688. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17689. editor: { xtype: 'textfield' }
  17690. },
  17691. {
  17692. dataIndex: 'header', header: '中文', width: 140,
  17693. editor: { xtype: 'textfield' }
  17694. },
  17695. {
  17696. dataIndex: 'dict', header: '字典', width: 110,
  17697. editor: { xtype: 'combogrid' }
  17698. },
  17699. {
  17700. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17701. editor: { xtype: 'combogrid' }, hidden: true,
  17702. },
  17703. {
  17704. dataIndex: 'width', header: '宽度', width: 80,
  17705. editor: { xtype: 'numberfield' }, hidden: true,
  17706. },
  17707. {
  17708. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17709. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17710. },
  17711. {
  17712. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17713. editor: { xtype: 'textfield' },
  17714. },
  17715. {
  17716. dataIndex: 'createValue', text: '客户端新创建值',
  17717. editor: { xtype: 'textfield' },
  17718. },
  17719. {
  17720. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17721. resizable: false, sortable: false, menuDisabled: true,
  17722. checkedValue: true, uncheckedValue: false,
  17723. },
  17724. {
  17725. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17726. resizable: false, sortable: false, menuDisabled: true,
  17727. checkedValue: true, uncheckedValue: false,
  17728. },
  17729. {
  17730. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17731. resizable: false, sortable: false, menuDisabled: true,
  17732. checkedValue: true, uncheckedValue: false,
  17733. },
  17734. {
  17735. dataIndex: 'formatter', header: '格式化', width: 110,
  17736. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17737. },
  17738. {
  17739. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17740. resizable: false, sortable: false, menuDisabled: true,
  17741. checkedValue: true, uncheckedValue: false, hidden: true,
  17742. },
  17743. {
  17744. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17745. resizable: false, sortable: false, menuDisabled: true,
  17746. hidden: true,
  17747. },
  17748. {
  17749. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17750. resizable: false, sortable: false, menuDisabled: true,
  17751. checkedValue: true, uncheckedValue: false, hidden: true,
  17752. },
  17753. {
  17754. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17755. resizable: false, sortable: false, menuDisabled: true,
  17756. },
  17757. {
  17758. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17759. resizable: false, sortable: false, menuDisabled: true,
  17760. checkedValue: true, uncheckedValue: false, hidden: true,
  17761. },
  17762. {
  17763. dataIndex: 'form_order', text: '对话框序号',
  17764. editor: { xtype: 'numberfield' },
  17765. },
  17766. {
  17767. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17768. resizable: false, sortable: false, menuDisabled: true,
  17769. checkedValue: true, uncheckedValue: false,
  17770. },
  17771. {
  17772. dataIndex: 'form_xtype', text: '对话框编辑器',
  17773. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17774. },
  17775. {
  17776. dataIndex: 'form_fieldset', text: '对话框字段组',
  17777. editor: { xtype: 'textfield' }, hidden: true,
  17778. },
  17779. {
  17780. dataIndex: 'form_tab', text: '对话框选项卡',
  17781. editor: { xtype: 'textfield' }, hidden: true,
  17782. },
  17783. {
  17784. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17785. resizable: false, sortable: false, menuDisabled: true,
  17786. checkedValue: true, uncheckedValue: false, hidden: true,
  17787. },
  17788. ],
  17789. },
  17790. {
  17791. title: 'SQL和查询条件', reference: 'sql',
  17792. layout: 'border',
  17793. border: false,
  17794. items: [
  17795. {
  17796. region: 'north',
  17797. height: 200,
  17798. border: false,
  17799. split: true,
  17800. xtype: 'yvgrid',
  17801. reference: 'gridCondition',
  17802. pagination: false,
  17803. hideFootbar: true,
  17804. _mode: 'edit',
  17805. listeners: {
  17806. buttonclick: 'scope.conditionButtonclick',
  17807. },
  17808. store: {},
  17809. tbar: {
  17810. xtype: 'toolbar',
  17811. border: false,
  17812. items: [
  17813. {
  17814. xtype: 'button',
  17815. text: '添加条件',
  17816. iconCls: 'x-fa fa-plus-circle',
  17817. listeners: {
  17818. click: 'scope.addCondition'
  17819. }
  17820. },
  17821. {
  17822. xtype: 'button',
  17823. text: '删除条件',
  17824. iconCls: 'x-fa fa-minus-circle',
  17825. listeners: {
  17826. click: 'scope.removeCondition'
  17827. }
  17828. },
  17829. '-',
  17830. {
  17831. xtype: 'button',
  17832. text: '自动分析条件变量',
  17833. iconCls: 'x-fa fa-code-fork',
  17834. listeners: {
  17835. click: 'scope.calcCondition'
  17836. }
  17837. },
  17838. {
  17839. xtype: 'button',
  17840. text: '上移',
  17841. iconCls: 'x-fa fa-arrow-up',
  17842. listeners: {
  17843. click: 'scope.moveUpCondition'
  17844. }
  17845. },
  17846. {
  17847. xtype: 'button',
  17848. text: '下移',
  17849. iconCls: 'x-fa fa-arrow-down',
  17850. listeners: {
  17851. click: 'scope.moveDownCondition'
  17852. }
  17853. },
  17854. ]
  17855. },
  17856. columns: [
  17857. {
  17858. text: '条件变量',
  17859. dataIndex: 'param_name',
  17860. width: 140,
  17861. sortable: false,
  17862. menuDisabled: true,
  17863. editor: {
  17864. selectOnFocus: true
  17865. },
  17866. },
  17867. {
  17868. text: '中文标题',
  17869. dataIndex: 'fieldLabel',
  17870. width: 120,
  17871. sortable: false,
  17872. menuDisabled: true,
  17873. editor: {
  17874. selectOnFocus: true
  17875. },
  17876. },
  17877. {
  17878. text: '编辑类型',
  17879. dataIndex: 'xtype',
  17880. width: 80,
  17881. sortable: false,
  17882. menuDisabled: true,
  17883. editor: {
  17884. xtype: 'combo',
  17885. typeAhead: true,
  17886. triggerAction: 'all',
  17887. selectOnFocus: true,
  17888. store: [
  17889. ['textfield', 'textfield'],
  17890. ['combo', 'combo'],
  17891. ['datefield', 'datefield'],
  17892. ['datetimefield', 'datetimefield'],
  17893. ['numberfield', 'numberfield'],
  17894. ['multiplesearch', 'multiplesearch'],
  17895. ]
  17896. }
  17897. },
  17898. {
  17899. text: '权重',
  17900. dataIndex: 'conditionFieldFlex',
  17901. align: 'right',
  17902. width: 60,
  17903. sortable: false,
  17904. menuDisabled: true,
  17905. editor: {
  17906. xtype: 'numberfield',
  17907. selectOnFocus: false,
  17908. minValue: 0,
  17909. maxValue: 10
  17910. },
  17911. },
  17912. {
  17913. text: '字典',
  17914. dataIndex: 'conditionFieldDict',
  17915. width: 160,
  17916. sortable: false,
  17917. menuDisabled: true,
  17918. editor: {
  17919. selectOnFocus: false
  17920. },
  17921. },
  17922. {
  17923. xtype: 'checkcolumn',
  17924. dataIndex: "conditionFieldWrap", header: "换行",
  17925. width: 65,
  17926. sortable: false,
  17927. menuDisabled: true,
  17928. },
  17929. {
  17930. text: '扩展参数',
  17931. dataIndex: 'conditionFieldExtend',
  17932. sortable: false,
  17933. menuDisabled: true,
  17934. editor: {
  17935. selectOnFocus: false
  17936. },
  17937. },
  17938. ]
  17939. },
  17940. {
  17941. region: 'center',
  17942. xtype: 'sqleditor',
  17943. layout: 'fit',
  17944. reference: 'sqlEditor',
  17945. split: true,
  17946. },
  17947. ]
  17948. },
  17949. {
  17950. title: '详情对话框',
  17951. layout: {
  17952. type: 'vbox',
  17953. pack: 'start',
  17954. align: 'stretch'
  17955. },
  17956. defaults: {
  17957. border: false,
  17958. anchor: '100%',
  17959. margin: '5',
  17960. },
  17961. scrollable: true,
  17962. items: [
  17963. {
  17964. xtype: 'cols',
  17965. items: [
  17966. {
  17967. fieldLabel: '对话框标题',
  17968. bind: { value: '{detailDialog.title}' },
  17969. xtype: 'textfield',
  17970. flex: 2,
  17971. },
  17972. {
  17973. fieldLabel: '宽度',
  17974. bind: { value: '{detailDialog.width}' },
  17975. xtype: 'numberfield',
  17976. },
  17977. {
  17978. fieldLabel: '高度',
  17979. bind: { value: '{detailDialog.height}' },
  17980. xtype: 'numberfield',
  17981. },
  17982. ]
  17983. },
  17984. ]
  17985. },
  17986. {
  17987. title: '界面源码',
  17988. xtype: 'jseditor',
  17989. reference: 'jseditor'
  17990. }
  17991. ]
  17992. }
  17993. ]
  17994. };
  17995. //# sourceMappingURL=GridColumnCustom.view.js.map
  17996. var GridColumnCustom = /** @class */ (function (_super) {
  17997. __extends(GridColumnCustom, _super);
  17998. function GridColumnCustom() {
  17999. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18000. }
  18001. GridColumnCustom.prototype.commit = function () {
  18002. };
  18003. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18004. };
  18005. GridColumnCustom.prototype.conditionButtonclick = function () {
  18006. };
  18007. GridColumnCustom.prototype.addField = function () {
  18008. };
  18009. GridColumnCustom.prototype.removeField = function () {
  18010. };
  18011. GridColumnCustom.prototype.calcField = function () {
  18012. };
  18013. GridColumnCustom.prototype.moveUp = function () {
  18014. };
  18015. GridColumnCustom.prototype.moveDown = function () {
  18016. };
  18017. GridColumnCustom.prototype.addCondition = function () {
  18018. };
  18019. GridColumnCustom.prototype.removeCondition = function () {
  18020. };
  18021. GridColumnCustom.prototype.calcCondition = function () {
  18022. };
  18023. GridColumnCustom.prototype.moveUpCondition = function () {
  18024. };
  18025. GridColumnCustom.prototype.moveDownCondition = function () {
  18026. };
  18027. return GridColumnCustom;
  18028. }(Scope));
  18029. //# sourceMappingURL=GridColumnCustom.js.map
  18030. function initGridCode(grid, newConfig, buttons) {
  18031. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18032. buttons.push({
  18033. xtype: 'button',
  18034. tooltip: '定义表格属性',
  18035. iconCls: 'x-fa fa-codepen',
  18036. handler: function (btn) {
  18037. var customWindow = new GridColumnCustom();
  18038. customWindow.showDialog(btn, {}, {});
  18039. }
  18040. });
  18041. buttons.push({
  18042. xtype: 'button',
  18043. tooltip: '定义表格数据源',
  18044. iconCls: 'x-fa fa-database',
  18045. handler: function () {
  18046. // showCustomGridDataSource(grid)
  18047. }
  18048. });
  18049. }
  18050. }
  18051. //# sourceMappingURL=grid_code.js.map
  18052. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18053. var hexToString = function (hex) {
  18054. var arr = hex.split("");
  18055. var out = "";
  18056. for (var i = 0; i < arr.length / 2; i++) {
  18057. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18058. // @ts-ignore
  18059. var charValue = String.fromCharCode(tmp);
  18060. out += charValue;
  18061. }
  18062. return out;
  18063. };
  18064. var defaultGrid = grid;
  18065. function initGrid () {
  18066. Ext.define('Yvan.Grid', {
  18067. extend: 'Ext.grid.Panel',
  18068. xtype: 'yvgrid',
  18069. __suspendReload: false,
  18070. _originVJson: {},
  18071. constructor: function (config) {
  18072. var _this = this;
  18073. var _a, _b, _c, _d, _e, _f;
  18074. var me = this;
  18075. var dataSource = config.dataSource;
  18076. 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);
  18077. me._originVJson = config;
  18078. if (!isDesignMode(scope, config)) {
  18079. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18080. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18081. var cacheData = this.getColumnConfigCache();
  18082. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18083. var newColumns = [];
  18084. for (var j = 0; j < cacheData.length; j++) {
  18085. var itData = cacheData[j];
  18086. for (var i = 0; i < config.columns.length; i++) {
  18087. var column = config.columns[i];
  18088. if (itData.dataIndex === column.dataIndex) {
  18089. if (itData.width) {
  18090. column.width = itData.width;
  18091. }
  18092. column.hidden = itData.hidden;
  18093. column.locked = itData.locked;
  18094. newColumns.push(column);
  18095. break;
  18096. }
  18097. }
  18098. }
  18099. config.columns = newColumns;
  18100. }
  18101. }
  18102. }
  18103. var newConfig = _$2.defaultsDeep({
  18104. // 强制性属性 bug.
  18105. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18106. // enableLocking: false,
  18107. // syncRowHeight: false,
  18108. }, baseConfig(config, 'row-item'), config, grid);
  18109. // 在面板上的组件
  18110. // const scope = newConfig.$initParent?.yvanScope ||
  18111. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18112. // config.$vmParent?.yvanScope ||
  18113. // newConfig.$vmParent?._parent?.yvanScope;
  18114. var buttons = [];
  18115. var getRowClass = newConfig.getRowClass;
  18116. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18117. _$2.startsWith(getRowClass, "system."))) {
  18118. var fn = lookupFn(scope, getRowClass);
  18119. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18120. }
  18121. if (!newConfig.hideExport) {
  18122. buttons.push({
  18123. xtype: 'button',
  18124. tooltip: '导出Excel',
  18125. iconCls: 'x-fa fa-download',
  18126. listeners: {
  18127. click: this.exportExcel
  18128. },
  18129. });
  18130. }
  18131. if (!newConfig.hideAutoSize) {
  18132. buttons.push({
  18133. xtype: 'button',
  18134. iconCls: 'x-fa fa-text-width',
  18135. tooltip: '自适应宽度',
  18136. listeners: {
  18137. click: this.autoSizeColumns
  18138. }
  18139. });
  18140. }
  18141. if (!newConfig.hideClearFilter) {
  18142. buttons.push({
  18143. xtype: 'button',
  18144. tooltip: '清空筛选',
  18145. iconCls: 'x-fa fa-filter',
  18146. handler: this.clearFilter
  18147. });
  18148. }
  18149. if (!newConfig.hideSaveGridUIConfig) {
  18150. buttons.push({
  18151. xtype: 'button',
  18152. tooltip: '保存布局',
  18153. iconCls: 'x-fa fa-cogs',
  18154. handler: this.saveGridUIConfig
  18155. });
  18156. }
  18157. if (!newConfig.hideClearGridUIConfig) {
  18158. buttons.push({
  18159. xtype: 'button',
  18160. tooltip: '还原布局',
  18161. iconCls: 'x-fa fa-reply-all',
  18162. handler: this.clearGridUIConfig
  18163. });
  18164. }
  18165. initGridCode(me, newConfig, buttons);
  18166. if (!newConfig.hideFootbar) {
  18167. if (newConfig.pagination) {
  18168. newConfig.bbar = new Ext.PagingToolbar({
  18169. // pageSize: newConfig.pageSize, 这个值是无效的
  18170. displayInfo: true,
  18171. store: this.store,
  18172. emptyMsg: '没有记录',
  18173. cls: 'grid-bbar',
  18174. items: __spread([
  18175. {
  18176. xtype: 'combobox',
  18177. tooltip: '分页',
  18178. queryMode: 'local',
  18179. editable: false,
  18180. allowBlank: true,
  18181. labelAlign: 'right',
  18182. width: 90,
  18183. // labelWidth: 30,
  18184. listConfig: {
  18185. minWidth: null
  18186. },
  18187. value: 50,
  18188. valueField: undefined,
  18189. displayField: undefined,
  18190. hideClear: true,
  18191. store: newConfig.pageSizeOption,
  18192. listeners: {
  18193. change: function (sender, nv, ov) {
  18194. _this.store.pageSize = nv;
  18195. _this.store.loadPage(1);
  18196. }
  18197. }
  18198. }
  18199. ], buttons),
  18200. doRefresh: function () {
  18201. me.reload();
  18202. }
  18203. });
  18204. }
  18205. else {
  18206. newConfig.bbar = {
  18207. xtype: 'toolbar', overflowHandler: 'menu',
  18208. cls: 'grid-bbar',
  18209. items: __spread([
  18210. {
  18211. xtype: 'button',
  18212. tooltip: '刷新',
  18213. iconCls: 'x-fa fa-refresh',
  18214. handler: function () {
  18215. _this.reload();
  18216. }
  18217. },
  18218. '-'
  18219. ], buttons)
  18220. };
  18221. if (newConfig.hideRefresh) {
  18222. newConfig.bbar.items.splice(0, 1);
  18223. }
  18224. }
  18225. }
  18226. if (_$2.isArray(newConfig.condition)) {
  18227. // 带查询条件
  18228. var conditionRows_1 = [];
  18229. var newRow_1 = false;
  18230. var currentRow_1 = { xtype: 'cols', items: [], };
  18231. conditionRows_1.push(currentRow_1);
  18232. _$2.forEach(newConfig.condition, function (item) {
  18233. var _a;
  18234. if (newRow_1) {
  18235. currentRow_1 = { xtype: 'cols', items: [], };
  18236. conditionRows_1.push(currentRow_1);
  18237. }
  18238. var vj = _$2.cloneDeep(item);
  18239. if (vj.xtype) {
  18240. if (item.xtype === 'combo' && item.dict) {
  18241. vj.fix = ['system.getDict("' + item.dict + '")'];
  18242. }
  18243. if (item.xtype === 'datetimefield') {
  18244. _$2.defer(function () {
  18245. //@ts-ignore
  18246. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18247. });
  18248. }
  18249. else if (item.xtype === 'datefield') {
  18250. _$2.defer(function () {
  18251. //@ts-ignore
  18252. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18253. });
  18254. }
  18255. else {
  18256. scope.viewModel.set(item.param_name, '');
  18257. }
  18258. }
  18259. else {
  18260. // 没有组件类型,是个空占位符
  18261. vj.border = false;
  18262. }
  18263. if (item.param_name) {
  18264. vj.bind = {
  18265. value: '{' + item.param_name + '}'
  18266. };
  18267. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18268. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18269. }
  18270. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18271. currentRow_1.items.push(vj);
  18272. });
  18273. newConfig.tbar = {
  18274. xtype: 'form',
  18275. border: false,
  18276. items: conditionRows_1,
  18277. defaults: {
  18278. margin: '8 0 8 0'
  18279. },
  18280. };
  18281. console.log('newConfig', newConfig);
  18282. }
  18283. _$2.each(newConfig.columns, function (c) {
  18284. var renderer = c.renderer, formatter = c.formatter;
  18285. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18286. _$2.startsWith(renderer, "system."))) {
  18287. if (newConfig.$initParent) {
  18288. if (scope) {
  18289. var rendererFn = lookupFn(scope, renderer);
  18290. c.renderer = rendererFn.bind(scope);
  18291. }
  18292. }
  18293. }
  18294. if (c.dict) {
  18295. c.fix = ['system.getDict("' + c.dict + '")'];
  18296. if (c.editor && c.editor.xtype === 'combo') {
  18297. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18298. c.editor.typeAhead = true;
  18299. c.editor.triggerAction = 'all';
  18300. c.editor.selectOnFocus = false;
  18301. c.editor.listConfig = {
  18302. minWidth: 200
  18303. };
  18304. }
  18305. }
  18306. if (formatter === 'button') {
  18307. c.tdCls = 'td-btn';
  18308. if (!c.listeners) {
  18309. c.listeners = {};
  18310. }
  18311. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18312. if ($(event.target).is('input')) {
  18313. me.fireEvent('buttonclick', me, this, record);
  18314. }
  18315. };
  18316. }
  18317. else if (formatter === 'percentRenderer') {
  18318. c.tdCls = 'td-percent';
  18319. }
  18320. });
  18321. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18322. // 强制为编辑模式
  18323. newConfig.selModel = {
  18324. type: 'spreadsheet',
  18325. columnSelect: true,
  18326. pruneRemoved: false,
  18327. extensible: 'y'
  18328. };
  18329. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18330. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18331. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18332. }
  18333. else {
  18334. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18335. }
  18336. }
  18337. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18338. // 强制为勾选模式
  18339. newConfig.selModel = {
  18340. type: 'checkboxmodel',
  18341. mode: 'MULTI',
  18342. };
  18343. }
  18344. else if (newConfig._mode === 'checkonly') {
  18345. newConfig.selModel = {
  18346. type: 'checkboxmodel',
  18347. mode: 'MULTI',
  18348. checkOnly: true,
  18349. };
  18350. }
  18351. else if (newConfig._mode === 'select') {
  18352. // 强制为选择模式
  18353. newConfig.selModel = {
  18354. selType: 'rowmodel',
  18355. mode: 'SINGLE',
  18356. };
  18357. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18358. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18359. }
  18360. }
  18361. initBehaviorEdit(newConfig);
  18362. initGridDialog(newConfig);
  18363. this.superclass.constructor.call(this, newConfig);
  18364. this.store.pageSize = newConfig.pageSize;
  18365. },
  18366. setData: function (value) {
  18367. var me = this;
  18368. me._setDataReal(value);
  18369. },
  18370. /**
  18371. * 添加行,并进入编辑状态
  18372. * @param record 新行的属性集
  18373. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18374. */
  18375. appendEditRow: function (record, editRowCol) {
  18376. var records = this.getStore().add(record);
  18377. var recNew = records[0];
  18378. this.setSelection(records);
  18379. if (typeof editRowCol === 'string' && editRowCol) {
  18380. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18381. }
  18382. if (typeof editRowCol === 'number') {
  18383. var ce = this.findPlugin('cellediting');
  18384. this.editingPlugin = ce;
  18385. ce.startEdit(recNew, editRowCol);
  18386. }
  18387. },
  18388. beginEdit: function (record, editRowCol) {
  18389. if (typeof record === 'number') {
  18390. record = this.store.data.getAt(record);
  18391. }
  18392. if (record.isEntity === true) {
  18393. this.setSelection([record]);
  18394. if (typeof editRowCol === 'string' && editRowCol) {
  18395. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18396. }
  18397. if (typeof editRowCol === 'number') {
  18398. var ce = this.findPlugin('cellediting');
  18399. this.editingPlugin = ce;
  18400. ce.startEdit(record, editRowCol);
  18401. }
  18402. }
  18403. },
  18404. /**
  18405. * 移除行
  18406. * @param record 如果记录传空,就是当前选中的行
  18407. */
  18408. removeEditRow: function (record) {
  18409. if (!record) {
  18410. record = this.selection;
  18411. }
  18412. if (!record) {
  18413. msg('请选中要删除的行');
  18414. return;
  18415. }
  18416. this.getStore().remove(record);
  18417. },
  18418. /**
  18419. * 获取全部原始数据
  18420. */
  18421. getDataRows: function () {
  18422. return this.getStore().data.items.map(function (r) { return r.data; });
  18423. },
  18424. /**
  18425. * 获取全部原始数据, 不带 id/ 不带 origin
  18426. */
  18427. getDataRowsOnlyData: function () {
  18428. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18429. delete r.id;
  18430. delete r._origin;
  18431. return r;
  18432. });
  18433. },
  18434. rowMoveUp: function () {
  18435. var grid = this;
  18436. if (!grid.selection) {
  18437. msg('无法对多行进行移动');
  18438. return;
  18439. }
  18440. var record = grid.selection;
  18441. if (_$2.isArray(record)) {
  18442. record = record[0];
  18443. }
  18444. if (!record) {
  18445. msg('无法对多行进行移动');
  18446. return;
  18447. }
  18448. // const records = grid.selModel.getSelection()
  18449. // if (records.length !== 1) {
  18450. // msg('无法对多行进行移动')
  18451. // return
  18452. // }
  18453. //
  18454. // const [record] = records
  18455. var index = grid.store.indexOf(record);
  18456. if (index > 0) {
  18457. grid.store.removeAt(index);
  18458. grid.store.insert(index - 1, record);
  18459. grid.getView().refresh();
  18460. grid.selModel.select([record]);
  18461. }
  18462. },
  18463. rowMoveDown: function () {
  18464. var grid = this;
  18465. // const records = grid.selModel.getSelection()
  18466. // if (records.length !== 1) {
  18467. // msg('无法对多行进行移动')
  18468. // return
  18469. // }
  18470. if (!grid.selection) {
  18471. msg('无法对多行进行移动');
  18472. return;
  18473. }
  18474. var record = grid.selection;
  18475. if (_$2.isArray(record)) {
  18476. record = record[0];
  18477. }
  18478. if (!record) {
  18479. msg('无法对多行进行移动');
  18480. return;
  18481. }
  18482. var index = grid.store.indexOf(record);
  18483. if (index < grid.store.getCount() - 1) {
  18484. grid.store.removeAt(index);
  18485. grid.store.insert(index + 1, record);
  18486. grid.getView().refresh();
  18487. grid.selModel.select([record]);
  18488. }
  18489. },
  18490. getEditRecord: function () {
  18491. var _a, _b;
  18492. var me = this;
  18493. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18494. 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;
  18495. var record;
  18496. if (typeof rowIdx === 'undefined') {
  18497. record = me.getSelectionModel().getLastSelected();
  18498. }
  18499. else {
  18500. record = me.store.getAt(rowIdx);
  18501. }
  18502. return record;
  18503. },
  18504. getEditRow: function () {
  18505. var _a;
  18506. var me = this;
  18507. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18508. },
  18509. setEditRow: function (rowValues) {
  18510. var me = this;
  18511. var record = me.getEditRecord();
  18512. if (record) {
  18513. _$2.forOwn(rowValues, function (v, k) {
  18514. record.set(k, v);
  18515. });
  18516. }
  18517. },
  18518. _transform: function (data) {
  18519. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18520. _$2.forEach(data, function (row) {
  18521. row._origin = _$2.clone(row);
  18522. });
  18523. },
  18524. _setDataReal: function (value) {
  18525. var me = this;
  18526. this._transform(value);
  18527. var storeOpt = {
  18528. fields: getFileds(this),
  18529. data: value,
  18530. };
  18531. if (this.groupField) {
  18532. storeOpt.groupField = this.groupField;
  18533. }
  18534. var store = new Ext.data.Store(storeOpt);
  18535. me.setStore(store);
  18536. },
  18537. setStore: function (store) {
  18538. var me = this;
  18539. if (_$2.isArray(store)) {
  18540. var value = store;
  18541. this._transform(value);
  18542. var storeOpt = {
  18543. fields: getFileds(this),
  18544. data: value,
  18545. };
  18546. if (this.groupField) {
  18547. storeOpt.groupField = this.groupField;
  18548. }
  18549. store = new Ext.data.Store(storeOpt);
  18550. }
  18551. me.superclass.setStore.call(this, store);
  18552. var reference = this.reference;
  18553. if (reference) {
  18554. var scope = lookupScope(this);
  18555. scope.viewModel.set(reference + '.ischanged', false);
  18556. scope.viewModel.set(reference + '.theid', null);
  18557. scope.viewModel.set(reference + '.theid2', null);
  18558. scope.viewModel.set(reference + '.theid3', null);
  18559. }
  18560. if (store) {
  18561. store.on({
  18562. add: function (store, records, index, eOpts) {
  18563. me._raiseChange(store, 'add');
  18564. },
  18565. remove: function (store, records, index, isMove, eOpts) {
  18566. me._raiseChange(store, 'remove');
  18567. },
  18568. datachanged: function (sender, opt) {
  18569. me._raiseChange(store, 'datachanged');
  18570. }
  18571. });
  18572. }
  18573. },
  18574. _raiseChange: function (store, type) {
  18575. var _a, _b;
  18576. var reference = this.reference;
  18577. if (reference && store) {
  18578. var ischanged = false;
  18579. if (store.getModifiedRecords().length > 0 ||
  18580. store.getNewRecords().length > 0 ||
  18581. store.getRemovedRecords().length > 0) {
  18582. ischanged = true;
  18583. }
  18584. else {
  18585. ischanged = false;
  18586. }
  18587. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18588. }
  18589. },
  18590. /**
  18591. * 轻量级刷新
  18592. */
  18593. refreshData: function () {
  18594. var store = this.getStore();
  18595. if (store) {
  18596. store.reload();
  18597. }
  18598. },
  18599. /**
  18600. * 为表格强制设置焦点
  18601. * @param seq 顺序号
  18602. */
  18603. focusRow: function (seq) {
  18604. this.setSelection(this.store.getAt(seq));
  18605. this.getView().focusRow(seq);
  18606. },
  18607. /**
  18608. * 重新载入数据(重新计算参数)
  18609. */
  18610. reload: function (reloadParams) {
  18611. if (reloadParams === void 0) { reloadParams = {}; }
  18612. var me = this;
  18613. var config = me.config;
  18614. if (config.dataSourceCallbackFn) {
  18615. // 函数请求刷新
  18616. var scope_1 = lookupScope(this);
  18617. _$2.defer(function () {
  18618. me.setLoading(true);
  18619. });
  18620. config.dataSourceCallbackFn.call(scope_1, me, {
  18621. successCallback: function (value) {
  18622. me._setDataReal(value);
  18623. _$2.defer(function () {
  18624. me.setLoading(false);
  18625. });
  18626. // 自动选中第一行
  18627. var data = me.getStore().data;
  18628. if (data.length > 0) {
  18629. me.setSelection(data.items[0]);
  18630. }
  18631. me.fireEvent('dataLoadComplete', me, true, value);
  18632. },
  18633. failCallback: function (error) {
  18634. _$2.defer(function () {
  18635. me.setLoading(false);
  18636. });
  18637. me.fireEvent('dataLoadComplete', me, false, error);
  18638. }
  18639. });
  18640. return;
  18641. }
  18642. // if (this.store) {
  18643. // this.store.reload({aaaa: 1, bbbb: 2})
  18644. // }
  18645. var dataSource = config.dataSource;
  18646. var scope = lookupScope(me);
  18647. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18648. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18649. }
  18650. },
  18651. exportCurrentExcelClick: function () {
  18652. var _a;
  18653. var me = this;
  18654. var config = me.config;
  18655. var scope = lookupScope(me);
  18656. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18657. if (excelFileName.endsWith(".xlsx")) {
  18658. excelFileName = excelFileName.split(".xlsx")[0];
  18659. }
  18660. excelFileName += ".xlsx";
  18661. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18662. var excelData = me.makeExcelData(rowsAll);
  18663. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18664. },
  18665. exportExcelClick: function (excelExportParams) {
  18666. var me = this;
  18667. var config = me.config;
  18668. excelExportParams.isExcelExport = true;
  18669. var scope = lookupScope(me);
  18670. var dataSource = config.dataSource;
  18671. scope.setLoading(true);
  18672. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18673. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18674. var _a, _b, _c, _d;
  18675. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18676. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18677. 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;
  18678. me.exportExcelCurrentPage = page;
  18679. me.exportExcelPageSize = size;
  18680. me.exportExcelTotal = total;
  18681. if (excelFileName.endsWith(".xlsx")) {
  18682. excelFileName = excelFileName.split(".xlsx")[0];
  18683. }
  18684. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18685. excelFileName += ".xlsx";
  18686. var excelData = me.makeExcelData(responseData.data);
  18687. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18688. if (page < total / size) {
  18689. page++;
  18690. me.exportExcelCurrentPage = page;
  18691. }
  18692. scope.setLoading(false);
  18693. });
  18694. },
  18695. exportBigExcelClick: function () {
  18696. var _a;
  18697. var me = this;
  18698. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18699. showErrorDialog('当前表格不支持大批量导出');
  18700. return;
  18701. }
  18702. var config = me.config;
  18703. var scope = lookupScope(me);
  18704. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18705. var head = [];
  18706. var dict = {};
  18707. _$2.forEach(me.columns, function (column) {
  18708. if (column.isHidden())
  18709. return;
  18710. if (!column.dataIndex)
  18711. return;
  18712. if (!column.text)
  18713. return;
  18714. head.push({ field: column.dataIndex, name: column.text });
  18715. if (column.dictForExcel) {
  18716. dict[column.dataIndex] = column.dictForExcel;
  18717. }
  18718. });
  18719. // 判断是否需要解密
  18720. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18721. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18722. me.dbInfo.password = hexToString(me.dbInfo.password);
  18723. me.dbInfo.username = hexToString(me.dbInfo.username);
  18724. }
  18725. scope.setLoading(true);
  18726. Ext.Ajax.request({
  18727. timeout: 15000,
  18728. url: window["EXPORT_DATA_HOST"],
  18729. method: "POST",
  18730. jsonData: {
  18731. file: excelFileName,
  18732. dbInfo: me.dbInfo,
  18733. exportDataSql: me.exportDataSql,
  18734. exportDataSqlParams: me.exportDataSqlParams,
  18735. head: head,
  18736. dict: dict,
  18737. },
  18738. }).then(function () {
  18739. scope.setLoading(false);
  18740. msg('请求成功');
  18741. }).catch(function () {
  18742. scope.setLoading(false);
  18743. showErrorDialog('请求失败,请确认是否已安装客户端');
  18744. });
  18745. },
  18746. makeExcelData: function (jsonData) {
  18747. var me = this;
  18748. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18749. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18750. return;
  18751. }
  18752. var data = [];
  18753. // 获取表格的列定义
  18754. var headerTextArr = [];
  18755. var headers = [];
  18756. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18757. var header = me.headerCt.getGridColumns()[i];
  18758. if (!header.isHidden()) {
  18759. var textStr = _$2.trim(header.text);
  18760. var dataIndexStr = _$2.trim(header.dataIndex);
  18761. if (dataIndexStr) {
  18762. if (textStr === '') {
  18763. headerTextArr.push(dataIndexStr);
  18764. }
  18765. else {
  18766. headerTextArr.push(textStr);
  18767. }
  18768. headers.push(header);
  18769. }
  18770. }
  18771. }
  18772. if (headers.length === 0) {
  18773. return;
  18774. }
  18775. data.push(headerTextArr);
  18776. for (var i = 0; i < jsonData.length; i++) {
  18777. var dataRow = jsonData[i];
  18778. var row = [];
  18779. for (var j = 0; j < headers.length; j++) {
  18780. var key = headers[j].dataIndex;
  18781. var value = dataRow[key];
  18782. if (!value && value !== 0) {
  18783. value = '';
  18784. }
  18785. var oValue = value;
  18786. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18787. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18788. try {
  18789. value = headers[j].renderer(value);
  18790. if (!value && value !== 0) {
  18791. value = oValue;
  18792. }
  18793. }
  18794. catch (e) {
  18795. value = oValue;
  18796. }
  18797. }
  18798. row.push(value);
  18799. }
  18800. data.push(row);
  18801. }
  18802. return data;
  18803. },
  18804. initComponent: function () {
  18805. var _this = this;
  18806. var _a;
  18807. var me = this;
  18808. var config = me.config;
  18809. var scope = lookupScope(this);
  18810. if (isDesignMode(scope, config)) {
  18811. this.superclass.initComponent.call(this);
  18812. return;
  18813. }
  18814. // 转换 dataSource 属性
  18815. convertDataSource$1(me, scope, config);
  18816. this.on({
  18817. afterrender: function (sender) {
  18818. var me = this;
  18819. var config = this.config;
  18820. var dataSource = config.dataSource;
  18821. if (config.autoLoad) {
  18822. if (config.dataSourceCallbackFn) {
  18823. me.reload();
  18824. }
  18825. else if (_$2.isPlainObject(dataSource)) {
  18826. me.reload();
  18827. }
  18828. }
  18829. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18830. var vm = this.lookupViewModel();
  18831. this.contextMenu = this.add(new Ext.menu.Menu({
  18832. viewModel: vm,
  18833. items: _$2.map(config.tbar, function (item) {
  18834. var menuItem = __assign({}, item);
  18835. if (menuItem.xtype === 'button') {
  18836. delete menuItem.xtype;
  18837. }
  18838. return menuItem;
  18839. })
  18840. }));
  18841. }
  18842. else if (_$2.isPlainObject(config.contextMenu)) {
  18843. this.contextMenu = this.add(config.contextMenu);
  18844. }
  18845. var $dom = $(sender.el.dom);
  18846. $dom.on('keydown', function (e) {
  18847. me.fireEvent('keydown', me, e);
  18848. }).on('keyup', function (e) {
  18849. me.fireEvent('keyup', me, e);
  18850. });
  18851. // 默认显示提示
  18852. if (this.cellTip) {
  18853. this.tip = Ext.create('Ext.tip.ToolTip', {
  18854. target: this.el,
  18855. delegate: '.x-grid-cell-inner',
  18856. trackMouse: true,
  18857. ancor: 'top',
  18858. style: 'background-color: #0D6EFD;',
  18859. listeners: {
  18860. beforeshow: function (tip) {
  18861. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18862. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18863. return false;
  18864. }
  18865. tip.update(tipText);
  18866. }
  18867. }
  18868. });
  18869. }
  18870. },
  18871. itemcontextmenu: function (view, rec, node, index, e) {
  18872. if (this.contextMenu) {
  18873. e.stopEvent();
  18874. this.contextMenu.show().setLocalXY(e.getXY());
  18875. return false;
  18876. }
  18877. },
  18878. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  18879. // this.setColumnConfigCache()
  18880. // },
  18881. // columnhide(sender, column, eOpts) {
  18882. // this.setColumnConfigCache()
  18883. // },
  18884. // columnshow(sender, column, eOpts) {
  18885. // this.setColumnConfigCache()
  18886. // },
  18887. // columnresize(sender, column, width, eOpts) {
  18888. // this.setColumnConfigCache()
  18889. // },
  18890. destory: function () {
  18891. },
  18892. selectionchange: function (sender, param) {
  18893. var record = undefined;
  18894. if (_$2.isArray(param)) {
  18895. record = param[0];
  18896. }
  18897. else if (_$2.isObject(param)) {
  18898. record = _$2.get(param, 'endCell.record');
  18899. }
  18900. itemselectFun(this, sender, record);
  18901. },
  18902. itemclick: function (sender, record) {
  18903. itemselectFun(this, sender, record);
  18904. },
  18905. show: function (sender) {
  18906. if (sender.__suspendReload) {
  18907. sender.__suspendReload = false;
  18908. sender.reload();
  18909. }
  18910. }
  18911. });
  18912. _$2.defer(function () {
  18913. var ce = _this.findPlugin('cellediting');
  18914. ce.on({
  18915. beforeedit: function (editor, context, eOpts) {
  18916. me.fireEvent('editbefore', me, editor, context, eOpts);
  18917. },
  18918. canceledit: function (editor, context, eOpts) {
  18919. me.fireEvent('editcancel', me, editor, context, eOpts);
  18920. },
  18921. edit: function (editor, context, eOpts) {
  18922. me.fireEvent('editfinish', me, editor, context, eOpts);
  18923. },
  18924. validateedit: function (editor, context, eOpts) {
  18925. me.fireEvent('editvalidate', me, editor, context, eOpts);
  18926. },
  18927. });
  18928. });
  18929. var itemselectFun = _$2.debounce(function (me, sender, record) {
  18930. var reference = me.reference;
  18931. var scope = lookupScope(me);
  18932. var theid = _$2.get(config, 'behavior.theid');
  18933. if (theid && reference) {
  18934. if (!record) {
  18935. scope.viewModel.set(reference + '.theid', null);
  18936. }
  18937. else {
  18938. scope.viewModel.set(reference + '.theid', record.get(theid));
  18939. }
  18940. }
  18941. var theid2 = _$2.get(config, 'behavior.theid2');
  18942. if (theid2 && reference) {
  18943. if (!record) {
  18944. scope.viewModel.set(reference + '.theid2', null);
  18945. }
  18946. else {
  18947. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  18948. }
  18949. }
  18950. var theid3 = _$2.get(config, 'behavior.theid3');
  18951. if (theid3 && reference) {
  18952. if (!record) {
  18953. scope.viewModel.set(reference + '.theid3', null);
  18954. }
  18955. else {
  18956. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  18957. }
  18958. }
  18959. me.fireEvent('itemselect', sender, record);
  18960. }, 50);
  18961. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  18962. // 为 stores.proxy.buildRequest 做准备
  18963. this.store.proxy.$owner = this;
  18964. }
  18965. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  18966. if (selectToReload) {
  18967. // 点击后触发某个目标表格刷新
  18968. this.on({
  18969. itemselect: function (sender) {
  18970. if (_$2.isArray(selectToReload)) {
  18971. _$2.forEach(selectToReload, function (ref) {
  18972. if (ref) {
  18973. var ctlTarget = scope.refs[ref];
  18974. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  18975. if (ctlTarget.isVisible()) {
  18976. ctlTarget.reload();
  18977. }
  18978. else {
  18979. ctlTarget.__suspendReload = true;
  18980. }
  18981. }
  18982. }
  18983. });
  18984. }
  18985. else if (_$2.isString(selectToReload)) {
  18986. var ctlTarget = scope.refs[selectToReload];
  18987. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  18988. ctlTarget.reload();
  18989. }
  18990. }
  18991. }
  18992. });
  18993. }
  18994. this.superclass.initComponent.call(this);
  18995. },
  18996. // 生成列自定义的缓存key
  18997. makeColumnConfigCacheKey: function (config) {
  18998. var _a, _b, _c, _d, _e, _f;
  18999. 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);
  19000. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19001. if (config.reference) {
  19002. key += config.reference;
  19003. }
  19004. else {
  19005. var subKey = "";
  19006. for (var i = 0; i < config.columns.length; i++) {
  19007. var column = config.columns[i];
  19008. if (column.dataIndex) {
  19009. subKey += column.dataIndex;
  19010. }
  19011. }
  19012. key += subKey;
  19013. }
  19014. return key;
  19015. },
  19016. getColumnConfigCache: function () {
  19017. var key = this.columnConfigCacheKey;
  19018. var dataStr = localStorage.getItem(key);
  19019. if (dataStr) {
  19020. return JSON.parse(dataStr);
  19021. }
  19022. return "";
  19023. },
  19024. setColumnConfigCache: function () {
  19025. var key = this.columnConfigCacheKey;
  19026. var cacheData = [];
  19027. var columns = this.headerCt.getGridColumns();
  19028. var index = 0;
  19029. for (var i = 0; i < columns.length; i++) {
  19030. var column = columns[i];
  19031. if (column.dataIndex) {
  19032. cacheData.push({
  19033. dataIndex: column.dataIndex,
  19034. width: column.width,
  19035. hidden: column.hidden,
  19036. locked: column.locked,
  19037. index: index
  19038. });
  19039. index++;
  19040. }
  19041. }
  19042. localStorage.setItem(key, JSON.stringify(cacheData));
  19043. },
  19044. autoSizeColumns: function (sender) {
  19045. var grid = sender ? sender.up('grid') : this;
  19046. // const columns = grid.columns;
  19047. // for (let i = 0; i < columns.length; i++) {
  19048. // const column = columns[i];
  19049. // grid.getView().autoSizeColumn(column);
  19050. // column.setWidth(column.getWidth() + 5);
  19051. // }
  19052. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19053. grid.headerCt.getGridColumns()[i].autoSize(i);
  19054. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19055. }
  19056. },
  19057. clearFilter: function (sender) {
  19058. var grid = sender.up('grid');
  19059. grid.filters.clearFilters();
  19060. grid.getStore().sorters.removeAll();
  19061. // grid.getStore().reload()
  19062. },
  19063. saveGridUIConfig: function (sender) {
  19064. var grid = sender.up('grid');
  19065. grid.setColumnConfigCache();
  19066. msg('保存设置成功!');
  19067. },
  19068. clearGridUIConfig: function (sender) {
  19069. var grid = sender.up('grid');
  19070. var key = grid.columnConfigCacheKey;
  19071. localStorage.setItem(key, "");
  19072. msg('清空设置成功,重新打开后生效!');
  19073. },
  19074. setLoading: function (value) {
  19075. if (value) {
  19076. this.mask('读取中');
  19077. }
  19078. else {
  19079. this.unmask();
  19080. }
  19081. },
  19082. exportExcel: function (sender) {
  19083. var rect = sender.btnEl.dom.getBoundingClientRect();
  19084. var scope = lookupScope(this);
  19085. var grid = sender.up('grid');
  19086. var treeMenu = new Ext.menu.Menu({
  19087. xtype: 'menu',
  19088. floated: false,
  19089. width: 300,
  19090. docked: 'left',
  19091. items: [
  19092. {
  19093. text: '大批量导出 (需要客户端支持!)',
  19094. iconCls: 'x-fa fa-download',
  19095. listeners: {
  19096. click: function (sender, value) {
  19097. // @ts-ignore
  19098. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19099. .then(function (res) {
  19100. grid.exportBigExcelClick();
  19101. });
  19102. }
  19103. }
  19104. },
  19105. '-',
  19106. {
  19107. text: '导出当前数据',
  19108. iconCls: 'x-fa fa-download',
  19109. listeners: {
  19110. click: function (sender, value) {
  19111. grid.exportCurrentExcelClick();
  19112. }
  19113. }
  19114. },
  19115. {
  19116. xtype: "textfield",
  19117. fieldLabel: '当前导出页',
  19118. maskRe: /[0-9]/,
  19119. value: grid.exportExcelCurrentPage,
  19120. listeners: {
  19121. render: function (sender) {
  19122. grid.exportExcelCurrentPageCmp = sender;
  19123. },
  19124. change: function (sender, value) {
  19125. var v = parseInt(value);
  19126. if (isNaN(v) || v === 0) {
  19127. window['system'].msg("页码不能为0");
  19128. v = 1;
  19129. sender.setValue(v);
  19130. }
  19131. var size = parseInt(grid.exportExcelPageSize);
  19132. var total = parseInt(grid.exportExcelTotal);
  19133. if (v > total / size) {
  19134. v = parseInt(total / size + "");
  19135. }
  19136. grid.exportExcelCurrentPage = v + "";
  19137. }
  19138. }
  19139. },
  19140. {
  19141. xtype: "textfield",
  19142. fieldLabel: '导出页大小',
  19143. maskRe: /[0-9]/,
  19144. value: grid.exportExcelPageSize,
  19145. listeners: {
  19146. render: function (sender) {
  19147. grid.exportExcelPageSizeCmp = sender;
  19148. },
  19149. change: function (sender, value) {
  19150. var v = parseInt(value);
  19151. if (isNaN(v) || v === 0) {
  19152. window['system'].msg("导出页大小不能为0");
  19153. v = defaultGrid.exportExcelPageSize;
  19154. sender.setValue(v);
  19155. }
  19156. if (v > 10000) {
  19157. window['system'].msg("导出页大小不能大于10000");
  19158. v = 10000;
  19159. sender.setValue(v);
  19160. }
  19161. var page = parseInt(grid.exportExcelCurrentPage);
  19162. var total = parseInt(grid.exportExcelTotal);
  19163. if (page > total / v) {
  19164. page = parseInt(total / v + "") + 1;
  19165. grid.exportExcelCurrentPageCmp.setValue(page);
  19166. }
  19167. grid.exportExcelPageSize = v + "";
  19168. }
  19169. }
  19170. },
  19171. {
  19172. xtype: "textfield",
  19173. fieldLabel: '总条数',
  19174. value: grid.exportExcelTotal,
  19175. readOnly: true
  19176. },
  19177. {
  19178. text: '导出',
  19179. iconCls: 'x-fa fa-download',
  19180. listeners: {
  19181. click: function (sender, value) {
  19182. grid.exportExcelClick({
  19183. exportExcelPageSize: grid.exportExcelPageSize,
  19184. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19185. });
  19186. }
  19187. }
  19188. },
  19189. ]
  19190. });
  19191. treeMenu.showAt(rect.left, rect.top - 120);
  19192. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19193. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19194. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19195. // }
  19196. },
  19197. /**
  19198. * 获取表格编辑的行数据
  19199. */
  19200. getGridEditRows: function () {
  19201. var grid = this;
  19202. var store = grid.getStore();
  19203. var rows = [];
  19204. var modifyRows = [];
  19205. var newRows = [];
  19206. var err = "";
  19207. var records = store.getModifiedRecords();
  19208. var newRecords = store.getNewRecords();
  19209. var removeRecords = [];
  19210. _$2.forEach(store.getRemovedRecords(), function (row) {
  19211. removeRecords.push(row.data);
  19212. });
  19213. _$2.forEach(records, function (record) {
  19214. var colums = grid.columns;
  19215. var errFunc = undefined;
  19216. _$2.forEach(colums, function (col) {
  19217. var name = col.dataIndex;
  19218. var value = record.data[name];
  19219. var colIndex = col.getIndex(); //获得列号
  19220. var rowIndex = store.indexOfId(record.id); //获得行号
  19221. var editor = col.getEditor(); //使用的编辑器
  19222. var tmpErrFunc = function () {
  19223. var text = col.text || col.name;
  19224. msg(text + ' 校验失败, 请确保输入的数据正确');
  19225. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19226. };
  19227. if (editor && !editor.allowBlank && isEmpty(value)) {
  19228. errFunc = tmpErrFunc;
  19229. return false;
  19230. }
  19231. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19232. errFunc = tmpErrFunc;
  19233. return false;
  19234. }
  19235. });
  19236. if (typeof errFunc === 'function') {
  19237. err = "1";
  19238. _$2.remove(rows, function (n) {
  19239. return true;
  19240. });
  19241. //@ts-ignore
  19242. errFunc();
  19243. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19244. return false;
  19245. }
  19246. else {
  19247. if (_$2.findIndex(newRecords, function (item) {
  19248. return item === record;
  19249. }) >= 0) {
  19250. newRows.push(record.data);
  19251. }
  19252. else {
  19253. modifyRows.push(record.data);
  19254. }
  19255. rows.push(record.data);
  19256. }
  19257. });
  19258. return {
  19259. rows: rows,
  19260. newRows: newRows,
  19261. modifyRows: modifyRows,
  19262. removeRecords: removeRecords,
  19263. err: err
  19264. };
  19265. }
  19266. // reload() {
  19267. // dataSourceReload(this)
  19268. // },
  19269. });
  19270. }
  19271. /**
  19272. * 获取 columns 中所有的 dataIndex
  19273. */
  19274. function getFileds(newConfig) {
  19275. var fields = [];
  19276. _$2.forEach(newConfig.columns, function (c) {
  19277. if (c.dataIndex) {
  19278. fields.push(c.dataIndex);
  19279. }
  19280. });
  19281. return fields;
  19282. }
  19283. function convertDataSource$1(sender, scope, newConfig) {
  19284. if (typeof newConfig.store !== 'undefined') {
  19285. // 有 store 属性的情况下,不做任何事
  19286. return;
  19287. }
  19288. if (typeof newConfig.dataSource === 'undefined') {
  19289. // 没有定义 dataSource 的情况下,不做任何事
  19290. return;
  19291. }
  19292. if (_$2.isArray(newConfig.data)) {
  19293. // 有 data 属性赋值的情况下
  19294. newConfig.store = {
  19295. fields: getFileds(newConfig),
  19296. data: newConfig.data
  19297. };
  19298. delete newConfig.data;
  19299. return;
  19300. }
  19301. var dataSource = newConfig.dataSource;
  19302. if (typeof dataSource === 'string') {
  19303. // dataSource 是字符串的情况下,找到成员函数
  19304. dataSource = lookupFn(scope, dataSource);
  19305. }
  19306. if (typeof dataSource === 'function') {
  19307. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19308. newConfig.store = new Ext.data.Store({
  19309. fields: getFileds(newConfig),
  19310. // data: [],
  19311. autoLoad: true,
  19312. proxy: {
  19313. type: 'memory',
  19314. data: [],
  19315. }
  19316. });
  19317. newConfig.dataSourceCallbackFn = dataSource;
  19318. return;
  19319. }
  19320. // throw new TypeError('无法识别的调用方法')
  19321. }
  19322. //# sourceMappingURL=grid.js.map
  19323. function initTextfield () {
  19324. var cc = Ext.form.field.Text.prototype.constructor;
  19325. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19326. Ext.form.field.Text.override({
  19327. constructor: function (config) {
  19328. var newConfig = _$2.defaultsDeep({
  19329. // 强制属性
  19330. triggers: {
  19331. clear: {
  19332. weight: -1,
  19333. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19334. hidden: true,
  19335. handler: 'onClearClick',
  19336. },
  19337. }
  19338. }, baseConfig(config, 'col-item'), config, text);
  19339. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19340. newConfig.enableKeyEvents = true;
  19341. }
  19342. cc.call(this, newConfig);
  19343. },
  19344. /**
  19345. * 清空所有值
  19346. */
  19347. onClearClick: function (sender, e) {
  19348. var me = this;
  19349. me.setValue('');
  19350. },
  19351. /**
  19352. * 尝试获取下一个要获取焦点的控件
  19353. */
  19354. _raiseNextFocus: function (sender) {
  19355. var config = sender.config;
  19356. var scope = lookupScope(sender);
  19357. if (typeof config.nextFocus === 'function') {
  19358. config.nextFocus(sender);
  19359. }
  19360. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19361. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19362. var fn = lookupFn(scope, config.nextFocus);
  19363. if (typeof fn === 'function') {
  19364. var nextCtlReference = fn(sender);
  19365. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19366. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19367. if (ctl) {
  19368. if (typeof ctl.focus2 === 'function') {
  19369. ctl.focus2();
  19370. }
  19371. else {
  19372. ctl.focus();
  19373. }
  19374. }
  19375. }
  19376. }
  19377. }
  19378. else {
  19379. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19380. if (ctl) {
  19381. if (typeof ctl.focus2 === 'function') {
  19382. ctl.focus2();
  19383. }
  19384. else {
  19385. ctl.focus();
  19386. }
  19387. }
  19388. }
  19389. }
  19390. },
  19391. initComponent: function () {
  19392. /**
  19393. * 改变必填项之前加星号
  19394. */
  19395. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19396. // this.beforeLabelTextTpl = [
  19397. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19398. // ];
  19399. this.afterLabelTextTpl = [
  19400. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19401. ];
  19402. }
  19403. var me = this;
  19404. this.on({
  19405. change: function (sender, newVal) {
  19406. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19407. if (hideTrigger || disabled || readOnly || hideClear) {
  19408. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19409. return;
  19410. }
  19411. var value = newVal;
  19412. if (value) {
  19413. me.getTrigger('clear').show();
  19414. me.updateLayout();
  19415. }
  19416. else {
  19417. me.getTrigger('clear').hide();
  19418. me.updateLayout();
  19419. }
  19420. },
  19421. afterrender: function (sender) {
  19422. var _this = this;
  19423. var _a;
  19424. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19425. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19426. $$2(sender.inputEl.dom).on('click', function (e) {
  19427. sender.fireEvent('click', _this, e);
  19428. });
  19429. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19430. var _a, _b, _c, _d;
  19431. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19432. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19433. if (sender.isExpanded === true) {
  19434. // 弹开下拉框的基础上,不干预上下选择
  19435. return;
  19436. }
  19437. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19438. var grid = sender.ownerCt.up('grid');
  19439. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19440. if (editingPlugin) {
  19441. 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;
  19442. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19443. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19444. // editingPlugin
  19445. var targetRecord = void 0;
  19446. if (e.code === 'ArrowDown') {
  19447. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19448. }
  19449. else {
  19450. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19451. }
  19452. if (targetRecord) {
  19453. grid.setSelection([targetRecord]);
  19454. editingPlugin.startEdit(targetRecord, column);
  19455. }
  19456. e.stopPropagation();
  19457. e.preventDefault();
  19458. }
  19459. }
  19460. }
  19461. }
  19462. });
  19463. }
  19464. var config = sender.config;
  19465. if (config.ff && config.ff > 0) {
  19466. setTimeout(function () {
  19467. if (typeof sender.focus2 === 'function') {
  19468. sender.focus2();
  19469. }
  19470. else {
  19471. sender.focus();
  19472. }
  19473. }, config.ff);
  19474. }
  19475. }
  19476. });
  19477. var config = this.config;
  19478. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19479. this.on({
  19480. keyup: function (sender, e) {
  19481. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19482. sender._raiseNextFocus(sender);
  19483. }
  19484. }
  19485. });
  19486. }
  19487. var that = this;
  19488. this.on({
  19489. keyup: function (sender, e, eOpts) {
  19490. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19491. return;
  19492. }
  19493. that.keydown_fun_item(sender, e, eOpts);
  19494. }
  19495. });
  19496. initComponent.call(this);
  19497. },
  19498. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19499. var that = sender;
  19500. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19501. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19502. var value = _$2.trim(sender.rawValue);
  19503. var r = that.fireEvent('scancode', that, value, event);
  19504. if (r === 'OK') {
  19505. // 停止事件的默认处理程序,停止事件的冒泡
  19506. // event.stopEvent();
  19507. event.preventDefault();
  19508. event.stopPropagation();
  19509. }
  19510. }
  19511. }, 100)
  19512. });
  19513. }
  19514. //# sourceMappingURL=textfield.js.map
  19515. function initTbFill () {
  19516. /**
  19517. *
  19518. */
  19519. var ct = Ext.toolbar.Fill.prototype.constructor;
  19520. Ext.toolbar.Fill.override({
  19521. constructor: function (config) {
  19522. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19523. ct.call(this, newConfig);
  19524. }
  19525. });
  19526. }
  19527. //# sourceMappingURL=tbfill.js.map
  19528. function initTbSeparator () {
  19529. /**
  19530. *
  19531. */
  19532. var ct = Ext.toolbar.Separator.prototype.constructor;
  19533. Ext.toolbar.Separator.override({
  19534. constructor: function (config) {
  19535. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19536. ct.call(this, newConfig);
  19537. }
  19538. });
  19539. }
  19540. //# sourceMappingURL=tbseparator.js.map
  19541. function initToolbar () {
  19542. /**
  19543. *
  19544. */
  19545. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19546. Ext.toolbar.Toolbar.override({
  19547. constructor: function (config) {
  19548. var newConfig = _$2.defaultsDeep({
  19549. // 强制性属性
  19550. }, baseConfig(config, 'cols-container'), config, toolbar);
  19551. ct.call(this, newConfig);
  19552. }
  19553. });
  19554. initTbFill();
  19555. initTbSeparator();
  19556. }
  19557. //# sourceMappingURL=toolbar.js.map
  19558. function initSplitter () {
  19559. var ct = Ext.resizer.Splitter.prototype.constructor;
  19560. Ext.resizer.Splitter.override({
  19561. constructor: function (config) {
  19562. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19563. ct.call(this, newConfig);
  19564. }
  19565. });
  19566. }
  19567. //# sourceMappingURL=splitter.js.map
  19568. /**
  19569. * 通用 dataSource 解析,
  19570. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19571. */
  19572. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19573. var config = ctl.config;
  19574. return new Promise(function (resolve, reject) {
  19575. if (!config.dataSource) {
  19576. // 没有设置数据源,直接置空
  19577. return Promise.resolve();
  19578. }
  19579. var option = {
  19580. extraParam: extraParam,
  19581. _successCb: _successCb,
  19582. successCallback: function (value) {
  19583. if (typeof successCallback === "function") {
  19584. successCallback(value);
  19585. }
  19586. else {
  19587. ctl.setData(value);
  19588. }
  19589. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19590. ctl.setLoading(false);
  19591. resolve(value);
  19592. },
  19593. failCallback: function (error) {
  19594. if (typeof failCallback === "function") {
  19595. failCallback(error);
  19596. }
  19597. ctl.fireEvent('dataLoadComplete', ctl, false);
  19598. ctl.setLoading(false);
  19599. reject(error);
  19600. }
  19601. };
  19602. // 请求前要求确认一下
  19603. var isCanceled = false;
  19604. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19605. isCanceled = true;
  19606. } }, option));
  19607. if (!isCanceled) {
  19608. // 请求没有被取消
  19609. // 调用异步接口返回 Promise
  19610. return _innerReload(ctl, option);
  19611. }
  19612. return reject();
  19613. });
  19614. }
  19615. function _innerReload(ctl, option) {
  19616. var config = ctl.config;
  19617. ctl.setLoading(true);
  19618. var scope = lookupScope(ctl);
  19619. var dataSource = config.dataSource;
  19620. if (typeof dataSource == 'string') {
  19621. dataSource = lookupFn(scope, config.dataSource);
  19622. }
  19623. if (typeof dataSource === 'function') {
  19624. // @ts-ignore
  19625. dataSource.call(scope, ctl, option);
  19626. return;
  19627. }
  19628. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19629. if (!ajax.func) {
  19630. console.error("没有配置 ajax");
  19631. return;
  19632. }
  19633. var params_1 = {};
  19634. var sortModel = null;
  19635. var filterModel = null;
  19636. if (option.extraParam && option.extraParam.filterModel) {
  19637. filterModel = option.extraParam.filterModel;
  19638. }
  19639. if (option.extraParam && option.extraParam.sortModel) {
  19640. sortModel = option.extraParam.sortModel;
  19641. }
  19642. _$2.forOwn(option.extraParam, function (v, key) {
  19643. if (key != "filterModel" && key != "sortModel") {
  19644. if (typeof v === 'function') {
  19645. params_1[key] = v();
  19646. }
  19647. else {
  19648. params_1[key] = v;
  19649. }
  19650. }
  19651. });
  19652. var ds = dataSource;
  19653. _$2.forOwn(ds.params, function (v, key) {
  19654. if (typeof v === 'function') {
  19655. params_1[key] = v();
  19656. }
  19657. else {
  19658. params_1[key] = v;
  19659. }
  19660. });
  19661. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19662. // @ts-ignore
  19663. ajax.func({
  19664. method: dataSource.method,
  19665. url: ds.url,
  19666. data: params_1,
  19667. filterModel: filterModel,
  19668. sortModel: sortModel,
  19669. }).then(function (res) {
  19670. if (res.success) {
  19671. option.successCallback(res.data);
  19672. }
  19673. else {
  19674. option.failCallback(res.msg);
  19675. }
  19676. }).catch(function (e) {
  19677. option.failCallback(e);
  19678. });
  19679. }
  19680. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19681. var ds_1 = ctl.dataSource;
  19682. // @ts-ignore
  19683. Extend.ajax.func({
  19684. url: ds_1.sqlId,
  19685. data: params_1,
  19686. db: ds_1.db,
  19687. method: 'sql',
  19688. filterModel: filterModel,
  19689. sortModel: sortModel,
  19690. }).then(function (res) {
  19691. if (res.success) {
  19692. option.successCallback(res.data);
  19693. }
  19694. else {
  19695. option.failCallback(res.msg);
  19696. }
  19697. }).catch(function (e) {
  19698. option.failCallback(e);
  19699. }).finally(function () {
  19700. ctl.loading = false;
  19701. });
  19702. return;
  19703. }
  19704. else {
  19705. console.error("非法的 dataSource", ctl.dataSource);
  19706. debugger;
  19707. throw new Error("非法的 dataSource");
  19708. }
  19709. }
  19710. }
  19711. //# sourceMappingURL=DataSourceHelper.js.map
  19712. function initCombo () {
  19713. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19714. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19715. Ext.form.field.ComboBox.override({
  19716. constructor: function (config) {
  19717. var newConfig = _$2.defaultsDeep({
  19718. // 强制性属性
  19719. }, baseConfig(config, 'col-item'), config, combo);
  19720. if (typeof config.dict === 'string') {
  19721. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19722. }
  19723. else if (typeof newConfig.store == 'undefined') {
  19724. if (_$2.isArray(newConfig.data)) {
  19725. // ExtJS 无法直接接受数组模式
  19726. newConfig.store = {
  19727. fields: [newConfig.valueField, newConfig.displayField],
  19728. data: newConfig.data
  19729. };
  19730. delete newConfig.data;
  19731. }
  19732. else if (typeof newConfig.data !== 'object') {
  19733. newConfig.store = {
  19734. fields: [newConfig.valueField, newConfig.displayField],
  19735. data: []
  19736. };
  19737. delete newConfig.data;
  19738. }
  19739. }
  19740. cc.call(this, newConfig);
  19741. },
  19742. setDict: function (bizKey) {
  19743. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19744. this.dict = bizKey;
  19745. },
  19746. getDict: function () {
  19747. return this.dict;
  19748. },
  19749. setData: function (value) {
  19750. if (!value) {
  19751. return;
  19752. }
  19753. var config = value.config;
  19754. if (!this.store) {
  19755. this.store = new Ext.data.Store({
  19756. fields: [config.valueField, config.displayField],
  19757. data: value
  19758. });
  19759. }
  19760. else {
  19761. this.store.getProxy().setData(value);
  19762. this.store.load();
  19763. }
  19764. },
  19765. setLoading: function (value) {
  19766. if (value) {
  19767. if (!this.loadMask) {
  19768. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19769. }
  19770. }
  19771. else {
  19772. if (this.loadMask) {
  19773. this.loadMask.destroy();
  19774. delete this.loadMask;
  19775. }
  19776. }
  19777. },
  19778. reload: function () {
  19779. dataSourceReload(this);
  19780. },
  19781. initComponent: function () {
  19782. var that = this;
  19783. var toggle = function (e) {
  19784. var readOnly = that.readOnly, disabled = that.disabled;
  19785. if (readOnly || disabled) {
  19786. return;
  19787. }
  19788. if ($(e.target).is('.x-form-trigger')) {
  19789. return;
  19790. }
  19791. // 点击后下拉
  19792. if (that.isExpanded) {
  19793. that.collapse();
  19794. }
  19795. else {
  19796. that.expand();
  19797. that.doQuery(that.allQuery, true);
  19798. }
  19799. };
  19800. this.on({
  19801. afterrender: function (sender) {
  19802. var config = this.config;
  19803. if (config.dataSource && config.autoLoad) {
  19804. dataSourceReload(this);
  19805. }
  19806. // 点击后下拉
  19807. $(this.el.dom).on('click', toggle.bind(this));
  19808. },
  19809. focusenter: function (sender, event, opt) {
  19810. var _a;
  19811. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19812. // 表格内编辑框,获取焦点后自动弹开
  19813. toggle.call(this, event);
  19814. }
  19815. },
  19816. destory: function () {
  19817. $(this.el.dom).off('click', toggle.bind(this));
  19818. },
  19819. beforequery: function (context) {
  19820. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19821. // console.log('beforequery', query)
  19822. if (!forceAll && query) {
  19823. combo.store.clearFilter();
  19824. combo.store.filterBy(function (record, id) {
  19825. var text = record.get(combo.displayField);
  19826. // 用拼音筛选的方式
  19827. return keywordFilter(query, text, id);
  19828. });
  19829. combo.expand();
  19830. return false;
  19831. }
  19832. combo.store.clearFilter();
  19833. combo.expand();
  19834. return false;
  19835. },
  19836. });
  19837. initComponent.call(this);
  19838. },
  19839. focus2: function () {
  19840. this.focus();
  19841. var that = this;
  19842. _$2.defer(function () {
  19843. if (that.isExpanded) {
  19844. that.collapse();
  19845. }
  19846. else {
  19847. that.expand();
  19848. that.doQuery(that.allQuery, true);
  19849. }
  19850. });
  19851. }
  19852. });
  19853. }
  19854. //# sourceMappingURL=combo.js.map
  19855. /**
  19856. xtype: 'tagfield',
  19857. displayField: 'show',
  19858. valueField: 'id',
  19859. queryMode: 'local',
  19860. filterPickList: true,
  19861. store: {
  19862. fields: ['id', 'show'],
  19863. data: [
  19864. {id: 0, show: 'Battlestar Galactica'},
  19865. {id: 1, show: 'Doctor Who'},
  19866. {id: 2, show: 'Farscape'},
  19867. {id: 3, show: 'Firefly'},
  19868. {id: 4, show: 'Star Trek'},
  19869. {id: 5, show: 'Star Wars: Christmas Special'}
  19870. ]
  19871. }
  19872. */
  19873. function initTag () {
  19874. var cc = Ext.form.field.Tag.prototype.constructor;
  19875. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19876. Ext.form.field.Tag.override({
  19877. constructor: function (config) {
  19878. var newConfig = _$2.defaultsDeep({
  19879. // 强制性属性
  19880. }, baseConfig(config, 'col-item'), config, tagfield);
  19881. if (typeof config.dict === 'string') {
  19882. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19883. }
  19884. else if (typeof newConfig.store == 'undefined') {
  19885. if (_$2.isArray(newConfig.data)) {
  19886. // ExtJS 无法直接接受数组模式
  19887. newConfig.store = {
  19888. fields: [newConfig.valueField, newConfig.displayField],
  19889. data: newConfig.data
  19890. };
  19891. delete newConfig.data;
  19892. }
  19893. else if (typeof newConfig.data !== 'object') {
  19894. newConfig.store = {
  19895. fields: [newConfig.valueField, newConfig.displayField],
  19896. data: []
  19897. };
  19898. delete newConfig.data;
  19899. }
  19900. }
  19901. cc.call(this, newConfig);
  19902. },
  19903. setDict: function (bizKey) {
  19904. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19905. this.dict = bizKey;
  19906. },
  19907. getDict: function () {
  19908. return this.dict;
  19909. },
  19910. setData: function (value) {
  19911. if (!value) {
  19912. return;
  19913. }
  19914. var config = value.config;
  19915. if (!this.store) {
  19916. this.store = new Ext.data.Store({
  19917. fields: [config.valueField, config.displayField],
  19918. data: value
  19919. });
  19920. }
  19921. else {
  19922. this.store.getProxy().setData(value);
  19923. this.store.load();
  19924. }
  19925. },
  19926. setLoading: function (value) {
  19927. if (value) {
  19928. if (!this.loadMask) {
  19929. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19930. }
  19931. }
  19932. else {
  19933. if (this.loadMask) {
  19934. this.loadMask.destroy();
  19935. delete this.loadMask;
  19936. }
  19937. }
  19938. },
  19939. reload: function () {
  19940. dataSourceReload(this);
  19941. },
  19942. initComponent: function () {
  19943. var that = this;
  19944. var toggle = function (e) {
  19945. var readOnly = that.readOnly, disabled = that.disabled;
  19946. if (readOnly || disabled) {
  19947. return;
  19948. }
  19949. if ($(e.target).is('.x-form-trigger')) {
  19950. return;
  19951. }
  19952. // 点击后下拉
  19953. if (that.isExpanded) {
  19954. that.collapse();
  19955. }
  19956. else {
  19957. that.expand();
  19958. that.doQuery(that.allQuery, true);
  19959. }
  19960. };
  19961. this.on({
  19962. afterrender: function (sender) {
  19963. var config = this.config;
  19964. if (config.dataSource && config.autoLoad) {
  19965. dataSourceReload(this);
  19966. }
  19967. // 点击后下拉
  19968. $(this.el.dom).on('click', toggle.bind(this));
  19969. },
  19970. focusenter: function (sender, event, opt) {
  19971. var _a;
  19972. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19973. // 表格内编辑框,获取焦点后自动弹开
  19974. toggle.call(this, event);
  19975. }
  19976. },
  19977. destory: function () {
  19978. $(this.el.dom).off('click', toggle.bind(this));
  19979. },
  19980. });
  19981. initComponent.call(this);
  19982. },
  19983. focus2: function () {
  19984. this.focus();
  19985. var that = this;
  19986. _$2.defer(function () {
  19987. if (that.isExpanded) {
  19988. that.collapse();
  19989. }
  19990. else {
  19991. that.expand();
  19992. that.doQuery(that.allQuery, true);
  19993. }
  19994. });
  19995. }
  19996. });
  19997. }
  19998. //# sourceMappingURL=tagfield.js.map
  19999. function initComboGridMulti () {
  20000. Ext.define('Yvan.LocalComboGrid', {
  20001. extend: 'Ext.form.field.Picker',
  20002. // extend: 'Yvan.PickerAlignCenter',
  20003. xtype: 'combogridmulti',
  20004. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20005. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20006. editable: false,
  20007. initComponent: function () {
  20008. this.on({
  20009. afterrender: function () {
  20010. var config = this.config;
  20011. if (config.dataSource && config.autoLoad) {
  20012. dataSourceReload(this);
  20013. }
  20014. },
  20015. });
  20016. this.superclass.initComponent.apply(this, arguments);
  20017. },
  20018. setStore: function (store) {
  20019. this.store = store;
  20020. var me = this;
  20021. if (me.store) {
  20022. if (me.picker) {
  20023. me.picker.setStore(store);
  20024. if (me.isExpanded) {
  20025. me.collapse();
  20026. delete me.picker;
  20027. me.expand();
  20028. }
  20029. }
  20030. this.onLoad();
  20031. me.mon(me.store, {
  20032. scope: me,
  20033. load: me.onLoad,
  20034. update: me.onUpdate
  20035. });
  20036. }
  20037. },
  20038. reload: function () {
  20039. dataSourceReload(this);
  20040. },
  20041. setData: function (value) {
  20042. var me = this;
  20043. var config = me.config;
  20044. if (!value) {
  20045. return;
  20046. }
  20047. if (!this.store) {
  20048. this.store = new Ext.data.Store({
  20049. fields: [config.valueField, config.displayField],
  20050. data: value
  20051. });
  20052. }
  20053. else {
  20054. this.store.getProxy().setData(value);
  20055. this.store.load();
  20056. }
  20057. this.onLoad();
  20058. },
  20059. createPicker: function () {
  20060. var me = this;
  20061. 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: {
  20062. scope: me,
  20063. selectionchange: me.onSelectionChange,
  20064. itemkeydown: me.onPickerKeyDown
  20065. } })), view = picker.getView();
  20066. if (Ext.isIE9 && Ext.isStrict) {
  20067. view.on({
  20068. scope: me,
  20069. highlightitem: me.repaintPickerView,
  20070. unhighlightitem: me.repaintPickerView,
  20071. afteritemexpand: me.repaintPickerView,
  20072. afteritemcollapse: me.repaintPickerView
  20073. });
  20074. }
  20075. return picker;
  20076. },
  20077. repaintPickerView: function () {
  20078. var style = this.picker.getView().getEl().dom.style;
  20079. style.display = style.display;
  20080. },
  20081. onSelectionChange: function (view, record, node, rowIndex, e) {
  20082. this.selectItem(view, record);
  20083. },
  20084. onPickerKeyDown: function (treeView, record, item, index, e) {
  20085. var key = e.getKey();
  20086. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20087. this.selectItem(treeView, record);
  20088. }
  20089. },
  20090. selectItem: function (sender, record) {
  20091. var me = this;
  20092. var ids = [];
  20093. _$2.forEach(me.picker.getSelection(), function (record) {
  20094. ids.push(record.get(me.valueField));
  20095. });
  20096. me.fireEvent('select', me, record);
  20097. me.setValue(ids.join(me.splitChar));
  20098. // me.collapse();
  20099. },
  20100. onExpand: function () {
  20101. var me = this;
  20102. var picker = this.picker;
  20103. var value = this.value;
  20104. if (!me.store) {
  20105. msg('正在初始化数据,请稍后');
  20106. me.collapse();
  20107. return;
  20108. }
  20109. var vs = _$2.split(value, me.splitChar);
  20110. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20111. picker.setSelection(records);
  20112. },
  20113. setValue: function (value) {
  20114. var me = this;
  20115. console.log('setValue', value);
  20116. me.value = value;
  20117. if (!me.store || me.store.loading) {
  20118. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20119. return me.mixins.field.setValue.call(me, value);
  20120. // return me;
  20121. }
  20122. var vs = _$2.split(value, me.splitChar);
  20123. var displayValues = [];
  20124. _$2.forEach(vs, function (v) {
  20125. var _a;
  20126. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20127. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20128. if (dv) {
  20129. displayValues.push(dv);
  20130. }
  20131. else {
  20132. displayValues.push(v);
  20133. }
  20134. });
  20135. // set the raw value to the record's display field if a record was found
  20136. me.setRawValue(displayValues.join(me.splitChar));
  20137. return me.mixins.field.setValue.call(me, value);
  20138. },
  20139. getSubmitValue: function () {
  20140. return this.value;
  20141. },
  20142. getValue: function () {
  20143. return this.value;
  20144. },
  20145. onLoad: function () {
  20146. var value = this.value;
  20147. if (value) {
  20148. this.setValue(value);
  20149. }
  20150. },
  20151. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20152. var display = this.displayField;
  20153. var me = this;
  20154. if (type === 'edit' && modifiedFieldNames &&
  20155. Ext.Array.contains(modifiedFieldNames, display) &&
  20156. this.value === rec.getId()) {
  20157. me.mixins.field.setValue.call(me, this.value);
  20158. this.setRawValue(rec.get(display));
  20159. }
  20160. }
  20161. });
  20162. }
  20163. //# sourceMappingURL=combogridmulti.js.map
  20164. function initSearch () {
  20165. Ext.define('Yvan.Search', {
  20166. extend: 'Ext.form.field.Text',
  20167. alias: 'widget.searchfield',
  20168. xtype: 'searchfield',
  20169. constructor: function (config) {
  20170. var self = this;
  20171. var newConfig = _$2.defaultsDeep({
  20172. // 强制性属性
  20173. triggers: {
  20174. clear: {
  20175. weight: 0,
  20176. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20177. hidden: true,
  20178. handler: 'onClearClick',
  20179. },
  20180. search: {
  20181. weight: 1,
  20182. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20183. handler: 'onSearchClick'
  20184. },
  20185. },
  20186. listeners: {
  20187. blur: function (sender, e) {
  20188. this.revertOnblur();
  20189. },
  20190. specialkey: function (sender, e) {
  20191. var _a;
  20192. var me = this;
  20193. if (e.getKey() === e.ENTER) {
  20194. me.onSearchClick(sender, {}, e);
  20195. return;
  20196. }
  20197. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20198. },
  20199. afterrender: function (sender, e) {
  20200. var _a;
  20201. this.replaceRawInputEvent();
  20202. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20203. }
  20204. },
  20205. }, baseConfig(config, 'col-item'), config, search);
  20206. this.superclass.constructor.call(self, newConfig);
  20207. },
  20208. revertOnblur: function () {
  20209. this.setRawValue(this.lastValue);
  20210. },
  20211. onSearchClick: function (sender, vv, e) {
  20212. var me = this;
  20213. var config = me.config;
  20214. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20215. if (e) {
  20216. e.preventDefault();
  20217. e.stopPropagation();
  20218. }
  20219. this.fireEvent('search', sender, e);
  20220. if (!widget) {
  20221. return;
  20222. }
  20223. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20224. },
  20225. replaceRawInputEvent: function () {
  20226. var me = this;
  20227. var $dom = $(me.inputEl.dom);
  20228. $dom.on('input', function (e) {
  20229. stopEvent(e);
  20230. // console.log('has input', e)
  20231. });
  20232. $dom.on('keyup', function (e) {
  20233. if (e.key === "Enter") {
  20234. me.onSearchClick(me, {}, e);
  20235. return;
  20236. }
  20237. stopEvent(e);
  20238. });
  20239. $dom.on('change', function (e) {
  20240. stopEvent(e);
  20241. });
  20242. },
  20243. onChange: function (newVal, oldVal) {
  20244. var me = this;
  20245. var value = newVal;
  20246. if (value) {
  20247. me.getTrigger('clear').show();
  20248. me.updateLayout();
  20249. }
  20250. else {
  20251. me.getTrigger('clear').hide();
  20252. me.updateLayout();
  20253. }
  20254. },
  20255. /**
  20256. * 清空所有值
  20257. */
  20258. onClearClick: function (sender, e) {
  20259. var me = this;
  20260. var config = me.config;
  20261. var lookup = config.lookup;
  20262. me.setValue('');
  20263. clearViewModelByLookup(sender, lookup);
  20264. }
  20265. });
  20266. }
  20267. //# sourceMappingURL=search.js.map
  20268. function initMultipleSearch () {
  20269. Ext.define('Yvan.MultipleSearch', {
  20270. extend: 'Ext.form.field.Text',
  20271. xtype: 'multiplesearch',
  20272. bindTargert: '',
  20273. constructor: function (config) {
  20274. var _a, _b, _c, _d;
  20275. var self = this;
  20276. var newConfig = _$2.defaultsDeep({
  20277. // 强制性属性
  20278. triggers: {
  20279. clear: {
  20280. weight: 0,
  20281. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20282. hidden: true,
  20283. handler: 'onClearClick',
  20284. }
  20285. },
  20286. transformRawValue: function (o) {
  20287. return o;
  20288. },
  20289. listeners: {
  20290. specialkey: function (sender, e) {
  20291. var me = this;
  20292. if (e.getKey() === e.ENTER) {
  20293. me.fireEvent('search', me, e);
  20294. }
  20295. },
  20296. afterrender: function (sender, e) {
  20297. var _a;
  20298. this.replaceRawInputEvent();
  20299. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20300. }
  20301. },
  20302. }, baseConfig(config, 'col-item'), config, search);
  20303. this.superclass.constructor.call(self, newConfig);
  20304. 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 : '';
  20305. vv = _$2.replace(vv, "{", "");
  20306. vv = _$2.replace(vv, "}", "");
  20307. this.bindTargert = vv;
  20308. this.bindTargert = _$2.trim(this.bindTargert);
  20309. },
  20310. setBindValue: function (arrValue) {
  20311. if (this.bindTargert) {
  20312. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20313. }
  20314. },
  20315. replaceRawInputEvent: function () {
  20316. var me = this;
  20317. var $dom = $(me.inputEl.dom);
  20318. $dom.on('input', function (e) {
  20319. var _a, _b, _c, _d, _e, _f;
  20320. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20321. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20322. if (!a.endsWith(",") && a.length > 0) {
  20323. e.currentTarget.value = a + ",";
  20324. }
  20325. else {
  20326. e.currentTarget.value = a;
  20327. }
  20328. }
  20329. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20330. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20331. _$2.remove(arr, function (it) {
  20332. return !it;
  20333. });
  20334. me.setBindValue(arr);
  20335. stopEvent(e);
  20336. });
  20337. $dom.on('keyup', function (e) {
  20338. me.fireEvent('keyup', me, e);
  20339. // invokeMethod(me.config.listeners?.keyup, me, e)
  20340. stopEvent(e);
  20341. });
  20342. $dom.on('keydown', function (e) {
  20343. me.fireEvent('keydown', me, e);
  20344. // invokeMethod(me.config.listeners?.keydown, me, e)
  20345. //stopEvent(e)
  20346. });
  20347. $dom.on('change', function (e) {
  20348. stopEvent(e);
  20349. });
  20350. $dom.on('paste', function (e) {
  20351. var _a;
  20352. // @ts-ignore
  20353. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20354. var text = clipdata.getData("text/plain");
  20355. var spliter = ',';
  20356. text = text.replaceAll("\r", "");
  20357. text = text.replaceAll("\n", spliter);
  20358. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20359. var arr = text.split(spliter);
  20360. if (arr && Array.isArray(arr)) {
  20361. for (var i = 0; i < arr.length; i++) {
  20362. arr[i] = _$2.trim(arr[i]);
  20363. }
  20364. }
  20365. _$2.remove(arr, function (it) {
  20366. return !it;
  20367. });
  20368. me.setBindValue(arr);
  20369. stopEvent(e);
  20370. });
  20371. },
  20372. onChange: function (newVal, oldVal) {
  20373. var me = this;
  20374. var value = newVal;
  20375. if (value) {
  20376. me.getTrigger('clear').show();
  20377. me.updateLayout();
  20378. }
  20379. else {
  20380. me.getTrigger('clear').hide();
  20381. me.updateLayout();
  20382. }
  20383. },
  20384. /**
  20385. * 清空所有值
  20386. */
  20387. onClearClick: function (sender, e) {
  20388. var me = this;
  20389. var config = me.config;
  20390. var lookup = config.lookup;
  20391. me.setValue('');
  20392. clearViewModelByLookup(sender, lookup);
  20393. }
  20394. });
  20395. }
  20396. //# sourceMappingURL=multiplesearch.js.map
  20397. function initDate () {
  20398. var cc = Ext.form.field.Date.prototype.constructor;
  20399. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20400. Ext.form.field.Date.override({
  20401. format: 'Y-m-d',
  20402. altFormats: 'Y-m-d',
  20403. constructor: function (config) {
  20404. var newConfig = _$2.defaultsDeep({
  20405. // 强制属性
  20406. }, baseConfig(config, 'col-item'), config, date);
  20407. cc.call(this, newConfig);
  20408. },
  20409. getValue: function () {
  20410. var ov = getValue.call(this);
  20411. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20412. // console.log('cc:', nv, ov)
  20413. return nv;
  20414. },
  20415. // focus2() {
  20416. // const that = this
  20417. // if (that.isExpanded) {
  20418. // that.collapse()
  20419. //
  20420. // } else {
  20421. // that.expand();
  20422. // }
  20423. // _.defer(() => {
  20424. // that.focus()
  20425. // })
  20426. // },
  20427. initComponent: function () {
  20428. this.on({
  20429. afterrender: function () {
  20430. var config = this.config;
  20431. // 日期框,不要默认弹出
  20432. // $(this.el.dom).on('click', toggle.bind(this))
  20433. },
  20434. destory: function () {
  20435. // 日期框,不要默认弹出
  20436. // $(this.el.dom).off('click', toggle.bind(this))
  20437. },
  20438. change: {
  20439. fn: function (sender) {
  20440. if (sender.format === 'Y-m-d') {
  20441. // 年月日格式
  20442. var value = sender.getRawValue();
  20443. if (/^\d{8}$/.test(value)) {
  20444. // 8位数字,自动转换为 YYYY-MM-DD
  20445. var newValue = [
  20446. value.substr(0, 4),
  20447. value.substr(4, 2),
  20448. value.substr(6, 2)
  20449. ].join('-');
  20450. sender.setValue(newValue);
  20451. }
  20452. }
  20453. },
  20454. }
  20455. // focus: {
  20456. // // 获得焦点后自动下拉
  20457. // fn(sender) {
  20458. // sender.expand();
  20459. // this.doQuery(this.allQuery, true);
  20460. // },
  20461. // },
  20462. });
  20463. initComponent.call(this);
  20464. },
  20465. createInitialDate: function (value) {
  20466. var minValue = this.minValue, maxValue = this.maxValue;
  20467. value = value || syncDate(new Date());
  20468. if (minValue && minValue > value) {
  20469. value = minValue;
  20470. }
  20471. else if (maxValue && maxValue < value) {
  20472. value = maxValue;
  20473. }
  20474. return value;
  20475. },
  20476. });
  20477. }
  20478. //# sourceMappingURL=datefield.js.map
  20479. function initDateTimePicker () {
  20480. Ext.define('Yvan.DateTimePicker', {
  20481. extend: 'Ext.picker.Date',
  20482. alias: 'datetimepicker',
  20483. alternateClassName: 'Ext.DateTimePicker',
  20484. renderTpl: [
  20485. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20486. '<div class="{baseCls}-header">',
  20487. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20488. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20489. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20490. '</div>',
  20491. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20492. '<thead>',
  20493. '<tr role="row">',
  20494. '<tpl for="dayNames">',
  20495. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20496. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20497. '</th>',
  20498. '</tpl>',
  20499. '</tr>',
  20500. '</thead>',
  20501. '<tbody>',
  20502. '<tr role="row">',
  20503. '<tpl for="days">',
  20504. '{#:this.isEndOfWeek}',
  20505. '<td role="gridcell">',
  20506. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20507. '</td>',
  20508. '</tpl>',
  20509. '</tr>',
  20510. '</tbody>',
  20511. '</table>',
  20512. '<tpl if="showToday">',
  20513. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20514. '</tpl>',
  20515. // These elements are used with Assistive Technologies such as screen readers
  20516. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20517. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20518. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20519. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20520. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20521. '</div>',
  20522. {
  20523. firstInitial: function (value) {
  20524. return Ext.picker.Date.prototype.getDayInitial(value);
  20525. },
  20526. isEndOfWeek: function (value) {
  20527. // convert from 1 based index to 0 based
  20528. // by decrementing value once.
  20529. value--;
  20530. // eslint-disable-next-line vars-on-top
  20531. var end = value % 7 === 0 && value !== 0;
  20532. return end ? '</tr><tr role="row">' : '';
  20533. },
  20534. renderTodayBtn: function (values, out) {
  20535. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20536. },
  20537. renderMonthBtn: function (values, out) {
  20538. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20539. }
  20540. }
  20541. ],
  20542. beforeRender: function () {
  20543. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20544. this.superclass.beforeRender.call(this);
  20545. function handleInput(extHandle, $input) {
  20546. var $dom = $(extHandle.el.dom);
  20547. // const $up = $dom.find('.x-form-spinner-up')
  20548. // const $down = $dom.find('.x-form-spinner-down')
  20549. // debugger
  20550. // $up.on('mousedown', () => {
  20551. // debugger
  20552. // });
  20553. // $up.on('click', () => {
  20554. // debugger
  20555. // });
  20556. extHandle.on('click', function (sender) {
  20557. var hideBak = me.hide;
  20558. me.hide = Ext.emptyFn;
  20559. extHandle.focus();
  20560. me.hide = hideBak;
  20561. });
  20562. var changeValue = function (delta) {
  20563. if (_$2.trim(extHandle.getValue()) === '') {
  20564. extHandle.setValue(extHandle.minValue);
  20565. }
  20566. else {
  20567. var v = parseInt('' + extHandle.getValue());
  20568. if (v + delta > extHandle.maxValue) {
  20569. extHandle.setValue(extHandle.minValue);
  20570. }
  20571. else if (v + delta < extHandle.minValue) {
  20572. extHandle.setValue(extHandle.maxValue);
  20573. }
  20574. else {
  20575. extHandle.setValue(v + delta);
  20576. }
  20577. }
  20578. };
  20579. $input.on('mousewheel', function (e) {
  20580. e.stopPropagation();
  20581. var event = e.originalEvent;
  20582. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20583. // if (event.wheelDelta) {
  20584. // delta = event.wheelDelta / 120;
  20585. // } else if (event.detail) {
  20586. // delta = -event.detail / 3;
  20587. // }
  20588. var zoomSize = Math.ceil(eventDelta / 120);
  20589. changeValue(zoomSize);
  20590. // console.log('delta', delta)
  20591. // $input.focus()
  20592. });
  20593. }
  20594. me.input1 = Ext.create('Ext.form.field.Number', {
  20595. minValue: 0,
  20596. maxValue: 23,
  20597. flex: 1,
  20598. enableKeyEvents: true,
  20599. fieldLabel: '时',
  20600. labelWidth: 20,
  20601. hideLabel: true,
  20602. spinDownEnabled: false,
  20603. spinUpEnabled: false,
  20604. style: {
  20605. marginLeft: '5px',
  20606. },
  20607. listeners: {
  20608. afterrender: function (sender) {
  20609. var $input = $(sender.inputEl.dom);
  20610. handleInput(me.input1, $input);
  20611. },
  20612. change: function (sender, e) {
  20613. if (me.getValue()) {
  20614. me.value.setHours(sender.getValue());
  20615. }
  20616. },
  20617. }
  20618. });
  20619. me.input2 = Ext.create('Ext.form.field.Number', {
  20620. minValue: 0,
  20621. maxValue: 59,
  20622. flex: 1,
  20623. enableKeyEvents: true,
  20624. fieldLabel: ' ',
  20625. hideLabel: false,
  20626. labelWidth: 8,
  20627. spinDownEnabled: false,
  20628. spinUpEnabled: false,
  20629. listeners: {
  20630. afterrender: function (sender) {
  20631. var $input = $(sender.inputEl.dom);
  20632. handleInput(me.input2, $input);
  20633. },
  20634. change: function (sender, e) {
  20635. if (me.getValue()) {
  20636. me.value.setMinutes(sender.getValue());
  20637. }
  20638. },
  20639. }
  20640. });
  20641. me.input3 = Ext.create('Ext.form.field.Number', {
  20642. minValue: 0,
  20643. maxValue: 59,
  20644. flex: 1,
  20645. enableKeyEvents: true,
  20646. fieldLabel: ' ',
  20647. hideLabel: false,
  20648. labelWidth: 8,
  20649. spinDownEnabled: false,
  20650. spinUpEnabled: false,
  20651. style: {
  20652. marginRight: '5px',
  20653. },
  20654. listeners: {
  20655. afterrender: function (sender) {
  20656. var $input = $(sender.inputEl.dom);
  20657. handleInput(me.input3, $input);
  20658. },
  20659. change: function (sender, e) {
  20660. if (me.getValue()) {
  20661. me.value.setSeconds(sender.getValue());
  20662. }
  20663. },
  20664. }
  20665. });
  20666. me.confirmBtn = new Ext.button.Button({
  20667. text: '确认',
  20668. handler: me.confirmClick,
  20669. scope: me
  20670. });
  20671. me.tdBtn = new Ext.button.Button({
  20672. text: '现在',
  20673. handler: me.selectToday,
  20674. scope: me
  20675. });
  20676. me.todayBtn = Ext.create('Ext.container.Container', {
  20677. layout: 'anchor', border: false,
  20678. defaults: {
  20679. border: false, anchor: '100%',
  20680. margin: '0 0 5 0',
  20681. },
  20682. items: [
  20683. {
  20684. layout: 'hbox',
  20685. items: [
  20686. me.input1,
  20687. me.input2,
  20688. me.input3,
  20689. ]
  20690. },
  20691. {
  20692. layout: 'hbox',
  20693. items: [
  20694. me.confirmBtn,
  20695. me.tdBtn,
  20696. ]
  20697. }
  20698. ]
  20699. });
  20700. },
  20701. // finishRenderChildren() {
  20702. // var me = this;
  20703. //
  20704. // this.superclass.finishRenderChildren.call(this);
  20705. // //*
  20706. // me.input1.finishRender();
  20707. // me.input2.finishRender();
  20708. // me.input3.finishRender();
  20709. // //
  20710. // me.tdBtn.finishRender();
  20711. // me.confirmBtn.finishRender();
  20712. // },
  20713. setValue: function (value) {
  20714. //this.value = Ext.Date.clearTime(value, true);
  20715. this.value = value;
  20716. this.input1.setValue(this.value.getHours());
  20717. this.input2.setValue(this.value.getMinutes());
  20718. this.input3.setValue(this.value.getSeconds());
  20719. return this.update(this.value);
  20720. },
  20721. selectDate: function (value) {
  20722. if (this.showTime) {
  20723. value.setHours(this.input1.getValue());
  20724. value.setMinutes(this.input2.getValue());
  20725. value.setSeconds(this.input3.getValue());
  20726. }
  20727. this.value = value;
  20728. return this.update(this.value);
  20729. },
  20730. setDisabledStatus: function (disabled) {
  20731. var me = this;
  20732. debugger;
  20733. // me.callParent();
  20734. if (me.showTime) {
  20735. me.confirmBtn.setDisabled(disabled);
  20736. }
  20737. if (me.isShowFooter()) {
  20738. me.footerContainer.setDisabled(disabled);
  20739. }
  20740. },
  20741. handleDateClick: function (e, t) {
  20742. var me = this, handler = me.handler;
  20743. // e.stopEvent();
  20744. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20745. me.doCancelFocus = me.focusOnSelect === false;
  20746. me.selectDate(new Date(t.dateValue));
  20747. delete me.doCancelFocus;
  20748. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20749. if (me.showTime) {
  20750. return;
  20751. }
  20752. me.fireEvent('select', me, me.value);
  20753. if (handler) {
  20754. handler.call(me.scope || me, me, me.value);
  20755. }
  20756. me.onSelect();
  20757. }
  20758. },
  20759. selectToday: function () {
  20760. var me = this, btn = me.todayBtn, handler = me.handler;
  20761. if (btn && !btn.disabled) {
  20762. me.value = syncDate(new Date());
  20763. me.update(me.value);
  20764. me.fireEvent('select', me, me.value);
  20765. if (handler) {
  20766. handler.call(me.scope || me, me, me.value);
  20767. }
  20768. me.onSelect();
  20769. me.hide();
  20770. }
  20771. return me;
  20772. },
  20773. confirmClick: function () {
  20774. var me = this, btn = me.confirmBtn, handler = me.handler;
  20775. if (btn && !btn.disabled) {
  20776. me.fireEvent('select', me, me.value);
  20777. if (handler) {
  20778. handler.call(me.scope || me, me, me.value);
  20779. }
  20780. me.onSelect();
  20781. me.hide();
  20782. }
  20783. return me;
  20784. },
  20785. selectedUpdate: function (date) {
  20786. var me = this,
  20787. //t = date.getTime(),
  20788. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20789. cells.removeCls(cls);
  20790. for (c = 0; c < cLen; c++) {
  20791. cell = Ext.fly(cellItems[c]);
  20792. if (cell.dom.firstChild.dateValue == t) {
  20793. me.fireEvent('highlightitem', me, cell);
  20794. cell.addCls(cls);
  20795. if (me.isVisible() && !me.doCancelFocus) {
  20796. Ext.fly(cell.dom.firstChild).focus(50);
  20797. }
  20798. break;
  20799. }
  20800. }
  20801. },
  20802. // private, inherit docs
  20803. beforeDestroy: function () {
  20804. var me = this;
  20805. if (me.rendered) {
  20806. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20807. }
  20808. me.superclass.beforeDestroy.call(this);
  20809. }
  20810. });
  20811. }
  20812. //# sourceMappingURL=datetimepicker.js.map
  20813. function initDateTime () {
  20814. Ext.define('Yvan.DateTimeField', {
  20815. extend: 'Ext.form.field.Date',
  20816. xtype: 'datetimefield',
  20817. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20818. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20819. showTime: true,
  20820. format: "Y-m-d H:i:s",
  20821. constructor: function (config) {
  20822. var newConfig = _$2.defaultsDeep({
  20823. // 强制属性
  20824. }, baseConfig(config, 'col-item'), config, date);
  20825. this.superclass.constructor.call(this, newConfig);
  20826. },
  20827. initComponent: function () {
  20828. this.superclass.initComponent.call(this);
  20829. var setInitValue = function () {
  20830. var value = this.getRawValue();
  20831. if (!value) {
  20832. // 没填内容的时候,自动设置当前时间
  20833. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20834. }
  20835. };
  20836. this.on({
  20837. afterrender: function () {
  20838. var config = this.config;
  20839. // 日期框,不要默认弹出
  20840. $(this.el.dom).on('click', setInitValue.bind(this));
  20841. },
  20842. destory: function () {
  20843. // 日期框,不要默认弹出
  20844. $(this.el.dom).off('click', setInitValue.bind(this));
  20845. },
  20846. change: {
  20847. fn: function (sender) {
  20848. if (sender.format === "Y-m-d H:i:s") {
  20849. // 年月日格式
  20850. var value = sender.getRawValue();
  20851. if (/^\d{14}$/.test(value)) {
  20852. // 8位数字,自动转换为 YYYY-MM-DD
  20853. var newValue = [
  20854. value.substr(0, 4),
  20855. '-',
  20856. value.substr(4, 2),
  20857. '-',
  20858. value.substr(6, 2),
  20859. ' ',
  20860. value.substr(8, 2),
  20861. ':',
  20862. value.substr(10, 2),
  20863. ':',
  20864. value.substr(12, 2)
  20865. ].join('');
  20866. sender.setValue(newValue);
  20867. }
  20868. }
  20869. },
  20870. }
  20871. });
  20872. },
  20873. getValue: function () {
  20874. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  20875. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  20876. // console.log('cc:', nv, ov)
  20877. return nv;
  20878. },
  20879. onExpand: function () {
  20880. var strValue = this.getValue();
  20881. var value;
  20882. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  20883. 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)));
  20884. }
  20885. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  20886. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  20887. }
  20888. else {
  20889. value = syncDate(new Date());
  20890. }
  20891. this.picker.setValue(value);
  20892. },
  20893. createPicker: function () {
  20894. var me = this, format = Ext.String.format;
  20895. //@ts-ignore
  20896. return new Yvan.DateTimePicker({
  20897. pickerField: me,
  20898. ownerCt: me.ownerCt,
  20899. renderTo: document.body,
  20900. floating: true,
  20901. hidden: true,
  20902. focusOnShow: true,
  20903. minDate: me.minValue,
  20904. maxDate: me.maxValue,
  20905. disabledDatesRE: me.disabledDatesRE,
  20906. disabledDatesText: me.disabledDatesText,
  20907. disabledDays: me.disabledDays,
  20908. disabledDaysText: me.disabledDaysText,
  20909. format: me.format,
  20910. showToday: me.showToday,
  20911. showTime: me.showTime,
  20912. startDay: me.startDay,
  20913. minText: format(me.minText, me.formatDate(me.minValue)),
  20914. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  20915. listeners: {
  20916. scope: me,
  20917. select: me.onSelect
  20918. },
  20919. keyNavConfig: {
  20920. esc: function () {
  20921. me.collapse();
  20922. }
  20923. }
  20924. });
  20925. },
  20926. });
  20927. }
  20928. //# sourceMappingURL=datetimefield.js.map
  20929. function initNumber () {
  20930. var cc = Ext.form.field.Number.prototype.constructor;
  20931. var initComponent = Ext.form.field.Number.prototype.initComponent;
  20932. Ext.form.field.Number.override({
  20933. constructor: function (config) {
  20934. var newConfig = _$2.defaultsDeep({
  20935. // 强制属性
  20936. }, baseConfig(config, 'col-item'), config, numberfield);
  20937. cc.call(this, newConfig);
  20938. },
  20939. initComponent: function () {
  20940. this.on({
  20941. afterrender: function (sender) {
  20942. var _this = this;
  20943. var _a;
  20944. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  20945. sender.inputEl.dom.setAttribute('spellcheck', "false");
  20946. $$2(sender.inputEl.dom).on('click', function (e) {
  20947. sender.fireEvent('click', _this, e);
  20948. });
  20949. }
  20950. }
  20951. });
  20952. initComponent.call(this);
  20953. },
  20954. });
  20955. }
  20956. //# sourceMappingURL=numberfield.js.map
  20957. function initCheckbox () {
  20958. var cc = Ext.form.field.Checkbox.prototype.constructor;
  20959. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  20960. Ext.form.field.Checkbox.override({
  20961. constructor: function (config) {
  20962. var newConfig = _$2.defaultsDeep({
  20963. // 强制属性
  20964. }, baseConfig(config, 'col-item'), config, checkbox);
  20965. cc.call(this, newConfig);
  20966. },
  20967. getValue: function () {
  20968. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  20969. var ov = getValue.call(this);
  20970. // const ov = this.getRawValue()
  20971. return (ov ? checkedValue : uncheckedValue);
  20972. },
  20973. setValue: function (nv) {
  20974. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  20975. var value;
  20976. if (nv === checkedValue) {
  20977. value = true;
  20978. }
  20979. else if (nv === uncheckedValue) {
  20980. value = false;
  20981. }
  20982. else {
  20983. value = !!nv;
  20984. }
  20985. // me.setRawValue(value)
  20986. // me.checked = value
  20987. // return me.mixins.field.setValue.call(me, value);
  20988. setValue.call(this, value);
  20989. },
  20990. updateCheckedCls: function (checked) {
  20991. var me = this;
  20992. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  20993. checked = checked != null ? checked : me.getValue();
  20994. if (checked === uncheckedValue) {
  20995. checked = false;
  20996. }
  20997. else if (checked === checkedValue) {
  20998. checked = true;
  20999. }
  21000. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21001. },
  21002. initComponent: function () {
  21003. initComponent.call(this);
  21004. },
  21005. });
  21006. }
  21007. //# sourceMappingURL=checkbox.js.map
  21008. function initCheckboxGroup () {
  21009. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21010. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21011. Ext.form.CheckboxGroup.override({
  21012. constructor: function (config) {
  21013. var newConfig = _$2.defaultsDeep({
  21014. // 强制属性
  21015. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21016. cc.call(this, newConfig);
  21017. },
  21018. initComponent: function () {
  21019. initComponent.call(this);
  21020. },
  21021. });
  21022. }
  21023. //# sourceMappingURL=checkboxgroup.js.map
  21024. function initRadio () {
  21025. var cc = Ext.form.field.Radio.prototype.constructor;
  21026. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21027. Ext.form.field.Radio.override({
  21028. constructor: function (config) {
  21029. var newConfig = _$2.defaultsDeep({
  21030. // 强制属性
  21031. }, baseConfig(config, 'col-item'), config, radio);
  21032. cc.call(this, newConfig);
  21033. },
  21034. initComponent: function () {
  21035. initComponent.call(this);
  21036. },
  21037. });
  21038. }
  21039. //# sourceMappingURL=radio.js.map
  21040. function initRadioGroup () {
  21041. var cc = Ext.form.RadioGroup.prototype.constructor;
  21042. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21043. Ext.form.RadioGroup.override({
  21044. constructor: function (config) {
  21045. var newConfig = _$2.defaultsDeep({
  21046. // 强制属性
  21047. }, baseConfig(config, 'col-item'), config, radiogroup);
  21048. cc.call(this, newConfig);
  21049. },
  21050. initComponent: function () {
  21051. initComponent.call(this);
  21052. },
  21053. });
  21054. }
  21055. //# sourceMappingURL=radiogroup.js.map
  21056. function initFieldset () {
  21057. /**
  21058. *
  21059. */
  21060. var ct = Ext.form.FieldSet.prototype.constructor;
  21061. Ext.form.FieldSet.override({
  21062. constructor: function (config) {
  21063. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21064. ct.call(this, newConfig);
  21065. }
  21066. });
  21067. }
  21068. //# sourceMappingURL=fieldset.js.map
  21069. function initCombotree () {
  21070. Ext.define('Yvan.ComboTree', {
  21071. extend: 'Ext.form.field.Picker',
  21072. xtype: 'combotree',
  21073. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21074. config: {
  21075. store: null,
  21076. displayField: null,
  21077. columns: null,
  21078. selectOnTab: true,
  21079. maxPickerHeight: 300,
  21080. minPickerHeight: 100,
  21081. minPickerWidth: 350,
  21082. rootVisible: true,
  21083. },
  21084. editable: false,
  21085. setStore: function (store) {
  21086. this.store = store;
  21087. var me = this;
  21088. if (me.store) {
  21089. if (me.picker) {
  21090. me.picker.setStore(store);
  21091. if (me.isExpanded) {
  21092. me.collapse();
  21093. delete me.picker;
  21094. me.expand();
  21095. }
  21096. }
  21097. this.onLoad();
  21098. me.mon(me.store, {
  21099. scope: me,
  21100. load: me.onLoad,
  21101. update: me.onUpdate
  21102. });
  21103. }
  21104. },
  21105. createPicker: function () {
  21106. var me = this;
  21107. var picker = new Ext.tree.Panel({
  21108. border: false,
  21109. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21110. shrinkWrapDock: 2,
  21111. store: me.store,
  21112. floating: true,
  21113. rootVisible: me.rootVisible,
  21114. displayField: me.displayField,
  21115. columns: me.columns,
  21116. minHeight: me.minPickerHeight,
  21117. maxHeight: me.maxPickerHeight,
  21118. minWidth: me.minPickerWidth,
  21119. manageHeight: false,
  21120. shadow: false,
  21121. scrollable: true,
  21122. // modal: true,
  21123. // constrain: true,
  21124. // constrainTo: topScope._handle.el.dom,
  21125. // renderTo: topScope._handle.el.dom,
  21126. // alignTarget: topScope._handle,
  21127. listeners: {
  21128. scope: me,
  21129. itemclick: me.onItemClick,
  21130. itemkeydown: me.onPickerKeyDown
  21131. }
  21132. }), view = picker.getView();
  21133. if (Ext.isIE9 && Ext.isStrict) {
  21134. view.on({
  21135. scope: me,
  21136. highlightitem: me.repaintPickerView,
  21137. unhighlightitem: me.repaintPickerView,
  21138. afteritemexpand: me.repaintPickerView,
  21139. afteritemcollapse: me.repaintPickerView
  21140. });
  21141. }
  21142. return picker;
  21143. },
  21144. repaintPickerView: function () {
  21145. var style = this.picker.getView().getEl().dom.style;
  21146. style.display = style.display;
  21147. },
  21148. onItemClick: function (view, record, node, rowIndex, e) {
  21149. this.selectItem(view, record);
  21150. },
  21151. onPickerKeyDown: function (treeView, record, item, index, e) {
  21152. var key = e.getKey();
  21153. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21154. this.selectItem(treeView, record);
  21155. }
  21156. },
  21157. selectItem: function (sender, record) {
  21158. var me = this;
  21159. me.setValue(record.getId());
  21160. me.fireEvent('select', me, record);
  21161. me.collapse();
  21162. },
  21163. onExpand: function () {
  21164. var picker = this.picker;
  21165. var store = picker.store;
  21166. var value = this.value;
  21167. var node;
  21168. if (value) {
  21169. node = store.getNodeById(value);
  21170. }
  21171. if (!node) {
  21172. node = store.getRoot();
  21173. }
  21174. picker.ensureVisible(node, {
  21175. select: true,
  21176. focus: true
  21177. });
  21178. },
  21179. setValue: function (value) {
  21180. var me = this;
  21181. console.log('setValue', value);
  21182. me.value = value;
  21183. if (!me.store || me.store.loading) {
  21184. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21185. return me.mixins.field.setValue.call(me, value);
  21186. // return me;
  21187. }
  21188. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21189. if (value === undefined) {
  21190. record = me.store.getRoot();
  21191. console.log('setValue', record.getId());
  21192. me.value = record.getId();
  21193. return me.mixins.field.setValue.call(me, value);
  21194. }
  21195. else {
  21196. record = me.store.getNodeById(value);
  21197. }
  21198. // set the raw value to the record's display field if a record was found
  21199. me.setRawValue(record ? record.get(me.displayField) : '');
  21200. return me.mixins.field.setValue.call(me, value);
  21201. },
  21202. getSubmitValue: function () {
  21203. return this.value;
  21204. },
  21205. getValue: function () {
  21206. return this.value;
  21207. },
  21208. onLoad: function () {
  21209. var value = this.value;
  21210. if (value) {
  21211. this.setValue(value);
  21212. }
  21213. },
  21214. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21215. var display = this.displayField;
  21216. var me = this;
  21217. if (type === 'edit' && modifiedFieldNames &&
  21218. Ext.Array.contains(modifiedFieldNames, display) &&
  21219. this.value === rec.getId()) {
  21220. me.mixins.field.setValue.call(me, this.value);
  21221. this.setRawValue(rec.get(display));
  21222. }
  21223. }
  21224. });
  21225. }
  21226. //# sourceMappingURL=combotree.js.map
  21227. function initPickerPlus () {
  21228. Ext.define('Yvan.PickerAlignCenter', {
  21229. extend: 'Ext.form.field.Picker',
  21230. /**
  21231. * Performs the alignment on the picker using the class defaults
  21232. * @private
  21233. */
  21234. doAlign: function () {
  21235. // 不要挪动就好
  21236. },
  21237. });
  21238. }
  21239. //# sourceMappingURL=pickerplus.js.map
  21240. function initCombogrid () {
  21241. Ext.define('Yvan.ComboGrid', {
  21242. extend: 'Ext.form.field.Picker',
  21243. // extend: 'Yvan.PickerAlignCenter',
  21244. xtype: 'combogrid',
  21245. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21246. triggers: {
  21247. clear: {
  21248. weight: 0,
  21249. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21250. hidden: true,
  21251. handler: 'onClearClick',
  21252. },
  21253. },
  21254. config: __assign({}, comboGrid),
  21255. editable: true,
  21256. _superBlur: false,
  21257. allowCustomInput: false,
  21258. pressEnterPopup: true,
  21259. initComponent: function () {
  21260. var that = this;
  21261. var scope = lookupScope(that);
  21262. var config = that.config;
  21263. if (isDesignMode(scope, config)) {
  21264. this.superclass.initComponent.call(this, arguments);
  21265. return;
  21266. }
  21267. this.on({
  21268. blur: function (sender, e) {
  21269. if (this._superBlur) {
  21270. // 挂起时不恢复内容
  21271. return;
  21272. }
  21273. // 离开焦点时,恢复原来的值
  21274. sender.setRawValue(sender.value);
  21275. },
  21276. afterrender: function (sender) {
  21277. var $dom = $(sender.inputEl.dom);
  21278. that.scope = lookupScope(sender);
  21279. if (sender.column) {
  21280. // 列模式,拦截 keydown
  21281. $dom.on('keydown', function (e) {
  21282. if (isChartEvent(e) && !that.tryEnable()) {
  21283. // 没有达成 editEnable 条件,不用响应
  21284. stopEvent(e);
  21285. return;
  21286. }
  21287. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21288. stopEvent(e);
  21289. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21290. return;
  21291. }
  21292. });
  21293. }
  21294. else {
  21295. // 常规模式,拦截 keyup
  21296. $dom.on('keyup', function (e) {
  21297. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21298. return;
  21299. }
  21300. if (isChartEvent(e) && !that.tryEnable()) {
  21301. // 没有达成 editEnable 条件,不用响应
  21302. stopEvent(e);
  21303. return;
  21304. }
  21305. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21306. stopEvent(e);
  21307. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21308. return;
  21309. }
  21310. if (!that.allowCustomInput) {
  21311. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21312. stopEvent(e);
  21313. }
  21314. });
  21315. $dom.on('change', function (e) {
  21316. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21317. // if (that.isExpanded) {
  21318. // that.filterChange(that, e.target.value)
  21319. // }
  21320. stopEvent(e);
  21321. });
  21322. }
  21323. $dom.on('input', function (e) {
  21324. stopEvent(e);
  21325. });
  21326. },
  21327. });
  21328. this.superclass.initComponent.apply(this, arguments);
  21329. },
  21330. createPicker: function () {
  21331. var me = this;
  21332. var cfg = {
  21333. layout: 'fit',
  21334. border: 0,
  21335. // border: 5,
  21336. style: {
  21337. // borderColor: 'black',
  21338. // borderWidth: '5px',
  21339. // borderStyle: 'solid',
  21340. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21341. },
  21342. shadow: 'side',
  21343. shadowOffset: 100,
  21344. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21345. shrinkWrapDock: 2,
  21346. floating: true,
  21347. width: me.pickerWidth,
  21348. height: me.pickerHeight,
  21349. minWidth: me.pickerWidth,
  21350. minHeight: me.pickerHeight,
  21351. maxWidth: me.pickerWidth,
  21352. maxHeight: me.pickerHeight,
  21353. items: [
  21354. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21355. xtype: 'toolbar',
  21356. items: [
  21357. { xtype: 'textfield', fieldLabel: '筛选' },
  21358. {
  21359. xtype: 'button',
  21360. text: '查询',
  21361. iconCls: 'x-fa fa-search',
  21362. cssType: 'primary',
  21363. listeners: {
  21364. click: function () {
  21365. me.reloadGrid();
  21366. }
  21367. }
  21368. },
  21369. ]
  21370. }, autoLoad: false, listeners: {
  21371. afterrender: function (grid) {
  21372. me.grid = grid;
  21373. grid.focus();
  21374. grid.on({
  21375. rowdblclick: function (sender, row) {
  21376. me.selectItem(row);
  21377. },
  21378. dataLoadComplete: function (sender) {
  21379. _$2.defer(function () {
  21380. me.setFocus();
  21381. });
  21382. },
  21383. keydown: function (sender, e) {
  21384. if (me.column) {
  21385. // 列模式,拦截 keydown
  21386. me.processKey(e);
  21387. }
  21388. },
  21389. keyup: function (sender, e) {
  21390. if (!me.column) {
  21391. // 常规模式,拦截 keyup
  21392. me.processKey(e);
  21393. }
  21394. }
  21395. });
  21396. },
  21397. } })
  21398. ]
  21399. };
  21400. // @ts-ignore
  21401. var picker = new Ext.container.Container(cfg);
  21402. return picker;
  21403. },
  21404. setFocus: function () {
  21405. if (this.grid.store.getCount() > 0) {
  21406. this.grid.focusRow(0);
  21407. }
  21408. },
  21409. processKey: function (e) {
  21410. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21411. this.selectItem(this.grid.selection);
  21412. stopEvent(e);
  21413. }
  21414. else if (e.key === 'Escape') {
  21415. this.collapse();
  21416. }
  21417. },
  21418. repaintPickerView: function () {
  21419. var style = this.picker.getView().getEl().dom.style;
  21420. style.display = style.display;
  21421. },
  21422. onItemClick: function (view, record, node, rowIndex, e) {
  21423. this.selectItem(record);
  21424. },
  21425. onPickerKeyDown: function (treeView, record, item, index, e) {
  21426. var key = e.getKey();
  21427. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21428. this.selectItem(record);
  21429. }
  21430. },
  21431. filterChange: _$2.debounce(function (sender, value) {
  21432. sender.onExpand();
  21433. }, 1000),
  21434. selectItem: function (record) {
  21435. var me = this;
  21436. var lookup = this.lookup;
  21437. var scope = lookupScope(this);
  21438. me.fireEvent('select', me, record);
  21439. if (record.isModel) {
  21440. record = record.data;
  21441. }
  21442. tryWriteObject(lookup, record, function (path, value) {
  21443. me._lookupSet(path, value);
  21444. });
  21445. // lookup
  21446. // fromColumn: 'toTarget'
  21447. // fromColumn: 'toTarget'
  21448. // fromColumn: 'toTarget'
  21449. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21450. var value = _$2.get(record, fromColumn);
  21451. me._lookupSet(toTarget, value);
  21452. });
  21453. // 选定之后不能做清空
  21454. // const {lookupClearOnChange} = me
  21455. // if (_.isArray(lookupClearOnChange)) {
  21456. // _.each(lookupClearOnChange, item => {
  21457. // me._lookupSet(item, '')
  21458. // })
  21459. // }
  21460. me.collapse();
  21461. // 触发 _raiseNextFocus
  21462. me._raiseNextFocus(me);
  21463. },
  21464. onExpand: function () {
  21465. // 展开时,根据 lookup 带入查询参数
  21466. var expressData = this.getExpressData();
  21467. var txtField = this.grid.down('toolbar').down('textfield');
  21468. txtField.setValue(expressData.queryValue);
  21469. this.reloadGrid();
  21470. },
  21471. reloadGrid: function () {
  21472. // 展开时,根据 lookup 带入查询参数
  21473. var expressData = this.getExpressData();
  21474. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21475. var txtField = this.grid.down('toolbar').down('textfield');
  21476. // 每个 combogrid 默认带上 __queryValue 属性
  21477. reloadParam["__queryValue"] = txtField.getValue();
  21478. this.grid.reload(reloadParam);
  21479. },
  21480. onTriggerClick: function (sender) {
  21481. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21482. if (!grid) {
  21483. msg('正在初始化,请稍后');
  21484. return;
  21485. }
  21486. if (!this.tryEnable()) {
  21487. // 没有达成 editEnable 条件,不用弹出
  21488. return;
  21489. }
  21490. if (isExpanded || readOnly || disabled) {
  21491. // 已弹出、只读、禁用状态下,不允许弹出
  21492. return;
  21493. }
  21494. this._superBlur = true;
  21495. this.superclass.onTriggerClick.apply(this, arguments);
  21496. this._superBlur = false;
  21497. },
  21498. onCollapse: function () {
  21499. // 每次收回时,删除下拉组件
  21500. // delete this.picker
  21501. },
  21502. /**
  21503. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21504. */
  21505. setValue: function (value) {
  21506. var me = this;
  21507. // 设值用户看到的表面内容
  21508. this.setRawValue(value);
  21509. // 设值 setValue 调用链,正常触发 change 事件等
  21510. return me.mixins.field.setValue.call(me, value);
  21511. },
  21512. _lookupSet: function (path, value) {
  21513. var me = this;
  21514. path = tryVarSimple(path);
  21515. if (me.column) {
  21516. // 判断写入目标,是否与自己绑定的属性相等
  21517. if (path === 'queryValue' || me.column.dataIndex === path) {
  21518. me.setValue(value);
  21519. }
  21520. // 列模式下,写当前编辑行
  21521. var parentRecord = me._lookupEditorRecord();
  21522. if (parentRecord) {
  21523. // Ext.data.Record / Ext.data.Model
  21524. parentRecord.set(path, value);
  21525. }
  21526. else {
  21527. debugger;
  21528. }
  21529. }
  21530. else {
  21531. // 常规模式下,写 viewModel
  21532. me.scope.viewModel.set(path, value);
  21533. }
  21534. },
  21535. _lookupGrid: function () {
  21536. return this.column.up('grid');
  21537. },
  21538. _lookupEditorRecord: function () {
  21539. var _a, _b, _c, _d;
  21540. // parentGrid.getSelectionModel().getLastSelected()
  21541. var grid = this._lookupGrid();
  21542. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21543. if (!editingPlugin) {
  21544. return grid.getSelectionModel().getLastSelected();
  21545. }
  21546. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21547. if (_$2.isNumber(rowIdx)) {
  21548. return grid.store.getAt(rowIdx);
  21549. }
  21550. else {
  21551. return grid.getSelectionModel().getLastSelected();
  21552. }
  21553. },
  21554. onChange: function (newVal, oldVal) {
  21555. var me = this;
  21556. var value = newVal;
  21557. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21558. if (hideTrigger || disabled || readOnly || hideClear) {
  21559. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21560. return;
  21561. }
  21562. if (value) {
  21563. me.getTrigger('clear').show();
  21564. me.updateLayout();
  21565. }
  21566. else {
  21567. me.getTrigger('clear').hide();
  21568. me.updateLayout();
  21569. }
  21570. },
  21571. /**
  21572. * 得到能用于 express 表达式计算的上下文数据
  21573. */
  21574. getExpressData: function () {
  21575. var queryValue = this.getRawValue();
  21576. if (!queryValue) {
  21577. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21578. queryValue = this.getPicker().down('textfield').getRawValue();
  21579. }
  21580. if (this.column) {
  21581. // 列模式, 准备好判断 editEnable 表达式用的数据
  21582. var parentRecord = this._lookupEditorRecord();
  21583. if (!parentRecord) {
  21584. debugger;
  21585. }
  21586. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21587. }
  21588. else {
  21589. // 编辑模式,准备好判断用的数据
  21590. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21591. }
  21592. },
  21593. tryEnable: function () {
  21594. return tryEnable(this.getExpressData(), this.editEnable);
  21595. },
  21596. /**
  21597. * 清空所有值
  21598. */
  21599. onClearClick: function (sender, e) {
  21600. var me = this;
  21601. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21602. me.fireEvent('clear', sender, e);
  21603. me.setValue('');
  21604. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21605. me._lookupSet(toTarget, '');
  21606. });
  21607. _$2.each(lookupClearOnChange, function (item) {
  21608. me._lookupSet(item, '');
  21609. });
  21610. }
  21611. });
  21612. }
  21613. //# sourceMappingURL=combogrid.js.map
  21614. function initContainer () {
  21615. var cc = Ext.container.Container.prototype.constructor;
  21616. //const {initComponent} = Ext.container.Container.prototype
  21617. Ext.container.Container.override({
  21618. constructor: function (config) {
  21619. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21620. cc.call(this, newConfig);
  21621. },
  21622. });
  21623. }
  21624. //# sourceMappingURL=container.js.map
  21625. function initRows () {
  21626. Ext.define('Yvan.Rows', {
  21627. extend: 'Ext.container.Container',
  21628. xtype: 'rows',
  21629. constructor: function (config) {
  21630. var self = this;
  21631. var newConfig = _$2.defaultsDeep({
  21632. // 强制性属性
  21633. layout: 'anchor', border: false,
  21634. defaults: {
  21635. border: false, anchor: '100%',
  21636. margin: '0 0 5 0',
  21637. },
  21638. }, baseConfig(config, 'rows-container'), config, rows);
  21639. this.superclass.constructor.call(self, newConfig);
  21640. },
  21641. });
  21642. }
  21643. //# sourceMappingURL=rows.js.map
  21644. function initForm () {
  21645. var ct = Ext.form.Panel.prototype.constructor;
  21646. Ext.form.Panel.override({
  21647. constructor: function (config) {
  21648. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21649. ct.call(this, newConfig);
  21650. }
  21651. });
  21652. }
  21653. //# sourceMappingURL=form.js.map
  21654. function initCols () {
  21655. Ext.define('Yvan.Cols', {
  21656. extend: 'Ext.container.Container',
  21657. xtype: 'cols',
  21658. constructor: function (config) {
  21659. var self = this;
  21660. var newConfig = _$2.defaultsDeep({
  21661. // 强制性属性
  21662. layout: 'hbox',
  21663. minHeight: config.designMode ? 32 : 0
  21664. }, baseConfig(config, 'cols-container'), config, cols);
  21665. this.superclass.constructor.call(self, newConfig);
  21666. },
  21667. });
  21668. }
  21669. //# sourceMappingURL=cols.js.map
  21670. function initButton () {
  21671. /**
  21672. *
  21673. */
  21674. var ct = Ext.button.Button.prototype.constructor;
  21675. Ext.button.Button.override({
  21676. constructor: function (config) {
  21677. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21678. ct.call(this, newConfig);
  21679. },
  21680. setLoading: function (value) {
  21681. if (value) {
  21682. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21683. this._originIconCls = this.iconCls;
  21684. }
  21685. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21686. this.setDisabled(true);
  21687. }
  21688. else {
  21689. this.setIconCls(this._originIconCls);
  21690. this.setDisabled(false);
  21691. }
  21692. }
  21693. });
  21694. }
  21695. //# sourceMappingURL=button.js.map
  21696. function initIframe () {
  21697. Ext.define('Ext.ux.IFrame', {
  21698. extend: 'Ext.Component',
  21699. alias: 'widget.uxiframe',
  21700. loadMask: 'Loading...',
  21701. src: 'about:blank',
  21702. renderTpl: [
  21703. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21704. ],
  21705. childEls: ['iframeEl'],
  21706. initComponent: function () {
  21707. this.superclass.initComponent.call(this);
  21708. this.superclass.initEvents.call(this);
  21709. this.frameName = this.frameName || this.id + '-frame';
  21710. },
  21711. initEvents: function () {
  21712. var me = this;
  21713. this.superclass.initEvents.call(this);
  21714. me.iframeEl.on('load', me.onLoad, me);
  21715. },
  21716. initRenderData: function () {
  21717. return Ext.apply(this.superclass.initRenderData.call(this), {
  21718. src: this.src,
  21719. frameName: this.frameName
  21720. });
  21721. },
  21722. getBody: function () {
  21723. var doc = this.getDoc();
  21724. return doc.body || doc.documentElement;
  21725. },
  21726. getDoc: function () {
  21727. try {
  21728. return this.getWin().document;
  21729. }
  21730. catch (ex) {
  21731. return null;
  21732. }
  21733. },
  21734. getWin: function () {
  21735. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21736. return win;
  21737. },
  21738. getFrame: function () {
  21739. var me = this;
  21740. return me.iframeEl.dom;
  21741. },
  21742. onLoad: function () {
  21743. var me = this, doc = me.getDoc();
  21744. if (doc) {
  21745. this.el.unmask();
  21746. this.fireEvent('load', this);
  21747. }
  21748. else if (me.src) {
  21749. this.el.unmask();
  21750. this.fireEvent('error', this);
  21751. }
  21752. },
  21753. load: function (src) {
  21754. var me = this, text = me.loadMask, frame = me.getFrame();
  21755. if (me.fireEvent('beforeload', me, src) !== false) {
  21756. if (text && me.el) {
  21757. me.el.mask(text);
  21758. }
  21759. frame.src = me.src = (src || me.src);
  21760. }
  21761. }
  21762. });
  21763. }
  21764. //# sourceMappingURL=iframe.js.map
  21765. /**
  21766. * 属性:
  21767. * - autoLoad: true
  21768. * - dataSource: ''
  21769. * 方法:
  21770. * - handleZoomBig
  21771. * - handleZoomSmall
  21772. * - handleZoomReset
  21773. * - openDiagram
  21774. * - getBpmn
  21775. * - getBpmnCanvas
  21776. * - getBpmnOverlays
  21777. * - getBpmnZoomScroll
  21778. * 事件:
  21779. * - initFinish
  21780. * - failed
  21781. * - success
  21782. * - itemHover
  21783. * - itemOut
  21784. * - itemClick
  21785. * - itemDblclick
  21786. * - itemMousedown
  21787. * - itemMouseup
  21788. */
  21789. function initBpmn () {
  21790. Ext.define('Yvan.Bpmn', {
  21791. // extend: 'Ext.container.Container',
  21792. extend: 'Ext.panel.Panel',
  21793. alias: 'widget.bpmn',
  21794. xtype: 'bpmn',
  21795. constructor: function (config) {
  21796. var self = this;
  21797. var newConfig = _$2.defaultsDeep({
  21798. // 强制性属性
  21799. }, baseConfig(config, 'row-item'), config, bpmn);
  21800. if (!newConfig.hideToolbar) {
  21801. newConfig.tbar = [];
  21802. newConfig.tbar.push({
  21803. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21804. listeners: {
  21805. click: function (sender) {
  21806. self.reload();
  21807. }
  21808. }
  21809. });
  21810. newConfig.tbar.push({
  21811. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21812. listeners: {
  21813. click: function (sender) {
  21814. self.handleZoomBig();
  21815. }
  21816. },
  21817. });
  21818. newConfig.tbar.push({
  21819. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21820. listeners: {
  21821. click: function (sender) {
  21822. self.handleZoomSmall();
  21823. }
  21824. },
  21825. });
  21826. newConfig.tbar.push({
  21827. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21828. listeners: {
  21829. click: function (sender) {
  21830. self.handleZoomReset();
  21831. }
  21832. },
  21833. });
  21834. }
  21835. this.superclass.constructor.call(self, newConfig);
  21836. },
  21837. initComponent: function () {
  21838. var _this = this;
  21839. var me = this;
  21840. var config = me.config;
  21841. var scope = lookupScope(this);
  21842. if (!isDesignMode(scope, config)) {
  21843. //@ts-ignore
  21844. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21845. console.log('BpNavigated', me, BpNavigated);
  21846. var dom = me.el.dom;
  21847. var $dom = $(dom);
  21848. var $container = $dom.find('.x-autocontainer-innerCt');
  21849. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21850. _this._bpmn = bpmn;
  21851. if (_this.autoLoad) {
  21852. _this.reload();
  21853. }
  21854. _this.fireEvent('initFinish', _this);
  21855. var eventBus = bpmn.get('eventBus');
  21856. eventBus.on('element.hover', function (e) {
  21857. // this.fireEvent('itemHover', this, e);
  21858. });
  21859. eventBus.on('element.out', function (e) {
  21860. _this.fireEvent('itemOut', _this, e);
  21861. });
  21862. eventBus.on('element.click', function (e) {
  21863. _this.fireEvent('itemClick', _this, e);
  21864. });
  21865. eventBus.on('element.dblclick', function (e) {
  21866. _this.fireEvent('itemDblclick', _this, e);
  21867. });
  21868. eventBus.on('element.mousedown', function (e) {
  21869. _this.fireEvent('itemMousedown', _this, e);
  21870. });
  21871. eventBus.on('element.mouseup', function (e) {
  21872. _this.fireEvent('itemMouseup', _this, e);
  21873. });
  21874. });
  21875. }
  21876. this.superclass.initComponent.call(this);
  21877. this.on({
  21878. afterrender: function (sender) {
  21879. }
  21880. });
  21881. },
  21882. /**
  21883. * 重新载入
  21884. */
  21885. reload: function () {
  21886. var _this = this;
  21887. var _a;
  21888. if (typeof this.dataSource === 'string' && this.dataSource) {
  21889. var scope = lookupScope(this);
  21890. var fn = lookupFn(scope, this.dataSource);
  21891. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  21892. _this.openDiagram(res.data);
  21893. });
  21894. }
  21895. },
  21896. /**
  21897. * 获取bpmn
  21898. */
  21899. getBpmn: function () {
  21900. return this._bpmn;
  21901. },
  21902. getBpmnCanvas: function () {
  21903. var _a;
  21904. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  21905. },
  21906. getBpmnOverlays: function () {
  21907. var _a;
  21908. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  21909. },
  21910. getBpmnZoomScroll: function () {
  21911. var _a;
  21912. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  21913. },
  21914. handleZoomBig: function () {
  21915. var _a;
  21916. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  21917. },
  21918. handleZoomSmall: function () {
  21919. var _a;
  21920. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  21921. },
  21922. handleZoomReset: function () {
  21923. var _a;
  21924. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  21925. },
  21926. openDiagram: function (diagram) {
  21927. var _this = this;
  21928. if (!this.getBpmn()) {
  21929. return;
  21930. }
  21931. this.getBpmn().importXML(diagram, function (err) {
  21932. if (err) {
  21933. // YvEventDispatch(this.onFailed, this, undefined);
  21934. _this.fireEvent('failed', _this, err);
  21935. return console.error('could not import BPMN 2.0 diagram', err);
  21936. }
  21937. // zoom to fit full viewport
  21938. _this.getBpmnCanvas().zoom('fit-viewport');
  21939. _this.fireEvent('success', _this);
  21940. });
  21941. },
  21942. });
  21943. }
  21944. //# sourceMappingURL=bpmn.js.map
  21945. function initSqlComplex () {
  21946. Ext.define('Yvan.SqlComplex', {
  21947. extend: 'Ext.panel.Panel',
  21948. xtype: 'sqlcomplex',
  21949. alias: 'widget.sqlcomplex',
  21950. getSqlExpress: function () {
  21951. },
  21952. constructor: function (config) {
  21953. var reference = config.reference;
  21954. var me = this;
  21955. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  21956. {
  21957. region: 'west',
  21958. width: 280,
  21959. border: false,
  21960. split: true,
  21961. reference: reference + '_tree',
  21962. xtype: 'yvtree',
  21963. hideRefresh: true,
  21964. hideExpand: true,
  21965. hideCollapse: true,
  21966. listeners: {
  21967. itemdblclick: function (sender, record, item, index, e) {
  21968. var field = record.get('field');
  21969. var defaultValue = record.get('defaultValue');
  21970. if (!field) {
  21971. return;
  21972. }
  21973. var tabExpress = me.down('tabpanel');
  21974. var sqleditor = me.down('sqleditor');
  21975. var expressGrid = me.down('yvgrid');
  21976. if (tabExpress.getActiveTab().key !== 'grid') {
  21977. // SQL 模式
  21978. sqleditor.insertText(field + '=');
  21979. }
  21980. else {
  21981. // 表格模式
  21982. expressGrid.appendEditRow({
  21983. field: field,
  21984. operator: '=',
  21985. value: defaultValue,
  21986. remark: '',
  21987. });
  21988. _$2.defer(function () {
  21989. gridChanged(me, expressGrid);
  21990. });
  21991. }
  21992. }
  21993. },
  21994. },
  21995. {
  21996. region: 'center',
  21997. xtype: 'tabpanel',
  21998. reference: reference + '_tab',
  21999. tabPosition: 'bottom',
  22000. listeners: {
  22001. afterrender: function (sender) {
  22002. var scope = lookupScope(me);
  22003. var value = scope.viewModel.get(me.config.bindValue);
  22004. // sql 转换为 grid
  22005. try {
  22006. var list_1 = parseSqlToGrid(value);
  22007. _$2.defer(function () {
  22008. var grid = me.down('yvgrid');
  22009. grid.setData(list_1);
  22010. });
  22011. }
  22012. catch (e) {
  22013. console.error(e);
  22014. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22015. var tabSql = sender.down('sqleditor');
  22016. sender.setActiveTab(tabSql);
  22017. }
  22018. },
  22019. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22020. var scope = lookupScope(me);
  22021. var value = scope.viewModel.get(me.config.bindValue);
  22022. if (newCard.key === 'grid') {
  22023. // sql 转换为 grid
  22024. try {
  22025. var list_2 = parseSqlToGrid(value);
  22026. _$2.defer(function () {
  22027. var grid = me.down('yvgrid');
  22028. grid.setData(list_2);
  22029. });
  22030. return true;
  22031. }
  22032. catch (e) {
  22033. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22034. console.error(e);
  22035. return false;
  22036. }
  22037. }
  22038. else if (newCard.key === 'sql') {
  22039. // grid 转换为 sql
  22040. _$2.defer(function () {
  22041. var editor = me.down('sqleditor');
  22042. editor.setValue(value);
  22043. });
  22044. return true;
  22045. }
  22046. }
  22047. },
  22048. items: [
  22049. {
  22050. title: '表格模式',
  22051. key: 'grid',
  22052. xtype: 'yvgrid',
  22053. _mode: 'select',
  22054. reference: reference + '_grid',
  22055. hideFootbar: true,
  22056. pagination: false,
  22057. tbar: [
  22058. {
  22059. xtype: 'button',
  22060. text: '删除',
  22061. iconCls: 'x-fa fa-minus-circle',
  22062. cls: 'ext-btn-danger',
  22063. bind: {
  22064. disabled: '{!' + reference + '_grid.selection}',
  22065. },
  22066. listeners: {
  22067. click: function (sender) {
  22068. var grid = sender.up('yvgrid');
  22069. removeGridRow(grid);
  22070. gridChanged(me, grid);
  22071. }
  22072. },
  22073. },
  22074. ],
  22075. store: {},
  22076. listeners: {
  22077. editfinish: function (sender) {
  22078. gridChanged(me, sender);
  22079. },
  22080. },
  22081. columns: [
  22082. {
  22083. dataIndex: 'field',
  22084. header: '字段', sortable: false, menuDisabled: true,
  22085. width: 190,
  22086. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22087. var column = context.column;
  22088. var propertyConfig = me.config.propertyConfig;
  22089. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22090. var field = record.get('field');
  22091. if (field) {
  22092. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22093. if (idx >= 0) {
  22094. var meta = propertyConfig[idx];
  22095. return meta.text;
  22096. }
  22097. }
  22098. return value;
  22099. }
  22100. },
  22101. {
  22102. dataIndex: 'operator',
  22103. header: '运算符', sortable: false, menuDisabled: true,
  22104. dict: 'operator',
  22105. width: 65,
  22106. editor: { xtype: 'combo' },
  22107. },
  22108. {
  22109. dataIndex: 'value',
  22110. header: '值', sortable: false, menuDisabled: true,
  22111. flex: 1,
  22112. getEditor: function (record) {
  22113. var column = this;
  22114. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22115. var propertyConfig = me.config.propertyConfig;
  22116. var field = record.get('field');
  22117. if (!field) {
  22118. // 没有填 propertyName
  22119. return;
  22120. }
  22121. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22122. if (idx < 0) {
  22123. console.error('没有找到 field=' + field + ". propertyConfig");
  22124. return;
  22125. }
  22126. var meta = propertyConfig[idx];
  22127. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22128. return new Ext.grid.CellEditor({
  22129. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22130. });
  22131. }
  22132. return new Ext.grid.CellEditor({
  22133. field: __assign({ dict: meta.dict }, meta.editor)
  22134. });
  22135. },
  22136. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22137. var column = context.column;
  22138. var grid = _$2.get(view, 'ownerGrid');
  22139. var propertyConfig = me.config.propertyConfig;
  22140. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22141. var field = record.get('field');
  22142. if (field) {
  22143. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22144. if (idx >= 0) {
  22145. var meta = propertyConfig[idx];
  22146. var dictName = _$2.get(meta, 'dict');
  22147. if (dictName && window['DICT_CACHE'][dictName]) {
  22148. var dict_1 = window['DICT_CACHE'][dictName];
  22149. var valueText_1 = [];
  22150. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22151. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22152. if (idxKv >= 0) {
  22153. valueText_1.push(dict_1[idxKv].text);
  22154. }
  22155. else {
  22156. valueText_1.push(value);
  22157. }
  22158. });
  22159. return valueText_1.join(',');
  22160. }
  22161. }
  22162. }
  22163. return valueList;
  22164. },
  22165. },
  22166. ]
  22167. },
  22168. {
  22169. title: 'SQL模式',
  22170. key: 'sql',
  22171. xtype: 'sqleditor',
  22172. reference: reference + '_sql',
  22173. listeners: {
  22174. change: function (sender) {
  22175. var scope = lookupScope(me);
  22176. // 保存 editor 写入的值
  22177. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22178. }
  22179. }
  22180. },
  22181. ]
  22182. }
  22183. ] });
  22184. this.superclass.constructor.call(this, newConfig);
  22185. },
  22186. initComponent: function () {
  22187. // 货位条件树
  22188. var me = this;
  22189. me.superclass.initComponent.apply(this, arguments);
  22190. var tree = this.down('yvtree');
  22191. var config = me.config;
  22192. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22193. },
  22194. });
  22195. function gridChanged(me, grid) {
  22196. var data = grid.getDataRows();
  22197. var propertyConfig = me.config.propertyConfig;
  22198. var bindValue = me.config.bindValue;
  22199. var scope = lookupScope(me);
  22200. var sql = parseGridToSql(data);
  22201. scope.viewModel.set(bindValue, sql);
  22202. }
  22203. /**
  22204. * 用于从 propertyConfig 解析出树形结构
  22205. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22206. * ->
  22207. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22208. */
  22209. function buildConfigTree(propertyConfig) {
  22210. var root = {
  22211. expanded: true,
  22212. leaf: false,
  22213. children: []
  22214. };
  22215. var categoryObj = {};
  22216. var cfgList = propertyConfig;
  22217. _$2.forEach(cfgList, function (cfg) {
  22218. var cateNode = categoryObj[cfg.category];
  22219. if (!cateNode) {
  22220. cateNode = {
  22221. text: cfg.category, expanded: true, leaf: false,
  22222. children: []
  22223. };
  22224. categoryObj[cfg.category] = cateNode;
  22225. root.children.push(cateNode);
  22226. }
  22227. cateNode.children.push({
  22228. text: cfg.text,
  22229. field: cfg.field,
  22230. operator: cfg.operator,
  22231. defaultValue: cfg.defaultValue,
  22232. leaf: true,
  22233. });
  22234. });
  22235. return root;
  22236. }
  22237. /**
  22238. * 将表格变成 SQL where语句 [
  22239. * {field: 'f1', value: 1, operator: '='}
  22240. * {field: 'f2', value: 2, operator: '='}
  22241. * {field: 'f3', value: '3', operator: '>='}
  22242. * {field: 'f4', value: 4, operator: '='}
  22243. * ]
  22244. * ->
  22245. * f1=v1 and f2=v2
  22246. */
  22247. function parseGridToSql(list) {
  22248. var sqls = [];
  22249. _$2.forEach(list, function (i) {
  22250. var _a;
  22251. if (i.operator === 'in') {
  22252. sqls.push(i.field + ' in (' + (i.value) + ')');
  22253. }
  22254. else if (i.operator === 'notIn') {
  22255. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22256. }
  22257. else {
  22258. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22259. }
  22260. });
  22261. return sqls.join(' AND ');
  22262. }
  22263. /**
  22264. * 将 SQL 语句的 where 片段变成表格
  22265. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22266. * @return [
  22267. {field: 'f1', value: 1, operator: '='}
  22268. {field: 'f2', value: 2, operator: '='}
  22269. {field: 'f3', value: '3', operator: '>='}
  22270. {field: 'f4', value: 4, operator: '='}
  22271. ]
  22272. */
  22273. function parseSqlToGrid(sql) {
  22274. if (!sql || !_$2.trim(sql)) {
  22275. return [];
  22276. }
  22277. var parser = new window['NodeSQLParser'].Parser();
  22278. var ast = parser.astify('select * from dual where ' + sql);
  22279. var ret = [];
  22280. exp(ast.where, ret);
  22281. return ret;
  22282. }
  22283. function exp(ast, ret) {
  22284. if (ast.type === 'binary_expr') {
  22285. if (_$2.toUpper(ast.operator) === 'AND') {
  22286. if (ast.left.type === 'binary_expr') {
  22287. exp(ast.left, ret);
  22288. }
  22289. if (ast.right.type === 'binary_expr') {
  22290. exp(ast.right, ret);
  22291. }
  22292. }
  22293. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22294. if (ast.left.type === 'column_ref') {
  22295. if (ast.right.type === 'number' ||
  22296. ast.right.type === 'single_quote_string' ||
  22297. ast.right.type === 'double_quote_string') {
  22298. // 具体值相等
  22299. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22300. }
  22301. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22302. && ast.right.type === 'expr_list') {
  22303. // in / not in
  22304. var valueList_1 = [];
  22305. _$2.forEach(ast.right.value, function (item) {
  22306. valueList_1.push(item.value);
  22307. });
  22308. var operator = void 0;
  22309. if (_$2.toUpper(ast.operator) === 'IN') {
  22310. operator = 'in';
  22311. }
  22312. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22313. operator = 'notIn';
  22314. }
  22315. ret.push({
  22316. field: ast.left.column, value: valueList_1.join(','),
  22317. operator: operator
  22318. });
  22319. }
  22320. else {
  22321. throw new Error('ast.right must is value.');
  22322. }
  22323. }
  22324. else {
  22325. throw new Error('ast.left must is column_ref.');
  22326. }
  22327. }
  22328. else {
  22329. // 必须用 AND 条件符匹配
  22330. throw new Error('ast.operator must is "AND / =".');
  22331. }
  22332. }
  22333. else {
  22334. throw new Error('ast.type must is "binary_expr".');
  22335. }
  22336. }
  22337. /**
  22338. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22339. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22340. {
  22341. type: 'binary_expr',
  22342. operator: 'AND',
  22343. left: {
  22344. type: 'binary_expr',
  22345. operator: 'AND',
  22346. left: {
  22347. type: 'binary_expr',
  22348. operator: 'AND',
  22349. left: {
  22350. type: 'binary_expr',
  22351. operator: 'AND',
  22352. left: {
  22353. type: 'binary_expr',
  22354. operator: '=',
  22355. left: {
  22356. type: 'column_ref',
  22357. table: null,
  22358. column: 'f1'
  22359. },
  22360. right: {
  22361. type: 'number',
  22362. value: 1
  22363. }
  22364. },
  22365. right: {
  22366. type: 'binary_expr',
  22367. operator: '=',
  22368. left: {
  22369. type: 'column_ref',
  22370. table: null,
  22371. column: 'f2'
  22372. },
  22373. right: {
  22374. type: 'number',
  22375. value: 2
  22376. }
  22377. }
  22378. },
  22379. right: {
  22380. type: 'binary_expr',
  22381. operator: '=',
  22382. left: {
  22383. type: 'column_ref',
  22384. table: null,
  22385. column: 'f3'
  22386. },
  22387. right: {
  22388. type: 'single_quote_string',
  22389. value: '3'
  22390. }
  22391. }
  22392. },
  22393. right: {
  22394. type: 'binary_expr',
  22395. operator: '>=',
  22396. left: {
  22397. type: 'column_ref',
  22398. table: null,
  22399. column: 'f4'
  22400. },
  22401. right: {
  22402. type: 'number',
  22403. value: 4
  22404. }
  22405. }
  22406. },
  22407. right: {
  22408. type: 'binary_expr',
  22409. operator: '<',
  22410. left: {
  22411. type: 'column_ref',
  22412. table: null,
  22413. column: 'f4'
  22414. },
  22415. right: {
  22416. type: 'number',
  22417. value: 3
  22418. }
  22419. }
  22420. }
  22421. * */
  22422. }
  22423. //# sourceMappingURL=SqlComplex.js.map
  22424. function initParamComplex () {
  22425. Ext.define('Yvan.ParamComplex', {
  22426. extend: 'Ext.panel.Panel',
  22427. xtype: 'paramcomplex',
  22428. alias: 'widget.paramcomplex',
  22429. getSqlExpress: function () {
  22430. },
  22431. constructor: function (config) {
  22432. var reference = config.reference;
  22433. var me = this;
  22434. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22435. {
  22436. region: 'west',
  22437. width: 280,
  22438. border: false,
  22439. split: true,
  22440. reference: reference + '_tree',
  22441. xtype: 'yvtree',
  22442. hideRefresh: true,
  22443. hideExpand: true,
  22444. hideCollapse: true,
  22445. listeners: {
  22446. itemdblclick: function (sender, record, item, index, e) {
  22447. var field = record.get('field');
  22448. var defaultValue = record.get('defaultValue');
  22449. if (!field) {
  22450. return;
  22451. }
  22452. var tabExpress = me.down('tabpanel');
  22453. var sqleditor = me.down('sqleditor');
  22454. var expressGrid = me.down('yvgrid');
  22455. if (tabExpress.getActiveTab().key !== 'grid') {
  22456. // SQL 模式
  22457. sqleditor.insertText(field + '=');
  22458. }
  22459. else {
  22460. // 表格模式
  22461. expressGrid.appendEditRow({
  22462. field: field,
  22463. operator: '=',
  22464. value: defaultValue,
  22465. remark: '',
  22466. });
  22467. _$2.defer(function () {
  22468. gridChanged(me, expressGrid);
  22469. });
  22470. }
  22471. }
  22472. },
  22473. },
  22474. {
  22475. region: 'center',
  22476. xtype: 'tabpanel',
  22477. reference: reference + '_tab',
  22478. tabPosition: 'bottom',
  22479. listeners: {
  22480. afterrender: function (sender) {
  22481. var scope = lookupScope(me);
  22482. var value = scope.viewModel.get(me.config.bindValue);
  22483. // sql 转换为 grid
  22484. try {
  22485. var list_1 = parseParamToGrid(value);
  22486. _$2.defer(function () {
  22487. var grid = me.down('yvgrid');
  22488. grid.setData(list_1);
  22489. });
  22490. }
  22491. catch (e) {
  22492. console.error(e);
  22493. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22494. var tabSql = sender.down('sqleditor');
  22495. sender.setActiveTab(tabSql);
  22496. }
  22497. },
  22498. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22499. var scope = lookupScope(me);
  22500. var value = scope.viewModel.get(me.config.bindValue);
  22501. if (newCard.key === 'grid') {
  22502. // sql 转换为 grid
  22503. try {
  22504. var list_2 = parseParamToGrid(value);
  22505. _$2.defer(function () {
  22506. var grid = me.down('yvgrid');
  22507. grid.setData(list_2);
  22508. });
  22509. return true;
  22510. }
  22511. catch (e) {
  22512. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22513. console.error(e);
  22514. return false;
  22515. }
  22516. }
  22517. else if (newCard.key === 'sql') {
  22518. // grid 转换为 sql
  22519. _$2.defer(function () {
  22520. var editor = me.down('sqleditor');
  22521. editor.setValue(value);
  22522. });
  22523. return true;
  22524. }
  22525. }
  22526. },
  22527. items: [
  22528. {
  22529. title: '表格模式',
  22530. key: 'grid',
  22531. xtype: 'yvgrid',
  22532. _mode: 'select',
  22533. reference: reference + '_grid',
  22534. hideFootbar: true,
  22535. pagination: false,
  22536. tbar: [
  22537. {
  22538. xtype: 'button',
  22539. text: '删除',
  22540. iconCls: 'x-fa fa-minus-circle',
  22541. cls: 'ext-btn-danger',
  22542. bind: {
  22543. disabled: '{!' + reference + '_grid.selection}',
  22544. },
  22545. listeners: {
  22546. click: function (sender) {
  22547. var grid = sender.up('yvgrid');
  22548. removeGridRow(grid);
  22549. gridChanged(me, grid);
  22550. }
  22551. },
  22552. },
  22553. ],
  22554. store: {},
  22555. listeners: {
  22556. editfinish: function (sender) {
  22557. gridChanged(me, sender);
  22558. },
  22559. },
  22560. columns: [
  22561. {
  22562. dataIndex: 'field',
  22563. header: '字段', sortable: false, menuDisabled: true,
  22564. width: 190,
  22565. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22566. var column = context.column;
  22567. var propertyConfig = me.config.propertyConfig;
  22568. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22569. var field = record.get('field');
  22570. if (field) {
  22571. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22572. if (idx >= 0) {
  22573. var meta = propertyConfig[idx];
  22574. return meta.text;
  22575. }
  22576. }
  22577. return value;
  22578. }
  22579. },
  22580. {
  22581. dataIndex: 'value',
  22582. header: '值', sortable: false, menuDisabled: true,
  22583. flex: 1,
  22584. getEditor: function (record) {
  22585. var column = this;
  22586. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22587. var propertyConfig = me.config.propertyConfig;
  22588. var field = record.get('field');
  22589. if (!field) {
  22590. // 没有填 propertyName
  22591. return;
  22592. }
  22593. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22594. if (idx < 0) {
  22595. console.error('没有找到 field=' + field + ". propertyConfig");
  22596. return;
  22597. }
  22598. var meta = propertyConfig[idx];
  22599. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22600. return new Ext.grid.CellEditor({
  22601. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22602. });
  22603. }
  22604. return new Ext.grid.CellEditor({
  22605. field: __assign({ dict: meta.dict }, meta.editor)
  22606. });
  22607. },
  22608. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22609. var column = context.column;
  22610. var grid = _$2.get(view, 'ownerGrid');
  22611. var propertyConfig = me.config.propertyConfig;
  22612. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22613. var field = record.get('field');
  22614. if (field) {
  22615. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22616. if (idx >= 0) {
  22617. var meta = propertyConfig[idx];
  22618. var dictName = _$2.get(meta, 'dict');
  22619. if (dictName && window['DICT_CACHE'][dictName]) {
  22620. var dict_1 = window['DICT_CACHE'][dictName];
  22621. var valueText_1 = [];
  22622. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22623. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22624. if (idxKv >= 0) {
  22625. valueText_1.push(dict_1[idxKv].text);
  22626. }
  22627. else {
  22628. valueText_1.push(value);
  22629. }
  22630. });
  22631. return valueText_1.join(',');
  22632. }
  22633. }
  22634. }
  22635. return valueList;
  22636. },
  22637. },
  22638. ]
  22639. },
  22640. {
  22641. title: '文本模式',
  22642. key: 'sql',
  22643. xtype: 'sqleditor',
  22644. reference: reference + '_sql',
  22645. listeners: {
  22646. change: function (sender) {
  22647. var scope = lookupScope(me);
  22648. // 保存 editor 写入的值
  22649. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22650. }
  22651. }
  22652. },
  22653. ]
  22654. }
  22655. ] });
  22656. this.superclass.constructor.call(this, newConfig);
  22657. },
  22658. initComponent: function () {
  22659. // 货位条件树
  22660. var me = this;
  22661. me.superclass.initComponent.apply(this, arguments);
  22662. var tree = this.down('yvtree');
  22663. var config = me.config;
  22664. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22665. },
  22666. });
  22667. function gridChanged(me, grid) {
  22668. var data = grid.getDataRows();
  22669. var propertyConfig = me.config.propertyConfig;
  22670. var bindValue = me.config.bindValue;
  22671. var scope = lookupScope(me);
  22672. var sql = parseGridToParam(data);
  22673. scope.viewModel.set(bindValue, sql);
  22674. }
  22675. /**
  22676. * 用于从 propertyConfig 解析出树形结构
  22677. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22678. * ->
  22679. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22680. */
  22681. function buildConfigTree(propertyConfig) {
  22682. var root = {
  22683. expanded: true,
  22684. leaf: false,
  22685. children: []
  22686. };
  22687. var categoryObj = {};
  22688. var cfgList = propertyConfig;
  22689. _$2.forEach(cfgList, function (cfg) {
  22690. var cateNode = categoryObj[cfg.category];
  22691. if (!cateNode) {
  22692. cateNode = {
  22693. text: cfg.category, expanded: true, leaf: false,
  22694. children: []
  22695. };
  22696. categoryObj[cfg.category] = cateNode;
  22697. root.children.push(cateNode);
  22698. }
  22699. cateNode.children.push({
  22700. text: cfg.text,
  22701. field: cfg.field,
  22702. operator: cfg.operator,
  22703. defaultValue: cfg.defaultValue,
  22704. leaf: true,
  22705. });
  22706. });
  22707. return root;
  22708. }
  22709. /**
  22710. * 将表格变成参数语句 [
  22711. * {field: 'f1', value: 1}
  22712. * {field: 'f2', value: 2}
  22713. * {field: 'f3', value: '3'}
  22714. * {field: 'f4', value: 4}
  22715. * ]
  22716. * ->
  22717. * f1=v1, f2=v2
  22718. */
  22719. function parseGridToParam(list) {
  22720. var sqls = [];
  22721. _$2.forEach(list, function (i) {
  22722. sqls.push(i.field + '=' + (i.value));
  22723. });
  22724. return sqls.join('; ');
  22725. }
  22726. /**
  22727. * 将 分号分割的的参数设置 变成表格
  22728. * @param param a=1; b=2; c='3'
  22729. * @return [
  22730. {field: 'a', value: 1}
  22731. {field: 'b', value: 2}
  22732. {field: 'c', value: '3'}
  22733. ]
  22734. */
  22735. function parseParamToGrid(param) {
  22736. if (!param || !_$2.trim(param)) {
  22737. return [];
  22738. }
  22739. var ret = [];
  22740. var sp = _$2.split(param, ';');
  22741. _$2.forEach(sp, function (v) {
  22742. var vi = _$2.indexOf(v, '=');
  22743. var field = _$2.trim(v.substr(0, vi));
  22744. var value = eval(v.substr(vi + 1));
  22745. ret.push({ field: field, value: value });
  22746. });
  22747. return ret;
  22748. }
  22749. }
  22750. //# sourceMappingURL=ParamComplex.js.map
  22751. function initSqlEditor () {
  22752. Ext.define('com.yvan.studio.SqlEditor', {
  22753. extend: 'Ext.panel.Panel',
  22754. alias: 'widget.sqleditor',
  22755. xtype: 'sqleditor',
  22756. layout: 'fit',
  22757. border: false,
  22758. html: "<div class=\"editor\"/>",
  22759. config: {
  22760. value: ''
  22761. },
  22762. codeChange: undefined,
  22763. isChangeFromOuter: false,
  22764. setCode: function (value) {
  22765. var _this = this;
  22766. this.code = value;
  22767. this.value = value;
  22768. _$2.defer(function () {
  22769. _this.isChangeFromOuter = true;
  22770. if (_this.editor) {
  22771. _this.editor.setValue(value);
  22772. }
  22773. });
  22774. },
  22775. getCode: function () {
  22776. return this.getValue();
  22777. },
  22778. updateOptions: function (options) {
  22779. if (this.editor && options) {
  22780. this.editor.updateOptions(options);
  22781. }
  22782. },
  22783. getValue: function () {
  22784. if (!this.editor) {
  22785. return this.code;
  22786. }
  22787. return this.editor.getValue();
  22788. },
  22789. applyPosition: function () {
  22790. var _this = this;
  22791. if (this.autoFocusMethod) {
  22792. if (this.editor) {
  22793. _$2.defer(function () {
  22794. if (_this.autoFocusStartLine) {
  22795. _this.editor.setPosition({
  22796. lineNumber: _this.autoFocusStartLine,
  22797. column: _this.autoFocusStartColumn
  22798. });
  22799. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22800. }
  22801. _this.editor.focus();
  22802. });
  22803. delete this.autoFocusMethod;
  22804. }
  22805. }
  22806. this.editor.layout();
  22807. },
  22808. insertText: function (text) {
  22809. var editor = this.editor;
  22810. var position = editor.getPosition();
  22811. editor.executeEdits('', [
  22812. {
  22813. range: {
  22814. startLineNumber: position.lineNumber,
  22815. startColumn: position.column,
  22816. endLineNumber: position.lineNumber,
  22817. endColumn: position.column
  22818. },
  22819. text: text
  22820. }
  22821. ]);
  22822. },
  22823. setValue: function (value, fromEditor) {
  22824. this.setCode(value);
  22825. var me = this;
  22826. if (me.value === value) {
  22827. // 值相等,不需要变化
  22828. return;
  22829. }
  22830. if (fromEditor !== true && me.editor) {
  22831. // 不是来源于编辑器的变化,才设置编辑器的值
  22832. me.editor.setValue(value);
  22833. }
  22834. // 通知mixins setValue
  22835. me.value = value;
  22836. me.fireEvent('change', value);
  22837. },
  22838. initComponent: function () {
  22839. var that = this;
  22840. this.superclass.initComponent.call(this);
  22841. that.on({
  22842. resize: function () {
  22843. if (that.editor) {
  22844. that.editor.layout();
  22845. }
  22846. },
  22847. destory: function () {
  22848. if (that.editor) {
  22849. that.editor.dispose();
  22850. delete that.editor;
  22851. }
  22852. },
  22853. afterrender: function (sender) {
  22854. var $dom = $(that.el.dom).find('.editor');
  22855. attach_2($dom[0], {
  22856. value: that.code
  22857. }).then(function (editor) {
  22858. that.editor = editor;
  22859. that.applyPosition();
  22860. that.editor.onDidChangeModelContent(function (e) {
  22861. that.fireEvent('change', that.editor, e);
  22862. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22863. that.codeChange(that.editor.getValue(), that.name, e);
  22864. }
  22865. that.isChangeFromOuter = false;
  22866. });
  22867. });
  22868. }
  22869. });
  22870. }
  22871. });
  22872. function attach_2(element, opts) {
  22873. if (!window['monaco']) {
  22874. return;
  22875. }
  22876. var monaco = window['monaco'];
  22877. return new Promise(function (resolve) {
  22878. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  22879. enabled: false
  22880. } }));
  22881. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  22882. // const sql = editor.getValue()
  22883. // if (_.trim(sql).length > 0) {
  22884. // editor.setValue(format(sql, {
  22885. // indent: ' ',
  22886. // uppercase: true,
  22887. // }))
  22888. // }
  22889. // })
  22890. editor.onKeyUp(function (e) {
  22891. // console.log(e)
  22892. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  22893. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  22894. }
  22895. });
  22896. resolve(editor);
  22897. });
  22898. }
  22899. }
  22900. //# sourceMappingURL=SqlEditor.js.map
  22901. function initJsonEditor () {
  22902. Ext.define('com.yvan.studio.JsonEditor', {
  22903. extend: 'Ext.panel.Panel',
  22904. alias: 'widget.jsoneditor',
  22905. xtype: 'jsoneditor',
  22906. layout: 'fit',
  22907. border: false,
  22908. html: "<div class=\"editor\"/>",
  22909. autoFocusMethod: true,
  22910. autoFocusStartLine: 0,
  22911. autoFocusStartColumn: 0,
  22912. codeChange: undefined,
  22913. funcArr: [],
  22914. modulePage: null,
  22915. isChangeFromOuter: false,
  22916. name: "",
  22917. /**
  22918. * 设置代码
  22919. */
  22920. setCode: function (value) {
  22921. var _this = this;
  22922. this.code = value;
  22923. _$2.defer(function () {
  22924. _this.isChangeFromOuter = true;
  22925. if (_this.editor) {
  22926. _this.editor.setValue(value);
  22927. }
  22928. });
  22929. },
  22930. updateOptions: function (options) {
  22931. if (this.editor && options) {
  22932. this.editor.updateOptions(options);
  22933. }
  22934. },
  22935. setLanguage: function (lang) {
  22936. if (!window['monaco']) {
  22937. return;
  22938. }
  22939. var monaco = window['monaco'];
  22940. if (this.editor && lang) {
  22941. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  22942. }
  22943. },
  22944. getCode: function () {
  22945. var _a;
  22946. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  22947. },
  22948. applyPosition: function () {
  22949. var _this = this;
  22950. if (this.autoFocusMethod) {
  22951. if (this.editor) {
  22952. _$2.defer(function () {
  22953. if (_this.autoFocusStartLine) {
  22954. _this.editor.setPosition({
  22955. lineNumber: _this.autoFocusStartLine,
  22956. column: _this.autoFocusStartColumn
  22957. });
  22958. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22959. }
  22960. _this.editor.focus();
  22961. });
  22962. delete this.autoFocusMethod;
  22963. }
  22964. }
  22965. this.editor.layout();
  22966. },
  22967. initComponent: function () {
  22968. var that = this;
  22969. this.superclass.initComponent.apply(this, arguments);
  22970. this.on({
  22971. resize: function (sender, width, height) {
  22972. if (that.editor) {
  22973. that.editor.layout();
  22974. }
  22975. },
  22976. destory: function () {
  22977. if (that.editor) {
  22978. that.editor.dispose();
  22979. delete that.editor;
  22980. }
  22981. },
  22982. afterrender: function (sender) {
  22983. var $dom = $(that.el.dom).find('.editor');
  22984. attach_116($dom[0], {
  22985. value: that.code
  22986. }).then(function (editor) {
  22987. that.editor = editor;
  22988. that.applyPosition();
  22989. that.editor.onDidChangeModelContent(function (e) {
  22990. that.fireEvent('change', that.editor, e);
  22991. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22992. that.codeChange(that.editor.getValue(), that.name, e);
  22993. }
  22994. that.isChangeFromOuter = false;
  22995. });
  22996. });
  22997. }
  22998. });
  22999. },
  23000. });
  23001. function attach_116(element, opts) {
  23002. if (!window['monaco']) {
  23003. return;
  23004. }
  23005. var monaco = window['monaco'];
  23006. return new Promise(function (resolve) {
  23007. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23008. enabled: false
  23009. } }));
  23010. editor.onKeyUp(function (e) {
  23011. // console.log(e)
  23012. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23013. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23014. }
  23015. });
  23016. resolve(editor);
  23017. });
  23018. }
  23019. }
  23020. //# sourceMappingURL=JsonEditor.js.map
  23021. function initJsEditor () {
  23022. Ext.define('com.yvan.studio.JsEditor', {
  23023. extend: 'Ext.panel.Panel',
  23024. alias: 'widget.jseditor',
  23025. xtype: 'jseditor',
  23026. layout: 'fit',
  23027. border: false,
  23028. html: "<div class=\"editor\"/>",
  23029. autoFocusMethod: true,
  23030. autoFocusStartLine: 0,
  23031. autoFocusStartColumn: 0,
  23032. codeChange: undefined,
  23033. funcArr: [],
  23034. modulePage: null,
  23035. isChangeFromOuter: false,
  23036. name: "",
  23037. /**
  23038. * 设置代码
  23039. */
  23040. setCode: function (value) {
  23041. var _this = this;
  23042. this.code = value;
  23043. _$2.defer(function () {
  23044. _this.isChangeFromOuter = true;
  23045. if (_this.editor) {
  23046. _this.editor.setValue(value);
  23047. if (_this.name === "controllerEditor") {
  23048. _this.funcArr = _this.getAllFunction();
  23049. }
  23050. }
  23051. });
  23052. },
  23053. getCode: function () {
  23054. var _a;
  23055. if (!this.editor) {
  23056. return this.code;
  23057. }
  23058. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23059. },
  23060. applyPosition: function () {
  23061. var _this = this;
  23062. if (this.autoFocusMethod) {
  23063. if (this.editor) {
  23064. _$2.defer(function () {
  23065. if (_this.autoFocusStartLine) {
  23066. _this.editor.setPosition({
  23067. lineNumber: _this.autoFocusStartLine,
  23068. column: _this.autoFocusStartColumn
  23069. });
  23070. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23071. }
  23072. _this.editor.focus();
  23073. });
  23074. delete this.autoFocusMethod;
  23075. }
  23076. }
  23077. this.editor.layout();
  23078. },
  23079. initComponent: function () {
  23080. var that = this;
  23081. this.superclass.initComponent.apply(this, arguments);
  23082. this.on({
  23083. resize: function (sender, width, height) {
  23084. if (that.editor) {
  23085. that.editor.layout();
  23086. }
  23087. },
  23088. destory: function () {
  23089. if (that.editor) {
  23090. that.editor.dispose();
  23091. delete that.editor;
  23092. }
  23093. },
  23094. afterrender: function () {
  23095. var $dom = $(that.el.dom).find('.editor');
  23096. attach_1($dom[0], {
  23097. value: that.code
  23098. }).then(function (editor) {
  23099. that.editor = editor;
  23100. that.applyPosition();
  23101. that.editor.onDidChangeModelContent(function (e) {
  23102. that.fireEvent('change', that.editor, e);
  23103. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23104. that.codeChange(that.editor.getValue(), that.name, e);
  23105. }
  23106. that.isChangeFromOuter = false;
  23107. });
  23108. });
  23109. }
  23110. });
  23111. },
  23112. getAllFunction: function () {
  23113. var funcArr = [];
  23114. var ast = window['YvanUI'].recast.parse(this.code);
  23115. if (ast && ast.program && ast.program.body) {
  23116. if (Array.isArray(ast.program.body)) {
  23117. for (var i = 0; i < ast.program.body.length; i++) {
  23118. var m = ast.program.body[i];
  23119. if (m.type === "ExportDefaultDeclaration") {
  23120. if (m.declaration.type === "ClassDeclaration") {
  23121. if (m.declaration.body.type === "ClassBody") {
  23122. if (Array.isArray(m.declaration.body.body)) {
  23123. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23124. var ob = m.declaration.body.body[j];
  23125. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23126. var funcItem = { name: ob.key.name, args: [] };
  23127. if (Array.isArray(ob.value.params)) {
  23128. for (var k = 0; k < ob.value.params.length; k++) {
  23129. var p = ob.value.params[k];
  23130. funcItem.args.push(p.name);
  23131. }
  23132. }
  23133. funcArr.push(funcItem);
  23134. }
  23135. }
  23136. }
  23137. }
  23138. }
  23139. }
  23140. }
  23141. }
  23142. }
  23143. return funcArr;
  23144. }
  23145. });
  23146. var isInited = false;
  23147. function attach_1(element, opts) {
  23148. if (!window['monaco']) {
  23149. return;
  23150. }
  23151. var monaco = window['monaco'];
  23152. return new Promise(function (resolve) {
  23153. if (!isInited) {
  23154. isInited = true;
  23155. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23156. noSemanticValidation: true,
  23157. noSyntaxValidation: false
  23158. });
  23159. // compiler options
  23160. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23161. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23162. allowNonTsExtensions: true,
  23163. });
  23164. // extra libraries
  23165. var libSource = [
  23166. 'declare class Facts {',
  23167. ' /**',
  23168. ' * Returns the next fact',
  23169. ' */',
  23170. ' static next():string',
  23171. ' static next222():string',
  23172. '}',
  23173. "\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 ",
  23174. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23175. ].join('\n');
  23176. var libUri = 'file:///index.d.ts';
  23177. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23178. // When resolving definitions and references, the editor will try to use created models.
  23179. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23180. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23181. }
  23182. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23183. resolve(editor);
  23184. });
  23185. }
  23186. }
  23187. //# sourceMappingURL=JsEditor.js.map
  23188. function initClipboard () {
  23189. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23190. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23191. Ext.grid.plugin.Clipboard.override({
  23192. getCellData: function (format, erase) {
  23193. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23194. if (selection) {
  23195. selection.eachCell(function (cellContext) {
  23196. column = cellContext.column;
  23197. view = cellContext.column.getView();
  23198. record = cellContext.record;
  23199. // Do not copy the check column or row numberer column
  23200. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23201. return;
  23202. }
  23203. if (lastRecord !== record) {
  23204. lastRecord = record;
  23205. ret.push(row = []);
  23206. }
  23207. dataIndex = column.dataIndex;
  23208. // 记录原始数据
  23209. var rData = record.data[dataIndex];
  23210. if (isRaw) {
  23211. data = record.data[dataIndex];
  23212. }
  23213. else {
  23214. // Try to access the view node.
  23215. viewNode = view.all.item(cellContext.rowIdx);
  23216. // If we could not, it's because it's outside of the rendered block -
  23217. // recreate it.
  23218. if (!viewNode) {
  23219. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23220. }
  23221. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23222. data = cell.innerHTML;
  23223. if (isText) {
  23224. data = Ext.util.Format.stripTags(data);
  23225. }
  23226. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23227. data = data || rData;
  23228. }
  23229. row.push(data);
  23230. if (erase && dataIndex) {
  23231. record.set(dataIndex, null);
  23232. }
  23233. });
  23234. }
  23235. // See decode() comment below
  23236. return Ext.util.TSV.encode(ret, undefined, null);
  23237. },
  23238. getCells: function (format, erase) {
  23239. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23240. if (selection) {
  23241. selection.eachCell(function (cellContext) {
  23242. record = cellContext.record;
  23243. if (lastRecord !== record) {
  23244. lastRecord = record;
  23245. ret.push(row = {
  23246. model: record.self,
  23247. fields: []
  23248. });
  23249. }
  23250. dataIndex = cellContext.column.dataIndex;
  23251. row.fields.push({
  23252. name: dataIndex,
  23253. value: record.data[dataIndex]
  23254. });
  23255. if (erase && dataIndex) {
  23256. record.set(dataIndex, null);
  23257. }
  23258. });
  23259. }
  23260. return ret;
  23261. },
  23262. getTextData: function (format, erase) {
  23263. return this.getCellData(format, erase);
  23264. },
  23265. putCellData: function (data, format) {
  23266. var _a;
  23267. 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 = {};
  23268. // If the view is not focused, use the first cell of the selection as the destination.
  23269. if (!destination && selected) {
  23270. selected.eachCell(function (c) {
  23271. destination = c;
  23272. return false;
  23273. });
  23274. }
  23275. if (destination) {
  23276. // Create a new Context based upon the outermost View.
  23277. // NavigationModel works on local views.
  23278. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23279. // At that point, we can use navModel.getPosition()
  23280. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23281. }
  23282. else {
  23283. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23284. }
  23285. destinationStartColumn = destination.colIdx;
  23286. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23287. row = values[sourceRowIdx];
  23288. // Collect new values in dataObject
  23289. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23290. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23291. continue;
  23292. }
  23293. dataIndex = destination.column.dataIndex;
  23294. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23295. if (dataIndex) {
  23296. switch (format) {
  23297. // Raw field values
  23298. case 'raw':
  23299. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23300. break;
  23301. // Textual data with HTML tags stripped
  23302. case 'text':
  23303. {
  23304. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23305. // 获取字典原始的value
  23306. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23307. }
  23308. else {
  23309. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23310. }
  23311. break;
  23312. }
  23313. }
  23314. }
  23315. // If we are at the end of the destination row, break the column loop.
  23316. if (destination.colIdx === maxColIdx) {
  23317. break;
  23318. }
  23319. destination.setColumn(destination.colIdx + 1);
  23320. }
  23321. // Update the record in one go.
  23322. destination.record.set(dataObject);
  23323. // If we are at the end of the destination store, break the row loop.
  23324. if (destination.rowIdx === maxRowIdx) {
  23325. break;
  23326. }
  23327. // Jump to next row in destination
  23328. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23329. }
  23330. },
  23331. putTextData: function (data, format) {
  23332. var _a, _b, _c;
  23333. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23334. // 根据复制的行数自动添加新的行
  23335. 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;
  23336. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23337. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23338. this.cmp.getStore().add({});
  23339. }
  23340. }
  23341. this.putCellData(data, format);
  23342. },
  23343. });
  23344. }
  23345. //# sourceMappingURL=clipboard.js.map
  23346. function initDict () {
  23347. var DICT_CACHE = window['DICT_CACHE'];
  23348. if (!DICT_CACHE) {
  23349. DICT_CACHE = {};
  23350. window['DICT_CACHE'] = DICT_CACHE;
  23351. }
  23352. DICT_CACHE.XTYPE = [
  23353. { id: 'datefield', text: '日期' },
  23354. { id: 'datetimefield', text: '日期时间' },
  23355. { id: 'textfield', text: '文本' },
  23356. { id: 'numberfield', text: '数字' },
  23357. { id: 'combo', text: '下拉框' },
  23358. ];
  23359. DICT_CACHE.operator = [
  23360. { id: '=', text: '=' },
  23361. { id: '>', text: '>' },
  23362. { id: '<', text: '<' },
  23363. { id: '>=', text: '>=' },
  23364. { id: '<=', text: '<=' },
  23365. { id: 'in', text: 'in' },
  23366. { id: 'notIn', text: 'notIn' },
  23367. ];
  23368. DICT_CACHE.GRID_MODE = [
  23369. { id: 'edit1', text: '单机编辑模式' },
  23370. { id: 'edit2', text: '双击编辑模式' },
  23371. { id: 'checkbox', text: '勾选' },
  23372. { id: 'checkonly', text: '只勾选' },
  23373. { id: 'select', text: '行选择模式' },
  23374. ];
  23375. DICT_CACHE.BOTH_SELECT = [
  23376. { id: 'N/A', text: '<无>' },
  23377. { id: 'textfield', text: '文本' },
  23378. { id: 'numberfield', text: '数字框' },
  23379. { id: 'datefield', text: '日期' },
  23380. { id: 'datetimefield', text: '日期时间' },
  23381. { id: 'combo', text: '下拉框' },
  23382. { id: 'combogrid', text: '下拉表' },
  23383. { id: 'checkbox', text: '勾选' },
  23384. ];
  23385. DICT_CACHE.ROW_LAYOUT = [
  23386. { id: 'flex', text: '按权重摆放' },
  23387. { id: 'hbox', text: '按宽度摆放' },
  23388. ];
  23389. DICT_CACHE.GRID_XTYPE = [
  23390. { id: 'N/A', text: '<无>' },
  23391. { id: 'textfield', text: '文本-textfield' },
  23392. { id: 'numberfield', text: '数字框-numberfield' },
  23393. { id: 'datefield', text: '日期-datefield' },
  23394. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23395. { id: 'combo', text: '下拉框-combo' },
  23396. { id: 'combogrid', text: '下拉表-combogrid' },
  23397. { id: 'checkbox', text: '勾选-checkbox' },
  23398. ];
  23399. DICT_CACHE.FORM_XTYPE = [
  23400. { id: 'N/A', text: '<无>' },
  23401. { id: 'textfield', text: '文本-textfield' },
  23402. { id: 'numberfield', text: '数字框-numberfield' },
  23403. { id: 'datefield', text: '日期-datefield' },
  23404. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23405. { id: 'combo', text: '下拉框-combo' },
  23406. { id: 'combogrid', text: '下拉表-combogrid' },
  23407. { id: 'checkbox', text: '勾选-checkbox' },
  23408. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23409. ];
  23410. DICT_CACHE.GRID_FORMATTER = [
  23411. { id: 'N/A', text: '默认' },
  23412. { id: 'rownum', text: '序号-rownum' },
  23413. { id: 'button', text: '按钮-button' },
  23414. { id: 'checkbox', text: '勾选-checkbox' },
  23415. { id: 'progres', text: '进度条-progres' },
  23416. ];
  23417. }
  23418. //# sourceMappingURL=dict.js.map
  23419. function initDesigner () {
  23420. Ext.define('com.yvan.studio.designer', {
  23421. extend: 'Ext.panel.Panel',
  23422. alias: 'widget.designer',
  23423. xtype: 'designer',
  23424. layout: 'fit',
  23425. items: [],
  23426. constructor: function (config) {
  23427. var self = this;
  23428. var newConfig = _$2.defaultsDeep({
  23429. // 强制性属性
  23430. }, config);
  23431. this.superclass.constructor.call(self, newConfig);
  23432. },
  23433. initComponent: function () {
  23434. var me = this;
  23435. me.on({
  23436. afterrender: function () {
  23437. }
  23438. });
  23439. this.superclass.initComponent.call(me);
  23440. }
  23441. });
  23442. }
  23443. //# sourceMappingURL=designer.js.map
  23444. var FixClass = /** @class */ (function () {
  23445. function FixClass() {
  23446. }
  23447. FixClass.prototype.fix = function (me, config) {
  23448. var _this = this;
  23449. if (isDesignMode(me, config)) {
  23450. return;
  23451. }
  23452. if (!config) {
  23453. return;
  23454. }
  23455. var fix = config.fix;
  23456. if (!fix) {
  23457. return;
  23458. }
  23459. delete config.fix;
  23460. // 这里有个 bug
  23461. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23462. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23463. var scope;
  23464. if (config.$initParent) {
  23465. // 在面板上的组件
  23466. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23467. }
  23468. else if (config.column) {
  23469. // 在列上的组件
  23470. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23471. }
  23472. if (_$2.isArray(fix)) {
  23473. _$2.each(fix, function (f) {
  23474. var fn = lookupFn(scope, f);
  23475. fn.call(_this, me, config);
  23476. });
  23477. }
  23478. else if (_$2.isString(fix)) {
  23479. var fn = lookupFn(scope, fix);
  23480. fn.call(this, me, config);
  23481. }
  23482. };
  23483. __decorate([
  23484. baseConfigProcess(),
  23485. __metadata("design:type", Function),
  23486. __metadata("design:paramtypes", [Object, Object]),
  23487. __metadata("design:returntype", void 0)
  23488. ], FixClass.prototype, "fix", null);
  23489. return FixClass;
  23490. }());
  23491. //# sourceMappingURL=fix.js.map
  23492. function init$1() {
  23493. // 引入 filters 过滤插件
  23494. Ext.require([
  23495. 'Ext.grid.filters.Filters'
  23496. ]);
  23497. // 启用 tooltip 快捷提示
  23498. Ext.QuickTips.init();
  23499. // 定义日期格式化方法
  23500. if (Ext.util && Ext.util.Format) {
  23501. Ext.apply(Ext.util.Format, {
  23502. dateFormat: 'Y-m-d'
  23503. });
  23504. }
  23505. Ext.form.field.Display.override({
  23506. cls: 'yvan-display-field',
  23507. labelAlign: 'right'
  23508. });
  23509. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23510. override: "Ext.picker.Date",
  23511. format: "Y-m-d",
  23512. });
  23513. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23514. override: "Ext.form.field.Date",
  23515. format: "Y-m-d",
  23516. });
  23517. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23518. override: "Ext.grid.PropertyColumnModel",
  23519. format: "Y-m-d",
  23520. });
  23521. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23522. override: "Ext.view.AbstractView",
  23523. loadingText: "读取中..."
  23524. });
  23525. Ext.LoadMask.prototype.msg = '请稍后...';
  23526. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23527. override: "Ext.grid.header.Container",
  23528. sortClearText: '不排序',
  23529. sortAscText: "正序",
  23530. sortDescText: "倒序",
  23531. lockText: "锁定列",
  23532. unlockText: "解除锁定",
  23533. columnsText: "字段隐藏"
  23534. });
  23535. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23536. override: "Ext.grid.filters.filter.Date",
  23537. fields: {
  23538. lt: { text: '之前' },
  23539. gt: { text: '之后' },
  23540. eq: { text: '相等' },
  23541. },
  23542. // Defaults to Ext.Date.defaultFormat
  23543. dateFormat: null
  23544. });
  23545. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23546. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23547. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23548. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23549. override: "Ext.grid.locking.Lockable",
  23550. lockText: "锁定",
  23551. unlockText: '解锁',
  23552. });
  23553. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23554. override: "Ext.grid.filters.Filters",
  23555. menuFilterText: "过滤"
  23556. });
  23557. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23558. override: "Ext.grid.filters.filter.Boolean",
  23559. yesText: "已钩选",
  23560. noText: "未勾选"
  23561. });
  23562. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23563. override: "Ext.grid.filters.filter.String",
  23564. emptyText: "输入过滤文本..."
  23565. });
  23566. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23567. override: "Ext.grid.filters.filter.Number",
  23568. emptyText: "输入数字..."
  23569. });
  23570. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23571. override: "Ext.PagingToolbar",
  23572. beforePageText: "第",
  23573. // update
  23574. afterPageText: "/ {0} 页",
  23575. // update
  23576. firstText: "第一页",
  23577. prevText: "上一页",
  23578. // update
  23579. nextText: "下一页",
  23580. lastText: "最后页",
  23581. refreshText: "刷新",
  23582. displayMsg: "总共 {2} 条",
  23583. // update
  23584. emptyMsg: '没有数据'
  23585. });
  23586. /**
  23587. * 改变事件的获取方式.
  23588. * 具体见: ext-all-debug.js:23216 addListener
  23589. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23590. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23591. */
  23592. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23593. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23594. if (typeof fn === 'string' &&
  23595. (_$2.startsWith(fn, 'scope.') ||
  23596. _$2.startsWith(fn, 'system.') ||
  23597. _$2.startsWith(fn, 'format.'))) {
  23598. scope = lookupScope(this);
  23599. if (isDesignMode(scope, undefined)) {
  23600. fn = Ext.emptyFn;
  23601. }
  23602. else {
  23603. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23604. // const vm = this.lookupViewModel()
  23605. // if (vm && vm.yvanScope) {
  23606. // scope = vm.yvanScope
  23607. // fn = scope[fn.substr('scope.'.length)]
  23608. // }
  23609. fn = lookupFn(scope, fn, this);
  23610. }
  23611. }
  23612. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23613. };
  23614. // 将 SystemLib 扩展到 window.system 下
  23615. if (!window['system']) {
  23616. window['system'] = {};
  23617. }
  23618. _$2.extend(window['system'], SystemLib);
  23619. _$2.extend(window['system'], {
  23620. showGridRowDetail: showGridRowDetail
  23621. });
  23622. Ext.apply(Ext.util.Format, {
  23623. // 百分比
  23624. percentRenderer: function (v, rd, model) {
  23625. if (!v) {
  23626. v = 0;
  23627. }
  23628. if (typeof v === 'string') {
  23629. v = parseInt(v);
  23630. }
  23631. var valueString = v.toFixed(2);
  23632. var valueFixed = v > 100 ? 100 : v;
  23633. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23634. var cls = '';
  23635. if (v < 90) {
  23636. cls = 'danger';
  23637. }
  23638. else if (v < 100) {
  23639. cls = 'warning';
  23640. }
  23641. else {
  23642. cls = 'success';
  23643. }
  23644. return Ext.String
  23645. .format(
  23646. // '<div>'
  23647. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23648. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23649. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23650. // + '</div></div>', valueString, valueFixed, cls);
  23651. '<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(
  23652. // '<div>'
  23653. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23654. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23655. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23656. // + '</div></div>', v, valueFixed, valueString);
  23657. },
  23658. //button
  23659. button: function (v, rd, model) {
  23660. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23661. }
  23662. });
  23663. initComponent();
  23664. initPanel();
  23665. initGridColumn();
  23666. initTree();
  23667. initGrid();
  23668. initMainTab();
  23669. initTextfield();
  23670. initCombo();
  23671. initTag();
  23672. initContainer();
  23673. initRows();
  23674. initCols();
  23675. initForm();
  23676. initToolbar();
  23677. initSplitter();
  23678. initButton();
  23679. initStores();
  23680. initSearch();
  23681. initMultipleSearch();
  23682. initDate();
  23683. initDateTimePicker();
  23684. initDateTime();
  23685. initNumber();
  23686. initCheckbox();
  23687. initCheckboxGroup();
  23688. initRadio();
  23689. initRadioGroup();
  23690. initFieldset();
  23691. initCombotree();
  23692. initPickerPlus();
  23693. initCombogrid();
  23694. initComboGridMulti();
  23695. initIframe();
  23696. initBpmn();
  23697. initSqlEditor();
  23698. initJsonEditor();
  23699. initJsEditor();
  23700. initClipboard();
  23701. initSqlComplex();
  23702. initParamComplex();
  23703. initDict();
  23704. initDesigner();
  23705. }
  23706. //# sourceMappingURL=init.js.map
  23707. /**
  23708. * 创建一个 Ajax 客户端
  23709. */
  23710. function createAjax(createOption) {
  23711. if (createOption.baseUrl) {
  23712. axios__default.defaults.baseURL = createOption.baseUrl;
  23713. axios__default.defaults.timeout = createOption.timeout;
  23714. storeAjax.timeout = createOption.timeout;
  23715. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23716. }
  23717. return function (option) {
  23718. //@ts-ignore
  23719. option.method = (option.method || 'get').toLocaleLowerCase();
  23720. //@ts-ignore
  23721. var ax = __assign({}, option);
  23722. switch (option.method) {
  23723. case 'get':
  23724. ax.method = 'GET';
  23725. ax.params = option.param;
  23726. ax.headers = __assign({}, option.headers);
  23727. break;
  23728. case 'post':
  23729. ax.method = 'POST';
  23730. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23731. ax.params = option.param;
  23732. ax.data = Qs.stringify(option.data);
  23733. break;
  23734. case 'put':
  23735. case 'patch':
  23736. case 'delete':
  23737. ax.method = option.method;
  23738. ax.headers = option.headers;
  23739. ax.params = option.param;
  23740. ax.data = Qs.stringify(option.data);
  23741. break;
  23742. case 'download':
  23743. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23744. return new Promise(function (resolver, reject) {
  23745. });
  23746. case "invoke":
  23747. ax.url = serverInvokeUrlTransform(option.url, option);
  23748. ax.method = 'POST';
  23749. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23750. if (typeof option.args === 'object') {
  23751. ax.data = JSON.stringify({
  23752. args: option.args,
  23753. });
  23754. }
  23755. else {
  23756. ax.data = JSON.stringify({
  23757. args: [
  23758. __assign(__assign({}, option.data), option.param)
  23759. ],
  23760. filterModel: option.filterModel,
  23761. sortModel: option.sortModel
  23762. });
  23763. }
  23764. break;
  23765. case 'post-json':
  23766. ax.method = 'POST';
  23767. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23768. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23769. break;
  23770. case 'post-file':
  23771. //TODO 刘壮. 上传文件
  23772. var forms = new FormData();
  23773. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23774. _$2.forOwn(option.data, function (value, key) {
  23775. if (key === 'files') {
  23776. var i_1 = 0;
  23777. _$2.each(value, function (f) {
  23778. // @ts-ignore
  23779. forms.append('file' + (++i_1), f);
  23780. });
  23781. }
  23782. else {
  23783. forms.append(key, value);
  23784. }
  23785. });
  23786. ax.data = forms;
  23787. ax.method = 'POST';
  23788. break;
  23789. case "sql":
  23790. ax.url = sqlUrlTransform(option.url);
  23791. ax.method = 'POST';
  23792. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23793. ax.data = JSON.stringify({
  23794. args: [option.data],
  23795. db: option.db,
  23796. filterModel: option.filterModel,
  23797. sortModel: option.sortModel
  23798. });
  23799. break;
  23800. default:
  23801. throw new Error('not implements');
  23802. }
  23803. return new Promise(function (resolver, reject) {
  23804. axios__default(ax).then(function (resolverRaw) {
  23805. var apiResult = {
  23806. rawData: resolverRaw.data,
  23807. status: resolverRaw.status,
  23808. success: (resolverRaw.data && resolverRaw.data.success),
  23809. data: resolverRaw.data.data,
  23810. pagination: resolverRaw.data.pagination,
  23811. msg: (resolverRaw.data.msg),
  23812. errors: resolverRaw.data.errors,
  23813. headers: resolverRaw.headers
  23814. };
  23815. resolver(apiResult);
  23816. }).catch(function (reason) {
  23817. reject(reason);
  23818. });
  23819. });
  23820. };
  23821. }
  23822. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23823. if (isJson === void 0) { isJson = false; }
  23824. var YvanUI = _$2.get(window, 'YvanUI');
  23825. YvanUI.loading();
  23826. var createObjectURL = function (object) {
  23827. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23828. };
  23829. // const formData = new FormData();
  23830. // _.forOwn(data, (v, k) => {
  23831. // formData.append(k, v);
  23832. // });
  23833. var formData = '';
  23834. var xhr = new XMLHttpRequest();
  23835. xhr.open('POST', downLoadUrl);
  23836. xhr.responseType = 'blob';
  23837. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23838. if (isJson) {
  23839. formData = data ? JSON.stringify(data) : '';
  23840. xhr.setRequestHeader('Content-Type', 'application/json');
  23841. }
  23842. else {
  23843. formData = data ? Qs.stringify(data) : '';
  23844. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23845. }
  23846. //
  23847. if (header) {
  23848. _$2.forOwn(header, function (v, k) {
  23849. xhr.setRequestHeader(k, v);
  23850. });
  23851. }
  23852. xhr.onload = function (e) {
  23853. if (this.status === 200) {
  23854. var blob = this.response;
  23855. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23856. navigator.msSaveBlob(blob, filename);
  23857. YvanUI.clearLoading();
  23858. }
  23859. else {
  23860. var a = document.createElement('a');
  23861. var url = createObjectURL(blob);
  23862. a.href = url;
  23863. a.download = filename;
  23864. document.append(a);
  23865. a.click();
  23866. a.remove();
  23867. window.URL.revokeObjectURL(url);
  23868. YvanUI.clearLoading();
  23869. }
  23870. }
  23871. };
  23872. xhr.send(formData);
  23873. }
  23874. //# sourceMappingURL=ajax.js.map
  23875. function readExcel(file) {
  23876. return new Promise(function (resolve, reject) {
  23877. if (!file) {
  23878. reject("文件读取失败!!!");
  23879. return;
  23880. }
  23881. var reader = new FileReader();
  23882. reader.onload = function (e) {
  23883. if (e.target) {
  23884. var data = e.target.result;
  23885. var workbook = XLSX.read(data, { type: 'binary' });
  23886. resolve(workbook);
  23887. }
  23888. else {
  23889. reject("文件读取失败!!!");
  23890. }
  23891. };
  23892. try {
  23893. reader.readAsBinaryString(file);
  23894. }
  23895. catch (e) {
  23896. reject(e);
  23897. }
  23898. });
  23899. }
  23900. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  23901. if (dataStartRow === void 0) { dataStartRow = 2; }
  23902. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  23903. if (rowValidate === void 0) { rowValidate = undefined; }
  23904. if (otherValidate === void 0) { otherValidate = undefined; }
  23905. if (fieldValidate === void 0) { fieldValidate = undefined; }
  23906. return new Promise(function (resolve, reject) {
  23907. var promiseArr = [];
  23908. for (var i = 0; i < columnsSet.length; i++) {
  23909. var fix = columnsSet[i].fix;
  23910. if (_$2.isArray(fix) && fix.length > 0) {
  23911. var ss = fix[0].toLowerCase();
  23912. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  23913. columnsSet[i].importFormatter = function (vdata) {
  23914. // @ts-ignore
  23915. return window.moment(vdata.ov) - 0;
  23916. };
  23917. }
  23918. else {
  23919. var fn = lookupFn(topScope, fix[0]);
  23920. promiseArr.push(fn(null, columnsSet[i]));
  23921. delete columnsSet[i].fix;
  23922. }
  23923. }
  23924. else if (_$2.isString(fix)) {
  23925. var ss = fix.toLowerCase();
  23926. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  23927. columnsSet[i].importFormatter = function (vdata) {
  23928. // @ts-ignore
  23929. return window.moment(vdata.ov) - 0;
  23930. };
  23931. }
  23932. else {
  23933. var fn = lookupFn(topScope, fix);
  23934. promiseArr.push(fn(null, columnsSet[i]));
  23935. delete columnsSet[i].fix;
  23936. }
  23937. }
  23938. }
  23939. var read = function () {
  23940. readExcel(file).then(function (workbook) {
  23941. var sheetNames = workbook.SheetNames; // 工作表名称集合
  23942. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  23943. var titleRowValue = [];
  23944. var titleRowKey = [];
  23945. var needLoop = false; // 是否需要迭代
  23946. var columns = [];
  23947. if (worksheet && worksheet["!ref"]) {
  23948. var t = worksheet["!ref"];
  23949. var tempArr = t.split(':');
  23950. if (tempArr.length >= 2) {
  23951. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  23952. // 选取title的行,删除之前的行
  23953. if (titleRowNumber > firstRowNumber) {
  23954. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  23955. for (var key in worksheet) {
  23956. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  23957. delete worksheet[key];
  23958. }
  23959. }
  23960. }
  23961. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  23962. firstRowNumber = titleRowNumber + '';
  23963. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  23964. }
  23965. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  23966. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  23967. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  23968. for (var key in worksheet) {
  23969. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  23970. titleRowKey.push(key);
  23971. titleRowValue.push(worksheet[key].v);
  23972. }
  23973. }
  23974. if (columnsSet && columnsSet.length > 0) {
  23975. var length = columnsSet.length;
  23976. length = length <= titleRowKey.length ? length : titleRowKey.length;
  23977. for (var i = 0; i < length; i++) {
  23978. var vk = titleRowKey[i];
  23979. var item = columnsSet[i];
  23980. var column = {};
  23981. if (typeof item === 'string') {
  23982. column.dataIndex = item;
  23983. column.header = worksheet[vk].v;
  23984. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  23985. }
  23986. else if (typeof item.dataIndex === "string") {
  23987. column.dataIndex = item.dataIndex;
  23988. column.header = worksheet[vk].v;
  23989. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  23990. if (typeof item.validate === "function") {
  23991. column.validate = item.validate;
  23992. needLoop = true;
  23993. }
  23994. if (typeof item.importFormatter === "function") {
  23995. column.importFormatter = item.importFormatter;
  23996. needLoop = true;
  23997. }
  23998. if ((item.data instanceof Array && item.data.length > 0)
  23999. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24000. column.data = item.data;
  24001. needLoop = true;
  24002. }
  24003. }
  24004. columns.push(column);
  24005. }
  24006. }
  24007. }
  24008. }
  24009. if (fieldValidate && typeof fieldValidate === "function") {
  24010. if (fieldValidate(columns, titleRowValue) !== true) {
  24011. reject("fields validate error");
  24012. return;
  24013. }
  24014. }
  24015. var allData = XLSX.utils.sheet_to_json(worksheet);
  24016. var okData = [], errorData = [], errorMsgData = [];
  24017. var needItemLoop = needLoop;
  24018. if (rowValidate && typeof rowValidate === "function") {
  24019. needLoop = true;
  24020. }
  24021. if (needLoop === true) {
  24022. for (var index = 0; index < allData.length; index++) {
  24023. var row = allData[index];
  24024. var rowNumber = dataStartRow + index;
  24025. row.__importID__ = rowNumber;
  24026. var isRowOk = true;
  24027. if (needItemLoop) {
  24028. var _loop_1 = function (num) {
  24029. var column = columns[num];
  24030. var ov = row[column.dataIndex];
  24031. var nv = ov;
  24032. var hasError = false;
  24033. var rowNumber_1 = dataStartRow + index;
  24034. var ei = {
  24035. errorId: rowNumber_1 + '_' + column.dataIndex,
  24036. importID: rowNumber_1,
  24037. dataIndex: column.dataIndex,
  24038. header: column.header,
  24039. value: ov,
  24040. errormessage: ""
  24041. };
  24042. // 格式化
  24043. if (column.data instanceof Array) {
  24044. nv = undefined;
  24045. ei.errormessage = "字典匹配失败";
  24046. _$2.forEach(column.data, function (v, index) {
  24047. if (v.text === ov) {
  24048. nv = v.id;
  24049. return;
  24050. }
  24051. });
  24052. }
  24053. else if (_$2.isPlainObject(column.data)) {
  24054. nv = undefined;
  24055. ei.errormessage = "字典匹配失败";
  24056. _$2.forEach(column.data, function (value, key) {
  24057. if (value === ov) {
  24058. nv = key;
  24059. return;
  24060. }
  24061. });
  24062. }
  24063. if (typeof column.importFormatter === 'function') {
  24064. var vdata = {
  24065. column: column,
  24066. ov: ov,
  24067. nv: nv,
  24068. rowIndex: index,
  24069. data: row,
  24070. rowDatas: allData
  24071. };
  24072. nv = undefined;
  24073. ei.errormessage = "格式化失败";
  24074. nv = column.importFormatter(vdata);
  24075. }
  24076. if (!nv && nv != 0) {
  24077. hasError = true;
  24078. }
  24079. else {
  24080. row[column.dataIndex] = nv;
  24081. ei.errormessage = "";
  24082. }
  24083. // 校验
  24084. if (typeof column.validate === 'function') {
  24085. var vdata = {
  24086. column: column,
  24087. ov: ov,
  24088. nv: nv,
  24089. rowIndex: index,
  24090. data: row,
  24091. rowDatas: allData
  24092. };
  24093. var errormessage = column.validate(vdata);
  24094. if (errormessage === true) ;
  24095. else {
  24096. hasError = true;
  24097. ei.errormessage = ei.errormessage + "/" + errormessage;
  24098. }
  24099. }
  24100. if (hasError === true) {
  24101. isRowOk = false;
  24102. errorMsgData.push(ei);
  24103. }
  24104. };
  24105. for (var num = 0; num < columns.length; num++) {
  24106. _loop_1(num);
  24107. }
  24108. }
  24109. if (rowValidate && typeof rowValidate === "function") {
  24110. var errormessage = rowValidate({
  24111. columns: columns,
  24112. data: row,
  24113. rowIndex: index,
  24114. rowDatas: allData
  24115. });
  24116. if (errormessage === true) ;
  24117. else {
  24118. isRowOk = false;
  24119. var ei = {
  24120. errorId: rowNumber + '',
  24121. dataIndex: "row",
  24122. header: "数据行",
  24123. value: "当前行的数据",
  24124. importID: rowNumber,
  24125. errormessage: errormessage
  24126. };
  24127. errorMsgData.push(ei);
  24128. }
  24129. }
  24130. row.__hasError__ = !isRowOk;
  24131. if (isRowOk === true) {
  24132. okData.push(row);
  24133. }
  24134. else {
  24135. errorData.push(row);
  24136. }
  24137. }
  24138. }
  24139. else {
  24140. // 添加数据的唯一标识
  24141. for (var index = 0; index < allData.length; index++) {
  24142. var row = allData[index];
  24143. var rowNumber = dataStartRow + index;
  24144. row.__importID__ = rowNumber;
  24145. row.__hasError__ = false;
  24146. }
  24147. okData = allData;
  24148. }
  24149. if (otherValidate && typeof otherValidate === "function") {
  24150. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24151. }
  24152. else {
  24153. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24154. }
  24155. // clearLoading()
  24156. }).catch(function (e) {
  24157. reject(e);
  24158. });
  24159. };
  24160. if (promiseArr.length > 0) {
  24161. Promise.all(promiseArr).then(function (resArr) {
  24162. for (var i = 0; i < resArr.length; i++) {
  24163. var tmp = resArr[i];
  24164. tmp.config.data = [];
  24165. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24166. if (tmp.r.field.length > 1) {
  24167. var keyKey = tmp.r.field[0];
  24168. var valueKey = tmp.r.field[1];
  24169. for (var j = 0; j < tmp.r.data.length; j++) {
  24170. var it = tmp.r.data[j];
  24171. var newIt = {};
  24172. newIt.id = it[keyKey];
  24173. newIt.text = it[valueKey];
  24174. tmp.config.data.push(newIt);
  24175. }
  24176. }
  24177. }
  24178. }
  24179. read();
  24180. });
  24181. }
  24182. else {
  24183. setTimeout(read, 50);
  24184. }
  24185. });
  24186. }
  24187. //# sourceMappingURL=xlsx.js.map
  24188. var ExcelImportDialog = /** @class */ (function (_super) {
  24189. __extends(ExcelImportDialog, _super);
  24190. function ExcelImportDialog(option) {
  24191. var _this = this;
  24192. var vjson = vjsonFunc(option);
  24193. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24194. _this.importExcelOption = option;
  24195. return _this;
  24196. }
  24197. ExcelImportDialog.prototype.onLoad = function () {
  24198. _super.prototype.onLoad.call(this);
  24199. };
  24200. ExcelImportDialog.prototype.fileChange = function (sender) {
  24201. var _this = this;
  24202. var file = sender.fileInputEl.dom.files[0];
  24203. // const senderScope = lookupScope(sender)
  24204. var topScope = this.topScope;
  24205. var rowValidate = this.importExcelOption.rowValidate;
  24206. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24207. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24208. }
  24209. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24210. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24211. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24212. }
  24213. var fieldValidate = this.importExcelOption.fieldValidate;
  24214. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24215. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24216. }
  24217. this.setLoading(true);
  24218. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24219. _this.importData = res;
  24220. _this.refs.dataGrid.setData(res.allData);
  24221. _this.viewModel.set("dataCount", res.allData.length);
  24222. _this.refs.errGrid.setData(res.errorMsgData);
  24223. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24224. }).catch(function (e) {
  24225. _this.importData = null;
  24226. _this.refs.dataGrid.setData();
  24227. _this.refs.errGrid.setData();
  24228. msg(e.toString());
  24229. }).finally(function () {
  24230. _this.setLoading(false);
  24231. });
  24232. };
  24233. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24234. if (record.get('__hasError__')) {
  24235. return "x-grid-record-bg-red";
  24236. }
  24237. };
  24238. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24239. return "x-grid-record-bg-red";
  24240. };
  24241. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24242. var _a;
  24243. var id = record.data.__importID__;
  24244. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24245. var selectRecord = null;
  24246. var dataIndex = -1;
  24247. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24248. for (var i = 0; i < rows.length; i++) {
  24249. if (rows[i].importID === id) {
  24250. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24251. dataIndex = i;
  24252. }
  24253. if (rows[i].errorId === id + "_" + subId) {
  24254. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24255. dataIndex = i;
  24256. break;
  24257. }
  24258. }
  24259. if (selectRecord) {
  24260. this.refs.errGrid.ensureVisible(selectRecord);
  24261. this.refs.errGrid.selModel.select(dataIndex);
  24262. // this.refs.errGrid.reload()
  24263. }
  24264. };
  24265. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24266. var _a;
  24267. var id = record.data.importID;
  24268. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24269. var selectRecord = null;
  24270. var dataIndex = -1;
  24271. for (var i = 0; i < rows.length; i++) {
  24272. if (rows[i].__importID__ === id) {
  24273. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24274. dataIndex = i;
  24275. break;
  24276. }
  24277. }
  24278. if (selectRecord) {
  24279. this.refs.dataGrid.ensureVisible(selectRecord);
  24280. this.refs.dataGrid.selModel.select(dataIndex);
  24281. // this.refs.dataGrid.reload()
  24282. }
  24283. };
  24284. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24285. this.viewModel.set("dataType", newValue);
  24286. if (this.importData) {
  24287. this.refs.dataGrid.setData(this.importData[newValue]);
  24288. this.viewModel.set("dataCount", this.importData[newValue].length);
  24289. }
  24290. };
  24291. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24292. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24293. window.location.href = this.importExcelOption.dowLoadUrl;
  24294. return;
  24295. }
  24296. var xt = [];
  24297. _$2.forEach(this.importExcelOption.columns, function (v) {
  24298. xt.push(v.header);
  24299. });
  24300. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24301. if (filename.endsWith(".xlsx")) {
  24302. filename = filename.split(".xlsx")[0];
  24303. }
  24304. filename = filename + ".xlsx";
  24305. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24306. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24307. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24308. XLSX.writeFile(wb, filename); //导出Excel
  24309. };
  24310. ExcelImportDialog.prototype.getData = function (sender) {
  24311. _$2.each(this.importData.okData, function (item) {
  24312. delete item.id;
  24313. delete item.__hasError__;
  24314. delete item.__importID__;
  24315. delete item._origin;
  24316. });
  24317. _$2.each(this.importData.allData, function (item) {
  24318. delete item.id;
  24319. delete item.__hasError__;
  24320. delete item.__importID__;
  24321. delete item._origin;
  24322. });
  24323. _$2.each(this.importData.errorData, function (item) {
  24324. delete item.id;
  24325. delete item.__hasError__;
  24326. delete item.__importID__;
  24327. delete item._origin;
  24328. });
  24329. this.dialogSuccess(this.importData);
  24330. };
  24331. return ExcelImportDialog;
  24332. }(Scope));
  24333. var model$d = {
  24334. data: {
  24335. dataType: "all",
  24336. errMsgCount: 0,
  24337. dataCount: 0
  24338. }
  24339. };
  24340. var vjsonFunc = function (option) {
  24341. return {
  24342. title: option.title || 'excel导入',
  24343. layout: 'fit',
  24344. items: [
  24345. {
  24346. layout: 'border',
  24347. tbar: {
  24348. xtype: "form",
  24349. items: [
  24350. {
  24351. xtype: "cols",
  24352. items: [
  24353. {
  24354. xtype: "filefield",
  24355. fieldLabel: 'excel文件',
  24356. buttonText: '请选择excel文件',
  24357. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24358. flex: 3,
  24359. listeners: {
  24360. change: "scope.fileChange"
  24361. }
  24362. }, {
  24363. xtype: "button",
  24364. iconCls: "x-fa fa-download",
  24365. text: "下载模版",
  24366. listeners: {
  24367. click: "scope.downloadTemplate"
  24368. }
  24369. }, {
  24370. xtype: 'container',
  24371. border: false,
  24372. layout: 'hbox',
  24373. }, {
  24374. xtype: "button",
  24375. iconCls: "x-fa fa-upload",
  24376. text: option.tQButtonText || "提取数据",
  24377. listeners: {
  24378. click: "scope.getData"
  24379. }
  24380. }
  24381. ]
  24382. },
  24383. ]
  24384. },
  24385. items: [
  24386. {
  24387. tbar: {
  24388. xtype: "toolbar",
  24389. title: "导入的数据",
  24390. items: [{
  24391. xtype: 'label',
  24392. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24393. }, {
  24394. xtype: 'radiogroup',
  24395. items: [
  24396. {
  24397. boxLabel: '所有数据',
  24398. checked: true,
  24399. inputValue: 'allData',
  24400. }, {
  24401. boxLabel: '正确数据',
  24402. inputValue: 'okData',
  24403. }, {
  24404. boxLabel: '错误数据',
  24405. inputValue: 'errorData',
  24406. }
  24407. ],
  24408. listeners: {
  24409. change: 'scope.filterData',
  24410. },
  24411. }, {
  24412. xtype: "textfield",
  24413. readOnly: true,
  24414. fieldLabel: "条目数",
  24415. bind: "{dataCount}"
  24416. }]
  24417. },
  24418. xtype: 'yvgrid',
  24419. reference: 'dataGrid',
  24420. layout: 'fit',
  24421. pagination: false,
  24422. // pageSize: 50,
  24423. getRowClass: 'scope.getDataGridRowRecord',
  24424. columns: option.columns,
  24425. region: 'center',
  24426. split: true,
  24427. listeners: {
  24428. cellclick: "scope.dataGridClick",
  24429. },
  24430. selModel: {
  24431. // type: 'rowmodel',
  24432. mode: 'SINGLE',
  24433. },
  24434. }, {
  24435. tbar: {
  24436. xtype: "toolbar", items: [
  24437. {
  24438. xtype: 'label',
  24439. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24440. }, {
  24441. xtype: "textfield",
  24442. readOnly: true,
  24443. fieldLabel: "条目数",
  24444. bind: "{errMsgCount}"
  24445. }
  24446. ]
  24447. },
  24448. xtype: 'yvgrid',
  24449. reference: 'errGrid',
  24450. layout: 'fit',
  24451. pagination: false,
  24452. getRowClass: 'scope.getErrGridRowRecord',
  24453. height: "40%",
  24454. columns: [
  24455. { dataIndex: "errorId", header: "ID", hidden: true },
  24456. { dataIndex: "importID", header: "行号", width: 80 },
  24457. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24458. { dataIndex: "value", header: "值", width: 120 },
  24459. { dataIndex: "header", header: "字段名", width: 120 },
  24460. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24461. ],
  24462. region: 'south',
  24463. split: true,
  24464. listeners: {
  24465. itemclick: "scope.errGridClick"
  24466. },
  24467. selModel: {
  24468. // type: 'rowmodel',
  24469. mode: 'SINGLE',
  24470. },
  24471. },
  24472. ],
  24473. },
  24474. ],
  24475. referenceHolder: true,
  24476. };
  24477. };
  24478. //# sourceMappingURL=ExcelImportDialog.js.map
  24479. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24480. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24481. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24482. ret.report_id = reportId;
  24483. ret.report = report;
  24484. return ret;
  24485. }
  24486. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24487. var e_1, _a, e_2, _b;
  24488. var model = {
  24489. data: {
  24490. report_name: config.report_name,
  24491. query: {},
  24492. sum: {},
  24493. }
  24494. };
  24495. var json5 = window['YvanUI'].json5;
  24496. var report = config.report ? json5.parse(config.report) : {};
  24497. var conditionRows = [];
  24498. var sumRows = [];
  24499. model.data.has_sum = _$2.size(report.summary) > 0;
  24500. // query 查询条件
  24501. var newRow = false;
  24502. var currentRow = { xtype: 'cols', items: [], };
  24503. conditionRows.push(currentRow);
  24504. _$2.forEach(report.query, function (item) {
  24505. if (newRow) {
  24506. currentRow = { xtype: 'cols', items: [], };
  24507. conditionRows.push(currentRow);
  24508. }
  24509. var vj = json5.parse(item.conditionFieldExtend);
  24510. if (item.conditionFieldXtype) {
  24511. vj.xtype = item.conditionFieldXtype;
  24512. if (item.conditionFieldXtype === 'combo') {
  24513. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24514. }
  24515. if (item.conditionFieldXtype === 'datetimefield') {
  24516. //@ts-ignore
  24517. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24518. }
  24519. else if (item.conditionFieldXtype === 'datefield') {
  24520. //@ts-ignore
  24521. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24522. }
  24523. else {
  24524. model.data.query[item.conditionFieldBind] = '';
  24525. }
  24526. }
  24527. else {
  24528. // 没有组件类型,是个空占位符
  24529. vj.border = false;
  24530. }
  24531. if (item.conditionFieldBind) {
  24532. vj.bind = {
  24533. value: '{query.' + item.conditionFieldBind + '}'
  24534. };
  24535. }
  24536. if (item.conditionFieldFlex) {
  24537. vj.flex = item.conditionFieldFlex;
  24538. }
  24539. if (item.conditionFieldXtype) {
  24540. vj.fieldLabel = item.conditionFieldLabel;
  24541. }
  24542. if (item.fieldLabel) {
  24543. vj.fieldLabel = item.fieldLabel;
  24544. }
  24545. newRow = item.conditionFieldWrap || false;
  24546. currentRow.items.push(vj);
  24547. });
  24548. if (currentRow) {
  24549. currentRow.margin = '10 0 10 0';
  24550. }
  24551. // sum 汇总条件
  24552. newRow = true;
  24553. try {
  24554. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24555. var item = _d.value;
  24556. if (newRow) {
  24557. currentRow = {
  24558. xtype: 'cols',
  24559. defaultType: 'displayfield',
  24560. defaults: {
  24561. labelWidth: 70,
  24562. },
  24563. items: []
  24564. };
  24565. sumRows.push(currentRow);
  24566. }
  24567. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24568. if (item.sumFieldBind) {
  24569. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24570. model.data.sum[item.sumFieldBind] = '';
  24571. }
  24572. else {
  24573. // 没有组件类型,是个空占位符
  24574. vj.border = false;
  24575. }
  24576. if (item.sumFieldFlex) {
  24577. vj.flex = item.sumFieldFlex;
  24578. }
  24579. if (item.sumFieldLabel) {
  24580. vj.fieldLabel = item.sumFieldLabel;
  24581. }
  24582. // sumFieldBind: "zs"
  24583. // sumFieldExtend: "{}"
  24584. // sumFieldFlex: 1
  24585. // sumFieldLabel: "总数"
  24586. // sumFieldWrap: false
  24587. newRow = item.sumFieldWrap || false;
  24588. currentRow.items.push(vj);
  24589. }
  24590. }
  24591. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24592. finally {
  24593. try {
  24594. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24595. }
  24596. finally { if (e_1) throw e_1.error; }
  24597. }
  24598. if (currentRow) {
  24599. currentRow.margin = '10 0 10 0';
  24600. }
  24601. // column 结果字段
  24602. var columns = [];
  24603. try {
  24604. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24605. var item = _f.value;
  24606. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24607. if (item.xtype) {
  24608. if (item.xtype == 'checkbox') {
  24609. vj.xtype = 'checkcolumn';
  24610. vj.disabled = true;
  24611. }
  24612. else {
  24613. vj.xtype = item.xtype;
  24614. }
  24615. }
  24616. if (item.dataType) {
  24617. vj.dataType = item.dataType;
  24618. }
  24619. if (item.align) {
  24620. vj.align = item.align;
  24621. }
  24622. if (item.width) {
  24623. vj.width = item.width;
  24624. }
  24625. if (item.dict) {
  24626. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24627. }
  24628. columns.push(vj);
  24629. }
  24630. }
  24631. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24632. finally {
  24633. try {
  24634. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24635. }
  24636. finally { if (e_2) throw e_2.error; }
  24637. }
  24638. var vjson = {
  24639. bind: {
  24640. title: '{report_name}',
  24641. },
  24642. layout: 'fit',
  24643. referenceHolder: true,
  24644. items: [
  24645. {
  24646. layout: 'border',
  24647. border: false,
  24648. items: [
  24649. {
  24650. region: 'north',
  24651. border: false,
  24652. tbar: {
  24653. xtype: 'toolbar',
  24654. border: false,
  24655. items: [
  24656. {
  24657. xtype: 'button',
  24658. text: '查询',
  24659. reference: 'btnSearch',
  24660. iconCls: 'x-fa fa-search',
  24661. listeners: {
  24662. click: 'scope.reload',
  24663. },
  24664. },
  24665. {
  24666. xtype: 'button',
  24667. text: '关闭',
  24668. iconCls: 'x-fa fa-times',
  24669. listeners: {
  24670. click: 'system.closeMe()',
  24671. },
  24672. },
  24673. ],
  24674. },
  24675. defaults: {
  24676. margin: '8 0 0 0'
  24677. },
  24678. items: __spread(conditionRows, sumRows),
  24679. fix: ['system.enterToClick("btnSearch")'],
  24680. },
  24681. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24682. method: 'invoke',
  24683. url: '/report/Report@execute',
  24684. params: {
  24685. dataSource: report.dataSource,
  24686. pagination: report.grid.pagination || true,
  24687. report_id: config.report_id,
  24688. query: '{query}',
  24689. },
  24690. }, columns: columns }, report.grid),
  24691. ],
  24692. },
  24693. ],
  24694. };
  24695. return { model: model, vjson: vjson, report: report };
  24696. }
  24697. var ReportScope = /** @class */ (function (_super) {
  24698. __extends(ReportScope, _super);
  24699. function ReportScope(_a, invokeServerFn) {
  24700. var model = _a.model, vjson = _a.vjson;
  24701. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  24702. _this.invokeServerFn = invokeServerFn;
  24703. return _this;
  24704. }
  24705. ReportScope.prototype.onLoad = function () {
  24706. // this.reload()
  24707. };
  24708. ReportScope.prototype.reload = function () {
  24709. var _this = this;
  24710. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24711. if (this.viewModel.get('has_sum')) {
  24712. this.invokeServerFn('/report/Report@executeSum', {
  24713. dataSource: this.report.dataSource,
  24714. report_id: this.report_id,
  24715. query: this.viewModel.get('query'),
  24716. }).then(function (res) {
  24717. if (!res.success) {
  24718. showErrorDialog$1(res.msg);
  24719. }
  24720. else {
  24721. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24722. }
  24723. });
  24724. }
  24725. this.refs.grid1.reload();
  24726. };
  24727. return ReportScope;
  24728. }(Scope));
  24729. //# sourceMappingURL=Report.js.map
  24730. var model$e = {
  24731. data: {
  24732. form: {
  24733. resource_parent: '',
  24734. resource_name: '',
  24735. resource_icon: '',
  24736. scope_url: '',
  24737. scope_params: '',
  24738. resource_order: '',
  24739. permission_code: '',
  24740. },
  24741. }
  24742. };
  24743. //# sourceMappingURL=RegisterModule.model.js.map
  24744. var vjson$d = {
  24745. title: '注册模块',
  24746. layout: 'fit',
  24747. width: "40%",
  24748. height: "50%",
  24749. fbar: {
  24750. xtype: 'toolbar',
  24751. items: [
  24752. {
  24753. xtype: "button",
  24754. text: "确定",
  24755. iconCls: 'x-fa fa-check',
  24756. listeners: {
  24757. click: 'scope.saveNode',
  24758. }
  24759. },
  24760. {
  24761. xtype: "button",
  24762. text: "关闭",
  24763. iconCls: 'x-fa fa-times',
  24764. listeners: {
  24765. click: 'system.closeMe()',
  24766. }
  24767. },
  24768. ]
  24769. },
  24770. items: [
  24771. {
  24772. layout: 'border',
  24773. items: [
  24774. {
  24775. region: 'west',
  24776. layout: 'fit',
  24777. xtype: 'tabpanel',
  24778. reference: 'tabs',
  24779. width: "50%",
  24780. split: true,
  24781. listeners: {
  24782. tabchange: 'scope.tabchange',
  24783. },
  24784. items: [
  24785. {
  24786. region: 'center',
  24787. layout: 'fit',
  24788. title: 'PC菜单',
  24789. key: "1",
  24790. items: [
  24791. {
  24792. xtype: 'treepanel',
  24793. layout: 'fit',
  24794. region: 'west',
  24795. rootVisible: false,
  24796. useArrows: true,
  24797. reference: 'tree1',
  24798. listeners: {
  24799. itemclick: "scope.tree1NodeClick",
  24800. }
  24801. },
  24802. ]
  24803. },
  24804. {
  24805. region: 'center',
  24806. layout: 'fit',
  24807. title: 'PDA菜单',
  24808. key: "2",
  24809. items: [
  24810. {
  24811. xtype: 'treepanel',
  24812. layout: 'fit',
  24813. region: 'west',
  24814. reference: 'tree2',
  24815. rootVisible: false,
  24816. useArrows: true,
  24817. listeners: {
  24818. itemclick: "scope.tree1NodeClick",
  24819. }
  24820. },
  24821. ]
  24822. },
  24823. ]
  24824. },
  24825. {
  24826. region: 'center',
  24827. xtype: 'form',
  24828. margin: '0 0 0 0',
  24829. split: true,
  24830. width: '50%',
  24831. items: [
  24832. {
  24833. xtype: 'cols',
  24834. items: [
  24835. {
  24836. xtype: 'textfield',
  24837. fieldLabel: '上级资源ID',
  24838. bind: {
  24839. readOnly: true,
  24840. disabled: true,
  24841. value: '{form.resource_parent}'
  24842. },
  24843. },
  24844. ],
  24845. },
  24846. {
  24847. xtype: 'cols',
  24848. items: [
  24849. {
  24850. xtype: 'textfield',
  24851. fieldLabel: '资源名称',
  24852. bind: {
  24853. value: '{form.resource_name}'
  24854. },
  24855. allowBlank: false,
  24856. },
  24857. ],
  24858. },
  24859. {
  24860. xtype: 'cols',
  24861. items: [
  24862. {
  24863. xtype: 'numberfield',
  24864. fieldLabel: '资源排序',
  24865. bind: {
  24866. value: '{form.resource_order}'
  24867. },
  24868. allowBlank: false,
  24869. },
  24870. ],
  24871. },
  24872. {
  24873. xtype: 'cols',
  24874. items: [
  24875. {
  24876. xtype: 'textfield',
  24877. fieldLabel: '功能URL',
  24878. bind: {
  24879. disabled: true,
  24880. value: '{form.scope_url}'
  24881. },
  24882. },
  24883. ]
  24884. },
  24885. {
  24886. xtype: 'cols',
  24887. items: [
  24888. {
  24889. xtype: 'textfield',
  24890. fieldLabel: '权限编码',
  24891. bind: {
  24892. value: '{form.permission_code}'
  24893. }
  24894. },
  24895. ],
  24896. },
  24897. {
  24898. xtype: 'cols',
  24899. items: [
  24900. {
  24901. xtype: 'textfield',
  24902. fieldLabel: '功能参数',
  24903. bind: {
  24904. value: '{form.scope_params}'
  24905. }
  24906. },
  24907. ],
  24908. },
  24909. ],
  24910. },
  24911. ],
  24912. },
  24913. ],
  24914. referenceHolder: true,
  24915. };
  24916. //# sourceMappingURL=RegisterModule.view.js.map
  24917. var RegisterModule = /** @class */ (function (_super) {
  24918. __extends(RegisterModule, _super);
  24919. function RegisterModule() {
  24920. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  24921. }
  24922. RegisterModule.prototype.onLoad = function () {
  24923. this.reloadTree("PC");
  24924. };
  24925. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  24926. var currTabKey = b.key;
  24927. if (currTabKey === '1') {
  24928. this.viewModel.set('form', '');
  24929. this.reloadTree("PC");
  24930. }
  24931. else {
  24932. this.viewModel.set('form', '');
  24933. this.reloadTree("PDA");
  24934. }
  24935. };
  24936. RegisterModule.prototype.reloadTree = function (type) {
  24937. var _this = this;
  24938. if ("PC" === type) {
  24939. this.setLoading(true);
  24940. getMenuTree({ type: "PC" }).then(function (res) {
  24941. if (res.success) {
  24942. _this.refs.tree1.store.setRootNode({
  24943. expanded: true,
  24944. children: res.data
  24945. });
  24946. }
  24947. }).finally(function () {
  24948. _this.setLoading(false);
  24949. });
  24950. }
  24951. else {
  24952. this.setLoading(true);
  24953. getMenuTree({ type: "PDA" }).then(function (res) {
  24954. if (res.success) {
  24955. _this.refs.tree2.store.setRoot({
  24956. expanded: true,
  24957. children: res.data
  24958. });
  24959. }
  24960. }).finally(function () {
  24961. _this.setLoading(false);
  24962. });
  24963. }
  24964. };
  24965. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  24966. var id = _$2.split(node.data.id, '_')[1];
  24967. if (!id) {
  24968. return;
  24969. }
  24970. this.viewModel.set('form.resource_parent', id);
  24971. };
  24972. RegisterModule.prototype.saveNode = function () {
  24973. var _this = this;
  24974. var tabKey = this.refs.tabs.activeTab.key;
  24975. // 检验菜单数据
  24976. var param = this.viewModel.get('form');
  24977. if (!param.resource_parent) {
  24978. msg$1('请选择一个父节点');
  24979. return;
  24980. }
  24981. if (!param.resource_name) {
  24982. msg$1('资源名称不能为空');
  24983. return;
  24984. }
  24985. if (!param.scope_url) {
  24986. msg$1('功能URL不能为空');
  24987. return;
  24988. }
  24989. var type;
  24990. if (tabKey === '1') {
  24991. type = 'PC';
  24992. }
  24993. else {
  24994. type = 'PDA';
  24995. }
  24996. this.setLoading(true);
  24997. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  24998. if (res.success) {
  24999. msg$1("注册成功");
  25000. _this.close();
  25001. }
  25002. }).finally(function () {
  25003. _this.setLoading(false);
  25004. });
  25005. };
  25006. return RegisterModule;
  25007. }(Scope));
  25008. //# sourceMappingURL=RegisterModule.js.map
  25009. var model$f = {
  25010. data: {
  25011. title: "模板选择",
  25012. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25013. moduleType: 1,
  25014. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25015. packagePath: "",
  25016. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25017. fileSavePath: "",
  25018. // 模块名称 "Dict"
  25019. moduleName: "NewModule",
  25020. // 页面标题 "字典维护"
  25021. pageTitle: "新模块",
  25022. // 单表查询
  25023. singleTable: {
  25024. sql: "select * from bas_dict",
  25025. // 新增或者删除所用的表
  25026. tableName: "",
  25027. // 是否分页查询
  25028. pagination: true,
  25029. // 是否需要删除
  25030. delete: true,
  25031. // 删除条件字段
  25032. deleteWhereColumn: "",
  25033. // 删除提示语
  25034. deleteTips: "确定要删除?",
  25035. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25036. editType: 2,
  25037. },
  25038. singleTableView: {
  25039. tableNameList: [
  25040. // { value: "aaa"},
  25041. ],
  25042. columnList: [
  25043. // { value: "aaa"},
  25044. ],
  25045. }
  25046. }
  25047. };
  25048. //# sourceMappingURL=CreateModule.model.js.map
  25049. var vjson$e = {
  25050. bind: {
  25051. title: '新建模块-{title}',
  25052. },
  25053. width: "55%",
  25054. height: "60%",
  25055. minWidth: 500,
  25056. minHeight: 400,
  25057. modal: true,
  25058. frame: true,
  25059. layout: 'card',
  25060. bbar: [
  25061. '->',
  25062. {
  25063. itemId: 'card-prev',
  25064. text: '&laquo; 上一步',
  25065. disabled: true,
  25066. listeners: {
  25067. click: 'scope.showPrevious',
  25068. },
  25069. },
  25070. {
  25071. itemId: 'card-next',
  25072. text: '下一步 &raquo;',
  25073. listeners: {
  25074. click: 'scope.showNext',
  25075. },
  25076. },
  25077. {
  25078. itemId: 'card-finish',
  25079. text: '立刻执行',
  25080. iconCls: 'x-fa fa-flash',
  25081. hidden: true,
  25082. listeners: {
  25083. click: 'scope.finish',
  25084. },
  25085. },
  25086. ],
  25087. items: [
  25088. {
  25089. vtitle: '模板选择',
  25090. reference: 'templateSelection',
  25091. layout: {
  25092. type: 'hbox',
  25093. pack: 'start',
  25094. align: 'stretch'
  25095. },
  25096. listeners: {
  25097. cardEnter: 'scope.templateEnter',
  25098. cardLevel: 'scope.templateLevel'
  25099. },
  25100. items: [
  25101. {
  25102. width: 150,
  25103. xtype: 'form',
  25104. border: false,
  25105. layout: {
  25106. type: 'vbox',
  25107. align: 'stretch'
  25108. },
  25109. defaults: {
  25110. border: false,
  25111. anchor: '100%',
  25112. margin: '5',
  25113. },
  25114. items: [
  25115. {
  25116. xtype: 'radiogroup',
  25117. bind: {
  25118. value: '{moduleType}'
  25119. },
  25120. layout: 'vbox',
  25121. defaults: {
  25122. border: false,
  25123. anchor: '100%',
  25124. margin: '5',
  25125. },
  25126. items: [
  25127. { boxLabel: '单表查询', inputValue: 1 },
  25128. { boxLabel: '主/明细查询', inputValue: 2 },
  25129. { boxLabel: '树/明细查询', inputValue: 3 },
  25130. { boxLabel: '卡片表单', inputValue: 4 },
  25131. { boxLabel: '主/详情查询', inputValue: 5 },
  25132. ]
  25133. },
  25134. ]
  25135. },
  25136. {
  25137. flex: 1,
  25138. region: 'center',
  25139. xtype: "panel",
  25140. border: false,
  25141. frame: true,
  25142. padding: "4px 8px",
  25143. html: "描述...",
  25144. }
  25145. ]
  25146. },
  25147. {
  25148. vtitle: '模块名称',
  25149. reference: 'moduleName',
  25150. layout: 'fit',
  25151. listeners: {
  25152. cardEnter: 'scope.moduleEnter',
  25153. cardLevel: 'scope.moduleLevel'
  25154. },
  25155. items: [
  25156. {
  25157. xtype: 'form',
  25158. border: false,
  25159. layout: {
  25160. type: 'vbox',
  25161. align: 'stretch'
  25162. },
  25163. defaults: {
  25164. border: false,
  25165. anchor: '100%',
  25166. margin: '5',
  25167. },
  25168. items: [
  25169. {
  25170. xtype: 'textfield',
  25171. fieldLabel: '包路径',
  25172. allowBlank: false,
  25173. bind: { value: '{packagePath}' },
  25174. },
  25175. {
  25176. xtype: 'textfield',
  25177. fieldLabel: '文件路径',
  25178. allowBlank: false,
  25179. bind: { value: '{fileSavePath}' },
  25180. },
  25181. {
  25182. xtype: 'textfield',
  25183. fieldLabel: '模块名',
  25184. allowBlank: false,
  25185. bind: { value: '{moduleName}' },
  25186. },
  25187. {
  25188. xtype: 'textfield',
  25189. fieldLabel: '菜单名',
  25190. allowBlank: false,
  25191. bind: { value: '{pageTitle}' },
  25192. },
  25193. ]
  25194. },
  25195. ]
  25196. },
  25197. {
  25198. vtitle: '确认结果',
  25199. reference: 'confirmResult',
  25200. layout: 'fit',
  25201. listeners: {
  25202. cardEnter: 'scope.optionEnter',
  25203. cardLevel: 'scope.optionLevel',
  25204. },
  25205. items: [
  25206. {
  25207. xtype: 'jsoneditor',
  25208. reference: 'jsoneditor'
  25209. }
  25210. ]
  25211. },
  25212. // ---------------------------------------------------------------------------------- 单表查询
  25213. {
  25214. vtitle: '查询SQL',
  25215. reference: 'singleTable_1',
  25216. layout: 'fit',
  25217. listeners: {
  25218. cardEnter: 'scope.editorEnter',
  25219. cardLevel: 'scope.editorLevel'
  25220. },
  25221. items: [
  25222. {
  25223. xtype: 'sqleditor',
  25224. }
  25225. ],
  25226. },
  25227. {
  25228. vtitle: '字段选项',
  25229. reference: 'singleTable_2',
  25230. layout: 'fit',
  25231. listeners: {
  25232. cardEnter: 'scope.columnEnter',
  25233. cardLevel: 'scope.columnLevel',
  25234. },
  25235. items: [
  25236. {
  25237. xtype: 'yvgrid',
  25238. border: false,
  25239. selModel: {
  25240. type: 'spreadsheet',
  25241. columnSelect: true,
  25242. pruneRemoved: false,
  25243. extensible: 'y'
  25244. },
  25245. plugins: {
  25246. clipboard: true,
  25247. selectionreplicator: true
  25248. },
  25249. reference: 'grid1',
  25250. idField: 'column_name',
  25251. hideFootbar: true,
  25252. tbar: {
  25253. xtype: 'toolbar',
  25254. items: [
  25255. {
  25256. xtype: 'button',
  25257. text: '添加',
  25258. iconCls: 'x-fa fa-plus-circle',
  25259. listeners: {
  25260. click: 'scope.addField'
  25261. }
  25262. },
  25263. {
  25264. xtype: 'button',
  25265. text: '删除',
  25266. iconCls: 'x-fa fa-minus-circle',
  25267. listeners: {
  25268. click: 'scope.removeField'
  25269. }
  25270. },
  25271. {
  25272. xtype: 'button',
  25273. text: '分析SQL',
  25274. iconCls: 'x-fa fa-refresh',
  25275. listeners: {
  25276. click: 'scope.parseSQL'
  25277. }
  25278. },
  25279. ]
  25280. },
  25281. columns: [
  25282. {
  25283. text: '字段名', dataIndex: 'column_name',
  25284. sortable: false,
  25285. menuDisabled: true,
  25286. width: 150,
  25287. editor: {
  25288. allowBlank: true,
  25289. selectOnFocus: false,
  25290. }
  25291. },
  25292. {
  25293. text: '字段中文', dataIndex: 'column_comment',
  25294. width: 150,
  25295. sortable: false,
  25296. menuDisabled: true,
  25297. editor: {
  25298. allowBlank: true,
  25299. selectOnFocus: false,
  25300. }
  25301. },
  25302. {
  25303. dataIndex: "column_useto",
  25304. // fix: ['system.getDict("column_useto")'],
  25305. header: "用途",
  25306. editor: {
  25307. xtype: 'combo',
  25308. allowBlank: false,
  25309. },
  25310. },
  25311. {
  25312. text: '主键', dataIndex: 'is_primary_key',
  25313. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25314. width: 48, resizable: false,
  25315. },
  25316. {
  25317. text: '必填', dataIndex: 'not_null',
  25318. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25319. width: 48, resizable: false,
  25320. },
  25321. {
  25322. text: '长度', dataIndex: 'column_size',
  25323. sortable: false, menuDisabled: true,
  25324. xtype: 'numbercolumn', format: '0',
  25325. editor: { allowBlank: true, selectOnFocus: true }
  25326. },
  25327. {
  25328. text: '字典', dataIndex: 'column_dict',
  25329. sortable: false, menuDisabled: true,
  25330. width: 200,
  25331. editor: {
  25332. allowBlank: true,
  25333. }
  25334. },
  25335. {
  25336. text: 'UI组件', dataIndex: 'column_ui',
  25337. sortable: false, menuDisabled: true,
  25338. // fix: ['system.getDict("column_ui")'],
  25339. width: 150,
  25340. editor: {
  25341. xtype: 'combo',
  25342. allowBlank: true,
  25343. }
  25344. },
  25345. {
  25346. dataIndex: 'data_type',
  25347. hidden: true,
  25348. },
  25349. ]
  25350. }
  25351. ],
  25352. },
  25353. {
  25354. vtitle: '其他选项',
  25355. reference: 'singleTable_3',
  25356. isEnd: true,
  25357. listeners: {
  25358. cardEnter: 'scope.extendEnter',
  25359. cardLevel: 'scope.extendLevel',
  25360. },
  25361. layout: 'fit',
  25362. items: [
  25363. {
  25364. xtype: 'form',
  25365. border: false,
  25366. layout: {
  25367. type: 'vbox',
  25368. align: 'stretch'
  25369. },
  25370. defaults: {
  25371. border: false,
  25372. anchor: '100%',
  25373. margin: '5',
  25374. },
  25375. items: [
  25376. {
  25377. xtype: 'checkbox',
  25378. fieldLabel: '需要分页',
  25379. labelWidth: 100,
  25380. bind: {
  25381. value: '{singleTable.pagination}',
  25382. },
  25383. },
  25384. {
  25385. xtype: 'combobox',
  25386. fieldLabel: '操作数据库表',
  25387. labelWidth: 100,
  25388. publishes: 'singleTable.tableName',
  25389. displayField: 'value',
  25390. valueField: 'value',
  25391. bind: {
  25392. data: '{singleTableView.tableNameList}',
  25393. value: '{singleTable.tableName}',
  25394. },
  25395. },
  25396. {
  25397. xtype: 'checkboxfield',
  25398. fieldLabel: '需要删除',
  25399. labelWidth: 100,
  25400. bind: {
  25401. value: '{singleTable.delete}',
  25402. },
  25403. },
  25404. {
  25405. xtype: 'combobox',
  25406. fieldLabel: '删除条件字段',
  25407. labelWidth: 100,
  25408. publishes: 'singleTable.deleteWhereColumn',
  25409. displayField: 'value',
  25410. valueField: 'value',
  25411. bind: {
  25412. data: '{singleTableView.columnList}',
  25413. hidden: '{!singleTable.delete}',
  25414. value: '{singleTable.deleteWhereColumn}',
  25415. },
  25416. },
  25417. {
  25418. xtype: 'textfield',
  25419. fieldLabel: '删除提示语句',
  25420. labelWidth: 100,
  25421. bind: {
  25422. hidden: '{!singleTable.delete}',
  25423. value: '{singleTable.deleteTips}',
  25424. },
  25425. },
  25426. {
  25427. fieldLabel: '新增与编辑',
  25428. labelWidth: 100,
  25429. xtype: 'radiogroup',
  25430. bind: {
  25431. value: '{singleTable.editType}'
  25432. },
  25433. layout: 'vbox',
  25434. defaults: {
  25435. border: false,
  25436. anchor: '100%',
  25437. margin: '5',
  25438. },
  25439. items: [
  25440. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25441. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25442. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25443. ]
  25444. },
  25445. ]
  25446. }
  25447. ]
  25448. },
  25449. // ---------------------------------------------------------------------------------- 主/明细查询
  25450. {
  25451. vtitle: '主表查询SQL',
  25452. reference: 'mainDetailTable_1',
  25453. layout: 'fit',
  25454. listeners: {},
  25455. items: [],
  25456. },
  25457. {
  25458. vtitle: '主表字段选项',
  25459. reference: 'mainDetailTable_2',
  25460. layout: 'fit',
  25461. listeners: {},
  25462. items: [],
  25463. },
  25464. {
  25465. vtitle: '主表其他选项',
  25466. reference: 'mainDetailTable_3',
  25467. layout: 'fit',
  25468. listeners: {},
  25469. items: [],
  25470. },
  25471. {
  25472. vtitle: '子表查询SQL',
  25473. reference: 'mainDetailTable_4',
  25474. layout: 'fit',
  25475. listeners: {},
  25476. items: [],
  25477. },
  25478. {
  25479. vtitle: '子表字段选项',
  25480. reference: 'mainDetailTable_5',
  25481. layout: 'fit',
  25482. listeners: {},
  25483. items: [],
  25484. },
  25485. {
  25486. vtitle: '子表其他选项',
  25487. reference: 'mainDetailTable_6',
  25488. isEnd: true,
  25489. layout: 'fit',
  25490. listeners: {},
  25491. items: [],
  25492. },
  25493. // ---------------------------------------------------------------------------------- 树/明细查询
  25494. // ---------------------------------------------------------------------------------- 卡片表单
  25495. {
  25496. vtitle: '表单字段',
  25497. reference: 'cardForm_1',
  25498. layout: 'fit',
  25499. listeners: {},
  25500. items: [],
  25501. },
  25502. {
  25503. vtitle: '表单初始化',
  25504. reference: 'cardForm_2',
  25505. isEnd: true,
  25506. layout: 'fit',
  25507. listeners: {},
  25508. items: [],
  25509. },
  25510. ]
  25511. };
  25512. //# sourceMappingURL=CreateModule.view.js.map
  25513. // noinspection TypeScriptCheckImport
  25514. function getSingleTableData(origin) {
  25515. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25516. var _a, _b, _c;
  25517. var data = {
  25518. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25519. package: _$2.replace(origin.packagePath, /\//g, "."),
  25520. groovyClass: origin.moduleName,
  25521. qClass: queryDslInfo.qClass,
  25522. qClassTable: queryDslInfo.qClassTable,
  25523. queryColumns: [],
  25524. insertColumns: [],
  25525. updateColumns: [],
  25526. updateWheres: [],
  25527. deleteWheres: [],
  25528. gridColumns: [],
  25529. sql: origin.sql,
  25530. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25531. addButton: origin.editType !== 1,
  25532. saveButton: origin.editType === 2,
  25533. deleteButton: true,
  25534. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25535. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25536. fileSavePath: origin.fileSavePath,
  25537. };
  25538. origin.columnList.forEach(function (column) {
  25539. 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;
  25540. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25541. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25542. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25543. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25544. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25545. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25546. if (query) {
  25547. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25548. }
  25549. if (insert) {
  25550. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25551. }
  25552. if (update) {
  25553. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25554. }
  25555. if (grid) {
  25556. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25557. if (column_dict) {
  25558. gridColumn.fix = { dictName: column_dict };
  25559. }
  25560. if (origin.editType == 2 && (insert || update)) {
  25561. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25562. if (column_dict) {
  25563. gridColumn.editor.fix = { dictName: column_dict };
  25564. }
  25565. }
  25566. data.gridColumns.push(gridColumn);
  25567. }
  25568. if (is_primary_key) {
  25569. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25570. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25571. }
  25572. });
  25573. return data;
  25574. });
  25575. }
  25576. // noinspection HttpUrlsUsage
  25577. var urlPrefix = "/static/studio-template/single_table";
  25578. function generateCode(data) {
  25579. return Promise.all([
  25580. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25581. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25582. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25583. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25584. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25585. ]).then(function (values) {
  25586. var groovy = handlebars.compile(values[0]);
  25587. var mybatis = handlebars.compile(values[1]);
  25588. var controller = handlebars.compile(values[2]);
  25589. var view = handlebars.compile(values[3]);
  25590. var model = handlebars.compile(values[4]);
  25591. var code = {
  25592. groovy: groovy(data),
  25593. mybatis: mybatis(data),
  25594. controller: controller(data),
  25595. view: view(data),
  25596. model: model(data),
  25597. };
  25598. return code;
  25599. });
  25600. }
  25601. //# sourceMappingURL=SingleTableCodegen.js.map
  25602. var CreateModule = /** @class */ (function (_super) {
  25603. __extends(CreateModule, _super);
  25604. function CreateModule() {
  25605. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25606. _this.columns = [];
  25607. return _this;
  25608. }
  25609. CreateModule.prototype.onLoad = function () {
  25610. this.refs.grid1.setData([]);
  25611. };
  25612. CreateModule.prototype.addField = function () {
  25613. this.refs.grid1.appendEditRow({
  25614. column_name: '',
  25615. column_comment: '',
  25616. is_primary_key: false,
  25617. not_null: true,
  25618. column_domain: '',
  25619. data_type: '',
  25620. column_size: 0,
  25621. decimal_digits: 0,
  25622. default_value: '',
  25623. column_dict: '',
  25624. column_ui: '',
  25625. column_note: '',
  25626. }, 0);
  25627. };
  25628. CreateModule.prototype.removeField = function () {
  25629. var _this = this;
  25630. var rows = [];
  25631. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25632. rows.push(r);
  25633. });
  25634. _$2.forEach(rows, function (r) {
  25635. _this.refs.grid1.getStore().remove(r);
  25636. });
  25637. };
  25638. CreateModule.prototype.parseSQL = function (sender) {
  25639. var _this = this;
  25640. var sql = this.viewModel.get('singleTable.sql');
  25641. sender.up('window').setLoading(true);
  25642. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25643. parseSqlApi(sql).then(function (parseResult) {
  25644. if (!parseResult.success) {
  25645. msg$1(parseResult.msg);
  25646. return;
  25647. }
  25648. var tableNameList = [];
  25649. var columnList = [];
  25650. var singleTableTableName;
  25651. var singleTableDeleteWhereColumn;
  25652. _this.refs.grid1.setData([]);
  25653. var rows = _this.refs.grid1.getDataRows();
  25654. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25655. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25656. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25657. return;
  25658. }
  25659. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25660. tableNameList.push({ value: tableName });
  25661. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25662. columnList.push({ value: columnName });
  25663. if (!singleTableTableName)
  25664. singleTableTableName = tableName;
  25665. if (!singleTableDeleteWhereColumn)
  25666. singleTableDeleteWhereColumn = columnName;
  25667. // 已经加过这个列了
  25668. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25669. if (rowExists) {
  25670. return;
  25671. }
  25672. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25673. if (columnRow) {
  25674. _this.refs.grid1.appendEditRow({
  25675. table_name: tableName,
  25676. column_name: columnRow.column_name,
  25677. column_comment: columnRow.column_comment,
  25678. column_useto: 2,
  25679. is_primary_key: columnRow.is_primary_key,
  25680. not_null: columnRow.not_null,
  25681. column_size: columnRow.column_size,
  25682. column_dict: columnRow.column_dict,
  25683. column_ui: columnRow.column_ui,
  25684. data_type: columnRow.data_type,
  25685. });
  25686. if (columnRow.is_primary_key)
  25687. singleTableDeleteWhereColumn = columnName;
  25688. }
  25689. else {
  25690. _this.refs.grid1.appendEditRow({
  25691. table_name: tableName,
  25692. column_name: columnName,
  25693. column_useto: 2,
  25694. });
  25695. }
  25696. });
  25697. _this.viewModel.set("singleTableView.columnList", columnList);
  25698. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25699. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25700. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25701. }).finally(function () {
  25702. sender.up('window').setLoading(false);
  25703. });
  25704. }).catch(function () {
  25705. sender.up('window').setLoading(false);
  25706. });
  25707. };
  25708. CreateModule.prototype.templateEnter = function (sender) {
  25709. };
  25710. CreateModule.prototype.templateLevel = function (sender, opt) {
  25711. if (!this.viewModel.get('moduleType')) {
  25712. msg$1('请选择模板类型');
  25713. opt.cancel = true;
  25714. return;
  25715. }
  25716. };
  25717. CreateModule.prototype.moduleEnter = function (sender) {
  25718. };
  25719. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25720. if (!sender.down('form').isValid()) {
  25721. opt.cancel = true;
  25722. return;
  25723. }
  25724. };
  25725. CreateModule.prototype.editorEnter = function (sender) {
  25726. var editor = sender.down('sqleditor');
  25727. editor.setValue(this.viewModel.get('singleTable.sql'));
  25728. };
  25729. CreateModule.prototype.editorLevel = function (sender, opt) {
  25730. var editor = sender.down('sqleditor');
  25731. var sql = editor.getValue();
  25732. if (!sql) {
  25733. msg$1('查询SQL语句必填');
  25734. opt.cancel = true;
  25735. return;
  25736. }
  25737. this.viewModel.set('singleTable.sql', sql);
  25738. };
  25739. CreateModule.prototype.columnEnter = function (sender) {
  25740. };
  25741. CreateModule.prototype.columnLevel = function (sender, opt) {
  25742. };
  25743. CreateModule.prototype.extendEnter = function (sender) {
  25744. };
  25745. CreateModule.prototype.extendLevel = function (sender, opt) {
  25746. };
  25747. // 确认结果 - Enter
  25748. CreateModule.prototype.optionEnter = function (sender) {
  25749. var _this = this;
  25750. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25751. var moduleType = this.viewModel.get("moduleType");
  25752. var data = this.viewModel.getData();
  25753. var code = "";
  25754. var origin = {};
  25755. if (moduleType === 1) {
  25756. var singleTable = data.singleTable;
  25757. var editColumns = this.refs.grid1.getDataRows();
  25758. origin.moduleType = data.moduleType;
  25759. origin.packagePath = data.packagePath;
  25760. origin.fileSavePath = data.fileSavePath;
  25761. origin.moduleName = data.moduleName;
  25762. origin.pageTitle = data.pageTitle;
  25763. if (singleTable) {
  25764. origin.sql = singleTable.sql;
  25765. origin.tableName = singleTable.tableName;
  25766. origin.pagination = singleTable.pagination;
  25767. origin.delete = singleTable.delete;
  25768. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25769. origin.deleteTips = singleTable.deleteTips;
  25770. origin.editType = singleTable.editType;
  25771. }
  25772. origin.columnList = [];
  25773. origin.queryColumns = [];
  25774. origin.insertColumns = [];
  25775. origin.updateColumns = [];
  25776. origin.gridColumns = [];
  25777. editColumns.forEach(function (column) {
  25778. var row = {
  25779. table_name: column.table_name,
  25780. column_name: column.column_name,
  25781. column_comment: column.column_comment,
  25782. is_primary_key: column.is_primary_key,
  25783. not_null: column.not_null,
  25784. column_size: column.column_size,
  25785. column_dict: column.column_dict,
  25786. column_ui: column.column_ui,
  25787. data_type: column.data_type,
  25788. column_type: column.column_type,
  25789. };
  25790. origin.columnList.push(row);
  25791. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25792. var column_name = column.column_name, column_useto = column.column_useto;
  25793. switch (column_useto) {
  25794. case 1:
  25795. origin.queryColumns.push(column_name);
  25796. break;
  25797. case 2:
  25798. origin.gridColumns.push(column_name);
  25799. break;
  25800. case 3:
  25801. origin.queryColumns.push(column_name);
  25802. origin.gridColumns.push(column_name);
  25803. break;
  25804. }
  25805. origin.insertColumns.push(column_name);
  25806. origin.updateColumns.push(column_name);
  25807. });
  25808. }
  25809. this.setLoading(true);
  25810. getSingleTableData(origin).then(function (data) {
  25811. code = JSON.stringify(data, null, 4);
  25812. window['lastTemplateData'] = code;
  25813. var editor = _this.refs.jsoneditor;
  25814. editor.setCode(code);
  25815. }).finally(function () { return _this.setLoading(false); });
  25816. };
  25817. // 确认结果 - Level
  25818. CreateModule.prototype.optionLevel = function (sender, opt) {
  25819. };
  25820. // 上一步
  25821. CreateModule.prototype.showPrevious = function () {
  25822. this.doCardNavigation(false);
  25823. };
  25824. // 下一步
  25825. CreateModule.prototype.showNext = function () {
  25826. this.doCardNavigation(true, true);
  25827. };
  25828. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25829. if (isNext === void 0) { isNext = true; }
  25830. if (isCancelable === void 0) { isCancelable = false; }
  25831. var layout = this._handle.getLayout();
  25832. var activeItem = layout.activeItem;
  25833. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25834. if (isNext)
  25835. this.prevCard = reference;
  25836. var activeCard;
  25837. if (reference === "templateSelection") {
  25838. if (isNext) {
  25839. activeCard = this.refs['moduleName'];
  25840. }
  25841. }
  25842. else if (reference === "moduleName") {
  25843. if (isNext) {
  25844. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25845. var moduleType = this.viewModel.get("moduleType");
  25846. switch (moduleType) {
  25847. case 1:
  25848. activeCard = this.refs['singleTable_1'];
  25849. break;
  25850. case 2:
  25851. activeCard = this.refs['mainDetailTable_1'];
  25852. break;
  25853. case 3:
  25854. // activeCard =
  25855. break;
  25856. case 4:
  25857. activeCard = this.refs['cardForm_1'];
  25858. break;
  25859. }
  25860. }
  25861. else {
  25862. activeCard = this.refs['templateSelection'];
  25863. }
  25864. }
  25865. else if (reference === "confirmResult") {
  25866. if (!isNext) {
  25867. activeCard = this.refs[this.prevCard];
  25868. }
  25869. }
  25870. else {
  25871. var name = reference.split('_')[0];
  25872. var idx = parseInt(reference.split('_')[1], 10);
  25873. if (isNext) {
  25874. if (isEnd) {
  25875. activeCard = this.refs['confirmResult'];
  25876. }
  25877. else {
  25878. idx += 1;
  25879. }
  25880. }
  25881. else {
  25882. idx -= 1;
  25883. }
  25884. if (idx <= 0) {
  25885. activeCard = this.refs['moduleName'];
  25886. }
  25887. else if (!activeCard) {
  25888. activeCard = this.refs[name + "_" + idx];
  25889. }
  25890. }
  25891. // 按钮状态
  25892. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  25893. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  25894. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  25895. // 设置下一页显示
  25896. if (activeCard) {
  25897. var optCancel = { cancel: false };
  25898. // 发出 cardLevel 事件
  25899. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  25900. if (isCancelable && optCancel.cancel) {
  25901. // 取消了
  25902. return;
  25903. }
  25904. layout.setActiveItem(activeCard);
  25905. this.viewModel.set('title', layout.activeItem.vtitle);
  25906. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  25907. }
  25908. };
  25909. // 立刻执行
  25910. CreateModule.prototype.finish = function (sender) {
  25911. var _this = this;
  25912. var parent = sender.up('window');
  25913. var editor = this.refs.jsoneditor;
  25914. var data = JSON.parse(editor.getCode());
  25915. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25916. var moduleType = this.viewModel.get("moduleType");
  25917. if (moduleType === 1) {
  25918. this.setLoading(true);
  25919. generateCode(data).then(function (code) {
  25920. console.log("===> ", code);
  25921. _this.setLoading(true);
  25922. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  25923. .then(function () {
  25924. msg$1("创建成功!");
  25925. parent.close();
  25926. handles$1.fileTree.reload();
  25927. }).finally(function () { return _this.setLoading(false); });
  25928. }).finally(function () { return _this.setLoading(false); });
  25929. }
  25930. };
  25931. return CreateModule;
  25932. }(Scope));
  25933. //# sourceMappingURL=CreateModule.js.map
  25934. function getModuleId(path) {
  25935. var separator = "/";
  25936. var sps = path.split(separator);
  25937. var joinSps = sps.join('$');
  25938. if (!joinSps) {
  25939. return "ROOT";
  25940. }
  25941. return joinSps;
  25942. }
  25943. /**
  25944. * Module数据转换成Tree数据
  25945. */
  25946. function modulesToTreeData(modules) {
  25947. var separator = "/";
  25948. var treeNodeMap = new Map();
  25949. var root = {
  25950. type: "Dir",
  25951. path: "",
  25952. expanded: true,
  25953. leaf: false,
  25954. children: [],
  25955. };
  25956. root.id = getModuleId(root.path);
  25957. treeNodeMap.set(root.path, root);
  25958. modules.forEach(function (module) {
  25959. var _a;
  25960. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  25961. if (paths.length <= 0)
  25962. return;
  25963. var path = [];
  25964. var parent = root;
  25965. paths.forEach(function (dirName, idx) {
  25966. var parentPath = path.join(separator);
  25967. parent = treeNodeMap.get(parentPath);
  25968. path.push(dirName);
  25969. var currentPath = path.join(separator);
  25970. var child = treeNodeMap.get(currentPath);
  25971. if (child == null) {
  25972. // 获取当前path 绝对路径
  25973. var indexLength = module.absolutePath.indexOf(currentPath);
  25974. var currentAbsolutePath = "";
  25975. if (indexLength > 0) {
  25976. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  25977. }
  25978. child = {
  25979. type: "Dir",
  25980. path: currentPath,
  25981. absolutePath: currentAbsolutePath,
  25982. leaf: false,
  25983. children: [],
  25984. text: dirName
  25985. };
  25986. child.id = getModuleId(child.path);
  25987. parent.children.push(child);
  25988. treeNodeMap.set(child.path, child);
  25989. }
  25990. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  25991. var leaf = {
  25992. type: "Module",
  25993. path: module.path + separator + module.name,
  25994. absolutePath: module.absolutePath,
  25995. leaf: true,
  25996. text: module.name,
  25997. module: module,
  25998. };
  25999. leaf.id = getModuleId(leaf.path);
  26000. child.children.push(leaf);
  26001. treeNodeMap.set(leaf.path, leaf);
  26002. }
  26003. });
  26004. });
  26005. // 排序处理
  26006. treeNodeMap.forEach(function (module) {
  26007. if (module.children) {
  26008. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26009. module.children.length = 0;
  26010. children.forEach(function (item) { return module.children.push(item); });
  26011. }
  26012. });
  26013. return root;
  26014. }
  26015. function showDialog(sender, option) {
  26016. var _a, _b;
  26017. var win = new Ext.Window({
  26018. autoDestroy: true,
  26019. title: option.title,
  26020. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26021. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26022. resizable: false,
  26023. closable: true,
  26024. modal: true,
  26025. maximizable: false,
  26026. minimizable: false,
  26027. // constrainHeader: true,
  26028. constrain: true,
  26029. layout: 'fit',
  26030. animateTarget: sender,
  26031. buttonAlign: 'center',
  26032. items: [
  26033. {
  26034. xtype: "form",
  26035. layout: "hbox",
  26036. margin: '10px 20px',
  26037. border: 0,
  26038. items: option.items
  26039. }
  26040. ],
  26041. //窗口按钮
  26042. fbar: [
  26043. {
  26044. xtype: 'button', text: '保存', handler: function (btn) {
  26045. //窗口获取表单
  26046. var form = win.down('form');
  26047. var vaildSuccess = form.isValid();
  26048. if (!vaildSuccess) {
  26049. return;
  26050. }
  26051. option.submitFunc(form);
  26052. }
  26053. },
  26054. {
  26055. xtype: 'button', text: '取消', handler: function (btn) {
  26056. //窗口关闭
  26057. btn.up('window').close();
  26058. }
  26059. }
  26060. ],
  26061. });
  26062. win.show();
  26063. }
  26064. function showCreateFolderWin(sender, parentPath) {
  26065. showDialog(sender, {
  26066. title: '新建文件夹',
  26067. height: 150,
  26068. items: [
  26069. {
  26070. xtype: "textfield",
  26071. name: "filename",
  26072. fieldLabel: "文件夹名称",
  26073. allowBlank: false,
  26074. selectOnFocus: true,
  26075. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26076. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26077. labelWidth: 80,
  26078. width: "100%",
  26079. listeners: {
  26080. afterrender: function (sender) {
  26081. _$2.defer(function () {
  26082. sender.focus();
  26083. });
  26084. }
  26085. }
  26086. },
  26087. ],
  26088. submitFunc: function (form) {
  26089. var filename = form.down('textfield[name="filename"]').getValue();
  26090. createFolder(parentPath, filename).then(function (res) {
  26091. if (res.success) {
  26092. msg$1('创建成功');
  26093. handles$1.fileTree.reload();
  26094. form.up('window').close();
  26095. }
  26096. else {
  26097. showErrorDialog$1(res.msg);
  26098. }
  26099. }).catch(function (e) {
  26100. showErrorDialog$1(e.responseJSON.msg);
  26101. });
  26102. }
  26103. });
  26104. }
  26105. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26106. var dlg = new CreateModule();
  26107. dlg.showDialog(sender, {}, {
  26108. data: {
  26109. packagePath: path,
  26110. fileSavePath: absolutePath,
  26111. }
  26112. });
  26113. }
  26114. function registerModule$1(sender, path, name, icon) {
  26115. // 前缀 com/galaxis/wms 写死了
  26116. var dlg = new RegisterModule();
  26117. dlg.showDialog(sender, {}, {
  26118. data: {
  26119. form: {
  26120. scope_url: path.replace("com/galaxis/wms", "."),
  26121. resource_name: name,
  26122. resource_icon: icon,
  26123. }
  26124. }
  26125. });
  26126. }
  26127. function showCreateEmptyModule(sender, path) {
  26128. var win = new Ext.Window({
  26129. autoDestroy: true,
  26130. title: "新建空模块",
  26131. width: 400,
  26132. height: 150,
  26133. resizable: true,
  26134. closable: true,
  26135. maximizable: true,
  26136. minimizable: true,
  26137. plain: true,
  26138. // constrainHeader: true,
  26139. constrain: true,
  26140. layout: 'fit',
  26141. animateTarget: sender,
  26142. buttonAlign: 'center',
  26143. items: [
  26144. {
  26145. xtype: "form",
  26146. layout: "hbox",
  26147. margin: '10px 20px',
  26148. border: 0,
  26149. items: [
  26150. {
  26151. flex: 1,
  26152. layout: 'vbox',
  26153. items: [
  26154. {
  26155. xtype: "textfield",
  26156. name: "filename",
  26157. fieldLabel: "模块名",
  26158. flex: 1,
  26159. allowBlank: false,
  26160. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26161. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26162. labelWidth: 50,
  26163. width: "100%",
  26164. },
  26165. ]
  26166. },
  26167. ]
  26168. }
  26169. ],
  26170. //窗口按钮
  26171. buttons: [
  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. var filename = form.down('textfield[name="filename"]').getValue();
  26181. createEmptyModule(path, filename).then(function (res) {
  26182. if (res.success) {
  26183. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26184. handles$1.fileTree.reload();
  26185. win.close();
  26186. }
  26187. else {
  26188. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26189. }
  26190. }).catch(function (e) {
  26191. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26192. });
  26193. }
  26194. },
  26195. {
  26196. xtype: 'button', text: '取消', handler: function (btn) {
  26197. //窗口关闭
  26198. win.close();
  26199. }
  26200. }
  26201. ]
  26202. });
  26203. win.show();
  26204. }
  26205. //# sourceMappingURL=FileHelp.js.map
  26206. function initFileTree () {
  26207. Ext.define('com.yvan.studio.FileTree', {
  26208. extend: 'com.yvan.studio.StateTree',
  26209. xtype: 'filetree',
  26210. tooltip: '文件',
  26211. iconCls: 'x-fa fa-file',
  26212. rootVisible: false,
  26213. useArrows: true,
  26214. colspan: 2,
  26215. lines: true,
  26216. reference: 'filetree',
  26217. multiSelect: true,
  26218. getStateFilename: function () {
  26219. return getCurrentProject().uuid + "/filetree.json";
  26220. },
  26221. openNode: function () {
  26222. var selection = this.getSelection();
  26223. var _a = __read(selection, 1), record = _a[0];
  26224. if (!record) {
  26225. return;
  26226. }
  26227. var raw = record.raw;
  26228. if (raw.type === 'Dir') {
  26229. return;
  26230. }
  26231. if (raw.type === "Module" && raw.module) {
  26232. eventBus.publish(EventType.ModuleOpen, raw);
  26233. }
  26234. },
  26235. openInIdea: function () {
  26236. var _a = __read(this.getSelection(), 1), record = _a[0];
  26237. if (record) {
  26238. var data = record.data;
  26239. if (data.type === "Module") {
  26240. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26241. native.openInIdea(data.module.groovyFile.absolutePath);
  26242. }
  26243. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26244. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26245. }
  26246. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26247. native.openInIdea(data.module.jsViewFile.absolutePath);
  26248. }
  26249. return;
  26250. }
  26251. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26252. }
  26253. },
  26254. deleteSelection: function () {
  26255. var selection = this.getSelection();
  26256. var pathList = [];
  26257. _.forEach(selection, function (item) {
  26258. if (item.data.type === "Dir") {
  26259. pathList.push({ path: item.data.path, isFolder: true });
  26260. }
  26261. else {
  26262. pathList.push({ path: item.data.path, isFolder: false });
  26263. }
  26264. });
  26265. {
  26266. return;
  26267. }
  26268. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26269. //
  26270. // Ext.Msg.confirm('提示', title, (btn) => {
  26271. // if (btn === 'yes') {
  26272. // deleteFileOrFolder(raw.path, title, true)
  26273. // }
  26274. // })
  26275. // const title = '您确定要删除(' + raw.path + ')吗?'
  26276. // deleteFileOrFolder(raw.path, title, false)
  26277. },
  26278. listeners: {
  26279. itemverify: function () {
  26280. this.openNode();
  26281. },
  26282. afterrender: function (me) {
  26283. console.log('filetree_afterrender', 'reloadIfNeed');
  26284. moduleStore.registe(me.subscribeModule.bind(this));
  26285. moduleStore.reloadIfNeed("PC");
  26286. },
  26287. destroy: function (me) {
  26288. console.log('filetree_destroy');
  26289. moduleStore.unregiste(me.subscribeModule.bind(this));
  26290. },
  26291. itemcontextmenu: function (sender, node, element, idx, e) {
  26292. e.preventDefault();
  26293. var raw = node.raw;
  26294. var option = {};
  26295. if (raw.type === 'Dir') {
  26296. // 文件夹右键
  26297. option = {
  26298. shadow: 'frame', allowOtherMenus: true,
  26299. items: [
  26300. {
  26301. text: '新建空模块',
  26302. iconCls: 'x-fa fa-plus-circle',
  26303. handler: function (sender) {
  26304. showCreateEmptyModule(sender, raw.path);
  26305. }
  26306. },
  26307. {
  26308. text: '新建模块',
  26309. iconCls: 'x-fa fa-plus-circle',
  26310. handler: function (sender) {
  26311. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26312. }
  26313. },
  26314. '-',
  26315. {
  26316. text: '新建文件夹',
  26317. iconCls: 'x-fa fa-folder-o',
  26318. handler: function (sender) {
  26319. var parentPath = raw.path;
  26320. showCreateFolderWin(sender, parentPath);
  26321. }
  26322. },
  26323. {
  26324. text: '复制路径',
  26325. iconCls: 'x-fa fa-external-link',
  26326. handler: function (sender) {
  26327. native.clipboardSet(raw.path);
  26328. }
  26329. },
  26330. ]
  26331. };
  26332. }
  26333. else {
  26334. // 文件右键
  26335. option = {
  26336. shadow: 'frame', allowOtherMenus: true,
  26337. items: [
  26338. // {
  26339. // text: '重命名',
  26340. // iconCls: 'x-fa fa-terminal',
  26341. // handler(sender) {
  26342. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26343. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26344. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26345. // }
  26346. // },
  26347. // {
  26348. // text: '另存为',
  26349. // iconCls: 'x-fa fa-exchange',
  26350. // handler(sender) {
  26351. // console.error('没做')
  26352. // }
  26353. // },
  26354. {
  26355. text: '复制路径',
  26356. iconCls: 'x-fa fa-external-link',
  26357. handler: function (sender) {
  26358. native.clipboardSet(raw.path);
  26359. }
  26360. },
  26361. '-',
  26362. {
  26363. text: '注册模块',
  26364. iconCls: 'x-fa fa-sign-in',
  26365. handler: function (sender) {
  26366. registerModule$1(sender, raw.path);
  26367. }
  26368. },
  26369. ]
  26370. };
  26371. }
  26372. var treeMenu = new Ext.menu.Menu(option);
  26373. treeMenu.showAt(e.getXY());
  26374. },
  26375. },
  26376. tbar: [
  26377. {
  26378. xtype: 'button',
  26379. iconCls: 'x-fa fa-crosshairs',
  26380. tooltip: '选中当前打开的文件',
  26381. handler: function (sender) {
  26382. msg$1('没做');
  26383. }
  26384. },
  26385. {
  26386. xtype: 'button',
  26387. iconCls: 'x-fa fa-link',
  26388. tooltip: '在IDEA中打开',
  26389. handler: function (sender) {
  26390. var scope = sender.up("filetree");
  26391. scope.openInIdea();
  26392. }
  26393. },
  26394. {
  26395. xtype: 'button',
  26396. iconCls: 'x-fa fa-refresh',
  26397. tooltip: '刷新',
  26398. handler: function (sender) {
  26399. var scope = sender.up("filetree");
  26400. scope.reload();
  26401. }
  26402. },
  26403. {
  26404. xtype: 'button',
  26405. iconCls: 'x-fa fa-percent',
  26406. tooltip: '监控',
  26407. handler: function (sender) {
  26408. // handles.mainWindow.showPerform()
  26409. }
  26410. },
  26411. ],
  26412. initComponent: function () {
  26413. setFileTree(this);
  26414. this.superclass.initComponent.apply(this, arguments);
  26415. // super.initComponent.apply(this, arguments)
  26416. },
  26417. subscribeModule: function (res) {
  26418. if (typeof res === 'object') {
  26419. var rootNode = modulesToTreeData(res.data);
  26420. this.setRootNode(rootNode);
  26421. this.restoreState();
  26422. handles$1.mainWindow.modules = res.data;
  26423. }
  26424. else if (typeof res === 'boolean') {
  26425. this.setLoading(res);
  26426. }
  26427. },
  26428. reload: function () {
  26429. console.log('filetree_reloadForce');
  26430. moduleStore.reloadForce("PC").then(function (res) {
  26431. });
  26432. }
  26433. });
  26434. }
  26435. //# sourceMappingURL=FileTree.js.map
  26436. function initDbTree () {
  26437. var define = {
  26438. extend: 'com.yvan.studio.StateTree',
  26439. xtype: 'dbtree',
  26440. tooltip: '数据库',
  26441. iconCls: 'x-fa fa-database',
  26442. rootVisible: false,
  26443. useArrows: true,
  26444. reference: 'dbtree',
  26445. multiSelect: true,
  26446. getStateFilename: function () {
  26447. return getCurrentProject().uuid + "/dbtree.json";
  26448. },
  26449. tbar: [
  26450. {
  26451. xtype: 'button',
  26452. iconCls: 'x-fa fa-crosshairs',
  26453. tooltip: '选中当前打开的表',
  26454. handler: function (sender) {
  26455. var _a;
  26456. // 获取当前选中的活动标签 tableColumn_bas_car
  26457. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26458. if (!locatPath) {
  26459. return;
  26460. }
  26461. handles$1.dbTree.selectPath(locatPath);
  26462. }
  26463. },
  26464. {
  26465. xtype: 'button',
  26466. iconCls: 'x-fa fa-refresh',
  26467. tooltip: '刷新',
  26468. handler: function (sender) {
  26469. handles$1.dbTree.reload();
  26470. }
  26471. },
  26472. {
  26473. xtype: 'button',
  26474. iconCls: 'x-fa fa-cloud-download',
  26475. tooltip: '重新拉取生成元数据(耗时很长!)',
  26476. handler: function (sender) {
  26477. handles$1.dbTree.dbToMetaAndReload(sender);
  26478. }
  26479. },
  26480. // {
  26481. // xtype: 'button',
  26482. // iconCls: 'x-fa fa-files-o',
  26483. // tooltip: '数据同步',
  26484. // handler(sender) {
  26485. //
  26486. // }
  26487. // },
  26488. {
  26489. xtype: 'button',
  26490. iconCls: 'x-fa fa-exchange',
  26491. tooltip: '数据结构同步',
  26492. handler: function (sender) {
  26493. // handles.mainWindow.showDataSync(sender)
  26494. }
  26495. },
  26496. {
  26497. xtype: 'button',
  26498. iconCls: 'x-fa fa-window-maximize',
  26499. tooltip: 'SQL查询分析器',
  26500. handler: function (sender) {
  26501. // handles.mainWindow.showDbCodeTemplate(sender)
  26502. }
  26503. },
  26504. {
  26505. xtype: 'button',
  26506. iconCls: 'x-fa fa-cubes',
  26507. tooltip: '数据域管理',
  26508. handler: function (sender) {
  26509. // handles.mainWindow.showColumnDomain()
  26510. }
  26511. },
  26512. {
  26513. xtype: 'button',
  26514. iconCls: 'x-fa fa-edit',
  26515. tooltip: '修改结构',
  26516. handler: function (sender) {
  26517. var tree = sender.up("treepanel");
  26518. var selection = tree.getSelection();
  26519. var _a = __read(selection, 1), node = _a[0];
  26520. if (!node) {
  26521. msg$1('请选择一个表');
  26522. return;
  26523. }
  26524. var raw = node.data.raw;
  26525. if (node.get('type') === 'table') ;
  26526. else if (node.get('type') === 'column') ;
  26527. }
  26528. },
  26529. ],
  26530. listeners: {
  26531. afterrender: function (me) {
  26532. setDbTree(this);
  26533. // 找管理器订阅刷新的事件
  26534. instance$1.registe(this.refreshData.bind(this));
  26535. instance$1.reloadIfNeed(undefined);
  26536. },
  26537. destory: function (me) {
  26538. setDbTree(undefined);
  26539. instance$1.unregiste(this.refreshData.bind(this));
  26540. },
  26541. itemcontextmenu: function (sender, node, element, idx, e) {
  26542. var _this = this;
  26543. e.preventDefault();
  26544. var option = {};
  26545. var raw = node.raw.raw;
  26546. if (node.get('type') === 'column') {
  26547. option = {
  26548. shadow: 'frame', allowOtherMenus: true,
  26549. items: [
  26550. {
  26551. text: '设计结构',
  26552. iconCls: 'x-fa fa-edit',
  26553. handler: function (sender) {
  26554. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26555. }
  26556. },
  26557. ]
  26558. };
  26559. }
  26560. else if (node.get('type') === 'table') {
  26561. option = {
  26562. shadow: 'frame', allowOtherMenus: true,
  26563. items: [
  26564. {
  26565. text: '新建',
  26566. iconCls: 'x-fa fa-plus',
  26567. handler: function (sender) {
  26568. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26569. }
  26570. },
  26571. {
  26572. text: '设计结构',
  26573. iconCls: 'x-fa fa-edit',
  26574. handler: function (sender) {
  26575. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26576. }
  26577. },
  26578. {
  26579. text: '重命名',
  26580. iconCls: 'x-fa fa-pencil',
  26581. handler: function (sender) {
  26582. _this.renameTable(sender, node.data.raw);
  26583. }
  26584. },
  26585. '-',
  26586. {
  26587. text: '删除',
  26588. iconCls: 'x-fa fa-minus',
  26589. handler: function (sender) {
  26590. _this.removeTable(sender, node.data.raw);
  26591. }
  26592. },
  26593. ]
  26594. };
  26595. }
  26596. var treeMenu = new Ext.menu.Menu(option);
  26597. treeMenu.showAt(e.getXY());
  26598. }
  26599. },
  26600. // DbTreeStore 刷新时,会回调到这个方法
  26601. refreshData: function (isLoadingState) {
  26602. var me = this;
  26603. if (typeof isLoadingState === 'boolean') {
  26604. me.setLoading(isLoadingState);
  26605. return;
  26606. }
  26607. var rootNode = getDbTree(instance$1.apiResponse);
  26608. me.setRootNode(rootNode);
  26609. this.restoreState();
  26610. },
  26611. renameTable: function (sender, tableRow) {
  26612. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26613. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26614. if (!res.data)
  26615. return;
  26616. var window = Ext.create('Ext.window.Window', {
  26617. title: 'SQL 预览',
  26618. height: 400,
  26619. width: 600,
  26620. modal: true,
  26621. animateTarget: sender,
  26622. maximizable: true,
  26623. layout: 'fit',
  26624. items: {
  26625. xtype: 'sqleditor',
  26626. value: res.data,
  26627. },
  26628. buttons: [
  26629. {
  26630. xtype: 'button',
  26631. text: '执行',
  26632. iconCls: 'x-fa fa-save',
  26633. handler: function (sender) {
  26634. var editor = sender.up('window').down('sqleditor');
  26635. var ddl = editor.getValue();
  26636. window.setLoading(true);
  26637. instance$1.pushToDbCommit({
  26638. schema_name: tableRow.schema_name,
  26639. table_name: name,
  26640. old_table_name: tableRow.table_name,
  26641. ddl: ddl,
  26642. }).then(function () {
  26643. handles$1.dbTree.reload();
  26644. window.close();
  26645. }).finally(function () { return window.setLoading(false); });
  26646. },
  26647. },
  26648. {
  26649. xtype: 'button',
  26650. text: '取消',
  26651. iconCls: 'x-fa fa-times',
  26652. handler: function () {
  26653. window.close();
  26654. }
  26655. },
  26656. ]
  26657. }).show();
  26658. });
  26659. });
  26660. },
  26661. removeTable: function (sender, tableRow) {
  26662. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26663. if (!res.data)
  26664. return;
  26665. var window = Ext.create('Ext.window.Window', {
  26666. title: 'SQL 预览',
  26667. height: 400,
  26668. width: 600,
  26669. modal: true,
  26670. animateTarget: sender,
  26671. maximizable: true,
  26672. layout: 'fit',
  26673. items: {
  26674. xtype: 'sqleditor',
  26675. value: res.data,
  26676. },
  26677. buttons: [
  26678. {
  26679. xtype: 'button',
  26680. text: '执行',
  26681. iconCls: 'x-fa fa-save',
  26682. handler: function (sender) {
  26683. var editor = sender.up('window').down('sqleditor');
  26684. var ddl = editor.getValue();
  26685. window.setLoading(true);
  26686. instance$1.pushToDbCommit({
  26687. schema_name: tableRow.schema_name,
  26688. table_name: tableRow.table_name,
  26689. ddl: ddl
  26690. })
  26691. .then(function () {
  26692. handles$1.dbTree.reload();
  26693. window.close();
  26694. }).finally(function () { return window.setLoading(false); });
  26695. }
  26696. },
  26697. {
  26698. xtype: 'button',
  26699. text: '取消',
  26700. iconCls: 'x-fa fa-times',
  26701. handler: function () {
  26702. window.close();
  26703. }
  26704. }
  26705. ]
  26706. }).show();
  26707. });
  26708. },
  26709. // hideHeaders: true,
  26710. // columns: [
  26711. // {
  26712. // xtype: 'treecolumn',
  26713. // text: '名称',
  26714. // dataIndex: 'text',
  26715. // flex: 2,
  26716. // }, {
  26717. // text: '描述',
  26718. // dataIndex: 'comment',
  26719. // flex: 1,
  26720. // }
  26721. // ],
  26722. reload: function () {
  26723. // 强制刷新 DbManager
  26724. instance$1.reloadForce(undefined);
  26725. },
  26726. dbToMetaAndReload: function () {
  26727. // 从数据库结构重新生成元数据
  26728. instance$1.dbToMetaAndReload();
  26729. }
  26730. };
  26731. Ext.define('com.yvan.studio.DbTree', define);
  26732. }
  26733. /**
  26734. * 将数据构建成 dbTree 需要的格式
  26735. */
  26736. function getDbTree(apiResponse) {
  26737. var rootNode = {
  26738. children: [],
  26739. expanded: true,
  26740. id: "ROOT",
  26741. leaf: false,
  26742. };
  26743. _$2.forEach(apiResponse, function (schemaRow) {
  26744. var schemaNode = {
  26745. id: 'schema$' + schemaRow.schema_name,
  26746. type: "schema",
  26747. expanded: true,
  26748. leaf: false,
  26749. iconCls: 'x-fa fa-th-large ',
  26750. text: schemaRow.schema_name,
  26751. raw: __assign({}, schemaRow),
  26752. children: [],
  26753. };
  26754. delete schemaNode.raw.table_list;
  26755. rootNode.children.push(schemaNode);
  26756. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26757. var _a;
  26758. var tableNode = {
  26759. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26760. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26761. comment: tableRow.description,
  26762. type: "table",
  26763. iconCls: 'x-fa fa-table',
  26764. expanded: false,
  26765. leaf: false,
  26766. children: [],
  26767. raw: __assign({}, tableRow)
  26768. };
  26769. delete tableNode.raw.column_list;
  26770. schemaNode.children.push(tableNode);
  26771. _$2.forEach(tableRow.column_list, function (columnRow) {
  26772. var _a;
  26773. var iconCls = 'x-fa fa-square-o';
  26774. if (columnRow.is_primary_key) {
  26775. iconCls = 'x-fa fa-key';
  26776. }
  26777. else if (columnRow.not_null) {
  26778. iconCls = 'x-fa fa-check-square';
  26779. }
  26780. var columnNode = {
  26781. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26782. type: "column",
  26783. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26784. comment: columnRow.column_comment,
  26785. leaf: true,
  26786. iconCls: iconCls,
  26787. raw: __assign({}, columnRow)
  26788. };
  26789. tableNode.children.push(columnNode);
  26790. }); // column
  26791. }); // table
  26792. }); // schema
  26793. return rootNode;
  26794. }
  26795. //# sourceMappingURL=DbTree.js.map
  26796. var ReportGridController = /** @class */ (function () {
  26797. function ReportGridController() {
  26798. }
  26799. ReportGridController.prototype.onLoad = function (sender) {
  26800. this.reload();
  26801. setReport(this);
  26802. };
  26803. ReportGridController.prototype.showSingle = function (sender) {
  26804. var _this = this;
  26805. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26806. if (record) {
  26807. handles.mainWindow.showFormSingle(record.data, function () {
  26808. _this.reload();
  26809. });
  26810. }
  26811. };
  26812. ReportGridController.prototype.filterChanged = function (sender, value) {
  26813. console.log('filterChange', sender, value);
  26814. this.view.store.clearFilter();
  26815. if (value) {
  26816. this.view.store.filterBy(function (record) {
  26817. var code = _.lowerCase(record.get('report_name'));
  26818. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26819. return (code.includes(value) ||
  26820. dict_desc_py.includes(value));
  26821. });
  26822. }
  26823. };
  26824. ReportGridController.prototype.onClearClick = function () {
  26825. var _a, _b;
  26826. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26827. };
  26828. ReportGridController.prototype.reload = function () {
  26829. var me = this;
  26830. me.getView().setLoading(true);
  26831. reportListApi().then(function (res) {
  26832. _.forEach(res.data, function (r) {
  26833. r.report_enable = r.report_enable === 1;
  26834. });
  26835. me.getView().setStore(new Ext.data.Store({
  26836. fields: ['report_id', 'report_name', 'report_enable'],
  26837. data: res.data,
  26838. }));
  26839. }).finally(function () {
  26840. me.getView().setLoading(false);
  26841. });
  26842. };
  26843. ReportGridController.prototype.reportAdd = function () {
  26844. var _this = this;
  26845. prompt$2('请输入报表名称').then(function (name) {
  26846. createReportApi(name).then(function (res) {
  26847. if (res.success) {
  26848. msg$1('添加成功');
  26849. handles.mainWindow.showReport(res.data, name, function () {
  26850. _this.reload();
  26851. });
  26852. }
  26853. _this.reload();
  26854. });
  26855. });
  26856. };
  26857. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26858. e.preventDefault();
  26859. var me = sender.up('grid').ownerGrid.getController();
  26860. var option = {
  26861. shadow: 'frame', allowOtherMenus: true,
  26862. items: [
  26863. {
  26864. text: '添加',
  26865. iconCls: 'x-fa fa-plus-circle',
  26866. handler: function (sender) {
  26867. me.reportAdd();
  26868. }
  26869. },
  26870. {
  26871. text: '编辑',
  26872. iconCls: 'x-fa fa-edit',
  26873. handler: function (sender) {
  26874. me.reportEdit();
  26875. }
  26876. },
  26877. {
  26878. text: '删除',
  26879. iconCls: 'x-fa fa-minus-circle',
  26880. handler: function (sender) {
  26881. me.reportRemove();
  26882. }
  26883. },
  26884. '-',
  26885. {
  26886. text: '注册(至菜单)',
  26887. iconCls: 'x-fa fa-sign-in',
  26888. handler: function (sender) {
  26889. me.reportRegiste(sender);
  26890. }
  26891. },
  26892. {
  26893. text: '卸载',
  26894. iconCls: 'x-fa fa-sign-out',
  26895. handler: function (sender) {
  26896. console.error('没做');
  26897. }
  26898. },
  26899. ]
  26900. };
  26901. var treeMenu = new Ext.menu.Menu(option);
  26902. treeMenu.showAt(e.getXY());
  26903. };
  26904. ReportGridController.prototype.reportRegiste = function (sender) {
  26905. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26906. if (record) {
  26907. var reportName = record.get('report_name');
  26908. var reportId = record.get('report_id');
  26909. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  26910. }
  26911. };
  26912. ReportGridController.prototype.reportRemove = function () {
  26913. var _this = this;
  26914. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26915. if (record) {
  26916. var reportName = record.get('report_name');
  26917. var reportId_1 = record.get('report_id');
  26918. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  26919. delReportApi(reportId_1).then(function (res) {
  26920. if (res.success) {
  26921. msg$1('删除成功');
  26922. _this.reload();
  26923. }
  26924. });
  26925. });
  26926. }
  26927. };
  26928. ReportGridController.prototype.reportEdit = function () {
  26929. var _this = this;
  26930. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26931. if (record) {
  26932. var reportName = record.get('report_name');
  26933. var reportId = record.get('report_id');
  26934. handles.mainWindow.showReport(reportId, reportName, function () {
  26935. _this.reload();
  26936. });
  26937. }
  26938. };
  26939. ReportGridController.prototype.onDblClick = function (sender) {
  26940. this.reportEdit();
  26941. };
  26942. return ReportGridController;
  26943. }());
  26944. //# sourceMappingURL=ReportGridController.js.map
  26945. function initReportGrid () {
  26946. var controller = new ReportGridController();
  26947. Ext.define('com.yvan.studio.ReportGrid', {
  26948. extend: 'Ext.grid.Panel',
  26949. xtype: 'reportGrid',
  26950. controller: controller,
  26951. scope: controller,
  26952. referenceHolder: true,
  26953. tooltip: '查询报表',
  26954. iconCls: 'x-fa fa-bar-chart',
  26955. useArrows: true,
  26956. reference: 'reportgrid',
  26957. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  26958. listeners: {
  26959. itemdblclick: 'onDblClick',
  26960. afterrender: 'onLoad',
  26961. },
  26962. viewConfig: {
  26963. listeners: {
  26964. itemcontextmenu: 'onGridContextMenu',
  26965. },
  26966. },
  26967. tbar: {
  26968. xtype: 'toolbar',
  26969. items: [
  26970. {
  26971. xtype: 'button',
  26972. tooltip: '测试',
  26973. iconCls: 'x-fa fa-bars',
  26974. listeners: {
  26975. click: 'showSingle'
  26976. }
  26977. },
  26978. {
  26979. xtype: 'button',
  26980. tooltip: '刷新',
  26981. iconCls: 'x-fa fa-refresh',
  26982. listeners: {
  26983. click: 'reload'
  26984. }
  26985. },
  26986. {
  26987. xtype: 'button',
  26988. tooltip: '添加',
  26989. iconCls: 'x-fa fa-plus-circle',
  26990. listeners: {
  26991. click: 'reportAdd'
  26992. }
  26993. },
  26994. {
  26995. xtype: 'button',
  26996. tooltip: '删除',
  26997. iconCls: 'x-fa fa-minus-circle',
  26998. listeners: {
  26999. click: 'reportRemove'
  27000. }
  27001. },
  27002. {
  27003. xtype: 'textfield',
  27004. flex: 1,
  27005. reference: "txtFilter",
  27006. emptyText: '搜索过滤',
  27007. enableKeyEvents: true,
  27008. listeners: {
  27009. change: {
  27010. fn: 'filterChanged',
  27011. buffer: 50
  27012. }
  27013. }
  27014. },
  27015. ]
  27016. },
  27017. columns: [
  27018. {
  27019. text: 'ID', dataIndex: 'report_id',
  27020. hidden: true,
  27021. },
  27022. {
  27023. text: '报表名称', dataIndex: 'report_name',
  27024. menuDisabled: true, flex: 1,
  27025. },
  27026. ]
  27027. });
  27028. }
  27029. //# sourceMappingURL=ReportGrid.js.map
  27030. /** 所有变量类型 */
  27031. var TypeEnum;
  27032. (function (TypeEnum) {
  27033. TypeEnum["string"] = "string";
  27034. TypeEnum["number"] = "number";
  27035. TypeEnum["object"] = "object";
  27036. TypeEnum["array"] = "array";
  27037. TypeEnum["function"] = "function";
  27038. TypeEnum["null"] = "null";
  27039. TypeEnum["boolean"] = "boolean";
  27040. TypeEnum["symbol"] = "symbol";
  27041. TypeEnum["json"] = "json";
  27042. TypeEnum["math"] = "math";
  27043. TypeEnum["regexp"] = "regexp";
  27044. TypeEnum["date"] = "date";
  27045. TypeEnum["undefined"] = "undefined";
  27046. TypeEnum["nan"] = "nan";
  27047. TypeEnum["reactNode"] = "react_node";
  27048. })(TypeEnum || (TypeEnum = {}));
  27049. /**
  27050. * 判断对象类型
  27051. * @param object 对象
  27052. */
  27053. var variableTypeOf = function (object) {
  27054. var typeStr = Object.prototype.toString.call(object);
  27055. var typeName;
  27056. switch (("" + typeStr).toLowerCase()) {
  27057. case '[object string]':
  27058. typeName = TypeEnum.string;
  27059. break;
  27060. case '[object number]':
  27061. if (Number.isNaN(object)) {
  27062. return TypeEnum.nan;
  27063. }
  27064. typeName = TypeEnum.number;
  27065. break;
  27066. case '[object object]':
  27067. if (object.$$typeof && object.props) {
  27068. var type = variableTypeOf(object.$$typeof);
  27069. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27070. return TypeEnum.reactNode;
  27071. }
  27072. }
  27073. typeName = TypeEnum.object;
  27074. break;
  27075. case '[object array]':
  27076. typeName = TypeEnum.array;
  27077. break;
  27078. case '[object function]':
  27079. typeName = TypeEnum.function;
  27080. break;
  27081. case '[object null]':
  27082. typeName = TypeEnum.null;
  27083. break;
  27084. case '[object boolean]':
  27085. typeName = TypeEnum.boolean;
  27086. break;
  27087. case '[object date]':
  27088. typeName = TypeEnum.date;
  27089. break;
  27090. // 不常用
  27091. case '[object symbol]':
  27092. typeName = TypeEnum.symbol;
  27093. break;
  27094. case '[object json]':
  27095. typeName = TypeEnum.json;
  27096. break;
  27097. case '[object math]':
  27098. typeName = TypeEnum.math;
  27099. break;
  27100. case '[object regexp]':
  27101. typeName = TypeEnum.regexp;
  27102. break;
  27103. // 貌似不会走的分支
  27104. case '[object undefined]':
  27105. typeName = TypeEnum.undefined;
  27106. break;
  27107. // 无法识别
  27108. default:
  27109. if (object === undefined) {
  27110. return TypeEnum.undefined;
  27111. }
  27112. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27113. typeName = TypeEnum.object;
  27114. }
  27115. return typeName;
  27116. };
  27117. //# sourceMappingURL=typeof.js.map
  27118. function initGroovyEditor () {
  27119. Ext.define('com.yvan.studio.GroovyEditor', {
  27120. extend: 'Ext.panel.Panel',
  27121. alias: 'widget.groovyeditor',
  27122. xtype: 'groovyeditor',
  27123. layout: 'fit',
  27124. border: false,
  27125. html: "<div class=\"editor\"/>",
  27126. config: {
  27127. value: ''
  27128. },
  27129. codeChange: undefined,
  27130. isChangeFromOuter: false,
  27131. getCode: function () {
  27132. if (this.editor) {
  27133. return this.editor.getValue();
  27134. }
  27135. else {
  27136. return this.code;
  27137. }
  27138. },
  27139. setCode: function (value) {
  27140. var _this = this;
  27141. this.code = value;
  27142. this.value = value;
  27143. _$2.defer(function () {
  27144. _this.isChangeFromOuter = true;
  27145. if (_this.editor) {
  27146. _this.editor.setValue(value);
  27147. }
  27148. });
  27149. },
  27150. applyPosition: function () {
  27151. var _this = this;
  27152. if (this.autoFocusMethod) {
  27153. if (this.editor) {
  27154. _$2.defer(function () {
  27155. if (_this.autoFocusStartLine) {
  27156. _this.editor.setPosition({
  27157. lineNumber: _this.autoFocusStartLine,
  27158. column: _this.autoFocusStartColumn
  27159. });
  27160. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27161. }
  27162. _this.editor.focus();
  27163. });
  27164. delete this.autoFocusMethod;
  27165. }
  27166. }
  27167. this.editor.layout();
  27168. },
  27169. getValue: function () {
  27170. return this.value;
  27171. },
  27172. setValue: function (value, fromEditor) {
  27173. var me = this;
  27174. if (me.value === value) {
  27175. // 值相等,不需要变化
  27176. return;
  27177. }
  27178. if (fromEditor !== true && me.editor) {
  27179. // 不是来源于编辑器的变化,才设置编辑器的值
  27180. me.editor.setValue(value);
  27181. }
  27182. // 通知mixins setValue
  27183. me.value = value;
  27184. me.fireEvent('change', value);
  27185. },
  27186. initComponent: function () {
  27187. var that = this;
  27188. this.superclass.initComponent.call(this, arguments);
  27189. that.on({
  27190. resize: function () {
  27191. if (that.editor) {
  27192. that.editor.layout();
  27193. }
  27194. },
  27195. destory: function () {
  27196. if (that.editor) {
  27197. that.editor.dispose();
  27198. delete that.editor;
  27199. }
  27200. },
  27201. afterrender: function (sender) {
  27202. var $dom = $(that.el.dom).find('.editor');
  27203. attach_3($dom[0], {
  27204. value: that.code
  27205. }).then(function (editor) {
  27206. that.editor = editor;
  27207. that.applyPosition();
  27208. that.editor.onDidChangeModelContent(function (e) {
  27209. that.fireEvent('change', that.editor, e);
  27210. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27211. that.codeChange(that.editor.getValue(), that.name, e);
  27212. }
  27213. that.isChangeFromOuter = false;
  27214. });
  27215. });
  27216. }
  27217. });
  27218. }
  27219. });
  27220. }
  27221. function attach_3(element, opts) {
  27222. return new Promise(function (resolve) {
  27223. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27224. enabled: false
  27225. } }));
  27226. editor.onKeyUp(function (e) {
  27227. // console.log(e)
  27228. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27229. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27230. }
  27231. });
  27232. resolve(editor);
  27233. });
  27234. }
  27235. //# sourceMappingURL=GroovyEditor.js.map
  27236. function initJsEditor$1 () {
  27237. Ext.define('com.yvan.studio.JsEditor', {
  27238. extend: 'Ext.panel.Panel',
  27239. alias: 'widget.jseditor',
  27240. xtype: 'jseditor',
  27241. layout: 'fit',
  27242. border: false,
  27243. html: "<div class=\"editor\"/>",
  27244. autoFocusMethod: true,
  27245. autoFocusStartLine: 0,
  27246. autoFocusStartColumn: 0,
  27247. codeChange: undefined,
  27248. funcArr: [],
  27249. modulePage: null,
  27250. isChangeFromOuter: false,
  27251. name: "",
  27252. /**
  27253. * 设置代码
  27254. */
  27255. setCode: function (value) {
  27256. var _this = this;
  27257. this.code = value;
  27258. _$2.defer(function () {
  27259. _this.isChangeFromOuter = true;
  27260. if (_this.editor) {
  27261. _this.editor.setValue(value);
  27262. if (_this.name === "controllerEditor") {
  27263. _this.funcArr = _this.getAllFunction();
  27264. }
  27265. }
  27266. });
  27267. },
  27268. getCode: function () {
  27269. var _a;
  27270. if (!this.editor) {
  27271. return this.code;
  27272. }
  27273. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27274. },
  27275. applyPosition: function () {
  27276. var _this = this;
  27277. if (this.autoFocusMethod) {
  27278. if (this.editor) {
  27279. _$2.defer(function () {
  27280. if (_this.autoFocusStartLine) {
  27281. _this.editor.setPosition({
  27282. lineNumber: _this.autoFocusStartLine,
  27283. column: _this.autoFocusStartColumn
  27284. });
  27285. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27286. }
  27287. _this.editor.focus();
  27288. });
  27289. delete this.autoFocusMethod;
  27290. }
  27291. }
  27292. this.editor.layout();
  27293. },
  27294. initComponent: function () {
  27295. var that = this;
  27296. this.superclass.initComponent.apply(this, arguments);
  27297. this.on({
  27298. resize: function (sender, width, height) {
  27299. if (that.editor) {
  27300. that.editor.layout();
  27301. }
  27302. },
  27303. destory: function () {
  27304. if (that.editor) {
  27305. that.editor.dispose();
  27306. delete that.editor;
  27307. }
  27308. },
  27309. afterrender: function () {
  27310. var $dom = $(that.el.dom).find('.editor');
  27311. attach_1($dom[0], {
  27312. value: that.code
  27313. }).then(function (editor) {
  27314. that.editor = editor;
  27315. that.applyPosition();
  27316. that.editor.onDidChangeModelContent(function (e) {
  27317. that.fireEvent('change', that.editor, e);
  27318. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27319. that.codeChange(that.editor.getValue(), that.name, e);
  27320. }
  27321. that.isChangeFromOuter = false;
  27322. });
  27323. });
  27324. }
  27325. });
  27326. },
  27327. getAllFunction: function () {
  27328. var funcArr = [];
  27329. var ast = window['YvanUI'].recast.parse(this.code);
  27330. if (ast && ast.program && ast.program.body) {
  27331. if (Array.isArray(ast.program.body)) {
  27332. for (var i = 0; i < ast.program.body.length; i++) {
  27333. var m = ast.program.body[i];
  27334. if (m.type === "ExportDefaultDeclaration") {
  27335. if (m.declaration.type === "ClassDeclaration") {
  27336. if (m.declaration.body.type === "ClassBody") {
  27337. if (Array.isArray(m.declaration.body.body)) {
  27338. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27339. var ob = m.declaration.body.body[j];
  27340. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27341. var funcItem = { name: ob.key.name, args: [] };
  27342. if (Array.isArray(ob.value.params)) {
  27343. for (var k = 0; k < ob.value.params.length; k++) {
  27344. var p = ob.value.params[k];
  27345. funcItem.args.push(p.name);
  27346. }
  27347. }
  27348. funcArr.push(funcItem);
  27349. }
  27350. }
  27351. }
  27352. }
  27353. }
  27354. }
  27355. }
  27356. }
  27357. }
  27358. return funcArr;
  27359. }
  27360. });
  27361. }
  27362. var isInited = false;
  27363. function attach_1(element, opts) {
  27364. return new Promise(function (resolve) {
  27365. var monaco = window['monaco'];
  27366. if (!isInited) {
  27367. isInited = true;
  27368. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27369. noSemanticValidation: true,
  27370. noSyntaxValidation: false
  27371. });
  27372. // compiler options
  27373. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27374. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27375. allowNonTsExtensions: true,
  27376. });
  27377. // extra libraries
  27378. var libSource = [
  27379. 'declare class Facts {',
  27380. ' /**',
  27381. ' * Returns the next fact',
  27382. ' */',
  27383. ' static next():string',
  27384. ' static next222():string',
  27385. '}',
  27386. "\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 ",
  27387. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27388. ].join('\n');
  27389. var libUri = 'file:///index.d.ts';
  27390. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27391. // When resolving definitions and references, the editor will try to use created models.
  27392. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27393. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27394. }
  27395. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27396. resolve(editor);
  27397. });
  27398. }
  27399. //# sourceMappingURL=JsEditor.js.map
  27400. function initJsonEditor$1 () {
  27401. Ext.define('com.yvan.studio.JsonEditor', {
  27402. extend: 'Ext.panel.Panel',
  27403. alias: 'widget.jsoneditor',
  27404. xtype: 'jsoneditor',
  27405. layout: 'fit',
  27406. border: false,
  27407. html: "<div class=\"editor\"/>",
  27408. autoFocusMethod: true,
  27409. autoFocusStartLine: 0,
  27410. autoFocusStartColumn: 0,
  27411. codeChange: undefined,
  27412. funcArr: [],
  27413. modulePage: null,
  27414. isChangeFromOuter: false,
  27415. name: "",
  27416. /**
  27417. * 设置代码
  27418. */
  27419. setCode: function (value) {
  27420. var _this = this;
  27421. this.code = value;
  27422. _$2.defer(function () {
  27423. _this.isChangeFromOuter = true;
  27424. if (_this.editor) {
  27425. _this.editor.setValue(value);
  27426. }
  27427. });
  27428. },
  27429. updateOptions: function (options) {
  27430. if (this.editor && options) {
  27431. this.editor.updateOptions(options);
  27432. }
  27433. },
  27434. setLanguage: function (lang) {
  27435. if (this.editor && lang) {
  27436. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27437. }
  27438. },
  27439. getCode: function () {
  27440. var _a;
  27441. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27442. },
  27443. applyPosition: function () {
  27444. var _this = this;
  27445. if (this.autoFocusMethod) {
  27446. if (this.editor) {
  27447. _$2.defer(function () {
  27448. if (_this.autoFocusStartLine) {
  27449. _this.editor.setPosition({
  27450. lineNumber: _this.autoFocusStartLine,
  27451. column: _this.autoFocusStartColumn
  27452. });
  27453. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27454. }
  27455. _this.editor.focus();
  27456. });
  27457. delete this.autoFocusMethod;
  27458. }
  27459. }
  27460. this.editor.layout();
  27461. },
  27462. initComponent: function () {
  27463. var that = this;
  27464. this.superclass.initComponent.apply(this, arguments);
  27465. this.on({
  27466. resize: function (sender, width, height) {
  27467. if (that.editor) {
  27468. that.editor.layout();
  27469. }
  27470. },
  27471. destory: function () {
  27472. if (that.editor) {
  27473. that.editor.dispose();
  27474. delete that.editor;
  27475. }
  27476. },
  27477. afterrender: function (sender) {
  27478. var $dom = $(that.el.dom).find('.editor');
  27479. attach_116($dom[0], {
  27480. value: that.code
  27481. }).then(function (editor) {
  27482. that.editor = editor;
  27483. that.applyPosition();
  27484. that.editor.onDidChangeModelContent(function (e) {
  27485. that.fireEvent('change', that.editor, e);
  27486. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27487. that.codeChange(that.editor.getValue(), that.name, e);
  27488. }
  27489. that.isChangeFromOuter = false;
  27490. });
  27491. });
  27492. }
  27493. });
  27494. },
  27495. });
  27496. }
  27497. function attach_116(element, opts) {
  27498. return new Promise(function (resolve) {
  27499. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27500. enabled: false
  27501. } }));
  27502. editor.onKeyUp(function (e) {
  27503. // console.log(e)
  27504. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27505. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27506. }
  27507. });
  27508. resolve(editor);
  27509. });
  27510. }
  27511. //# sourceMappingURL=JsonEditor.js.map
  27512. function initSqlEditor$1 () {
  27513. Ext.define('com.yvan.studio.SqlEditor', {
  27514. extend: 'Ext.panel.Panel',
  27515. alias: 'widget.sqleditor',
  27516. xtype: 'sqleditor',
  27517. layout: 'fit',
  27518. border: false,
  27519. html: "<div class=\"editor\"/>",
  27520. config: {
  27521. value: ''
  27522. },
  27523. codeChange: undefined,
  27524. isChangeFromOuter: false,
  27525. setCode: function (value) {
  27526. var _this = this;
  27527. this.code = value;
  27528. this.value = value;
  27529. _$2.defer(function () {
  27530. _this.isChangeFromOuter = true;
  27531. if (_this.editor) {
  27532. _this.editor.setValue(value);
  27533. }
  27534. });
  27535. },
  27536. getCode: function () {
  27537. return this.getValue();
  27538. },
  27539. updateOptions: function (options) {
  27540. if (this.editor && options) {
  27541. this.editor.updateOptions(options);
  27542. }
  27543. },
  27544. getValue: function () {
  27545. if (!this.editor) {
  27546. return this.code;
  27547. }
  27548. return this.editor.getValue();
  27549. },
  27550. applyPosition: function () {
  27551. var _this = this;
  27552. if (this.autoFocusMethod) {
  27553. if (this.editor) {
  27554. _$2.defer(function () {
  27555. if (_this.autoFocusStartLine) {
  27556. _this.editor.setPosition({
  27557. lineNumber: _this.autoFocusStartLine,
  27558. column: _this.autoFocusStartColumn
  27559. });
  27560. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27561. }
  27562. _this.editor.focus();
  27563. });
  27564. delete this.autoFocusMethod;
  27565. }
  27566. }
  27567. this.editor.layout();
  27568. },
  27569. setValue: function (value, fromEditor) {
  27570. this.setCode(value);
  27571. var me = this;
  27572. if (me.value === value) {
  27573. // 值相等,不需要变化
  27574. return;
  27575. }
  27576. if (fromEditor !== true && me.editor) {
  27577. // 不是来源于编辑器的变化,才设置编辑器的值
  27578. me.editor.setValue(value);
  27579. }
  27580. // 通知mixins setValue
  27581. me.value = value;
  27582. me.fireEvent('change', value);
  27583. },
  27584. initComponent: function () {
  27585. var that = this;
  27586. this.superclass.initComponent.call(this);
  27587. that.on({
  27588. resize: function () {
  27589. if (that.editor) {
  27590. that.editor.layout();
  27591. }
  27592. },
  27593. destory: function () {
  27594. if (that.editor) {
  27595. that.editor.dispose();
  27596. delete that.editor;
  27597. }
  27598. },
  27599. afterrender: function (sender) {
  27600. var $dom = $(that.el.dom).find('.editor');
  27601. attach_2($dom[0], {
  27602. value: that.code
  27603. }).then(function (editor) {
  27604. that.editor = editor;
  27605. that.applyPosition();
  27606. that.editor.onDidChangeModelContent(function (e) {
  27607. that.fireEvent('change', that.editor, e);
  27608. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27609. that.codeChange(that.editor.getValue(), that.name, e);
  27610. }
  27611. that.isChangeFromOuter = false;
  27612. });
  27613. });
  27614. }
  27615. });
  27616. }
  27617. });
  27618. }
  27619. function attach_2(element, opts) {
  27620. return new Promise(function (resolve) {
  27621. var monaco = window['monaco'];
  27622. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27623. enabled: false
  27624. } }));
  27625. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27626. // const sql = editor.getValue()
  27627. // if (_.trim(sql).length > 0) {
  27628. // editor.setValue(format(sql, {
  27629. // indent: ' ',
  27630. // uppercase: true,
  27631. // }))
  27632. // }
  27633. msg$1('没做');
  27634. });
  27635. editor.onKeyUp(function (e) {
  27636. // console.log(e)
  27637. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27638. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27639. }
  27640. });
  27641. resolve(editor);
  27642. });
  27643. }
  27644. //# sourceMappingURL=SqlEditor.js.map
  27645. function initTemplateEditor () {
  27646. Ext.define('com.yvan.studio.TemplateEditor', {
  27647. extend: 'Ext.panel.Panel',
  27648. alias: 'widget.templateeditor',
  27649. xtype: 'templateeditor',
  27650. layout: 'fit',
  27651. border: false,
  27652. html: "<div class=\"editor\"/>",
  27653. autoFocusMethod: true,
  27654. autoFocusStartLine: 0,
  27655. autoFocusStartColumn: 0,
  27656. codeChange: undefined,
  27657. funcArr: [],
  27658. modulePage: null,
  27659. isChangeFromOuter: false,
  27660. name: "",
  27661. /**
  27662. * 设置代码
  27663. */
  27664. setCode: function (value) {
  27665. var _this = this;
  27666. this.code = value;
  27667. _$2.defer(function () {
  27668. _this.isChangeFromOuter = true;
  27669. if (_this.editor) {
  27670. _this.editor.setValue(value);
  27671. }
  27672. });
  27673. },
  27674. getCode: function () {
  27675. var _a;
  27676. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27677. },
  27678. applyPosition: function () {
  27679. var _this = this;
  27680. if (this.autoFocusMethod) {
  27681. if (this.editor) {
  27682. _$2.defer(function () {
  27683. if (_this.autoFocusStartLine) {
  27684. _this.editor.setPosition({
  27685. lineNumber: _this.autoFocusStartLine,
  27686. column: _this.autoFocusStartColumn
  27687. });
  27688. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27689. }
  27690. _this.editor.focus();
  27691. });
  27692. delete this.autoFocusMethod;
  27693. }
  27694. }
  27695. this.editor.layout();
  27696. },
  27697. initComponent: function () {
  27698. var that = this;
  27699. this.superclass.initComponent.apply(this, arguments);
  27700. this.on({
  27701. resize: function (sender, width, height) {
  27702. if (that.editor) {
  27703. that.editor.layout();
  27704. }
  27705. },
  27706. destory: function () {
  27707. if (that.editor) {
  27708. that.editor.dispose();
  27709. delete that.editor;
  27710. }
  27711. },
  27712. afterrender: function (sender) {
  27713. var $dom = $(that.el.dom).find('.editor');
  27714. attach_117($dom[0], {
  27715. value: that.code
  27716. }).then(function (editor) {
  27717. that.editor = editor;
  27718. that.applyPosition();
  27719. that.editor.onDidChangeModelContent(function (e) {
  27720. that.fireEvent('change', that.editor, e);
  27721. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27722. that.codeChange(that.editor.getValue(), that.name, e);
  27723. }
  27724. that.isChangeFromOuter = false;
  27725. });
  27726. });
  27727. }
  27728. });
  27729. },
  27730. });
  27731. }
  27732. function attach_117(element, opts) {
  27733. return new Promise(function (resolve) {
  27734. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27735. enabled: false
  27736. } }));
  27737. editor.onKeyUp(function (e) {
  27738. // console.log(e)
  27739. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27740. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27741. }
  27742. });
  27743. resolve(editor);
  27744. });
  27745. }
  27746. //# sourceMappingURL=TemplateEditor.js.map
  27747. var DictStore = /** @class */ (function (_super) {
  27748. __extends(DictStore, _super);
  27749. function DictStore() {
  27750. return _super !== null && _super.apply(this, arguments) || this;
  27751. }
  27752. DictStore.prototype.getCacheKey = function (param) {
  27753. return "dict_data.json";
  27754. };
  27755. DictStore.prototype.invokeApi = function (param) {
  27756. return getDict(param);
  27757. };
  27758. DictStore.prototype.getDicts = function () {
  27759. return this.apiResponse.data.dict;
  27760. };
  27761. DictStore.prototype.getDictCodes = function () {
  27762. return new Promise(function (resolve) {
  27763. // reloadIfNeedPromise().then(() => {
  27764. // const result = []
  27765. // _.forEach(this.getDicts(), dictRow => {
  27766. // result.push({
  27767. // id: dictRow.dict_code,
  27768. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27769. // })
  27770. // })
  27771. // resolve(result)
  27772. // })
  27773. });
  27774. };
  27775. DictStore.prototype.saveDict = function (param) {
  27776. return saveDictApi(param);
  27777. };
  27778. DictStore.prototype.saveDictItems = function (param) {
  27779. return saveDictItemsApi(param);
  27780. };
  27781. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27782. var results = [];
  27783. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27784. if (dictItemRow.dict_code === dict_code) {
  27785. results.push(_$2.clone(dictItemRow));
  27786. }
  27787. });
  27788. return results;
  27789. };
  27790. return DictStore;
  27791. }(CacheStore));
  27792. var instance$2 = new DictStore();
  27793. //# sourceMappingURL=DictStore.js.map
  27794. var DictTreeController = /** @class */ (function () {
  27795. function DictTreeController() {
  27796. this._saveStateFlag = true;
  27797. }
  27798. DictTreeController.prototype.dictSave = function () {
  27799. var _this = this;
  27800. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27801. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27802. if (err) {
  27803. // 如果有异常就不保存
  27804. return;
  27805. }
  27806. // 进行业务上的逻辑校验,比如说必填校验等等
  27807. var hasError = false;
  27808. _$2.forEach(rows, function (row, i) {
  27809. if (isEmpty(row.dict_code)) {
  27810. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27811. hasError = true;
  27812. return false;
  27813. }
  27814. });
  27815. if (hasError) {
  27816. return;
  27817. }
  27818. // 设置当前界面为 "保存中..." 状态
  27819. this.view.setLoading(true);
  27820. instance$2.saveDict({
  27821. newRows: newRows,
  27822. modifyRows: modifyRows,
  27823. removeRecords: removeRecords,
  27824. }).then(function (res) {
  27825. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27826. msg$1(res.msg);
  27827. _this.reload();
  27828. }).finally(function () {
  27829. // 无论正常异常,关闭 "保存中..." 状态
  27830. _this.view.setLoading(false);
  27831. });
  27832. };
  27833. DictTreeController.prototype.dictItemSave = function () {
  27834. var _this = this;
  27835. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27836. var currentDictCode = undefined;
  27837. if (record) {
  27838. currentDictCode = record.get('dict_code');
  27839. }
  27840. if (!currentDictCode) {
  27841. msg$1('请选择一个字典');
  27842. return;
  27843. }
  27844. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27845. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27846. if (err) {
  27847. // 如果有异常就不保存
  27848. return;
  27849. }
  27850. // 进行业务上的逻辑校验,比如说必填校验等等
  27851. var hasError = false;
  27852. _$2.forEach(rows, function (row, i) {
  27853. if (!row.dict_value && row.dict_value !== 0) {
  27854. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27855. hasError = true;
  27856. return false;
  27857. }
  27858. });
  27859. if (hasError) {
  27860. return;
  27861. }
  27862. // 设置当前界面为 "保存中..." 状态
  27863. this.view.setLoading(true);
  27864. instance$2.saveDictItems({
  27865. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27866. newRows: newRows,
  27867. modifyRows: modifyRows,
  27868. removeRecords: removeRecords,
  27869. dict_code: currentDictCode
  27870. }).then(function (res) {
  27871. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27872. msg$1(res.msg);
  27873. _this.reload();
  27874. }).finally(function () {
  27875. // 无论正常异常,关闭 "保存中..." 状态
  27876. _this.view.setLoading(false);
  27877. });
  27878. };
  27879. DictTreeController.prototype.createDictEnum = function () {
  27880. var _this = this;
  27881. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27882. var currentDictCode = undefined;
  27883. if (record) {
  27884. currentDictCode = record.get('dict_code');
  27885. }
  27886. if (!currentDictCode) {
  27887. msg$1('请选择一个字典');
  27888. return;
  27889. }
  27890. // 设置当前界面为 "保存中..." 状态
  27891. this.view.setLoading(true);
  27892. createDictEnum({ dictCode: currentDictCode })
  27893. .then(function () { return _this.reload(); })
  27894. .finally(function () { return _this.view.setLoading(false); });
  27895. };
  27896. DictTreeController.prototype.onLoad = function () {
  27897. setDictTree(this);
  27898. this.grid1 = this.view.lookupReference('grid1');
  27899. this.grid2 = this.view.lookupReference('grid2');
  27900. this.grid1.setData([]);
  27901. this.grid2.setData([]);
  27902. // this.grid1.columns[0].hide()
  27903. this.grid2.columns[0].hide();
  27904. // 找管理器订阅刷新的事件
  27905. instance$2.registe(this.refreshData.bind(this));
  27906. // 非强制性刷新 DbManager
  27907. instance$2.reloadIfNeed(undefined);
  27908. };
  27909. DictTreeController.prototype.onDestory = function () {
  27910. instance$2.unregiste(this.refreshData.bind(this));
  27911. };
  27912. // dictStore 刷新时,会回调到这个方法
  27913. DictTreeController.prototype.refreshData = function (isLoadingState) {
  27914. var me = this;
  27915. if (typeof isLoadingState === 'boolean') {
  27916. me.view.setLoading(isLoadingState);
  27917. return;
  27918. }
  27919. this.grid1.setData(instance$2.getDicts());
  27920. this.restoreState();
  27921. };
  27922. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  27923. var _this = this;
  27924. _$2.defer(function () {
  27925. _this.saveState();
  27926. });
  27927. if (!record) {
  27928. this.grid2.setData([]);
  27929. return;
  27930. }
  27931. var dict_code = record.get('dict_code');
  27932. var data = instance$2.getDictItemByDictcode(dict_code);
  27933. this.grid2.setData(data);
  27934. };
  27935. DictTreeController.prototype.reload = function () {
  27936. var _this = this;
  27937. // 强制刷新 DbManager
  27938. instance$2.reloadForce(undefined).then(function (res) {
  27939. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  27940. });
  27941. };
  27942. DictTreeController.prototype.dictAdd = function () {
  27943. this.grid1.appendEditRow({
  27944. _createFlag: true,
  27945. dict_code: '',
  27946. dict_desc: '',
  27947. }, 0);
  27948. };
  27949. DictTreeController.prototype.dictRemove = function () {
  27950. this.grid1.removeEditRow();
  27951. };
  27952. DictTreeController.prototype.dictItemAdd = function () {
  27953. var _a, _b;
  27954. 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;
  27955. if (!dict_code) {
  27956. msg$1('请先保存字典');
  27957. return;
  27958. }
  27959. this.grid2.appendEditRow({
  27960. dict_code: dict_code,
  27961. dict_text: '',
  27962. dict_value: '',
  27963. }, 0);
  27964. };
  27965. DictTreeController.prototype.dictItemRemove = function () {
  27966. var _this = this;
  27967. var rows = [];
  27968. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  27969. rows.push(r);
  27970. });
  27971. _$2.forEach(rows, function (r) {
  27972. _this.grid2.getStore().remove(r);
  27973. });
  27974. };
  27975. DictTreeController.prototype.clearSearch1 = function () {
  27976. this.grid1.store.clearFilter();
  27977. };
  27978. DictTreeController.prototype.search1 = function (sender) {
  27979. this.grid1.store.clearFilter();
  27980. this.getViewModel().set('grid1.selection', null);
  27981. this.grid1.fireEvent('itemselect');
  27982. var value = _$2.lowerCase(sender.getRawValue()).trim();
  27983. if (!value) {
  27984. return;
  27985. }
  27986. this.grid1.store.filterBy(function (record) {
  27987. if (record.get('_createFlag')) {
  27988. return true;
  27989. }
  27990. var dict_code = _$2.lowerCase(record.get('dict_code'));
  27991. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  27992. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  27993. return (dict_code.includes(value) ||
  27994. dict_desc.includes(value) ||
  27995. dict_desc_py.includes(value));
  27996. });
  27997. };
  27998. DictTreeController.prototype.clearSearch2 = function () {
  27999. this.grid2.store.clearFilter();
  28000. };
  28001. DictTreeController.prototype.search2 = function (sender) {
  28002. this.grid2.store.clearFilter();
  28003. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28004. if (!value) {
  28005. return;
  28006. }
  28007. this.grid2.store.filterBy(function (record) {
  28008. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28009. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28010. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28011. return (dict_text.includes(value) ||
  28012. dict_value === value ||
  28013. dict_text_py.includes(value));
  28014. });
  28015. };
  28016. DictTreeController.prototype.getStateFilename = function () {
  28017. return getCurrentProject().uuid + "/dicttree.json";
  28018. };
  28019. DictTreeController.prototype.restoreState = function () {
  28020. var _this = this;
  28021. var grid = this.grid1;
  28022. native.loadFile(this.getStateFilename(), function (content) {
  28023. if (!content)
  28024. return;
  28025. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28026. _this._saveStateFlag = false;
  28027. if (selection) {
  28028. var idx = grid.store.findExact('dict_code', selection);
  28029. if (idx >= 0) {
  28030. var record = grid.store.getAt(idx);
  28031. if (record) {
  28032. grid.setSelection([record]);
  28033. }
  28034. }
  28035. }
  28036. if (scrollPosition && scrollSize) {
  28037. var size = grid.scrollable.getSize();
  28038. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28039. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28040. }
  28041. }
  28042. setTimeout(function () {
  28043. _this._saveStateFlag = true;
  28044. }, 200);
  28045. });
  28046. };
  28047. DictTreeController.prototype.saveState = function () {
  28048. if (!this._saveStateFlag) {
  28049. return;
  28050. }
  28051. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28052. var selection = undefined;
  28053. if (record) {
  28054. selection = record.get('dict_code');
  28055. }
  28056. var scrollPosition = this.grid1.scrollable.position;
  28057. var scrollSize = this.grid1.scrollable.getSize();
  28058. native.saveFile(this.getStateFilename(), {
  28059. selection: selection,
  28060. scrollPosition: scrollPosition,
  28061. scrollSize: scrollSize
  28062. });
  28063. };
  28064. return DictTreeController;
  28065. }());
  28066. //# sourceMappingURL=DictTreeController.js.map
  28067. function initDict$1 () {
  28068. var controller = new DictTreeController();
  28069. Ext.define('com.yvan.studio.DictTree', {
  28070. extend: 'Ext.panel.Panel',
  28071. xtype: 'dicttree',
  28072. controller: controller,
  28073. scope: controller,
  28074. referenceHolder: true,
  28075. tooltip: '字典',
  28076. iconCls: 'x-fa fa-book',
  28077. rootVisible: false,
  28078. useArrows: true,
  28079. reference: 'dicttree',
  28080. layout: 'border',
  28081. listeners: {
  28082. afterrender: 'onLoad',
  28083. destory: 'onDestory',
  28084. },
  28085. items: [
  28086. {
  28087. region: 'center',
  28088. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28089. _mode: 'select',
  28090. tbar: [
  28091. {
  28092. xtype: 'button',
  28093. tooltip: '刷新',
  28094. iconCls: 'x-fa fa-refresh',
  28095. listeners: {
  28096. click: 'reload'
  28097. }
  28098. },
  28099. {
  28100. xtype: 'button',
  28101. tooltip: '添加',
  28102. iconCls: 'x-fa fa-plus-circle',
  28103. listeners: {
  28104. click: 'dictAdd'
  28105. }
  28106. },
  28107. {
  28108. xtype: 'button',
  28109. tooltip: '删除',
  28110. iconCls: 'x-fa fa-minus-circle',
  28111. bind: {
  28112. disabled: '{!grid1.selection}'
  28113. },
  28114. listeners: {
  28115. click: 'dictRemove'
  28116. }
  28117. },
  28118. {
  28119. xtype: 'button',
  28120. tooltip: '保存',
  28121. iconCls: 'x-fa fa-save',
  28122. bind: {
  28123. disabled: '{!grid1.ischanged}'
  28124. },
  28125. listeners: {
  28126. click: 'dictSave'
  28127. }
  28128. },
  28129. {
  28130. xtype: 'textfield',
  28131. hideClear: true,
  28132. triggers: {
  28133. clear: {
  28134. cls: 'x-form-clear-trigger',
  28135. handler: 'clearSearch1'
  28136. },
  28137. },
  28138. flex: 1,
  28139. emptyText: '搜索过滤',
  28140. enableKeyEvents: true,
  28141. listeners: {
  28142. keyup: {
  28143. fn: 'search1',
  28144. buffer: 50
  28145. }
  28146. }
  28147. },
  28148. ],
  28149. listeners: {
  28150. itemselect: 'grid1Selected',
  28151. },
  28152. idField: 'dict_code',
  28153. columns: [
  28154. {
  28155. text: '字典编号', dataIndex: 'dict_code',
  28156. menuDisabled: true, flex: 1,
  28157. editor: {
  28158. allowBlank: true,
  28159. selectOnFocus: false
  28160. }
  28161. },
  28162. {
  28163. text: '中文描述', dataIndex: 'dict_desc',
  28164. menuDisabled: true, flex: 1,
  28165. editor: {
  28166. allowBlank: true,
  28167. selectOnFocus: false
  28168. }
  28169. },
  28170. ]
  28171. },
  28172. {
  28173. region: 'south', height: '50%',
  28174. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28175. split: true,
  28176. _mode: 'edit1',
  28177. listeners: {},
  28178. tbar: [
  28179. {
  28180. xtype: 'button',
  28181. tooltip: '添加',
  28182. iconCls: 'x-fa fa-plus-circle',
  28183. bind: {
  28184. disabled: '{!grid1.selection}'
  28185. },
  28186. listeners: {
  28187. click: 'dictItemAdd'
  28188. }
  28189. },
  28190. {
  28191. xtype: 'button',
  28192. tooltip: '删除',
  28193. iconCls: 'x-fa fa-minus-circle',
  28194. bind: {
  28195. disabled: '{!grid1.selection}'
  28196. },
  28197. listeners: {
  28198. click: 'dictItemRemove'
  28199. }
  28200. },
  28201. {
  28202. xtype: 'button',
  28203. tooltip: '保存',
  28204. iconCls: 'x-fa fa-save',
  28205. bind: {
  28206. disabled: '{!grid2.ischanged}'
  28207. },
  28208. listeners: {
  28209. click: 'dictItemSave'
  28210. }
  28211. },
  28212. {
  28213. xtype: 'button',
  28214. tooltip: '刷新代码',
  28215. iconCls: 'x-fa fa-code',
  28216. bind: {
  28217. disabled: '{!grid1.selection}'
  28218. },
  28219. listeners: {
  28220. click: 'createDictEnum'
  28221. }
  28222. },
  28223. ],
  28224. columns: [
  28225. {
  28226. text: '字典项', dataIndex: 'dict_text',
  28227. menuDisabled: true, flex: 1,
  28228. editor: {
  28229. allowBlank: true,
  28230. selectOnFocus: false
  28231. }
  28232. },
  28233. {
  28234. text: '字典值', dataIndex: 'dict_value',
  28235. menuDisabled: true, flex: 1,
  28236. dataType: 'int',
  28237. editor: {
  28238. xtype: 'numberfield',
  28239. allowBlank: true,
  28240. selectOnFocus: false
  28241. }
  28242. },
  28243. {
  28244. text: '激活', dataIndex: 'is_enable',
  28245. xtype: 'checkcolumn', menuDisabled: true,
  28246. },
  28247. {
  28248. text: '变量名', dataIndex: 'var_name',
  28249. menuDisabled: true, flex: 1,
  28250. editor: {
  28251. allowBlank: true,
  28252. selectOnFocus: false
  28253. }
  28254. },
  28255. ]
  28256. }
  28257. ]
  28258. });
  28259. }
  28260. //# sourceMappingURL=DictTree.js.map
  28261. var model$g = {
  28262. data: {
  28263. form: {
  28264. path: "",
  28265. requestBody: "",
  28266. responseBody: "",
  28267. }
  28268. }
  28269. };
  28270. var vjson$f = {
  28271. title: '接口信息',
  28272. layout: 'fit',
  28273. width: 800,
  28274. height: 500,
  28275. items: [
  28276. {
  28277. xtype: 'form',
  28278. layout: {
  28279. type: 'vbox',
  28280. pack: 'start',
  28281. align: 'stretch'
  28282. },
  28283. defaults: {
  28284. border: false,
  28285. anchor: '100%',
  28286. margin: '5',
  28287. },
  28288. items: [
  28289. {
  28290. xtype: 'textfield',
  28291. fieldLabel: '接口路径',
  28292. bind: {
  28293. value: "{form.path}",
  28294. },
  28295. },
  28296. {
  28297. xtype: 'textareafield',
  28298. // height: 150,
  28299. flex: 2,
  28300. fieldLabel: '请求数据',
  28301. bind: {
  28302. value: "{form.requestBody}",
  28303. },
  28304. },
  28305. {
  28306. xtype: 'textareafield',
  28307. // height: 150,
  28308. flex: 5,
  28309. fieldLabel: '响应数据',
  28310. bind: {
  28311. value: "{form.responseBody}",
  28312. },
  28313. },
  28314. ]
  28315. }
  28316. ]
  28317. };
  28318. var ApiInfoDialog = /** @class */ (function (_super) {
  28319. __extends(ApiInfoDialog, _super);
  28320. function ApiInfoDialog() {
  28321. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28322. }
  28323. return ApiInfoDialog;
  28324. }(Scope));
  28325. //# sourceMappingURL=apiInfoDialog.js.map
  28326. var model$h = {
  28327. data: {
  28328. query: {
  28329. role_id: '',
  28330. resource_id: '',
  28331. },
  28332. form: {},
  28333. form2: {
  28334. key: "",
  28335. start_at: "",
  28336. end_at: "",
  28337. }
  28338. }
  28339. };
  28340. var vjson$g = {
  28341. title: '接口信息',
  28342. layout: 'fit',
  28343. items: [
  28344. {
  28345. layout: 'border',
  28346. border: false,
  28347. items: [
  28348. {
  28349. region: 'center',
  28350. layout: 'border',
  28351. items: [
  28352. {
  28353. region: 'north',
  28354. bind: {
  28355. title: '{form.title}',
  28356. },
  28357. xtype: 'form',
  28358. scrollable: true,
  28359. layout: {
  28360. type: 'vbox',
  28361. pack: 'start',
  28362. align: 'stretch'
  28363. },
  28364. defaults: {
  28365. border: false,
  28366. anchor: '100%',
  28367. margin: '5',
  28368. },
  28369. tbar: {
  28370. xtype: 'toolbar',
  28371. items: [
  28372. {
  28373. xtype: 'button',
  28374. text: '查询',
  28375. iconCls: 'x-fa fa-search',
  28376. listeners: {
  28377. click: 'scope.requestLogs'
  28378. },
  28379. },
  28380. {
  28381. xtype: 'button',
  28382. text: '保存',
  28383. iconCls: 'x-fa fa-save',
  28384. listeners: {},
  28385. },
  28386. {
  28387. xtype: 'button',
  28388. text: '禁用',
  28389. iconCls: 'x-fa fa-stop-circle',
  28390. bind: {},
  28391. listeners: {},
  28392. },
  28393. {
  28394. xtype: 'button',
  28395. text: '启用',
  28396. iconCls: 'x-fa fa-play-circle',
  28397. bind: {},
  28398. listeners: {},
  28399. },
  28400. ],
  28401. },
  28402. items: [
  28403. {
  28404. xtype: 'cols',
  28405. defaults: { labelWidth: 120 },
  28406. items: [
  28407. {
  28408. xtype: 'textfield',
  28409. fieldLabel: 'URL',
  28410. bind: {
  28411. value: '{form.api_url}',
  28412. },
  28413. readOnly: true,
  28414. },
  28415. {
  28416. xtype: 'textfield',
  28417. fieldLabel: '名称',
  28418. bind: {
  28419. value: '{form.api_name}',
  28420. },
  28421. readOnly: true,
  28422. },
  28423. ],
  28424. },
  28425. {
  28426. xtype: 'cols',
  28427. defaults: { labelWidth: 120 },
  28428. items: [
  28429. {
  28430. xtype: 'textfield',
  28431. fieldLabel: '实现类',
  28432. bind: {
  28433. value: '{form.api_class}',
  28434. },
  28435. readOnly: true,
  28436. },
  28437. {
  28438. border: false,
  28439. flex: 1
  28440. },
  28441. ]
  28442. },
  28443. {
  28444. xtype: 'cols',
  28445. defaults: { labelWidth: 120 },
  28446. items: [
  28447. {
  28448. xtype: 'textfield',
  28449. fieldLabel: '超时时间',
  28450. bind: {
  28451. value: '{form.timeout}',
  28452. },
  28453. readOnly: true,
  28454. },
  28455. {
  28456. border: false,
  28457. flex: 1
  28458. },
  28459. ]
  28460. },
  28461. {
  28462. xtype: 'cols',
  28463. defaults: { labelWidth: 120 },
  28464. items: [
  28465. {
  28466. xtype: 'textfield',
  28467. fieldLabel: 'Remote IP',
  28468. bind: {
  28469. value: '{form.remote_ip}',
  28470. },
  28471. readOnly: true,
  28472. },
  28473. {
  28474. border: false,
  28475. flex: 1
  28476. },
  28477. ]
  28478. },
  28479. {
  28480. xtype: 'cols',
  28481. defaults: { labelWidth: 120 },
  28482. items: [
  28483. {
  28484. xtype: 'textfield',
  28485. fieldLabel: '解析表单',
  28486. bind: {
  28487. value: '{form.chandi}',
  28488. },
  28489. readOnly: true,
  28490. },
  28491. {
  28492. border: false,
  28493. flex: 1
  28494. },
  28495. ]
  28496. },
  28497. ],
  28498. },
  28499. {
  28500. region: 'center',
  28501. // title: 'Request',
  28502. layout: 'border',
  28503. items: [
  28504. {
  28505. region: 'north',
  28506. xtype: 'form',
  28507. reference: 'form2',
  28508. split: true,
  28509. items: [
  28510. {
  28511. xtype: 'cols',
  28512. width: 700,
  28513. items: [
  28514. {
  28515. xtype: 'textfield',
  28516. fieldLabel: '关键字',
  28517. bind: {
  28518. value: "{form2.key}"
  28519. },
  28520. },
  28521. {
  28522. xtype: 'datefield',
  28523. fieldLabel: '开始时间',
  28524. bind: {
  28525. value: "{form2.start_at}"
  28526. },
  28527. },
  28528. {
  28529. xtype: 'datefield',
  28530. fieldLabel: '结束时间',
  28531. bind: {
  28532. value: "{form2.end_at}"
  28533. },
  28534. },
  28535. ]
  28536. }
  28537. ]
  28538. },
  28539. {
  28540. region: 'center',
  28541. xtype: 'yvgrid',
  28542. layout: 'fit',
  28543. reference: 'grid1',
  28544. pagination: true,
  28545. autoLoad: false,
  28546. selModel: {
  28547. selType: 'rowmodel',
  28548. mode: 'SINGLE',
  28549. },
  28550. dataSource: {
  28551. method: 'invoke',
  28552. url: '/sys/api/Api@requestLogs',
  28553. params: {
  28554. formData: '{form2}',
  28555. path: '{form.api_url}',
  28556. },
  28557. },
  28558. listeners: {
  28559. rowdblclick: 'scope.showDialog',
  28560. },
  28561. columns: [
  28562. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28563. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28564. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28565. { dataIndex: "size", header: "大小", width: 80 },
  28566. { dataIndex: "path", header: "path", flex: 1 },
  28567. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28568. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28569. ]
  28570. }
  28571. ]
  28572. },
  28573. ],
  28574. },
  28575. ],
  28576. },
  28577. ],
  28578. referenceHolder: true,
  28579. };
  28580. var Api = /** @class */ (function (_super) {
  28581. __extends(Api, _super);
  28582. function Api() {
  28583. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28584. }
  28585. Api.prototype.onLoad = function () {
  28586. _super.prototype.onLoad.call(this);
  28587. this.requestLogs();
  28588. };
  28589. Api.prototype.selectList = function (sender, selected, eOpts) {
  28590. this.viewModel.set("form", selected.data);
  28591. if (selected.data.api_type === '1') {
  28592. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28593. }
  28594. else {
  28595. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28596. }
  28597. };
  28598. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28599. var sel = [];
  28600. _$2.forEach(records, function (item) {
  28601. if (item.data.flg === 'Y') {
  28602. sel.push(item);
  28603. }
  28604. });
  28605. this.refs.methodGrid.selModel.select(sel);
  28606. };
  28607. Api.prototype.saveAll = function () {
  28608. var _this = this;
  28609. var _a, _b, _c;
  28610. var role_id = this.viewModel.get("query.role_id");
  28611. if (!role_id) {
  28612. msg$1("请先选择一个角色");
  28613. return;
  28614. }
  28615. var wh_id = this.viewModel.get("form.wh_id");
  28616. if (!wh_id) {
  28617. msg$1("请先选择一个仓库");
  28618. return;
  28619. }
  28620. var menus = this.refs.theTree.getChecked();
  28621. var rowsMenus = [];
  28622. _$2.forEach(menus, function (m) {
  28623. if (m.data.resource_id) {
  28624. rowsMenus.push(m.data.resource_id);
  28625. }
  28626. });
  28627. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28628. 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; });
  28629. _$2.remove(mm, function (x) {
  28630. return methodsArry.includes(x.resource_id);
  28631. });
  28632. var rowsBtn = [];
  28633. _$2.forEach(mm, function (m) {
  28634. rowsBtn.push({ resource_id: m.resource_id });
  28635. });
  28636. this.setLoading(true);
  28637. invokeServer$1('/sys/role/Role@saveAll', {
  28638. wh_id: wh_id,
  28639. role_id: role_id,
  28640. rowsMenus: rowsMenus,
  28641. rowsBtn: rowsBtn,
  28642. }).then(function (res) {
  28643. msg$1(res.msg);
  28644. if (res.success) {
  28645. _this.reloadTree();
  28646. // this.viewModel.set('query.role_id', '')
  28647. _this.viewModel.set('query.resource_id', '');
  28648. _this.refs.methodGrid.reload();
  28649. }
  28650. }).finally(function () {
  28651. _this.setLoading(false);
  28652. });
  28653. };
  28654. Api.prototype.editRoleSuccess = function (sender, data) {
  28655. if (data.success) {
  28656. this.refs.roleGrid.reload();
  28657. this.viewModel.set("query.JIAOS_ID", "");
  28658. this.reloadTree();
  28659. this.viewModel.set("query.CAID_ID", "");
  28660. this.refs.methodGrid.reload();
  28661. }
  28662. };
  28663. Api.prototype.deleteRole = function (sender) {
  28664. var _this = this;
  28665. var role_id = this.viewModel.get("query.role_id");
  28666. if (!role_id) {
  28667. msg$1("请先选择一个角色");
  28668. return;
  28669. }
  28670. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28671. if (btn === 'yes') {
  28672. invokeServer$1('/sys/role/Role@deleteRole', {
  28673. role_id: role_id,
  28674. wh_id: window['whId']
  28675. }).then(function (res) {
  28676. msg$1(res.msg);
  28677. if (res.success) {
  28678. _this.refs.roleGrid.reload();
  28679. _this.viewModel.set("query.role_id", "");
  28680. _this.reloadTree();
  28681. _this.refs.methodGrid.reload();
  28682. }
  28683. });
  28684. }
  28685. });
  28686. };
  28687. Api.prototype.reloadTree = function () {
  28688. showErrorDialog$1('reloadTree 不存在');
  28689. };
  28690. Api.prototype.whChange = function (sender, value) {
  28691. this.viewModel.set("form.wh_id", value);
  28692. this.reloadTree();
  28693. this.refs.methodGrid.reload();
  28694. };
  28695. Api.prototype.requestLogs = function () {
  28696. var path = this.viewModel.get("form.api_url");
  28697. if (!path)
  28698. return;
  28699. this.refs.grid1.reload();
  28700. };
  28701. Api.prototype.showDialog = function (sender) {
  28702. var _a, _b;
  28703. 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; });
  28704. if (!rows || rows.length <= 0)
  28705. return;
  28706. var dialog = new ApiInfoDialog();
  28707. dialog.showDialog(null, {}, {
  28708. data: {
  28709. form: __assign({}, rows[0])
  28710. }
  28711. });
  28712. };
  28713. return Api;
  28714. }(Scope));
  28715. //# sourceMappingURL=ApiPage.js.map
  28716. var Controller = /** @class */ (function () {
  28717. function Controller() {
  28718. }
  28719. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28720. var _a, _b, _c, _d, _e, _f, _g, _h;
  28721. // @ts-ignore
  28722. 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; });
  28723. if (!rows || rows.length <= 0)
  28724. return;
  28725. var apiPage = new Api();
  28726. apiPage.showPage({
  28727. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28728. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28729. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28730. }, {
  28731. data: {
  28732. form: __assign({}, rows[0])
  28733. }
  28734. });
  28735. };
  28736. return Controller;
  28737. }());
  28738. var controller = new Controller();
  28739. function initApiTree () {
  28740. Ext.define('com.yvan.studio.ApiGrid', {
  28741. extend: 'Ext.Panel',
  28742. xtype: 'apigrid',
  28743. controller: controller,
  28744. scope: controller,
  28745. referenceHolder: true,
  28746. layout: 'fit',
  28747. items: [
  28748. {
  28749. width: 400,
  28750. split: true,
  28751. xtype: 'yvgrid',
  28752. reference: 'roleGrid',
  28753. border: false,
  28754. pagination: false,
  28755. autoLoad: true,
  28756. remoteFilter: false,
  28757. selModel: {
  28758. selType: 'rowmodel',
  28759. mode: 'SINGLE',
  28760. },
  28761. tbar: {
  28762. xtype: 'toolbar',
  28763. items: [
  28764. {
  28765. xtype: 'button',
  28766. text: '新增',
  28767. iconCls: 'x-fa fa-plus-circle',
  28768. listeners: {},
  28769. },
  28770. {
  28771. xtype: 'button',
  28772. text: '删除',
  28773. iconCls: 'x-fa fa-trash',
  28774. bind: {
  28775. disabled: '{roleGrid.selection==null}',
  28776. },
  28777. listeners: {},
  28778. },
  28779. ],
  28780. },
  28781. dataSource: {
  28782. url: '/sys/api/Api@getApiList',
  28783. method: 'invoke',
  28784. params: {},
  28785. },
  28786. listeners: {
  28787. itemdblclick: "selectList",
  28788. },
  28789. columns: [
  28790. {
  28791. dataIndex: 'api_name',
  28792. header: '接口名称',
  28793. filter: { type: 'string' },
  28794. flex: 1,
  28795. },
  28796. ],
  28797. },
  28798. ]
  28799. });
  28800. }
  28801. //# sourceMappingURL=ApiTree.js.map
  28802. var model$i = {
  28803. data: {
  28804. iframeSrc: ''
  28805. }
  28806. };
  28807. var vjson$h = {
  28808. layout: 'fit',
  28809. border: false,
  28810. iconCls: 'x-fa fa-newspaper-o',
  28811. referenceHolder: true,
  28812. items: [
  28813. {
  28814. // title: 'view.design',
  28815. xtype: 'uxiframe',
  28816. layout: 'fit',
  28817. // cls: 'module_page_iframe',
  28818. reference: 'iframe',
  28819. listeners: {
  28820. afterrender: 'scope.iframeRender'
  28821. }
  28822. },
  28823. ]
  28824. };
  28825. var Iframe = /** @class */ (function (_super) {
  28826. __extends(Iframe, _super);
  28827. function Iframe(path) {
  28828. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28829. _this.path = "";
  28830. _this.path = path;
  28831. return _this;
  28832. }
  28833. Iframe.prototype.iframeRender = function (sender) {
  28834. var $dom = $(sender.el.dom).find('iframe');
  28835. var iframe = $dom[0];
  28836. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28837. iframe.onload = function () {
  28838. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28839. };
  28840. };
  28841. return Iframe;
  28842. }(Scope));
  28843. //# sourceMappingURL=Iframe.js.map
  28844. var Controller$1 = /** @class */ (function () {
  28845. function Controller() {
  28846. }
  28847. Controller.prototype.onDblClick = function (sender, record) {
  28848. var data = record.raw;
  28849. if (data.text === "运行报表") {
  28850. this.openIframe("/xxl-job/index", "运行报表");
  28851. }
  28852. else if (data.text === "任务管理") {
  28853. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28854. }
  28855. else if (data.text === "调度日志") {
  28856. this.openIframe("/xxl-job/joblog", "调度日志");
  28857. }
  28858. else if (data.text === "执行器管理") {
  28859. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28860. }
  28861. };
  28862. Controller.prototype.openIframe = function (path, title) {
  28863. var page = new Iframe(path);
  28864. page.showPage({
  28865. title: title,
  28866. id: 'xxljob__' + path.replaceAll("/", "_"),
  28867. path: 'xxljob__' + path.replaceAll("/", "_"),
  28868. }, {});
  28869. };
  28870. Controller.prototype.onLoad = function () {
  28871. var me = this;
  28872. me.getView().setRootNode({
  28873. expanded: true,
  28874. leaf: false,
  28875. children: [
  28876. { leaf: true, text: '运行报表' },
  28877. { leaf: true, text: '任务管理' },
  28878. { leaf: true, text: '调度日志' },
  28879. { leaf: true, text: '执行器管理' },
  28880. ]
  28881. });
  28882. };
  28883. return Controller;
  28884. }());
  28885. var controller$1 = new Controller$1();
  28886. function initTaskTree () {
  28887. Ext.define('com.yvan.studio.TaskTree', {
  28888. extend: 'Ext.tree.Panel',
  28889. xtype: 'tasktree',
  28890. controller: controller$1,
  28891. scope: controller$1,
  28892. reference: 'roleGrid',
  28893. tooltip: '表单定义',
  28894. iconCls: 'x-fa fa-bar-chart',
  28895. useArrows: true,
  28896. rootVisible: false,
  28897. colspan: 2,
  28898. lines: true,
  28899. multiSelect: false,
  28900. referenceHolder: true,
  28901. // openNode() {
  28902. // const selection = this.getSelection()
  28903. // const [record] = selection
  28904. // if (!record) {
  28905. // return
  28906. // }
  28907. //
  28908. // const {raw} = record;
  28909. // if (raw.type === 'Dir') {
  28910. // return
  28911. // }
  28912. // if (raw.type === "Module" && raw.module) {
  28913. // // eventBus.publish(EventType.ModuleOpen, raw)
  28914. // }
  28915. // },
  28916. listeners: {
  28917. itemdblclick: 'onDblClick',
  28918. afterrender: "onLoad",
  28919. },
  28920. });
  28921. }
  28922. //# sourceMappingURL=TaskTree.js.map
  28923. var model$j = {
  28924. data: {
  28925. form: {
  28926. address: "",
  28927. level: "",
  28928. logger: "",
  28929. message: "",
  28930. nodeName: "",
  28931. serverName: "",
  28932. thread: "",
  28933. whId: "",
  28934. userId: "",
  28935. }
  28936. }
  28937. };
  28938. var vjson$i = {
  28939. title: '接口信息',
  28940. layout: 'fit',
  28941. width: 800,
  28942. height: 600,
  28943. items: [
  28944. {
  28945. xtype: 'form',
  28946. layout: {
  28947. type: 'vbox',
  28948. pack: 'start',
  28949. align: 'stretch'
  28950. },
  28951. defaults: {
  28952. border: false,
  28953. anchor: '100%',
  28954. margin: '5',
  28955. },
  28956. items: [
  28957. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  28958. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  28959. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  28960. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  28961. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  28962. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  28963. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  28964. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  28965. {
  28966. xtype: 'textareafield',
  28967. flex: 5,
  28968. fieldLabel: '响应数据',
  28969. bind: {
  28970. value: "{form.message}",
  28971. },
  28972. },
  28973. ]
  28974. }
  28975. ]
  28976. };
  28977. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  28978. __extends(ApiInfoDialog, _super);
  28979. function ApiInfoDialog() {
  28980. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  28981. }
  28982. return ApiInfoDialog;
  28983. }(Scope));
  28984. //# sourceMappingURL=LogPageDialog.js.map
  28985. var model$k = {
  28986. data: {
  28987. form2: {}
  28988. }
  28989. };
  28990. var vjson$j = {
  28991. title: '日志查询',
  28992. layout: 'fit',
  28993. width: "70%",
  28994. height: "80%",
  28995. items: [
  28996. {
  28997. region: 'center',
  28998. xtype: 'yvgrid',
  28999. layout: 'fit',
  29000. reference: 'grid1',
  29001. pagination: false,
  29002. autoLoad: false,
  29003. selModel: {
  29004. selType: 'rowmodel',
  29005. mode: 'SINGLE',
  29006. },
  29007. dataSource: {
  29008. method: 'invoke',
  29009. url: '/sys/api/Api@aroundLogs',
  29010. params: {
  29011. formData: '{form2}',
  29012. },
  29013. },
  29014. listeners: {
  29015. rowdblclick: 'scope.showDialog2',
  29016. },
  29017. columns: [
  29018. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29019. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29020. { dataIndex: "thread", header: "thread", width: 150 },
  29021. { dataIndex: "message", header: "message", flex: 1 },
  29022. ]
  29023. }
  29024. ]
  29025. };
  29026. var AroundLog = /** @class */ (function (_super) {
  29027. __extends(AroundLog, _super);
  29028. function AroundLog() {
  29029. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29030. }
  29031. AroundLog.prototype.onLoad = function () {
  29032. _super.prototype.onLoad.call(this);
  29033. this.queryLog();
  29034. };
  29035. AroundLog.prototype.queryLog = function () {
  29036. this.refs.grid1.reload();
  29037. };
  29038. AroundLog.prototype.showDialog2 = function () {
  29039. var _a, _b;
  29040. 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; });
  29041. if (!rows || rows.length <= 0)
  29042. return;
  29043. var dialog = new ApiInfoDialog$1();
  29044. dialog.showDialog(null, {}, {
  29045. data: {
  29046. form: __assign({}, rows[0])
  29047. }
  29048. });
  29049. };
  29050. return AroundLog;
  29051. }(Scope));
  29052. //# sourceMappingURL=AroundLog.js.map
  29053. var model$l = {
  29054. data: {
  29055. form2: {
  29056. key: "",
  29057. start_at: "",
  29058. end_at: "",
  29059. }
  29060. }
  29061. };
  29062. var vjson$k = {
  29063. title: '日志查询',
  29064. layout: 'fit',
  29065. tbar: {
  29066. xtype: 'toolbar',
  29067. items: [
  29068. {
  29069. xtype: 'button',
  29070. text: '刷新',
  29071. listeners: {
  29072. click: 'scope.queryLog'
  29073. },
  29074. },
  29075. {
  29076. xtype: 'button',
  29077. text: '周围日志',
  29078. bind: {},
  29079. listeners: {
  29080. click: 'scope.aroundLogs'
  29081. },
  29082. },
  29083. ],
  29084. },
  29085. items: [
  29086. {
  29087. region: 'center',
  29088. xtype: 'yvgrid',
  29089. layout: 'fit',
  29090. reference: 'grid1',
  29091. pagination: true,
  29092. autoLoad: false,
  29093. selModel: {
  29094. selType: 'rowmodel',
  29095. mode: 'SINGLE',
  29096. },
  29097. dataSource: {
  29098. method: 'invoke',
  29099. url: '/sys/api/Api@queryLog',
  29100. params: {
  29101. formData: '{form2}',
  29102. path: '{form.api_url}',
  29103. },
  29104. },
  29105. listeners: {
  29106. rowdblclick: 'scope.showDialog',
  29107. },
  29108. columns: [
  29109. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29110. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29111. { dataIndex: "thread", header: "thread", width: 150 },
  29112. { dataIndex: "message", header: "message", flex: 1 },
  29113. ]
  29114. }
  29115. ]
  29116. };
  29117. var LogPage = /** @class */ (function (_super) {
  29118. __extends(LogPage, _super);
  29119. function LogPage() {
  29120. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29121. }
  29122. LogPage.prototype.onLoad = function () {
  29123. _super.prototype.onLoad.call(this);
  29124. this.queryLog();
  29125. };
  29126. LogPage.prototype.queryLog = function () {
  29127. this.refs.grid1.reload();
  29128. };
  29129. LogPage.prototype.showDialog = function () {
  29130. var _a, _b;
  29131. 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; });
  29132. if (!rows || rows.length <= 0)
  29133. return;
  29134. var dialog = new ApiInfoDialog$1();
  29135. dialog.showDialog(null, {}, {
  29136. data: {
  29137. form: __assign({}, rows[0])
  29138. }
  29139. });
  29140. };
  29141. LogPage.prototype.aroundLogs = function () {
  29142. var _a, _b;
  29143. 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; });
  29144. if (!rows || rows.length <= 0)
  29145. return;
  29146. var dialog = new AroundLog();
  29147. dialog.showDialog(null, {}, {
  29148. data: {
  29149. form2: __assign({}, rows[0])
  29150. }
  29151. });
  29152. };
  29153. return LogPage;
  29154. }(Scope));
  29155. //# sourceMappingURL=LogPage.js.map
  29156. var Controller$2 = /** @class */ (function () {
  29157. function Controller() {
  29158. }
  29159. Controller.prototype.queryLog = function () {
  29160. var form2 = this.getViewModel().get("form2");
  29161. var logPage = new LogPage();
  29162. logPage.showPage({}, {
  29163. data: {
  29164. form2: __assign({}, form2)
  29165. }
  29166. });
  29167. };
  29168. return Controller;
  29169. }());
  29170. var controller$2 = new Controller$2();
  29171. function initLogsTree () {
  29172. Ext.define('com.yvan.studio.LogsTree', {
  29173. extend: 'Ext.panel.Panel',
  29174. xtype: 'logstree',
  29175. controller: controller$2,
  29176. scope: controller$2,
  29177. viewModel: {
  29178. data: {
  29179. form2: {
  29180. key: "",
  29181. start_at: "",
  29182. end_at: "",
  29183. }
  29184. }
  29185. },
  29186. reference: 'logstree',
  29187. tooltip: '表单定义',
  29188. iconCls: 'x-fa fa-bar-chart',
  29189. useArrows: true,
  29190. rootVisible: false,
  29191. colspan: 2,
  29192. lines: true,
  29193. multiSelect: false,
  29194. referenceHolder: true,
  29195. items: [
  29196. {
  29197. region: 'north',
  29198. xtype: 'form',
  29199. reference: 'form2',
  29200. split: true,
  29201. items: [
  29202. {
  29203. xtype: 'textfield',
  29204. fieldLabel: '关键字',
  29205. bind: {
  29206. value: "{form2.key}"
  29207. },
  29208. },
  29209. {
  29210. xtype: 'datefield',
  29211. fieldLabel: '开始时间',
  29212. bind: {
  29213. value: "{form2.start_at}"
  29214. },
  29215. },
  29216. {
  29217. xtype: 'datefield',
  29218. fieldLabel: '结束时间',
  29219. bind: {
  29220. value: "{form2.end_at}"
  29221. },
  29222. },
  29223. ]
  29224. },
  29225. {
  29226. xtype: "cols",
  29227. items: [
  29228. {
  29229. xtype: "box",
  29230. },
  29231. {
  29232. xtype: "button",
  29233. text: '查询',
  29234. listeners: {
  29235. click: 'queryLog'
  29236. },
  29237. },
  29238. {
  29239. xtype: "box",
  29240. },
  29241. ]
  29242. },
  29243. ],
  29244. });
  29245. }
  29246. //# sourceMappingURL=LogsTree.js.map
  29247. var model$m = {
  29248. data: {
  29249. // opsId: "",
  29250. // name: "",
  29251. running: false,
  29252. }
  29253. };
  29254. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29255. var vjson$l = {
  29256. bind: {
  29257. title: '运维-{name}',
  29258. },
  29259. layout: 'fit',
  29260. items: [
  29261. {
  29262. layout: 'border',
  29263. items: [
  29264. {
  29265. region: 'north',
  29266. items: [
  29267. {
  29268. xtype: 'toolbar',
  29269. border: false,
  29270. items: [
  29271. {
  29272. xtype: 'button',
  29273. text: '执行',
  29274. iconCls: 'x-fa fa-play',
  29275. bind: {
  29276. hidden: "{running}",
  29277. },
  29278. listeners: {
  29279. click: 'scope.start'
  29280. }
  29281. },
  29282. {
  29283. xtype: 'button',
  29284. text: '停止',
  29285. iconCls: 'x-fa fa-stop',
  29286. bind: {
  29287. hidden: "{!running}",
  29288. },
  29289. listeners: {
  29290. click: 'scope.stop'
  29291. }
  29292. },
  29293. ],
  29294. },
  29295. ]
  29296. },
  29297. {
  29298. region: 'center',
  29299. reference: 'terminal',
  29300. xtype: 'terminal',
  29301. },
  29302. ],
  29303. },
  29304. ],
  29305. };
  29306. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29307. var DevOpsTerminal = /** @class */ (function (_super) {
  29308. __extends(DevOpsTerminal, _super);
  29309. function DevOpsTerminal() {
  29310. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29311. _this.websocket = undefined;
  29312. return _this;
  29313. }
  29314. DevOpsTerminal.prototype.onLoad = function () {
  29315. this.load();
  29316. };
  29317. DevOpsTerminal.prototype.onDestroy = function () {
  29318. if (this.websocket) {
  29319. this.websocket.close();
  29320. this.websocket = undefined;
  29321. }
  29322. };
  29323. DevOpsTerminal.prototype.load = function () {
  29324. var _this = this;
  29325. var opsId = this.viewModel.get('opsId');
  29326. this.setLoading(true);
  29327. devOpsById(opsId).then(function (res) {
  29328. _this.viewModel.set('devOps', res.data);
  29329. }).finally(function () {
  29330. _this.setLoading(false);
  29331. });
  29332. };
  29333. DevOpsTerminal.prototype.start = function () {
  29334. var me = this;
  29335. var running = this.viewModel.get('running');
  29336. var devOps = this.viewModel.get('devOps');
  29337. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29338. return;
  29339. var devopsServer = "ws://122.9.140.63:9999";
  29340. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29341. this.websocket.addEventListener('open', function () {
  29342. me.viewModel.set('running', true);
  29343. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29344. });
  29345. this.websocket.addEventListener('message', function (event) {
  29346. me.refs.terminal.write(event.data);
  29347. });
  29348. this.websocket.addEventListener('close', function () {
  29349. me.stop();
  29350. });
  29351. this.websocket.addEventListener('error', function () {
  29352. me.stop();
  29353. });
  29354. };
  29355. DevOpsTerminal.prototype.stop = function () {
  29356. if (this.websocket) {
  29357. this.websocket.close();
  29358. this.websocket = undefined;
  29359. }
  29360. this.viewModel.set('running', false);
  29361. };
  29362. return DevOpsTerminal;
  29363. }(Scope));
  29364. //# sourceMappingURL=DevOpsTerminal.js.map
  29365. var Controller$3 = /** @class */ (function () {
  29366. function Controller() {
  29367. }
  29368. Controller.prototype.onLoad = function (sender) {
  29369. this.reload();
  29370. };
  29371. Controller.prototype.reload = function () {
  29372. var me = this;
  29373. // @ts-ignore
  29374. var view = me.getView();
  29375. view.setLoading(true);
  29376. devOpsList().then(function (res) {
  29377. view.setStore(new Ext.data.Store({
  29378. fields: ['ops_id', 'host', 'name'],
  29379. data: res.data,
  29380. }));
  29381. }).finally(function () {
  29382. view.setLoading(false);
  29383. });
  29384. };
  29385. Controller.prototype.onDblClick = function (sender) {
  29386. this.devOpsTerminal();
  29387. };
  29388. Controller.prototype.devOpsTerminal = function () {
  29389. // @ts-ignore
  29390. var view = this.getView();
  29391. var _a = __read(view.getSelection(), 1), record = _a[0];
  29392. if (record) {
  29393. var name = record.get('name');
  29394. var opsId = record.get('ops_id');
  29395. var instance = new DevOpsTerminal();
  29396. instance.showPage({
  29397. id: 'ops_' + opsId,
  29398. path: 'ops_' + opsId,
  29399. }, {
  29400. data: {
  29401. opsId: opsId,
  29402. name: name,
  29403. }
  29404. });
  29405. instance.dialogSuccess = function () {
  29406. };
  29407. }
  29408. };
  29409. return Controller;
  29410. }());
  29411. var controller$3 = new Controller$3();
  29412. function initDevOpsTree () {
  29413. Ext.define('com.yvan.studio.DevOpsGrid', {
  29414. extend: 'Ext.grid.Panel',
  29415. xtype: 'devopsgrid',
  29416. controller: controller$3,
  29417. scope: controller$3,
  29418. referenceHolder: true,
  29419. tooltip: '运维',
  29420. iconCls: 'x-fa fa-terminal',
  29421. useArrows: true,
  29422. reference: 'devopsgrid',
  29423. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29424. listeners: {
  29425. afterrender: 'onLoad',
  29426. itemdblclick: 'onDblClick',
  29427. },
  29428. viewConfig: {
  29429. // listeners: {
  29430. // itemcontextmenu: 'onGridContextMenu',
  29431. // },
  29432. },
  29433. tbar: {
  29434. xtype: 'toolbar',
  29435. items: [
  29436. {
  29437. xtype: 'button',
  29438. tooltip: '刷新',
  29439. iconCls: 'x-fa fa-refresh',
  29440. listeners: {
  29441. click: 'reload'
  29442. }
  29443. },
  29444. {
  29445. xtype: 'textfield',
  29446. flex: 1,
  29447. emptyText: '搜索过滤',
  29448. enableKeyEvents: true,
  29449. listeners: {
  29450. change: {
  29451. fn: 'filterChanged',
  29452. buffer: 50
  29453. }
  29454. }
  29455. },
  29456. ]
  29457. },
  29458. columns: [
  29459. {
  29460. text: 'ID', dataIndex: 'report_id',
  29461. hidden: true,
  29462. },
  29463. {
  29464. text: '服务器',
  29465. dataIndex: 'host',
  29466. width: 100,
  29467. menuDisabled: true,
  29468. },
  29469. {
  29470. text: '操作名称',
  29471. dataIndex: 'name',
  29472. flex: 1,
  29473. menuDisabled: true,
  29474. },
  29475. ]
  29476. });
  29477. }
  29478. //# sourceMappingURL=DevOpsTree.js.map
  29479. function initTerminal () {
  29480. Ext.define('com.yvan.studio.Terminal', {
  29481. extend: 'Ext.panel.Panel',
  29482. alias: 'widget.terminal',
  29483. xtype: 'terminal',
  29484. layout: 'fit',
  29485. border: false,
  29486. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29487. config: {},
  29488. write: function (str) {
  29489. if (this.term) {
  29490. this.term.write(str);
  29491. }
  29492. },
  29493. initComponent: function () {
  29494. var that = this;
  29495. this.superclass.initComponent.call(this, arguments);
  29496. that.on({
  29497. resize: function () {
  29498. var _a;
  29499. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29500. that.fitAddon.fit();
  29501. }
  29502. },
  29503. destory: function () {
  29504. if (that.term) {
  29505. that.term.dispose();
  29506. delete that.term;
  29507. }
  29508. if (that.fitAddon) {
  29509. that.fitAddon.dispose();
  29510. delete that.fitAddon;
  29511. }
  29512. },
  29513. afterrender: function (sender) {
  29514. _.defer(function () {
  29515. var $dom = $(that.el.dom).find('.terminal');
  29516. that.term = new xterm.Terminal({
  29517. // cursorBlink: false,
  29518. // cursorStyle: 'bar', // block underline bar
  29519. // enableBold: false,
  29520. // bellStyle: "sound",
  29521. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29522. // scrollback: 10000,
  29523. // tabStopWidth: 4,
  29524. disableStdin: true,
  29525. theme: {
  29526. // foreground: "#111",
  29527. // background: "#fdfdfd",
  29528. // background: "#fafafa",
  29529. },
  29530. });
  29531. that.fitAddon = new xtermAddonFit.FitAddon();
  29532. that.term.loadAddon(that.fitAddon);
  29533. that.term.open($dom[0]);
  29534. that.fitAddon.fit();
  29535. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29536. });
  29537. }
  29538. });
  29539. }
  29540. });
  29541. }
  29542. //# sourceMappingURL=Terminal.js.map
  29543. var vjson$m = {
  29544. title: '接口统计',
  29545. layout: 'fit',
  29546. items: [
  29547. {
  29548. title: '接口统计',
  29549. xtype: 'yvgrid',
  29550. enableLocking: false,
  29551. reference: 'grid1',
  29552. pagination: false,
  29553. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29554. tbar: {
  29555. xtype: 'form',
  29556. items: [
  29557. {
  29558. xtype: 'cols',
  29559. items: [
  29560. {
  29561. xtype: 'textfield',
  29562. fieldLabel: '搜索',
  29563. listeners: {
  29564. change: 'scope.requestFilterChange'
  29565. }
  29566. },
  29567. ]
  29568. },
  29569. ]
  29570. },
  29571. columns: [
  29572. { text: '地址', dataIndex: 'url', flex: 1 },
  29573. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29574. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29575. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29576. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29577. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29578. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29579. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29580. ],
  29581. leadingBufferZone: 8,
  29582. trailingBufferZone: 8,
  29583. viewConfig: {
  29584. listeners: {
  29585. expandbody: 'scope.onChildExpand'
  29586. }
  29587. },
  29588. listeners: {
  29589. itemdblclick: 'scope.itemClick1'
  29590. },
  29591. plugins: {
  29592. rowwidget: {
  29593. widget: {
  29594. xtype: 'yvgrid',
  29595. hideFootbar: true,
  29596. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29597. listeners: {
  29598. itemdblclick: 'scope.itemClick1'
  29599. },
  29600. columns: [
  29601. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29602. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29603. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29604. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29605. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29606. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29607. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29608. ]
  29609. }
  29610. }
  29611. }
  29612. },
  29613. ]
  29614. };
  29615. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29616. var model$n = {
  29617. data: {
  29618. count: 0,
  29619. dataSourceName: '',
  29620. sql: "",
  29621. histogram: '',
  29622. maxCost: 0,
  29623. minCost: 0,
  29624. avgCost: '',
  29625. sumCost: 0,
  29626. histogramInfos: [
  29627. // count: 1
  29628. // gteCost: 20
  29629. // ltCost: 50
  29630. // 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"
  29631. // topN: [
  29632. // cost: 24
  29633. // occurrenceTime: "1648004895171"
  29634. // 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"
  29635. // ]
  29636. ]
  29637. }
  29638. };
  29639. //# sourceMappingURL=PerformDialog.model.js.map
  29640. var vjson$n = {
  29641. title: '性能统计详情',
  29642. height: 400,
  29643. width: 800,
  29644. modal: true,
  29645. layout: 'fit',
  29646. items: [
  29647. {
  29648. xtype: 'tabpanel',
  29649. items: [
  29650. {
  29651. title: '摘要',
  29652. key: "1",
  29653. layout: 'border',
  29654. items: [
  29655. {
  29656. region: 'north',
  29657. border: false,
  29658. defaults: {
  29659. margin: '8 0 0 0'
  29660. },
  29661. items: [
  29662. {
  29663. xtype: 'cols',
  29664. defaultType: 'displayfield',
  29665. defaults: {
  29666. labelWidth: 70,
  29667. },
  29668. items: [
  29669. {
  29670. fieldLabel: 'count',
  29671. bind: {
  29672. value: '{count}'
  29673. }
  29674. },
  29675. {
  29676. fieldLabel: 'maxCost',
  29677. bind: {
  29678. value: '{maxCost}'
  29679. }
  29680. },
  29681. {
  29682. fieldLabel: 'minCost',
  29683. bind: {
  29684. value: '{minCost}'
  29685. }
  29686. },
  29687. {
  29688. fieldLabel: 'avgCost',
  29689. bind: {
  29690. value: '{avgCost}'
  29691. }
  29692. },
  29693. {
  29694. fieldLabel: 'sumCost',
  29695. bind: {
  29696. value: '{sumCost}'
  29697. }
  29698. },
  29699. ]
  29700. },
  29701. {
  29702. xtype: 'cols',
  29703. items: [
  29704. {
  29705. flex: 5,
  29706. border: false,
  29707. items: [
  29708. {
  29709. xtype: 'segmentedbutton',
  29710. reference: 'histogram',
  29711. allowToggle: false,
  29712. border: false,
  29713. items: []
  29714. }
  29715. ]
  29716. },
  29717. ]
  29718. },
  29719. ],
  29720. },
  29721. {
  29722. region: 'center',
  29723. xtype: 'sqleditor',
  29724. reference: 'sqlEditor',
  29725. },
  29726. ]
  29727. },
  29728. {
  29729. title: '直方图',
  29730. key: "2",
  29731. }
  29732. ]
  29733. }
  29734. ]
  29735. };
  29736. //# sourceMappingURL=PerformDialog.view.js.map
  29737. var PerformDialog = /** @class */ (function (_super) {
  29738. __extends(PerformDialog, _super);
  29739. function PerformDialog() {
  29740. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29741. }
  29742. PerformDialog.prototype.onLoad = function () {
  29743. var _this = this;
  29744. var sql = this.viewModel.get('sql');
  29745. var sql2 = sqlFormat.format(sql, {
  29746. indent: ' ',
  29747. uppercase: true,
  29748. });
  29749. var histogramInfos = this.viewModel.get('histogramInfos');
  29750. var vs = _$2.map(histogramInfos, function (v) {
  29751. if (v.ltCost > 2100000000) {
  29752. return {
  29753. text: "[" + v.gteCost + ", \u221E):" + v.count
  29754. };
  29755. }
  29756. return {
  29757. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29758. };
  29759. });
  29760. this.refs.sqlEditor.setCode(sql2);
  29761. _$2.forEach(vs, function (v) {
  29762. _this.refs.histogram.add(v);
  29763. });
  29764. };
  29765. return PerformDialog;
  29766. }(Scope));
  29767. //# sourceMappingURL=PerformDialog.js.map
  29768. var model$o = {
  29769. data: {}
  29770. };
  29771. var PerformStats = /** @class */ (function (_super) {
  29772. __extends(PerformStats, _super);
  29773. function PerformStats() {
  29774. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29775. _this.requestFilterChange = _.debounce(function (sender, value) {
  29776. var store = _this.refs.grid1.store;
  29777. store.clearFilter();
  29778. if (value) {
  29779. store.filterBy(function (record, id) {
  29780. var text = toString(record.get('url'));
  29781. // 用拼音筛选的方式
  29782. return text.includes(value);
  29783. });
  29784. }
  29785. }, 100);
  29786. return _this;
  29787. }
  29788. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29789. widget.setData(record.data.children);
  29790. };
  29791. PerformStats.prototype.itemClick1 = function (sender, record) {
  29792. console.log('itemClick1', record.data);
  29793. new PerformDialog().showDialog(sender, {}, {
  29794. data: record.data
  29795. });
  29796. };
  29797. PerformStats.prototype.onLoad = function () {
  29798. var _this = this;
  29799. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29800. .then(function (_a) {
  29801. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29802. var resData = reqRes.data;
  29803. var jdbcData = jdbcRes.data;
  29804. _.forEach(jdbcData, function (item) {
  29805. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29806. });
  29807. _.forEach(resData, function (item) {
  29808. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29809. if (_.isArray(item.sqls)) {
  29810. item.children = _.map(item.sqls, function (sql) {
  29811. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29812. }).filter(function (v) { return !!v; });
  29813. }
  29814. item.jdbcCount = _.size(item.children);
  29815. });
  29816. _this.refs.grid1.setData(resData);
  29817. // this.refs.grid2.setData(jdbcData)
  29818. });
  29819. };
  29820. return PerformStats;
  29821. }(Scope));
  29822. //# sourceMappingURL=InterfaceStatistics.js.map
  29823. var vjson$o = {
  29824. title: '性能统计',
  29825. layout: 'fit',
  29826. items: [
  29827. {
  29828. title: '数据库统计',
  29829. xtype: 'yvgrid',
  29830. enableLocking: false,
  29831. reference: 'grid2',
  29832. pagination: false,
  29833. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29834. tbar: {
  29835. xtype: 'form',
  29836. items: [
  29837. {
  29838. xtype: 'cols',
  29839. items: [
  29840. {
  29841. fieldLabel: '搜索',
  29842. listeners: {
  29843. change: 'scope.jdbcFilterChange'
  29844. }
  29845. },
  29846. ]
  29847. },
  29848. ]
  29849. },
  29850. listeners: {
  29851. itemdblclick: 'scope.itemClick1'
  29852. },
  29853. columns: [
  29854. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29855. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29856. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29857. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29858. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29859. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29860. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29861. ]
  29862. },
  29863. ]
  29864. };
  29865. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29866. var model$p = {
  29867. data: {}
  29868. };
  29869. var PerformStats$1 = /** @class */ (function (_super) {
  29870. __extends(PerformStats, _super);
  29871. function PerformStats() {
  29872. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  29873. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  29874. var store = _this.refs.grid2.store;
  29875. store.clearFilter();
  29876. if (value) {
  29877. store.filterBy(function (record, id) {
  29878. var text = toString(record.get('sql'));
  29879. // 用拼音筛选的方式
  29880. return text.includes(value);
  29881. });
  29882. }
  29883. }, 100);
  29884. return _this;
  29885. }
  29886. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29887. widget.setData(record.data.children);
  29888. };
  29889. PerformStats.prototype.itemClick1 = function (sender, record) {
  29890. console.log('itemClick1', record.data);
  29891. new PerformDialog().showDialog(sender, {}, {
  29892. data: record.data
  29893. });
  29894. };
  29895. PerformStats.prototype.onLoad = function () {
  29896. var _this = this;
  29897. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29898. .then(function (_a) {
  29899. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29900. var resData = reqRes.data;
  29901. var jdbcData = jdbcRes.data;
  29902. _.forEach(jdbcData, function (item) {
  29903. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29904. });
  29905. _.forEach(resData, function (item) {
  29906. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29907. if (_.isArray(item.sqls)) {
  29908. item.children = _.map(item.sqls, function (sql) {
  29909. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29910. }).filter(function (v) { return !!v; });
  29911. }
  29912. item.jdbcCount = _.size(item.children);
  29913. });
  29914. _this.refs.grid2.setData(jdbcData);
  29915. });
  29916. };
  29917. return PerformStats;
  29918. }(Scope));
  29919. //# sourceMappingURL=DatabaseStatistics.js.map
  29920. var Controller$4 = /** @class */ (function () {
  29921. function Controller() {
  29922. }
  29923. Controller.prototype.onDblClick = function (sender, record) {
  29924. var data = record.raw;
  29925. if (data.text === "接口统计") {
  29926. var page = new PerformStats();
  29927. page.showPage({
  29928. title: "接口统计",
  29929. id: '_InterfaceStatistics',
  29930. path: '_InterfaceStatistics',
  29931. }, {});
  29932. }
  29933. else if (data.text === "数据库统计") {
  29934. var page = new PerformStats$1();
  29935. page.showPage({
  29936. title: "数据库统计",
  29937. id: '_DatabaseStatistics',
  29938. path: '_DatabaseStatistics',
  29939. }, {});
  29940. }
  29941. };
  29942. Controller.prototype.onLoad = function () {
  29943. var me = this;
  29944. //@ts-ignore
  29945. var view = me.getView();
  29946. view.setRootNode({
  29947. expanded: true,
  29948. leaf: false,
  29949. children: [
  29950. { leaf: true, text: '接口统计' },
  29951. { leaf: true, text: '数据库统计' },
  29952. ]
  29953. });
  29954. };
  29955. return Controller;
  29956. }());
  29957. var controller$4 = new Controller$4();
  29958. function initMonitorTree () {
  29959. Ext.define('com.yvan.studio.MonitorTree', {
  29960. extend: 'Ext.tree.Panel',
  29961. xtype: 'monitortree',
  29962. controller: controller$4,
  29963. scope: controller$4,
  29964. reference: 'roleGrid',
  29965. tooltip: '表单定义',
  29966. iconCls: 'x-fa fa-bar-chart',
  29967. useArrows: true,
  29968. rootVisible: false,
  29969. colspan: 2,
  29970. lines: true,
  29971. multiSelect: false,
  29972. referenceHolder: true,
  29973. // openNode() {
  29974. // const selection = this.getSelection()
  29975. // const [record] = selection
  29976. // if (!record) {
  29977. // return
  29978. // }
  29979. //
  29980. // const {raw} = record;
  29981. // if (raw.type === 'Dir') {
  29982. // return
  29983. // }
  29984. // if (raw.type === "Module" && raw.module) {
  29985. // // eventBus.publish(EventType.ModuleOpen, raw)
  29986. // }
  29987. // },
  29988. listeners: {
  29989. itemdblclick: 'onDblClick',
  29990. afterrender: "onLoad",
  29991. },
  29992. });
  29993. }
  29994. //# sourceMappingURL=MonitorTree.js.map
  29995. var Controller$5 = /** @class */ (function () {
  29996. function Controller() {
  29997. }
  29998. return Controller;
  29999. }());
  30000. var controller$5 = new Controller$5();
  30001. function initHomeTree () {
  30002. Ext.define('com.yvan.studio.HomeTree', {
  30003. extend: 'Ext.Panel',
  30004. xtype: 'hometree',
  30005. controller: controller$5,
  30006. scope: controller$5,
  30007. referenceHolder: true,
  30008. bodyCls: 'home',
  30009. // layout: 'fit',
  30010. tbar: {
  30011. xtype: 'toolbar',
  30012. items: [
  30013. {
  30014. xtype: 'button',
  30015. iconCls: 'x-fa fa-exchange',
  30016. text: '数据结构同步',
  30017. handler: function (sender) {
  30018. handles$1.mainWindow.showDataSync(sender);
  30019. }
  30020. },
  30021. {
  30022. xtype: 'button',
  30023. iconCls: 'x-fa fa-cubes',
  30024. text: '数据域管理',
  30025. handler: function (sender) {
  30026. handles$1.mainWindow.showColumnDomain();
  30027. }
  30028. },
  30029. ],
  30030. },
  30031. // items: [
  30032. //
  30033. // ],
  30034. layout: {
  30035. type: 'vbox',
  30036. pack: 'start',
  30037. align: 'stretch',
  30038. },
  30039. items: [
  30040. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30041. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30042. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30043. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30044. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30045. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30046. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30047. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30048. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30049. ],
  30050. });
  30051. }
  30052. //# sourceMappingURL=HomeTree.js.map
  30053. var WidgetStore = /** @class */ (function (_super) {
  30054. __extends(WidgetStore, _super);
  30055. function WidgetStore() {
  30056. return _super !== null && _super.apply(this, arguments) || this;
  30057. }
  30058. WidgetStore.prototype.getCacheKey = function (param) {
  30059. return "widget_data.json";
  30060. };
  30061. /*invokeApi(param: any): Promise<any> {
  30062. return new Promise<any>(resolve => {
  30063. //@ts-ignore
  30064. require(["../../widget/all"], function (res) {
  30065. const widgetList = res.default
  30066. resolve(widgetList)
  30067. })
  30068. })
  30069. }*/
  30070. WidgetStore.prototype.invokeApi = function (param) {
  30071. return widgetListApi(param);
  30072. };
  30073. return WidgetStore;
  30074. }(CacheStore));
  30075. var instance$3 = new WidgetStore();
  30076. //# sourceMappingURL=WidgetStore.js.map
  30077. var WidgetGridController = /** @class */ (function () {
  30078. function WidgetGridController() {
  30079. }
  30080. WidgetGridController.prototype.onLoad = function (sender) {
  30081. var me = this;
  30082. setWidget(me);
  30083. instance$3.registe(me.reloadData.bind(this));
  30084. instance$3.reloadIfNeed(undefined);
  30085. };
  30086. WidgetGridController.prototype.widgetAdd = function (sender) {
  30087. var me = this;
  30088. var win = new Ext.Window({
  30089. autoDestroy: true,
  30090. title: "新建弹框",
  30091. width: 400,
  30092. height: 220,
  30093. resizable: true,
  30094. closable: true,
  30095. maximizable: true,
  30096. minimizable: true,
  30097. plain: true,
  30098. // constrainHeader: true,
  30099. constrain: true,
  30100. layout: 'fit',
  30101. animateTarget: sender,
  30102. buttonAlign: 'center',
  30103. items: [
  30104. {
  30105. xtype: "form",
  30106. layout: "hbox",
  30107. margin: '10px 20px',
  30108. border: 0,
  30109. items: [
  30110. {
  30111. flex: 1,
  30112. layout: 'vbox',
  30113. items: [
  30114. {
  30115. xtype: "textfield",
  30116. name: "widgetcode",
  30117. fieldLabel: "弹窗文件",
  30118. flex: 1,
  30119. allowBlank: false,
  30120. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30121. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30122. labelWidth: 80,
  30123. width: "100%",
  30124. },
  30125. {
  30126. xtype: "textfield",
  30127. name: "widgetname",
  30128. fieldLabel: "弹窗名称",
  30129. flex: 1,
  30130. allowBlank: false,
  30131. labelWidth: 80,
  30132. width: "100%",
  30133. },
  30134. ]
  30135. },
  30136. ]
  30137. }
  30138. ],
  30139. //窗口按钮
  30140. buttons: [
  30141. {
  30142. xtype: 'button', text: '保存', handler: function (btn) {
  30143. //窗口获取表单
  30144. var form = win.down('form');
  30145. var vaildSuccess = form.isValid();
  30146. if (!vaildSuccess) {
  30147. return;
  30148. }
  30149. var title = form.down('textfield[name="widgetname"]').getValue();
  30150. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30151. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30152. if (res.success) {
  30153. msg$1('添加成功');
  30154. // 添加
  30155. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30156. me.reload();
  30157. });
  30158. win.close();
  30159. }
  30160. });
  30161. }
  30162. },
  30163. {
  30164. xtype: 'button', text: '取消', handler: function (btn) {
  30165. //窗口关闭
  30166. win.close();
  30167. }
  30168. }
  30169. ]
  30170. });
  30171. win.show();
  30172. };
  30173. WidgetGridController.prototype.widgetRemove = function (sender) {
  30174. var _this = this;
  30175. //@ts-ignore
  30176. var record = this.getView().selection.data;
  30177. if (!record) {
  30178. msg$1('请选择一行');
  30179. return;
  30180. }
  30181. var widgetPath = record.widget_path;
  30182. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30183. if (btn === 'yes') {
  30184. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30185. if (res.success) {
  30186. msg$1(res.msg);
  30187. _this.reload();
  30188. }
  30189. });
  30190. }
  30191. });
  30192. };
  30193. WidgetGridController.prototype.widgetEdit = function (record) {
  30194. var _this = this;
  30195. if (record) {
  30196. var widgetPath = record.widget_path;
  30197. var widgetName = record.widget_name;
  30198. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30199. _this.reload();
  30200. });
  30201. }
  30202. };
  30203. WidgetGridController.prototype.onDestory = function (sender) {
  30204. var me = this;
  30205. setWidget(undefined);
  30206. instance$3.unregiste(me.reloadData.bind(this));
  30207. };
  30208. WidgetGridController.prototype.reloadData = function (res) {
  30209. var me = this;
  30210. //@ts-ignore
  30211. var view = me.getView();
  30212. if (typeof res === 'object') {
  30213. // const data = []
  30214. // _.forOwn(res, (v, k) => {
  30215. // data.push({
  30216. // widget_path: k,
  30217. // widget_name: v.title,
  30218. // vjson : v
  30219. // })
  30220. // })
  30221. view.setStore(new Ext.data.Store({
  30222. fields: ['widget_path', 'widget_name'],
  30223. data: res.data,
  30224. }));
  30225. }
  30226. else if (typeof res === 'boolean') {
  30227. view.setLoading(res);
  30228. }
  30229. };
  30230. WidgetGridController.prototype.reload = function () {
  30231. instance$3.reloadForce(undefined);
  30232. };
  30233. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30234. //@ts-ignore
  30235. this.view.store.clearFilter();
  30236. if (value) {
  30237. //@ts-ignore
  30238. this.view.store.filterBy(function (record) {
  30239. var widget_path = record.get('widget_path');
  30240. var widget_name = record.get('widget_name');
  30241. return (window['system'].pinyinMatch(widget_name, value) ||
  30242. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30243. });
  30244. }
  30245. };
  30246. WidgetGridController.prototype.onClearClick = function () {
  30247. var _a, _b;
  30248. //@ts-ignore
  30249. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30250. };
  30251. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30252. this.widgetEdit(record.data);
  30253. };
  30254. return WidgetGridController;
  30255. }());
  30256. //# sourceMappingURL=WidgetGridController.js.map
  30257. function initWidget () {
  30258. var controller = new WidgetGridController();
  30259. Ext.define('com.yvan.studio.WidgetGrid', {
  30260. extend: 'Ext.grid.Panel',
  30261. xtype: 'widgetgrid',
  30262. controller: controller,
  30263. scope: controller,
  30264. referenceHolder: true,
  30265. tooltip: '检索窗口',
  30266. iconCls: 'x-fa fa-search',
  30267. useArrows: true,
  30268. reference: 'widgetgrid',
  30269. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30270. listeners: {
  30271. itemdblclick: 'onDblClick',
  30272. afterrender: 'onLoad',
  30273. destory: 'onDestory',
  30274. },
  30275. viewConfig: {
  30276. listeners: {
  30277. itemcontextmenu: 'onGridContextMenu',
  30278. },
  30279. },
  30280. tbar: [
  30281. {
  30282. xtype: 'button',
  30283. tooltip: '刷新',
  30284. iconCls: 'x-fa fa-refresh',
  30285. listeners: {
  30286. click: 'reload'
  30287. }
  30288. },
  30289. {
  30290. xtype: 'button',
  30291. tooltip: '添加',
  30292. iconCls: 'x-fa fa-plus-circle',
  30293. listeners: {
  30294. click: 'widgetAdd'
  30295. }
  30296. },
  30297. {
  30298. xtype: 'button',
  30299. tooltip: '删除',
  30300. iconCls: 'x-fa fa-minus-circle',
  30301. listeners: {
  30302. click: 'widgetRemove'
  30303. }
  30304. },
  30305. ],
  30306. fbar: [
  30307. {
  30308. xtype: 'textfield',
  30309. flex: 1,
  30310. reference: "txtFilter",
  30311. emptyText: '搜索过滤',
  30312. enableKeyEvents: true,
  30313. listeners: {
  30314. change: {
  30315. fn: 'filterChanged',
  30316. buffer: 50
  30317. }
  30318. }
  30319. },
  30320. ],
  30321. columns: [
  30322. {
  30323. text: '弹窗文件', dataIndex: 'widget_path',
  30324. menuDisabled: true, flex: 1,
  30325. },
  30326. {
  30327. text: '弹窗名称', dataIndex: 'widget_name',
  30328. menuDisabled: true, flex: 1,
  30329. },
  30330. ]
  30331. });
  30332. }
  30333. //# sourceMappingURL=WidgetGrid.js.map
  30334. var WhLayoutController = /** @class */ (function () {
  30335. function WhLayoutController() {
  30336. }
  30337. WhLayoutController.prototype.onLoad = function (sender) {
  30338. var _this = this;
  30339. var me = this;
  30340. setWhLayout(me);
  30341. _$2.defer(function () {
  30342. _this.reload();
  30343. });
  30344. };
  30345. WhLayoutController.prototype.reload = function () {
  30346. //@ts-ignore
  30347. var view = this.getView();
  30348. view.setLoading(true);
  30349. loadWhLayoutAll().then(function (res) {
  30350. view.setStore(new Ext.data.Store({
  30351. fields: ['layout_code', 'layout_name'],
  30352. data: res.data,
  30353. }));
  30354. }).finally(function () {
  30355. view.setLoading(false);
  30356. });
  30357. };
  30358. WhLayoutController.prototype.add = function () {
  30359. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30360. };
  30361. WhLayoutController.prototype.edit = function (data) {
  30362. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30363. };
  30364. WhLayoutController.prototype.remove = function () {
  30365. var _this = this;
  30366. var _a;
  30367. //@ts-ignore
  30368. var view = this.getView();
  30369. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30370. if (!record) {
  30371. msg$1('请选择一行数据');
  30372. return;
  30373. }
  30374. var layoutCode = record.layout_code;
  30375. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30376. if (btn === 'yes') {
  30377. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30378. if (res.success) {
  30379. msg$1(res.msg);
  30380. _this.reload();
  30381. }
  30382. });
  30383. }
  30384. });
  30385. };
  30386. WhLayoutController.prototype.onDblClick = function () {
  30387. var _a;
  30388. //@ts-ignore
  30389. var view = this.getView();
  30390. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30391. if (!record) {
  30392. msg$1('请选择一行数据');
  30393. return;
  30394. }
  30395. this.edit(record);
  30396. };
  30397. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30398. //@ts-ignore
  30399. this.view.store.clearFilter();
  30400. if (value) {
  30401. //@ts-ignore
  30402. this.view.store.filterBy(function (record) {
  30403. var widget_path = record.get('widget_path');
  30404. var widget_name = record.get('widget_name');
  30405. return (window['system'].pinyinMatch(widget_name, value) ||
  30406. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30407. });
  30408. }
  30409. };
  30410. WhLayoutController.prototype.onClearClick = function () {
  30411. var _a, _b;
  30412. //@ts-ignore
  30413. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30414. };
  30415. return WhLayoutController;
  30416. }());
  30417. //# sourceMappingURL=WhLayoutController.js.map
  30418. function initWhLayout () {
  30419. var controller = new WhLayoutController();
  30420. Ext.define('com.yvan.studio.WhLayout', {
  30421. extend: 'Ext.grid.Panel',
  30422. xtype: 'whlayout',
  30423. alias: 'widget.whlayout',
  30424. controller: controller,
  30425. scope: controller,
  30426. referenceHolder: true,
  30427. tooltip: '检索窗口',
  30428. iconCls: 'x-fa fa-search',
  30429. useArrows: true,
  30430. reference: 'whlayout',
  30431. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30432. listeners: {
  30433. itemdblclick: 'onDblClick',
  30434. afterrender: 'onLoad',
  30435. destory: 'onDestory',
  30436. },
  30437. viewConfig: {
  30438. listeners: {
  30439. itemcontextmenu: 'onGridContextMenu',
  30440. },
  30441. },
  30442. tbar: [
  30443. {
  30444. xtype: 'button',
  30445. tooltip: '刷新',
  30446. iconCls: 'x-fa fa-refresh',
  30447. listeners: {
  30448. click: 'reload'
  30449. }
  30450. },
  30451. {
  30452. xtype: 'button',
  30453. tooltip: '添加',
  30454. iconCls: 'x-fa fa-plus-circle',
  30455. listeners: {
  30456. click: 'add'
  30457. }
  30458. },
  30459. {
  30460. xtype: 'button',
  30461. tooltip: '删除',
  30462. iconCls: 'x-fa fa-minus-circle',
  30463. listeners: {
  30464. click: 'remove'
  30465. }
  30466. },
  30467. ],
  30468. fbar: [
  30469. {
  30470. xtype: 'textfield',
  30471. flex: 1,
  30472. reference: "txtFilter",
  30473. emptyText: '搜索过滤',
  30474. enableKeyEvents: true,
  30475. listeners: {
  30476. change: {
  30477. fn: 'filterChanged',
  30478. buffer: 50
  30479. }
  30480. }
  30481. },
  30482. ],
  30483. columns: [
  30484. {
  30485. text: '图编号', dataIndex: 'layout_code',
  30486. menuDisabled: true, flex: 1,
  30487. },
  30488. {
  30489. text: '图名称', dataIndex: 'layout_name',
  30490. menuDisabled: true, flex: 1,
  30491. },
  30492. ]
  30493. });
  30494. }
  30495. //# sourceMappingURL=WhLayout.js.map
  30496. var BpmnTreeController = /** @class */ (function () {
  30497. function BpmnTreeController() {
  30498. }
  30499. BpmnTreeController.prototype.onLoad = function (sender) {
  30500. this.reload();
  30501. };
  30502. BpmnTreeController.prototype.reload = function () {
  30503. var me = this;
  30504. me.getView().setLoading(true);
  30505. exporerList().then(function (res) {
  30506. // handles.mainWindow.modules = res.data
  30507. // const rootNode = modulesToTreeData(res.data)
  30508. var rootNode = res.data.tree;
  30509. me.getView().setRootNode({
  30510. expanded: true,
  30511. leaf: false,
  30512. children: rootNode
  30513. });
  30514. // const lastId = window.location.hash.substring(1);
  30515. // file.selectPath(lastId)
  30516. // if (lastId) {
  30517. // const node = getModuleById(rootNode, lastId)
  30518. // if (node) {
  30519. // showDesign(node.id, node.path, node.text, node.module)
  30520. // }
  30521. // }
  30522. // this.restoreState()
  30523. }).finally(function () {
  30524. me.getView().setLoading(false);
  30525. });
  30526. };
  30527. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30528. var _this = this;
  30529. e.preventDefault();
  30530. var raw = node.raw;
  30531. //const me = sender.up("treepanel").scope
  30532. var option;
  30533. if (raw.exporerType === 1) ;
  30534. else if (raw.exporerType === 21) {
  30535. if (raw.type === 'Dir') {
  30536. option = {
  30537. shadow: 'frame', allowOtherMenus: true,
  30538. items: [
  30539. {
  30540. text: '添加',
  30541. iconCls: 'x-fa fa-plus-circle',
  30542. handler: function (sender) {
  30543. var dirPath = raw.dirPath;
  30544. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30545. }
  30546. },
  30547. '-',
  30548. {
  30549. text: '新建文件夹',
  30550. iconCls: 'x-fa fa-folder-o',
  30551. handler: function (sender) {
  30552. }
  30553. }
  30554. ]
  30555. };
  30556. }
  30557. else if (raw.type === 'Model') {
  30558. option = {
  30559. shadow: 'frame', allowOtherMenus: true,
  30560. items: [
  30561. {
  30562. text: '编辑',
  30563. iconCls: 'x-fa fa-edit',
  30564. handler: function (sender) {
  30565. }
  30566. },
  30567. {
  30568. text: '删除',
  30569. iconCls: 'x-fa fa-minus-circle',
  30570. handler: function (sender) {
  30571. }
  30572. },
  30573. '-',
  30574. {
  30575. text: '注册(至菜单)',
  30576. iconCls: 'x-fa fa-sign-in',
  30577. handler: function (sender) {
  30578. }
  30579. },
  30580. {
  30581. text: '新建文件夹',
  30582. iconCls: 'x-fa fa-folder-o',
  30583. handler: function (sender) {
  30584. }
  30585. }
  30586. ]
  30587. };
  30588. }
  30589. }
  30590. else if (raw.exporerType === 22) {
  30591. if (raw.type === 'Dir') {
  30592. option = {
  30593. shadow: 'frame', allowOtherMenus: true,
  30594. items: [
  30595. {
  30596. text: '添加',
  30597. iconCls: 'x-fa fa-plus-circle',
  30598. handler: function (sender) {
  30599. var dirPath = raw.dirPath;
  30600. handles$1.mainWindow.showFormBill();
  30601. }
  30602. },
  30603. '-',
  30604. {
  30605. text: '新建文件夹',
  30606. iconCls: 'x-fa fa-folder-o',
  30607. handler: function (sender) {
  30608. }
  30609. }
  30610. ]
  30611. };
  30612. }
  30613. else if (raw.type === 'Model') {
  30614. option = {
  30615. shadow: 'frame', allowOtherMenus: true,
  30616. items: [
  30617. {
  30618. text: '编辑',
  30619. iconCls: 'x-fa fa-edit',
  30620. handler: function (sender) {
  30621. }
  30622. },
  30623. {
  30624. text: '删除',
  30625. iconCls: 'x-fa fa-minus-circle',
  30626. handler: function (sender) {
  30627. }
  30628. },
  30629. '-',
  30630. {
  30631. text: '注册(至菜单)',
  30632. iconCls: 'x-fa fa-sign-in',
  30633. handler: function (sender) {
  30634. }
  30635. },
  30636. {
  30637. text: '新建文件夹',
  30638. iconCls: 'x-fa fa-folder-o',
  30639. handler: function (sender) {
  30640. }
  30641. }
  30642. ]
  30643. };
  30644. }
  30645. }
  30646. else if (raw.exporerType === 3) ;
  30647. else if (raw.exporerType === 50) {
  30648. option = {
  30649. shadow: 'frame', allowOtherMenus: true,
  30650. items: [
  30651. {
  30652. text: '新建流程',
  30653. iconCls: 'x-fa fa-new',
  30654. handler: function (sender) {
  30655. _this.bpmnAdd(sender);
  30656. }
  30657. },
  30658. ]
  30659. };
  30660. }
  30661. else if (raw.exporerType === 51) {
  30662. option = {
  30663. shadow: 'frame', allowOtherMenus: true,
  30664. items: [
  30665. {
  30666. text: '新建流程',
  30667. iconCls: 'x-fa fa-new',
  30668. handler: function (sender) {
  30669. _this.bpmnAdd(sender);
  30670. }
  30671. },
  30672. {
  30673. text: '删除',
  30674. iconCls: 'x-fa fa-minus-circle',
  30675. handler: function (sender) {
  30676. _this.bpmnDelete(sender, raw);
  30677. }
  30678. },
  30679. ]
  30680. };
  30681. }
  30682. else {
  30683. throw Error('暂时不支持!');
  30684. }
  30685. if (option) {
  30686. var treeMenu = new Ext.menu.Menu(option);
  30687. treeMenu.showAt(e.getXY());
  30688. }
  30689. };
  30690. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30691. var _this = this;
  30692. prompt$2('输入工作流名称').then(function (name) {
  30693. createBpmn("", name).then(function (res) {
  30694. if (res.success) {
  30695. msg$1('添加成功');
  30696. }
  30697. _this.reload();
  30698. });
  30699. });
  30700. };
  30701. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30702. var _this = this;
  30703. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30704. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30705. if (res.success) {
  30706. msg$1('添加成功');
  30707. }
  30708. _this.reload();
  30709. });
  30710. });
  30711. };
  30712. BpmnTreeController.prototype.reportAdd = function (sender) {
  30713. var _this = this;
  30714. prompt$2('请输入报表名称').then(function (name) {
  30715. createReportApi(name).then(function (res) {
  30716. if (res.success) {
  30717. msg$1('添加成功');
  30718. handles$1.mainWindow.showReport(res.data, name, function () {
  30719. _this.reload();
  30720. });
  30721. }
  30722. _this.reload();
  30723. });
  30724. });
  30725. };
  30726. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30727. if (record) {
  30728. var reportName = record.get('report_name');
  30729. var reportId = record.get('report_id');
  30730. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30731. }
  30732. };
  30733. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30734. var _this = this;
  30735. if (record) {
  30736. var reportName = record.get('report_name');
  30737. var reportId_1 = record.get('report_id');
  30738. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30739. delReportApi(reportId_1).then(function (res) {
  30740. if (res.success) {
  30741. msg$1('删除成功');
  30742. _this.reload();
  30743. }
  30744. });
  30745. });
  30746. }
  30747. };
  30748. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30749. var _this = this;
  30750. if (!record || record.type !== 'Module') {
  30751. return;
  30752. }
  30753. var reportName = record.text;
  30754. var reportId = record.target;
  30755. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30756. _this.reload();
  30757. });
  30758. };
  30759. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30760. var data = record.raw;
  30761. if (data.type !== 'Module' && data.type !== 'Dir') {
  30762. return;
  30763. }
  30764. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30765. if (data.exporerType === 10) { // 表单
  30766. // this.reportEdit(sender, data)
  30767. handles$1.mainWindow.showReport();
  30768. }
  30769. else if (data.exporerType === 21) {
  30770. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30771. }
  30772. else if (data.exporerType === 22) {
  30773. handles$1.mainWindow.showFormBill();
  30774. }
  30775. else if (data.exporerType === 30) {
  30776. handles$1.mainWindow.showWidgetDesign();
  30777. }
  30778. else if (data.exporerType === 51) {
  30779. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30780. }
  30781. else {
  30782. throw Error('暂时不支持!');
  30783. }
  30784. };
  30785. return BpmnTreeController;
  30786. }());
  30787. var controller$6 = new BpmnTreeController();
  30788. function initBpmnTree () {
  30789. Ext.define('com.yvan.studio.BpmnTree', {
  30790. extend: 'Ext.tree.Panel',
  30791. //extend: 'com.yvan.studio.StateTree',
  30792. xtype: 'bpmntree',
  30793. controller: controller$6,
  30794. scope: controller$6,
  30795. tooltip: '表单定义',
  30796. iconCls: 'x-fa fa-random',
  30797. useArrows: true,
  30798. rootVisible: false,
  30799. colspan: 2,
  30800. lines: true,
  30801. multiSelect: true,
  30802. reload: function () {
  30803. this.controller.reload.call(this, arguments);
  30804. },
  30805. openNode: function () {
  30806. var selection = this.getSelection();
  30807. var _a = __read(selection, 1), record = _a[0];
  30808. if (!record) {
  30809. return;
  30810. }
  30811. var raw = record.raw;
  30812. if (raw.type === 'Dir') {
  30813. return;
  30814. }
  30815. if (raw.type === "Module" && raw.module) ;
  30816. },
  30817. listeners: {
  30818. itemdblclick: 'onDblClick',
  30819. afterrender: 'onLoad',
  30820. // itemverify() {
  30821. // this.openNode()
  30822. // },
  30823. itemcontextmenu: 'onLisenContextMenu'
  30824. },
  30825. tbar: {
  30826. xtype: 'toolbar',
  30827. items: [
  30828. {
  30829. xtype: 'button',
  30830. tooltip: '刷新',
  30831. iconCls: 'x-fa fa-refresh',
  30832. listeners: {
  30833. click: 'reload'
  30834. }
  30835. },
  30836. /*{
  30837. xtype: 'button',
  30838. tooltip: '添加',
  30839. iconCls: 'x-fa fa-plus-circle',
  30840. menu: [
  30841. {
  30842. text: '类别',
  30843. listeners: {
  30844. click: 'classAdd'
  30845. }
  30846. },
  30847. {
  30848. text: '查询',
  30849. listeners: {
  30850. click: 'reportAdd'
  30851. }
  30852. },
  30853. '-',
  30854. {
  30855. text: '单表定义',
  30856. listeners: {
  30857. click: 'singleTableAdd'
  30858. }
  30859. },
  30860. {
  30861. text: '多表定义',
  30862. listeners: {
  30863. click: 'complexTableAdd'
  30864. }
  30865. },
  30866. {
  30867. text: '查询窗口定义',
  30868. listeners: {
  30869. click: 'widgetAdd'
  30870. }
  30871. },
  30872. ],
  30873. },
  30874. {
  30875. xtype: 'button',
  30876. tooltip: '删除',
  30877. iconCls: 'x-fa fa-minus-circle',
  30878. listeners: {
  30879. click: 'reportRemove'
  30880. }
  30881. },*/
  30882. {
  30883. xtype: 'textfield',
  30884. flex: 1,
  30885. reference: "txtFilter",
  30886. emptyText: '搜索过滤',
  30887. enableKeyEvents: true,
  30888. listeners: {
  30889. change: {
  30890. fn: 'filterChanged',
  30891. buffer: 50
  30892. }
  30893. }
  30894. },
  30895. ]
  30896. },
  30897. });
  30898. }
  30899. //# sourceMappingURL=BpmnTree.js.map
  30900. function initToolBox () {
  30901. Ext.define('com.yvan.studio.ToolBox', {
  30902. extend: 'Ext.panel.Panel',
  30903. xtype: 'toolbox',
  30904. tooltip: '工具箱',
  30905. layout: 'fit',
  30906. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  30907. border: false,
  30908. beforeRender: function () {
  30909. console.log('beforeRender', this);
  30910. },
  30911. afterRender: function () {
  30912. var $dom = $(this.body.dom).children('div');
  30913. $dom.append(createComponent());
  30914. $dom.css("height", '100%');
  30915. // @ts-ignore
  30916. $('#_toolbox_list').find('li').each(function () {
  30917. var id = $(this).children(':first').attr('drag_id');
  30918. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  30919. setDrag(this, node);
  30920. });
  30921. }
  30922. });
  30923. }
  30924. function setDrag(el, node) {
  30925. new Ext.drag.Source({
  30926. element: el,
  30927. proxy: {
  30928. type: 'placeholder',
  30929. getElement: function (info) {
  30930. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  30931. return Ext.getBody().createChild({
  30932. html: html
  30933. });
  30934. }
  30935. },
  30936. listeners: {
  30937. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  30938. dragend: delegateDragend.bind(getDesignInstance(), node),
  30939. },
  30940. sourceVjson: node.code,
  30941. dragType: node.dragType
  30942. });
  30943. }
  30944. function createComponent() {
  30945. var template = [];
  30946. for (var i = 0; i < codeLines.length; i++) {
  30947. var item = codeLines[i];
  30948. if (!item.dragHtml) {
  30949. continue;
  30950. }
  30951. var $ele = $("<li>" + item.dragHtml + "</li>");
  30952. $ele.children(':first').attr('drag_id', item.id);
  30953. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  30954. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  30955. }
  30956. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  30957. return html;
  30958. }
  30959. var codeLines = [
  30960. {
  30961. id: '$label',
  30962. value: layoutOrXtypeNameMap.label + ' - label',
  30963. icon: "fa fa-font",
  30964. dragType: "col-item",
  30965. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30966. code: {
  30967. xtype: 'label',
  30968. text: '文本' + _$2.uniqueId('_l')
  30969. }
  30970. },
  30971. {
  30972. id: '$text',
  30973. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  30974. icon: "fa fa-edit",
  30975. dragType: "col-item",
  30976. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30977. code: {
  30978. xtype: 'textfield',
  30979. fieldLabel: '输入框' + _$2.uniqueId('_e')
  30980. }
  30981. },
  30982. {
  30983. id: '$textarea',
  30984. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  30985. icon: "fa fa-edit",
  30986. dragType: "col-item",
  30987. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30988. code: {
  30989. xtype: 'textareafield',
  30990. fieldLabel: '输入框' + _$2.uniqueId('_e')
  30991. }
  30992. },
  30993. {
  30994. id: '$number',
  30995. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  30996. icon: "fa fa-edit",
  30997. dragType: "col-item",
  30998. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30999. code: {
  31000. xtype: 'numberfield',
  31001. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31002. }
  31003. },
  31004. {
  31005. id: '$combo',
  31006. value: layoutOrXtypeNameMap.combo + ' - combo',
  31007. icon: "fa fa-angle-double-down",
  31008. dragType: "col-item",
  31009. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31010. code: {
  31011. xtype: 'combo',
  31012. fieldLabel: '请选择',
  31013. data: [
  31014. { id: 'id1', text: '选项1' },
  31015. { id: 'id2', text: '选项2' },
  31016. { id: 'id3', text: '选项3' },
  31017. ],
  31018. }
  31019. },
  31020. {
  31021. id: '$datebox',
  31022. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31023. icon: "fa fa-calendar",
  31024. dragType: "col-item",
  31025. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31026. code: {
  31027. xtype: "datefield",
  31028. fieldLabel: '日期',
  31029. }
  31030. },
  31031. {
  31032. id: '$searchbox',
  31033. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31034. icon: "fa fa-search",
  31035. dragType: "col-item",
  31036. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31037. code: {
  31038. xtype: 'searchfield',
  31039. fieldLabel: '搜索框',
  31040. }
  31041. },
  31042. {
  31043. id: '$combogrid',
  31044. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31045. icon: "fa fa-table",
  31046. dragType: "col-item",
  31047. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31048. code: {
  31049. xtype: 'combogrid',
  31050. fieldLabel: '下拉表'
  31051. }
  31052. },
  31053. {
  31054. id: '$combotree',
  31055. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31056. icon: "fa fa-tree",
  31057. dragType: "col-item",
  31058. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31059. code: {
  31060. xtype: 'combotree',
  31061. fieldLabel: '下拉树',
  31062. displayField: 'text',
  31063. rootVisible: false
  31064. }
  31065. },
  31066. {
  31067. id: '$button',
  31068. value: layoutOrXtypeNameMap.button + ' - button',
  31069. icon: 'fa fa-sign-in',
  31070. dragType: "col-item",
  31071. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31072. code: {
  31073. text: '按钮',
  31074. iconCls: 'x-fa fa-bars',
  31075. xtype: 'button'
  31076. }
  31077. },
  31078. {
  31079. id: '$checkbox',
  31080. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31081. icon: 'fa fa-check-square',
  31082. dragType: "col-item",
  31083. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31084. code: {
  31085. xtype: 'checkbox',
  31086. boxLabel: '勾选框',
  31087. hideLabel: true,
  31088. margin: '0 0 0 15',
  31089. flex: 0,
  31090. }
  31091. },
  31092. {
  31093. id: '$checkboxgroup',
  31094. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31095. icon: 'fa fa-check-square',
  31096. dragType: "col-item",
  31097. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31098. code: {
  31099. xtype: 'checkboxgroup',
  31100. fieldLabel: '勾选组',
  31101. items: [
  31102. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31103. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31104. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31105. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31106. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31107. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31108. ]
  31109. }
  31110. },
  31111. {
  31112. id: '$radio',
  31113. value: layoutOrXtypeNameMap.radio + ' - radio',
  31114. icon: 'fa fa-dot-circle-o',
  31115. dragType: "col-item",
  31116. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31117. code: {
  31118. xtype: "radio",
  31119. fieldLabel: "请选择",
  31120. }
  31121. },
  31122. {
  31123. id: '$radiogroup',
  31124. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31125. icon: 'fa fa-dot-circle-o',
  31126. dragType: "col-item",
  31127. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31128. code: {
  31129. xtype: "radiogroup",
  31130. fieldLabel: "请选择",
  31131. items: [
  31132. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31133. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31134. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31135. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31136. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31137. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31138. ]
  31139. }
  31140. },
  31141. {
  31142. id: '$cols',
  31143. value: layoutOrXtypeNameMap.cols + ' - cols',
  31144. icon: 'fa fa-list-alt',
  31145. dragType: "cols-container",
  31146. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31147. code: {
  31148. xtype: 'cols',
  31149. items: [
  31150. {
  31151. xtype: 'textfield',
  31152. fieldLabel: '输入框',
  31153. },
  31154. ],
  31155. }
  31156. },
  31157. {
  31158. id: '$container',
  31159. value: layoutOrXtypeNameMap.container + ' - container',
  31160. icon: 'fa fa-flag',
  31161. dragType: "col-item",
  31162. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31163. code: {
  31164. xtype: 'container',
  31165. border: false,
  31166. layout: 'hbox',
  31167. }
  31168. },
  31169. {
  31170. id: '$fit',
  31171. value: layoutOrXtypeNameMap.fit + ' - fit',
  31172. icon: 'fa fa-flag',
  31173. dragType: "rows-container",
  31174. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31175. code: {
  31176. border: false,
  31177. layout: 'fit',
  31178. items: [
  31179. {
  31180. xtype: 'container',
  31181. border: false,
  31182. layout: 'hbox',
  31183. }
  31184. ]
  31185. }
  31186. },
  31187. ];
  31188. // @ts-ignore
  31189. // export default ToolBoxCmp
  31190. //# sourceMappingURL=ToolBox.js.map
  31191. var that = undefined;
  31192. function initPropertyDesign () {
  31193. Ext.define('com.yvan.studio.PropertyDesign', {
  31194. extend: 'Ext.panel.Panel',
  31195. xtype: 'propertydesign',
  31196. name: "PropertyDesign",
  31197. tooltip: '属性',
  31198. iconCls: 'x-fa fa-newspaper-o',
  31199. reference: 'propertygrid',
  31200. layout: 'border',
  31201. border: false,
  31202. moduleId: null,
  31203. currentComponentVJson: null,
  31204. currentComponentPropertyEditSource: null,
  31205. vjson: null,
  31206. propertyHandle: null,
  31207. moduleSubscribe: null,
  31208. items: [
  31209. new Ext.grid.property.Grid({
  31210. sortableColumns: false,
  31211. region: 'center',
  31212. listeners: {
  31213. propertychange: function (source, propName, value, oldValue, eOpts) {
  31214. value = _.trim(value);
  31215. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31216. return item.label === propName;
  31217. });
  31218. if (a.type === 'listeners') {
  31219. if (value) {
  31220. if (that.currentComponentVJson.listeners) {
  31221. that.currentComponentVJson.listeners[propName] = value;
  31222. }
  31223. else {
  31224. var t = {};
  31225. t[propName] = value;
  31226. that.currentComponentVJson.listeners = t;
  31227. }
  31228. }
  31229. else {
  31230. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31231. if (!value1) {
  31232. delete that.currentComponentVJson.listeners[key];
  31233. }
  31234. else if (key === propName) {
  31235. delete that.currentComponentVJson.listeners[key];
  31236. }
  31237. });
  31238. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31239. delete that.currentComponentVJson.listeners;
  31240. }
  31241. }
  31242. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31243. vjson: that.vjson,
  31244. from: that.name,
  31245. ignoreRenderUI: true
  31246. });
  31247. }
  31248. else if (a.type === 'fix') {
  31249. if (!value) {
  31250. delete that.currentComponentVJson[propName];
  31251. }
  31252. else {
  31253. that.currentComponentVJson[propName] = value.split("\r\n");
  31254. }
  31255. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31256. vjson: that.vjson,
  31257. from: that.name,
  31258. ignoreRenderUI: true
  31259. });
  31260. }
  31261. else if (a.type === 'bind') {
  31262. var bind_1 = that.currentComponentVJson.bind;
  31263. if (typeof bind_1 === 'string' && a.id === "value") {
  31264. if (value) {
  31265. that.currentComponentVJson.bind = value;
  31266. }
  31267. else {
  31268. delete that.currentComponentVJson.bind;
  31269. }
  31270. }
  31271. else {
  31272. // 转成bind对象
  31273. if (typeof bind_1 === 'string') {
  31274. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31275. }
  31276. if (value) {
  31277. if (bind_1) {
  31278. bind_1[a.id] = value;
  31279. }
  31280. else {
  31281. var t = {};
  31282. t[a.id] = value;
  31283. that.currentComponentVJson.bind = t;
  31284. }
  31285. }
  31286. else {
  31287. _.forOwn(bind_1, function (value1, key) {
  31288. if (!value1) {
  31289. delete bind_1[key];
  31290. }
  31291. else if (key === a.id) {
  31292. delete bind_1[key];
  31293. }
  31294. });
  31295. if (Object.keys(bind_1).length <= 0) {
  31296. delete that.currentComponentVJson.bind;
  31297. }
  31298. }
  31299. }
  31300. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31301. vjson: that.vjson,
  31302. from: that.name,
  31303. ignoreRenderUI: true
  31304. });
  31305. }
  31306. else if (a.type === 'boolean') {
  31307. if (!value) {
  31308. delete that.currentComponentVJson[propName];
  31309. }
  31310. else if (value === 'false') {
  31311. that.currentComponentVJson[propName] = false;
  31312. }
  31313. else if (value === 'true') {
  31314. that.currentComponentVJson[propName] = true;
  31315. }
  31316. else {
  31317. that.currentComponentVJson[propName] = value;
  31318. }
  31319. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31320. vjson: that.vjson,
  31321. from: that.name
  31322. });
  31323. }
  31324. else {
  31325. that.currentComponentVJson[propName] = value;
  31326. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31327. vjson: that.vjson,
  31328. from: that.name
  31329. });
  31330. }
  31331. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31332. },
  31333. }
  31334. })
  31335. ],
  31336. listeners: {
  31337. // afterrender() {
  31338. // this.propertyHandle.setSource({
  31339. // "(name)": "My Object",
  31340. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31341. // "Available": false, // boolean type
  31342. // "Version": .01, // decimal type
  31343. // "Description": "A test object"
  31344. // });
  31345. // }
  31346. },
  31347. initComponent: function () {
  31348. var _this = this;
  31349. this.propertyHandle = this.items[0];
  31350. setPropertyPanel(this);
  31351. that = this;
  31352. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31353. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31354. _this.setVjson(moduleId, from, ignoreRenderUI);
  31355. });
  31356. return this.superclass.initComponent.apply(this, arguments);
  31357. },
  31358. setVjson: function (moduleId, from, ignoreRenderUI) {
  31359. var _this = this;
  31360. // if (this.moduleId === null && moduleId) {
  31361. // this.moduleId = moduleId
  31362. // }
  31363. if (moduleId !== this.moduleId || from === this.name) {
  31364. return;
  31365. }
  31366. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31367. if (!moduleObj) {
  31368. return;
  31369. }
  31370. this.vjson = moduleObj.moduleObj.vjson;
  31371. this.setPropertyAndEventSource();
  31372. if (this.componentSelectionChangeSubscribe) {
  31373. this.componentSelectionChangeSubscribe.cancel();
  31374. this.componentSelectionChangeSubscribe = null;
  31375. }
  31376. if (this.updateVjsonChangeSubscribe) {
  31377. this.updateVjsonChangeSubscribe.cancel();
  31378. this.updateVjsonChangeSubscribe = null;
  31379. }
  31380. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31381. var id = _a.id, from = _a.from;
  31382. _this.onComponentSelectionChange(id, from);
  31383. });
  31384. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31385. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31386. _this.updateVjson(vjson, from, ignoreRenderUI);
  31387. });
  31388. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31389. this.onComponentSelectionChange(id, from);
  31390. },
  31391. updateVjson: function (vjson, from, ignoreRenderUI) {
  31392. if (!vjson || from === this.name) {
  31393. return;
  31394. }
  31395. this.vjson = vjson;
  31396. this.setPropertyAndEventSource();
  31397. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31398. this.onComponentSelectionChange(id, from);
  31399. },
  31400. onComponentSelectionChange: function (id, from) {
  31401. if (from !== this.name) {
  31402. this.currentComponentVJson = findInCode(this.vjson, id);
  31403. this.setPropertyAndEventSource();
  31404. }
  31405. },
  31406. setPropertyAndEventSource: function () {
  31407. var _this = this;
  31408. this.propertyHandle.setSource({});
  31409. if (!this.currentComponentVJson) {
  31410. return;
  31411. }
  31412. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31413. var v = xtype;
  31414. // 选中的对象可能是组
  31415. if (!v) {
  31416. if (_.has(this.currentComponentVJson, "cols")) {
  31417. v = "cols";
  31418. }
  31419. else if (_.has(this.currentComponentVJson, "rows")) {
  31420. v = "rows";
  31421. }
  31422. }
  31423. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31424. if (!pd) {
  31425. // 这个组件没有属性
  31426. this.propertyHandle.setSource({});
  31427. return;
  31428. }
  31429. var funcArr = this.getAllfuncs();
  31430. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31431. // disabled: true,
  31432. displayField: 'name',
  31433. valueField: 'name',
  31434. store: funcArr,
  31435. }); };
  31436. // ====================== 属性
  31437. var elements = [];
  31438. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31439. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31440. var props = pd.getPropsByGroup(group);
  31441. if (props.length <= 0)
  31442. return; //没有这一组属性
  31443. // 显示 group 的中文名
  31444. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31445. if (caption[i] === '绑定') {
  31446. _.each(props, function (prop) {
  31447. elements.push({
  31448. label: "_" + prop.name,
  31449. type: "bind",
  31450. id: prop.name,
  31451. desc: prop.desc,
  31452. editor: new Ext.form.field.Text()
  31453. });
  31454. });
  31455. }
  31456. else {
  31457. _.each(props, function (prop) {
  31458. if (_.isArray(prop.type)) {
  31459. elements.push({
  31460. label: prop.name,
  31461. type: "combo",
  31462. options: prop.type,
  31463. id: prop.name,
  31464. desc: prop.desc
  31465. });
  31466. return;
  31467. }
  31468. switch (prop.type) {
  31469. case 'boolean': {
  31470. elements.push({
  31471. label: prop.name,
  31472. id: prop.name,
  31473. desc: prop.desc,
  31474. type: 'boolean',
  31475. editor: new Ext.form.field.ComboBox({
  31476. displayField: 'text',
  31477. valueField: 'id',
  31478. store: new Ext.data.Store({
  31479. field: ['id', 'text'],
  31480. data: [
  31481. { id: 'true', text: 'True' },
  31482. { id: 'false', text: 'False' },
  31483. ]
  31484. })
  31485. }),
  31486. });
  31487. break;
  31488. }
  31489. case 'number': {
  31490. elements.push({
  31491. label: prop.name,
  31492. type: "number",
  31493. id: prop.name,
  31494. isNum: true,
  31495. desc: prop.desc,
  31496. editor: new Ext.form.field.Number()
  31497. });
  31498. break;
  31499. }
  31500. case 'string': {
  31501. elements.push({
  31502. label: prop.name,
  31503. type: "string",
  31504. id: prop.name,
  31505. desc: prop.desc,
  31506. editor: new Ext.form.field.Text()
  31507. });
  31508. break;
  31509. }
  31510. case 'listeners': {
  31511. elements.push({
  31512. label: prop.name,
  31513. type: "listeners",
  31514. id: prop.name,
  31515. desc: prop.desc,
  31516. editor: createFuncEditor()
  31517. });
  31518. break;
  31519. }
  31520. case 'fix': {
  31521. elements.push({
  31522. label: prop.name,
  31523. type: "fix",
  31524. id: prop.name,
  31525. desc: prop.desc,
  31526. editor: new Ext.form.field.Text()
  31527. });
  31528. break;
  31529. }
  31530. case 'object': {
  31531. break;
  31532. }
  31533. // case 'dataSource' : {
  31534. // break;
  31535. // }
  31536. case 'valid': {
  31537. break;
  31538. }
  31539. default:
  31540. elements.push({
  31541. label: prop.name,
  31542. type: prop.type,
  31543. id: prop.name,
  31544. desc: prop.desc,
  31545. editor: new Ext.form.field.Text({ disabled: true })
  31546. });
  31547. console.error('不支持的编辑类型', prop);
  31548. }
  31549. });
  31550. }
  31551. });
  31552. this.currentComponentPropertyEditSource = elements;
  31553. var panel1Source = {};
  31554. var panel1SourceConfig = {};
  31555. _.each(elements, function (item) {
  31556. var _a;
  31557. if (item.type === "listeners") {
  31558. var listeners = _this.currentComponentVJson.listeners;
  31559. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31560. }
  31561. else if (item.type === "fix") {
  31562. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31563. }
  31564. else if (item.type === "bind") {
  31565. var bind = _this.currentComponentVJson.bind;
  31566. if (typeof bind === 'string' && item.id === 'value') {
  31567. panel1Source[item.label] = bind;
  31568. }
  31569. else {
  31570. panel1Source[item.label] = bind ? bind[item.id] : '';
  31571. }
  31572. }
  31573. else {
  31574. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31575. }
  31576. panel1Source[item.label] = panel1Source[item.label] || '';
  31577. panel1SourceConfig[item.label] = { editor: item.editor };
  31578. });
  31579. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31580. },
  31581. getAllfuncs: function () {
  31582. var _a, _b;
  31583. 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;
  31584. var scopeFuncs = [];
  31585. _.forEach(arr, function (item) {
  31586. scopeFuncs.push({ name: "scope." + item.name });
  31587. });
  31588. return scopeFuncs;
  31589. }
  31590. });
  31591. }
  31592. //# sourceMappingURL=PropertyDesign.js.map
  31593. function initViewOutlineTree () {
  31594. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31595. extend: 'Ext.tree.Panel',
  31596. xtype: 'viewoutlinetree',
  31597. name: "ViewOutlineTree",
  31598. tooltip: '设计大纲',
  31599. iconCls: 'x-fa fa-list',
  31600. rootVisible: false,
  31601. useArrows: true,
  31602. allowDeselect: true,
  31603. colspan: 2,
  31604. lines: false,
  31605. reference: 'viewoutlinetree',
  31606. multiSelect: true,
  31607. _saveStateFlag: true,
  31608. keyMapEnabled: true,
  31609. moduleId: null,
  31610. vjson: null,
  31611. columns: [
  31612. {
  31613. xtype: 'treecolumn',
  31614. text: '布局',
  31615. dataIndex: 'layoutNameDesc',
  31616. flex: 2,
  31617. sortable: true
  31618. }, {
  31619. text: '组件',
  31620. dataIndex: 'xtype',
  31621. flex: 1,
  31622. sortable: true,
  31623. align: 'center',
  31624. }
  31625. ],
  31626. listeners: {
  31627. itemcontextmenu: function (sender, node, element, idx, e) {
  31628. e.preventDefault();
  31629. this.rightClickTreeNode(sender, node, element, idx, e);
  31630. },
  31631. select: function (sender, node, index, e) {
  31632. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31633. },
  31634. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31635. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31636. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31637. }
  31638. }
  31639. },
  31640. initComponent: function () {
  31641. var _this = this;
  31642. setViewoutlinetree(this);
  31643. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31644. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31645. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31646. });
  31647. return this.superclass.initComponent.apply(this, arguments);
  31648. },
  31649. clear: function () {
  31650. this.setRootNode(null);
  31651. },
  31652. onChangModule: function (moduleId, oldModuleId, from) {
  31653. if (!moduleId || moduleId !== this.moduleId) {
  31654. return;
  31655. }
  31656. if (moduleStore.getModuleObject(moduleId)) {
  31657. this.setVjson(moduleId, from);
  31658. }
  31659. },
  31660. setVjson: function (moduleId, from, ignoreRenderUI) {
  31661. var _this = this;
  31662. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31663. return;
  31664. }
  31665. this.moduleId = moduleId;
  31666. // if (from === this.name) {
  31667. // return
  31668. // }
  31669. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31670. this.setTreeValue();
  31671. if (this.componentSelectionChangeSubscribe) {
  31672. this.componentSelectionChangeSubscribe.cancel();
  31673. this.componentSelectionChangeSubscribe = null;
  31674. }
  31675. if (this.setVjsonChangeSubscribe) {
  31676. this.setVjsonChangeSubscribe.cancel();
  31677. this.setVjsonChangeSubscribe = null;
  31678. }
  31679. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31680. var id = _a.id, from = _a.from;
  31681. return _this.onComponentSelectionChange(id, from);
  31682. });
  31683. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31684. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31685. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31686. });
  31687. },
  31688. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31689. if (!vjson || from === this.name) {
  31690. return;
  31691. }
  31692. this.vjson = vjson;
  31693. this.setTreeValue();
  31694. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31695. if (id) {
  31696. this.selectPath(id);
  31697. }
  31698. },
  31699. onComponentSelectionChange: function (id, from) {
  31700. if (from !== this.name) {
  31701. if (id) {
  31702. this.selectPath(id);
  31703. }
  31704. else {
  31705. this.setTreeValue();
  31706. }
  31707. }
  31708. },
  31709. setTreeValue: function () {
  31710. var outlineVj = {};
  31711. _.forOwn(this.vjson, function (obj, key) {
  31712. if (key !== 'viewModel' && key !== 'store') {
  31713. outlineVj[key] = _.cloneDeep(obj);
  31714. }
  31715. });
  31716. getLayoutOutline(outlineVj);
  31717. this.setRootNode(outlineVj);
  31718. },
  31719. rightClickTreeNode: function (sender, node, element, idx, e) {
  31720. var raw = node.data;
  31721. var option = {};
  31722. // 右键
  31723. option = {
  31724. shadow: 'frame',
  31725. allowOtherMenus: true,
  31726. items: []
  31727. };
  31728. var switchType = raw.layoutName;
  31729. if (raw.layoutName === 'north' ||
  31730. raw.layoutName === 'south' ||
  31731. raw.layoutName === 'west' ||
  31732. raw.layoutName === 'east' ||
  31733. raw.layoutName === 'center' ||
  31734. raw.layoutName === 'tbar' ||
  31735. raw.layoutName === 'fbar') {
  31736. switchType = raw.xtype || raw.layout;
  31737. }
  31738. var itemArr = [];
  31739. var hasTbar = false, hasFbar = false, hasBody = false;
  31740. if (raw.hasOwnProperty("children")) {
  31741. _.forEach(raw.children, function (value) {
  31742. if (value.layoutName === 'tbar') {
  31743. hasTbar = true;
  31744. }
  31745. else if (value.layoutName === 'fbar') {
  31746. hasFbar = true;
  31747. }
  31748. else {
  31749. hasBody = true;
  31750. }
  31751. });
  31752. }
  31753. switch (switchType) {
  31754. case 'fit':
  31755. if (!hasTbar) {
  31756. itemArr.push('tbar');
  31757. }
  31758. if (!hasFbar) {
  31759. itemArr.push('fbar');
  31760. }
  31761. if (!hasBody) {
  31762. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31763. }
  31764. option.items = this.menuNew(itemArr, raw);
  31765. break;
  31766. case 'border':
  31767. if (!hasTbar) {
  31768. itemArr.push('tbar');
  31769. }
  31770. if (!hasFbar) {
  31771. itemArr.push('fbar');
  31772. }
  31773. itemArr.push('cnsew');
  31774. option.items = this.menuNew(itemArr, raw);
  31775. break;
  31776. // case 'tbar':
  31777. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31778. // break;
  31779. // case 'fbar':
  31780. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31781. // break;
  31782. case 'tabpanel':
  31783. if (!hasTbar) {
  31784. itemArr.push('tbar');
  31785. }
  31786. if (!hasFbar) {
  31787. itemArr.push('fbar');
  31788. }
  31789. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31790. option.items = this.menuNew(itemArr, raw);
  31791. break;
  31792. case 'yvgrid':
  31793. if (!hasTbar) {
  31794. itemArr.push('tbar');
  31795. }
  31796. option.items = this.menuNew(itemArr, raw);
  31797. break;
  31798. case 'tree':
  31799. if (!hasTbar) {
  31800. itemArr.push('tbar');
  31801. }
  31802. if (!hasFbar) {
  31803. itemArr.push('fbar');
  31804. }
  31805. option.items = this.menuNew(itemArr, raw);
  31806. break;
  31807. case 'fieldset':
  31808. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31809. break;
  31810. case 'form':
  31811. if (!hasTbar) {
  31812. itemArr.push('tbar');
  31813. }
  31814. if (!hasFbar) {
  31815. itemArr.push('fbar');
  31816. }
  31817. itemArr.push('form', 'fieldset', 'cols');
  31818. option.items = this.menuNew(itemArr, raw);
  31819. break;
  31820. case 'toolbar':
  31821. itemArr.push('button', 'textfield', 'label', 'combo');
  31822. option.items = this.menuNew(itemArr, raw);
  31823. break;
  31824. // case 'fbar':
  31825. // itemArr.push('button', 'textfield', 'label', 'combo')
  31826. // option.items = this.menuNew(itemArr, raw)
  31827. // break
  31828. default:
  31829. option.items = this.menuNew(itemArr, raw);
  31830. break;
  31831. }
  31832. var treeMenu = new Ext.menu.Menu(option);
  31833. treeMenu.showAt(e.getXY());
  31834. },
  31835. newItem: function (viewType, raw, region) {
  31836. var itemVjson = {};
  31837. switch (viewType) {
  31838. case 'fit':
  31839. itemVjson.layout = 'fit';
  31840. itemVjson.items = [];
  31841. break;
  31842. case 'border':
  31843. itemVjson.layout = 'border';
  31844. itemVjson.items = [];
  31845. break;
  31846. case 'toolbar':
  31847. itemVjson.xtype = 'toolbar';
  31848. itemVjson.title = 'toolbar';
  31849. itemVjson.items = [
  31850. {
  31851. xtype: 'button',
  31852. text: 'button'
  31853. }
  31854. ];
  31855. break;
  31856. case 'tabpanel':
  31857. itemVjson.xtype = 'tabpanel';
  31858. itemVjson.layout = 'fit';
  31859. itemVjson.items = [];
  31860. break;
  31861. case 'yvgrid':
  31862. itemVjson.xtype = 'yvgrid';
  31863. itemVjson.layout = 'fit';
  31864. itemVjson.pagination = false;
  31865. itemVjson.columns = [
  31866. {
  31867. dataIndex: "skuId",
  31868. header: "SKU_ID",
  31869. },
  31870. ];
  31871. break;
  31872. case 'tree':
  31873. itemVjson.xtype = 'treepanel';
  31874. itemVjson.layout = 'fit';
  31875. break;
  31876. case 'fieldset':
  31877. case 'form':
  31878. itemVjson.xtype = viewType;
  31879. itemVjson.title = viewType;
  31880. itemVjson.items = [
  31881. {
  31882. xtype: 'cols',
  31883. items: [
  31884. {
  31885. xtype: 'textfield',
  31886. fieldLabel: '输入框'
  31887. }
  31888. ]
  31889. }
  31890. ];
  31891. break;
  31892. case 'cols':
  31893. itemVjson.xtype = 'cols';
  31894. itemVjson.items = [
  31895. {
  31896. xtype: 'textfield',
  31897. fieldLabel: '输入框'
  31898. }
  31899. ];
  31900. break;
  31901. case 'button':
  31902. itemVjson.xtype = 'button';
  31903. itemVjson.text = '按钮';
  31904. itemVjson.iconCls = 'x-fa fa-plus';
  31905. break;
  31906. case 'textfield':
  31907. itemVjson.xtype = 'textfield';
  31908. itemVjson.fieldLabel = '输入框';
  31909. break;
  31910. case 'combo':
  31911. itemVjson.xtype = 'combo';
  31912. itemVjson.fieldLabel = '下拉框';
  31913. break;
  31914. case 'label':
  31915. itemVjson.xtype = 'label';
  31916. itemVjson.text = '文本';
  31917. break;
  31918. }
  31919. var target = findInCode(this.vjson, raw.id);
  31920. if (region) {
  31921. if (region === 'tbar' || region === 'fbar') {
  31922. target[region] = itemVjson;
  31923. }
  31924. else {
  31925. itemVjson.region = region;
  31926. itemVjson.split = true;
  31927. if (region === 'north' || region === 'south') {
  31928. itemVjson.height = '30%';
  31929. itemVjson.collapsible = true;
  31930. }
  31931. else if (region === 'west' || region === 'east') {
  31932. itemVjson.width = '30%';
  31933. itemVjson.collapsible = true;
  31934. }
  31935. target.items.push(itemVjson);
  31936. }
  31937. }
  31938. else {
  31939. if (target.xtype === 'tabpanel') {
  31940. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  31941. }
  31942. target.items.push(itemVjson);
  31943. }
  31944. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  31945. },
  31946. menuNew: function (typeArr, raw, region) {
  31947. var that = this;
  31948. var reArr = [];
  31949. typeArr.forEach(function (value) {
  31950. if (value === 'cnsew') {
  31951. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  31952. }
  31953. else if (value === 'tbar' || value === 'fbar') {
  31954. reArr.push(that.menuNewTFBar(value, raw));
  31955. }
  31956. else {
  31957. reArr.push({
  31958. text: '新建' + layoutOrXtypeNameMap[value],
  31959. iconCls: 'x-fa fa-plus',
  31960. handler: function (sender) {
  31961. that.newItem(value, raw, region);
  31962. }
  31963. });
  31964. }
  31965. reArr.push("-");
  31966. });
  31967. if (region) {
  31968. reArr.pop();
  31969. return reArr;
  31970. }
  31971. reArr.push({
  31972. text: '高级属性',
  31973. iconCls: 'x-fa fa-cog',
  31974. handler: function (sender) {
  31975. var vj = findInCode(that.vjson, raw.id);
  31976. that.advancedSettingWindow(vj);
  31977. }
  31978. }, {
  31979. text: '上移',
  31980. iconCls: 'x-fa fa-trash',
  31981. handler: function (sender) {
  31982. that.moveCmp(raw.id, 'up');
  31983. }
  31984. }, {
  31985. text: '置顶',
  31986. iconCls: 'x-fa fa-trash',
  31987. handler: function (sender) {
  31988. that.moveCmp(raw.id, 'top');
  31989. }
  31990. }, {
  31991. text: '置底',
  31992. iconCls: 'x-fa fa-trash',
  31993. handler: function (sender) {
  31994. that.moveCmp(raw.id, 'bottom');
  31995. }
  31996. }, {
  31997. text: '下移',
  31998. iconCls: 'x-fa fa-trash',
  31999. handler: function (sender) {
  32000. that.moveCmp(raw.id, 'down');
  32001. }
  32002. }, {
  32003. text: '删除',
  32004. iconCls: 'x-fa fa-trash',
  32005. handler: function (sender) {
  32006. deletVjsonById(that.vjson, raw.id);
  32007. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32008. }
  32009. });
  32010. return reArr;
  32011. },
  32012. menuNewCNSEW: function (raw) {
  32013. var that = this;
  32014. var arr = ['center', 'north', 'south', 'west', 'east'];
  32015. if (raw.hasOwnProperty("children")) {
  32016. _.forEach(raw.children, function (value) {
  32017. _.remove(arr, function (it) {
  32018. return it === value.layoutName;
  32019. });
  32020. });
  32021. }
  32022. var reArr = [];
  32023. arr.forEach(function (value) {
  32024. reArr.push({
  32025. text: layoutOrXtypeNameMap[value],
  32026. iconCls: 'x-fa fa-plus',
  32027. menu: {
  32028. showSeparator: true,
  32029. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32030. }
  32031. });
  32032. reArr.push("-");
  32033. });
  32034. reArr.pop();
  32035. return reArr;
  32036. },
  32037. menuNewTFBar: function (barType, raw) {
  32038. var that = this;
  32039. var reObj = {
  32040. text: layoutOrXtypeNameMap[barType],
  32041. iconCls: 'x-fa fa-plus',
  32042. menu: {
  32043. showSeparator: true,
  32044. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32045. }
  32046. };
  32047. return reObj;
  32048. },
  32049. moveCmp: function (id, moveType) {
  32050. var arr = findArrayContainer(this.vjson, id);
  32051. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32052. if (index < 0) {
  32053. return;
  32054. }
  32055. switch (moveType) {
  32056. case 'up':
  32057. if (index > 0) {
  32058. var o = arr[index];
  32059. arr[index] = arr[index - 1];
  32060. arr[index - 1] = o;
  32061. }
  32062. else {
  32063. return;
  32064. }
  32065. break;
  32066. case 'down':
  32067. if (index < arr.length - 1) {
  32068. var o = arr[index];
  32069. arr[index] = arr[index + 1];
  32070. arr[index + 1] = o;
  32071. }
  32072. else {
  32073. return;
  32074. }
  32075. break;
  32076. case 'top':
  32077. if (index > 0) {
  32078. var o = arr[index];
  32079. arr[index] = arr[0];
  32080. arr[0] = o;
  32081. }
  32082. else {
  32083. return;
  32084. }
  32085. break;
  32086. case 'bottom':
  32087. if (index < arr.length - 1) {
  32088. var o = arr[index];
  32089. arr[index] = arr[arr.length - 1];
  32090. arr[arr.length - 1] = o;
  32091. }
  32092. else {
  32093. return;
  32094. }
  32095. break;
  32096. }
  32097. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32098. }
  32099. });
  32100. }
  32101. //# sourceMappingURL=ViewOutlineTree.js.map
  32102. function init$2 () {
  32103. window['native'] = native;
  32104. native.init();
  32105. init();
  32106. initStateTree();
  32107. initDashboard();
  32108. initFileTree();
  32109. initDbTree();
  32110. initReportGrid();
  32111. initGroovyEditor();
  32112. initJsEditor$1();
  32113. initJsonEditor$1();
  32114. initSqlEditor$1();
  32115. initTemplateEditor();
  32116. initDict$1();
  32117. initBpmnTree();
  32118. initToolBox();
  32119. initPropertyDesign();
  32120. initViewOutlineTree();
  32121. initWidget();
  32122. initWhLayout();
  32123. initApiTree();
  32124. initTaskTree();
  32125. initLogsTree();
  32126. initDevOpsTree();
  32127. initTerminal();
  32128. initMonitorTree();
  32129. initHomeTree();
  32130. }
  32131. //# sourceMappingURL=init.js.map
  32132. var studio = {
  32133. init: init$2,
  32134. handles: handles$1,
  32135. Workbench: Workbench
  32136. };
  32137. //# sourceMappingURL=index.js.map
  32138. exports.axios = axios;
  32139. exports.qs = Qs;
  32140. exports.lodash = _$2;
  32141. exports.jquery = $$2;
  32142. exports.moment = moment$1;
  32143. exports.recast = recast;
  32144. exports.XLSX = XLSX;
  32145. exports.Defaults = Defaults;
  32146. exports.ExcelImportDialog = ExcelImportDialog;
  32147. exports.Lib = Lib;
  32148. exports.LibParam = LibParam;
  32149. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32150. exports.ReportScope = ReportScope;
  32151. exports.SIMPLE_RE = SIMPLE_RE;
  32152. exports.Scope = Scope;
  32153. exports.ScopeEngine = ScopeEngine;
  32154. exports.SystemEventFu = SystemEventFu;
  32155. exports.ajax = ajax;
  32156. exports.baseConfigProcess = baseConfigProcess;
  32157. exports.baseConfigProcessList = baseConfigProcessList;
  32158. exports.buildPlus = buildPlus;
  32159. exports.buildReportScope = buildReportScope;
  32160. exports.calcExpress = calcExpress;
  32161. exports.calcObject = calcObject;
  32162. exports.calcObjectFlat = calcObjectFlat;
  32163. exports.clearViewModel = clearViewModel;
  32164. exports.clearViewModelByLookup = clearViewModelByLookup;
  32165. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32166. exports.clearViewModelValues = clearViewModelValues;
  32167. exports.commitMe = commitMe;
  32168. exports.confirm = confirm;
  32169. exports.createAjax = createAjax;
  32170. exports.createUUID = createUUID;
  32171. exports.downLoad = downLoad;
  32172. exports.evalFunction = evalFunction;
  32173. exports.extend = extend;
  32174. exports.flatRow = flatRow;
  32175. exports.getApiConvert = getApiConvert;
  32176. exports.getGridEditRows = getGridEditRows;
  32177. exports.getParentGrid = getParentGrid;
  32178. exports.getPinyin = getPinyin;
  32179. exports.getRegList = getRegList;
  32180. exports.getRegParamList = getRegParamList;
  32181. exports.getScopeOnCreate = getScopeOnCreate;
  32182. exports.init = init$1;
  32183. exports.insertGridRow = insertGridRow;
  32184. exports.invokeServer = invokeServer$1;
  32185. exports.isDesignMode = isDesignMode;
  32186. exports.isEmpty = isEmpty;
  32187. exports.json5 = dist;
  32188. exports.keywordFilter = keywordFilter;
  32189. exports.lookupFn = lookupFn;
  32190. exports.lookupScope = lookupScope;
  32191. exports.mergeViewModel = mergeViewModel;
  32192. exports.moveDownGridRow = moveDownGridRow;
  32193. exports.moveUpGridRow = moveUpGridRow;
  32194. exports.msg = msg$1;
  32195. exports.msgError = msgError;
  32196. exports.normId = normId;
  32197. exports.pinyinMatch = pinyinMatch;
  32198. exports.prompt = prompt$2;
  32199. exports.raiseClick = raiseClick;
  32200. exports.reloadGrid = reloadGrid;
  32201. exports.removeGridRow = removeGridRow;
  32202. exports.replaceNA = replaceNA;
  32203. exports.saveGridRow = saveGridRow;
  32204. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32205. exports.setComboStore = setComboStore;
  32206. exports.showErrorDialog = showErrorDialog$1;
  32207. exports.showInfoDialog = showInfoDialog;
  32208. exports.showWidget = showWidget;
  32209. exports.sqlUrlTransform = sqlUrlTransform;
  32210. exports.stopEvent = stopEvent;
  32211. exports.studio = studio;
  32212. exports.toPlainObject = toPlainObject;
  32213. exports.toString = toString;
  32214. exports.tryEnable = tryEnable;
  32215. exports.tryVarSimple = tryVarSimple;
  32216. exports.tryWriteByExpress = tryWriteByExpress;
  32217. exports.tryWriteObject = tryWriteObject;
  32218. exports.watch = watch;
  32219. Object.defineProperty(exports, '__esModule', { value: true });
  32220. });
  32221. //# sourceMappingURL=yvan-ext.js.map