yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863
  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. typeAheadDelay: 1,
  50. queryDelay: 1,
  51. };
  52. var comboGrid = {
  53. selectOnTab: true,
  54. pickerHeight: 500,
  55. pickerWidth: 850,
  56. editEnable: null,
  57. };
  58. var comboGridPicker = {
  59. xtype: 'yvgrid',
  60. layout: 'fit',
  61. selModel: {
  62. selType: 'rowmodel',
  63. mode: 'SINGLE'
  64. },
  65. };
  66. var comboGridMulti = {
  67. selectOnTab: true,
  68. pickerHeight: 500,
  69. pickerWidth: 850,
  70. editEnable: null,
  71. splitChar: ',',
  72. displayField: 'text',
  73. valueField: 'id',
  74. autoLoad: true,
  75. };
  76. var comboGridMultiPicker = {
  77. selType: 'checkboxmodel',
  78. selModel: {
  79. type: 'checkboxmodel',
  80. checkOnly: false
  81. },
  82. };
  83. var numberfield = {
  84. labelAlign: 'right',
  85. decimalPrecision: 6,
  86. labelWidth: labelWidth,
  87. };
  88. var checkbox = {
  89. labelAlign: 'right',
  90. labelWidth: labelWidth,
  91. checkedValue: true,
  92. uncheckedValue: false,
  93. };
  94. var checkboxgroup = {
  95. labelAlign: 'right',
  96. labelWidth: labelWidth,
  97. };
  98. var radio = {
  99. labelAlign: 'right',
  100. labelWidth: labelWidth,
  101. };
  102. var radiogroup = {
  103. labelAlign: 'right',
  104. labelWidth: labelWidth,
  105. simpleValue: true,
  106. layout: 'hbox',
  107. defaults: {
  108. xtype: 'radio',
  109. name: 'type',
  110. margin: '0 15 0 0'
  111. },
  112. };
  113. var form = {
  114. margin: '5 5 0 0',
  115. border: false,
  116. defaults: {
  117. margin: '0 0 5 0',
  118. border: false,
  119. },
  120. };
  121. var column = {
  122. filter: { type: 'string' },
  123. };
  124. var grid = {
  125. border: true,
  126. columnLines: true,
  127. rowLines: true,
  128. plugins: {
  129. cellediting: {
  130. clicksToEdit: 1,
  131. },
  132. gridfilters: true
  133. },
  134. multiColumnSort: true,
  135. viewConfig: {
  136. enableTextSelection: true,
  137. sortOnClick: false,
  138. emptyText: '没有数据'
  139. },
  140. selModel: {
  141. type: 'checkboxmodel',
  142. checkOnly: false
  143. },
  144. pagination: true,
  145. pageSize: 50,
  146. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  147. hideFootbar: false,
  148. hideRefresh: false,
  149. hideExport: false,
  150. hideAutoSize: false,
  151. hideClearFilter: false,
  152. hideSaveGridUIConfig: false,
  153. hideClearGridUIConfig: false,
  154. autoLoad: true,
  155. remoteSort: false,
  156. remoteFilter: false,
  157. enableLocking: true,
  158. syncRowHeight: false,
  159. enableColumnMove: true,
  160. enableColumnHide: true,
  161. enableColumnResize: true,
  162. hidden: false,
  163. disabled: false,
  164. exportExcelPageSize: 100,
  165. exportExcelCurrentPage: 1,
  166. exportExcelTotal: 0,
  167. cellTip: false,
  168. };
  169. var fieldContainer = {
  170. labelAlign: 'right',
  171. labelWidth: labelWidth,
  172. layout: 'hbox',
  173. defaults: {
  174. flex: 1,
  175. }
  176. };
  177. var tree = {
  178. autoLoad: true,
  179. hideFilter: false,
  180. hideToolbar: false,
  181. hideRefresh: false,
  182. hideExpand: false,
  183. hideCollapse: false,
  184. root: [],
  185. rootVisible: false,
  186. };
  187. var search = {
  188. labelAlign: 'right',
  189. labelWidth: labelWidth,
  190. };
  191. var text = {
  192. labelAlign: 'right',
  193. labelWidth: labelWidth,
  194. msgTarget: 'qtip',
  195. };
  196. var toolbar = {
  197. overflowHandler: 'menu',
  198. };
  199. var tbfill = {};
  200. var tbseparator = {};
  201. var button = {};
  202. var fieldSet = {
  203. margin: '5 5 0 0',
  204. border: false,
  205. defaults: {
  206. margin: '0 0 5 0',
  207. border: false,
  208. },
  209. };
  210. var storeAjax = {
  211. timeout: 60000
  212. };
  213. var panel = {};
  214. var splitter = {};
  215. var maintab = {};
  216. var rows = {};
  217. var cols = {
  218. defaults: {
  219. flex: 1
  220. },
  221. };
  222. var bpmn = {
  223. hideRefresh: false,
  224. autoLoad: true,
  225. dataSource: '',
  226. bpmnConfig: {}
  227. };
  228. var Defaults = /*#__PURE__*/Object.freeze({
  229. __proto__: null,
  230. windows: windows,
  231. date: date,
  232. tagfield: tagfield,
  233. combo: combo,
  234. comboGrid: comboGrid,
  235. comboGridPicker: comboGridPicker,
  236. comboGridMulti: comboGridMulti,
  237. comboGridMultiPicker: comboGridMultiPicker,
  238. numberfield: numberfield,
  239. checkbox: checkbox,
  240. checkboxgroup: checkboxgroup,
  241. radio: radio,
  242. radiogroup: radiogroup,
  243. form: form,
  244. column: column,
  245. grid: grid,
  246. fieldContainer: fieldContainer,
  247. tree: tree,
  248. search: search,
  249. text: text,
  250. toolbar: toolbar,
  251. tbfill: tbfill,
  252. tbseparator: tbseparator,
  253. button: button,
  254. fieldSet: fieldSet,
  255. storeAjax: storeAjax,
  256. panel: panel,
  257. splitter: splitter,
  258. maintab: maintab,
  259. rows: rows,
  260. cols: cols,
  261. bpmn: bpmn
  262. });
  263. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  264. function createCommonjsModule(fn, module) {
  265. return module = { exports: {} }, fn(module, module.exports), module.exports;
  266. }
  267. var dist = createCommonjsModule(function (module, exports) {
  268. (function (global, factory) {
  269. module.exports = factory() ;
  270. }(commonjsGlobal, (function () {
  271. function createCommonjsModule(fn, module) {
  272. return module = { exports: {} }, fn(module, module.exports), module.exports;
  273. }
  274. var _global = createCommonjsModule(function (module) {
  275. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  276. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  277. ? window : typeof self != 'undefined' && self.Math == Math ? self
  278. // eslint-disable-next-line no-new-func
  279. : Function('return this')();
  280. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  281. });
  282. var _core = createCommonjsModule(function (module) {
  283. var core = module.exports = { version: '2.6.5' };
  284. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  285. });
  286. var _core_1 = _core.version;
  287. var _isObject = function (it) {
  288. return typeof it === 'object' ? it !== null : typeof it === 'function';
  289. };
  290. var _anObject = function (it) {
  291. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  292. return it;
  293. };
  294. var _fails = function (exec) {
  295. try {
  296. return !!exec();
  297. } catch (e) {
  298. return true;
  299. }
  300. };
  301. // Thank's IE8 for his funny defineProperty
  302. var _descriptors = !_fails(function () {
  303. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  304. });
  305. var document = _global.document;
  306. // typeof document.createElement is 'object' in old IE
  307. var is = _isObject(document) && _isObject(document.createElement);
  308. var _domCreate = function (it) {
  309. return is ? document.createElement(it) : {};
  310. };
  311. var _ie8DomDefine = !_descriptors && !_fails(function () {
  312. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  313. });
  314. // 7.1.1 ToPrimitive(input [, PreferredType])
  315. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  316. // and the second argument - flag - preferred type is a string
  317. var _toPrimitive = function (it, S) {
  318. if (!_isObject(it)) { return it; }
  319. var fn, val;
  320. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  323. throw TypeError("Can't convert object to primitive value");
  324. };
  325. var dP = Object.defineProperty;
  326. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  327. _anObject(O);
  328. P = _toPrimitive(P, true);
  329. _anObject(Attributes);
  330. if (_ie8DomDefine) { try {
  331. return dP(O, P, Attributes);
  332. } catch (e) { /* empty */ } }
  333. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  334. if ('value' in Attributes) { O[P] = Attributes.value; }
  335. return O;
  336. };
  337. var _objectDp = {
  338. f: f
  339. };
  340. var _propertyDesc = function (bitmap, value) {
  341. return {
  342. enumerable: !(bitmap & 1),
  343. configurable: !(bitmap & 2),
  344. writable: !(bitmap & 4),
  345. value: value
  346. };
  347. };
  348. var _hide = _descriptors ? function (object, key, value) {
  349. return _objectDp.f(object, key, _propertyDesc(1, value));
  350. } : function (object, key, value) {
  351. object[key] = value;
  352. return object;
  353. };
  354. var hasOwnProperty = {}.hasOwnProperty;
  355. var _has = function (it, key) {
  356. return hasOwnProperty.call(it, key);
  357. };
  358. var id = 0;
  359. var px = Math.random();
  360. var _uid = function (key) {
  361. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  362. };
  363. var _shared = createCommonjsModule(function (module) {
  364. var SHARED = '__core-js_shared__';
  365. var store = _global[SHARED] || (_global[SHARED] = {});
  366. (module.exports = function (key, value) {
  367. return store[key] || (store[key] = value !== undefined ? value : {});
  368. })('versions', []).push({
  369. version: _core.version,
  370. mode: 'global',
  371. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  372. });
  373. });
  374. var _functionToString = _shared('native-function-to-string', Function.toString);
  375. var _redefine = createCommonjsModule(function (module) {
  376. var SRC = _uid('src');
  377. var TO_STRING = 'toString';
  378. var TPL = ('' + _functionToString).split(TO_STRING);
  379. _core.inspectSource = function (it) {
  380. return _functionToString.call(it);
  381. };
  382. (module.exports = function (O, key, val, safe) {
  383. var isFunction = typeof val == 'function';
  384. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  385. if (O[key] === val) { return; }
  386. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  387. if (O === _global) {
  388. O[key] = val;
  389. } else if (!safe) {
  390. delete O[key];
  391. _hide(O, key, val);
  392. } else if (O[key]) {
  393. O[key] = val;
  394. } else {
  395. _hide(O, key, val);
  396. }
  397. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  398. })(Function.prototype, TO_STRING, function toString() {
  399. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  400. });
  401. });
  402. var _aFunction = function (it) {
  403. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  404. return it;
  405. };
  406. // optional / simple context binding
  407. var _ctx = function (fn, that, length) {
  408. _aFunction(fn);
  409. if (that === undefined) { return fn; }
  410. switch (length) {
  411. case 1: return function (a) {
  412. return fn.call(that, a);
  413. };
  414. case 2: return function (a, b) {
  415. return fn.call(that, a, b);
  416. };
  417. case 3: return function (a, b, c) {
  418. return fn.call(that, a, b, c);
  419. };
  420. }
  421. return function (/* ...args */) {
  422. return fn.apply(that, arguments);
  423. };
  424. };
  425. var PROTOTYPE = 'prototype';
  426. var $export = function (type, name, source) {
  427. var IS_FORCED = type & $export.F;
  428. var IS_GLOBAL = type & $export.G;
  429. var IS_STATIC = type & $export.S;
  430. var IS_PROTO = type & $export.P;
  431. var IS_BIND = type & $export.B;
  432. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  433. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  434. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  435. var key, own, out, exp;
  436. if (IS_GLOBAL) { source = name; }
  437. for (key in source) {
  438. // contains in native
  439. own = !IS_FORCED && target && target[key] !== undefined;
  440. // export native or passed
  441. out = (own ? target : source)[key];
  442. // bind timers to global for call from export context
  443. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  444. // extend global
  445. if (target) { _redefine(target, key, out, type & $export.U); }
  446. // export
  447. if (exports[key] != out) { _hide(exports, key, exp); }
  448. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  449. }
  450. };
  451. _global.core = _core;
  452. // type bitmap
  453. $export.F = 1; // forced
  454. $export.G = 2; // global
  455. $export.S = 4; // static
  456. $export.P = 8; // proto
  457. $export.B = 16; // bind
  458. $export.W = 32; // wrap
  459. $export.U = 64; // safe
  460. $export.R = 128; // real proto method for `library`
  461. var _export = $export;
  462. // 7.1.4 ToInteger
  463. var ceil = Math.ceil;
  464. var floor = Math.floor;
  465. var _toInteger = function (it) {
  466. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  467. };
  468. // 7.2.1 RequireObjectCoercible(argument)
  469. var _defined = function (it) {
  470. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  471. return it;
  472. };
  473. // true -> String#at
  474. // false -> String#codePointAt
  475. var _stringAt = function (TO_STRING) {
  476. return function (that, pos) {
  477. var s = String(_defined(that));
  478. var i = _toInteger(pos);
  479. var l = s.length;
  480. var a, b;
  481. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  482. a = s.charCodeAt(i);
  483. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  484. ? TO_STRING ? s.charAt(i) : a
  485. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  486. };
  487. };
  488. var $at = _stringAt(false);
  489. _export(_export.P, 'String', {
  490. // 21.1.3.3 String.prototype.codePointAt(pos)
  491. codePointAt: function codePointAt(pos) {
  492. return $at(this, pos);
  493. }
  494. });
  495. var codePointAt = _core.String.codePointAt;
  496. var max = Math.max;
  497. var min = Math.min;
  498. var _toAbsoluteIndex = function (index, length) {
  499. index = _toInteger(index);
  500. return index < 0 ? max(index + length, 0) : min(index, length);
  501. };
  502. var fromCharCode = String.fromCharCode;
  503. var $fromCodePoint = String.fromCodePoint;
  504. // length should be 1, old FF problem
  505. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  506. // 21.1.2.2 String.fromCodePoint(...codePoints)
  507. fromCodePoint: function fromCodePoint(x) {
  508. var arguments$1 = arguments;
  509. // eslint-disable-line no-unused-vars
  510. var res = [];
  511. var aLen = arguments.length;
  512. var i = 0;
  513. var code;
  514. while (aLen > i) {
  515. code = +arguments$1[i++];
  516. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  517. res.push(code < 0x10000
  518. ? fromCharCode(code)
  519. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  520. );
  521. } return res.join('');
  522. }
  523. });
  524. var fromCodePoint = _core.String.fromCodePoint;
  525. // This is a generated file. Do not edit.
  526. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  527. 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]/;
  528. 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]/;
  529. var unicode = {
  530. Space_Separator: Space_Separator,
  531. ID_Start: ID_Start,
  532. ID_Continue: ID_Continue
  533. };
  534. var util = {
  535. isSpaceSeparator: function isSpaceSeparator (c) {
  536. return typeof c === 'string' && unicode.Space_Separator.test(c)
  537. },
  538. isIdStartChar: function isIdStartChar (c) {
  539. return typeof c === 'string' && (
  540. (c >= 'a' && c <= 'z') ||
  541. (c >= 'A' && c <= 'Z') ||
  542. (c === '$') || (c === '_') ||
  543. unicode.ID_Start.test(c)
  544. )
  545. },
  546. isIdContinueChar: function isIdContinueChar (c) {
  547. return typeof c === 'string' && (
  548. (c >= 'a' && c <= 'z') ||
  549. (c >= 'A' && c <= 'Z') ||
  550. (c >= '0' && c <= '9') ||
  551. (c === '$') || (c === '_') ||
  552. (c === '\u200C') || (c === '\u200D') ||
  553. unicode.ID_Continue.test(c)
  554. )
  555. },
  556. isDigit: function isDigit (c) {
  557. return typeof c === 'string' && /[0-9]/.test(c)
  558. },
  559. isHexDigit: function isHexDigit (c) {
  560. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  561. },
  562. };
  563. var source;
  564. var parseState;
  565. var stack;
  566. var pos;
  567. var line;
  568. var column;
  569. var token;
  570. var key;
  571. var root;
  572. var parse = function parse (text, reviver) {
  573. source = String(text);
  574. parseState = 'start';
  575. stack = [];
  576. pos = 0;
  577. line = 1;
  578. column = 0;
  579. token = undefined;
  580. key = undefined;
  581. root = undefined;
  582. do {
  583. token = lex();
  584. // This code is unreachable.
  585. // if (!parseStates[parseState]) {
  586. // throw invalidParseState()
  587. // }
  588. parseStates[parseState]();
  589. } while (token.type !== 'eof')
  590. if (typeof reviver === 'function') {
  591. return internalize({'': root}, '', reviver)
  592. }
  593. return root
  594. };
  595. function internalize (holder, name, reviver) {
  596. var value = holder[name];
  597. if (value != null && typeof value === 'object') {
  598. for (var key in value) {
  599. var replacement = internalize(value, key, reviver);
  600. if (replacement === undefined) {
  601. delete value[key];
  602. } else {
  603. value[key] = replacement;
  604. }
  605. }
  606. }
  607. return reviver.call(holder, name, value)
  608. }
  609. var lexState;
  610. var buffer;
  611. var doubleQuote;
  612. var sign;
  613. var c;
  614. function lex () {
  615. lexState = 'default';
  616. buffer = '';
  617. doubleQuote = false;
  618. sign = 1;
  619. for (;;) {
  620. c = peek();
  621. // This code is unreachable.
  622. // if (!lexStates[lexState]) {
  623. // throw invalidLexState(lexState)
  624. // }
  625. var token = lexStates[lexState]();
  626. if (token) {
  627. return token
  628. }
  629. }
  630. }
  631. function peek () {
  632. if (source[pos]) {
  633. return String.fromCodePoint(source.codePointAt(pos))
  634. }
  635. }
  636. function read () {
  637. var c = peek();
  638. if (c === '\n') {
  639. line++;
  640. column = 0;
  641. } else if (c) {
  642. column += c.length;
  643. } else {
  644. column++;
  645. }
  646. if (c) {
  647. pos += c.length;
  648. }
  649. return c
  650. }
  651. var lexStates = {
  652. default: function default$1 () {
  653. switch (c) {
  654. case '\t':
  655. case '\v':
  656. case '\f':
  657. case ' ':
  658. case '\u00A0':
  659. case '\uFEFF':
  660. case '\n':
  661. case '\r':
  662. case '\u2028':
  663. case '\u2029':
  664. read();
  665. return
  666. case '/':
  667. read();
  668. lexState = 'comment';
  669. return
  670. case undefined:
  671. read();
  672. return newToken('eof')
  673. }
  674. if (util.isSpaceSeparator(c)) {
  675. read();
  676. return
  677. }
  678. // This code is unreachable.
  679. // if (!lexStates[parseState]) {
  680. // throw invalidLexState(parseState)
  681. // }
  682. return lexStates[parseState]()
  683. },
  684. comment: function comment () {
  685. switch (c) {
  686. case '*':
  687. read();
  688. lexState = 'multiLineComment';
  689. return
  690. case '/':
  691. read();
  692. lexState = 'singleLineComment';
  693. return
  694. }
  695. throw invalidChar(read())
  696. },
  697. multiLineComment: function multiLineComment () {
  698. switch (c) {
  699. case '*':
  700. read();
  701. lexState = 'multiLineCommentAsterisk';
  702. return
  703. case undefined:
  704. throw invalidChar(read())
  705. }
  706. read();
  707. },
  708. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  709. switch (c) {
  710. case '*':
  711. read();
  712. return
  713. case '/':
  714. read();
  715. lexState = 'default';
  716. return
  717. case undefined:
  718. throw invalidChar(read())
  719. }
  720. read();
  721. lexState = 'multiLineComment';
  722. },
  723. singleLineComment: function singleLineComment () {
  724. switch (c) {
  725. case '\n':
  726. case '\r':
  727. case '\u2028':
  728. case '\u2029':
  729. read();
  730. lexState = 'default';
  731. return
  732. case undefined:
  733. read();
  734. return newToken('eof')
  735. }
  736. read();
  737. },
  738. value: function value () {
  739. switch (c) {
  740. case '{':
  741. case '[':
  742. return newToken('punctuator', read())
  743. case 'n':
  744. read();
  745. literal('ull');
  746. return newToken('null', null)
  747. case 't':
  748. read();
  749. literal('rue');
  750. return newToken('boolean', true)
  751. case 'f':
  752. read();
  753. literal('alse');
  754. return newToken('boolean', false)
  755. case '-':
  756. case '+':
  757. if (read() === '-') {
  758. sign = -1;
  759. }
  760. lexState = 'sign';
  761. return
  762. case '.':
  763. buffer = read();
  764. lexState = 'decimalPointLeading';
  765. return
  766. case '0':
  767. buffer = read();
  768. lexState = 'zero';
  769. return
  770. case '1':
  771. case '2':
  772. case '3':
  773. case '4':
  774. case '5':
  775. case '6':
  776. case '7':
  777. case '8':
  778. case '9':
  779. buffer = read();
  780. lexState = 'decimalInteger';
  781. return
  782. case 'I':
  783. read();
  784. literal('nfinity');
  785. return newToken('numeric', Infinity)
  786. case 'N':
  787. read();
  788. literal('aN');
  789. return newToken('numeric', NaN)
  790. case '"':
  791. case "'":
  792. doubleQuote = (read() === '"');
  793. buffer = '';
  794. lexState = 'string';
  795. return
  796. }
  797. throw invalidChar(read())
  798. },
  799. identifierNameStartEscape: function identifierNameStartEscape () {
  800. if (c !== 'u') {
  801. throw invalidChar(read())
  802. }
  803. read();
  804. var u = unicodeEscape();
  805. switch (u) {
  806. case '$':
  807. case '_':
  808. break
  809. default:
  810. if (!util.isIdStartChar(u)) {
  811. throw invalidIdentifier()
  812. }
  813. break
  814. }
  815. buffer += u;
  816. lexState = 'identifierName';
  817. },
  818. identifierName: function identifierName () {
  819. switch (c) {
  820. case '$':
  821. case '_':
  822. case '\u200C':
  823. case '\u200D':
  824. buffer += read();
  825. return
  826. case '\\':
  827. read();
  828. lexState = 'identifierNameEscape';
  829. return
  830. }
  831. if (util.isIdContinueChar(c)) {
  832. buffer += read();
  833. return
  834. }
  835. return newToken('identifier', buffer)
  836. },
  837. identifierNameEscape: function identifierNameEscape () {
  838. if (c !== 'u') {
  839. throw invalidChar(read())
  840. }
  841. read();
  842. var u = unicodeEscape();
  843. switch (u) {
  844. case '$':
  845. case '_':
  846. case '\u200C':
  847. case '\u200D':
  848. break
  849. default:
  850. if (!util.isIdContinueChar(u)) {
  851. throw invalidIdentifier()
  852. }
  853. break
  854. }
  855. buffer += u;
  856. lexState = 'identifierName';
  857. },
  858. sign: function sign$1 () {
  859. switch (c) {
  860. case '.':
  861. buffer = read();
  862. lexState = 'decimalPointLeading';
  863. return
  864. case '0':
  865. buffer = read();
  866. lexState = 'zero';
  867. return
  868. case '1':
  869. case '2':
  870. case '3':
  871. case '4':
  872. case '5':
  873. case '6':
  874. case '7':
  875. case '8':
  876. case '9':
  877. buffer = read();
  878. lexState = 'decimalInteger';
  879. return
  880. case 'I':
  881. read();
  882. literal('nfinity');
  883. return newToken('numeric', sign * Infinity)
  884. case 'N':
  885. read();
  886. literal('aN');
  887. return newToken('numeric', NaN)
  888. }
  889. throw invalidChar(read())
  890. },
  891. zero: function zero () {
  892. switch (c) {
  893. case '.':
  894. buffer += read();
  895. lexState = 'decimalPoint';
  896. return
  897. case 'e':
  898. case 'E':
  899. buffer += read();
  900. lexState = 'decimalExponent';
  901. return
  902. case 'x':
  903. case 'X':
  904. buffer += read();
  905. lexState = 'hexadecimal';
  906. return
  907. }
  908. return newToken('numeric', sign * 0)
  909. },
  910. decimalInteger: function decimalInteger () {
  911. switch (c) {
  912. case '.':
  913. buffer += read();
  914. lexState = 'decimalPoint';
  915. return
  916. case 'e':
  917. case 'E':
  918. buffer += read();
  919. lexState = 'decimalExponent';
  920. return
  921. }
  922. if (util.isDigit(c)) {
  923. buffer += read();
  924. return
  925. }
  926. return newToken('numeric', sign * Number(buffer))
  927. },
  928. decimalPointLeading: function decimalPointLeading () {
  929. if (util.isDigit(c)) {
  930. buffer += read();
  931. lexState = 'decimalFraction';
  932. return
  933. }
  934. throw invalidChar(read())
  935. },
  936. decimalPoint: function decimalPoint () {
  937. switch (c) {
  938. case 'e':
  939. case 'E':
  940. buffer += read();
  941. lexState = 'decimalExponent';
  942. return
  943. }
  944. if (util.isDigit(c)) {
  945. buffer += read();
  946. lexState = 'decimalFraction';
  947. return
  948. }
  949. return newToken('numeric', sign * Number(buffer))
  950. },
  951. decimalFraction: function decimalFraction () {
  952. switch (c) {
  953. case 'e':
  954. case 'E':
  955. buffer += read();
  956. lexState = 'decimalExponent';
  957. return
  958. }
  959. if (util.isDigit(c)) {
  960. buffer += read();
  961. return
  962. }
  963. return newToken('numeric', sign * Number(buffer))
  964. },
  965. decimalExponent: function decimalExponent () {
  966. switch (c) {
  967. case '+':
  968. case '-':
  969. buffer += read();
  970. lexState = 'decimalExponentSign';
  971. return
  972. }
  973. if (util.isDigit(c)) {
  974. buffer += read();
  975. lexState = 'decimalExponentInteger';
  976. return
  977. }
  978. throw invalidChar(read())
  979. },
  980. decimalExponentSign: function decimalExponentSign () {
  981. if (util.isDigit(c)) {
  982. buffer += read();
  983. lexState = 'decimalExponentInteger';
  984. return
  985. }
  986. throw invalidChar(read())
  987. },
  988. decimalExponentInteger: function decimalExponentInteger () {
  989. if (util.isDigit(c)) {
  990. buffer += read();
  991. return
  992. }
  993. return newToken('numeric', sign * Number(buffer))
  994. },
  995. hexadecimal: function hexadecimal () {
  996. if (util.isHexDigit(c)) {
  997. buffer += read();
  998. lexState = 'hexadecimalInteger';
  999. return
  1000. }
  1001. throw invalidChar(read())
  1002. },
  1003. hexadecimalInteger: function hexadecimalInteger () {
  1004. if (util.isHexDigit(c)) {
  1005. buffer += read();
  1006. return
  1007. }
  1008. return newToken('numeric', sign * Number(buffer))
  1009. },
  1010. string: function string () {
  1011. switch (c) {
  1012. case '\\':
  1013. read();
  1014. buffer += escape();
  1015. return
  1016. case '"':
  1017. if (doubleQuote) {
  1018. read();
  1019. return newToken('string', buffer)
  1020. }
  1021. buffer += read();
  1022. return
  1023. case "'":
  1024. if (!doubleQuote) {
  1025. read();
  1026. return newToken('string', buffer)
  1027. }
  1028. buffer += read();
  1029. return
  1030. case '\n':
  1031. case '\r':
  1032. throw invalidChar(read())
  1033. case '\u2028':
  1034. case '\u2029':
  1035. separatorChar(c);
  1036. break
  1037. case undefined:
  1038. throw invalidChar(read())
  1039. }
  1040. buffer += read();
  1041. },
  1042. start: function start () {
  1043. switch (c) {
  1044. case '{':
  1045. case '[':
  1046. return newToken('punctuator', read())
  1047. // This code is unreachable since the default lexState handles eof.
  1048. // case undefined:
  1049. // return newToken('eof')
  1050. }
  1051. lexState = 'value';
  1052. },
  1053. beforePropertyName: function beforePropertyName () {
  1054. switch (c) {
  1055. case '$':
  1056. case '_':
  1057. buffer = read();
  1058. lexState = 'identifierName';
  1059. return
  1060. case '\\':
  1061. read();
  1062. lexState = 'identifierNameStartEscape';
  1063. return
  1064. case '}':
  1065. return newToken('punctuator', read())
  1066. case '"':
  1067. case "'":
  1068. doubleQuote = (read() === '"');
  1069. lexState = 'string';
  1070. return
  1071. }
  1072. if (util.isIdStartChar(c)) {
  1073. buffer += read();
  1074. lexState = 'identifierName';
  1075. return
  1076. }
  1077. throw invalidChar(read())
  1078. },
  1079. afterPropertyName: function afterPropertyName () {
  1080. if (c === ':') {
  1081. return newToken('punctuator', read())
  1082. }
  1083. throw invalidChar(read())
  1084. },
  1085. beforePropertyValue: function beforePropertyValue () {
  1086. lexState = 'value';
  1087. },
  1088. afterPropertyValue: function afterPropertyValue () {
  1089. switch (c) {
  1090. case ',':
  1091. case '}':
  1092. return newToken('punctuator', read())
  1093. }
  1094. throw invalidChar(read())
  1095. },
  1096. beforeArrayValue: function beforeArrayValue () {
  1097. if (c === ']') {
  1098. return newToken('punctuator', read())
  1099. }
  1100. lexState = 'value';
  1101. },
  1102. afterArrayValue: function afterArrayValue () {
  1103. switch (c) {
  1104. case ',':
  1105. case ']':
  1106. return newToken('punctuator', read())
  1107. }
  1108. throw invalidChar(read())
  1109. },
  1110. end: function end () {
  1111. // This code is unreachable since it's handled by the default lexState.
  1112. // if (c === undefined) {
  1113. // read()
  1114. // return newToken('eof')
  1115. // }
  1116. throw invalidChar(read())
  1117. },
  1118. };
  1119. function newToken (type, value) {
  1120. return {
  1121. type: type,
  1122. value: value,
  1123. line: line,
  1124. column: column,
  1125. }
  1126. }
  1127. function literal (s) {
  1128. for (var i = 0, list = s; i < list.length; i += 1) {
  1129. var c = list[i];
  1130. var p = peek();
  1131. if (p !== c) {
  1132. throw invalidChar(read())
  1133. }
  1134. read();
  1135. }
  1136. }
  1137. function escape () {
  1138. var c = peek();
  1139. switch (c) {
  1140. case 'b':
  1141. read();
  1142. return '\b'
  1143. case 'f':
  1144. read();
  1145. return '\f'
  1146. case 'n':
  1147. read();
  1148. return '\n'
  1149. case 'r':
  1150. read();
  1151. return '\r'
  1152. case 't':
  1153. read();
  1154. return '\t'
  1155. case 'v':
  1156. read();
  1157. return '\v'
  1158. case '0':
  1159. read();
  1160. if (util.isDigit(peek())) {
  1161. throw invalidChar(read())
  1162. }
  1163. return '\0'
  1164. case 'x':
  1165. read();
  1166. return hexEscape()
  1167. case 'u':
  1168. read();
  1169. return unicodeEscape()
  1170. case '\n':
  1171. case '\u2028':
  1172. case '\u2029':
  1173. read();
  1174. return ''
  1175. case '\r':
  1176. read();
  1177. if (peek() === '\n') {
  1178. read();
  1179. }
  1180. return ''
  1181. case '1':
  1182. case '2':
  1183. case '3':
  1184. case '4':
  1185. case '5':
  1186. case '6':
  1187. case '7':
  1188. case '8':
  1189. case '9':
  1190. throw invalidChar(read())
  1191. case undefined:
  1192. throw invalidChar(read())
  1193. }
  1194. return read()
  1195. }
  1196. function hexEscape () {
  1197. var buffer = '';
  1198. var c = peek();
  1199. if (!util.isHexDigit(c)) {
  1200. throw invalidChar(read())
  1201. }
  1202. buffer += read();
  1203. c = peek();
  1204. if (!util.isHexDigit(c)) {
  1205. throw invalidChar(read())
  1206. }
  1207. buffer += read();
  1208. return String.fromCodePoint(parseInt(buffer, 16))
  1209. }
  1210. function unicodeEscape () {
  1211. var buffer = '';
  1212. var count = 4;
  1213. while (count-- > 0) {
  1214. var c = peek();
  1215. if (!util.isHexDigit(c)) {
  1216. throw invalidChar(read())
  1217. }
  1218. buffer += read();
  1219. }
  1220. return String.fromCodePoint(parseInt(buffer, 16))
  1221. }
  1222. var parseStates = {
  1223. start: function start () {
  1224. if (token.type === 'eof') {
  1225. throw invalidEOF()
  1226. }
  1227. push();
  1228. },
  1229. beforePropertyName: function beforePropertyName () {
  1230. switch (token.type) {
  1231. case 'identifier':
  1232. case 'string':
  1233. key = token.value;
  1234. parseState = 'afterPropertyName';
  1235. return
  1236. case 'punctuator':
  1237. // This code is unreachable since it's handled by the lexState.
  1238. // if (token.value !== '}') {
  1239. // throw invalidToken()
  1240. // }
  1241. pop();
  1242. return
  1243. case 'eof':
  1244. throw invalidEOF()
  1245. }
  1246. // This code is unreachable since it's handled by the lexState.
  1247. // throw invalidToken()
  1248. },
  1249. afterPropertyName: function afterPropertyName () {
  1250. // This code is unreachable since it's handled by the lexState.
  1251. // if (token.type !== 'punctuator' || token.value !== ':') {
  1252. // throw invalidToken()
  1253. // }
  1254. if (token.type === 'eof') {
  1255. throw invalidEOF()
  1256. }
  1257. parseState = 'beforePropertyValue';
  1258. },
  1259. beforePropertyValue: function beforePropertyValue () {
  1260. if (token.type === 'eof') {
  1261. throw invalidEOF()
  1262. }
  1263. push();
  1264. },
  1265. beforeArrayValue: function beforeArrayValue () {
  1266. if (token.type === 'eof') {
  1267. throw invalidEOF()
  1268. }
  1269. if (token.type === 'punctuator' && token.value === ']') {
  1270. pop();
  1271. return
  1272. }
  1273. push();
  1274. },
  1275. afterPropertyValue: function afterPropertyValue () {
  1276. // This code is unreachable since it's handled by the lexState.
  1277. // if (token.type !== 'punctuator') {
  1278. // throw invalidToken()
  1279. // }
  1280. if (token.type === 'eof') {
  1281. throw invalidEOF()
  1282. }
  1283. switch (token.value) {
  1284. case ',':
  1285. parseState = 'beforePropertyName';
  1286. return
  1287. case '}':
  1288. pop();
  1289. }
  1290. // This code is unreachable since it's handled by the lexState.
  1291. // throw invalidToken()
  1292. },
  1293. afterArrayValue: function afterArrayValue () {
  1294. // This code is unreachable since it's handled by the lexState.
  1295. // if (token.type !== 'punctuator') {
  1296. // throw invalidToken()
  1297. // }
  1298. if (token.type === 'eof') {
  1299. throw invalidEOF()
  1300. }
  1301. switch (token.value) {
  1302. case ',':
  1303. parseState = 'beforeArrayValue';
  1304. return
  1305. case ']':
  1306. pop();
  1307. }
  1308. // This code is unreachable since it's handled by the lexState.
  1309. // throw invalidToken()
  1310. },
  1311. end: function end () {
  1312. // This code is unreachable since it's handled by the lexState.
  1313. // if (token.type !== 'eof') {
  1314. // throw invalidToken()
  1315. // }
  1316. },
  1317. };
  1318. function push () {
  1319. var value;
  1320. switch (token.type) {
  1321. case 'punctuator':
  1322. switch (token.value) {
  1323. case '{':
  1324. value = {};
  1325. break
  1326. case '[':
  1327. value = [];
  1328. break
  1329. }
  1330. break
  1331. case 'null':
  1332. case 'boolean':
  1333. case 'numeric':
  1334. case 'string':
  1335. value = token.value;
  1336. break
  1337. // This code is unreachable.
  1338. // default:
  1339. // throw invalidToken()
  1340. }
  1341. if (root === undefined) {
  1342. root = value;
  1343. } else {
  1344. var parent = stack[stack.length - 1];
  1345. if (Array.isArray(parent)) {
  1346. parent.push(value);
  1347. } else {
  1348. parent[key] = value;
  1349. }
  1350. }
  1351. if (value !== null && typeof value === 'object') {
  1352. stack.push(value);
  1353. if (Array.isArray(value)) {
  1354. parseState = 'beforeArrayValue';
  1355. } else {
  1356. parseState = 'beforePropertyName';
  1357. }
  1358. } else {
  1359. var current = stack[stack.length - 1];
  1360. if (current == null) {
  1361. parseState = 'end';
  1362. } else if (Array.isArray(current)) {
  1363. parseState = 'afterArrayValue';
  1364. } else {
  1365. parseState = 'afterPropertyValue';
  1366. }
  1367. }
  1368. }
  1369. function pop () {
  1370. stack.pop();
  1371. var current = stack[stack.length - 1];
  1372. if (current == null) {
  1373. parseState = 'end';
  1374. } else if (Array.isArray(current)) {
  1375. parseState = 'afterArrayValue';
  1376. } else {
  1377. parseState = 'afterPropertyValue';
  1378. }
  1379. }
  1380. // This code is unreachable.
  1381. // function invalidParseState () {
  1382. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1383. // }
  1384. // This code is unreachable.
  1385. // function invalidLexState (state) {
  1386. // return new Error(`JSON5: invalid lex state '${state}'`)
  1387. // }
  1388. function invalidChar (c) {
  1389. if (c === undefined) {
  1390. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1391. }
  1392. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1393. }
  1394. function invalidEOF () {
  1395. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1396. }
  1397. // This code is unreachable.
  1398. // function invalidToken () {
  1399. // if (token.type === 'eof') {
  1400. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1401. // }
  1402. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1403. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1404. // }
  1405. function invalidIdentifier () {
  1406. column -= 5;
  1407. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1408. }
  1409. function separatorChar (c) {
  1410. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1411. }
  1412. function formatChar (c) {
  1413. var replacements = {
  1414. "'": "\\'",
  1415. '"': '\\"',
  1416. '\\': '\\\\',
  1417. '\b': '\\b',
  1418. '\f': '\\f',
  1419. '\n': '\\n',
  1420. '\r': '\\r',
  1421. '\t': '\\t',
  1422. '\v': '\\v',
  1423. '\0': '\\0',
  1424. '\u2028': '\\u2028',
  1425. '\u2029': '\\u2029',
  1426. };
  1427. if (replacements[c]) {
  1428. return replacements[c]
  1429. }
  1430. if (c < ' ') {
  1431. var hexString = c.charCodeAt(0).toString(16);
  1432. return '\\x' + ('00' + hexString).substring(hexString.length)
  1433. }
  1434. return c
  1435. }
  1436. function syntaxError (message) {
  1437. var err = new SyntaxError(message);
  1438. err.lineNumber = line;
  1439. err.columnNumber = column;
  1440. return err
  1441. }
  1442. var stringify = function stringify (value, replacer, space) {
  1443. var stack = [];
  1444. var indent = '';
  1445. var propertyList;
  1446. var replacerFunc;
  1447. var gap = '';
  1448. var quote;
  1449. if (
  1450. replacer != null &&
  1451. typeof replacer === 'object' &&
  1452. !Array.isArray(replacer)
  1453. ) {
  1454. space = replacer.space;
  1455. quote = replacer.quote;
  1456. replacer = replacer.replacer;
  1457. }
  1458. if (typeof replacer === 'function') {
  1459. replacerFunc = replacer;
  1460. } else if (Array.isArray(replacer)) {
  1461. propertyList = [];
  1462. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1463. var v = list[i];
  1464. var item = (void 0);
  1465. if (typeof v === 'string') {
  1466. item = v;
  1467. } else if (
  1468. typeof v === 'number' ||
  1469. v instanceof String ||
  1470. v instanceof Number
  1471. ) {
  1472. item = String(v);
  1473. }
  1474. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1475. propertyList.push(item);
  1476. }
  1477. }
  1478. }
  1479. if (space instanceof Number) {
  1480. space = Number(space);
  1481. } else if (space instanceof String) {
  1482. space = String(space);
  1483. }
  1484. if (typeof space === 'number') {
  1485. if (space > 0) {
  1486. space = Math.min(10, Math.floor(space));
  1487. gap = ' '.substr(0, space);
  1488. }
  1489. } else if (typeof space === 'string') {
  1490. gap = space.substr(0, 10);
  1491. }
  1492. return serializeProperty('', {'': value})
  1493. function serializeProperty (key, holder) {
  1494. var value = holder[key];
  1495. if (value != null) {
  1496. if (typeof value.toJSON5 === 'function') {
  1497. value = value.toJSON5(key);
  1498. } else if (typeof value.toJSON === 'function') {
  1499. value = value.toJSON(key);
  1500. }
  1501. }
  1502. if (replacerFunc) {
  1503. value = replacerFunc.call(holder, key, value);
  1504. }
  1505. if (value instanceof Number) {
  1506. value = Number(value);
  1507. } else if (value instanceof String) {
  1508. value = String(value);
  1509. } else if (value instanceof Boolean) {
  1510. value = value.valueOf();
  1511. }
  1512. switch (value) {
  1513. case null: return 'null'
  1514. case true: return 'true'
  1515. case false: return 'false'
  1516. }
  1517. if (typeof value === 'string') {
  1518. return quoteString(value)
  1519. }
  1520. if (typeof value === 'number') {
  1521. return String(value)
  1522. }
  1523. if (typeof value === 'object') {
  1524. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1525. }
  1526. return undefined
  1527. }
  1528. function quoteString (value) {
  1529. var quotes = {
  1530. "'": 0.1,
  1531. '"': 0.2,
  1532. };
  1533. var replacements = {
  1534. "'": "\\'",
  1535. '"': '\\"',
  1536. '\\': '\\\\',
  1537. '\b': '\\b',
  1538. '\f': '\\f',
  1539. '\n': '\\n',
  1540. '\r': '\\r',
  1541. '\t': '\\t',
  1542. '\v': '\\v',
  1543. '\0': '\\0',
  1544. '\u2028': '\\u2028',
  1545. '\u2029': '\\u2029',
  1546. };
  1547. var product = '';
  1548. for (var i = 0; i < value.length; i++) {
  1549. var c = value[i];
  1550. switch (c) {
  1551. case "'":
  1552. case '"':
  1553. quotes[c]++;
  1554. product += c;
  1555. continue
  1556. case '\0':
  1557. if (util.isDigit(value[i + 1])) {
  1558. product += '\\x00';
  1559. continue
  1560. }
  1561. }
  1562. if (replacements[c]) {
  1563. product += replacements[c];
  1564. continue
  1565. }
  1566. if (c < ' ') {
  1567. var hexString = c.charCodeAt(0).toString(16);
  1568. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1569. continue
  1570. }
  1571. product += c;
  1572. }
  1573. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1574. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1575. return quoteChar + product + quoteChar
  1576. }
  1577. function serializeObject (value) {
  1578. if (stack.indexOf(value) >= 0) {
  1579. throw TypeError('Converting circular structure to JSON5')
  1580. }
  1581. stack.push(value);
  1582. var stepback = indent;
  1583. indent = indent + gap;
  1584. var keys = propertyList || Object.keys(value);
  1585. var partial = [];
  1586. for (var i = 0, list = keys; i < list.length; i += 1) {
  1587. var key = list[i];
  1588. var propertyString = serializeProperty(key, value);
  1589. if (propertyString !== undefined) {
  1590. var member = serializeKey(key) + ':';
  1591. if (gap !== '') {
  1592. member += ' ';
  1593. }
  1594. member += propertyString;
  1595. partial.push(member);
  1596. }
  1597. }
  1598. var final;
  1599. if (partial.length === 0) {
  1600. final = '{}';
  1601. } else {
  1602. var properties;
  1603. if (gap === '') {
  1604. properties = partial.join(',');
  1605. final = '{' + properties + '}';
  1606. } else {
  1607. var separator = ',\n' + indent;
  1608. properties = partial.join(separator);
  1609. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1610. }
  1611. }
  1612. stack.pop();
  1613. indent = stepback;
  1614. return final
  1615. }
  1616. function serializeKey (key) {
  1617. if (key.length === 0) {
  1618. return quoteString(key)
  1619. }
  1620. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1621. if (!util.isIdStartChar(firstChar)) {
  1622. return quoteString(key)
  1623. }
  1624. for (var i = firstChar.length; i < key.length; i++) {
  1625. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1626. return quoteString(key)
  1627. }
  1628. }
  1629. return key
  1630. }
  1631. function serializeArray (value) {
  1632. if (stack.indexOf(value) >= 0) {
  1633. throw TypeError('Converting circular structure to JSON5')
  1634. }
  1635. stack.push(value);
  1636. var stepback = indent;
  1637. indent = indent + gap;
  1638. var partial = [];
  1639. for (var i = 0; i < value.length; i++) {
  1640. var propertyString = serializeProperty(String(i), value);
  1641. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1642. }
  1643. var final;
  1644. if (partial.length === 0) {
  1645. final = '[]';
  1646. } else {
  1647. if (gap === '') {
  1648. var properties = partial.join(',');
  1649. final = '[' + properties + ']';
  1650. } else {
  1651. var separator = ',\n' + indent;
  1652. var properties$1 = partial.join(separator);
  1653. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1654. }
  1655. }
  1656. stack.pop();
  1657. indent = stepback;
  1658. return final
  1659. }
  1660. };
  1661. var JSON5 = {
  1662. parse: parse,
  1663. stringify: stringify,
  1664. };
  1665. var lib = JSON5;
  1666. var es5 = lib;
  1667. return es5;
  1668. })));
  1669. });
  1670. /*! *****************************************************************************
  1671. Copyright (c) Microsoft Corporation.
  1672. Permission to use, copy, modify, and/or distribute this software for any
  1673. purpose with or without fee is hereby granted.
  1674. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1675. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1676. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1677. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1678. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1679. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1680. PERFORMANCE OF THIS SOFTWARE.
  1681. ***************************************************************************** */
  1682. /* global Reflect, Promise */
  1683. var extendStatics = function(d, b) {
  1684. extendStatics = Object.setPrototypeOf ||
  1685. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1686. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1687. return extendStatics(d, b);
  1688. };
  1689. function __extends(d, b) {
  1690. extendStatics(d, b);
  1691. function __() { this.constructor = d; }
  1692. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1693. }
  1694. var __assign = function() {
  1695. __assign = Object.assign || function __assign(t) {
  1696. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1697. s = arguments[i];
  1698. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1699. }
  1700. return t;
  1701. };
  1702. return __assign.apply(this, arguments);
  1703. };
  1704. function __decorate(decorators, target, key, desc) {
  1705. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1706. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1707. 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;
  1708. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1709. }
  1710. function __param(paramIndex, decorator) {
  1711. return function (target, key) { decorator(target, key, paramIndex); }
  1712. }
  1713. function __metadata(metadataKey, metadataValue) {
  1714. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1715. }
  1716. function __values(o) {
  1717. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1718. if (m) return m.call(o);
  1719. if (o && typeof o.length === "number") return {
  1720. next: function () {
  1721. if (o && i >= o.length) o = void 0;
  1722. return { value: o && o[i++], done: !o };
  1723. }
  1724. };
  1725. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1726. }
  1727. function __read(o, n) {
  1728. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1729. if (!m) return o;
  1730. var i = m.call(o), r, ar = [], e;
  1731. try {
  1732. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1733. }
  1734. catch (error) { e = { error: error }; }
  1735. finally {
  1736. try {
  1737. if (r && !r.done && (m = i["return"])) m.call(i);
  1738. }
  1739. finally { if (e) throw e.error; }
  1740. }
  1741. return ar;
  1742. }
  1743. function __spread() {
  1744. for (var ar = [], i = 0; i < arguments.length; i++)
  1745. ar = ar.concat(__read(arguments[i]));
  1746. return ar;
  1747. }
  1748. var PropertyDescription = /** @class */ (function () {
  1749. function PropertyDescription() {
  1750. var _this = this;
  1751. var args = [];
  1752. for (var _i = 0; _i < arguments.length; _i++) {
  1753. args[_i] = arguments[_i];
  1754. }
  1755. this.propertyes = {
  1756. props: [],
  1757. events: []
  1758. };
  1759. _$2.each(args, function (arg) {
  1760. _this.merge(arg);
  1761. });
  1762. }
  1763. PropertyDescription.prototype.merge = function (pd) {
  1764. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1765. if (pd.events) {
  1766. if (this.propertyes.events) {
  1767. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1768. }
  1769. else {
  1770. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1771. }
  1772. }
  1773. };
  1774. /**
  1775. * 根据分组名 获取属性定义
  1776. */
  1777. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1778. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1779. };
  1780. /**
  1781. * 获取全部事件
  1782. */
  1783. PropertyDescription.prototype.getEvents = function () {
  1784. return this.propertyes.events;
  1785. };
  1786. return PropertyDescription;
  1787. }());
  1788. //# sourceMappingURL=PropertyDescription.js.map
  1789. var PropertyDescriptionTable = new Map();
  1790. var width = {
  1791. name: 'width',
  1792. default: '',
  1793. group: 'common',
  1794. desc: '宽',
  1795. type: 'string'
  1796. };
  1797. var height = {
  1798. name: 'height',
  1799. default: '',
  1800. group: 'common',
  1801. desc: '高',
  1802. type: 'string'
  1803. };
  1804. var fieldLabel = {
  1805. name: 'fieldLabel',
  1806. default: '',
  1807. group: 'common',
  1808. desc: '文本描述',
  1809. type: 'string',
  1810. expr: true,
  1811. };
  1812. var text$1 = {
  1813. name: 'text',
  1814. default: '',
  1815. group: 'common',
  1816. desc: '文本描述',
  1817. type: 'string',
  1818. expr: true,
  1819. };
  1820. var iconCls = {
  1821. name: 'iconCls',
  1822. default: '',
  1823. group: 'common',
  1824. desc: '图标',
  1825. type: 'string',
  1826. expr: true,
  1827. };
  1828. var disabled = {
  1829. name: 'disabled',
  1830. default: false,
  1831. group: 'common',
  1832. desc: '禁用',
  1833. type: 'boolean',
  1834. expr: true,
  1835. };
  1836. var value = {
  1837. name: 'value',
  1838. default: '',
  1839. group: 'common',
  1840. desc: '字段值',
  1841. type: 'string',
  1842. expr: true,
  1843. };
  1844. var template = {
  1845. name: 'template',
  1846. default: '',
  1847. group: 'common',
  1848. desc: 'HTML内容',
  1849. type: 'string',
  1850. expr: true,
  1851. };
  1852. var reference = {
  1853. name: 'reference',
  1854. default: '',
  1855. group: 'common',
  1856. desc: '组件句柄',
  1857. type: 'string',
  1858. expr: true,
  1859. };
  1860. var tooltip = {
  1861. name: 'tooltip',
  1862. default: '',
  1863. group: 'common',
  1864. desc: '悬停提示',
  1865. type: 'string'
  1866. };
  1867. // =============事件 ==============
  1868. var click = {
  1869. name: 'click',
  1870. default: '',
  1871. group: 'listeners',
  1872. desc: '点击事件',
  1873. eventParamter: [
  1874. 'sender',
  1875. 'e: any'
  1876. ],
  1877. type: 'listeners'
  1878. };
  1879. var change = {
  1880. name: 'change',
  1881. default: '',
  1882. group: 'listeners',
  1883. desc: 'value change事件',
  1884. eventParamter: [
  1885. 'sender',
  1886. 'e: any'
  1887. ],
  1888. type: 'listeners'
  1889. };
  1890. var keyup = {
  1891. name: 'keyup',
  1892. default: '',
  1893. group: 'listeners',
  1894. desc: '键盘按键抬起事件',
  1895. eventParamter: [
  1896. 'sender',
  1897. 'e'
  1898. ],
  1899. type: 'listeners'
  1900. };
  1901. var afterrender = {
  1902. name: 'afterrender',
  1903. default: '',
  1904. group: 'listeners',
  1905. desc: '控件渲染后触发',
  1906. eventParamter: [
  1907. 'sender',
  1908. 'e'
  1909. ],
  1910. type: 'listeners'
  1911. };
  1912. // =============特性 ==============
  1913. var fix = {
  1914. name: 'fix',
  1915. default: '',
  1916. group: 'fix',
  1917. desc: '特性',
  1918. type: 'fix',
  1919. expr: true,
  1920. };
  1921. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1922. props: [
  1923. height
  1924. ]
  1925. }));
  1926. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1927. props: [
  1928. {
  1929. name: 'borderless',
  1930. default: true,
  1931. group: 'css',
  1932. desc: '有无边框',
  1933. type: 'boolean'
  1934. },
  1935. {
  1936. name: 'type',
  1937. default: '',
  1938. group: 'css',
  1939. desc: '布局类型',
  1940. type: ['line', 'clean', 'wide', 'space', 'form']
  1941. },
  1942. {
  1943. name: '_designMode',
  1944. default: 'module',
  1945. group: 'common',
  1946. desc: '设计类型',
  1947. type: ['none', 'module', 'scroll-module']
  1948. }
  1949. ]
  1950. }));
  1951. var YvBase = {
  1952. props: [
  1953. width, height, reference, afterrender, fix
  1954. ],
  1955. events: [
  1956. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1957. ]
  1958. };
  1959. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1960. props: [
  1961. template
  1962. ]
  1963. }));
  1964. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1965. props: [
  1966. {
  1967. name: 'label',
  1968. default: '',
  1969. group: 'common',
  1970. desc: '字段组标题',
  1971. type: 'string'
  1972. }
  1973. ]
  1974. }));
  1975. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1976. props: [
  1977. {
  1978. name: 'src',
  1979. default: '',
  1980. group: 'common',
  1981. desc: '地址路径',
  1982. type: 'string'
  1983. }
  1984. ]
  1985. }));
  1986. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1987. props: [
  1988. width, height,
  1989. {
  1990. name: 'value',
  1991. default: '上传',
  1992. group: 'common',
  1993. desc: '文本描述',
  1994. type: 'string'
  1995. },
  1996. {
  1997. name: 'upload',
  1998. default: '/upload',
  1999. group: 'common',
  2000. desc: '上传地址',
  2001. type: 'string'
  2002. },
  2003. ],
  2004. events: [
  2005. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2006. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2007. ]
  2008. }));
  2009. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2010. props: [
  2011. value,
  2012. {
  2013. name: 'imgWidth',
  2014. default: '',
  2015. group: 'common',
  2016. desc: '图片宽',
  2017. type: 'string'
  2018. },
  2019. {
  2020. name: 'imgHeight',
  2021. default: '',
  2022. group: 'common',
  2023. desc: '图片高',
  2024. type: 'string'
  2025. }
  2026. ]
  2027. }));
  2028. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2029. props: [
  2030. value,
  2031. {
  2032. name: 'imgWidth',
  2033. default: '',
  2034. group: 'common',
  2035. desc: '图片宽',
  2036. type: 'string'
  2037. },
  2038. {
  2039. name: 'imgHeight',
  2040. default: '',
  2041. group: 'common',
  2042. desc: '图片高',
  2043. type: 'string'
  2044. }
  2045. ]
  2046. }));
  2047. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2048. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2049. }));
  2050. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2051. props: [
  2052. fieldLabel, value, disabled,
  2053. tooltip, width, height
  2054. ],
  2055. }));
  2056. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2057. props: [
  2058. fieldLabel, value, disabled,
  2059. tooltip, width, height, keyup, afterrender, change
  2060. ],
  2061. }));
  2062. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2063. props: [
  2064. fieldLabel, value, disabled,
  2065. tooltip, width, height, keyup, afterrender, change
  2066. ],
  2067. }));
  2068. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2069. props: [
  2070. fieldLabel, value, disabled,
  2071. tooltip, width, height, keyup, afterrender, change
  2072. ],
  2073. }));
  2074. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2075. props: [
  2076. fieldLabel, value, disabled,
  2077. tooltip, width, height, keyup, afterrender, change
  2078. ],
  2079. }));
  2080. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2081. props: [
  2082. fieldLabel, value, disabled,
  2083. tooltip, width, height, keyup, afterrender, change
  2084. ],
  2085. }));
  2086. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2087. props: [
  2088. fieldLabel, value, disabled,
  2089. tooltip, width, height, keyup, afterrender, change
  2090. ],
  2091. }));
  2092. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2093. props: [
  2094. fieldLabel, value, disabled,
  2095. tooltip, width, height, keyup, afterrender, change
  2096. ],
  2097. }));
  2098. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2099. props: [
  2100. fieldLabel, value, disabled,
  2101. tooltip, width, height, keyup, afterrender, change
  2102. ],
  2103. }));
  2104. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2105. props: [
  2106. fieldLabel, value, disabled,
  2107. tooltip, width, height
  2108. ],
  2109. }));
  2110. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2111. props: [
  2112. fieldLabel, value, disabled,
  2113. tooltip, width, height, keyup, afterrender, change
  2114. ],
  2115. }));
  2116. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2117. props: [
  2118. fieldLabel, value, disabled,
  2119. tooltip, width, height, keyup, afterrender, change
  2120. ],
  2121. }));
  2122. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2123. props: [
  2124. fieldLabel, value, disabled,
  2125. tooltip, width, height, keyup, afterrender, change
  2126. ],
  2127. }));
  2128. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2129. props: [
  2130. fieldLabel, value, disabled,
  2131. tooltip, width, height, afterrender, change
  2132. ],
  2133. }));
  2134. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2135. /**
  2136. * 弹出输入框,输入文字
  2137. * @param message 提示文字
  2138. * @param defaultValue 默认值
  2139. * @param multiLine 是否多行输入
  2140. */
  2141. function prompt$1(message, defaultValue, multiLine) {
  2142. if (defaultValue === void 0) { defaultValue = ""; }
  2143. if (multiLine === void 0) { multiLine = false; }
  2144. return new Promise(function (resolve) {
  2145. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2146. if (button === 'ok') {
  2147. resolve(value);
  2148. }
  2149. }, null, multiLine, defaultValue);
  2150. });
  2151. }
  2152. /**
  2153. * 显示错误异常信息
  2154. * @param msg 错误内容
  2155. * @param sender 发送者按钮(可以为空)
  2156. */
  2157. function showErrorDialog(msg, sender) {
  2158. console.error(msg);
  2159. Ext.MessageBox.show({
  2160. title: '错误',
  2161. msg: msg,
  2162. buttons: Ext.MessageBox.OK,
  2163. animateTarget: sender,
  2164. icon: 'error',
  2165. cls: 'show-icon-messagebox',
  2166. });
  2167. }
  2168. /**
  2169. * 显示错误异常信息
  2170. * @param msg 错误内容
  2171. * @param sender 发送者按钮(可以为空)
  2172. */
  2173. function showInfoDialogSimple(msg, sender) {
  2174. console.info(msg);
  2175. Ext.MessageBox.show({
  2176. title: '提示',
  2177. msg: msg,
  2178. buttons: Ext.MessageBox.OK,
  2179. animateTarget: sender,
  2180. icon: 'info',
  2181. cls: 'show-icon-messagebox',
  2182. });
  2183. }
  2184. function msgError(msg, sender) {
  2185. showErrorDialog(msg, sender);
  2186. }
  2187. /**
  2188. * 中间灰底白字提示
  2189. */
  2190. function msg(message) {
  2191. console.log(message);
  2192. var t = { message: message };
  2193. var WMSTranslate = window["WMSTranslate"];
  2194. if (WMSTranslate) {
  2195. if (typeof window['viewTranslate'] === 'function') {
  2196. window['viewTranslate'](t, message, "message");
  2197. }
  2198. }
  2199. var $body = $$2('body');
  2200. $body.find('[xtype=tooltip]').remove();
  2201. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2202. ' <div class="yvan-msg-content">' +
  2203. _$2.escape(t.message) +
  2204. '</div></div>');
  2205. $body.append($w);
  2206. var iframeWidth = $w.parent().width();
  2207. var iframeHeight = $w.parent().height();
  2208. var windowWidth = $w.width();
  2209. var windowHeight = $w.height();
  2210. var setWidth = (iframeWidth - windowWidth) / 2;
  2211. var setHeight = (iframeHeight - windowHeight) / 2;
  2212. if (iframeHeight < windowHeight || setHeight < 0) {
  2213. setHeight = 0;
  2214. }
  2215. if (iframeWidth < windowWidth || setWidth < 0) {
  2216. setWidth = 0;
  2217. }
  2218. $w.css({ left: setWidth, top: setHeight });
  2219. setTimeout(function () {
  2220. $w.remove();
  2221. }, 3000);
  2222. }
  2223. //# sourceMappingURL=message.js.map
  2224. localforage.config({
  2225. name: "studio",
  2226. storeName: "item",
  2227. });
  2228. function getItem(key, callback) {
  2229. localforage.getItem(key).then(function (value) {
  2230. if (callback) {
  2231. callback(value);
  2232. }
  2233. });
  2234. }
  2235. function setItem(key, value, callback) {
  2236. localforage.setItem(key, value).then(function (val) {
  2237. if (callback) {
  2238. callback();
  2239. }
  2240. });
  2241. }
  2242. var native = {
  2243. /**
  2244. * 读取文件
  2245. */
  2246. loadFile: function (fileName, callback) {
  2247. console.log('loadFile', fileName);
  2248. getItem('NATIVE_' + fileName, callback);
  2249. },
  2250. /**
  2251. * 保存文件
  2252. */
  2253. saveFile: function (fileName, content) {
  2254. console.log('saveFile', fileName, content);
  2255. setItem('NATIVE_' + fileName, content);
  2256. },
  2257. openInIdea: function (path) {
  2258. msg(path);
  2259. },
  2260. /**
  2261. * 初始化 native 工具类
  2262. */
  2263. init: function () {
  2264. var ClipboardJS = window['ClipboardJS'];
  2265. if (!ClipboardJS) {
  2266. msg('没有引入 ClipboardJS');
  2267. return;
  2268. }
  2269. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2270. var clipboard = new ClipboardJS('.__btnClipboard');
  2271. },
  2272. /**
  2273. * 设置剪切板
  2274. */
  2275. clipboardSet: function (c) {
  2276. var $btn = $('.__btnClipboard');
  2277. $btn.attr('data-clipboard-text', c);
  2278. $btn.trigger("click");
  2279. },
  2280. };
  2281. /**
  2282. * 判断变量是否有值 value === null || value === undefined
  2283. * @param value 目标变量
  2284. */
  2285. var noValue = function (value) {
  2286. return value === null || value === undefined;
  2287. };
  2288. //# sourceMappingURL=Utils.js.map
  2289. function initStateTree () {
  2290. Ext.define('com.yvan.studio.StateTree', {
  2291. extend: 'Ext.tree.Panel',
  2292. _saveStateFlag: true,
  2293. _filterText: '',
  2294. fbar: [
  2295. {
  2296. xtype: 'textfield',
  2297. flex: 1,
  2298. emptyText: '搜索过滤',
  2299. enableKeyEvents: true,
  2300. listeners: {
  2301. change: function (sender) {
  2302. var tree = sender.up("treepanel");
  2303. tree.filterByText(this.getRawValue());
  2304. },
  2305. keyup: function (sender, e) {
  2306. var tree = sender.up("treepanel");
  2307. if (e.ESC === e.getKey()) {
  2308. sender.setValue('');
  2309. tree.filterByText('');
  2310. }
  2311. }
  2312. }
  2313. },
  2314. ],
  2315. getStateFilename: function () {
  2316. throw Error('没有实现这个函数');
  2317. },
  2318. initComponent: function () {
  2319. var me = this;
  2320. this.on({
  2321. afterrender: function () {
  2322. var _this = this;
  2323. // 回车后打开节点
  2324. $(me.el.dom).keydown(function (event) {
  2325. if (event.keyCode === 13) {
  2326. event.preventDefault();
  2327. _this.fireEvent('itemverify');
  2328. return;
  2329. }
  2330. });
  2331. },
  2332. afteritemexpand: {
  2333. fn: function (node, index, item, eOpts) {
  2334. this.saveState();
  2335. },
  2336. buffer: 100,
  2337. },
  2338. afteritemcollapse: {
  2339. fn: function (node, index, item, eOpts) {
  2340. this.saveState();
  2341. },
  2342. buffer: 100,
  2343. },
  2344. itemdblclick: function (sender, record) {
  2345. this.fireEvent('itemverify');
  2346. },
  2347. itemclick: {
  2348. fn: function (node, index, item, eOpts) {
  2349. this.saveState();
  2350. },
  2351. buffer: 100,
  2352. }
  2353. });
  2354. this.superclass.superclass.initComponent.apply(this, arguments);
  2355. },
  2356. restoreState: function () {
  2357. var _this = this;
  2358. native.loadFile(this.getStateFilename(), function (content) {
  2359. if (!content)
  2360. return;
  2361. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2362. _this._saveStateFlag = false;
  2363. if (_.isArray(expands)) {
  2364. _.forEach(expands, function (p) {
  2365. _this.expandPath(p);
  2366. });
  2367. }
  2368. if (_.isArray(selections) && selections[0]) {
  2369. try {
  2370. _this.selectPath(selections[0]);
  2371. }
  2372. catch (e) {
  2373. }
  2374. }
  2375. if (scrollPosition && scrollSize) {
  2376. var size = _this.scrollable.getSize();
  2377. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2378. try {
  2379. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2380. }
  2381. catch (e) {
  2382. }
  2383. }
  2384. }
  2385. setTimeout(function () {
  2386. _this._saveStateFlag = true;
  2387. }, 200);
  2388. });
  2389. },
  2390. saveState: function () {
  2391. if (!this._saveStateFlag) {
  2392. return;
  2393. }
  2394. if (this._filterText) {
  2395. // 有筛选,不保存展开状态
  2396. return;
  2397. }
  2398. var expands = [];
  2399. var selections = [];
  2400. var selection = this.getSelection();
  2401. _.forEach(selection, function (item) {
  2402. selections.push(item.getPath());
  2403. });
  2404. var data = this.getStore().data;
  2405. _.forEach(data.items, function (item) {
  2406. if (item.data.expanded === true) {
  2407. expands.push(item.getPath());
  2408. }
  2409. });
  2410. var scrollPosition = this.scrollable.position;
  2411. var scrollSize = this.scrollable.getSize();
  2412. native.saveFile(this.getStateFilename(), {
  2413. selections: selections,
  2414. expands: expands,
  2415. scrollPosition: scrollPosition,
  2416. scrollSize: scrollSize
  2417. });
  2418. },
  2419. filterByText: function (text) {
  2420. this._filterText = text;
  2421. this._filterBy(this, text, 'text');
  2422. },
  2423. _filterBy: _.debounce(function (me, text, by) {
  2424. var view = me.getView();
  2425. me.store.clearFilter();
  2426. if (!me._filterText) {
  2427. // 没有筛选内容,还原状态
  2428. var selections = me.getSelection();
  2429. var selectionPaths_1 = [];
  2430. _.forEach(me.getSelection(), function (item) {
  2431. selectionPaths_1.push(item.getPath());
  2432. });
  2433. me.collapseAll();
  2434. me.restoreState();
  2435. _.forEach(selectionPaths_1, function (path) {
  2436. me.expandPath(path);
  2437. });
  2438. me.setSelection(selections);
  2439. return;
  2440. }
  2441. // 递归查找所有需要可见的节点 id 数组
  2442. var nodesAndParents = [];
  2443. var expandPaths = [];
  2444. me.getRootNode().cascadeBy(function (tree, view) {
  2445. var currNode = this;
  2446. currNode.collapse();
  2447. if (currNode && currNode.data[by] &&
  2448. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2449. // 展开到匹配的路径
  2450. // me.expandPath(currNode.getPath());
  2451. expandPaths.push(currNode.getPath());
  2452. // 沿途父节点全部设定为可见
  2453. while (currNode.parentNode) {
  2454. nodesAndParents.push(currNode.id);
  2455. currNode = currNode.parentNode;
  2456. }
  2457. }
  2458. }, null, [me, view]);
  2459. me.store.filterBy(function (r) {
  2460. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2461. });
  2462. _.forEach(expandPaths, function (path) {
  2463. me.expandPath(path);
  2464. });
  2465. }, 1000),
  2466. });
  2467. }
  2468. //# sourceMappingURL=StateTree.js.map
  2469. function initDashboard () {
  2470. Ext.define('com.yvan.studio.Dashboard', {
  2471. extend: 'Ext.panel.Panel',
  2472. alias: 'widget.dashboard',
  2473. xtype: 'dashboard',
  2474. html: ''
  2475. });
  2476. }
  2477. //# sourceMappingURL=dashboard.js.map
  2478. var handles$1 = {
  2479. mainWindow: undefined,
  2480. fileTree: undefined,
  2481. dbTree: undefined,
  2482. viewoutlinetree: undefined,
  2483. statusbar: undefined,
  2484. dictTree: undefined,
  2485. property: undefined,
  2486. dbcode: undefined,
  2487. report: undefined,
  2488. widget: undefined,
  2489. whLayout: undefined,
  2490. };
  2491. window['handles'] = handles$1;
  2492. function setDictTree(value) {
  2493. handles$1.dictTree = value;
  2494. }
  2495. function setMainWindow(value) {
  2496. handles$1.mainWindow = value;
  2497. }
  2498. function setReport(value) {
  2499. handles$1.report = value;
  2500. }
  2501. function setStatusbar(statusbar) {
  2502. handles$1.statusbar = statusbar;
  2503. }
  2504. function setFileTree(value) {
  2505. handles$1.fileTree = value;
  2506. }
  2507. function setDbTree(value) {
  2508. handles$1.dbTree = value;
  2509. }
  2510. function setWidget(value) {
  2511. handles$1.widget = value;
  2512. }
  2513. function setWhLayout(value) {
  2514. handles$1.whLayout = value;
  2515. }
  2516. function setViewoutlinetree(value) {
  2517. handles$1.viewoutlinetree = value;
  2518. }
  2519. function setPropertyPanel(value) {
  2520. handles$1.property = value;
  2521. }
  2522. function setDbCode(value) {
  2523. handles$1.dbcode = value;
  2524. }
  2525. //# sourceMappingURL=Handles.js.map
  2526. /**
  2527. * 调用方法
  2528. */
  2529. function invokeMethod(fn, sender, args) {
  2530. if (typeof fn === 'function') {
  2531. fn.apply.apply(fn, __spread([sender], args));
  2532. }
  2533. }
  2534. /**
  2535. * 判断事件是否为有效的输入字符
  2536. * @param e
  2537. */
  2538. function isChartEvent(e) {
  2539. if (e.key === 'Shift' ||
  2540. e.key === 'Control' ||
  2541. e.key === 'Alt' ||
  2542. e.key === 'Escape' ||
  2543. e.key === 'ArrowRight' ||
  2544. e.key === 'Tab' ||
  2545. e.key === 'ArrowLeft') {
  2546. return false;
  2547. }
  2548. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2549. // 0-9
  2550. return true;
  2551. }
  2552. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2553. // a-z
  2554. return true;
  2555. }
  2556. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2557. // 小键盘 0-9
  2558. return true;
  2559. }
  2560. return false;
  2561. }
  2562. if (!window["time_offset"]) {
  2563. window["time_offset"] = 0;
  2564. }
  2565. function syncDate(date) {
  2566. if (date && date.setTime && date.getTime) {
  2567. date.setTime(date.getTime() + window["time_offset"]);
  2568. }
  2569. return date;
  2570. }
  2571. //# sourceMappingURL=utils.js.map
  2572. function isDesignMode(control, config) {
  2573. var _a, _b;
  2574. if (window["IS_DESIGN_MODE"]) {
  2575. return true;
  2576. }
  2577. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2578. return true;
  2579. }
  2580. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2581. return true;
  2582. }
  2583. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2584. return true;
  2585. }
  2586. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2587. return true;
  2588. }
  2589. return false;
  2590. }
  2591. function toString(value) {
  2592. if (typeof value === 'undefined' || value === null) {
  2593. return "";
  2594. }
  2595. if (typeof value === 'number' && isNaN(value)) {
  2596. return "";
  2597. }
  2598. if (value == 'N/A') {
  2599. return "";
  2600. }
  2601. return ("" + value);
  2602. }
  2603. function isEmpty(value) {
  2604. if (typeof value === 'undefined' || value === null) {
  2605. return true;
  2606. }
  2607. if (typeof value === 'number' && isNaN(value)) {
  2608. return true;
  2609. }
  2610. if (value == 'N/A') {
  2611. return true;
  2612. }
  2613. return ("" + value).trim().length <= 0;
  2614. }
  2615. function createUUID() {
  2616. //@ts-ignore
  2617. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2618. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2619. });
  2620. }
  2621. function getRegList() {
  2622. var regList = _$2.get(window, 'yvanLib.regList');
  2623. if (!regList) {
  2624. regList = [];
  2625. _$2.set(window, 'yvanLib.regList', regList);
  2626. }
  2627. return regList;
  2628. }
  2629. function getRegParamList(methodName) {
  2630. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2631. if (!regParamList) {
  2632. regParamList = {};
  2633. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2634. }
  2635. if (!_$2.has(regParamList, methodName)) {
  2636. regParamList[methodName] = [];
  2637. }
  2638. return regParamList[methodName];
  2639. }
  2640. /**
  2641. * 模拟点击按钮
  2642. */
  2643. function raiseClick(buttonHandle) {
  2644. if (!buttonHandle) {
  2645. return false;
  2646. }
  2647. if (buttonHandle.disabled) {
  2648. // 按钮是禁止状态
  2649. return false;
  2650. }
  2651. if (buttonHandle.hidden) {
  2652. // 按钮是隐藏状态
  2653. return false;
  2654. }
  2655. // 按钮点击
  2656. buttonHandle.click();
  2657. return true;
  2658. }
  2659. /**
  2660. * 标注系统全局函数的参数
  2661. * @param title 函数名称
  2662. * @param type 函数类型
  2663. * @param allowEmpty 可否为空
  2664. */
  2665. function LibParam(title, type, allowEmpty) {
  2666. if (allowEmpty === void 0) { allowEmpty = false; }
  2667. return function (target, methodName, paramsIndex) {
  2668. var systemFnArgs = getRegParamList(methodName);
  2669. systemFnArgs[paramsIndex] = {
  2670. type: type,
  2671. title: title,
  2672. name: methodName,
  2673. allowEmpty: allowEmpty,
  2674. };
  2675. };
  2676. }
  2677. /**
  2678. * 标注函数变成"系统全局函数"
  2679. */
  2680. function Lib(registe) {
  2681. return function (target, propertyKey, descriptor) {
  2682. var libList = getRegList();
  2683. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2684. if (registe.type === 'system') {
  2685. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2686. }
  2687. else if (registe.type === 'format') {
  2688. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2689. }
  2690. return target;
  2691. };
  2692. }
  2693. /**
  2694. * 解析事件
  2695. * 'scope.私有方法名'
  2696. * 'system.系统函数名'
  2697. * 'format.格式化名'
  2698. */
  2699. function lookupFn(scope, event, errorWho) {
  2700. if (isDesignMode(scope, undefined)) {
  2701. return Ext.emptyFn;
  2702. }
  2703. if (!_$2.startsWith(event, 'scope.') &&
  2704. !_$2.startsWith(event, 'system.') &&
  2705. !_$2.startsWith(event, 'format.')) {
  2706. console.error('无法识别的事件响应类型', event);
  2707. throw new TypeError('无法识别的事件响应类型');
  2708. }
  2709. // 为 eval 准备环境
  2710. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2711. var data = scope.viewModel.data;
  2712. var keys = [];
  2713. var values = [];
  2714. _$2.forOwn(data, function (value, key) {
  2715. var idxKey = key.indexOf('//');
  2716. if (idxKey >= 0) {
  2717. keys.push(key.substr(0, idxKey));
  2718. }
  2719. else {
  2720. keys.push(key);
  2721. }
  2722. values.push(value);
  2723. });
  2724. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2725. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2726. if (typeof funcResult !== 'function') {
  2727. console.error('无法识别的事件响应类型', event, func, errorWho);
  2728. throw new TypeError('无法识别的事件响应类型');
  2729. }
  2730. return funcResult;
  2731. }
  2732. /**
  2733. * 从 ext.element 获取 scope 对象
  2734. */
  2735. function lookupScope(extHandle) {
  2736. if (!extHandle) {
  2737. // @ts-ignore
  2738. return;
  2739. }
  2740. if (extHandle.isScope) {
  2741. return extHandle;
  2742. }
  2743. if (extHandle.column) {
  2744. // 列上的组件
  2745. return extHandle.column.lookupReferenceHolder().yvanScope;
  2746. }
  2747. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2748. if (typeof extHandle.lookupViewModel === 'function') {
  2749. var vm = extHandle.lookupViewModel();
  2750. return vm.yvanScope;
  2751. }
  2752. return;
  2753. }
  2754. //# sourceMappingURL=lib.js.map
  2755. /**
  2756. * 全局 ajax 方法
  2757. */
  2758. var ajax = {};
  2759. /**
  2760. * 计算拼音的函数
  2761. */
  2762. var pinyinFunc = function (str) { return (str); };
  2763. exports.scopeOnLoad = null;
  2764. exports.apiConvert = undefined;
  2765. var baseConfigProcessList = [];
  2766. /**
  2767. * 在基类添加 Config 的处理方法
  2768. */
  2769. function baseConfigProcess(option) {
  2770. return function (target, propertyKey) {
  2771. baseConfigProcessList.push(target[propertyKey]);
  2772. };
  2773. }
  2774. // let designMode: boolean = false
  2775. //
  2776. // export function isDesignMode(): boolean {
  2777. // return designMode
  2778. // }
  2779. //
  2780. // export function setDesignMode(v: boolean) {
  2781. // designMode = v
  2782. // }
  2783. /**
  2784. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2785. */
  2786. function serverInvokeUrlTransform(url, option) {
  2787. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2788. }
  2789. /**
  2790. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2791. */
  2792. function sqlUrlTransform(url) {
  2793. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2794. }
  2795. /**
  2796. * YvanUI 全局扩展配置
  2797. */
  2798. function extend(option) {
  2799. if (option.ajax) {
  2800. ajax.func = option.ajax;
  2801. }
  2802. if (option.serverInvokeUrlTransform) {
  2803. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2804. }
  2805. if (option.sqlUrlTransform) {
  2806. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2807. }
  2808. if (option.pinyinFunction) {
  2809. pinyinFunc = option.pinyinFunction;
  2810. }
  2811. if (option.scopeOnLoad) {
  2812. exports.scopeOnLoad = option.scopeOnLoad;
  2813. }
  2814. if (option.scopeOnCreate) {
  2815. exports.scopeOnCreate = option.scopeOnCreate;
  2816. }
  2817. if (option.apiConvert) {
  2818. exports.apiConvert = option.apiConvert;
  2819. }
  2820. // if (typeof option.designMode !== 'undefined') {
  2821. // setDesignMode(option.designMode)
  2822. // }
  2823. }
  2824. function getApiConvert() {
  2825. return exports.apiConvert;
  2826. }
  2827. function getScopeOnCreate() {
  2828. return exports.scopeOnCreate;
  2829. }
  2830. function getPinyin(v) {
  2831. return pinyinFunc(v);
  2832. }
  2833. /**
  2834. * 适用于 Select / Tree 等,作筛选的通用方法.
  2835. * 1.首字母模糊匹配(不区分大小写)
  2836. * 2.标识的模糊匹配(不区分大小写)
  2837. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2838. */
  2839. function keywordFilter(keyword, label, value) {
  2840. if (!keyword) {
  2841. return true;
  2842. }
  2843. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2844. // const labelPy = _.toLower(getPinyin(label))
  2845. //@ts-ignore
  2846. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2847. value = _$2.toLower(_$2.trim(value));
  2848. var found = 0;
  2849. _$2.some(ws, function (word) {
  2850. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2851. found++;
  2852. return;
  2853. }
  2854. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2855. found++;
  2856. return;
  2857. }
  2858. });
  2859. return found >= ws.length;
  2860. }
  2861. //# sourceMappingURL=config.js.map
  2862. var idPrefix = "_ds_";
  2863. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2864. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2865. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2866. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2867. var layoutOrXtypeNameMap = {
  2868. fit: 'fit布局',
  2869. border: 'border布局',
  2870. center: '中部',
  2871. north: '上部',
  2872. south: '下部',
  2873. west: '左部',
  2874. east: '右部',
  2875. yvgrid: '表格',
  2876. tree: '树',
  2877. tabpanel: '标签页',
  2878. form: '表单',
  2879. fieldset: '字段组',
  2880. tbar: '顶部工具栏',
  2881. fbar: '底部工具栏',
  2882. toolbar: '工具栏',
  2883. cols: '列容器',
  2884. rows: '行容器',
  2885. textfield: '文本框',
  2886. textareafield: '长文本框',
  2887. numberfield: '数字框',
  2888. label: "文本",
  2889. combo: "下拉框",
  2890. combobox: "下拉框",
  2891. combotree: "下拉树",
  2892. combogrid: "下拉表",
  2893. datefield: "日期框",
  2894. searchfield: "搜索框",
  2895. button: "按钮",
  2896. checkbox: "勾选",
  2897. checkboxgroup: "勾选组",
  2898. radio: "点选",
  2899. radiogroup: "点选组",
  2900. container: "占位"
  2901. };
  2902. /**
  2903. * 从 VJSON 中找到 rows/cols 的数组
  2904. */
  2905. function findArrayContainer(vjson, id) {
  2906. var parentVJson = getSuperVjson(vjson, id);
  2907. if (_$2.isArray(parentVJson)) {
  2908. return parentVJson;
  2909. }
  2910. if (parentVJson.hasOwnProperty('items')) {
  2911. return parentVJson.items;
  2912. }
  2913. }
  2914. /**
  2915. * 根据id查找上级vjson
  2916. * @param vjson 原始 vjson 视图
  2917. * @param targetId 子元素的id
  2918. */
  2919. function getSuperVjson(vjson, targetId) {
  2920. return deepTravFindSuper(vjson, vjson, targetId);
  2921. }
  2922. /**
  2923. * 根据id查找上级vjson id
  2924. * @param vjson 原始 vjson 视图
  2925. * @param targetId 子元素的id
  2926. */
  2927. function getSuperVjsonId(vjson, targetId) {
  2928. var vj = getSuperVjson(vjson, targetId);
  2929. return vj.id;
  2930. }
  2931. function deepTravFindSuper(superVjson, vjson, targetId) {
  2932. var rObj = null;
  2933. _$2.forOwn(vjson, function (value, key) {
  2934. if (rObj) {
  2935. return;
  2936. }
  2937. if (typeof value !== "object") {
  2938. return;
  2939. }
  2940. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2941. if (key !== 'items') {
  2942. return;
  2943. }
  2944. }
  2945. else {
  2946. // 模型、数据、数据源不扫描
  2947. if (key === 'data' ||
  2948. key === 'dataSource' ||
  2949. key === 'suggest' ||
  2950. key === 'options' ||
  2951. key === 'config' ||
  2952. key === 'columns' ||
  2953. key === 'viewModel' ||
  2954. key === 'store') {
  2955. return;
  2956. }
  2957. }
  2958. //事件不扫描
  2959. if (key === "on" && _$2.isObject(value)) {
  2960. return;
  2961. }
  2962. if (key.startsWith("on") && _$2.size(key) > 2) {
  2963. return;
  2964. }
  2965. if (value.id === targetId) {
  2966. if (_$2.isArray(vjson)) {
  2967. rObj = superVjson;
  2968. }
  2969. else {
  2970. rObj = vjson;
  2971. }
  2972. return;
  2973. }
  2974. rObj = deepTravFindSuper(vjson, value, targetId);
  2975. });
  2976. return rObj;
  2977. }
  2978. /**
  2979. * 深度遍历 vjson
  2980. * @param vjson 视图JSON
  2981. * @param resolver 分析函数
  2982. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  2983. */
  2984. function deepTravVJson(vjson, resolver, propDeep) {
  2985. if (propDeep === void 0) { propDeep = false; }
  2986. var markerList = [];
  2987. deepTrav1(vjson, resolver, markerList, propDeep);
  2988. return markerList;
  2989. }
  2990. function deepTrav1(obj, resolver, marker, propDeep) {
  2991. if (propDeep === void 0) { propDeep = false; }
  2992. var isMarker = resolver(obj);
  2993. if (marker && isMarker === true) {
  2994. marker.unshift({ id: 0, keyName: '', object: obj });
  2995. }
  2996. _$2.forOwn(obj, function (value, key) {
  2997. if (typeof value !== 'object') {
  2998. return;
  2999. }
  3000. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3001. if (key !== 'items' && key !== 'children') {
  3002. return;
  3003. }
  3004. }
  3005. else {
  3006. // 模型、数据、数据源不扫描
  3007. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3008. return;
  3009. }
  3010. if (!propDeep &&
  3011. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3012. key === 'listeners' || key === 'bind')) {
  3013. return;
  3014. }
  3015. }
  3016. //事件不扫描
  3017. if (key === 'on' && _$2.isObject(value)) {
  3018. return;
  3019. }
  3020. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3021. return;
  3022. }
  3023. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3024. if (marker && isMarkerChild === true) {
  3025. isMarker = true;
  3026. marker.unshift({ id: obj.id, keyName: key, object: value });
  3027. }
  3028. });
  3029. // @ts-ignore 删除作废对象
  3030. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3031. return isMarker;
  3032. }
  3033. /**
  3034. * 在代码中找到 reference 对应的对象
  3035. */
  3036. function findInCode(code, id) {
  3037. try {
  3038. deepTravVJson(code, function (child) {
  3039. if (child.id === id) {
  3040. throw child;
  3041. }
  3042. });
  3043. return undefined;
  3044. }
  3045. catch (err) {
  3046. return err;
  3047. }
  3048. }
  3049. function replaceVjsonById(vjson, itemVjson, itemId) {
  3050. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3051. msgError('无法定位组件!');
  3052. debugger;
  3053. return;
  3054. }
  3055. var id = itemId || itemVjson.id;
  3056. deepTravVJson(vjson, function (obj) {
  3057. if (obj.id == id) {
  3058. _$2.assign(obj, itemVjson, { id: id });
  3059. }
  3060. });
  3061. }
  3062. function deepTravDeleteVjson(obj, targetId) {
  3063. var isDelete = false;
  3064. _$2.forOwn(obj, function (value, key) {
  3065. if (isDelete) {
  3066. return;
  3067. }
  3068. if (typeof value !== 'object') {
  3069. return;
  3070. }
  3071. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3072. if (key !== 'items') {
  3073. return;
  3074. }
  3075. }
  3076. else {
  3077. // 模型、数据、数据源不扫描
  3078. if (key === 'data' ||
  3079. key === 'dataSource' ||
  3080. key === 'suggest' ||
  3081. key === 'options' ||
  3082. key === 'config' ||
  3083. key === 'columns' ||
  3084. key === 'viewModel' ||
  3085. key === 'store') {
  3086. return;
  3087. }
  3088. }
  3089. //事件不扫描
  3090. if (key === 'on' && _$2.isObject(value)) {
  3091. return;
  3092. }
  3093. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3094. return;
  3095. }
  3096. if (value.id === targetId) {
  3097. isDelete = true;
  3098. /** 如果是数组的元素*/
  3099. if (_$2.isArray(obj)) {
  3100. obj.splice(key, 1);
  3101. }
  3102. else {
  3103. delete obj[key];
  3104. }
  3105. return;
  3106. }
  3107. isDelete = deepTravDeleteVjson(value, targetId);
  3108. });
  3109. return isDelete;
  3110. }
  3111. /**
  3112. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3113. * @param obj 原始 vjson 视图
  3114. * @param targetId 子元素的id
  3115. */
  3116. function deletVjsonById(vjson, targetId) {
  3117. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3118. // if (_.isArray(obj)) {
  3119. // if (obj.length <= 0) {
  3120. // let T: any = {
  3121. // view: "template",
  3122. // template: "拖动任何组件到此处",
  3123. // role: "placeholder",
  3124. // id: webix.uid()
  3125. // }
  3126. // obj.push(T);
  3127. // }
  3128. // }
  3129. return isDeleted;
  3130. }
  3131. function removeDesignProp(vjson) {
  3132. deepTravVJson(vjson, function (obj) {
  3133. if (obj.hasOwnProperty('id')) {
  3134. delete obj.id;
  3135. }
  3136. if (obj.hasOwnProperty("designMode")) {
  3137. delete obj.designMode;
  3138. }
  3139. });
  3140. if (vjson.hasOwnProperty("cls")) {
  3141. delete vjson.cls;
  3142. }
  3143. if (vjson.hasOwnProperty("viewModel")) {
  3144. delete vjson.viewModel;
  3145. }
  3146. if (vjson.hasOwnProperty("store")) {
  3147. delete vjson.store;
  3148. }
  3149. }
  3150. function getLayoutOutline(vjson) {
  3151. deepTravVJson(vjson, function (obj) {
  3152. if (!Array.isArray(obj)) {
  3153. _$2.forOwn(obj, function (value, key) {
  3154. if (key === 'id' || key === 'region' || key === 'layoutName'
  3155. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3156. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3157. if (key === 'region'
  3158. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3159. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3160. if (!_$2.has(obj, 'layoutName')) {
  3161. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3162. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3163. // console.log(obj.layoutName, obj.layoutNameDesc)
  3164. }
  3165. }
  3166. }
  3167. else {
  3168. if (key === 'items') {
  3169. obj.children = obj[key];
  3170. }
  3171. if (key === 'tbar') {
  3172. var t = obj[key];
  3173. t.layoutName = key;
  3174. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3175. // console.log(t.layoutName, t.layoutNameDesc)
  3176. if (_$2.has(obj, "items")) {
  3177. obj.items.splice(0, 0, t);
  3178. }
  3179. else if (_$2.has(obj, "children")) {
  3180. obj.children.splice(0, 0, t);
  3181. }
  3182. else {
  3183. obj.children = [t];
  3184. }
  3185. }
  3186. if (key === 'fbar') {
  3187. var t = obj[key];
  3188. t.layoutName = key;
  3189. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3190. // console.log(t.layoutName, t.layoutNameDesc)
  3191. if (_$2.has(obj, "items")) {
  3192. obj.items.push(t);
  3193. }
  3194. else if (_$2.has(obj, "children")) {
  3195. obj.children.push(t);
  3196. }
  3197. else {
  3198. obj.children = [t];
  3199. }
  3200. }
  3201. delete obj[key];
  3202. }
  3203. });
  3204. if (!obj.hasOwnProperty("children")) {
  3205. obj.leaf = true;
  3206. }
  3207. if (!obj.hasOwnProperty("expanded")) {
  3208. obj.expanded = true;
  3209. }
  3210. }
  3211. });
  3212. return vjson;
  3213. }
  3214. //# sourceMappingURL=ViewHelper.js.map
  3215. var Scope = /** @class */ (function () {
  3216. function Scope(args) {
  3217. /**
  3218. * 业务模块的唯一编号
  3219. */
  3220. this.id = _$2.uniqueId('scope_');
  3221. this.IS_DESIGN_MODE = false;
  3222. /**
  3223. * onload 运行完成之后才会设置本标记为 true
  3224. */
  3225. this.isLoadFinish = false;
  3226. this._isLoading = false;
  3227. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  3228. this.model = model;
  3229. if (typeof vjson.layout === 'undefined') {
  3230. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3231. var ret = buildPlus({ model: model, vjson: vjson });
  3232. model = ret.model;
  3233. vjson = ret.vjson;
  3234. }
  3235. this.originalVjson = _$2.cloneDeep(vjson);
  3236. this.vjson = this.originalVjson; // this.buildVjson()
  3237. var WMSTranslate = window["WMSTranslate"];
  3238. if (WMSTranslate) {
  3239. var i18nPath_1 = this.constructor.name;
  3240. if (i18n) {
  3241. WMSTranslate[i18nPath_1] = i18n;
  3242. }
  3243. this.vjson.i18nPath = i18nPath_1;
  3244. deepTravVJson(this.vjson, function (obj) {
  3245. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3246. return;
  3247. }
  3248. obj.i18nPath = i18nPath_1;
  3249. });
  3250. }
  3251. var extScope = getScopeOnCreate();
  3252. if (typeof extScope === 'function') {
  3253. extScope({ vjson: vjson, model: model }, this);
  3254. }
  3255. }
  3256. Scope.prototype._addWatch = function (tplExpress, fn) {
  3257. if (!this._watchList) {
  3258. this._watchList = [];
  3259. }
  3260. this._watchList.push({ watch: tplExpress, fn: fn });
  3261. };
  3262. Scope.prototype._applyWatchList = function () {
  3263. var _this = this;
  3264. _$2.forEach(this._watchList, function (item) {
  3265. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3266. });
  3267. };
  3268. Object.defineProperty(Scope.prototype, "isScope", {
  3269. get: function () {
  3270. return true;
  3271. },
  3272. enumerable: true,
  3273. configurable: true
  3274. });
  3275. /**
  3276. * 产生一个当前模块有效的唯一id
  3277. * @param key 唯一编号
  3278. */
  3279. Scope.prototype.uid = function (key) {
  3280. return this.id + key;
  3281. };
  3282. /**
  3283. * 对话框"保存"成功.
  3284. * 关闭对话框,并响应 success 方法
  3285. * @param data 要傳回的數據(可以為空)
  3286. */
  3287. Scope.prototype.dialogSuccess = function (data) {
  3288. this._handle.fireEvent('success', this, data);
  3289. var sender = this._handle.config.animateTarget;
  3290. var scope = lookupScope(sender);
  3291. if (typeof this['success'] === 'function') {
  3292. this['success'].call(scope, sender, data);
  3293. }
  3294. this.close();
  3295. };
  3296. /**
  3297. * 设置等待状态
  3298. * @param value
  3299. * @param msg
  3300. */
  3301. Scope.prototype.setLoading = function (value) {
  3302. var _a;
  3303. var scope = this;
  3304. this._isLoading = value;
  3305. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3306. };
  3307. Scope.prototype.getLoading = function () {
  3308. return this._isLoading;
  3309. };
  3310. /**
  3311. * 以对话框模式打开当前模块
  3312. * @param sender 发送者(按钮或Scope对象)
  3313. * @param vjsonOption 界面覆盖选项(可以为空)
  3314. * @param dataOption 数据覆盖选项(可以为空)
  3315. */
  3316. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3317. var _a;
  3318. var that = this;
  3319. var vmodel = _$2.defaultsDeep({
  3320. //
  3321. }, dataOption, that.model);
  3322. this.viewModel = new Ext.app.ViewModel(vmodel);
  3323. this.viewModel.yvanScope = this;
  3324. this._applyWatchList();
  3325. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3326. var config = _$2.defaultsDeep({
  3327. animateTarget: sender,
  3328. viewModel: this.viewModel,
  3329. yvanScope: this,
  3330. referenceHolder: true,
  3331. }, vjsonOption, that.vjson, windows);
  3332. if (config.height === 'unset') {
  3333. delete config.height;
  3334. }
  3335. if (config.width === 'unset') {
  3336. delete config.width;
  3337. }
  3338. // const holder = sender?.lookupReferenceHolder()
  3339. // delete config.constrain
  3340. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3341. if (topScope) {
  3342. config.constrain = true;
  3343. this.topScope = topScope;
  3344. }
  3345. var win = new Ext.Window(config);
  3346. // if (holder) {
  3347. // holder.add(win)
  3348. // }
  3349. if (topScope) {
  3350. topScope._handle.add(win);
  3351. }
  3352. win.addListener('beforerender', function (sender) {
  3353. // 记录句柄
  3354. if (sender && !that._handle) {
  3355. that._handle = sender;
  3356. }
  3357. });
  3358. win.addListener('afterrender', function (sender) {
  3359. // 调用onLoad回调
  3360. try {
  3361. that._onLoad();
  3362. }
  3363. catch (e) {
  3364. console.error('errorAt onLoad', e);
  3365. }
  3366. window['cw'] = that;
  3367. });
  3368. win.addListener('destroy', this._destroy.bind(this));
  3369. win.show();
  3370. };
  3371. /**
  3372. * 以标签模式打开当前模块
  3373. * @param vjsonOption 界面覆盖选项(可以为空)
  3374. * @param dataOption 数据覆盖选项(可以为空)
  3375. */
  3376. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3377. var _this = this;
  3378. var that = this;
  3379. this._vjsonOption = vjsonOption;
  3380. this._dataOption = dataOption;
  3381. var vmodel = _$2.defaultsDeep({
  3382. data: {}
  3383. }, dataOption, that.model);
  3384. this.viewModel = new Ext.app.ViewModel(vmodel);
  3385. this.viewModel.yvanScope = this;
  3386. this._applyWatchList();
  3387. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3388. // 根级不能设置id
  3389. delete that.vjson.id;
  3390. var config = _$2.defaultsDeep({
  3391. viewModel: this.viewModel,
  3392. yvanScope: this,
  3393. referenceHolder: true,
  3394. }, vjsonOption, that.vjson);
  3395. var tt = Ext.getCmp('TT');
  3396. var handle = tt.addScope(this, config, function (handle) {
  3397. handle.addListener('added', function (sender) {
  3398. // 记录句柄
  3399. if (sender && !that._handle) {
  3400. that._handle = sender;
  3401. }
  3402. });
  3403. handle.addListener('afterrender', function (sender) {
  3404. // 调用onLoad回调
  3405. try {
  3406. that._onLoad();
  3407. }
  3408. catch (e) {
  3409. console.error('errorAt onLoad', e);
  3410. }
  3411. });
  3412. handle.addListener('destroy', _this._destroy.bind(_this));
  3413. });
  3414. return handle;
  3415. };
  3416. /**
  3417. * 直接渲染到元素
  3418. * @param element 渲染目标
  3419. * @param vjsonOption 界面覆盖选项(可以为空)
  3420. * @param dataOption 数据覆盖选项(可以为空)
  3421. */
  3422. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3423. var that = this;
  3424. this._vjsonOption = vjsonOption;
  3425. this._dataOption = dataOption;
  3426. var vmodel = _$2.defaultsDeep({
  3427. data: {}
  3428. }, that.model, dataOption);
  3429. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3430. this.viewModel = new Ext.app.ViewModel(vmodel);
  3431. this.viewModel.yvanScope = this;
  3432. this._applyWatchList();
  3433. var config = _$2.defaultsDeep({
  3434. viewModel: this.viewModel,
  3435. yvanScope: this,
  3436. referenceHolder: true,
  3437. renderTo: element,
  3438. listeners: {
  3439. afterrender: function (sender) {
  3440. var _a;
  3441. // 记录句柄
  3442. if (sender && !that._handle) {
  3443. that._handle = sender;
  3444. }
  3445. // 调用onLoad回调
  3446. that._onLoad();
  3447. // 如果vjson中配置了 afterrender ,需要恢复状态
  3448. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3449. },
  3450. },
  3451. }, vjsonOption, that.vjson);
  3452. new Ext.container.Viewport(config);
  3453. };
  3454. Scope.prototype.showDesigner = function (designer, option) {
  3455. var that = this;
  3456. var vmodel = _$2.defaultsDeep({
  3457. data: {
  3458. IS_DESIGN_MODE: true,
  3459. }
  3460. }, that.model);
  3461. this.IS_DESIGN_MODE = true;
  3462. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3463. this.viewModel = new Ext.app.ViewModel(vmodel);
  3464. this.viewModel.yvanScope = this;
  3465. this._applyWatchList();
  3466. var config = _$2.defaultsDeep({
  3467. viewModel: this.viewModel,
  3468. yvanScope: this,
  3469. referenceHolder: true,
  3470. listeners: {
  3471. afterrender: function (sender) {
  3472. var _a;
  3473. // 记录句柄
  3474. if (sender && !that._handle) {
  3475. that._handle = sender;
  3476. }
  3477. // 调用onLoad回调
  3478. that._onLoad();
  3479. // 如果vjson中配置了 afterrender ,需要恢复状态
  3480. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3481. },
  3482. },
  3483. }, that.vjson);
  3484. designer.removeAll(true);
  3485. designer.add(config);
  3486. };
  3487. /**
  3488. * 关闭对话框(或标签页)
  3489. */
  3490. Scope.prototype.close = function () {
  3491. this._handle.close();
  3492. };
  3493. Object.defineProperty(Scope.prototype, "data", {
  3494. /**
  3495. * 获取 viewModel 里包含的数据(只读)
  3496. */
  3497. get: function () {
  3498. return this.viewModel.getData();
  3499. },
  3500. enumerable: true,
  3501. configurable: true
  3502. });
  3503. /**
  3504. * 设置 viewModel 中的数据
  3505. * 可以是 key, value 模式
  3506. * 也可以是 {key:value} 模式
  3507. */
  3508. Scope.prototype.set = function (path, value) {
  3509. return this.viewModel.set(path, value);
  3510. };
  3511. /**
  3512. * 寻找模块内所有的 xtype 对应的对象
  3513. * @param xtypeKey
  3514. */
  3515. Scope.prototype.down = function (xtypeKey) {
  3516. return this._handle.down(xtypeKey);
  3517. };
  3518. Object.defineProperty(Scope.prototype, "refs", {
  3519. /**
  3520. * 获取所有设置过 Reference 名称的组件
  3521. */
  3522. get: function () {
  3523. var _a, _b;
  3524. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3525. },
  3526. enumerable: true,
  3527. configurable: true
  3528. });
  3529. Scope.prototype._destroy = function () {
  3530. var that = this;
  3531. that.onDestroy();
  3532. delete that._watchList;
  3533. delete that._handle;
  3534. this.isLoadFinish = false;
  3535. };
  3536. /**
  3537. * 私有渲染完成后的回调
  3538. */
  3539. Scope.prototype._onLoad = function () {
  3540. var _this = this;
  3541. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3542. exports.scopeOnLoad(this);
  3543. }
  3544. this.onLoad();
  3545. _$2.defer(function () {
  3546. _this.isLoadFinish = true;
  3547. });
  3548. };
  3549. /**
  3550. * 默认 渲染完成之后调用的函数
  3551. */
  3552. Scope.prototype.onLoad = function () {
  3553. };
  3554. /**
  3555. * 组件卸载之后的回调
  3556. */
  3557. Scope.prototype.onDestroy = function () {
  3558. };
  3559. return Scope;
  3560. }());
  3561. /**
  3562. * 观察装饰器,viewModel 属性更改时触发成员方法
  3563. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3564. */
  3565. function watch(tplExpress, deep) {
  3566. if (deep === void 0) { deep = false; }
  3567. return function (target, propertyKey, pd) {
  3568. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3569. return target[propertyKey];
  3570. };
  3571. }
  3572. // 获取vjson的hash值
  3573. function getVjsonHash(str) {
  3574. var hash = 3465217896, i, ch;
  3575. for (i = str.length - 1; i >= 0; i--) {
  3576. ch = str.charCodeAt(i);
  3577. hash ^= ((hash << 5) + ch + (hash >> 2));
  3578. }
  3579. return (hash & 0x7FFFFFFF) + "";
  3580. }
  3581. function buildPlus(_a) {
  3582. var model = _a.model, vjson = _a.vjson;
  3583. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3584. {
  3585. layout: 'border',
  3586. // tbar: vjson.action,
  3587. items: vjson.items,
  3588. },
  3589. ] });
  3590. if (_$2.isArray(vjson.action)) {
  3591. vjsonNew.items[0].tbar = vjson.action;
  3592. }
  3593. return { model: model, vjson: vjsonNew };
  3594. }
  3595. //# sourceMappingURL=Scope.js.map
  3596. var model = {
  3597. data: {
  3598. leftTabTitle: ''
  3599. }
  3600. };
  3601. //# sourceMappingURL=Workbench.model.js.map
  3602. var vjson = {
  3603. frame: false,
  3604. layout: 'border',
  3605. width: '100%',
  3606. height: '100%',
  3607. border: false,
  3608. defaults: {
  3609. border: false
  3610. },
  3611. items: [
  3612. {
  3613. region: 'north',
  3614. height: 60,
  3615. cls: 'main-header',
  3616. reference: 'mainTop',
  3617. layout: 'hbox',
  3618. items: [
  3619. {
  3620. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3621. flex: 1,
  3622. border: false
  3623. },
  3624. {
  3625. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3626. menu: [
  3627. {
  3628. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3629. reference: 'commonSetting'
  3630. },
  3631. {
  3632. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3633. listeners: {
  3634. // click: 'scope.ready_api_click'
  3635. }
  3636. },
  3637. ]
  3638. },
  3639. {
  3640. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3641. cls: 'header-menu',
  3642. menu: [
  3643. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3644. ]
  3645. },
  3646. ]
  3647. },
  3648. {
  3649. region: 'west',
  3650. bind: {
  3651. title: '{leftTabTitle}',
  3652. },
  3653. titleAlign: 'center',
  3654. border: true, split: true, width: 340, collapsible: true,
  3655. reference: 'leftTab',
  3656. xtype: 'tabpanel',
  3657. tabPosition: 'left',
  3658. tabRotation: 0,
  3659. tabBar: {
  3660. border: false
  3661. },
  3662. listeners: {
  3663. tabchange: 'scope.leftTabChange',
  3664. },
  3665. items: [
  3666. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3667. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3668. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3669. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3670. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3671. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3672. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3673. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3674. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3675. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3676. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3677. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3678. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3679. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3680. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3681. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3682. ]
  3683. },
  3684. {
  3685. region: 'east',
  3686. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3687. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3688. },
  3689. {
  3690. region: 'center',
  3691. split: true, border: true,
  3692. xtype: 'maintab', reference: 'tt', id: 'TT',
  3693. plain: true,
  3694. listeners: {
  3695. restorypage: 'scope.openScope',
  3696. tabchange: 'scope.tabchange'
  3697. },
  3698. items: []
  3699. },
  3700. ],
  3701. };
  3702. //# sourceMappingURL=Workbench.view.js.map
  3703. /**
  3704. * 获取当前打开的项目资料
  3705. */
  3706. function getCurrentProject() {
  3707. // const value = sessionStorage.getItem('CurrentProject');
  3708. // if (value) {
  3709. // project = JSON.parse(value)
  3710. // if (!project.url) {
  3711. // project = undefined
  3712. // }
  3713. // }
  3714. // return project
  3715. return {
  3716. uuid: '00000000',
  3717. name: '本服项目',
  3718. url: '',
  3719. };
  3720. }
  3721. /**
  3722. * 设置当前打开的项目资料(全局)
  3723. */
  3724. function setCurrentProject(value) {
  3725. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3726. }
  3727. //# sourceMappingURL=Project.js.map
  3728. // ------------------------------------------------------------------------------------------ types
  3729. /** 订阅消息key类型 */
  3730. var EventType;
  3731. (function (EventType) {
  3732. /** FileTree打开Module */
  3733. EventType["ModuleOpen"] = "ModuleOpen";
  3734. /** ModulePage 创建 */
  3735. EventType["ModulePageCreate"] = "ModulePageCreate";
  3736. /** ModuleItem内容变化 */
  3737. EventType["ModuleItemChange"] = "ModuleItemChange";
  3738. /** ModuleItem的 jsView 内容变化 */
  3739. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3740. /** 设置 vjson */
  3741. EventType["SetVjson"] = "SetVjson";
  3742. /** 更新 vjson */
  3743. EventType["UpdateVjson"] = "UpdateVjson";
  3744. /** 更新 组件vjson */
  3745. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3746. /** Component 选中内容变化 */
  3747. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3748. /** Component 选中内容变化 */
  3749. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3750. /** Component 删除事件 */
  3751. EventType["ComponentDelete"] = "ComponentDelete";
  3752. /** MainTab 选中改变事件 */
  3753. EventType["MainTabChange"] = "MainTabChange";
  3754. /** ModuleTab 选中改变事件 */
  3755. EventType["ModuleTabChange"] = "ModuleTabChange";
  3756. /** 保存事件 */
  3757. EventType["SaveCall"] = "SaveCall";
  3758. /** 撤销 */
  3759. EventType["Undo"] = "Undo";
  3760. /** 还原 */
  3761. EventType["Redo"] = "Redo";
  3762. /** 剪切 */
  3763. EventType["Cut"] = "Cut";
  3764. /** 复制 */
  3765. EventType["Copy"] = "Copy";
  3766. /** 粘贴 */
  3767. EventType["Paste"] = "Paste";
  3768. /** 全选 */
  3769. EventType["SelectAll"] = "SelectAll";
  3770. /** 读取剪切板 */
  3771. EventType["ClipboardRead"] = "ClipboardRead";
  3772. /** 检查模块更新 */
  3773. EventType["RunCheckModule"] = "RunCheckModule";
  3774. /** 停止检查模块更新 */
  3775. EventType["StopCheckModule"] = "StopCheckModule";
  3776. })(EventType || (EventType = {}));
  3777. // ------------------------------------------------------------------------------------------ impls
  3778. var EventBus = /** @class */ (function () {
  3779. function EventBus() {
  3780. /** 事件数据 */
  3781. this.store = {};
  3782. /** 事件订阅者注册表 */
  3783. this.observeStoreTable = {};
  3784. this.init();
  3785. }
  3786. EventBus.prototype.init = function () {
  3787. var _this = this;
  3788. // 更改store值就会自动publish消息 - 实现
  3789. this.store = new Proxy({}, {
  3790. get: function (target, key) {
  3791. return target[key];
  3792. },
  3793. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3794. set: function (target, key, data) {
  3795. if (noValue(key))
  3796. return false;
  3797. target[key] = data;
  3798. // 消息通知订阅者
  3799. var observerArr = _this.observeStoreTable[key];
  3800. if (noValue(observerArr) || observerArr.length <= 0)
  3801. return true;
  3802. observerArr.forEach(function (handler) {
  3803. //try {
  3804. handler(data, key);
  3805. // } catch (err) {
  3806. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3807. // }
  3808. });
  3809. return true;
  3810. },
  3811. });
  3812. };
  3813. /** 取消注册订阅者 */
  3814. EventBus.prototype.unregisterObserver = function (key, handler) {
  3815. var _this = this;
  3816. var observerArr = this.observeStoreTable[key];
  3817. if (noValue(observerArr) || observerArr.length <= 0)
  3818. return;
  3819. if (noValue(handler)) {
  3820. this.observeStoreTable[key] = [];
  3821. }
  3822. else {
  3823. observerArr.forEach(function (obsHandler, index) {
  3824. if (obsHandler !== handler)
  3825. return;
  3826. _this.observeStoreTable[key].splice(index, 1);
  3827. });
  3828. }
  3829. };
  3830. /** 注册订阅者 */
  3831. EventBus.prototype.registerObserver = function (key, handler) {
  3832. var observerArr = this.observeStoreTable[key];
  3833. if (noValue(observerArr) || observerArr.length <= 0) {
  3834. observerArr = [];
  3835. this.observeStoreTable[key] = observerArr;
  3836. }
  3837. observerArr.push(handler);
  3838. // if (noValue(key)) return;
  3839. // const sourceValue = this.store[key];
  3840. // if (noValue(sourceValue)) return;
  3841. // handler(sourceValue, key);
  3842. };
  3843. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3844. EventBus.prototype.getStore = function () {
  3845. return this.store;
  3846. };
  3847. /**
  3848. * 取消订阅
  3849. * @param key 订阅的消息key
  3850. * @param handler 指定取消的监听函数
  3851. */
  3852. EventBus.prototype.unsubscribe = function (key, handler) {
  3853. var _this = this;
  3854. if (key instanceof Array) {
  3855. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3856. }
  3857. else {
  3858. this.unregisterObserver(key, handler);
  3859. }
  3860. };
  3861. /**
  3862. * 消息订阅
  3863. * @param key 订阅的消息key
  3864. * @param handler 监听函数
  3865. */
  3866. EventBus.prototype.subscribe = function (key, handler) {
  3867. var _this = this;
  3868. var cancelSubscribe = {
  3869. key: key,
  3870. cancel: function () {
  3871. },
  3872. };
  3873. if (key instanceof Array) {
  3874. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3875. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3876. }
  3877. else {
  3878. this.registerObserver(key, handler);
  3879. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3880. }
  3881. return cancelSubscribe;
  3882. };
  3883. /**
  3884. * 消息订阅(只订阅一次)
  3885. * @param key 订阅的消息key
  3886. * @param handler 监听函数
  3887. */
  3888. EventBus.prototype.subscribeOnce = function (key, handler) {
  3889. var cancelSubscribe = this.subscribe(key, function (data) {
  3890. // try {
  3891. handler(data, key);
  3892. // } catch (err) {
  3893. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3894. // }
  3895. cancelSubscribe.cancel();
  3896. });
  3897. };
  3898. /**
  3899. * 发送消息(触发订阅监听函数)
  3900. * @param key 消息key
  3901. * @param eventData 消息值
  3902. */
  3903. EventBus.prototype.publish = function (key, eventData) {
  3904. var _this = this;
  3905. if (key instanceof Array) {
  3906. key.forEach(function (k) { return _this.store[k] = eventData; });
  3907. }
  3908. else {
  3909. this.store[key] = eventData;
  3910. }
  3911. };
  3912. return EventBus;
  3913. }());
  3914. // ------------------------------------------------------------------------------------------ use
  3915. var eventBus = new EventBus();
  3916. //# sourceMappingURL=EventBus.js.map
  3917. var model$1 = {
  3918. data: {
  3919. dataSync_isStart: false,
  3920. dataSync: {
  3921. skipError: false,
  3922. clearData: false,
  3923. tables: []
  3924. },
  3925. dataSyncResult: {
  3926. jobId: ''
  3927. },
  3928. dataSource1: '',
  3929. dataSource2: '',
  3930. schema1: '',
  3931. schema2: '',
  3932. hasDiff: false,
  3933. }
  3934. };
  3935. //# sourceMappingURL=DbSync.model.js.map
  3936. var vjson$1 = {
  3937. title: '数据库同步',
  3938. layout: 'fit',
  3939. items: [
  3940. {
  3941. reference: 'wizard1',
  3942. layout: 'card',
  3943. items: [
  3944. {
  3945. reference: 'first',
  3946. layout: 'fit',
  3947. bbar: [
  3948. '->',
  3949. {
  3950. xtype: 'button',
  3951. iconCls: 'x-fa fa-road',
  3952. text: '结构同步 &raquo;',
  3953. bind: {
  3954. disabled: '{!hasDiff}'
  3955. },
  3956. listeners: {
  3957. click: 'scope.structCopyTo',
  3958. }
  3959. },
  3960. {
  3961. xtype: 'button',
  3962. iconCls: 'x-fa fa-files-o',
  3963. text: '数据同步 &raquo;',
  3964. bind: {
  3965. disabled: '{!hasDiff}'
  3966. },
  3967. listeners: {
  3968. click: 'scope.dataCopyTo',
  3969. }
  3970. },
  3971. {
  3972. xtype: 'button',
  3973. iconCls: 'x-fa fa-sort-alpha-desc',
  3974. text: '索引同步 &raquo;',
  3975. bind: {
  3976. disabled: '{!hasDiff}'
  3977. },
  3978. listeners: {
  3979. click: 'scope.indexCopyTo',
  3980. }
  3981. },
  3982. {
  3983. xtype: 'button',
  3984. iconCls: 'x-fa fa-product-hunt',
  3985. text: '存储过程同步 &raquo;',
  3986. bind: {
  3987. disabled: '{!hasDiff}'
  3988. },
  3989. listeners: {
  3990. click: 'scope.procedureCopyTo',
  3991. }
  3992. },
  3993. ],
  3994. items: [
  3995. {
  3996. title: '数据库对比',
  3997. reference: 'grid1',
  3998. xtype: 'yvgrid',
  3999. pagination: false,
  4000. border: false,
  4001. cellTip: true,
  4002. selModel: {
  4003. type: 'checkboxmodel',
  4004. mode: 'MULTI',
  4005. },
  4006. tbar: {
  4007. xtype: 'toolbar',
  4008. items: [
  4009. {
  4010. xtype: 'combo',
  4011. fieldLabel: '源数据库',
  4012. bind: {
  4013. value: '{dataSource1}'
  4014. },
  4015. dataSource: 'scope.getDataBaseName'
  4016. },
  4017. {
  4018. xtype: 'combo',
  4019. fieldLabel: '目标数据库',
  4020. bind: {
  4021. value: '{dataSource2}'
  4022. },
  4023. dataSource: 'scope.getDataBaseName'
  4024. },
  4025. {
  4026. xtype: 'button',
  4027. iconCls: 'x-fa fa-flash',
  4028. text: '对比',
  4029. bind: {
  4030. disabled: '{!dataSource1 || !dataSource2}'
  4031. },
  4032. listeners: {
  4033. click: 'scope.diff',
  4034. }
  4035. },
  4036. {
  4037. xtype: 'button',
  4038. iconCls: 'x-fa fa-cloud-download',
  4039. text: '重新拉取结构(耗时!)',
  4040. bind: {
  4041. disabled: '{!dataSource1 || !dataSource2}'
  4042. },
  4043. listeners: {
  4044. click: 'scope.dbToMeta',
  4045. }
  4046. },
  4047. ]
  4048. },
  4049. columns: [
  4050. {
  4051. dataIndex: 'table_name1',
  4052. header: '源表',
  4053. width: 300,
  4054. },
  4055. {
  4056. dataIndex: 'table_name2',
  4057. header: '目标表',
  4058. width: 300,
  4059. },
  4060. {
  4061. dataIndex: 'diff',
  4062. header: '对比结果',
  4063. width: 100,
  4064. },
  4065. {
  4066. xtype: 'actioncolumn',
  4067. width: 30,
  4068. sortable: false,
  4069. menuDisabled: true,
  4070. items: [
  4071. {
  4072. iconCls: 'x-fa fa-bars',
  4073. text: '打开',
  4074. handler: 'scope.showDetail',
  4075. }
  4076. ]
  4077. },
  4078. {
  4079. dataIndex: 'remark',
  4080. header: '详情',
  4081. width: 200,
  4082. sortable: true,
  4083. },
  4084. ],
  4085. },
  4086. ]
  4087. },
  4088. {
  4089. reference: 'ddl',
  4090. layout: {
  4091. type: 'vbox',
  4092. pack: 'start',
  4093. align: 'stretch'
  4094. },
  4095. items: [
  4096. {
  4097. xtype: 'sqleditor',
  4098. reference: 'ddleditor',
  4099. flex: 1,
  4100. },
  4101. {
  4102. xtype: 'toolbar',
  4103. items: [
  4104. '->',
  4105. {
  4106. xtype: 'button',
  4107. text: '&laquo; 上一步',
  4108. listeners: {
  4109. click: 'scope.back'
  4110. }
  4111. },
  4112. {
  4113. xtype: 'button',
  4114. iconCls: 'x-fa fa-flash',
  4115. text: '执行',
  4116. listeners: {
  4117. click: 'scope.executeDDL'
  4118. }
  4119. },
  4120. ]
  4121. }
  4122. ]
  4123. },
  4124. {
  4125. reference: 'ddl_idx',
  4126. layout: {
  4127. type: 'vbox',
  4128. pack: 'start',
  4129. align: 'stretch'
  4130. },
  4131. items: [
  4132. {
  4133. xtype: 'sqleditor',
  4134. reference: 'ddleditor_idx',
  4135. flex: 1,
  4136. },
  4137. {
  4138. xtype: 'toolbar',
  4139. items: [
  4140. '->',
  4141. {
  4142. xtype: 'button',
  4143. text: '&laquo; 上一步',
  4144. listeners: {
  4145. click: 'scope.back'
  4146. }
  4147. },
  4148. {
  4149. xtype: 'button',
  4150. iconCls: 'x-fa fa-flash',
  4151. text: '执行',
  4152. listeners: {
  4153. click: 'scope.executeDDLIdx'
  4154. }
  4155. },
  4156. ]
  4157. }
  4158. ]
  4159. },
  4160. {
  4161. reference: 'ddl_procedure',
  4162. layout: {
  4163. type: 'vbox',
  4164. pack: 'start',
  4165. align: 'stretch'
  4166. },
  4167. items: [
  4168. {
  4169. xtype: 'sqleditor',
  4170. reference: 'ddleditor_procedure',
  4171. flex: 1,
  4172. },
  4173. {
  4174. xtype: 'toolbar',
  4175. items: [
  4176. '->',
  4177. {
  4178. xtype: 'button',
  4179. text: '&laquo; 上一步',
  4180. listeners: {
  4181. click: 'scope.back'
  4182. }
  4183. },
  4184. {
  4185. xtype: 'button',
  4186. iconCls: 'x-fa fa-flash',
  4187. text: '执行',
  4188. listeners: {
  4189. click: 'scope.executeProcedureSQL'
  4190. }
  4191. },
  4192. ]
  4193. }
  4194. ]
  4195. },
  4196. {
  4197. reference: 'datacopy',
  4198. xtype: 'yvgrid',
  4199. pagination: false,
  4200. tbar: {
  4201. xtype: 'toolbar',
  4202. items: [
  4203. {
  4204. xtype: 'checkbox',
  4205. fieldLabel: '忽略错误',
  4206. bind: {
  4207. value: '{dataSync.skipError}'
  4208. },
  4209. },
  4210. {
  4211. xtype: 'checkbox',
  4212. fieldLabel: '清空数据',
  4213. bind: {
  4214. value: '{dataSync.clearData}'
  4215. },
  4216. },
  4217. {
  4218. xtype: 'button',
  4219. iconCls: 'x-fa fa-play-circle',
  4220. text: '开始',
  4221. bind: {
  4222. disabled: '{dataSync_isStart}'
  4223. },
  4224. listeners: { click: 'scope.dataSync_start' }
  4225. },
  4226. {
  4227. xtype: 'button',
  4228. iconCls: 'x-fa fa-stop-circle',
  4229. text: '停止',
  4230. bind: {
  4231. disabled: '{!dataSync_isStart}'
  4232. },
  4233. listeners: { click: 'scope.dataSync_stop' }
  4234. },
  4235. ]
  4236. },
  4237. columns: [
  4238. {
  4239. dataIndex: 'tableName', header: '表名',
  4240. width: 300,
  4241. },
  4242. {
  4243. dataIndex: 'dataCount', header: '总记录数',
  4244. width: 150,
  4245. },
  4246. {
  4247. dataIndex: 'currentIdx', header: '当前记录数',
  4248. width: 150,
  4249. },
  4250. {
  4251. dataIndex: 'syncCount', header: '同步数',
  4252. width: 150,
  4253. },
  4254. {
  4255. dataIndex: 'deleteCount', header: '删除',
  4256. width: 150,
  4257. },
  4258. {
  4259. dataIndex: 'syncProgress', header: '进度',
  4260. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4261. },
  4262. ]
  4263. }
  4264. ]
  4265. }
  4266. ]
  4267. };
  4268. //# sourceMappingURL=DbSync.view.js.map
  4269. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4270. function createEmptyModule(path, filename) {
  4271. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4272. }
  4273. function createFolder(parentPath, filename) {
  4274. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4275. }
  4276. function getModuleFileContent(module) {
  4277. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4278. }
  4279. function saveFile(fileFullPath, fileContent) {
  4280. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4281. // @ts-ignore
  4282. system.msg("保存成功");
  4283. return res;
  4284. });
  4285. }
  4286. function getQueryDslInfo(tableName) {
  4287. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4288. args: [
  4289. { tableName: tableName }
  4290. ]
  4291. }).catch(function (e) {
  4292. var _a, _b;
  4293. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4294. showErrorDialog(msg);
  4295. console.error(msg, e);
  4296. });
  4297. }
  4298. function invokeServer(url, param) {
  4299. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4300. return request.post(url, {
  4301. args: [
  4302. param
  4303. ]
  4304. }).catch(function (e) {
  4305. var _a, _b;
  4306. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4307. showErrorDialog(msg);
  4308. console.error(msg, e);
  4309. });
  4310. }
  4311. function parseSqlApi(sql) {
  4312. return request.post(getBaseUrl() + "@parseSqlApi", {
  4313. args: [sql]
  4314. }).catch(function (e) {
  4315. var _a, _b;
  4316. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4317. showErrorDialog(msg);
  4318. console.error(msg, e);
  4319. });
  4320. }
  4321. function saveModuleFiles(param) {
  4322. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4323. args: [
  4324. param
  4325. ]
  4326. }).catch(function (e) {
  4327. var _a, _b;
  4328. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4329. showErrorDialog(msg);
  4330. console.error(msg, e);
  4331. });
  4332. }
  4333. function createQueryDSLFile(_a) {
  4334. var schema_name = _a.schema_name, table_name = _a.table_name;
  4335. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4336. args: [{ schema_name: schema_name, table_name: table_name }]
  4337. }).catch(function (e) {
  4338. var _a, _b;
  4339. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4340. showErrorDialog(msg);
  4341. console.error(msg, e);
  4342. });
  4343. }
  4344. function dbToMeta(param) {
  4345. if (typeof param === 'undefined') {
  4346. param = { datasource: 'master' };
  4347. }
  4348. else if (typeof param.datasource === 'undefined') {
  4349. param.datasource = 'master';
  4350. }
  4351. return request.post(getBaseUrl() + "@dbToMeta", {
  4352. args: [
  4353. param
  4354. ]
  4355. }).catch(function (e) {
  4356. var _a, _b;
  4357. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4358. showErrorDialog(msg);
  4359. console.error(msg, e);
  4360. });
  4361. }
  4362. function getColumnDomainApi(param) {
  4363. if (typeof param === 'undefined') {
  4364. param = { datasource: 'master' };
  4365. }
  4366. else if (typeof param.datasource === 'undefined') {
  4367. param.datasource = 'master';
  4368. }
  4369. return request.post(getBaseUrl() + "@getColumnDomain", {
  4370. args: [
  4371. param
  4372. ]
  4373. }).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) || 'getColumnDomainApi ERROR!';
  4376. showErrorDialog(msg);
  4377. console.error(msg, e);
  4378. });
  4379. }
  4380. function getMateData(param) {
  4381. if (typeof param === 'undefined') {
  4382. param = { datasource: 'master' };
  4383. }
  4384. else if (typeof param.datasource === 'undefined') {
  4385. param.datasource = 'master';
  4386. }
  4387. return request.post(getBaseUrl() + "@getMateData", {
  4388. args: [
  4389. param
  4390. ]
  4391. }).catch(function (e) {
  4392. var _a, _b;
  4393. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4394. showErrorDialog(msg);
  4395. console.error(msg, e);
  4396. });
  4397. }
  4398. function getMateDataByTableName(param) {
  4399. if (typeof param === 'undefined') {
  4400. param = { datasource: 'master' };
  4401. }
  4402. else if (typeof param.datasource === 'undefined') {
  4403. param.datasource = 'master';
  4404. }
  4405. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4406. args: [
  4407. param
  4408. ]
  4409. }).catch(function (e) {
  4410. var _a, _b;
  4411. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4412. showErrorDialog(msg);
  4413. console.error(msg, e);
  4414. });
  4415. }
  4416. function saveMetaTableChanges(param) {
  4417. if (typeof param === 'undefined') {
  4418. param = { datasource: 'master' };
  4419. }
  4420. else if (typeof param.datasource === 'undefined') {
  4421. param.datasource = 'master';
  4422. }
  4423. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4424. args: [
  4425. param
  4426. ]
  4427. }).catch(function (e) {
  4428. var _a, _b;
  4429. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4430. showErrorDialog(msg);
  4431. console.error(msg, e);
  4432. });
  4433. }
  4434. function getModifyTableDDL(param) {
  4435. if (typeof param === 'undefined') {
  4436. param = { datasource: 'master' };
  4437. }
  4438. else if (typeof param.datasource === 'undefined') {
  4439. param.datasource = 'master';
  4440. }
  4441. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4442. args: [
  4443. param
  4444. ]
  4445. }).catch(function (e) {
  4446. var _a, _b;
  4447. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4448. showErrorDialog(msg);
  4449. console.error(msg, e);
  4450. });
  4451. }
  4452. function pushToDbCommitApi(param) {
  4453. if (typeof param === 'undefined') {
  4454. param = { datasource: 'master' };
  4455. }
  4456. else if (typeof param.datasource === 'undefined') {
  4457. param.datasource = 'master';
  4458. }
  4459. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4460. args: [
  4461. param
  4462. ]
  4463. }).catch(function (e) {
  4464. var _a, _b;
  4465. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4466. showErrorDialog(msg);
  4467. console.error(msg, e);
  4468. });
  4469. }
  4470. /**
  4471. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4472. */
  4473. function saveMetaExBuildDDL(param) {
  4474. if (typeof param === 'undefined') {
  4475. param = { datasource: 'master' };
  4476. }
  4477. else if (typeof param.datasource === 'undefined') {
  4478. param.datasource = 'master';
  4479. }
  4480. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4481. args: [
  4482. param
  4483. ]
  4484. }).catch(function (e) {
  4485. var _a, _b;
  4486. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4487. showErrorDialog(msg);
  4488. console.error(msg, e);
  4489. });
  4490. }
  4491. function registerResource(params) {
  4492. return request.post(getBaseUrl() + "@registerResource", {
  4493. args: [params]
  4494. }).catch(function (e) {
  4495. var _a, _b;
  4496. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4497. showErrorDialog(msg);
  4498. console.error(msg, e);
  4499. });
  4500. }
  4501. function getMenuTree(params) {
  4502. return request.post(getBaseUrl() + "@getMenuTree", {
  4503. args: [params]
  4504. }).catch(function (e) {
  4505. var _a, _b;
  4506. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4507. showErrorDialog(msg);
  4508. console.error(msg, e);
  4509. });
  4510. }
  4511. function moduleTree() {
  4512. return request.post(getBaseUrl() + "@moduleTree")
  4513. .catch(function (e) {
  4514. var _a, _b;
  4515. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4516. showErrorDialog(msg);
  4517. console.error(msg, e);
  4518. });
  4519. }
  4520. function dropTableDDL(schemaName, tableName) {
  4521. return request.post(getBaseUrl() + "@dropTableDDL", {
  4522. args: [
  4523. { schemaName: schemaName, tableName: tableName },
  4524. ]
  4525. }).catch(function (e) {
  4526. var _a, _b;
  4527. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4528. showErrorDialog(msg);
  4529. console.error(msg, e);
  4530. });
  4531. }
  4532. function renameTableDDL(schemaName, tableName, reTableName) {
  4533. return request.post(getBaseUrl() + "@renameTableDDL", {
  4534. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4535. }).catch(function (e) {
  4536. var _a, _b;
  4537. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4538. showErrorDialog(msg);
  4539. console.error(msg, e);
  4540. });
  4541. }
  4542. function executeModifyProcedureSQL(param) {
  4543. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4544. args: [
  4545. param,
  4546. ]
  4547. }).catch(function (e) {
  4548. var _a, _b;
  4549. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4550. showErrorDialog(msg);
  4551. console.error(msg, e);
  4552. });
  4553. }
  4554. function parseDynamicSqlApi(sql, dataSource) {
  4555. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4556. args: [
  4557. { sql: sql, dataSource: dataSource },
  4558. ]
  4559. }).catch(function (e) {
  4560. var _a, _b;
  4561. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4562. showErrorDialog(msg);
  4563. console.error(msg, e);
  4564. });
  4565. }
  4566. function exporerList() {
  4567. return request.post(getBaseUrl() + "@exporerList", {
  4568. args: [{}]
  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) || 'exporerList ERROR!';
  4572. showErrorDialog(msg);
  4573. console.error(msg, e);
  4574. });
  4575. }
  4576. function reportListApi() {
  4577. return request.post(getBaseUrl() + "@reportList", {
  4578. args: []
  4579. }).catch(function (e) {
  4580. var _a, _b;
  4581. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4582. showErrorDialog(msg);
  4583. console.error(msg, e);
  4584. });
  4585. }
  4586. function reportByIdApi(reportId) {
  4587. return request.post(getBaseUrl() + "@reportById", {
  4588. args: [
  4589. { reportId: reportId },
  4590. ]
  4591. }).catch(function (e) {
  4592. var _a, _b;
  4593. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4594. showErrorDialog(msg);
  4595. console.error(msg, e);
  4596. });
  4597. }
  4598. function createReportApi(reportName) {
  4599. return request.post(getBaseUrl() + "@createReport", {
  4600. args: [
  4601. { reportName: reportName },
  4602. ]
  4603. }).catch(function (e) {
  4604. var _a, _b;
  4605. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4606. showErrorDialog(msg);
  4607. console.error(msg, e);
  4608. });
  4609. }
  4610. function saveReportApi(param) {
  4611. return request.post(getBaseUrl() + "@saveReport", {
  4612. args: [
  4613. param,
  4614. ]
  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) || 'saveReport ERROR!';
  4618. showErrorDialog(msg);
  4619. console.error(msg, e);
  4620. });
  4621. }
  4622. function delReportApi(report_id) {
  4623. return request.post(getBaseUrl() + "@delReport", {
  4624. args: [{ report_id: report_id },]
  4625. }).catch(function (e) {
  4626. var _a, _b;
  4627. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4628. showErrorDialog(msg);
  4629. console.error(msg, e);
  4630. });
  4631. }
  4632. function getDict(param) {
  4633. if (typeof param === 'undefined') {
  4634. param = { datasource: 'master' };
  4635. }
  4636. else if (typeof param.datasource === 'undefined') {
  4637. param.datasource = 'master';
  4638. }
  4639. return request.post(getBaseUrl() + "@getDict", {
  4640. args: [
  4641. param
  4642. ]
  4643. });
  4644. }
  4645. function saveDictApi(param) {
  4646. if (typeof param === 'undefined') {
  4647. param = { datasource: 'master' };
  4648. }
  4649. else if (typeof param.datasource === 'undefined') {
  4650. param.datasource = 'master';
  4651. }
  4652. return request.post(getBaseUrl() + "@saveDict", {
  4653. args: [
  4654. param
  4655. ]
  4656. }).catch(function (e) {
  4657. var _a, _b;
  4658. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4659. showErrorDialog(msg);
  4660. console.error(msg, e);
  4661. });
  4662. }
  4663. function saveDictItemsApi(param) {
  4664. if (typeof param === 'undefined') {
  4665. param = { datasource: 'master' };
  4666. }
  4667. else if (typeof param.datasource === 'undefined') {
  4668. param.datasource = 'master';
  4669. }
  4670. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4671. args: [
  4672. param
  4673. ]
  4674. }).catch(function (e) {
  4675. var _a, _b;
  4676. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4677. showErrorDialog(msg);
  4678. console.error(msg, e);
  4679. });
  4680. }
  4681. function createDictEnum(param) {
  4682. return request.post(getBaseUrl() + "@createDictEnum", {
  4683. args: [
  4684. param
  4685. ]
  4686. }).catch(function (e) {
  4687. var _a, _b;
  4688. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4689. showErrorDialog(msg);
  4690. console.error(msg, e);
  4691. });
  4692. }
  4693. function loadSqlContentApi(url) {
  4694. return request.post(getBaseUrl() + "@loadSqlContent", {
  4695. args: [
  4696. {
  4697. url: GLOBAL_NAMESPACE_PREFIX + url,
  4698. }
  4699. ]
  4700. }).catch(function (e) {
  4701. var _a, _b;
  4702. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4703. showErrorDialog(msg);
  4704. console.error(msg, e);
  4705. });
  4706. }
  4707. function saveSqlContentApi(url, content) {
  4708. return request.post(getBaseUrl() + "@saveSqlContent", {
  4709. args: [
  4710. {
  4711. url: GLOBAL_NAMESPACE_PREFIX + url,
  4712. content: content,
  4713. }
  4714. ]
  4715. }).catch(function (e) {
  4716. var _a, _b;
  4717. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4718. showErrorDialog(msg);
  4719. console.error(msg, e);
  4720. });
  4721. }
  4722. function readBpmn(param) {
  4723. return request.post(getBaseUrl() + "@readBpmn", {
  4724. args: [param]
  4725. }).catch(function (e) {
  4726. var _a, _b;
  4727. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4728. showErrorDialog(msg);
  4729. console.error(msg, e);
  4730. });
  4731. }
  4732. function createBpmn(path, filename) {
  4733. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4734. var _a, _b;
  4735. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4736. showErrorDialog(msg);
  4737. console.error(msg, e);
  4738. });
  4739. }
  4740. function saveBpmn(fileFullPath, fileContent) {
  4741. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4742. // @ts-ignore
  4743. system.msg("保存成功");
  4744. return res;
  4745. });
  4746. }
  4747. function deleteBpmn(path, filename) {
  4748. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4749. var _a, _b;
  4750. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4751. showErrorDialog(msg);
  4752. console.error(msg, e);
  4753. });
  4754. }
  4755. function createDevForm(param) {
  4756. return request.post(getBaseUrl() + "@createDevForm", {
  4757. args: [param]
  4758. }).catch(function (e) {
  4759. var _a, _b;
  4760. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4761. showErrorDialog(msg);
  4762. console.error(msg, e);
  4763. });
  4764. }
  4765. function readDevForm(param) {
  4766. return request.post(getBaseUrl() + "@readDevForm", {
  4767. args: [param]
  4768. }).catch(function (e) {
  4769. var _a, _b;
  4770. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4771. showErrorDialog(msg);
  4772. console.error(msg, e);
  4773. });
  4774. }
  4775. function calcColumnForm(param) {
  4776. return request.post(getBaseUrl() + "@calcColumnForm", {
  4777. args: [param]
  4778. }).catch(function (e) {
  4779. var _a, _b;
  4780. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4781. showErrorDialog(msg);
  4782. console.error(msg, e);
  4783. });
  4784. }
  4785. function widgetListApi(param) {
  4786. return request.post(getBaseUrl() + "@widgetListApi", {
  4787. args: [param]
  4788. }).catch(function (e) {
  4789. var _a, _b;
  4790. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4791. showErrorDialog(msg);
  4792. console.error(msg, e);
  4793. });
  4794. }
  4795. function readWidget(param) {
  4796. return request.post(getBaseUrl() + "@readWidget", {
  4797. args: [param]
  4798. }).catch(function (e) {
  4799. var _a, _b;
  4800. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4801. showErrorDialog(msg);
  4802. console.error(msg, e);
  4803. });
  4804. }
  4805. function saveWidget(param) {
  4806. return request.post(getBaseUrl() + "@saveWidget", {
  4807. args: [param]
  4808. }).catch(function (e) {
  4809. var _a, _b;
  4810. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4811. showErrorDialog(msg);
  4812. console.error(msg, e);
  4813. });
  4814. }
  4815. function deleteWidget(param) {
  4816. return request.post(getBaseUrl() + "@deleteWidget", {
  4817. args: [param]
  4818. }).catch(function (e) {
  4819. var _a, _b;
  4820. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4821. showErrorDialog(msg);
  4822. console.error(msg, e);
  4823. });
  4824. }
  4825. function getDataBaseNameApi() {
  4826. return request.post(getBaseUrl() + "@getDataBaseName", {
  4827. args: []
  4828. }).catch(function (e) {
  4829. var _a, _b;
  4830. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4831. showErrorDialog(msg);
  4832. console.error(msg, e);
  4833. });
  4834. }
  4835. function getDiffDDLApi(param) {
  4836. return request.post(getBaseUrl() + "@getDiffDDL", {
  4837. args: [
  4838. param
  4839. ]
  4840. }).catch(function (e) {
  4841. var _a, _b;
  4842. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4843. showErrorDialog(msg);
  4844. console.error(msg, e);
  4845. });
  4846. }
  4847. function dataSyncApi(param) {
  4848. return request.post(getBaseUrl() + "@dataSync", {
  4849. args: [
  4850. param
  4851. ]
  4852. }).catch(function (e) {
  4853. var _a, _b;
  4854. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4855. showErrorDialog(msg);
  4856. console.error(msg, e);
  4857. });
  4858. }
  4859. function dataSyncInfoApi(param) {
  4860. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4861. args: [
  4862. param
  4863. ]
  4864. }).catch(function (e) {
  4865. var _a, _b;
  4866. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4867. showErrorDialog(msg);
  4868. console.error(msg, e);
  4869. });
  4870. }
  4871. function saveColumnDomain(param) {
  4872. if (typeof param === 'undefined') {
  4873. param = { datasource: 'master' };
  4874. }
  4875. else if (typeof param.datasource === 'undefined') {
  4876. param.datasource = 'master';
  4877. }
  4878. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4879. args: [
  4880. param
  4881. ]
  4882. }).catch(function (e) {
  4883. var _a, _b;
  4884. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4885. showErrorDialog('发生错误:' + msg);
  4886. console.error(msg, e);
  4887. });
  4888. }
  4889. function devOpsList() {
  4890. return request.post(getBaseUrl() + "@devOpsList", {
  4891. args: [{}]
  4892. }).catch(function (e) {
  4893. var _a, _b;
  4894. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4895. showErrorDialog('发生错误:' + msg);
  4896. console.error(msg, e);
  4897. });
  4898. }
  4899. function devOpsById(opsId) {
  4900. return request.post(getBaseUrl() + "@devOpsById", {
  4901. args: [{ opsId: opsId }]
  4902. }).catch(function (e) {
  4903. var _a, _b;
  4904. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4905. showErrorDialog('发生错误:' + msg);
  4906. console.error(msg, e);
  4907. });
  4908. }
  4909. function metricsRequestApi() {
  4910. return request.get("/api/metrics/request")
  4911. .catch(function (e) {
  4912. var _a, _b;
  4913. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4914. showErrorDialog('发生错误:' + msg);
  4915. console.error(msg, e);
  4916. });
  4917. }
  4918. function metricsJdbcApi() {
  4919. return request.get("/api/metrics/jdbc")
  4920. .catch(function (e) {
  4921. var _a, _b;
  4922. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4923. showErrorDialog('发生错误:' + msg);
  4924. console.error(msg, e);
  4925. });
  4926. }
  4927. function executeDDL(param) {
  4928. return request.post(getBaseUrl() + "@executeDDL", {
  4929. args: [
  4930. param,
  4931. ]
  4932. }).catch(function (e) {
  4933. var _a, _b;
  4934. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4935. showErrorDialog('发生错误:' + msg);
  4936. console.error(msg, e);
  4937. });
  4938. }
  4939. function getModifyIdxDDL(param) {
  4940. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4941. args: [
  4942. param,
  4943. ]
  4944. }).catch(function (e) {
  4945. var _a, _b;
  4946. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4947. showErrorDialog('发生错误:' + msg);
  4948. console.error(msg, e);
  4949. });
  4950. }
  4951. function getModifyProcedureSQL(param) {
  4952. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4953. args: [
  4954. param,
  4955. ]
  4956. }).catch(function (e) {
  4957. var _a, _b;
  4958. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4959. showErrorDialog('发生错误:' + msg);
  4960. console.error(msg, e);
  4961. });
  4962. }
  4963. function saveWhLayout(param) {
  4964. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4965. args: [
  4966. param,
  4967. ]
  4968. }).catch(function (e) {
  4969. var _a, _b;
  4970. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4971. showErrorDialog('发生错误:' + msg);
  4972. console.error(msg, e);
  4973. });
  4974. }
  4975. function deleteWhLayout(param) {
  4976. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4977. args: [
  4978. param,
  4979. ]
  4980. }).catch(function (e) {
  4981. var _a, _b;
  4982. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4983. showErrorDialog('发生错误:' + msg);
  4984. console.error(msg, e);
  4985. });
  4986. }
  4987. function loadWhLayoutAll() {
  4988. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4989. args: []
  4990. }).catch(function (e) {
  4991. var _a, _b;
  4992. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4993. showErrorDialog('发生错误:' + msg);
  4994. console.error(msg, e);
  4995. });
  4996. }
  4997. function loadWhLayout(param) {
  4998. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4999. args: [
  5000. param,
  5001. ]
  5002. }).catch(function (e) {
  5003. var _a, _b;
  5004. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  5005. showErrorDialog('发生错误:' + msg);
  5006. console.error(msg, e);
  5007. });
  5008. }
  5009. var baseUrl = "/api/com/yvan/studio/FileManager";
  5010. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  5011. function getBaseUrl() {
  5012. // return getCurrentProject().url + baseUrl
  5013. return baseUrl;
  5014. }
  5015. function getLayoutUrl() {
  5016. // return getCurrentProject().url + baseUrl
  5017. return layoutUrl;
  5018. }
  5019. var Request = /** @class */ (function () {
  5020. function Request(axiosInstance) {
  5021. this.axiosInstance = axiosInstance;
  5022. }
  5023. // 全局响应数据转换处理
  5024. Request.transformResponse = function (response) {
  5025. var _a;
  5026. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5027. };
  5028. Request.prototype.get = function (url, config) {
  5029. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5030. };
  5031. Request.prototype.delete = function (url, config) {
  5032. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5033. };
  5034. Request.prototype.head = function (url, config) {
  5035. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5036. };
  5037. Request.prototype.options = function (url, config) {
  5038. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5039. };
  5040. Request.prototype.post = function (url, data, config) {
  5041. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5042. };
  5043. Request.prototype.put = function (url, data, config) {
  5044. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5045. };
  5046. Request.prototype.patch = function (url, data, config) {
  5047. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5048. };
  5049. Request.prototype.request = function (config) {
  5050. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5051. };
  5052. return Request;
  5053. }());
  5054. /** 创建一个axios实例对象 */
  5055. function axiosCreate(config) {
  5056. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5057. }
  5058. var axiosInstance;
  5059. function init() {
  5060. axiosInstance = axiosCreate({
  5061. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5062. });
  5063. request = new Request(axiosInstance);
  5064. }
  5065. var request;
  5066. //# sourceMappingURL=Api.js.map
  5067. /**
  5068. * 对比两个列 是否存在不一致
  5069. */
  5070. function compareColumn(t1, c1, t2, c2) {
  5071. if (typeof c2 === 'undefined') {
  5072. return 'column_name';
  5073. }
  5074. if (c1.column_name !== c2.column_name) {
  5075. return 'column_name';
  5076. }
  5077. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5078. return 'default_value';
  5079. }
  5080. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5081. return 'column_comment';
  5082. }
  5083. if (c1.is_primary_key !== c2.is_primary_key) {
  5084. return 'is_primary_key';
  5085. }
  5086. if (c1.not_null !== c2.not_null) {
  5087. return 'not_null';
  5088. }
  5089. var symbol1 = getDataTypeSymbol(t1, c1);
  5090. var symbol2 = getDataTypeSymbol(t2, c2);
  5091. if (symbol1 !== symbol2) {
  5092. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5093. return 'data_type';
  5094. }
  5095. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5096. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5097. // 只关注长度
  5098. if (c1.column_size != c2.column_size) {
  5099. return 'column_size';
  5100. }
  5101. }
  5102. else {
  5103. // 其他情况,长度和精度都要关注
  5104. if (c1.column_size != c2.column_size) {
  5105. return 'column_size';
  5106. }
  5107. if (c1.decimal_digits !== c2.decimal_digits) {
  5108. return 'decimal_digits';
  5109. }
  5110. }
  5111. }
  5112. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5113. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5114. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5115. if (symbol1 !== symbol2) {
  5116. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5117. return 'data_type';
  5118. }
  5119. if (is_fix_size) {
  5120. // 字段域吧大小限制住了
  5121. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5122. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5123. // 只关注长度
  5124. if (column.column_size != domain.column_size) {
  5125. return 'column_size';
  5126. }
  5127. }
  5128. else {
  5129. // 其他情况,长度和精度都要关注
  5130. if (column.column_size != domain.column_size) {
  5131. return 'column_size';
  5132. }
  5133. if (column.decimal_digits !== domain.decimal_digits) {
  5134. return 'decimal_digits';
  5135. }
  5136. }
  5137. }
  5138. }
  5139. function checkColumn(table, col) {
  5140. if (isEmpty(col.column_name)) {
  5141. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5142. }
  5143. if (isKeyword(col.column_name)) {
  5144. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5145. }
  5146. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5147. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5148. }
  5149. return undefined;
  5150. }
  5151. function applyDomain(dbType, domain) {
  5152. var editRow = {
  5153. data_type: domain[dbType + '_datatype'],
  5154. };
  5155. domain = _$2.cloneDeep(domain);
  5156. if (!editRow.data_type) {
  5157. throw Error('字段域没有定义数据类型!');
  5158. }
  5159. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5160. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5161. if (match) {
  5162. // 类型里面包含括号
  5163. var sz = parseInt(match[2]);
  5164. if (isNaN(sz)) {
  5165. throw Error('字段域的定义错误:' + editRow.data_type);
  5166. }
  5167. domain.is_fix_size = true;
  5168. editRow.data_type = match[1];
  5169. domain.column_size = sz;
  5170. domain.decimal_digits = 0;
  5171. }
  5172. else {
  5173. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5174. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5175. if (match2) {
  5176. // 类型里面包含括号
  5177. var sz = parseInt(match2[2]);
  5178. if (isNaN(sz)) {
  5179. throw Error('字段域的定义错误:' + editRow.data_type);
  5180. }
  5181. var dg = parseInt(match2[3]);
  5182. if (isNaN(dg)) {
  5183. throw Error('字段域的定义错误:' + editRow.data_type);
  5184. }
  5185. domain.is_fix_size = true;
  5186. editRow.data_type = match[1];
  5187. domain.column_size = sz;
  5188. domain.decimal_digits = dg;
  5189. }
  5190. }
  5191. if (domain.domain_column_ui) {
  5192. _$2.extend(editRow, {
  5193. column_ui: domain.domain_column_ui,
  5194. });
  5195. }
  5196. if (domain.domain_column_dict) {
  5197. _$2.extend(editRow, {
  5198. column_dict: domain.domain_column_dict,
  5199. });
  5200. }
  5201. if (domain.is_fix_size) {
  5202. _$2.extend(editRow, {
  5203. column_size: domain.column_size,
  5204. decimal_digits: domain.decimal_digits
  5205. });
  5206. }
  5207. if (domain.is_fix_default_value) {
  5208. _$2.extend(editRow, {
  5209. default_value: domain.default_value,
  5210. });
  5211. }
  5212. return editRow;
  5213. }
  5214. /**
  5215. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5216. */
  5217. function getDataTypeSymbol(table, col) {
  5218. if (table.db_type === 'oracle') {
  5219. switch (col.data_type) {
  5220. case 'number':
  5221. if (col.column_size <= 10 && !col.decimal_digits) {
  5222. return 'integer';
  5223. }
  5224. else if (col.column_size <= 19 && !col.decimal_digits) {
  5225. return 'long';
  5226. }
  5227. return 'bigdecimal';
  5228. case 'char':
  5229. if (col.column_size > 3000) {
  5230. return 'clob';
  5231. }
  5232. return 'char';
  5233. case 'integer':
  5234. return 'integer';
  5235. case 'varchar':
  5236. case 'varchar2':
  5237. if (col.column_size > 3000) {
  5238. return 'clob';
  5239. }
  5240. return 'varchar';
  5241. case 'clob':
  5242. return 'clob';
  5243. case 'blob':
  5244. return 'blob';
  5245. case 'date':
  5246. case 'timestamp':
  5247. case 'timestamp(6)':
  5248. case 'timestamp with local time zone':
  5249. case 'timestamp(6) with local time zone':
  5250. case 'timestamp(6) with time zone':
  5251. return 'timestamp';
  5252. }
  5253. return "undefined";
  5254. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5255. }
  5256. if (table.db_type === 'pgsql') {
  5257. switch (col.data_type) {
  5258. case 'int4':
  5259. return 'integer';
  5260. case 'int8':
  5261. return 'long';
  5262. case 'char':
  5263. return 'char';
  5264. case 'varchar':
  5265. case 'varchar2':
  5266. if (col.column_size > 3000) {
  5267. return 'clob';
  5268. }
  5269. return 'varchar';
  5270. case 'numeric':
  5271. if (col.column_size <= 10 && !col.decimal_digits) {
  5272. return 'integer';
  5273. }
  5274. else if (col.column_size <= 19 && !col.decimal_digits) {
  5275. return 'long';
  5276. }
  5277. return 'bigdecimal';
  5278. case 'timestamp':
  5279. case 'timestamptz':
  5280. return 'timestamp';
  5281. case 'bytea':
  5282. return 'blob';
  5283. }
  5284. return "undefined";
  5285. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5286. }
  5287. throw Error('未知数据库类型:' + table.db_type);
  5288. }
  5289. /**
  5290. * 判断对象名称是不是数据库关键字(保留字)
  5291. */
  5292. function isKeyword(word) {
  5293. if (!word || typeof word !== 'string') {
  5294. return false;
  5295. }
  5296. var kk = ['access',
  5297. 'add',
  5298. 'all',
  5299. 'alter',
  5300. 'and',
  5301. 'any',
  5302. 'as',
  5303. 'asc',
  5304. 'audit',
  5305. 'between',
  5306. 'by',
  5307. 'char',
  5308. 'check',
  5309. 'cluster',
  5310. 'column',
  5311. 'comment',
  5312. 'compress',
  5313. 'connect',
  5314. 'create',
  5315. 'current',
  5316. 'date',
  5317. 'decimal',
  5318. 'default',
  5319. 'delete',
  5320. 'desc',
  5321. 'distinct',
  5322. 'drop',
  5323. 'else',
  5324. 'exclusive',
  5325. 'exists',
  5326. 'file',
  5327. 'float',
  5328. 'for',
  5329. 'from',
  5330. 'grant',
  5331. 'group',
  5332. 'having',
  5333. 'identified',
  5334. 'immediate',
  5335. 'in',
  5336. 'increment',
  5337. 'index',
  5338. 'initial',
  5339. 'insert',
  5340. 'integer',
  5341. 'intersect',
  5342. 'into',
  5343. 'is',
  5344. 'level',
  5345. 'like',
  5346. 'lock',
  5347. 'long',
  5348. 'maxextents',
  5349. 'minus',
  5350. 'mlslabel',
  5351. 'mode',
  5352. 'modify',
  5353. 'noaudit',
  5354. 'nocompress',
  5355. 'not',
  5356. 'nowait',
  5357. 'null',
  5358. 'number',
  5359. 'of',
  5360. 'offline',
  5361. 'on',
  5362. 'online',
  5363. 'option',
  5364. 'or',
  5365. 'order',
  5366. 'p',
  5367. 'ctfree',
  5368. 'prior',
  5369. 'privileges',
  5370. 'public',
  5371. 'raw',
  5372. 'rename',
  5373. 'resource',
  5374. 'revoke',
  5375. 'row',
  5376. 'rowid',
  5377. 'rownum',
  5378. 'rows',
  5379. 'select',
  5380. 'session',
  5381. 'set',
  5382. 'share',
  5383. 'size',
  5384. 'smallint',
  5385. 'start',
  5386. 'successful',
  5387. 'synonym',
  5388. 'sysdate',
  5389. 'table',
  5390. 'then',
  5391. 'to',
  5392. 'trigger',
  5393. 'uid',
  5394. 'union',
  5395. 'unique',
  5396. 'update',
  5397. 'user',
  5398. 'validate',
  5399. 'values',
  5400. 'varchar',
  5401. 'varchar2',
  5402. 'view',
  5403. 'whenever',
  5404. 'where',
  5405. 'with'];
  5406. return _$2.includes(kk, word.toLowerCase());
  5407. }
  5408. //# sourceMappingURL=DbUtils.js.map
  5409. var DbSync = /** @class */ (function (_super) {
  5410. __extends(DbSync, _super);
  5411. function DbSync() {
  5412. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5413. }
  5414. DbSync.prototype.onLoad = function () {
  5415. };
  5416. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5417. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5418. getDataBaseNameApi().then(function (res) {
  5419. successCallback(res.data.map(function (name) {
  5420. return {
  5421. id: name, text: name
  5422. };
  5423. }));
  5424. });
  5425. };
  5426. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5427. showInfoDialog(record.get('remark'));
  5428. };
  5429. DbSync.prototype.diff = function () {
  5430. var _this = this;
  5431. var promise1 = getMateData({
  5432. datasource: this.viewModel.get('dataSource1')
  5433. });
  5434. var promise2 = getMateData({
  5435. datasource: this.viewModel.get('dataSource2')
  5436. });
  5437. this.viewModel.set('schema1', '');
  5438. this.viewModel.set('schema2', '');
  5439. this.refs.grid1.setLoading(true);
  5440. Promise.all([promise1, promise2]).then(function (_a) {
  5441. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5442. var rows = [];
  5443. if (_$2.size(res1) > 0) {
  5444. // res1 起码有一个 schema
  5445. _this.viewModel.set('schema1', res1[0].schema_name);
  5446. _this.viewModel.set('schema2', res2[0].schema_name);
  5447. if (!_this.viewModel.get('schema1')) {
  5448. msg$1('datasource1 最起码需要一张表');
  5449. return;
  5450. }
  5451. if (!_this.viewModel.get('schema2')) {
  5452. msg$1('datasource2 最起码需要一张表');
  5453. return;
  5454. }
  5455. _$2.forEach(res1[0].table_list, function (table1) {
  5456. var _a;
  5457. 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; });
  5458. if (table1.schema_name) {
  5459. _this.viewModel.set('schema1', table1.schema_name);
  5460. }
  5461. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5462. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5463. }
  5464. var row = {
  5465. table_name1: table1.table_name,
  5466. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5467. table_info: table1
  5468. };
  5469. if (!table2) {
  5470. row.diff = '不一致';
  5471. row.remark = '目标表缺失';
  5472. }
  5473. else if (table1.column_list.length !== table2.column_list.length) {
  5474. row.diff = '不一致';
  5475. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5476. }
  5477. else {
  5478. row.diff = '一致';
  5479. var remark_1 = [];
  5480. _$2.forEach(table1.column_list, function (col1) {
  5481. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5482. if (!col2) {
  5483. row.diff = '不一致';
  5484. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5485. }
  5486. else {
  5487. var colDiff = compareColumn(table1, col1, table2, col2);
  5488. if (colDiff) {
  5489. row.diff = '不一致';
  5490. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5491. }
  5492. }
  5493. });
  5494. row.remark = remark_1.join('\n');
  5495. }
  5496. rows.push(row);
  5497. });
  5498. }
  5499. _this.refs.grid1.setData(rows);
  5500. _this.viewModel.set('hasDiff', true);
  5501. }).finally(function () {
  5502. _this.refs.grid1.setLoading(false);
  5503. });
  5504. };
  5505. DbSync.prototype.structCopyTo = function () {
  5506. var _this = this;
  5507. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5508. msg$1('选择数据源!');
  5509. return;
  5510. }
  5511. var recordList = this.refs.grid1.getSelection();
  5512. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5513. if (_$2.size(tableNameList) <= 0) {
  5514. msg$1('请选择要同步的表');
  5515. return;
  5516. }
  5517. var error = undefined;
  5518. _$2.forEach(tableNameList, function (tableInfo) {
  5519. _$2.forEach(tableInfo.column_list, function (col) {
  5520. error = checkColumn(tableInfo, col);
  5521. return false;
  5522. });
  5523. if (error) {
  5524. return false;
  5525. }
  5526. });
  5527. if (error) {
  5528. msg$1(error);
  5529. return;
  5530. }
  5531. var schema1 = this.viewModel.get('schema1');
  5532. var schema2 = this.viewModel.get('schema2');
  5533. if (!schema1 || !schema2) {
  5534. msg$1('无法识别 schema 名称');
  5535. return;
  5536. }
  5537. this.refs.grid1.setLoading(true);
  5538. getDiffDDLApi({
  5539. datasource1: this.viewModel.get('dataSource1'),
  5540. datasource2: this.viewModel.get('dataSource2'),
  5541. schema1: this.viewModel.get('schema1'),
  5542. schema2: this.viewModel.get('schema2'),
  5543. tables: tableNameList,
  5544. }).then(function (res) {
  5545. if (res.success) {
  5546. _this.refs.ddleditor.setCode(res.data);
  5547. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5548. }
  5549. }).finally(function () {
  5550. _this.refs.grid1.setLoading(false);
  5551. });
  5552. };
  5553. DbSync.prototype.indexCopyTo = function () {
  5554. var _this = this;
  5555. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5556. msg$1('选择数据源!');
  5557. return;
  5558. }
  5559. var recordList = this.refs.grid1.getSelection();
  5560. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5561. if (_$2.size(tableNameList) <= 0) {
  5562. msg$1('请选择要同步的表');
  5563. return;
  5564. }
  5565. var schema1 = this.viewModel.get('schema1');
  5566. var schema2 = this.viewModel.get('schema2');
  5567. if (!schema1 || !schema2) {
  5568. msg$1('无法识别 schema 名称');
  5569. return;
  5570. }
  5571. this.refs.grid1.setLoading(true);
  5572. getModifyIdxDDL({
  5573. datasource1: this.viewModel.get('dataSource1'),
  5574. datasource2: this.viewModel.get('dataSource2'),
  5575. schema1: this.viewModel.get('schema1'),
  5576. schema2: this.viewModel.get('schema2'),
  5577. tables: tableNameList,
  5578. }).then(function (res) {
  5579. if (res.success) {
  5580. _this.refs.ddleditor_idx.setCode(res.data);
  5581. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5582. }
  5583. }).finally(function () {
  5584. _this.refs.grid1.setLoading(false);
  5585. });
  5586. };
  5587. DbSync.prototype.procedureCopyTo = function () {
  5588. var _this = this;
  5589. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5590. msg$1('选择数据源!');
  5591. return;
  5592. }
  5593. var schema1 = this.viewModel.get('schema1');
  5594. var schema2 = this.viewModel.get('schema2');
  5595. if (!schema1 || !schema2) {
  5596. msg$1('无法识别 schema 名称');
  5597. return;
  5598. }
  5599. this.refs.grid1.setLoading(true);
  5600. getModifyProcedureSQL({
  5601. datasource1: this.viewModel.get('dataSource1'),
  5602. datasource2: this.viewModel.get('dataSource2'),
  5603. schema1: this.viewModel.get('schema1'),
  5604. schema2: this.viewModel.get('schema2'),
  5605. }).then(function (res) {
  5606. if (res.success) {
  5607. _this.refs.ddleditor_procedure.setCode(res.data);
  5608. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5609. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5610. }
  5611. }).finally(function () {
  5612. _this.refs.grid1.setLoading(false);
  5613. });
  5614. };
  5615. DbSync.prototype.dataSync_start = function () {
  5616. var _this = this;
  5617. this.viewModel.set('dataSync_isStart', true);
  5618. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5619. this.refs.datacopy.setLoading(true);
  5620. dataSyncApi(dataSync)
  5621. .then(function (res) {
  5622. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5623. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5624. })
  5625. .finally(function () {
  5626. _this.refs.datacopy.setLoading(false);
  5627. });
  5628. };
  5629. DbSync.prototype.dataSync_process = function () {
  5630. var _this = this;
  5631. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5632. dataSyncInfoApi({ jobId: jobId })
  5633. .then(function (res) {
  5634. if (_$2.isArray(res.tableSyncInfos)) {
  5635. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5636. _this.refs.datacopy.setData(res.tableSyncInfos);
  5637. try {
  5638. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5639. }
  5640. catch (e) {
  5641. }
  5642. }
  5643. if (res.endTime) {
  5644. // 已经结束
  5645. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5646. if (res.success) {
  5647. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5648. }
  5649. else {
  5650. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5651. }
  5652. _this.dataSync_stop();
  5653. }
  5654. })
  5655. .catch(function (e) {
  5656. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5657. console.error(e);
  5658. // this.dataSync_stop()
  5659. })
  5660. .finally(function () {
  5661. _this.refs.datacopy.setLoading(false);
  5662. });
  5663. };
  5664. DbSync.prototype.dataSync_stop = function () {
  5665. this.viewModel.set('dataSync_isStart', false);
  5666. clearInterval(this.dataSyncInterval);
  5667. delete this.dataSyncInterval;
  5668. };
  5669. DbSync.prototype.dataCopyTo = function () {
  5670. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5671. msg$1('选择数据源!');
  5672. return;
  5673. }
  5674. var recordList = this.refs.grid1.getSelection();
  5675. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5676. if (_$2.size(tableNameList) <= 0) {
  5677. msg$1('请选择要同步的表');
  5678. return;
  5679. }
  5680. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5681. this.viewModel.set('dataSync.tables', tableNameList);
  5682. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5683. };
  5684. DbSync.prototype.next = function () {
  5685. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5686. };
  5687. DbSync.prototype.back = function () {
  5688. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5689. };
  5690. DbSync.prototype.dbToMeta = function () {
  5691. var _this = this;
  5692. var dataSource1 = this.viewModel.get('dataSource1');
  5693. var dataSource2 = this.viewModel.get('dataSource2');
  5694. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5695. var promise1 = dbToMeta({ datasource: dataSource1 });
  5696. var promise2 = dbToMeta({ datasource: dataSource2 });
  5697. _this.refs.grid1.setLoading(true);
  5698. Promise.all([promise1, promise2]).then(function (_a) {
  5699. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5700. _this.diff();
  5701. }).catch(function (res) {
  5702. _this.refs.grid1.setLoading(false);
  5703. showErrorDialog$1(res);
  5704. });
  5705. });
  5706. };
  5707. DbSync.prototype.executeDDL = function () {
  5708. var _this = this;
  5709. var code = this.refs.ddleditor.getValue();
  5710. var dataSource2 = this.viewModel.get('dataSource2');
  5711. var target_schema_name = this.viewModel.get('schema2');
  5712. var recordList = this.refs.grid1.getSelection();
  5713. var table_infos = _$2.map(recordList, function (r) {
  5714. return r.get('table_info');
  5715. });
  5716. this.setLoading(true);
  5717. pushToDbCommitApi({
  5718. datasource: dataSource2,
  5719. ddl: code,
  5720. table_infos: table_infos,
  5721. target_schema_name: target_schema_name,
  5722. }).then(function (res) {
  5723. if (res === null || res === void 0 ? void 0 : res.success) {
  5724. msg$1('执行成功');
  5725. _this.back();
  5726. _this.diff();
  5727. return;
  5728. }
  5729. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5730. }).finally(function () {
  5731. _this.setLoading(false);
  5732. });
  5733. };
  5734. DbSync.prototype.executeDDLIdx = function () {
  5735. var _this = this;
  5736. var code = this.refs.ddleditor_idx.getValue();
  5737. var dataSource2 = this.viewModel.get('dataSource2');
  5738. this.setLoading(true);
  5739. executeDDL({
  5740. datasource: dataSource2,
  5741. ddl: code,
  5742. }).then(function (res) {
  5743. if (res === null || res === void 0 ? void 0 : res.success) {
  5744. msg$1('执行成功');
  5745. _this.back();
  5746. return;
  5747. }
  5748. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5749. }).finally(function () {
  5750. _this.setLoading(false);
  5751. });
  5752. };
  5753. DbSync.prototype.executeProcedureSQL = function () {
  5754. var _this = this;
  5755. this.setLoading(true);
  5756. executeModifyProcedureSQL({
  5757. datasource1: this.viewModel.get('dataSource1'),
  5758. datasource2: this.viewModel.get('dataSource2'),
  5759. schema1: this.viewModel.get('schema1'),
  5760. schema2: this.viewModel.get('schema2'),
  5761. }).then(function (res) {
  5762. if (res === null || res === void 0 ? void 0 : res.success) {
  5763. msg$1('执行成功');
  5764. _this.back();
  5765. return;
  5766. }
  5767. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5768. }).finally(function () {
  5769. _this.setLoading(false);
  5770. });
  5771. };
  5772. return DbSync;
  5773. }(Scope));
  5774. //# sourceMappingURL=DbSync.js.map
  5775. var model$2 = {
  5776. data: {}
  5777. };
  5778. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5779. var vjson$2 = {
  5780. title: '示例代码',
  5781. layout: 'fit',
  5782. items: [
  5783. {
  5784. layout: 'border',
  5785. items: [
  5786. {
  5787. region: 'north',
  5788. split: true,
  5789. height: 200,
  5790. title: '表格数据',
  5791. reference: 'dataeditor',
  5792. xtype: 'jsoneditor',
  5793. listeners: {
  5794. change: 'scope.dataChanged'
  5795. },
  5796. },
  5797. {
  5798. region: 'west',
  5799. split: true,
  5800. width: 230,
  5801. title: '模板',
  5802. reference: 'tree1',
  5803. xtype: 'treepanel',
  5804. rootVisible: false,
  5805. useArrows: true,
  5806. colspan: 2,
  5807. lines: true,
  5808. multiSelect: false,
  5809. listeners: {
  5810. itemclick: 'scope.templateChange',
  5811. },
  5812. },
  5813. {
  5814. region: 'center',
  5815. title: '参考代码',
  5816. reference: 'preview',
  5817. xtype: 'jsoneditor',
  5818. },
  5819. ]
  5820. }
  5821. ]
  5822. };
  5823. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5824. var rootNode = {
  5825. id: 'ROOT',
  5826. type: "ROOT",
  5827. path: "",
  5828. expanded: true,
  5829. leaf: false,
  5830. children: [
  5831. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5832. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5833. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5834. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5835. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5836. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5837. ],
  5838. };
  5839. var TemplateDev = /** @class */ (function (_super) {
  5840. __extends(TemplateDev, _super);
  5841. function TemplateDev() {
  5842. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5843. _this.dataChanged = _$2.debounce(function () {
  5844. var me = _this;
  5845. if (me.refs.tree1.selection) {
  5846. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5847. }
  5848. }, 50);
  5849. return _this;
  5850. }
  5851. TemplateDev.prototype.onDestroy = function () {
  5852. setDbCode(undefined);
  5853. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5854. };
  5855. TemplateDev.prototype.onLoad = function () {
  5856. setDbCode(this);
  5857. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5858. this.refs.tree1.setRootNode(rootNode);
  5859. getColumnDomainApi({}).then(function (_a) {
  5860. var data = _a.data;
  5861. return window['dev_column_domain'] = data;
  5862. });
  5863. };
  5864. TemplateDev.prototype.dbTreeNodeChange = function () {
  5865. var me = handles$1.dbcode;
  5866. var tables = [];
  5867. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5868. var raw = _$2.cloneDeep(r.get('raw'));
  5869. raw.id = r.get('id');
  5870. if (r.get('type') === 'table') {
  5871. tables.push(raw);
  5872. return;
  5873. }
  5874. if (r.get('type') === 'column') {
  5875. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5876. if (!tableInfo) {
  5877. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5878. tables.push(tableInfo);
  5879. }
  5880. if (!tableInfo.column_list) {
  5881. tableInfo.column_list = [raw];
  5882. }
  5883. else {
  5884. tableInfo.column_list.push(raw);
  5885. }
  5886. }
  5887. });
  5888. // 对于没有选择列的表格,默认加上所有列
  5889. _$2.forEach(tables, function (tableInfo) {
  5890. if (typeof tableInfo.column_list === 'undefined') {
  5891. tableInfo.column_list = [];
  5892. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5893. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5894. });
  5895. }
  5896. });
  5897. var code = JSON.stringify(tables, null, ' ');
  5898. me.refs.dataeditor.setCode(code);
  5899. };
  5900. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5901. var url = record.data.url;
  5902. var rd = _$2.uniqueId('db_code_request');
  5903. if (url) {
  5904. var data = void 0;
  5905. try {
  5906. data = JSON.parse(this.refs.dataeditor.getCode());
  5907. }
  5908. catch (e) {
  5909. return;
  5910. }
  5911. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5912. // if (typeof node.default === "function") {
  5913. // const v = toString(node.default(data))
  5914. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5915. // this.refs.preview.setLanguage("plaintext")
  5916. // this.refs.preview.setCode(v)
  5917. // }
  5918. // })
  5919. showErrorDialog$1('没做这里');
  5920. }
  5921. };
  5922. return TemplateDev;
  5923. }(Scope));
  5924. //# sourceMappingURL=DbCodeTemplate.js.map
  5925. var model$3 = {
  5926. data: {
  5927. hasChanged: false,
  5928. }
  5929. };
  5930. //# sourceMappingURL=DbDomain.model.js.map
  5931. var vjson$3 = {
  5932. bind: {
  5933. title: '字段域{grid1.ischanged?" *":""}',
  5934. },
  5935. layout: 'fit',
  5936. items: [
  5937. {
  5938. layout: 'border',
  5939. items: [
  5940. {
  5941. region: 'center',
  5942. xtype: 'yvgrid',
  5943. selModel: {
  5944. type: 'spreadsheet',
  5945. columnSelect: true,
  5946. pruneRemoved: false,
  5947. extensible: 'y'
  5948. },
  5949. plugins: {
  5950. clipboard: true,
  5951. selectionreplicator: true
  5952. },
  5953. reference: 'grid1',
  5954. pagination: false,
  5955. tbar: {
  5956. xtype: 'toolbar',
  5957. items: [
  5958. {
  5959. xtype: 'button',
  5960. text: '添加',
  5961. iconCls: 'x-fa fa-plus-circle',
  5962. listeners: {
  5963. click: 'scope.addField'
  5964. }
  5965. },
  5966. {
  5967. xtype: 'button',
  5968. text: '删除',
  5969. iconCls: 'x-fa fa-minus-circle',
  5970. listeners: {
  5971. click: 'scope.removeField'
  5972. }
  5973. },
  5974. {
  5975. xtype: 'button',
  5976. text: '保存',
  5977. iconCls: 'x-fa fa-save',
  5978. bind: {
  5979. disabled: '{!grid1.ischanged}'
  5980. },
  5981. listeners: {
  5982. click: 'scope.save'
  5983. }
  5984. },
  5985. ]
  5986. },
  5987. listeners: {
  5988. editfinish: 'scope.gridEditFinish',
  5989. },
  5990. columns: [
  5991. {
  5992. text: '字段域名称', dataIndex: 'domain_name',
  5993. sortable: false,
  5994. menuDisabled: true,
  5995. locked: true,
  5996. editor: {
  5997. selectOnFocus: true
  5998. }
  5999. },
  6000. {
  6001. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  6002. sortable: false, menuDisabled: true,
  6003. editor: {
  6004. selectOnFocus: true
  6005. }
  6006. },
  6007. {
  6008. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  6009. sortable: false, menuDisabled: true,
  6010. editor: {
  6011. selectOnFocus: true
  6012. }
  6013. },
  6014. {
  6015. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  6016. sortable: false, menuDisabled: true,
  6017. editor: {
  6018. selectOnFocus: true
  6019. }
  6020. },
  6021. {
  6022. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  6023. sortable: false, menuDisabled: true,
  6024. editor: {
  6025. selectOnFocus: true
  6026. }
  6027. },
  6028. {
  6029. text: 'Java类型', dataIndex: 'java_datatype',
  6030. sortable: false, menuDisabled: true,
  6031. editor: {
  6032. selectOnFocus: true
  6033. }
  6034. },
  6035. {
  6036. text: '固定长度', dataIndex: 'is_fix_size',
  6037. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6038. width: 88, resizable: false,
  6039. },
  6040. {
  6041. text: '长度', dataIndex: 'column_size',
  6042. sortable: false, menuDisabled: true, dataType: 'int',
  6043. xtype: 'numbercolumn', format: '0',
  6044. editor: { selectOnFocus: true }
  6045. },
  6046. {
  6047. text: '小数位', dataIndex: 'decimal_digits',
  6048. sortable: false, menuDisabled: true, dataType: 'int',
  6049. xtype: 'numbercolumn', format: '0',
  6050. editor: { selectOnFocus: true }
  6051. },
  6052. {
  6053. text: '字典', dataIndex: 'domain_column_dict',
  6054. sortable: false, menuDisabled: true,
  6055. // fix: ['system.getDict("DICT")'],
  6056. width: 200,
  6057. editor: {
  6058. xtype: 'combo',
  6059. listConfig: {
  6060. minWidth: 350
  6061. },
  6062. }
  6063. },
  6064. {
  6065. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6066. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6067. width: 88, resizable: false,
  6068. },
  6069. {
  6070. text: '默认值', dataIndex: 'default_value',
  6071. sortable: false, menuDisabled: true,
  6072. editor: {
  6073. selectOnFocus: true
  6074. }
  6075. },
  6076. {
  6077. text: 'UI建议', dataIndex: 'domain_column_ui',
  6078. sortable: false, menuDisabled: true,
  6079. // fix: ['system.getDict("column_ui")'],
  6080. editor: {
  6081. xtype: 'combo',
  6082. allowBlank: true,
  6083. listConfig: {
  6084. minWidth: 200
  6085. },
  6086. }
  6087. },
  6088. {
  6089. text: '详细描述', dataIndex: 'domain_note',
  6090. sortable: false, menuDisabled: true,
  6091. editor: {}
  6092. },
  6093. {
  6094. text: '责任人', dataIndex: 'domain_person',
  6095. sortable: false, menuDisabled: true,
  6096. editor: {
  6097. selectOnFocus: true
  6098. }
  6099. },
  6100. {
  6101. text: '版本', dataIndex: 'domain_version',
  6102. sortable: false, menuDisabled: true,
  6103. editor: {
  6104. selectOnFocus: true
  6105. }
  6106. },
  6107. ]
  6108. }
  6109. ]
  6110. },
  6111. ]
  6112. };
  6113. //# sourceMappingURL=DbDomain.view.js.map
  6114. var CacheStore = /** @class */ (function () {
  6115. function CacheStore() {
  6116. // 订阅
  6117. this.subscribeList = [];
  6118. this.apiResponse = undefined;
  6119. }
  6120. /**
  6121. * 订阅结果集
  6122. */
  6123. CacheStore.prototype.registe = function (fn) {
  6124. this.subscribeList.push(fn);
  6125. };
  6126. /**
  6127. * 取消订阅
  6128. */
  6129. CacheStore.prototype.unregiste = function (fn) {
  6130. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6131. };
  6132. /**
  6133. * 尝试取数据(先读缓存)
  6134. */
  6135. CacheStore.prototype.reloadIfNeed = function (param) {
  6136. var _this = this;
  6137. if (typeof this.apiResponse === 'undefined') {
  6138. // 从未有获取过值
  6139. var cacheKey = this.getCacheKey(param);
  6140. if (cacheKey) {
  6141. // 可以从缓存读
  6142. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6143. native.loadFile(fileName, function (res) {
  6144. if (res) {
  6145. // 缓存有值
  6146. _this.apiResponse = res;
  6147. _this.notifyRefresh();
  6148. }
  6149. else {
  6150. // 缓存没值
  6151. _this.reloadForce(param).then(function (res) {
  6152. });
  6153. }
  6154. });
  6155. }
  6156. else {
  6157. // 不能从缓存读
  6158. this.reloadForce(param).then(function (res) {
  6159. });
  6160. }
  6161. return true;
  6162. }
  6163. return false;
  6164. };
  6165. /**
  6166. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6167. */
  6168. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6169. var _this = this;
  6170. return new Promise(function (resolve, reject) {
  6171. if (typeof _this.apiResponse === 'undefined') {
  6172. // 从未有获取过值
  6173. var cacheKey = _this.getCacheKey(param);
  6174. if (cacheKey) {
  6175. // 可以从缓存读
  6176. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6177. native.loadFile(fileName, function (res) {
  6178. if (res) {
  6179. // 缓存有值
  6180. _this.apiResponse = res;
  6181. _this.notifyRefresh();
  6182. resolve(_this.apiResponse);
  6183. }
  6184. else {
  6185. // 缓存没值
  6186. _this.reloadForce(param).then(function (res) {
  6187. resolve(_this.apiResponse);
  6188. });
  6189. }
  6190. });
  6191. }
  6192. else {
  6193. // 不能从缓存读
  6194. _this.reloadForce(param).then(function (res) {
  6195. resolve(_this.apiResponse);
  6196. });
  6197. }
  6198. }
  6199. else {
  6200. // 有值,获取过
  6201. resolve(_this.apiResponse);
  6202. }
  6203. });
  6204. };
  6205. /**
  6206. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6207. */
  6208. CacheStore.prototype.reloadForce = function (param) {
  6209. var _this = this;
  6210. _$2.forEach(this.subscribeList, function (fn) {
  6211. fn(true);
  6212. });
  6213. return this.invokeApi(param)
  6214. .then(function (res) {
  6215. _this.apiResponse = res;
  6216. var cacheKey = _this.getCacheKey(param);
  6217. if (cacheKey) {
  6218. // 可以保存到缓存
  6219. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6220. native.saveFile(fileName, res);
  6221. }
  6222. // 通知订阅者刷新
  6223. _this.notifyRefresh();
  6224. })
  6225. .finally(function () {
  6226. _$2.forEach(_this.subscribeList, function (fn) {
  6227. fn(false);
  6228. });
  6229. });
  6230. };
  6231. /**
  6232. * 通知组件,isLoading状态被更改
  6233. */
  6234. CacheStore.prototype.notifyLoading = function (isLoading) {
  6235. var _this = this;
  6236. _$2.forEach(this.subscribeList, function (fn) {
  6237. fn(_this.apiResponse);
  6238. });
  6239. };
  6240. /**
  6241. * 通知数据更改,需要刷新
  6242. */
  6243. CacheStore.prototype.notifyRefresh = function () {
  6244. var _this = this;
  6245. _$2.forEach(this.subscribeList, function (fn) {
  6246. fn(_this.apiResponse);
  6247. });
  6248. };
  6249. return CacheStore;
  6250. }());
  6251. //# sourceMappingURL=CacheStore.js.map
  6252. // 字段域数据
  6253. var columnDomain = undefined;
  6254. var DomainStore = /** @class */ (function (_super) {
  6255. __extends(DomainStore, _super);
  6256. function DomainStore() {
  6257. return _super !== null && _super.apply(this, arguments) || this;
  6258. }
  6259. DomainStore.prototype.getCacheKey = function (param) {
  6260. return "domain_data.json";
  6261. };
  6262. DomainStore.prototype.invokeApi = function (param) {
  6263. return getColumnDomainApi();
  6264. };
  6265. /**
  6266. * 设置全局可访问的 字段域数据
  6267. */
  6268. DomainStore.prototype.getColumnDomainComboData = function () {
  6269. var _this = this;
  6270. return new Promise(function (resolve) {
  6271. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6272. resolve(_this.apiResponse.data.map(function (v) {
  6273. return { id: v.domain_id, text: v.domain_name };
  6274. }));
  6275. });
  6276. });
  6277. };
  6278. /**
  6279. * 设置全局可访问的 字段域数据
  6280. */
  6281. DomainStore.prototype.getColumnDomainById = function (value) {
  6282. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6283. };
  6284. DomainStore.prototype.getAllDomain = function () {
  6285. return new Promise(function (resolve, reject) {
  6286. getColumnDomainApi()
  6287. .then(function (res) {
  6288. if (res.success) {
  6289. if (res.success) {
  6290. var tt = _$2.map(res.data, function (row) {
  6291. return {
  6292. text: row.domain_name,
  6293. id: row.domain_id,
  6294. };
  6295. });
  6296. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  6297. }
  6298. columnDomain = res.data;
  6299. resolve(res.data);
  6300. }
  6301. else {
  6302. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6303. console.error('getColumnDomain', res.msg);
  6304. }
  6305. })
  6306. .catch(function (e) {
  6307. window['showErrorDialog']('getColumnDomain error!');
  6308. console.error('getColumnDomain', e);
  6309. reject(e);
  6310. });
  6311. });
  6312. };
  6313. return DomainStore;
  6314. }(CacheStore));
  6315. var instance = new DomainStore();
  6316. //# sourceMappingURL=DomainStore.js.map
  6317. var DbDomain = /** @class */ (function (_super) {
  6318. __extends(DbDomain, _super);
  6319. function DbDomain() {
  6320. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6321. }
  6322. DbDomain.prototype.onLoad = function () {
  6323. var _this = this;
  6324. instance.getAllDomain().then(function (data) {
  6325. _this.refs.grid1.setData(data);
  6326. });
  6327. };
  6328. DbDomain.prototype.gridEditFinish = function () {
  6329. this.viewModel.set('hasChanged', true);
  6330. };
  6331. DbDomain.prototype.addField = function () {
  6332. this.refs.grid1.appendEditRow({
  6333. domainName: '',
  6334. pgSqlDataType: '',
  6335. mysqlDataType: '',
  6336. oracleDataType: '',
  6337. sqlserverDataType: '',
  6338. javaDataType: '',
  6339. isFixSize: true,
  6340. size: '',
  6341. decimalDigits: '',
  6342. isFixDefaultValue: false,
  6343. defaultValue: null,
  6344. domainColumnDict: '',
  6345. domainColumnUI: '',
  6346. note: '',
  6347. domainPerson: '',
  6348. domainVersion: '',
  6349. }, 0);
  6350. };
  6351. DbDomain.prototype.removeField = function () {
  6352. var _this = this;
  6353. var rows = [];
  6354. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6355. rows.push(r);
  6356. });
  6357. _.forEach(rows, function (r) {
  6358. _this.refs.grid1.getStore().remove(r);
  6359. });
  6360. };
  6361. DbDomain.prototype.save = function () {
  6362. var _this = this;
  6363. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6364. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6365. if (err) {
  6366. // 如果有异常就不保存
  6367. return;
  6368. }
  6369. // 进行业务上的逻辑校验,比如说必填校验等等
  6370. var hasError = false;
  6371. _.forEach(rows, function (row, i) {
  6372. if (isEmpty(row.domain_name)) {
  6373. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6374. hasError = true;
  6375. return false;
  6376. }
  6377. if (isEmpty(row.pgsql_datatype) ||
  6378. isEmpty(row.mysql_datatype) ||
  6379. isEmpty(row.oracle_datatype) ||
  6380. isEmpty(row.sqlserver_datatype)) {
  6381. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6382. hasError = true;
  6383. return false;
  6384. }
  6385. });
  6386. if (hasError) {
  6387. return;
  6388. }
  6389. // 设置当前界面为 "保存中..." 状态
  6390. this.setLoading(true);
  6391. saveColumnDomain({
  6392. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6393. newRows: newRows,
  6394. modifyRows: modifyRows,
  6395. removeRecords: removeRecords,
  6396. }).then(function (res) {
  6397. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6398. system.msg(res.msg);
  6399. instance.reloadForce({}).then(function () {
  6400. instance.getAllDomain().then(function (data) {
  6401. _this.refs.grid1.setData(data);
  6402. });
  6403. }).finally(function () {
  6404. // 无论正常异常,关闭 "保存中..." 状态
  6405. _this.setLoading(false);
  6406. });
  6407. }).catch(function (e) {
  6408. // 无论正常异常,关闭 "保存中..." 状态
  6409. _this.setLoading(false);
  6410. });
  6411. };
  6412. return DbDomain;
  6413. }(Scope));
  6414. //# sourceMappingURL=DbDomain.js.map
  6415. var model$4 = {
  6416. data: {
  6417. report_id: '',
  6418. report_name: '',
  6419. report_enable: false,
  6420. report: {
  6421. dataSource: '',
  6422. grid: {
  6423. pagination: true,
  6424. },
  6425. query: [],
  6426. columns: [],
  6427. summary: [],
  6428. },
  6429. querySql: '',
  6430. summarySql: '',
  6431. createAt: '',
  6432. createBy: '',
  6433. updateAt: '',
  6434. updateBy: '',
  6435. }
  6436. };
  6437. //# sourceMappingURL=ReportDesign.model.js.map
  6438. var vjson$4 = {
  6439. bind: {
  6440. title: '报表-{report_name}',
  6441. },
  6442. layout: 'fit',
  6443. items: [
  6444. {
  6445. layout: 'border',
  6446. items: [
  6447. {
  6448. region: 'north',
  6449. items: [
  6450. {
  6451. xtype: 'toolbar',
  6452. border: false,
  6453. items: [
  6454. {
  6455. xtype: 'button',
  6456. text: '刷新',
  6457. iconCls: 'x-fa fa-refresh',
  6458. listeners: {
  6459. click: 'scope.load'
  6460. }
  6461. },
  6462. {
  6463. xtype: 'button',
  6464. text: '保存',
  6465. iconCls: 'x-fa fa-save',
  6466. listeners: {
  6467. click: 'scope.save'
  6468. }
  6469. },
  6470. {
  6471. xtype: 'button',
  6472. text: '预览',
  6473. iconCls: 'x-fa fa-play-circle-o',
  6474. listeners: {
  6475. click: 'scope.preview'
  6476. }
  6477. },
  6478. {
  6479. xtype: 'textfield',
  6480. fieldLabel: '报表名称',
  6481. flex: 1,
  6482. bind: {
  6483. value: '{report_name}'
  6484. }
  6485. },
  6486. {
  6487. xtype: 'checkbox',
  6488. fieldLabel: '启用报表',
  6489. checkedValue: 1,
  6490. uncheckedValue: 0,
  6491. bind: {
  6492. value: '{report_enable}'
  6493. }
  6494. },
  6495. {
  6496. xtype: 'checkbox',
  6497. fieldLabel: '启用分页',
  6498. bind: {
  6499. value: '{report.grid.pagination}'
  6500. }
  6501. },
  6502. {
  6503. xtype: 'textfield',
  6504. fieldLabel: '数据源',
  6505. flex: 1,
  6506. bind: {
  6507. value: '{report.dataSource}'
  6508. }
  6509. },
  6510. ]
  6511. }
  6512. ]
  6513. },
  6514. {
  6515. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6516. items: [
  6517. {
  6518. title: 'SQL和查询条件',
  6519. layout: 'border',
  6520. border: false,
  6521. items: [
  6522. {
  6523. region: 'north',
  6524. height: 200,
  6525. border: false,
  6526. split: true,
  6527. xtype: 'yvgrid',
  6528. reference: 'gridCondition',
  6529. pagination: false,
  6530. hideFootbar: true,
  6531. plugins: {
  6532. clipboard: true,
  6533. selectionreplicator: true
  6534. },
  6535. selModel: {
  6536. type: 'spreadsheet',
  6537. columnSelect: false,
  6538. pruneRemoved: false,
  6539. extensible: 'y'
  6540. },
  6541. tbar: {
  6542. xtype: 'toolbar',
  6543. border: false,
  6544. items: [
  6545. {
  6546. xtype: 'button',
  6547. text: '添加条件',
  6548. iconCls: 'x-fa fa-plus-circle',
  6549. listeners: {
  6550. click: 'scope.addCondition'
  6551. }
  6552. },
  6553. {
  6554. xtype: 'button',
  6555. text: '删除条件',
  6556. iconCls: 'x-fa fa-minus-circle',
  6557. listeners: {
  6558. click: 'scope.removeCondition'
  6559. }
  6560. },
  6561. '-',
  6562. {
  6563. xtype: 'button',
  6564. text: '自动分析条件变量',
  6565. iconCls: 'x-fa fa-code-fork',
  6566. listeners: {
  6567. click: 'scope.calcCondition'
  6568. }
  6569. },
  6570. {
  6571. xtype: 'button',
  6572. text: '上移',
  6573. iconCls: 'x-fa fa-arrow-up',
  6574. listeners: {
  6575. click: 'scope.moveUp'
  6576. }
  6577. },
  6578. {
  6579. xtype: 'button',
  6580. text: '下移',
  6581. iconCls: 'x-fa fa-arrow-down',
  6582. listeners: {
  6583. click: 'scope.moveDown'
  6584. }
  6585. },
  6586. ]
  6587. },
  6588. columns: [
  6589. {
  6590. text: '条件变量',
  6591. dataIndex: 'conditionFieldBind',
  6592. width: 140,
  6593. sortable: false,
  6594. menuDisabled: true,
  6595. editor: {
  6596. selectOnFocus: true
  6597. },
  6598. },
  6599. {
  6600. text: '中文标题',
  6601. dataIndex: 'conditionFieldLabel',
  6602. width: 120,
  6603. sortable: false,
  6604. menuDisabled: true,
  6605. editor: {
  6606. selectOnFocus: true
  6607. },
  6608. },
  6609. {
  6610. text: '编辑类型',
  6611. dataIndex: 'conditionFieldXtype',
  6612. width: 80,
  6613. sortable: false,
  6614. menuDisabled: true,
  6615. editor: {
  6616. xtype: 'combo',
  6617. typeAhead: true,
  6618. triggerAction: 'all',
  6619. selectOnFocus: true,
  6620. store: [
  6621. ['textfield', 'textfield'],
  6622. ['combo', 'combo'],
  6623. ['datefield', 'datefield'],
  6624. ['datetimefield', 'datetimefield'],
  6625. ['numberfield', 'numberfield'],
  6626. ['multiplesearch', 'multiplesearch'],
  6627. ]
  6628. }
  6629. },
  6630. {
  6631. text: '权重',
  6632. dataIndex: 'conditionFieldFlex',
  6633. align: 'right',
  6634. width: 60,
  6635. sortable: false,
  6636. menuDisabled: true,
  6637. editor: {
  6638. xtype: 'numberfield',
  6639. selectOnFocus: false,
  6640. minValue: 0,
  6641. maxValue: 10
  6642. },
  6643. },
  6644. {
  6645. text: '字典',
  6646. dataIndex: 'conditionFieldDict',
  6647. width: 160,
  6648. sortable: false,
  6649. menuDisabled: true,
  6650. editor: {
  6651. selectOnFocus: false
  6652. },
  6653. },
  6654. {
  6655. xtype: 'checkcolumn',
  6656. dataIndex: "conditionFieldWrap", header: "换行",
  6657. width: 65,
  6658. sortable: false,
  6659. menuDisabled: true,
  6660. },
  6661. {
  6662. text: '扩展参数',
  6663. dataIndex: 'conditionFieldExtend',
  6664. sortable: false,
  6665. menuDisabled: true,
  6666. editor: {
  6667. selectOnFocus: false
  6668. },
  6669. },
  6670. ]
  6671. },
  6672. {
  6673. region: 'center',
  6674. xtype: 'sqleditor',
  6675. layout: 'fit',
  6676. reference: 'sqlEditor',
  6677. split: true,
  6678. },
  6679. ]
  6680. },
  6681. {
  6682. title: '查询结果字段',
  6683. xtype: 'yvgrid',
  6684. reference: 'gridColumn',
  6685. pagination: false,
  6686. hideFootbar: true,
  6687. border: false,
  6688. plugins: {
  6689. clipboard: true,
  6690. selectionreplicator: true
  6691. },
  6692. selModel: {
  6693. type: 'spreadsheet',
  6694. columnSelect: false,
  6695. pruneRemoved: false,
  6696. extensible: 'y'
  6697. },
  6698. tbar: {
  6699. xtype: 'toolbar',
  6700. items: [
  6701. {
  6702. xtype: 'button',
  6703. text: '添加',
  6704. iconCls: 'x-fa fa-plus-circle',
  6705. listeners: {
  6706. click: 'scope.addColumn'
  6707. }
  6708. },
  6709. {
  6710. xtype: 'button',
  6711. text: '删除',
  6712. iconCls: 'x-fa fa-minus-circle',
  6713. listeners: {
  6714. click: 'scope.removeColumn'
  6715. }
  6716. },
  6717. '-',
  6718. {
  6719. xtype: 'button',
  6720. text: '自动分析',
  6721. iconCls: 'x-fa fa-code-fork',
  6722. listeners: {
  6723. click: 'scope.calcColumn'
  6724. }
  6725. },
  6726. {
  6727. xtype: 'button',
  6728. text: '上移',
  6729. iconCls: 'x-fa fa-arrow-up',
  6730. listeners: {
  6731. click: 'scope.moveUp'
  6732. }
  6733. },
  6734. {
  6735. xtype: 'button',
  6736. text: '下移',
  6737. iconCls: 'x-fa fa-arrow-down',
  6738. listeners: {
  6739. click: 'scope.moveDown'
  6740. }
  6741. },
  6742. ]
  6743. },
  6744. columns: [
  6745. { xtype: 'rownumberer' },
  6746. {
  6747. text: '字段',
  6748. dataIndex: 'dataIndex',
  6749. width: 140,
  6750. sortable: false,
  6751. menuDisabled: true,
  6752. editor: {
  6753. selectOnFocus: true
  6754. },
  6755. },
  6756. {
  6757. text: '标题',
  6758. dataIndex: 'header',
  6759. width: 120,
  6760. sortable: false,
  6761. menuDisabled: true,
  6762. editor: {
  6763. selectOnFocus: true
  6764. },
  6765. },
  6766. {
  6767. text: '显示类型',
  6768. dataIndex: 'xtype',
  6769. width: 90,
  6770. sortable: false,
  6771. menuDisabled: true,
  6772. editor: {
  6773. xtype: 'combo',
  6774. typeAhead: true,
  6775. triggerAction: 'all',
  6776. selectOnFocus: true,
  6777. store: [
  6778. ['', ''],
  6779. ['rownum', 'rownum'],
  6780. ['button', 'button'],
  6781. ['checkbox', 'checkbox'],
  6782. ['progres', 'progres'],
  6783. ]
  6784. }
  6785. },
  6786. {
  6787. text: '数据类型',
  6788. dataIndex: 'dataType',
  6789. width: 90,
  6790. sortable: false,
  6791. menuDisabled: true,
  6792. editor: {
  6793. xtype: 'combo',
  6794. typeAhead: true,
  6795. triggerAction: 'all',
  6796. selectOnFocus: true,
  6797. store: [
  6798. ['', ''],
  6799. ['string', 'string'],
  6800. ['number', 'number'],
  6801. ['date', 'date'],
  6802. ]
  6803. }
  6804. },
  6805. {
  6806. text: '宽度',
  6807. dataIndex: 'width',
  6808. align: 'right',
  6809. width: 60,
  6810. sortable: false,
  6811. menuDisabled: true,
  6812. editor: {
  6813. xtype: 'numberfield',
  6814. selectOnFocus: true,
  6815. minValue: 0,
  6816. maxValue: 1000
  6817. },
  6818. },
  6819. {
  6820. text: '权重',
  6821. dataIndex: 'flex',
  6822. align: 'right',
  6823. width: 60,
  6824. sortable: false,
  6825. menuDisabled: true,
  6826. editor: {
  6827. xtype: 'numberfield',
  6828. selectOnFocus: true,
  6829. minValue: 0,
  6830. maxValue: 10
  6831. },
  6832. },
  6833. {
  6834. text: '字典',
  6835. dataIndex: 'dict',
  6836. sortable: false,
  6837. menuDisabled: true,
  6838. width: 120,
  6839. editor: {
  6840. selectOnFocus: true,
  6841. },
  6842. },
  6843. {
  6844. text: '对齐',
  6845. dataIndex: 'align',
  6846. width: 60,
  6847. sortable: false,
  6848. menuDisabled: true,
  6849. editor: {
  6850. xtype: 'combo',
  6851. typeAhead: true,
  6852. triggerAction: 'all',
  6853. selectOnFocus: false,
  6854. store: [
  6855. ['', ''],
  6856. ['start', 'start'],
  6857. ['center', 'center'],
  6858. ['end', 'end'],
  6859. ]
  6860. },
  6861. },
  6862. {
  6863. text: '过滤',
  6864. dataIndex: 'filterable',
  6865. xtype: 'checkcolumn',
  6866. width: 50,
  6867. resizable: false,
  6868. sortable: false,
  6869. menuDisabled: true,
  6870. },
  6871. {
  6872. text: '隐藏',
  6873. dataIndex: 'hidden',
  6874. xtype: 'checkcolumn',
  6875. width: 50,
  6876. resizable: false,
  6877. sortable: false,
  6878. menuDisabled: true,
  6879. },
  6880. {
  6881. text: '排序',
  6882. dataIndex: 'sortable',
  6883. xtype: 'checkcolumn',
  6884. width: 50,
  6885. resizable: false,
  6886. sortable: false,
  6887. menuDisabled: true,
  6888. },
  6889. {
  6890. text: '扩展参数',
  6891. dataIndex: 'fieldExtend',
  6892. sortable: false,
  6893. menuDisabled: true,
  6894. editor: {
  6895. selectOnFocus: false
  6896. },
  6897. },
  6898. ],
  6899. },
  6900. {
  6901. title: '汇总和汇总逻辑',
  6902. layout: 'border',
  6903. border: false,
  6904. items: [
  6905. {
  6906. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6907. reference: 'gridSum',
  6908. pagination: false,
  6909. hideFootbar: true,
  6910. height: 200,
  6911. split: true,
  6912. border: false,
  6913. plugins: {
  6914. clipboard: true,
  6915. selectionreplicator: true
  6916. },
  6917. selModel: {
  6918. type: 'spreadsheet',
  6919. columnSelect: false,
  6920. pruneRemoved: false,
  6921. extensible: 'y'
  6922. },
  6923. tbar: {
  6924. xtype: 'toolbar',
  6925. border: false,
  6926. items: [
  6927. {
  6928. xtype: 'button',
  6929. text: '添加',
  6930. iconCls: 'x-fa fa-plus-circle',
  6931. listeners: {
  6932. click: 'scope.addSum'
  6933. }
  6934. },
  6935. {
  6936. xtype: 'button',
  6937. text: '删除',
  6938. iconCls: 'x-fa fa-minus-circle',
  6939. listeners: {
  6940. click: 'scope.removeSum'
  6941. }
  6942. },
  6943. '-',
  6944. {
  6945. xtype: 'button',
  6946. text: '自动分析',
  6947. iconCls: 'x-fa fa-code-fork',
  6948. listeners: {
  6949. click: 'scope.calcSum'
  6950. }
  6951. },
  6952. {
  6953. xtype: 'button',
  6954. text: '上移',
  6955. iconCls: 'x-fa fa-arrow-up',
  6956. listeners: {
  6957. click: 'scope.moveUp'
  6958. }
  6959. },
  6960. {
  6961. xtype: 'button',
  6962. text: '下移',
  6963. iconCls: 'x-fa fa-arrow-down',
  6964. listeners: {
  6965. click: 'scope.moveDown'
  6966. }
  6967. },
  6968. ]
  6969. },
  6970. columns: [
  6971. {
  6972. text: '字段名',
  6973. dataIndex: 'sumFieldBind',
  6974. width: 140,
  6975. sortable: false,
  6976. menuDisabled: true,
  6977. editor: {
  6978. selectOnFocus: true
  6979. },
  6980. },
  6981. {
  6982. text: '标题',
  6983. dataIndex: 'sumFieldLabel',
  6984. width: 120,
  6985. sortable: false,
  6986. menuDisabled: true,
  6987. editor: {
  6988. selectOnFocus: true
  6989. },
  6990. },
  6991. {
  6992. text: '权重',
  6993. dataIndex: 'sumFieldFlex',
  6994. align: 'right',
  6995. width: 60,
  6996. sortable: false,
  6997. menuDisabled: true,
  6998. editor: {
  6999. xtype: 'numberfield',
  7000. selectOnFocus: false,
  7001. allowBlank: true,
  7002. minValue: 0,
  7003. maxValue: 10
  7004. },
  7005. },
  7006. {
  7007. xtype: 'checkcolumn',
  7008. dataIndex: "sumFieldWrap", header: "换行",
  7009. sortable: false,
  7010. menuDisabled: true,
  7011. width: 65,
  7012. },
  7013. {
  7014. text: '扩展参数',
  7015. dataIndex: 'sumFieldExtend',
  7016. sortable: false,
  7017. menuDisabled: true,
  7018. editor: {
  7019. selectOnFocus: false
  7020. },
  7021. },
  7022. ]
  7023. },
  7024. {
  7025. region: 'center',
  7026. xtype: 'sqleditor',
  7027. layout: 'fit',
  7028. reference: 'sqlSumEditor',
  7029. },
  7030. ]
  7031. },
  7032. ]
  7033. }
  7034. ]
  7035. }
  7036. ]
  7037. }; //
  7038. //
  7039. //# sourceMappingURL=ReportDesign.view.js.map
  7040. var DbStore = /** @class */ (function (_super) {
  7041. __extends(DbStore, _super);
  7042. function DbStore() {
  7043. return _super !== null && _super.apply(this, arguments) || this;
  7044. }
  7045. DbStore.prototype.getCacheKey = function (param) {
  7046. return "db_data.json";
  7047. };
  7048. DbStore.prototype.invokeApi = function (param) {
  7049. return getMateData(param);
  7050. };
  7051. /**
  7052. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7053. */
  7054. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7055. return new Promise(function (resolve, reject) {
  7056. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7057. resolve(res1);
  7058. // TODO 好像不需要,先跳过
  7059. // reloadByTableName(schema_name, table_name).then(res2 => {
  7060. // resolve(res1)
  7061. // }).catch(e => {
  7062. // reject(e)
  7063. // })
  7064. }).catch(function (e) {
  7065. reject(e);
  7066. });
  7067. });
  7068. };
  7069. /**
  7070. * 保存元数据至表格
  7071. */
  7072. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7073. var _this = this;
  7074. return new Promise(function (resolve, reject) {
  7075. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7076. // 保存后重新刷新
  7077. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7078. resolve({
  7079. data: res2,
  7080. msg: res1.msg
  7081. });
  7082. }).catch(function (e) {
  7083. reject(e);
  7084. });
  7085. }).catch(function (e) {
  7086. reject(e);
  7087. });
  7088. });
  7089. };
  7090. /**
  7091. * 预览生成的 DDL 语句
  7092. */
  7093. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7094. return new Promise(function (resolve, reject) {
  7095. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7096. .then(function (res) {
  7097. resolve(res);
  7098. });
  7099. });
  7100. };
  7101. /**
  7102. * 执行 DDL
  7103. */
  7104. DbStore.prototype.pushToDbCommit = function (arg) {
  7105. return new Promise(function (resolve, reject) {
  7106. pushToDbCommitApi(arg).then(function (res) {
  7107. resolve(res);
  7108. }).catch(function (e) {
  7109. reject(e);
  7110. });
  7111. });
  7112. };
  7113. /**
  7114. * 重读某一个表格的 meta 元数据
  7115. */
  7116. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7117. var _this = this;
  7118. return new Promise(function (resolve, reject) {
  7119. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7120. if (!res[0] || !res[0].table_list[0]) {
  7121. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7122. return;
  7123. }
  7124. var tableRow = _this.getTableByName(schema_name, table_name);
  7125. if (!tableRow) {
  7126. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7127. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7128. if (!schemaRow) {
  7129. showErrorDialog$1('没有找到 schema:' + schema_name);
  7130. return;
  7131. }
  7132. schemaRow.table_list.push(res[0].table_list[0]);
  7133. }
  7134. else {
  7135. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7136. Object.assign(tableRow, res[0].table_list[0]);
  7137. }
  7138. // 所有界面通知一遍刷新
  7139. _this.notifyRefresh();
  7140. resolve(res);
  7141. }).catch(function (e) {
  7142. reject(e);
  7143. });
  7144. });
  7145. };
  7146. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7147. var result = undefined;
  7148. _$2.forEach(this.apiResponse, function (schemaRow) {
  7149. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7150. if (tableRow) {
  7151. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7152. if (columnRow) {
  7153. result = columnRow;
  7154. return false;
  7155. }
  7156. }
  7157. });
  7158. return result;
  7159. };
  7160. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7161. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7162. if (!schemaRow) {
  7163. showErrorDialog$1('没有找到 schema:' + schemaName);
  7164. return;
  7165. }
  7166. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7167. if (!schemaRow) {
  7168. showErrorDialog$1('没有找到 table:' + tableName);
  7169. return;
  7170. }
  7171. return tableRow;
  7172. };
  7173. /**
  7174. * 添加一个新表格
  7175. */
  7176. DbStore.prototype.appendNewTable = function (tableInfo) {
  7177. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7178. if (!schemaRow) {
  7179. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7180. return;
  7181. }
  7182. schemaRow.table_list.push(tableInfo);
  7183. };
  7184. /**
  7185. * 从数据库结构重新生成元数据
  7186. */
  7187. DbStore.prototype.dbToMetaAndReload = function () {
  7188. var _this = this;
  7189. this.notifyLoading(true);
  7190. dbToMeta().then(function () {
  7191. _this.reloadForce(undefined);
  7192. }).catch(function (e) {
  7193. _this.notifyLoading(false);
  7194. });
  7195. };
  7196. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7197. var dbType = undefined;
  7198. _$2.forEach(this.apiResponse, function (schemaRow) {
  7199. if (schemaRow.schema_name === schemaName) {
  7200. dbType = schemaRow.db_type;
  7201. return false;
  7202. }
  7203. });
  7204. return dbType;
  7205. };
  7206. return DbStore;
  7207. }(CacheStore));
  7208. function syncQueryDSL(_a) {
  7209. var schema_name = _a.schema_name, table_name = _a.table_name;
  7210. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7211. }
  7212. var instance$1 = new DbStore();
  7213. // // 字段域数据
  7214. // let columnDomain = undefined
  7215. // // 元数据
  7216. // let apiResponse = []
  7217. //
  7218. // // 订阅
  7219. // const subscribeList = []
  7220. // /**
  7221. // * 获取全部元数据
  7222. // */
  7223. // export function getApiResponse() {
  7224. // return apiResponse
  7225. // }
  7226. //
  7227. // export function getColumnDomain() {
  7228. // return columnDomain
  7229. // }
  7230. // window['getApiResponse'] = getApiResponse
  7231. // window['getColumnDomain'] = getColumnDomain
  7232. // window['getDbTreeStore'] = function () {
  7233. // return apiResponse
  7234. // }
  7235. //
  7236. // /**
  7237. // * 订阅结果集
  7238. // */
  7239. // export function subscribe(fn) {
  7240. // subscribeList.push(fn)
  7241. // }
  7242. //
  7243. // /**
  7244. // * 取消订阅
  7245. // */
  7246. // export function describe(fn) {
  7247. // _.remove(subscribeList, item => item === fn)
  7248. // }
  7249. //
  7250. // /**
  7251. // * 刷新,如果前端从来没有取到过结果的话
  7252. // * 如果强制刷新成功,就返回 true
  7253. // * 如果没有被强制刷新,返回 false
  7254. // */
  7255. // export function reloadIfNeed() {
  7256. // if (_.size(apiResponse) <= 0) {
  7257. // reloadForce()
  7258. // return true
  7259. // }
  7260. // return false
  7261. // }
  7262. //
  7263. // export function reloadIfNeedPromise() {
  7264. // return new Promise((resolve, reject) => {
  7265. // if (_.size(apiResponse) <= 0) {
  7266. // // 从未有获取过值
  7267. // reloadForce().then(res => {
  7268. // resolve(apiResponse)
  7269. // })
  7270. // return
  7271. // }
  7272. // resolve(apiResponse)
  7273. // return
  7274. // })
  7275. // }
  7276. //
  7277. // /**
  7278. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7279. // */
  7280. // export function reloadForce() {
  7281. // _.forEach(subscribeList, fn => {
  7282. // fn(true)
  7283. // })
  7284. //
  7285. // return getMateData().then((content) => {
  7286. // apiResponse = content
  7287. // _.forEach(subscribeList, fn => {
  7288. // fn(apiResponse)
  7289. // })
  7290. // }).finally(() => {
  7291. // _.forEach(subscribeList, fn => {
  7292. // fn(false)
  7293. // })
  7294. // })
  7295. // }
  7296. //
  7297. // /**
  7298. // * 通知刷新元数据
  7299. // */
  7300. // export function notifyRefresh() {
  7301. // _.forEach(subscribeList, fn => {
  7302. // fn(apiResponse)
  7303. // })
  7304. // }
  7305. // export function getAllDomain() {
  7306. // return new Promise((resolve, reject) => {
  7307. // getColumnDomainApi()
  7308. // .then(res => {
  7309. // if (res.success) {
  7310. // columnDomain = res.data
  7311. // resolve(res.data)
  7312. // } else {
  7313. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7314. // console.error('getColumnDomain', res.msg)
  7315. // }
  7316. //
  7317. // })
  7318. // .catch(e => {
  7319. // showErrorDialog('getColumnDomain error!')
  7320. // console.error('getColumnDomain', e)
  7321. // reject(e)
  7322. // })
  7323. // })
  7324. // }
  7325. //# sourceMappingURL=DbStore.js.map
  7326. var PROJECT_DICT_CACHE = {};
  7327. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7328. /**
  7329. *项目运行时构建
  7330. **/
  7331. function createRuntime() {
  7332. {
  7333. // 已经构建过了
  7334. return new Promise(function (resolve) {
  7335. resolve();
  7336. });
  7337. }
  7338. }
  7339. //# sourceMappingURL=ProjectRuntime.js.map
  7340. function ReportRunner(reportId, setLoadingFn) {
  7341. return new Promise(function (resolve) {
  7342. setLoadingFn(true);
  7343. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7344. // const {model, vjson, report} = buildVjson(res.data)
  7345. // const ret = new ReportScope({model, vjson})
  7346. // ret.report_id = reportId
  7347. // ret.report = report
  7348. // resolve(ret)
  7349. var _b = __read(_a, 1), res = _b[0];
  7350. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7351. resolve(ret);
  7352. }).finally(function () {
  7353. setLoadingFn(false);
  7354. });
  7355. });
  7356. }
  7357. //# sourceMappingURL=ReportRunner.js.map
  7358. //gridCondition
  7359. //gridColumn
  7360. //gridSum
  7361. //sqlSumEditor
  7362. //sqlEditor
  7363. var ReportDesign = /** @class */ (function (_super) {
  7364. __extends(ReportDesign, _super);
  7365. function ReportDesign() {
  7366. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7367. }
  7368. ReportDesign.prototype.onLoad = function () {
  7369. this.load();
  7370. };
  7371. ReportDesign.prototype.save = function (sender) {
  7372. var _this = this;
  7373. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7374. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7375. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7376. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7377. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7378. var report = this.viewModel.get('report');
  7379. var data = {
  7380. report_id: this.viewModel.get('report_id'),
  7381. report_name: this.viewModel.get('report_name'),
  7382. report_enable: this.viewModel.get('report_enable'),
  7383. query_sql: this.viewModel.get('querySql'),
  7384. summary_sql: this.viewModel.get('summarySql'),
  7385. report: json5.stringify(report, null, ' '),
  7386. };
  7387. sender.setLoading(true);
  7388. saveReportApi(data).then(function (res) {
  7389. if (res.success) {
  7390. msg$1('保存成功');
  7391. _this.dialogSuccess(data);
  7392. _this.load();
  7393. }
  7394. }).finally(function () {
  7395. sender.setLoading(false);
  7396. });
  7397. };
  7398. ReportDesign.prototype.preview = function (sender) {
  7399. var reportId = this.viewModel.get('report_id');
  7400. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7401. handles.mainWindow.showReportPreview(reportId, scope);
  7402. });
  7403. };
  7404. ReportDesign.prototype.load = function () {
  7405. var _this = this;
  7406. var reportId = this.viewModel.get('report_id');
  7407. this.setLoading(true);
  7408. reportByIdApi(reportId).then(function (res) {
  7409. 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;
  7410. if (report) {
  7411. report = json5.parse(report);
  7412. }
  7413. else {
  7414. report = {};
  7415. }
  7416. _this.viewModel.set('report_enable', report_enable);
  7417. _this.viewModel.set('report_name', report_name);
  7418. _this.viewModel.set('querySql', query_sql || '');
  7419. _this.viewModel.set('summarySql', summary_sql || '');
  7420. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7421. var query = _this.viewModel.get('report.query') || [];
  7422. var columns = _this.viewModel.get('report.columns') || [];
  7423. var summary = _this.viewModel.get('report.summary') || [];
  7424. var querySql = _this.viewModel.get('querySql');
  7425. var summarySql = _this.viewModel.get('summarySql');
  7426. _this.refs.gridCondition.setData(query);
  7427. _this.refs.gridColumn.setData(columns);
  7428. _this.refs.gridSum.setData(summary);
  7429. _this.refs.sqlEditor.setCode(querySql);
  7430. _this.refs.sqlSumEditor.setCode(summarySql);
  7431. }).finally(function () {
  7432. _this.setLoading(false);
  7433. });
  7434. };
  7435. ReportDesign.prototype.addCondition = function () {
  7436. this.refs.gridCondition.appendEditRow({
  7437. conditionFieldBind: '',
  7438. conditionFieldLabel: '',
  7439. conditionFieldXtype: 'textfield',
  7440. conditionFieldFlex: 1,
  7441. conditionFieldDict: '',
  7442. conditionFieldWrap: false,
  7443. conditionFieldExtend: '{}',
  7444. }, 'conditionFieldBind');
  7445. };
  7446. ReportDesign.prototype.removeCondition = function () {
  7447. var _this = this;
  7448. var rows = [];
  7449. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7450. rows.push(r);
  7451. });
  7452. _.forEach(rows, function (r) {
  7453. _this.refs.gridCondition.getStore().remove(r);
  7454. });
  7455. };
  7456. ReportDesign.prototype.moveUp = function (sender) {
  7457. var grid = sender.up('grid');
  7458. grid.rowMoveUp();
  7459. };
  7460. ReportDesign.prototype.moveDown = function (sender) {
  7461. var grid = sender.up('grid');
  7462. grid.rowMoveDown();
  7463. };
  7464. ReportDesign.prototype.calcCondition = function () {
  7465. var _this = this;
  7466. var sql = this.refs.sqlEditor.getCode();
  7467. var re = sql.matchAll(/#{(.+?)}/gi);
  7468. var rows = this.refs.gridCondition.getDataRows();
  7469. this.refs.gridCondition.setLoading(true);
  7470. Promise.all([
  7471. parseDynamicSqlApi(sql),
  7472. instance$1.reloadIfNeedPromise(),
  7473. ]).then(function (_a) {
  7474. var e_1, _b;
  7475. var _c = __read(_a, 1), res1 = _c[0];
  7476. if (res1.success) {
  7477. var tables_1 = [];
  7478. _.forEach(res1.data, function (parseItem) {
  7479. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7480. if (tableName && !_.includes(tables_1, tableName)) {
  7481. tables_1.push(tableName);
  7482. }
  7483. });
  7484. var _loop_1 = function (m) {
  7485. var e_2, _a;
  7486. var columnName = m[1];
  7487. // 没有这个列才添加
  7488. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7489. var meta = undefined;
  7490. try {
  7491. 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()) {
  7492. var tableName = tables_2_1.value;
  7493. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7494. if (meta) {
  7495. break;
  7496. }
  7497. }
  7498. }
  7499. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7500. finally {
  7501. try {
  7502. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7503. }
  7504. finally { if (e_2) throw e_2.error; }
  7505. }
  7506. if (meta) {
  7507. // 找到元数据
  7508. var r = {
  7509. conditionFieldBind: meta.column_name,
  7510. conditionFieldLabel: meta.column_comment,
  7511. conditionFieldXtype: 'textfield',
  7512. conditionFieldFlex: 1,
  7513. conditionFieldDict: '',
  7514. conditionFieldWrap: false,
  7515. conditionFieldExtend: '{}',
  7516. };
  7517. if (meta.column_ui === 'combo' && meta.column_dict) {
  7518. r.conditionFieldXtype = 'combo';
  7519. r.conditionFieldDict = meta.column_dict;
  7520. }
  7521. else if (meta.column_ui === "checkbox") {
  7522. r.conditionFieldXtype = 'checkbox';
  7523. }
  7524. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7525. r.conditionFieldXtype = 'numberfield';
  7526. }
  7527. _this.refs.gridCondition.appendEditRow(r);
  7528. }
  7529. else {
  7530. // 没找到元数据,直接添加
  7531. _this.refs.gridCondition.appendEditRow({
  7532. conditionFieldBind: columnName,
  7533. conditionFieldLabel: '',
  7534. conditionFieldXtype: 'textfield',
  7535. conditionFieldFlex: 1,
  7536. conditionFieldDict: '',
  7537. conditionFieldWrap: false,
  7538. conditionFieldExtend: '{}',
  7539. });
  7540. }
  7541. }
  7542. };
  7543. try {
  7544. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7545. var m = re_1_1.value;
  7546. _loop_1(m);
  7547. }
  7548. }
  7549. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7550. finally {
  7551. try {
  7552. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7553. }
  7554. finally { if (e_1) throw e_1.error; }
  7555. }
  7556. }
  7557. }).finally(function () {
  7558. _this.refs.gridCondition.setLoading(false);
  7559. });
  7560. };
  7561. ReportDesign.prototype.addColumn = function () {
  7562. this.refs.gridColumn.appendEditRow({
  7563. dataIndex: '',
  7564. header: '',
  7565. xtype: '',
  7566. dataType: '',
  7567. width: '',
  7568. dict: '',
  7569. align: '',
  7570. filterable: true,
  7571. hidden: false,
  7572. sortable: true,
  7573. fieldExtend: '{}',
  7574. }, 'header');
  7575. };
  7576. ReportDesign.prototype.removeColumn = function () {
  7577. var _this = this;
  7578. var rows = [];
  7579. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7580. rows.push(r);
  7581. });
  7582. _.forEach(rows, function (r) {
  7583. _this.refs.gridColumn.getStore().remove(r);
  7584. });
  7585. };
  7586. ReportDesign.prototype.calcColumn = function () {
  7587. var _this = this;
  7588. var sql = this.refs.sqlEditor.getCode();
  7589. this.refs.gridColumn.setLoading(true);
  7590. var rows = this.refs.gridColumn.getDataRows();
  7591. Promise.all([
  7592. parseDynamicSqlApi(sql),
  7593. instance$1.reloadIfNeedPromise(),
  7594. ]).then(function (_a) {
  7595. var _b = __read(_a, 1), res1 = _b[0];
  7596. if (res1.success) {
  7597. _.forEach(res1.data, function (parseItem) {
  7598. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7599. // 是否找到重复字段
  7600. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7601. if (exists) {
  7602. if ((columnTypeName || "").toLowerCase() === "number") {
  7603. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7604. if (record) {
  7605. record.set("dataType", "number");
  7606. record.set("align", "end");
  7607. }
  7608. }
  7609. return;
  7610. }
  7611. if (tableName) {
  7612. // 解出表格名和字段名
  7613. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7614. if (meta) {
  7615. // 找到了元数据
  7616. var r = {
  7617. dataIndex: meta.column_name,
  7618. header: meta.column_comment,
  7619. xtype: '',
  7620. dataType: '',
  7621. width: '',
  7622. dict: '',
  7623. align: '',
  7624. filterable: true,
  7625. hidden: false,
  7626. sortable: true,
  7627. fieldExtend: '{}',
  7628. };
  7629. if (meta.column_ui === 'combo' && meta.column_dict) {
  7630. r.dict = meta.column_dict;
  7631. }
  7632. else if (meta.column_ui === "checkbox") {
  7633. r.xtype = 'checkbox';
  7634. }
  7635. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7636. r.dataType = meta.data_type;
  7637. r.align = 'end';
  7638. }
  7639. if ((columnTypeName || "").toLowerCase() === "number") {
  7640. r.dataType = "number";
  7641. r.align = 'end';
  7642. }
  7643. _this.refs.gridColumn.appendEditRow(r);
  7644. return;
  7645. }
  7646. }
  7647. if (columnName) {
  7648. // 解出字段名
  7649. var r = {
  7650. dataIndex: columnName,
  7651. header: columnName,
  7652. xtype: '',
  7653. dataType: '',
  7654. width: '',
  7655. dict: '',
  7656. align: '',
  7657. filterable: true,
  7658. hidden: false,
  7659. sortable: true,
  7660. fieldExtend: '{}',
  7661. };
  7662. if ((columnTypeName || "").toLowerCase() === "number") {
  7663. r.dataType = "number";
  7664. r.align = 'end';
  7665. }
  7666. _this.refs.gridColumn.appendEditRow(r);
  7667. }
  7668. });
  7669. }
  7670. }).finally(function () {
  7671. _this.refs.gridColumn.setLoading(false);
  7672. });
  7673. };
  7674. ReportDesign.prototype.addSum = function () {
  7675. this.refs.gridSum.appendEditRow({
  7676. sumFieldBind: '',
  7677. sumFieldLabel: '',
  7678. sumFieldFlex: 1,
  7679. sumFieldWrap: false,
  7680. sumFieldExtend: '{}',
  7681. }, 'sumFieldBind');
  7682. };
  7683. ReportDesign.prototype.removeSum = function () {
  7684. var _this = this;
  7685. var rows = [];
  7686. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7687. rows.push(r);
  7688. });
  7689. _.forEach(rows, function (r) {
  7690. _this.refs.gridSum.getStore().remove(r);
  7691. });
  7692. };
  7693. ReportDesign.prototype.calcSum = function () {
  7694. var _this = this;
  7695. var sql = this.refs.sqlSumEditor.getCode();
  7696. var rows = this.refs.gridSum.getDataRows();
  7697. this.refs.gridSum.setLoading(true);
  7698. parseDynamicSqlApi(sql).then(function (res1) {
  7699. if (res1.success) {
  7700. _.forEach(res1.data, function (parseItem) {
  7701. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7702. // 是否找到重复字段
  7703. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7704. return;
  7705. }
  7706. if (columnName) {
  7707. // 解出字段名
  7708. _this.refs.gridSum.appendEditRow({
  7709. sumFieldBind: columnName,
  7710. sumFieldLabel: columnName,
  7711. sumFieldFlex: 1,
  7712. sumFieldWrap: false,
  7713. sumFieldExtend: '{}',
  7714. });
  7715. }
  7716. });
  7717. }
  7718. }).finally(function () {
  7719. _this.refs.gridSum.setLoading(false);
  7720. });
  7721. };
  7722. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7723. get: function () {
  7724. return this.viewModel.get('report_id');
  7725. },
  7726. enumerable: true,
  7727. configurable: true
  7728. });
  7729. return ReportDesign;
  7730. }(Scope));
  7731. //# sourceMappingURL=ReportDesign.js.map
  7732. var model$5 = {
  7733. data: {
  7734. originalTableInfo: {
  7735. table_name: '',
  7736. description: '',
  7737. },
  7738. hasChanged: false,
  7739. schema_name: undefined,
  7740. table_name: undefined,
  7741. column_name: undefined,
  7742. tableInfo: {
  7743. schema_name: '',
  7744. table_name: '',
  7745. description: '',
  7746. biz_category: '',
  7747. note: '',
  7748. archive_enable: false,
  7749. archive_cron: '',
  7750. archive_condition: '',
  7751. column_list: []
  7752. },
  7753. },
  7754. formulas: {
  7755. shouldSave: function (get) {
  7756. // console.log("-->", get('grid1.ischanged'))
  7757. return get('grid1.ischanged')
  7758. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7759. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7760. },
  7761. },
  7762. };
  7763. //# sourceMappingURL=DbColumn.model.js.map
  7764. var vjson$5 = {
  7765. bind: {
  7766. title: '{tableName}{shouldSave?" *":""}',
  7767. },
  7768. layout: 'fit',
  7769. items: [
  7770. {
  7771. layout: 'border',
  7772. tbar: {
  7773. xtype: 'toolbar',
  7774. items: [
  7775. // {
  7776. // xtype: 'button',
  7777. // text: '拉取库结构',
  7778. // iconCls: 'x-fa fa-cloud-download',
  7779. // listeners: {
  7780. // click: 'scope.pullFromDb'
  7781. // }
  7782. // },
  7783. {
  7784. xtype: 'button',
  7785. text: '保存至数据库',
  7786. iconCls: 'x-fa fa-save',
  7787. bind: {
  7788. disabled: '{!shouldSave}'
  7789. },
  7790. listeners: {
  7791. click: 'scope.pushToDb'
  7792. }
  7793. },
  7794. '-',
  7795. {
  7796. xtype: 'button',
  7797. text: '刷新 QueryDSL',
  7798. iconCls: 'x-fa fa-refresh',
  7799. listeners: {
  7800. click: 'scope.syncQueryDSL'
  7801. }
  7802. },
  7803. {
  7804. xtype: 'button',
  7805. text: '生成 DDL',
  7806. iconCls: 'x-fa fa-file-text',
  7807. listeners: {
  7808. click: 'scope.buildDDL'
  7809. }
  7810. }
  7811. ]
  7812. },
  7813. items: [
  7814. {
  7815. region: 'center',
  7816. xtype: 'tabpanel',
  7817. items: [
  7818. {
  7819. title: '字段',
  7820. xtype: 'yvgrid',
  7821. selModel: {
  7822. type: 'spreadsheet',
  7823. columnSelect: true,
  7824. pruneRemoved: false,
  7825. extensible: 'y'
  7826. },
  7827. enableLocking: false,
  7828. idField: 'column_name',
  7829. plugins: {
  7830. clipboard: true,
  7831. selectionreplicator: true
  7832. },
  7833. reference: 'grid1',
  7834. pagination: false,
  7835. // hideFootbar: true,
  7836. tbar: {
  7837. xtype: 'form',
  7838. items: [
  7839. {
  7840. xtype: 'cols',
  7841. items: [
  7842. {
  7843. xtype: 'textfield',
  7844. fieldLabel: '表格名',
  7845. reference: 'text_table_name',
  7846. readOnly: true,
  7847. bind: {
  7848. value: '{tableInfo.table_name}'
  7849. }
  7850. },
  7851. {
  7852. xtype: 'textfield',
  7853. fieldLabel: '描述',
  7854. // readOnly: true,
  7855. bind: {
  7856. value: '{tableInfo.description}'
  7857. }
  7858. },
  7859. ]
  7860. },
  7861. {
  7862. xtype: 'toolbar',
  7863. items: [
  7864. {
  7865. xtype: 'button',
  7866. text: '添加',
  7867. iconCls: 'x-fa fa-plus-circle',
  7868. listeners: {
  7869. click: 'scope.addField'
  7870. }
  7871. },
  7872. {
  7873. xtype: 'button',
  7874. text: '删除',
  7875. iconCls: 'x-fa fa-minus-circle',
  7876. listeners: {
  7877. click: 'scope.removeField'
  7878. }
  7879. },
  7880. ]
  7881. },
  7882. ]
  7883. },
  7884. listeners: {
  7885. editbefore: 'scope.gridEditBefore'
  7886. },
  7887. columns: [
  7888. {
  7889. text: '字段名', dataIndex: 'column_name',
  7890. sortable: false,
  7891. menuDisabled: true,
  7892. width: 120,
  7893. editor: {
  7894. allowBlank: true,
  7895. selectOnFocus: false
  7896. }
  7897. },
  7898. {
  7899. text: '字段中文', dataIndex: 'column_comment',
  7900. width: 130,
  7901. sortable: false,
  7902. menuDisabled: true,
  7903. editor: {
  7904. allowBlank: true,
  7905. selectOnFocus: false
  7906. }
  7907. },
  7908. {
  7909. text: '主键', dataIndex: 'is_primary_key',
  7910. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7911. width: 48, resizable: false,
  7912. },
  7913. {
  7914. text: '必填', dataIndex: 'not_null',
  7915. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7916. width: 48, resizable: false,
  7917. },
  7918. {
  7919. text: '字段域', dataIndex: 'column_domain',
  7920. sortable: false, menuDisabled: true,
  7921. width: 148,
  7922. dict: 'column_domain',
  7923. editor: {
  7924. xtype: 'combo',
  7925. allowBlank: true,
  7926. selectOnFocus: true,
  7927. // fix: ['system.getDict("column_domain")'],
  7928. dict: 'column_domain',
  7929. listConfig: {
  7930. minWidth: 200
  7931. },
  7932. listeners: {
  7933. change: 'scope.columnDomainChange',
  7934. }
  7935. }
  7936. },
  7937. {
  7938. text: '数据类型', dataIndex: 'data_type',
  7939. sortable: false, menuDisabled: true,
  7940. editor: { allowBlank: true, selectOnFocus: true }
  7941. },
  7942. {
  7943. text: '长度', dataIndex: 'column_size',
  7944. sortable: false, menuDisabled: true,
  7945. xtype: 'numbercolumn', format: '0',
  7946. editor: { allowBlank: true, selectOnFocus: true }
  7947. },
  7948. {
  7949. text: '小数位', dataIndex: 'decimal_digits',
  7950. sortable: false, menuDisabled: true,
  7951. xtype: 'numbercolumn', format: '0',
  7952. editor: { allowBlank: true, selectOnFocus: true }
  7953. },
  7954. {
  7955. text: '默认值', dataIndex: 'default_value',
  7956. sortable: false, menuDisabled: true,
  7957. editor: { allowBlank: true, selectOnFocus: true }
  7958. },
  7959. {
  7960. text: '字典', dataIndex: 'column_dict',
  7961. sortable: false, menuDisabled: true,
  7962. // fix: ['system.getDict("DICT")'],
  7963. width: 200,
  7964. editor: {
  7965. xtype: 'combo',
  7966. allowBlank: true,
  7967. listConfig: {
  7968. minWidth: 350
  7969. },
  7970. }
  7971. },
  7972. {
  7973. text: 'UI建议', dataIndex: 'column_ui',
  7974. sortable: false, menuDisabled: true,
  7975. // fix: ['system.getDict("column_ui")'],
  7976. editor: {
  7977. xtype: 'combo',
  7978. allowBlank: true,
  7979. listConfig: {
  7980. minWidth: 200
  7981. },
  7982. }
  7983. },
  7984. {
  7985. text: '详细描述', dataIndex: 'column_note',
  7986. sortable: false, menuDisabled: true,
  7987. editor: { allowBlank: true, }
  7988. },
  7989. ]
  7990. },
  7991. {
  7992. title: '高级属性',
  7993. xtype: 'form',
  7994. items: [
  7995. // {
  7996. // xtype: 'textfield',
  7997. // fieldLabel: '表格名',
  7998. // bind: {
  7999. // value: '{tableName}'
  8000. // }
  8001. // },
  8002. // {
  8003. // xtype: 'textfield',
  8004. // fieldLabel: '中文含义',
  8005. // bind: {
  8006. // value: '{tableInfo.description}'
  8007. // }
  8008. // },
  8009. {
  8010. xtype: 'combo',
  8011. fieldLabel: '业务类型',
  8012. bind: {
  8013. value: '{tableInfo.biz_category}'
  8014. },
  8015. store: [
  8016. '基础资料',
  8017. '系统',
  8018. '账目与库存',
  8019. '单据',
  8020. '指令',
  8021. '规则与流程',
  8022. '开发辅助',
  8023. ]
  8024. },
  8025. {
  8026. xtype: 'textfield',
  8027. fieldLabel: '详细描述',
  8028. bind: {
  8029. value: '{tableInfo.note}'
  8030. },
  8031. },
  8032. {
  8033. xtype: 'checkbox',
  8034. fieldLabel: '允许归档',
  8035. bind: "{tableInfo.archive_enable}",
  8036. },
  8037. {
  8038. xtype: 'textfield',
  8039. fieldLabel: '归档周期',
  8040. bind: {
  8041. value: '{tableInfo.archive_cron}',
  8042. hidden: '{!tableInfo.archive_enable}',
  8043. }
  8044. },
  8045. {
  8046. xtype: 'textfield',
  8047. fieldLabel: '归档条件',
  8048. bind: {
  8049. value: '{tableInfo.archive_condition}',
  8050. hidden: '{!tableInfo.archive_enable}',
  8051. }
  8052. },
  8053. ]
  8054. },
  8055. ]
  8056. }
  8057. ]
  8058. },
  8059. ]
  8060. };
  8061. //# sourceMappingURL=DbColumn.view.js.map
  8062. var DbColumn = /** @class */ (function (_super) {
  8063. __extends(DbColumn, _super);
  8064. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8065. var _this = _super.call(this, {
  8066. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8067. vjson: vjson$5
  8068. }) || this;
  8069. _this.isCreate = false;
  8070. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8071. return _this;
  8072. }
  8073. DbColumn.prototype.onLoad = function () {
  8074. var _this = this;
  8075. var _a, _b, _c, _d, _e, _f, _g, _h;
  8076. console.log('me', this);
  8077. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8078. this.refs.grid1.autoSizeColumns();
  8079. // this.refs.grid1.columns[0].hide()
  8080. // 自动定位到选定的列
  8081. if (this.viewModel.get('column_name')) {
  8082. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8083. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8084. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8085. return;
  8086. }
  8087. }
  8088. }
  8089. instance.getColumnDomainComboData().then(function () {
  8090. _this.checkDomain();
  8091. });
  8092. 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 : "");
  8093. 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 : "");
  8094. if (this.isCreate)
  8095. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8096. };
  8097. DbColumn.prototype.checkDomain = function () {
  8098. // 走查一遍 domain
  8099. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8100. var dbType = this.viewModel.get('tableInfo.db_type');
  8101. var diffColumnName = [];
  8102. var tableInfo = this.viewModel.get('tableInfo');
  8103. this.refs.grid1.store.data.items.forEach(function (record) {
  8104. var data = record.data;
  8105. var column_domain = data.column_domain;
  8106. var domain = instance.getColumnDomainById(column_domain);
  8107. if (!domain) {
  8108. // 没有找到 domain
  8109. return;
  8110. }
  8111. var editRow = applyDomain(dbType, domain);
  8112. // 字段跟领域做对比
  8113. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8114. if (typeof compareResult === 'string') {
  8115. // 不一样的情况下,要改成一致
  8116. _$2.forOwn(editRow, function (value, key) {
  8117. // 改成与 domain 一致
  8118. record.set(key, value);
  8119. });
  8120. diffColumnName.push(data.column_name + '.' + compareResult);
  8121. }
  8122. });
  8123. if (diffColumnName.length > 0) {
  8124. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8125. }
  8126. };
  8127. DbColumn.prototype.addField = function () {
  8128. this.refs.grid1.appendEditRow({
  8129. column_name: '',
  8130. column_comment: '',
  8131. is_primary_key: false,
  8132. not_null: true,
  8133. column_domain: '',
  8134. data_type: '',
  8135. column_size: 0,
  8136. decimal_digits: 0,
  8137. default_value: '',
  8138. column_dict: '',
  8139. column_ui: '',
  8140. column_note: '',
  8141. }, 'column_name');
  8142. };
  8143. DbColumn.prototype.removeField = function () {
  8144. var _this = this;
  8145. var rows = [];
  8146. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8147. rows.push(r);
  8148. });
  8149. _$2.forEach(rows, function (r) {
  8150. _this.refs.grid1.getStore().remove(r);
  8151. });
  8152. };
  8153. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8154. instance.getColumnDomainComboData().then(function (data) {
  8155. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8156. });
  8157. // 被字段域锁定的内容,不允许修改
  8158. var record = context.record, field = context.field;
  8159. var domainId = record.get('column_domain');
  8160. if (!domainId) {
  8161. return;
  8162. }
  8163. var domain = instance.getColumnDomainById(domainId);
  8164. if (!domain) {
  8165. msg$1('没有找到字段域' + domainId);
  8166. return;
  8167. }
  8168. if (field === "data_type") {
  8169. // 字段类型不允许修改
  8170. context.cancel = true;
  8171. return;
  8172. }
  8173. if (domain.is_fix_size &&
  8174. (field === "column_size" ||
  8175. field === "decimal_digits")) {
  8176. // 锁定长度的情况下,大小不允许修改
  8177. context.cancel = true;
  8178. return;
  8179. }
  8180. if (domain.is_fix_default_value && field === "default_value") {
  8181. // 锁定默认值的情况下,默认值不允许修改
  8182. context.cancel = true;
  8183. return;
  8184. }
  8185. };
  8186. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8187. if (!newValue) {
  8188. return;
  8189. }
  8190. var grid = editor.up('grid').ownerGrid;
  8191. var domain = instance.getColumnDomainById(newValue);
  8192. if (!domain) {
  8193. msg$1('没有找到 domain:' + newValue);
  8194. return;
  8195. }
  8196. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8197. var dbType = this.viewModel.get('tableInfo.db_type');
  8198. var editRow = applyDomain(dbType, domain);
  8199. grid.setEditRow(editRow);
  8200. };
  8201. DbColumn.prototype.pullFromDb = function () {
  8202. };
  8203. DbColumn.prototype.pushToDb = function (sender) {
  8204. var _this = this;
  8205. // 设置当前界面为 "保存中..." 状态
  8206. var me = this;
  8207. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8208. this.viewModel.set('tableInfo.table_name', table_name);
  8209. this.viewModel.set('tableInfo.schema_name', schema_name);
  8210. var tableInfo = this.viewModel.get('tableInfo');
  8211. var column_list = this.refs.grid1.getDataRows();
  8212. var hasError = false;
  8213. if (column_list.length <= 0) {
  8214. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8215. hasError = true;
  8216. }
  8217. var columnNameExistsCheck = {};
  8218. _$2.forEach(column_list, function (row, i) {
  8219. var checkResult = checkColumn(tableInfo, row);
  8220. if (typeof checkResult !== 'undefined') {
  8221. msg$1(checkResult);
  8222. hasError = true;
  8223. _this.refs.grid1.beginEdit(i, 'column_name');
  8224. return false;
  8225. }
  8226. if (!row.column_domain || row.column_domain === '0') {
  8227. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8228. hasError = true;
  8229. _this.refs.grid1.beginEdit(i, 'column_domain');
  8230. return false;
  8231. }
  8232. if (isEmpty(row.data_type)) {
  8233. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8234. hasError = true;
  8235. _this.refs.grid1.beginEdit(i, 'data_type');
  8236. return false;
  8237. }
  8238. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8239. // 列名已存在
  8240. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8241. hasError = true;
  8242. _this.refs.grid1.beginEdit(i, 'column_name');
  8243. return false;
  8244. }
  8245. columnNameExistsCheck[row.column_name] = true;
  8246. });
  8247. if (hasError)
  8248. return;
  8249. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8250. me.setLoading(true);
  8251. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8252. .then(function (res) {
  8253. var _a;
  8254. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8255. // 返回 DDL 就要显示出来
  8256. var window_1 = Ext.create('Ext.window.Window', {
  8257. title: 'SQL 预览',
  8258. height: 400,
  8259. width: 600,
  8260. modal: true,
  8261. animateTarget: sender,
  8262. maximizable: true,
  8263. layout: 'fit',
  8264. items: {
  8265. xtype: 'sqleditor',
  8266. value: res.data.ddl
  8267. },
  8268. buttons: [
  8269. {
  8270. xtype: 'button',
  8271. text: '执行',
  8272. iconCls: 'x-fa fa-save',
  8273. handler: function (sender) {
  8274. var editor = sender.up('window').down('sqleditor');
  8275. var ddl = editor.getValue();
  8276. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8277. }
  8278. },
  8279. {
  8280. xtype: 'button',
  8281. text: '取消',
  8282. iconCls: 'x-fa fa-times',
  8283. handler: function () {
  8284. window_1.close();
  8285. }
  8286. }
  8287. ]
  8288. }).show();
  8289. return;
  8290. }
  8291. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8292. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8293. if (!tableRow) {
  8294. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8295. console.log('这是一个新 table');
  8296. instance$1.appendNewTable(tableInfo);
  8297. }
  8298. _this.viewModel.set('schema_name', schema_name);
  8299. _this.viewModel.set('table_name', table_name);
  8300. _this.viewModel.set('tableInfo', tableInfo);
  8301. _this.refs.grid1.setData(tableInfo.column_list);
  8302. if (tableRow)
  8303. Object.assign(tableRow, tableInfo);
  8304. msg$1('保存成功');
  8305. _this.viewModel.set('hasChanged', false);
  8306. })
  8307. .finally(function () {
  8308. me.setLoading(false);
  8309. });
  8310. };
  8311. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8312. var _this = this;
  8313. window.setLoading(true);
  8314. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8315. .then(function (res) {
  8316. var _a, _b, _c, _d;
  8317. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8318. // 保存成功就提示一下,并重新载入数据
  8319. msg$1(res.msg);
  8320. instance$1.reloadForce(undefined);
  8321. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8322. if (!tableRow) {
  8323. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8324. console.log('这是一个新 table');
  8325. instance$1.appendNewTable(tableInfo);
  8326. }
  8327. _this.viewModel.set('schema_name', schema_name);
  8328. _this.viewModel.set('table_name', table_name);
  8329. _this.viewModel.set('tableInfo', tableInfo);
  8330. _this.refs.grid1.setData(tableInfo.column_list);
  8331. if (tableRow)
  8332. Object.assign(tableRow, tableInfo);
  8333. instance$1.notifyRefresh();
  8334. window.close();
  8335. _this.viewModel.set('hasChanged', false);
  8336. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8337. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8338. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8339. })
  8340. .finally(function () {
  8341. // 无论正常异常,关闭 "保存中..." 状态
  8342. window.setLoading(false);
  8343. });
  8344. };
  8345. DbColumn.prototype.syncQueryDSL = function () {
  8346. var _this = this;
  8347. var tableInfo = this.viewModel.get("tableInfo");
  8348. this.setLoading(true);
  8349. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8350. .then(function () {
  8351. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8352. })
  8353. .finally(function () {
  8354. _this.setLoading(false);
  8355. });
  8356. };
  8357. DbColumn.prototype.buildDDL = function () {
  8358. };
  8359. return DbColumn;
  8360. }(Scope));
  8361. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8362. model.data.schema_name = schemaName;
  8363. model.data.table_name = tableName;
  8364. model.data.column_name = columnName;
  8365. if (isCreateTable) {
  8366. var dbType = instance$1.getSchemaDbType(schemaName);
  8367. if (!dbType) {
  8368. throw Error('无法识别数据库类型' + schemaName);
  8369. }
  8370. model.data.tableInfo.schema_name = model.data.schema_name;
  8371. model.data.tableInfo.table_name = model.data.table_name;
  8372. model.data.tableInfo.db_type = dbType;
  8373. model.data.tableInfo.column_list = [];
  8374. model.data.tableInfo.is_create = true;
  8375. return model;
  8376. }
  8377. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8378. if (!tableRow) {
  8379. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8380. }
  8381. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8382. model.data.tableInfo.is_create = false;
  8383. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8384. return model;
  8385. }
  8386. //# sourceMappingURL=DbColumn.js.map
  8387. var model$6 = {
  8388. data: {
  8389. id: '',
  8390. path: '',
  8391. form: {
  8392. title: '',
  8393. sqlId: '',
  8394. }
  8395. }
  8396. };
  8397. //# sourceMappingURL=WidgetDesign.model.js.map
  8398. var vjson$6 = {
  8399. bind: {
  8400. title: '{title}',
  8401. },
  8402. layout: 'fit',
  8403. items: [
  8404. {
  8405. layout: 'border',
  8406. items: [
  8407. {
  8408. region: 'center',
  8409. layout: 'border',
  8410. items: [
  8411. {
  8412. region: 'north',
  8413. items: [
  8414. {
  8415. xtype: 'toolbar',
  8416. border: false,
  8417. items: [
  8418. {
  8419. xtype: 'button',
  8420. text: '刷新',
  8421. iconCls: 'x-fa fa-refresh',
  8422. listeners: {
  8423. click: 'scope.load'
  8424. }
  8425. },
  8426. {
  8427. xtype: 'button',
  8428. text: '保存',
  8429. iconCls: 'x-fa fa-save',
  8430. listeners: {
  8431. click: 'scope.widgetSave'
  8432. }
  8433. },
  8434. {
  8435. xtype: 'button',
  8436. text: '预览',
  8437. iconCls: 'x-fa fa-play-circle-o',
  8438. listeners: {
  8439. //click: 'scope.preview'
  8440. }
  8441. },
  8442. {
  8443. xtype: 'textfield',
  8444. fieldLabel: '弹窗文件',
  8445. reference: "wPath",
  8446. labelWidth: 80,
  8447. //width: 200,
  8448. bind: {
  8449. value: '{widgetPath}',
  8450. },
  8451. readOnly: true,
  8452. },
  8453. {
  8454. xtype: 'textfield',
  8455. fieldLabel: '弹窗名称',
  8456. reference: "wTitle",
  8457. labelWidth: 80,
  8458. //width: 200,
  8459. bind: {
  8460. value: '{form.title}',
  8461. },
  8462. readOnly: true,
  8463. },
  8464. {
  8465. xtype: 'textfield',
  8466. fieldLabel: 'sqlId',
  8467. bind: {
  8468. value: '{form.sqlId}',
  8469. },
  8470. readOnly: true,
  8471. },
  8472. ]
  8473. },
  8474. ]
  8475. },
  8476. {
  8477. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8478. items: [
  8479. {
  8480. title: "SQL和条件",
  8481. layout: 'border',
  8482. border: false,
  8483. items: [
  8484. {
  8485. region: 'north',
  8486. height: 200,
  8487. xtype: 'yvgrid',
  8488. reference: "grid2",
  8489. split: true,
  8490. selModel: {
  8491. selType: 'rowmodel',
  8492. mode: 'SINGLE',
  8493. },
  8494. store: {},
  8495. pagination: false,
  8496. hideFootbar: true,
  8497. tbar: {
  8498. xtype: 'toolbar',
  8499. items: [
  8500. {
  8501. xtype: 'button',
  8502. text: '添加',
  8503. iconCls: 'x-fa fa-plus-circle',
  8504. listeners: {}
  8505. },
  8506. {
  8507. xtype: 'button',
  8508. text: '删除',
  8509. iconCls: 'x-fa fa-minus-circle',
  8510. listeners: {
  8511. click: 'scope.delCondition'
  8512. }
  8513. },
  8514. '-',
  8515. {
  8516. xtype: 'button',
  8517. text: '上移',
  8518. iconCls: 'x-fa fa-refresh',
  8519. listeners: {
  8520. //click: 'scope.saveAll'
  8521. }
  8522. },
  8523. {
  8524. xtype: 'button',
  8525. text: '下移',
  8526. iconCls: 'x-fa fa-refresh',
  8527. listeners: {
  8528. //click: 'scope.saveAll'
  8529. }
  8530. },
  8531. '-',
  8532. {
  8533. xtype: 'button',
  8534. text: '自动分析',
  8535. iconCls: 'x-fa fa-refresh',
  8536. listeners: {
  8537. click: 'scope.calcCondition'
  8538. }
  8539. },
  8540. ]
  8541. },
  8542. columns: [
  8543. {
  8544. text: '条件变量',
  8545. dataIndex: 'conditionFieldBind',
  8546. width: 140,
  8547. sortable: false,
  8548. menuDisabled: true,
  8549. editor: {
  8550. selectOnFocus: true
  8551. },
  8552. },
  8553. {
  8554. text: '中文标题',
  8555. dataIndex: 'conditionFieldLabel',
  8556. width: 120,
  8557. sortable: false,
  8558. menuDisabled: true,
  8559. editor: {
  8560. selectOnFocus: true
  8561. },
  8562. },
  8563. {
  8564. text: '编辑类型',
  8565. dataIndex: 'xtype',
  8566. sortable: false,
  8567. menuDisabled: true,
  8568. editor: {
  8569. xtype: 'combo',
  8570. typeAhead: true,
  8571. triggerAction: 'all',
  8572. selectOnFocus: true,
  8573. store: [
  8574. ['textfield', 'textfield'],
  8575. ['combo', 'combo'],
  8576. ['datefield', 'datefield'],
  8577. ['datetimefield', 'datetimefield'],
  8578. ['numberfield', 'numberfield'],
  8579. ['multiplesearch', 'multiplesearch'],
  8580. ]
  8581. }
  8582. },
  8583. {
  8584. text: '权重',
  8585. dataIndex: 'conditionFieldFlex',
  8586. align: 'right',
  8587. sortable: false,
  8588. menuDisabled: true,
  8589. editor: {
  8590. xtype: 'numberfield',
  8591. selectOnFocus: false,
  8592. minValue: 0,
  8593. maxValue: 10
  8594. },
  8595. },
  8596. {
  8597. text: '字典',
  8598. dataIndex: 'conditionFieldDict',
  8599. width: 160,
  8600. sortable: false,
  8601. menuDisabled: true,
  8602. editor: {
  8603. selectOnFocus: false
  8604. },
  8605. },
  8606. {
  8607. xtype: 'checkcolumn',
  8608. dataIndex: "conditionFieldWrap", header: "换行",
  8609. width: 65,
  8610. sortable: false,
  8611. menuDisabled: true,
  8612. },
  8613. ]
  8614. },
  8615. {
  8616. region: 'center',
  8617. xtype: 'sqleditor',
  8618. layout: 'fit',
  8619. reference: 'sqlEditor',
  8620. split: true,
  8621. bind: {
  8622. value: "{form.sql}"
  8623. },
  8624. },
  8625. ]
  8626. },
  8627. {
  8628. title: "结果字段定义",
  8629. border: false,
  8630. xtype: 'yvgrid',
  8631. reference: "grid3",
  8632. selModel: {
  8633. selType: 'rowmodel',
  8634. mode: 'SINGLE',
  8635. },
  8636. store: {},
  8637. pagination: false,
  8638. hideFootbar: true,
  8639. tbar: {
  8640. xtype: 'toolbar',
  8641. items: [
  8642. {
  8643. xtype: 'button',
  8644. text: '添加',
  8645. iconCls: 'x-fa fa-plus-circle',
  8646. listeners: {}
  8647. },
  8648. {
  8649. xtype: 'button',
  8650. text: '删除',
  8651. iconCls: 'x-fa fa-minus-circle',
  8652. listeners: {
  8653. click: 'scope.delColumn'
  8654. }
  8655. },
  8656. '-',
  8657. {
  8658. xtype: 'button',
  8659. text: '上移',
  8660. iconCls: 'x-fa fa-refresh',
  8661. listeners: {
  8662. //click: 'scope.saveAll'
  8663. }
  8664. },
  8665. {
  8666. xtype: 'button',
  8667. text: '下移',
  8668. iconCls: 'x-fa fa-refresh',
  8669. listeners: {
  8670. //click: 'scope.saveAll'
  8671. }
  8672. },
  8673. '-',
  8674. {
  8675. xtype: 'button',
  8676. text: '自动分析',
  8677. iconCls: 'x-fa fa-refresh',
  8678. listeners: {
  8679. click: 'scope.calcColumn'
  8680. }
  8681. },
  8682. ]
  8683. },
  8684. columns: [
  8685. { xtype: 'rownumberer' },
  8686. {
  8687. text: '字段',
  8688. dataIndex: 'dataIndex',
  8689. width: 140,
  8690. sortable: false,
  8691. menuDisabled: true,
  8692. editor: {
  8693. selectOnFocus: true
  8694. },
  8695. },
  8696. {
  8697. text: '标题',
  8698. dataIndex: 'header',
  8699. width: 120,
  8700. sortable: false,
  8701. menuDisabled: true,
  8702. editor: {
  8703. selectOnFocus: true
  8704. },
  8705. },
  8706. {
  8707. text: '显示类型',
  8708. dataIndex: 'xtype',
  8709. width: 90,
  8710. sortable: false,
  8711. menuDisabled: true,
  8712. editor: {
  8713. xtype: 'combo',
  8714. typeAhead: true,
  8715. triggerAction: 'all',
  8716. selectOnFocus: true,
  8717. store: [
  8718. ['', ''],
  8719. ['rownum', 'rownum'],
  8720. ['button', 'button'],
  8721. ['checkbox', 'checkbox'],
  8722. ['progres', 'progres'],
  8723. ]
  8724. }
  8725. },
  8726. {
  8727. text: '数据类型',
  8728. dataIndex: 'dataType',
  8729. width: 90,
  8730. sortable: false,
  8731. menuDisabled: true,
  8732. editor: {
  8733. xtype: 'combo',
  8734. typeAhead: true,
  8735. triggerAction: 'all',
  8736. selectOnFocus: true,
  8737. store: [
  8738. ['', ''],
  8739. ['string', 'string'],
  8740. ['number', 'number'],
  8741. ['date', 'date'],
  8742. ]
  8743. }
  8744. },
  8745. {
  8746. text: '数据字典',
  8747. dataIndex: 'dict',
  8748. sortable: false,
  8749. menuDisabled: true,
  8750. width: 120,
  8751. editor: {
  8752. selectOnFocus: true,
  8753. },
  8754. },
  8755. ],
  8756. },
  8757. ]
  8758. },
  8759. ]
  8760. },
  8761. ]
  8762. }
  8763. ]
  8764. }; //
  8765. //
  8766. //# sourceMappingURL=WidgetDesign.view.js.map
  8767. var WidgetDesign = /** @class */ (function (_super) {
  8768. __extends(WidgetDesign, _super);
  8769. function WidgetDesign(widgetPath, widgetName) {
  8770. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8771. _this.widgetPath = widgetPath;
  8772. _this.widgetName = widgetName;
  8773. return _this;
  8774. }
  8775. WidgetDesign.prototype.onLoad = function () {
  8776. if (this.widgetPath) {
  8777. this.loadForm(this.widgetPath);
  8778. this.viewModel.set("widgetPath", this.widgetPath);
  8779. this.refs.wTitle.setReadOnly(true);
  8780. this.refs.wPath.setReadOnly(true);
  8781. }
  8782. else {
  8783. this.refs.wTitle.setReadOnly(false);
  8784. this.refs.wPath.setReadOnly(false);
  8785. }
  8786. };
  8787. WidgetDesign.prototype.load = function () {
  8788. var widgetPath = this.viewModel.get("widgetPath");
  8789. if (widgetPath) {
  8790. this.loadForm(widgetPath);
  8791. }
  8792. };
  8793. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8794. var _this = this;
  8795. var me = this;
  8796. me.setLoading(true);
  8797. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8798. msg$1(res.msg);
  8799. if (res.success) {
  8800. _this.viewModel.set("widgetPath", widgetPath);
  8801. me.refs.grid3.getStore().removeAll();
  8802. if (res.data.form.columns) {
  8803. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8804. }
  8805. _this.viewModel.set("form.title", res.data.form.title);
  8806. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8807. // set sql
  8808. _this.refs.sqlEditor.setCode(res.data.sql);
  8809. }
  8810. }).finally(function () {
  8811. me.setLoading(false);
  8812. });
  8813. };
  8814. WidgetDesign.prototype.widgetAdd = function (sender) {
  8815. var _this = this;
  8816. var title = this.viewModel.get("form.title");
  8817. if (title) {
  8818. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8819. if (btn == 'yes') {
  8820. alert(1);
  8821. }
  8822. else {
  8823. alert(2);
  8824. }
  8825. });
  8826. }
  8827. else {
  8828. var me_1 = this;
  8829. var win_1 = new Ext.Window({
  8830. autoDestroy: true,
  8831. title: "新建弹框",
  8832. width: 400,
  8833. height: 220,
  8834. resizable: true,
  8835. closable: true,
  8836. maximizable: true,
  8837. minimizable: true,
  8838. plain: true,
  8839. // constrainHeader: true,
  8840. constrain: true,
  8841. layout: 'fit',
  8842. animateTarget: sender,
  8843. buttonAlign: 'center',
  8844. items: [
  8845. {
  8846. xtype: "form",
  8847. layout: "hbox",
  8848. margin: '10px 20px',
  8849. border: 0,
  8850. items: [
  8851. {
  8852. flex: 1,
  8853. layout: 'vbox',
  8854. items: [
  8855. {
  8856. xtype: "textfield",
  8857. name: "widgetcode",
  8858. fieldLabel: "弹框编号",
  8859. flex: 1,
  8860. allowBlank: false,
  8861. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8862. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8863. labelWidth: 50,
  8864. width: "100%",
  8865. },
  8866. {
  8867. xtype: "textfield",
  8868. name: "widgetname",
  8869. fieldLabel: "弹框名称",
  8870. flex: 1,
  8871. allowBlank: false,
  8872. labelWidth: 50,
  8873. width: "100%",
  8874. },
  8875. ]
  8876. },
  8877. ]
  8878. }
  8879. ],
  8880. //窗口按钮
  8881. buttons: [
  8882. {
  8883. xtype: 'button', text: '保存', handler: function (btn) {
  8884. //窗口获取表单
  8885. var form = win_1.down('form');
  8886. var vaildSuccess = form.isValid();
  8887. if (!vaildSuccess) {
  8888. return;
  8889. }
  8890. var title = form.down('textfield[name="widgetname"]').getValue();
  8891. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8892. me_1.viewModel.set("form.title", title);
  8893. me_1.viewModel.set("widgetPath", widgetPath);
  8894. var formdata = _this.viewModel.get("form");
  8895. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8896. if (res.success) {
  8897. msg$1('添加成功');
  8898. }
  8899. me_1.loadForm(widgetPath);
  8900. win_1.close();
  8901. });
  8902. }
  8903. },
  8904. {
  8905. xtype: 'button', text: '取消', handler: function (btn) {
  8906. //窗口关闭
  8907. win_1.close();
  8908. }
  8909. }
  8910. ]
  8911. });
  8912. win_1.show();
  8913. }
  8914. };
  8915. WidgetDesign.prototype.widgetSave = function () {
  8916. var _this = this;
  8917. var _a, _b;
  8918. var widgetPath = this.viewModel.get("widgetPath");
  8919. if (!widgetPath) {
  8920. msg$1("请选择或添加弹框后再保存!");
  8921. return;
  8922. }
  8923. var title = this.viewModel.get("form.title");
  8924. if (!title) {
  8925. msg$1("请选择或添加弹框后再保存!");
  8926. return;
  8927. }
  8928. // 获取条件
  8929. 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) {
  8930. delete r.id;
  8931. return r;
  8932. });
  8933. this.viewModel.set("form.conditions", conditions);
  8934. // 获取查询列
  8935. 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) {
  8936. delete r.id;
  8937. if (r.dict) {
  8938. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8939. }
  8940. return r;
  8941. });
  8942. this.viewModel.set("form.columns", columns);
  8943. // sql
  8944. var sql = this.refs.sqlEditor.getCode();
  8945. this.viewModel.set("form.sql", sql);
  8946. var form = this.viewModel.get("form");
  8947. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8948. msg$1(res.msg);
  8949. if (res.success) {
  8950. msg$1('保存成功');
  8951. _this.loadForm(widgetPath);
  8952. }
  8953. }).catch(function (res) {
  8954. });
  8955. };
  8956. WidgetDesign.prototype.delCondition = function () {
  8957. var _a;
  8958. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8959. };
  8960. WidgetDesign.prototype.delColumn = function () {
  8961. var _a;
  8962. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8963. };
  8964. WidgetDesign.prototype.calcCondition = function () {
  8965. var _this = this;
  8966. var sql = this.refs.sqlEditor.getCode();
  8967. var re = sql.matchAll(/#{(.+?)}/gi);
  8968. var rows = this.refs.grid2.getDataRows();
  8969. this.refs.grid2.setLoading(true);
  8970. parseDynamicSqlApi(sql).then(function (res) {
  8971. var e_1, _a;
  8972. if (res.success) {
  8973. var tables_1 = [];
  8974. _.forEach(res.data, function (parseItem) {
  8975. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8976. if (tableName && !_.includes(tables_1, tableName)) {
  8977. tables_1.push(tableName);
  8978. }
  8979. });
  8980. var _loop_1 = function (m) {
  8981. var e_2, _a;
  8982. var columnName = m[1];
  8983. // 没有这个列才添加
  8984. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8985. var meta = undefined;
  8986. try {
  8987. 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()) {
  8988. var tableName = tables_2_1.value;
  8989. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8990. if (meta) {
  8991. break;
  8992. }
  8993. }
  8994. }
  8995. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8996. finally {
  8997. try {
  8998. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8999. }
  9000. finally { if (e_2) throw e_2.error; }
  9001. }
  9002. if (meta) {
  9003. // 没找到元数据,直接添加
  9004. _this.refs.grid2.appendEditRow({
  9005. conditionFieldBind: columnName,
  9006. conditionFieldLabel: meta.column_comment,
  9007. conditionFieldXtype: 'textfield',
  9008. conditionFieldFlex: 1,
  9009. conditionFieldDict: '',
  9010. conditionFieldWrap: false,
  9011. });
  9012. }
  9013. else {
  9014. _this.refs.grid2.appendEditRow({
  9015. conditionFieldBind: columnName,
  9016. conditionFieldLabel: '',
  9017. conditionFieldXtype: 'textfield',
  9018. conditionFieldFlex: 1,
  9019. conditionFieldDict: '',
  9020. conditionFieldWrap: false,
  9021. });
  9022. }
  9023. }
  9024. };
  9025. try {
  9026. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  9027. var m = re_1_1.value;
  9028. _loop_1(m);
  9029. }
  9030. }
  9031. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  9032. finally {
  9033. try {
  9034. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  9035. }
  9036. finally { if (e_1) throw e_1.error; }
  9037. }
  9038. }
  9039. }).finally(function () {
  9040. _this.refs.grid2.setLoading(false);
  9041. });
  9042. };
  9043. WidgetDesign.prototype.calcColumn = function () {
  9044. var _this = this;
  9045. var sql = this.refs.sqlEditor.getCode();
  9046. var rows = this.refs.grid3.getDataRows();
  9047. this.refs.grid3.setLoading(true);
  9048. parseDynamicSqlApi(sql).then(function (res) {
  9049. _.forEach(res.data, function (parseItem) {
  9050. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9051. // 是否找到重复字段
  9052. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9053. if (exists) {
  9054. return;
  9055. }
  9056. if (tableName) {
  9057. // 解出表格名和字段名
  9058. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9059. if (meta) {
  9060. // 找到了元数据
  9061. var r = {
  9062. dataIndex: meta.column_name,
  9063. header: meta.column_comment,
  9064. xtype: '',
  9065. dataType: 'string',
  9066. dict: '',
  9067. };
  9068. if (meta.column_ui === 'combo' && meta.column_dict) {
  9069. r.dict = meta.column_dict;
  9070. }
  9071. else if (meta.column_ui === "checkbox") {
  9072. r.xtype = 'checkbox';
  9073. }
  9074. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9075. r.dataType = meta.data_type;
  9076. }
  9077. _this.refs.grid3.appendEditRow(r);
  9078. return;
  9079. }
  9080. }
  9081. if (columnName) {
  9082. // 解出字段名
  9083. var r = {
  9084. dataIndex: columnName,
  9085. header: columnName,
  9086. xtype: '',
  9087. dataType: 'string',
  9088. dict: '',
  9089. };
  9090. _this.refs.grid3.appendEditRow(r);
  9091. }
  9092. });
  9093. }).finally(function () {
  9094. _this.refs.grid3.setLoading(false);
  9095. });
  9096. };
  9097. return WidgetDesign;
  9098. }(Scope));
  9099. //# sourceMappingURL=WidgetDesign.js.map
  9100. var model$7 = {
  9101. data: {
  9102. // spreadsheet: false,
  9103. // multSelect: false,
  9104. // showCheckColumn: false,
  9105. // checkColumncheckOnly: false,
  9106. // disableSelection: false,
  9107. vjson: {
  9108. reference: '',
  9109. pagination: false,
  9110. pageSize: false,
  9111. pageSizeOption: false,
  9112. hideFootbar: false,
  9113. hideRefresh: false,
  9114. hideExport: false,
  9115. hideAutoSize: false,
  9116. hideClearFilter: false,
  9117. hideSaveGridUIConfig: false,
  9118. hideClearGridUIConfig: false,
  9119. selectMode: '',
  9120. cellediting_clicksToEdit: 1,
  9121. columnLines: false,
  9122. rowLines: false,
  9123. border: false,
  9124. autoLoad: false,
  9125. remoteSort: false,
  9126. remoteFilter: false,
  9127. enableLocking: false,
  9128. enableColumnHide: false,
  9129. enableColumnMove: false,
  9130. gridfilters: false,
  9131. enableColumnResize: false,
  9132. sortOnClick: false,
  9133. hidden: false,
  9134. cls: '',
  9135. dataSource: {
  9136. url: '',
  9137. params: {
  9138. formData: '{form}',
  9139. },
  9140. },
  9141. listeners: {
  9142. beforeselect: '',
  9143. selectionchange: '',
  9144. itemclick: '',
  9145. itemdblclick: '',
  9146. cellClick: '',
  9147. celldblclick: '',
  9148. afterrender: '',
  9149. destory: '',
  9150. }
  9151. },
  9152. }
  9153. };
  9154. //# sourceMappingURL=YvgridDesign.model.js.map
  9155. var vjson$7 = {
  9156. title: '表格-高级',
  9157. height: 450,
  9158. width: 970,
  9159. layout: 'fit',
  9160. modal: true,
  9161. items: [
  9162. {
  9163. xtype: 'tabpanel',
  9164. items: [
  9165. {
  9166. title: '属性',
  9167. xtype: 'form',
  9168. scrollable: true,
  9169. items: [
  9170. {
  9171. xtype: 'cols',
  9172. items: [
  9173. {
  9174. xtype: 'textfield',
  9175. fieldLabel: '引用名',
  9176. tooltip: 'reference',
  9177. bind: '{vjson.reference}',
  9178. },
  9179. ]
  9180. },
  9181. {
  9182. xtype: 'cols',
  9183. border: false,
  9184. items: [
  9185. // 允许分页、页大小、页大小选项
  9186. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9187. // 多选、显示勾选、自动勾选、
  9188. // 单击编辑、列分割线、行分割线、边框
  9189. // 数据源自动加载、后端排序、后端过滤
  9190. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9191. {
  9192. xtype: 'checkbox',
  9193. fieldLabel: '允许分页',
  9194. bind: {
  9195. value: "{vjson.pagination}"
  9196. }
  9197. },
  9198. {
  9199. xtype: 'numberfield',
  9200. fieldLabel: '页大小',
  9201. bind: '{vjson.pageSize}',
  9202. },
  9203. {
  9204. xtype: 'textfield',
  9205. fieldLabel: '页大小选项',
  9206. flex: 2,
  9207. bind: '{vjson.pageSizeOption}',
  9208. },
  9209. ]
  9210. },
  9211. {
  9212. layout: 'hbox',
  9213. border: false,
  9214. items: [
  9215. {
  9216. xtype: 'combo',
  9217. fieldLabel: '选择模式',
  9218. flex: 4,
  9219. data: [
  9220. { id: 'spreadsheet', text: 'Excel模式' },
  9221. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9222. { id: 'checkColumn', text: '勾选框' },
  9223. { id: 'row_mulity', text: '行选择-允许多选' },
  9224. { id: 'row_single', text: '行选择-单选' },
  9225. { id: 'disableSelection', text: '禁用' },
  9226. ],
  9227. bind: {
  9228. value: '{vjson.selectMode}'
  9229. }
  9230. }
  9231. ]
  9232. },
  9233. {
  9234. layout: 'hbox',
  9235. border: false,
  9236. defaults: {
  9237. xtype: 'checkbox',
  9238. margin: '0 15 0 0',
  9239. },
  9240. items: [
  9241. {
  9242. xtype: 'container',
  9243. margin: '3',
  9244. border: false,
  9245. width: 80,
  9246. },
  9247. {
  9248. boxLabel: '隐藏底部',
  9249. bind: {
  9250. value: "{vjson.hideFootbar}"
  9251. }
  9252. },
  9253. {
  9254. boxLabel: '隐藏刷新',
  9255. bind: {
  9256. value: "{vjson.hideRefresh}"
  9257. }
  9258. },
  9259. {
  9260. boxLabel: '隐藏导出',
  9261. bind: {
  9262. value: "{vjson.hideExport}"
  9263. }
  9264. },
  9265. {
  9266. boxLabel: '隐藏自动调宽',
  9267. bind: {
  9268. value: "{vjson.hideAutoSize}"
  9269. }
  9270. },
  9271. {
  9272. boxLabel: '隐藏清空筛选',
  9273. bind: {
  9274. value: "{vjson.hideClearFilter}"
  9275. }
  9276. },
  9277. {
  9278. boxLabel: '隐藏保存布局',
  9279. bind: {
  9280. value: "{vjson.hideSaveGridUIConfig}"
  9281. }
  9282. },
  9283. {
  9284. boxLabel: '隐藏重置布局',
  9285. bind: {
  9286. value: "{vjson.hideClearGridUIConfig}"
  9287. }
  9288. },
  9289. ]
  9290. },
  9291. {
  9292. layout: 'hbox',
  9293. border: false,
  9294. defaults: {
  9295. xtype: 'checkbox',
  9296. margin: '0 15 0 0',
  9297. },
  9298. items: [
  9299. {
  9300. xtype: 'container',
  9301. margin: '3',
  9302. border: false,
  9303. width: 80
  9304. },
  9305. {
  9306. boxLabel: '单击编辑',
  9307. bind: {
  9308. value: "{vjson.cellediting_clicksToEdit}"
  9309. }
  9310. },
  9311. {
  9312. boxLabel: '列分隔线',
  9313. bind: {
  9314. value: "{vjson.columnLines}"
  9315. }
  9316. },
  9317. {
  9318. boxLabel: '行分隔线',
  9319. bind: {
  9320. value: "{vjson.rowLines}"
  9321. }
  9322. },
  9323. {
  9324. boxLabel: '边框',
  9325. bind: {
  9326. value: "{vjson.border}"
  9327. }
  9328. },
  9329. ]
  9330. },
  9331. {
  9332. layout: 'hbox',
  9333. border: false,
  9334. defaults: {
  9335. xtype: 'checkbox',
  9336. margin: '0 15 0 0',
  9337. },
  9338. items: [
  9339. {
  9340. xtype: 'container',
  9341. margin: '3',
  9342. border: false,
  9343. width: 80
  9344. },
  9345. {
  9346. boxLabel: '数据源自动加载',
  9347. bind: {
  9348. value: "{vjson.autoLoad}"
  9349. }
  9350. },
  9351. {
  9352. boxLabel: '后端排序',
  9353. bind: {
  9354. value: "{vjson.remoteSort}"
  9355. }
  9356. },
  9357. {
  9358. boxLabel: '后端过滤',
  9359. bind: {
  9360. value: "{vjson.remoteFilter}"
  9361. }
  9362. },
  9363. ]
  9364. },
  9365. {
  9366. layout: 'hbox',
  9367. border: false,
  9368. defaults: {
  9369. xtype: 'checkbox',
  9370. margin: '0 15 0 0',
  9371. },
  9372. items: [
  9373. {
  9374. xtype: 'container',
  9375. margin: '3',
  9376. border: false,
  9377. width: 80
  9378. },
  9379. {
  9380. boxLabel: '自定义锁定',
  9381. bind: {
  9382. value: "{vjson.enableLocking}"
  9383. }
  9384. },
  9385. {
  9386. boxLabel: '自定义隐藏',
  9387. bind: {
  9388. value: "{vjson.enableColumnHide}"
  9389. }
  9390. },
  9391. {
  9392. boxLabel: '用户拖拽字段',
  9393. bind: {
  9394. value: "{vjson.enableColumnMove}"
  9395. }
  9396. },
  9397. {
  9398. boxLabel: '自定义筛选',
  9399. bind: {
  9400. value: "{vjson.gridfilters}"
  9401. }
  9402. },
  9403. {
  9404. boxLabel: '用户拖拽字段宽度',
  9405. bind: {
  9406. value: "{vjson.enableColumnResize}"
  9407. }
  9408. },
  9409. {
  9410. boxLabel: '点击列头排序',
  9411. bind: {
  9412. value: "{vjson.sortOnClick}"
  9413. }
  9414. },
  9415. {
  9416. xtype: 'checkbox',
  9417. boxLabel: '隐藏',
  9418. bind: {
  9419. value: "{vjson.hidden}"
  9420. }
  9421. },
  9422. ]
  9423. },
  9424. {
  9425. xtype: 'cols',
  9426. items: [
  9427. {
  9428. xtype: 'textfield',
  9429. fieldLabel: '样式',
  9430. bind: '{vjson.cls}',
  9431. flex: 4
  9432. },
  9433. ]
  9434. },
  9435. ]
  9436. },
  9437. {
  9438. title: '字段',
  9439. xtype: 'yvgrid',
  9440. reference: 'grid1',
  9441. pagination: false,
  9442. hideFootbar: true,
  9443. plugins: {
  9444. clipboard: true,
  9445. selectionreplicator: true
  9446. },
  9447. selModel: {
  9448. type: 'spreadsheet',
  9449. columnSelect: true,
  9450. pruneRemoved: false,
  9451. extensible: 'y'
  9452. },
  9453. listeners: {
  9454. editfinish: 'scope.gridEditFinish',
  9455. },
  9456. tbar: {
  9457. xtype: 'toolbar',
  9458. items: [
  9459. {
  9460. xtype: 'button',
  9461. text: '添加',
  9462. iconCls: 'x-fa fa-plus-circle',
  9463. listeners: {
  9464. click: 'scope.addColumn'
  9465. }
  9466. },
  9467. {
  9468. xtype: 'button',
  9469. text: '删除',
  9470. iconCls: 'x-fa fa-minus-circle',
  9471. listeners: {
  9472. click: 'scope.removeColumn'
  9473. }
  9474. },
  9475. '-',
  9476. {
  9477. xtype: 'button',
  9478. text: '自动分析',
  9479. iconCls: 'x-fa fa-code-fork',
  9480. listeners: {
  9481. click: 'scope.calcColumn'
  9482. }
  9483. },
  9484. {
  9485. xtype: 'button',
  9486. text: '上移',
  9487. iconCls: 'x-fa fa-arrow-up',
  9488. listeners: {
  9489. click: 'scope.moveUp'
  9490. }
  9491. },
  9492. {
  9493. xtype: 'button',
  9494. text: '下移',
  9495. iconCls: 'x-fa fa-arrow-down',
  9496. listeners: {
  9497. click: 'scope.moveDown'
  9498. }
  9499. },
  9500. ]
  9501. },
  9502. columns: [
  9503. { xtype: 'rownumberer' },
  9504. {
  9505. text: '字段',
  9506. dataIndex: 'dataIndex',
  9507. width: 140,
  9508. sortable: false,
  9509. menuDisabled: true,
  9510. editor: {
  9511. selectOnFocus: true,
  9512. },
  9513. },
  9514. {
  9515. text: '标题',
  9516. dataIndex: 'header',
  9517. width: 120,
  9518. sortable: false,
  9519. menuDisabled: true,
  9520. editor: {
  9521. selectOnFocus: true,
  9522. },
  9523. },
  9524. {
  9525. text: '类型',
  9526. dataIndex: 'xtype',
  9527. width: 100,
  9528. sortable: false,
  9529. menuDisabled: true,
  9530. editor: {
  9531. xtype: 'combo',
  9532. typeAhead: true,
  9533. triggerAction: 'all',
  9534. selectOnFocus: false,
  9535. listConfig: {
  9536. minWidth: 200
  9537. },
  9538. store: [
  9539. ['', '默认'],
  9540. ['rownum', 'rownum'],
  9541. ['checkcolumn', 'checkcolumn'],
  9542. ]
  9543. },
  9544. },
  9545. {
  9546. text: '数据类型',
  9547. dataIndex: 'dataType',
  9548. width: 100,
  9549. sortable: false,
  9550. menuDisabled: true,
  9551. editor: {
  9552. xtype: 'combo',
  9553. selectOnFocus: true,
  9554. listConfig: {
  9555. minWidth: 200
  9556. },
  9557. store: [
  9558. ['', '默认'],
  9559. ['string', 'string'],
  9560. ['number', 'number'],
  9561. ['date', 'date'],
  9562. ]
  9563. },
  9564. },
  9565. {
  9566. text: '编辑模式',
  9567. dataIndex: 'editor',
  9568. width: 100,
  9569. sortable: false,
  9570. menuDisabled: true,
  9571. editor: {
  9572. xtype: 'combo',
  9573. selectOnFocus: true,
  9574. listConfig: {
  9575. minWidth: 200
  9576. },
  9577. store: [
  9578. ['', ''],
  9579. ['textfield', 'textfield'],
  9580. ['numberfield', 'numberfield'],
  9581. ['combo', 'combo'],
  9582. ['combogrid', 'combogrid'],
  9583. ['datefield', 'datefield'],
  9584. ]
  9585. },
  9586. },
  9587. {
  9588. text: '宽度',
  9589. dataIndex: 'width',
  9590. align: 'right',
  9591. width: 100,
  9592. sortable: false,
  9593. menuDisabled: true,
  9594. editor: {
  9595. xtype: 'numberfield',
  9596. selectOnFocus: true,
  9597. minValue: 0,
  9598. maxValue: 1000
  9599. },
  9600. },
  9601. {
  9602. text: '权重',
  9603. dataIndex: 'flex',
  9604. align: 'right',
  9605. width: 90,
  9606. sortable: false,
  9607. menuDisabled: true,
  9608. editor: {
  9609. xtype: 'numberfield',
  9610. selectOnFocus: true,
  9611. minValue: 0,
  9612. maxValue: 10
  9613. },
  9614. },
  9615. {
  9616. text: '字典',
  9617. dataIndex: 'dict',
  9618. sortable: false,
  9619. menuDisabled: true,
  9620. width: 210,
  9621. editor: {
  9622. selectOnFocus: true,
  9623. },
  9624. },
  9625. {
  9626. text: '对齐',
  9627. dataIndex: 'align',
  9628. width: 90,
  9629. sortable: false,
  9630. menuDisabled: true,
  9631. editor: {
  9632. xtype: 'combo',
  9633. selectOnFocus: true,
  9634. listConfig: {
  9635. minWidth: 120
  9636. },
  9637. store: [
  9638. ['start', 'start'],
  9639. ['center', 'center'],
  9640. ['end', 'end'],
  9641. ]
  9642. },
  9643. },
  9644. {
  9645. text: '必填',
  9646. dataIndex: 'notAllowBlank',
  9647. width: 50,
  9648. resizable: false,
  9649. sortable: false,
  9650. menuDisabled: true,
  9651. xtype: 'checkcolumn',
  9652. },
  9653. {
  9654. text: '禁用',
  9655. dataIndex: 'disabled',
  9656. width: 50,
  9657. resizable: false,
  9658. sortable: false,
  9659. menuDisabled: true,
  9660. xtype: 'checkcolumn',
  9661. },
  9662. {
  9663. text: '禁菜',
  9664. dataIndex: 'menuDisabled',
  9665. width: 50,
  9666. resizable: false,
  9667. sortable: false,
  9668. menuDisabled: true,
  9669. xtype: 'checkcolumn',
  9670. },
  9671. {
  9672. text: '过滤',
  9673. dataIndex: 'filterable',
  9674. xtype: 'checkcolumn',
  9675. width: 50,
  9676. resizable: false,
  9677. sortable: false,
  9678. menuDisabled: true,
  9679. },
  9680. {
  9681. text: '隐藏',
  9682. dataIndex: 'hidden',
  9683. xtype: 'checkcolumn',
  9684. width: 50,
  9685. resizable: false,
  9686. sortable: false,
  9687. menuDisabled: true,
  9688. },
  9689. {
  9690. text: '可隐',
  9691. dataIndex: 'hideable',
  9692. xtype: 'checkcolumn',
  9693. width: 50,
  9694. resizable: false,
  9695. sortable: false,
  9696. menuDisabled: true,
  9697. },
  9698. {
  9699. text: '调宽',
  9700. dataIndex: 'resizable',
  9701. xtype: 'checkcolumn',
  9702. width: 50,
  9703. resizable: false,
  9704. sortable: false,
  9705. menuDisabled: true,
  9706. },
  9707. {
  9708. text: '排序',
  9709. dataIndex: 'sortable',
  9710. xtype: 'checkcolumn',
  9711. width: 50,
  9712. resizable: false,
  9713. sortable: false,
  9714. menuDisabled: true,
  9715. },
  9716. {
  9717. text: '适宽',
  9718. dataIndex: 'autoSize',
  9719. xtype: 'checkcolumn',
  9720. width: 50,
  9721. resizable: false,
  9722. sortable: false,
  9723. menuDisabled: true,
  9724. },
  9725. ],
  9726. },
  9727. {
  9728. title: '数据源',
  9729. layout: 'border',
  9730. listeners: {
  9731. activate: 'scope.dataSourceActivate'
  9732. },
  9733. items: [
  9734. {
  9735. region: 'north',
  9736. xtype: 'toolbar',
  9737. border: false,
  9738. items: [
  9739. {
  9740. xtype: 'textfield',
  9741. fieldLabel: '数据源',
  9742. flex: 1,
  9743. bind: {
  9744. value: '{vjson.dataSource.url}'
  9745. }
  9746. },
  9747. {
  9748. xtype: 'button',
  9749. text: '保存',
  9750. iconCls: 'x-fa fa-save',
  9751. listeners: {
  9752. click: 'scope.dataSourceSave'
  9753. }
  9754. },
  9755. {
  9756. xtype: 'button',
  9757. text: '读取',
  9758. iconCls: 'x-fa fa-folder-open',
  9759. listeners: {
  9760. click: 'scope.reloadSqlContent'
  9761. }
  9762. },
  9763. ]
  9764. },
  9765. {
  9766. region: 'center',
  9767. xtype: 'sqleditor',
  9768. layout: 'fit',
  9769. reference: 'sqlEditor',
  9770. },
  9771. {
  9772. region: 'south',
  9773. xtype: 'jsoneditor',
  9774. height: 200,
  9775. split: true,
  9776. collapsible: true,
  9777. title: '参数',
  9778. reference: 'sqlParams',
  9779. }
  9780. ]
  9781. },
  9782. {
  9783. title: '事件',
  9784. xtype: 'form',
  9785. scrollable: true,
  9786. margin: '10',
  9787. defaults: {
  9788. width: '100%',
  9789. labelAlign: 'top',
  9790. },
  9791. items: [
  9792. {
  9793. xtype: 'textfield',
  9794. fieldLabel: '选中前触发 beforeSelect',
  9795. bind: {
  9796. value: '{vjson.listeners.beforeselect}'
  9797. },
  9798. },
  9799. {
  9800. xtype: 'textfield',
  9801. fieldLabel: '选择范围改变 selectionChange',
  9802. bind: {
  9803. value: '{vjson.listeners.selectionchange}'
  9804. },
  9805. },
  9806. {
  9807. xtype: 'textfield',
  9808. fieldLabel: '行点击 itemClick',
  9809. bind: {
  9810. value: '{vjson.listeners.itemclick}'
  9811. },
  9812. },
  9813. {
  9814. xtype: 'textfield',
  9815. fieldLabel: '行双击 itemDblClick',
  9816. bind: {
  9817. value: '{vjson.listeners.itemdblclick}'
  9818. },
  9819. },
  9820. {
  9821. xtype: 'textfield',
  9822. fieldLabel: '单元格点击 cellClick',
  9823. bind: {
  9824. value: '{vjson.listeners.cellClick}'
  9825. },
  9826. },
  9827. {
  9828. xtype: 'textfield',
  9829. fieldLabel: '单元格双击 cellDblClick',
  9830. bind: {
  9831. value: '{vjson.listeners.celldblclick}'
  9832. },
  9833. },
  9834. {
  9835. xtype: 'textfield',
  9836. fieldLabel: '渲染后触发 afterrender',
  9837. bind: {
  9838. value: '{vjson.listeners.afterrender}'
  9839. },
  9840. },
  9841. {
  9842. xtype: 'textfield',
  9843. fieldLabel: '销毁后触发 destory',
  9844. bind: {
  9845. value: '{vjson.listeners.destory}'
  9846. },
  9847. },
  9848. ]
  9849. },
  9850. ],
  9851. }
  9852. ],
  9853. fbar: [
  9854. {
  9855. text: '应用', iconCls: 'x-fa fa-save',
  9856. listeners: {
  9857. click: 'scope.save'
  9858. }
  9859. },
  9860. '-',
  9861. {
  9862. text: '确定', iconCls: 'x-fa fa-check-circle',
  9863. listeners: {
  9864. click: 'scope.saveClose'
  9865. }
  9866. },
  9867. {
  9868. text: '取消', iconCls: 'x-fa fa-times-circle',
  9869. listeners: {
  9870. click: 'system.closeMe()'
  9871. }
  9872. },
  9873. ]
  9874. };
  9875. //# sourceMappingURL=YvgridDesign.view.js.map
  9876. var checkFlags = {};
  9877. // ------------------------------------------------------------------------------------------ impls
  9878. function jsViewToVJson(modulePage, jsView) {
  9879. if (!jsView)
  9880. return {};
  9881. jsView = jsView.replace(/^\s*export\s+default/, "");
  9882. jsView = _$2.trim(jsView) || "{}";
  9883. try {
  9884. var json = dist.parse(jsView);
  9885. return modulePage.addViewId(json);
  9886. }
  9887. catch (e) {
  9888. //@ts-ignore
  9889. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9890. }
  9891. }
  9892. function stringToJsonObj(jsonStr) {
  9893. if (!jsonStr)
  9894. return {};
  9895. try {
  9896. return dist.parse(jsonStr);
  9897. }
  9898. catch (e) {
  9899. return {};
  9900. }
  9901. }
  9902. /**
  9903. * 获取view.js 文件 string
  9904. */
  9905. function vjsonTojsView(vjson) {
  9906. var reVjson = _$2.cloneDeep(vjson);
  9907. removeDesignProp(reVjson);
  9908. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9909. }
  9910. var ModuleStore = /** @class */ (function (_super) {
  9911. __extends(ModuleStore, _super);
  9912. function ModuleStore() {
  9913. var _this = _super.call(this) || this;
  9914. _this.store = {};
  9915. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9916. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9917. _this.addModule(id, module, modulePage);
  9918. });
  9919. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9920. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9921. _this.onMainTabChange(moduleId, oldModuleId, from);
  9922. });
  9923. return _this;
  9924. }
  9925. ModuleStore.prototype.getCacheKey = function (param) {
  9926. return "filetree_data.json";
  9927. };
  9928. ModuleStore.prototype.invokeApi = function (param) {
  9929. return moduleTree();
  9930. };
  9931. ModuleStore.prototype.reloadModule = function (id) {
  9932. var moduleObject = this.store[id];
  9933. if (!moduleObject)
  9934. return;
  9935. var module = moduleObject.module;
  9936. getModuleFileContent(module).then(function (_a) {
  9937. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9938. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9939. moduleObject.lastModifyTime = lastModifyTime;
  9940. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9941. // 触发事件 ModuleItemChange
  9942. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9943. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9944. vjson: moduleObject.moduleObj.vjson,
  9945. from: "reloadModule"
  9946. });
  9947. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9948. });
  9949. };
  9950. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9951. var _this = this;
  9952. window['mainWindow'].setLoading(true);
  9953. getModuleFileContent(module)
  9954. .then(function (_a) {
  9955. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9956. var moduleObject = {
  9957. id: id, module: module,
  9958. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9959. lastModifyTime: lastModifyTime,
  9960. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9961. modulePage: modulePage,
  9962. moduleEventBus: modulePage.moduleEventBus
  9963. };
  9964. _this.store[id] = moduleObject;
  9965. // 触发事件 ModuleItemChange
  9966. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9967. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9968. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9969. })
  9970. .finally(function () {
  9971. window['mainWindow'].setLoading(false);
  9972. });
  9973. };
  9974. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9975. if (this.store[moduleId]) {
  9976. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9977. }
  9978. };
  9979. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9980. var moduleObject = this.store[id];
  9981. moduleObject.fileContent.jsController = codeValue;
  9982. };
  9983. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9984. var moduleObject = this.store[id];
  9985. moduleObject.fileContent.jsView = codeValue;
  9986. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9987. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9988. vjson: moduleObject.moduleObj.vjson,
  9989. from: from
  9990. });
  9991. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9992. };
  9993. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9994. var moduleObject = this.store[id];
  9995. moduleObject.fileContent.jsModel = codeValue;
  9996. };
  9997. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9998. var moduleObject = this.store[id];
  9999. moduleObject.fileContent.groovy = codeValue;
  10000. };
  10001. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  10002. var moduleObject = this.store[id];
  10003. moduleObject.fileContent.mybatis = codeValue;
  10004. };
  10005. ModuleStore.prototype.getModuleObject = function (id) {
  10006. return this.store[id];
  10007. };
  10008. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  10009. if (checkFlags[moduleId] === 1) {
  10010. // @ts-ignore
  10011. system.msg("正在检测文件是否有外部修改,请稍后操作");
  10012. }
  10013. eventBus.publish(EventType.StopCheckModule, {});
  10014. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  10015. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  10016. saveFile(fileFullPath, fileContent).then(function (res) {
  10017. if (res.data && res.data.lastModified) {
  10018. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  10019. }
  10020. }).finally(function () {
  10021. eventBus.publish(EventType.RunCheckModule, {});
  10022. });
  10023. };
  10024. ModuleStore.prototype.check = function (moduleId) {
  10025. {
  10026. return;
  10027. }
  10028. };
  10029. return ModuleStore;
  10030. }(CacheStore));
  10031. // ------------------------------------------------------------------------------------------ use
  10032. var moduleStore = new ModuleStore();
  10033. //# sourceMappingURL=ModuleStore.js.map
  10034. var VjsonExchange = /** @class */ (function () {
  10035. function VjsonExchange(vjson) {
  10036. this.pendingSet = true;
  10037. this.vjsonOrigin = _$2.cloneDeep(vjson);
  10038. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  10039. }
  10040. /**
  10041. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  10042. * @param propName
  10043. * @param value
  10044. */
  10045. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10046. if (this.pendingSet) {
  10047. return;
  10048. }
  10049. // selectMode
  10050. // pageSizeOption
  10051. // cellediting_clicksToEdit
  10052. msg$1('' + propName + '=' + value);
  10053. _$2.set(this.vjson, propName, value);
  10054. };
  10055. /**
  10056. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10057. */
  10058. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10059. var _a, _b, _c;
  10060. if (this.pendingSet) {
  10061. return;
  10062. }
  10063. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10064. // 如果不使用默认属性,就直接设定 undefined
  10065. var vs = {
  10066. dataIndex: undefined,
  10067. header: undefined,
  10068. xtype: '',
  10069. width: undefined,
  10070. flex: undefined,
  10071. align: 'start',
  10072. editor: undefined,
  10073. dataType: 'string',
  10074. dict: undefined,
  10075. disabled: false,
  10076. menuDisabled: false,
  10077. notAllowBlank: false,
  10078. filterable: true,
  10079. hidden: false,
  10080. hideable: true,
  10081. resizable: true,
  10082. sortable: true,
  10083. autoSize: true,
  10084. };
  10085. var raw = record.get('raw');
  10086. if (raw === undefined || raw == null) {
  10087. raw = {};
  10088. record.set('raw', raw);
  10089. }
  10090. var setRaw = function (propName, value) {
  10091. if (typeof value === 'undefined' || value == null) {
  10092. msg$1("delete columns[" + rowIdx + "]." + propName);
  10093. delete raw[propName];
  10094. return;
  10095. }
  10096. var defaultValue = vs[propName];
  10097. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10098. // 要设的值,与默认值相同,就直接删除这个属性
  10099. msg$1("delete columns[" + rowIdx + "]." + propName);
  10100. delete raw[propName];
  10101. return;
  10102. }
  10103. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10104. _$2.set(raw, propName, value);
  10105. };
  10106. if (!vs.hasOwnProperty(propName)) {
  10107. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10108. return;
  10109. }
  10110. else if (propName === 'dict') {
  10111. if (value) {
  10112. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10113. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10114. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10115. }
  10116. }
  10117. else {
  10118. setRaw('fix', undefined);
  10119. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10120. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10121. delete raw.editor.fix;
  10122. }
  10123. }
  10124. }
  10125. else if (propName === 'xtype') {
  10126. if (!value) {
  10127. setRaw('xtype', undefined);
  10128. }
  10129. else {
  10130. setRaw('xtype', value);
  10131. }
  10132. }
  10133. else if (propName === 'notAllowBlank') {
  10134. setRaw('editor.allowBlank', !value);
  10135. }
  10136. else if (propName === 'editor') {
  10137. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10138. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10139. value = undefined;
  10140. }
  10141. // editor.xtype
  10142. if (!value) {
  10143. // 不需要编辑器
  10144. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10145. msg$1("delete columns[" + rowIdx + "].editor");
  10146. delete raw.editor;
  10147. record.set('notAllowBlank', false);
  10148. }
  10149. }
  10150. else {
  10151. setRaw('editor.xtype', value);
  10152. var dict = record.get('dict');
  10153. if (value === 'combo' && dict) {
  10154. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10155. }
  10156. }
  10157. }
  10158. else if (propName === 'width') {
  10159. var width = value;
  10160. var flex = record.get('flex');
  10161. if (!width && !flex) {
  10162. setRaw('width', undefined);
  10163. setRaw('flex', undefined);
  10164. record.set('flex', undefined);
  10165. record.set('width', undefined);
  10166. return;
  10167. }
  10168. else if (!!width) {
  10169. setRaw('flex', undefined);
  10170. record.set('flex', undefined);
  10171. setRaw('width', width);
  10172. return;
  10173. }
  10174. }
  10175. else if (propName === 'flex') {
  10176. var width = record.get('width');
  10177. var flex = value;
  10178. if (!width && !flex) {
  10179. setRaw('width', undefined);
  10180. setRaw('flex', undefined);
  10181. record.set('flex', undefined);
  10182. record.set('width', undefined);
  10183. return;
  10184. }
  10185. else if (!!flex) {
  10186. setRaw('width', undefined);
  10187. record.set('width', undefined);
  10188. setRaw('flex', flex);
  10189. return;
  10190. }
  10191. }
  10192. else {
  10193. // 其他属性,作为同名属性,与 raw 同步
  10194. setRaw(propName, value);
  10195. }
  10196. };
  10197. /**
  10198. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10199. */
  10200. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10201. var _this = this;
  10202. var vs = [
  10203. 'reference', 'pagination', 'pageSize',
  10204. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10205. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10206. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10207. 'listeners.beforeselect',
  10208. 'listeners.selectionchange',
  10209. 'listeners.itemclick',
  10210. 'listeners.itemdblclick',
  10211. 'listeners.cellClick',
  10212. 'listeners.celldblclick',
  10213. 'listeners.afterrender',
  10214. 'listeners.destory',
  10215. ];
  10216. _$2.forEach(vs, function (v) {
  10217. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10218. });
  10219. };
  10220. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10221. var me = this;
  10222. return function (value) {
  10223. me.setPropValue(propName, value);
  10224. };
  10225. };
  10226. VjsonExchange.prototype.parseModel = function () {
  10227. var _this = this;
  10228. 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;
  10229. //@ts-ignore
  10230. var df = YvanUI.Defaults.grid;
  10231. var vjson = _$2.assign({}, df, this.vjson);
  10232. var model = {
  10233. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10234. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10235. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10236. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10237. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10238. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10239. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10240. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10241. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10242. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10243. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10244. selectMode: 'spreadsheet',
  10245. cellediting_clicksToEdit: true,
  10246. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10247. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10248. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10249. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10250. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10251. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10252. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10253. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10254. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10255. gridfilters: true,
  10256. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10257. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10258. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10259. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10260. columns: [],
  10261. listeners: {
  10262. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10263. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10264. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10265. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10266. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10267. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10268. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10269. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10270. }
  10271. };
  10272. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10273. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10274. }
  10275. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10276. if (_$2.get(vjson, 'disableSelection') == true) {
  10277. model.selectMode = 'disableSelection';
  10278. }
  10279. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10280. model.selectMode = 'spreadsheet';
  10281. }
  10282. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10283. model.selectMode = 'onlyCheckColumn';
  10284. }
  10285. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10286. model.selectMode = 'checkColumn';
  10287. }
  10288. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10289. model.selectMode = 'row_mulity';
  10290. }
  10291. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10292. model.selectMode = 'row_single';
  10293. }
  10294. else {
  10295. model.selectMode = 'row_single';
  10296. }
  10297. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10298. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10299. model.dataSource = {
  10300. url: _$2.get(vjson, 'dataSource.url'),
  10301. //@ts-ignore
  10302. params: _$2.get(vjson, 'dataSource.params')
  10303. };
  10304. }
  10305. _$2.forEach(vjson.columns, function (column) {
  10306. model.columns.push(_this.parseColumn(column));
  10307. });
  10308. return model;
  10309. };
  10310. VjsonExchange.prototype.parseColumn = function (column) {
  10311. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10312. var model = {
  10313. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10314. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10315. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10316. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10317. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10318. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10319. editor: '',
  10320. editParam: '',
  10321. dict: '',
  10322. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10323. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10324. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10325. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10326. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10327. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10328. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10329. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10330. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10331. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10332. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10333. raw: _$2.cloneDeep(column),
  10334. };
  10335. // width / flex 只能留一个属性, 或者全不留
  10336. if (model.width <= 0 && model.flex <= 0) {
  10337. delete model.width;
  10338. delete model.flex;
  10339. }
  10340. else if (model.width > 0) {
  10341. delete model.flex;
  10342. }
  10343. else {
  10344. delete model.width;
  10345. }
  10346. // editor
  10347. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10348. model.editor = _$2.get(column, 'editor.xtype');
  10349. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10350. if (!model.editor) {
  10351. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10352. model.editor = 'textfield';
  10353. }
  10354. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10355. msg$1('不可识别的 editor.xtype=' + model.editor);
  10356. console.error('不可识别的 editor.xtype', column);
  10357. }
  10358. if (_$2.get(column, 'editor.allowBlank') === false) {
  10359. model.notAllowBlank = true;
  10360. }
  10361. }
  10362. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10363. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10364. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10365. if (match && match[1]) {
  10366. model.dict = match[1];
  10367. }
  10368. }
  10369. return model;
  10370. };
  10371. return VjsonExchange;
  10372. }());
  10373. //
  10374. //# sourceMappingURL=YvgridExchange.js.map
  10375. var YvgridDesign = /** @class */ (function (_super) {
  10376. __extends(YvgridDesign, _super);
  10377. function YvgridDesign(moduleId) {
  10378. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10379. _this.moduleId = '';
  10380. _this.name = 'YvgridDesign';
  10381. _this.dataSourceIsActived = false;
  10382. _this.setModuleId(moduleId);
  10383. return _this;
  10384. }
  10385. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10386. var _this = this;
  10387. this.moduleId = moduleId;
  10388. if (this.componentSelectionChangeSubscribe) {
  10389. this.componentSelectionChangeSubscribe.cancel();
  10390. this.componentSelectionChangeSubscribe = null;
  10391. }
  10392. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10393. var id = _a.id, from = _a.from;
  10394. _this.onComponentSelectionChange(id, from);
  10395. });
  10396. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10397. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10398. if (vj.xtype !== 'yvgrid') {
  10399. throw Error('非 yvgrid 组件');
  10400. }
  10401. this.vjsonExchange = new VjsonExchange(vj);
  10402. };
  10403. YvgridDesign.prototype.onLoad = function () {
  10404. var _this = this;
  10405. var model = this.vjsonExchange.parseModel();
  10406. this.vjsonExchange.pendingSet = true;
  10407. mergeViewModel(this.viewModel, "vjson", model, false);
  10408. this.refs.grid1.setData(model.columns);
  10409. this.vjsonExchange.attachViewModel(this.viewModel);
  10410. _$2.defer(function () {
  10411. _this.vjsonExchange.pendingSet = false;
  10412. });
  10413. };
  10414. YvgridDesign.prototype.moveUp = function (sender) {
  10415. var grid = sender.up('grid');
  10416. grid.rowMoveUp();
  10417. };
  10418. YvgridDesign.prototype.moveDown = function (sender) {
  10419. var grid = sender.up('grid');
  10420. grid.rowMoveDown();
  10421. };
  10422. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10423. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10424. };
  10425. YvgridDesign.prototype.reloadSqlContent = function () {
  10426. var _this = this;
  10427. var url = this.viewModel.get('vjson.dataSource.url');
  10428. if (url) {
  10429. loadSqlContentApi(url).then(function (res) {
  10430. _this.refs.sqlEditor.setCode('');
  10431. if (res.success) {
  10432. _this.refs.sqlEditor.setCode(res.data.content);
  10433. }
  10434. }).catch(function () {
  10435. _this.refs.sqlEditor.setCode('');
  10436. });
  10437. }
  10438. };
  10439. YvgridDesign.prototype.dataSourceSave = function () {
  10440. var url = this.viewModel.get('vjson.dataSource.url');
  10441. if (!url) {
  10442. msg$1('必须填写 groovy/SQL 模块路径');
  10443. return;
  10444. }
  10445. var content = this.refs.sqlEditor.getCode();
  10446. saveSqlContentApi(url, content).then(function (res) {
  10447. if (res.success) {
  10448. msg$1('保存成功');
  10449. }
  10450. else {
  10451. msg$1(res.msg);
  10452. }
  10453. });
  10454. };
  10455. YvgridDesign.prototype.dataSourceActivate = function () {
  10456. if (!this.dataSourceIsActived) {
  10457. // 激活
  10458. this.reloadSqlContent();
  10459. var params = this.viewModel.get('vjson.dataSource.params');
  10460. if (_$2.isObject(params)) {
  10461. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10462. }
  10463. this.dataSourceIsActived = true;
  10464. }
  10465. };
  10466. // 外部控件选择发生改变
  10467. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10468. if (!id || from === this.name) {
  10469. return;
  10470. }
  10471. this.setVjson(id);
  10472. };
  10473. YvgridDesign.prototype.setVjson = function (id) {
  10474. // 找到对应的组件 判断是不是表格
  10475. };
  10476. YvgridDesign.prototype.save = function () {
  10477. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10478. if (this.dataSourceIsActived) {
  10479. var url = this.viewModel.get('vjson.dataSource.url');
  10480. // 解析 params
  10481. var paramsString = this.refs.sqlParams.getCode('');
  10482. var params = undefined;
  10483. if (paramsString) {
  10484. try {
  10485. params = window['YvanUI'].json5.parse(paramsString);
  10486. }
  10487. catch (e) {
  10488. msg$1('dataSource.params 格式非法,请检查');
  10489. return;
  10490. }
  10491. }
  10492. if (typeof params === 'undefined') {
  10493. params = this.viewModel.get('vjson.dataSource.params');
  10494. }
  10495. if (url) {
  10496. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10497. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10498. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10499. }
  10500. else {
  10501. delete this.vjsonExchange.vjson['dataSource'];
  10502. }
  10503. }
  10504. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10505. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10506. from: this.name,
  10507. ignoreRenderUI: false
  10508. });
  10509. };
  10510. YvgridDesign.prototype.saveClose = function () {
  10511. this.save();
  10512. this.close();
  10513. };
  10514. YvgridDesign.prototype.addColumn = function () {
  10515. this.refs.grid1.appendEditRow({
  10516. dataIndex: '',
  10517. header: '',
  10518. xtype: '',
  10519. width: 80,
  10520. align: '',
  10521. editor: '',
  10522. editParam: '',
  10523. dict: '',
  10524. disabled: false,
  10525. notAllowBlank: false,
  10526. menuDisabled: false,
  10527. filterable: false,
  10528. hidden: false,
  10529. hideable: true,
  10530. resizable: true,
  10531. sortable: true,
  10532. locked: false,
  10533. lockable: false,
  10534. autoSize: true,
  10535. raw: undefined,
  10536. }, 'header');
  10537. };
  10538. YvgridDesign.prototype.removeColumn = function () {
  10539. var _this = this;
  10540. var rows = [];
  10541. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10542. rows.push(r);
  10543. });
  10544. _$2.forEach(rows, function (r) {
  10545. _this.refs.grid1.getStore().remove(r);
  10546. });
  10547. };
  10548. YvgridDesign.prototype.calcColumn = function () {
  10549. msg$1('暂未实现');
  10550. };
  10551. YvgridDesign.prototype.onDestroy = function () {
  10552. if (this.componentSelectionChangeSubscribe) {
  10553. this.componentSelectionChangeSubscribe.cancel();
  10554. this.componentSelectionChangeSubscribe = null;
  10555. }
  10556. };
  10557. return YvgridDesign;
  10558. }(Scope));
  10559. //# sourceMappingURL=YvgridDesign.js.map
  10560. // export const idPrefix = "_ds_"
  10561. var _designInstance;
  10562. function setDesignInstance(instance) {
  10563. _designInstance = instance;
  10564. }
  10565. function getDesignInstance() {
  10566. return _designInstance;
  10567. }
  10568. function delegateDragmove(node, source, info) {
  10569. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10570. //@ts-ignore
  10571. _designInstance.dragmove(node, source, info);
  10572. }
  10573. }
  10574. function delegateDragend(node, source, info) {
  10575. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10576. //@ts-ignore
  10577. _designInstance.dragend(node, source, info);
  10578. }
  10579. }
  10580. //# sourceMappingURL=DropHelper.js.map
  10581. var YvanUI$1 = window['YvanUI'];
  10582. var _$1 = window["_"];
  10583. var Ext$1 = window['Ext'];
  10584. var $$1 = window["$"];
  10585. var historySize = 100;
  10586. var ViewDesign = /** @class */ (function () {
  10587. function ViewDesign(moduleId, reference) {
  10588. var _this = this;
  10589. this.name = "ViewDesign";
  10590. this.expandedVjsonObjArray = [];
  10591. // 编辑历史
  10592. this.undoVjsonList = [];
  10593. // 撤销历史
  10594. this.redoVjsonList = [];
  10595. // 订阅事件列表
  10596. this.subscribeList = [];
  10597. // private getOuterCopyValueTimer: any = null
  10598. /**
  10599. * 唯一编号
  10600. */
  10601. this.id = _$1.uniqueId("_dv");
  10602. this.moduleId = moduleId;
  10603. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10604. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10605. this.designReference = reference;
  10606. this.designElement = reference.ariaEl.dom;
  10607. this.$overlay.appendTo(this.designElement);
  10608. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10609. // 添加到撤销
  10610. this.lastVjson = _$1.cloneDeep(this.vjson);
  10611. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10612. event.stopPropagation();
  10613. event.preventDefault();
  10614. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10615. });
  10616. this.$overlay.on('click', '.studio_mask', function (event) {
  10617. event.stopPropagation();
  10618. event.preventDefault();
  10619. _this.clearSelection();
  10620. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10621. _$1.defer(function () {
  10622. _this.$overlay.focus();
  10623. });
  10624. });
  10625. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10626. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10627. this.$overlay.on('copy', this.onCopy.bind(this));
  10628. this.$overlay.on('paste', this.onPaste.bind(this));
  10629. this.$overlay.on('focus', this.onfocus.bind(this));
  10630. // this.$overlay.on('mouseenter', ()=>{
  10631. // clearTimeout(this.getOuterCopyValueTimer);
  10632. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10633. // })
  10634. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10635. _this.onMousemove(event);
  10636. }, 300, { maxWait: 500 }).bind(this));
  10637. window.addEventListener('message', this.onMessageEvent.bind(this));
  10638. this.subscribe();
  10639. setDesignInstance(this);
  10640. }
  10641. // todo ======== 方法 ==========
  10642. ViewDesign.prototype.subscribe = function () {
  10643. var _this = this;
  10644. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10645. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10646. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10647. _this.setVjson(vjson, from, ignoreRenderUI);
  10648. }));
  10649. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10650. var id = _a.id, from = _a.from;
  10651. _this.onComponentSelectionChange(id, from);
  10652. }));
  10653. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10654. var id = _a.id, from = _a.from;
  10655. _this.onComponentDelete(id, from);
  10656. }));
  10657. };
  10658. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10659. if (vjson === void 0) { vjson = this.vjson; }
  10660. if (from === void 0) { from = this.name; }
  10661. this.vjson = vjson;
  10662. if (from !== "undo" && from !== "redo") {
  10663. if (this.undoVjsonList.length >= 100) {
  10664. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10665. }
  10666. this.undoVjsonList.push(this.lastVjson);
  10667. }
  10668. this.lastVjson = _$1.cloneDeep(vjson);
  10669. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10670. };
  10671. /**
  10672. * 覆盖层点击事件
  10673. */
  10674. ViewDesign.prototype.overlayClickFunction = function (event) {
  10675. if (!event.altKey && !event.shiftKey) {
  10676. var target = this.findElByXY(event.clientX, event.clientY);
  10677. if (target) {
  10678. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10679. var extHandle = Ext$1.get(target).component;
  10680. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10681. rect.x = position.x;
  10682. rect.y = position.y;
  10683. this.clearSelection();
  10684. this.appendMaskbox(rect, extHandle.id);
  10685. }
  10686. }
  10687. };
  10688. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10689. if (dragType === void 0) { dragType = ""; }
  10690. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10691. var ele = document.elementsFromPoint(x, y);
  10692. if (ele.length <= 1) {
  10693. return;
  10694. }
  10695. var target = null;
  10696. for (var i = 0; i < ele.length; i++) {
  10697. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10698. 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) {
  10699. switch (dragType) {
  10700. case "cols-container":
  10701. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10702. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10703. target = ele[i];
  10704. }
  10705. break;
  10706. case "col-item":
  10707. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10708. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10709. target = ele[i];
  10710. }
  10711. break;
  10712. case "rows-container":
  10713. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10714. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10715. target = ele[i];
  10716. }
  10717. break;
  10718. case "row-item":
  10719. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10720. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10721. target = ele[i];
  10722. }
  10723. break;
  10724. default:
  10725. target = ele[i];
  10726. break;
  10727. }
  10728. if (target) {
  10729. break;
  10730. }
  10731. }
  10732. }
  10733. return target;
  10734. };
  10735. /**
  10736. * 清空选择项
  10737. */
  10738. ViewDesign.prototype.clearSelection = function () {
  10739. // $(this.designElement).removeClass('selected');
  10740. // // $(this.designElement).find('.selected').removeClass('selected')
  10741. // $(this.designElement).find('.ds_mask')
  10742. // .not('.mask_not_hide')
  10743. // .remove();
  10744. $$1('.studio_mask').remove();
  10745. // $(this.designElement).find('.selected').each(function () {
  10746. // $(this).removeClass('selected');
  10747. // // const extHandle = Ext.get(this).component
  10748. // // if (extHandle) {
  10749. // // extHandle.removeCls('selected')
  10750. // // }
  10751. // })
  10752. };
  10753. /**
  10754. * 添加遮罩层
  10755. */
  10756. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10757. var that = this;
  10758. if (vjsonId) {
  10759. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10760. }
  10761. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10762. // return item === cj.xtype
  10763. // }) >= 0
  10764. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10765. 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>");
  10766. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10767. this.$mask.css({
  10768. position: 'absolute',
  10769. top: top, left: left, width: width, height: height,
  10770. border: '2px dashed #1890ff',
  10771. zIndex: 100,
  10772. });
  10773. this.$mask.appendTo(this.$overlay);
  10774. this.$mask.on("click", ".ds_del", function (e) {
  10775. e.stopPropagation();
  10776. e.preventDefault();
  10777. that.deleteComponent(vjsonId);
  10778. });
  10779. // 点击选中父级
  10780. this.$mask.on('click', '.ds_parent', function (e) {
  10781. e.stopPropagation();
  10782. e.preventDefault();
  10783. that.selectParent(vjsonId);
  10784. });
  10785. var sel = document.getElementById(vjsonId);
  10786. var sVjosn = findInCode(this.vjson, vjsonId);
  10787. // 限制可以拖动的组件
  10788. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10789. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10790. this.dragSource = new Ext$1.drag.Source({
  10791. element: this.$mask[0],
  10792. constrain: this.$overlay[0],
  10793. listeners: {
  10794. dragmove: this.dragmove.bind(that, this.vjson),
  10795. dragend: this.dragend.bind(that, this.vjson)
  10796. },
  10797. startRect: rect,
  10798. sourceVjson: findInCode(this.vjson, vjsonId),
  10799. sourceVjsonId: vjsonId,
  10800. dragType: dragType
  10801. });
  10802. }
  10803. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10804. };
  10805. /**
  10806. * 选中某个选项
  10807. */
  10808. ViewDesign.prototype.setSelection = function (id) {
  10809. var _a, _b;
  10810. if (!this.designElement) {
  10811. return;
  10812. }
  10813. // 清空选中内容
  10814. this.clearSelection();
  10815. if (!id) {
  10816. return;
  10817. }
  10818. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10819. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10820. rect.x = position.x;
  10821. rect.y = position.y;
  10822. this.appendMaskbox(rect, id);
  10823. };
  10824. /**
  10825. * 删除组件
  10826. * @param id
  10827. */
  10828. ViewDesign.prototype.deleteComponent = function (id) {
  10829. deletVjsonById(this.vjson, id);
  10830. this.moduleObject.modulePage.currentComponentSelectId = null;
  10831. this.setVjson();
  10832. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10833. this.clearSelection();
  10834. };
  10835. ViewDesign.prototype.selectParent = function (id) {
  10836. var pid = getSuperVjsonId(this.vjson, id);
  10837. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10838. this.setSelection(pid);
  10839. };
  10840. // todo ====== 拖拽事件 ======
  10841. ViewDesign.prototype.dragmove = function (node, source, info) {
  10842. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10843. if (!target) {
  10844. return;
  10845. }
  10846. var rect = target.getBoundingClientRect();
  10847. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10848. var extHandle = Ext$1.get(target).component;
  10849. if (!extHandle) {
  10850. return;
  10851. }
  10852. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10853. rect.x = position.x;
  10854. rect.y = position.y;
  10855. this.appendDirection(rect, extHandle.id, direction);
  10856. };
  10857. ViewDesign.prototype.dragend = function (node, source, info) {
  10858. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10859. if (!target) {
  10860. return;
  10861. }
  10862. var rect = target.getBoundingClientRect();
  10863. var extHandle = Ext$1.get(target).component;
  10864. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10865. if (!extHandle) {
  10866. return;
  10867. }
  10868. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10869. this.removeDirection();
  10870. };
  10871. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10872. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10873. var cv = findInCode(this.vjson, vjsonId);
  10874. if (this.$direction) {
  10875. $$1('#direction' + this.id).remove();
  10876. }
  10877. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10878. //
  10879. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10880. if (direction) {
  10881. if (direction === "top") {
  10882. // direction = 'center'
  10883. height = height / 4;
  10884. }
  10885. else if (direction === "bottom") {
  10886. // direction = 'center'
  10887. top = top + height / 4 * 3;
  10888. height = height / 4;
  10889. }
  10890. else if (direction === "left") {
  10891. width = width / 4;
  10892. }
  10893. else if (direction === "right") {
  10894. left = left + width / 4 * 3;
  10895. width = width / 4;
  10896. }
  10897. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10898. this.$direction.css({
  10899. position: 'absolute',
  10900. top: top, left: left, width: width, height: height,
  10901. // border: '2px dashed #1890ff',
  10902. background: 'rgba(40,224,218,0.75)',
  10903. zIndex: 100,
  10904. });
  10905. this.$direction.appendTo(this.$overlay);
  10906. // }
  10907. }
  10908. };
  10909. ViewDesign.prototype.removeDirection = function () {
  10910. if (this.$direction) {
  10911. this.$direction.remove();
  10912. this.$direction = null;
  10913. }
  10914. };
  10915. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10916. var arrS;
  10917. if (sourceVjId) {
  10918. arrS = findArrayContainer(this.vjson, sourceVjId);
  10919. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10920. var indexS = _$1.findIndex(arrS, function (v) {
  10921. return v.id === sourceVjId;
  10922. });
  10923. if (indexS < 0) {
  10924. return;
  10925. }
  10926. }
  10927. delete sourceVjson.id;
  10928. var vjsonT = findInCode(this.vjson, targetVjId);
  10929. var arrT = findArrayContainer(this.vjson, targetVjId);
  10930. var indexT = _$1.findIndex(arrT, function (v) {
  10931. return v.id === targetVjId;
  10932. });
  10933. if (indexT < 0) {
  10934. return;
  10935. }
  10936. switch (direction) {
  10937. case 'top':
  10938. case 'left':
  10939. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10940. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10941. vjsonT.items.splice(0, 0, sourceVjson);
  10942. }
  10943. else {
  10944. arrT.splice(indexT, 0, sourceVjson);
  10945. }
  10946. break;
  10947. case 'bottom':
  10948. case 'right':
  10949. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10950. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10951. vjsonT.items.push(sourceVjson);
  10952. }
  10953. else {
  10954. arrT.splice(indexT + 1, 0, sourceVjson);
  10955. }
  10956. break;
  10957. case 'center':
  10958. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10959. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10960. vjsonT.items.push(sourceVjson);
  10961. }
  10962. else {
  10963. arrT.splice(indexT, 1, sourceVjson);
  10964. }
  10965. break;
  10966. }
  10967. if (sourceVjId) {
  10968. deletVjsonById(this.vjson, sourceVjId);
  10969. sourceVjson.id = sourceVjId;
  10970. }
  10971. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10972. };
  10973. // todo ======== 事件 ==========
  10974. // 接收 postMessage 事件分发
  10975. ViewDesign.prototype.onMessageEvent = function (event) {
  10976. var _a, _b;
  10977. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10978. if (fucName && typeof this[fucName] === 'function') {
  10979. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10980. }
  10981. };
  10982. // 接收外部选中组件事件
  10983. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10984. if (from !== this.name) {
  10985. this.setSelection(id);
  10986. }
  10987. };
  10988. // 接收外部组件删除事件
  10989. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10990. if (from !== this.name) {
  10991. this.deleteComponent(id);
  10992. }
  10993. };
  10994. // 组件被选中
  10995. ViewDesign.prototype.onComponentSelect = function (args) {
  10996. if (args[2] != this.moduleId) {
  10997. return;
  10998. }
  10999. if (args[0]) {
  11000. var rect = args[0];
  11001. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11002. rect.x = position.x;
  11003. rect.y = position.y;
  11004. this.clearSelection();
  11005. this.appendMaskbox(rect, args[1]);
  11006. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  11007. }
  11008. };
  11009. ViewDesign.prototype.onComponentInfo = function (_a) {
  11010. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  11011. if (moduleId != this.moduleId) {
  11012. return;
  11013. }
  11014. if (rect) {
  11015. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11016. rect.x = position.x;
  11017. rect.y = position.y;
  11018. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  11019. var cv_1 = findInCode(this.vjson, vjsonId);
  11020. if (this.$direction) {
  11021. $$1('#direction' + this.id).remove();
  11022. }
  11023. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  11024. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  11025. if (direction) {
  11026. if (direction === "top") {
  11027. direction = 'center';
  11028. //height = height/3
  11029. }
  11030. else if (direction === "bottom") {
  11031. direction = 'center';
  11032. // top=top+height/3*2
  11033. // height = height/3
  11034. }
  11035. else if (direction === "left") {
  11036. width = width / 3;
  11037. }
  11038. else if (direction === "right") {
  11039. left = left + width / 3 * 2;
  11040. width = width / 3;
  11041. }
  11042. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11043. this.$direction.css({
  11044. position: 'absolute',
  11045. top: top, left: left, width: width, height: height,
  11046. // border: '2px dashed #1890ff',
  11047. background: 'rgba(74,106,201,0.42)',
  11048. zIndex: 100,
  11049. });
  11050. this.$direction.appendTo(this.$overlay);
  11051. }
  11052. }
  11053. console.log("direction", direction);
  11054. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11055. // rect.x = position.x
  11056. // rect.y = position.y
  11057. // this.clearSelection()
  11058. // this.appendMaskbox(rect, args[1])
  11059. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11060. }
  11061. };
  11062. ViewDesign.prototype.onUndo = function () {
  11063. if (this.undoVjsonList.length > 0) {
  11064. if (this.redoVjsonList.length >= 100) {
  11065. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11066. }
  11067. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11068. this.vjson = this.undoVjsonList.pop();
  11069. // this.setVjson(this.vjson, "", false, "undo")
  11070. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11071. }
  11072. };
  11073. ViewDesign.prototype.onRedo = function () {
  11074. if (this.redoVjsonList.length > 0) {
  11075. if (this.undoVjsonList.length >= 100) {
  11076. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11077. }
  11078. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11079. this.vjson = this.redoVjsonList.pop();
  11080. // this.setVjson(this.vjson, "", false, "redo")
  11081. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11082. }
  11083. };
  11084. ViewDesign.prototype.onKeyPress = function (event) {
  11085. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11086. // if (this.backStep()) {
  11087. // event.stopPropagation()
  11088. // event.preventDefault()
  11089. // return
  11090. // }
  11091. // }
  11092. //
  11093. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11094. // if (this.recoverStep()) {
  11095. // event.stopPropagation()
  11096. // event.preventDefault()
  11097. // return
  11098. // }
  11099. // }
  11100. // if (event.key === 'ArrowUp') {
  11101. // if (this.selectParent()) {
  11102. // event.stopPropagation()
  11103. // event.preventDefault()
  11104. // return;
  11105. // }
  11106. // }
  11107. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11108. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11109. event.stopPropagation();
  11110. event.preventDefault();
  11111. return;
  11112. }
  11113. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11114. // if (this.copyView()) {
  11115. // event.stopPropagation()
  11116. // event.preventDefault()
  11117. // return;
  11118. // }
  11119. // }
  11120. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11121. // if (this.copyView(true)) {
  11122. // event.stopPropagation()
  11123. // event.preventDefault()
  11124. // return;
  11125. // }
  11126. // }
  11127. //
  11128. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11129. // if (this.selectRoot()) {
  11130. // event.stopPropagation()
  11131. // event.preventDefault()
  11132. // return;
  11133. // }
  11134. //
  11135. };
  11136. ViewDesign.prototype.onCopy = function (event) {
  11137. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11138. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11139. if (copyVjson) {
  11140. removeDesignProp(copyVjson);
  11141. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11142. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11143. }
  11144. }
  11145. };
  11146. ViewDesign.prototype.onPaste = function (event) {
  11147. debugger;
  11148. };
  11149. ViewDesign.prototype.onfocus = function () {
  11150. console.log("getCopy");
  11151. console.log("document.activeElement", document.activeElement.id);
  11152. // clearTimeout(this.getOuterCopyValueTimer);
  11153. // native.clipboardRead()
  11154. };
  11155. ViewDesign.prototype.onMousemove = function (event) {
  11156. var _a;
  11157. if (document.activeElement.id === this.$overlay[0].id) {
  11158. // console.log(event.clientX, event.clientY)
  11159. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11160. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11161. // this.iframeWindow.postMessage({
  11162. // method: 'overlayGetInfo',
  11163. // args: [position, this.moduleId]
  11164. // }, '*')
  11165. }
  11166. }
  11167. };
  11168. ViewDesign.prototype.onDestroy = function () {
  11169. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11170. for (var i = 0; i < this.subscribeList.length; i++) {
  11171. this.subscribeList[i].cancel();
  11172. }
  11173. };
  11174. // todo ======== 工具方法 ==========
  11175. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11176. if (relative === void 0) { relative = null; }
  11177. if (from === "main" && to === "overlay") {
  11178. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11179. var x = overlayRect.x;
  11180. var y = overlayRect.y;
  11181. if (relative) {
  11182. var relativeRect = relative.getBoundingClientRect();
  11183. console.log("main->", relativeRect.x, relativeRect.y);
  11184. x = x - relativeRect.x;
  11185. y = y - relativeRect.y;
  11186. }
  11187. pos.x = pos.x - x;
  11188. pos.y = pos.y - y;
  11189. }
  11190. else if (from === "overlay" && to === "main") {
  11191. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11192. var x = overlayRect.x;
  11193. var y = overlayRect.y;
  11194. if (relative) {
  11195. var relativeRect = relative.getBoundingClientRect();
  11196. console.log("iframe->", relativeRect.x, relativeRect.y);
  11197. x = x - relativeRect.x;
  11198. y = y - relativeRect.y;
  11199. }
  11200. pos.x = pos.x + x;
  11201. pos.y = pos.y + y;
  11202. }
  11203. return pos;
  11204. };
  11205. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11206. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11207. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11208. return "center";
  11209. }
  11210. // col-item 只能放左右
  11211. if (dragType === "col-item" || dragType === "") {
  11212. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11213. if (x > rect.x && x < rect.x + rect.width / 3) {
  11214. return "left";
  11215. }
  11216. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11217. return "right";
  11218. }
  11219. }
  11220. }
  11221. // cols-container 只能放上下
  11222. if (dragType === "cols-container" || dragType === "") {
  11223. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11224. if (y > rect.y && y < rect.y + rect.height / 3) {
  11225. return "top";
  11226. }
  11227. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11228. return "bottom";
  11229. }
  11230. }
  11231. }
  11232. return "";
  11233. };
  11234. return ViewDesign;
  11235. }());
  11236. //
  11237. //# sourceMappingURL=ViewDesign.js.map
  11238. var model$8 = {
  11239. data: {
  11240. iframeSrc: ''
  11241. }
  11242. };
  11243. //# sourceMappingURL=ModulePage.model.js.map
  11244. var vjson$8 = {
  11245. layout: 'fit',
  11246. border: false,
  11247. iconCls: 'x-fa fa-newspaper-o',
  11248. referenceHolder: true,
  11249. items: [
  11250. {
  11251. layout: 'border',
  11252. border: false,
  11253. items: [
  11254. {
  11255. region: 'center',
  11256. xtype: 'tabpanel',
  11257. border: false,
  11258. tabPosition: 'bottom',
  11259. reference: 'tabPanel',
  11260. listeners: {
  11261. tabchange: 'scope.tabchange'
  11262. },
  11263. defaults: {
  11264. border: false,
  11265. },
  11266. items: [
  11267. {
  11268. title: 'controller.js',
  11269. xtype: 'jseditor',
  11270. reference: 'controllerEditor',
  11271. },
  11272. {
  11273. title: 'view.design',
  11274. xtype: 'designer',
  11275. reference: 'designer',
  11276. listeners: {
  11277. afterrender: 'scope.previewRender'
  11278. },
  11279. },
  11280. {
  11281. title: 'view.js',
  11282. xtype: 'jseditor',
  11283. reference: 'viewEditor',
  11284. },
  11285. {
  11286. title: 'model.js',
  11287. xtype: 'jseditor',
  11288. reference: 'modelEditor',
  11289. },
  11290. {
  11291. title: 'groovy',
  11292. xtype: 'groovyeditor',
  11293. reference: 'groovyEditor',
  11294. },
  11295. {
  11296. title: 'SQL',
  11297. xtype: 'sqleditor',
  11298. reference: 'sqlEditor',
  11299. }
  11300. ]
  11301. }
  11302. ]
  11303. }
  11304. ]
  11305. };
  11306. //# sourceMappingURL=ModulePage.view.js.map
  11307. var ModulePage = /** @class */ (function (_super) {
  11308. __extends(ModulePage, _super);
  11309. function ModulePage(moduleId, module) {
  11310. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11311. _this.name = "ModulePage";
  11312. _this.viewDesign = null;
  11313. _this.maxViewId = 0;
  11314. _this.moduleEventBus = new EventBus();
  11315. _this.codeChange = _$2.debounce(function (code, from, e) {
  11316. try {
  11317. switch (from) {
  11318. case _this.refs.controllerEditor.name:
  11319. moduleStore.updateJsController(_this.moduleId, code, from);
  11320. break;
  11321. case _this.refs.viewEditor.name:
  11322. moduleStore.updateJsView(_this.moduleId, code, from);
  11323. break;
  11324. case _this.refs.modelEditor.name:
  11325. moduleStore.updateJsModel(_this.moduleId, code, from);
  11326. break;
  11327. case _this.refs.groovyEditor.name:
  11328. moduleStore.updateGroovy(_this.moduleId, code, from);
  11329. break;
  11330. case _this.refs.sqlEditor.name:
  11331. moduleStore.updateMybatis(_this.moduleId, code, from);
  11332. break;
  11333. }
  11334. }
  11335. catch (e) {
  11336. }
  11337. }, 500, { maxWait: 10000 });
  11338. _this.moduleId = moduleId;
  11339. _this.module = module;
  11340. _this.cancelSubscribe = [];
  11341. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11342. _this.initEditor(moduleItem);
  11343. }));
  11344. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11345. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11346. _this.previewReRender();
  11347. }));
  11348. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11349. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11350. _this.updateVjson(vjson, from, ignoreRenderUI);
  11351. }));
  11352. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11353. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11354. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11355. }));
  11356. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11357. var id = _a.id, from = _a.from;
  11358. _this.onComponentSelectionChange(id, from);
  11359. }));
  11360. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11361. _this.onUndo();
  11362. }));
  11363. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11364. _this.onRedo();
  11365. }));
  11366. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11367. _this.currentCopyVjson = stringToJsonObj(value);
  11368. }));
  11369. return _this;
  11370. }
  11371. ModulePage.prototype.onLoad = function () {
  11372. var _this = this;
  11373. // this.refs.preview.src = href
  11374. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11375. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11376. _this.saveCall();
  11377. }));
  11378. this.activeEditor = this.refs.controllerEditor;
  11379. this.refs.controllerEditor.modulePage = this;
  11380. this.refs.viewEditor.modulePage = this;
  11381. this.refs.modelEditor.modulePage = this;
  11382. this.refs.groovyEditor.modulePage = this;
  11383. this.refs.sqlEditor.modulePage = this;
  11384. this.refs.controllerEditor.name = "controllerEditor";
  11385. this.refs.viewEditor.name = "viewEditor";
  11386. this.refs.modelEditor.name = "modelEditor";
  11387. this.refs.groovyEditor.name = "groovyEditor";
  11388. this.refs.sqlEditor.name = "sqlEditor";
  11389. this.refs.controllerEditor.codeChange = this.codeChange;
  11390. this.refs.viewEditor.codeChange = this.codeChange;
  11391. this.refs.modelEditor.codeChange = this.codeChange;
  11392. this.refs.groovyEditor.codeChange = this.codeChange;
  11393. this.refs.sqlEditor.codeChange = this.codeChange;
  11394. };
  11395. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11396. if (!cmpVjson || from === this.name) {
  11397. return;
  11398. }
  11399. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11400. replaceVjsonById(vj, cmpVjson);
  11401. this.updateVjson(vj, from, ignoreRenderUI);
  11402. };
  11403. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11404. var _this = this;
  11405. var _a, _b;
  11406. if (!vjson || from === this.name) {
  11407. return;
  11408. }
  11409. this.addViewId(vjson);
  11410. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11411. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11412. (_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);
  11413. this.previewReRender();
  11414. _$2.defer(function () {
  11415. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11416. });
  11417. };
  11418. ModulePage.prototype.previewRender = function (sender) {
  11419. var _this = this;
  11420. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11421. if (!this.designScope) {
  11422. this.designScope = new Scope({
  11423. vjson: vjson,
  11424. model: {
  11425. data: {}
  11426. }
  11427. });
  11428. }
  11429. else {
  11430. this.designScope.vjson = vjson;
  11431. }
  11432. this.designScope.showDesigner(sender, {
  11433. moduleId: this.moduleId,
  11434. });
  11435. if (this.viewDesign) {
  11436. return;
  11437. }
  11438. _$2.defer(function () {
  11439. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11440. handles$1.mainWindow.setLoading(false);
  11441. });
  11442. };
  11443. ModulePage.prototype.previewReRender = function () {
  11444. var designer = this.refs.designer;
  11445. this.previewRender(designer);
  11446. };
  11447. ModulePage.prototype.initEditor = function (moduleItem) {
  11448. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11449. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11450. return;
  11451. (_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);
  11452. (_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);
  11453. (_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);
  11454. (_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);
  11455. (_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);
  11456. };
  11457. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11458. this.currentComponentSelectId = id;
  11459. };
  11460. ModulePage.prototype.onUndo = function () {
  11461. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11462. this.viewDesign.onUndo();
  11463. }
  11464. };
  11465. ModulePage.prototype.onRedo = function () {
  11466. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11467. this.viewDesign.onRedo();
  11468. }
  11469. };
  11470. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11471. this.activeEditor = newCard;
  11472. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11473. };
  11474. ModulePage.prototype.saveCall = function () {
  11475. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11476. moduleStore.saveFile(this.moduleId, "jsView");
  11477. }
  11478. else if (this.activeEditor === this.refs.controllerEditor) {
  11479. moduleStore.saveFile(this.moduleId, "jsController");
  11480. }
  11481. else if (this.activeEditor === this.refs.modelEditor) {
  11482. moduleStore.saveFile(this.moduleId, "jsModel");
  11483. }
  11484. else if (this.activeEditor === this.refs.groovyEditor) {
  11485. moduleStore.saveFile(this.moduleId, "groovy");
  11486. }
  11487. else if (this.activeEditor === this.refs.sqlEditor) {
  11488. moduleStore.saveFile(this.moduleId, "mybatis");
  11489. }
  11490. };
  11491. ModulePage.prototype.check = function () {
  11492. moduleStore.check(this.moduleId);
  11493. };
  11494. /**
  11495. * 为vjson添加id
  11496. * @param vjson
  11497. * @param isAll
  11498. */
  11499. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11500. var _this = this;
  11501. if (isAll === void 0) { isAll = false; }
  11502. var maxIdTag = 0;
  11503. // 先提取当前的最大id
  11504. deepTravVJson(vjson, function (obj) {
  11505. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11506. return;
  11507. }
  11508. if (obj.id && obj.id.indexOf(idPrefix)) {
  11509. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11510. if (sutr.length > 0) {
  11511. var tid = sutr.replace(idPrefix, "");
  11512. var idNum = parseInt(tid);
  11513. if (idNum && maxIdTag < idNum) {
  11514. maxIdTag = idNum;
  11515. }
  11516. }
  11517. }
  11518. });
  11519. // 标记最大的id号,避免重复
  11520. this.maxViewId = maxIdTag;
  11521. deepTravVJson(vjson, function (obj) {
  11522. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11523. return;
  11524. }
  11525. if (!obj.hasOwnProperty('id')) {
  11526. obj.id = _this.createViewId();
  11527. }
  11528. if (!obj.hasOwnProperty('designMode')) {
  11529. obj.designMode = true;
  11530. }
  11531. // if (obj.xtype == "tabview" && obj.activeTab) {
  11532. // // 设置默认的选项
  11533. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11534. // if (typeof obj.activeTab === 'number') {
  11535. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11536. // } else if (typeof obj.activeTab === 'string') {
  11537. // this._tabViewSelect[obj.id] = obj.activeTab
  11538. // }
  11539. //
  11540. // }
  11541. // }
  11542. if (isAll && obj.hasOwnProperty("view")) ;
  11543. });
  11544. return vjson;
  11545. };
  11546. /**
  11547. * 为组件创建 ID
  11548. */
  11549. ModulePage.prototype.createViewId = function () {
  11550. this.maxViewId++;
  11551. return this.id + idPrefix + this.maxViewId;
  11552. };
  11553. ModulePage.prototype.onDestroy = function () {
  11554. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11555. this.cancelSubscribe[i].cancel();
  11556. }
  11557. _super.prototype.onDestroy.call(this);
  11558. };
  11559. return ModulePage;
  11560. }(Scope));
  11561. //# sourceMappingURL=ModulePage.js.map
  11562. var camundaModdleDescriptor = {
  11563. "name": "Camunda",
  11564. "uri": "http://camunda.org/schema/1.0/bpmn",
  11565. "prefix": "camunda",
  11566. "xml": {
  11567. "tagAlias": "lowerCase"
  11568. },
  11569. "associations": [],
  11570. "types": [
  11571. {
  11572. "name": "Definitions",
  11573. "isAbstract": true,
  11574. "extends": [
  11575. "bpmn:Definitions"
  11576. ],
  11577. "properties": [
  11578. {
  11579. "name": "diagramRelationId",
  11580. "isAttr": true,
  11581. "type": "String"
  11582. }
  11583. ]
  11584. },
  11585. {
  11586. "name": "InOutBinding",
  11587. "superClass": [
  11588. "Element"
  11589. ],
  11590. "isAbstract": true,
  11591. "properties": [
  11592. {
  11593. "name": "source",
  11594. "isAttr": true,
  11595. "type": "String"
  11596. },
  11597. {
  11598. "name": "sourceExpression",
  11599. "isAttr": true,
  11600. "type": "String"
  11601. },
  11602. {
  11603. "name": "target",
  11604. "isAttr": true,
  11605. "type": "String"
  11606. },
  11607. {
  11608. "name": "businessKey",
  11609. "isAttr": true,
  11610. "type": "String"
  11611. },
  11612. {
  11613. "name": "local",
  11614. "isAttr": true,
  11615. "type": "Boolean",
  11616. "default": false
  11617. },
  11618. {
  11619. "name": "variables",
  11620. "isAttr": true,
  11621. "type": "String"
  11622. }
  11623. ]
  11624. },
  11625. {
  11626. "name": "In",
  11627. "superClass": [
  11628. "InOutBinding"
  11629. ],
  11630. "meta": {
  11631. "allowedIn": [
  11632. "bpmn:CallActivity",
  11633. "bpmn:SignalEventDefinition"
  11634. ]
  11635. }
  11636. },
  11637. {
  11638. "name": "Out",
  11639. "superClass": [
  11640. "InOutBinding"
  11641. ],
  11642. "meta": {
  11643. "allowedIn": [
  11644. "bpmn:CallActivity"
  11645. ]
  11646. }
  11647. },
  11648. {
  11649. "name": "AsyncCapable",
  11650. "isAbstract": true,
  11651. "extends": [
  11652. "bpmn:Activity",
  11653. "bpmn:Gateway",
  11654. "bpmn:Event"
  11655. ],
  11656. "properties": [
  11657. {
  11658. "name": "async",
  11659. "isAttr": true,
  11660. "type": "Boolean",
  11661. "default": false
  11662. },
  11663. {
  11664. "name": "asyncBefore",
  11665. "isAttr": true,
  11666. "type": "Boolean",
  11667. "default": false
  11668. },
  11669. {
  11670. "name": "asyncAfter",
  11671. "isAttr": true,
  11672. "type": "Boolean",
  11673. "default": false
  11674. },
  11675. {
  11676. "name": "exclusive",
  11677. "isAttr": true,
  11678. "type": "Boolean",
  11679. "default": true
  11680. }
  11681. ]
  11682. },
  11683. {
  11684. "name": "JobPriorized",
  11685. "isAbstract": true,
  11686. "extends": [
  11687. "bpmn:Process",
  11688. "camunda:AsyncCapable"
  11689. ],
  11690. "properties": [
  11691. {
  11692. "name": "jobPriority",
  11693. "isAttr": true,
  11694. "type": "String"
  11695. }
  11696. ]
  11697. },
  11698. {
  11699. "name": "SignalEventDefinitionExtension",
  11700. "isAbstract": true,
  11701. "extends": [
  11702. "bpmn:SignalEventDefinition"
  11703. ],
  11704. "properties": [
  11705. {
  11706. "name": "async",
  11707. "isAttr": true,
  11708. "type": "Boolean",
  11709. "default": false
  11710. }
  11711. ]
  11712. },
  11713. {
  11714. "name": "ErrorEventDefinitionExtension",
  11715. "isAbstract": true,
  11716. "extends": [
  11717. "bpmn:ErrorEventDefinition"
  11718. ],
  11719. "properties": [
  11720. {
  11721. "name": "errorCodeVariable",
  11722. "isAttr": true,
  11723. "type": "String"
  11724. },
  11725. {
  11726. "name": "errorMessageVariable",
  11727. "isAttr": true,
  11728. "type": "String"
  11729. }
  11730. ]
  11731. },
  11732. {
  11733. "name": "ErrorEventDefinition",
  11734. "superClass": [
  11735. "bpmn:ErrorEventDefinition",
  11736. "Element"
  11737. ],
  11738. "properties": [
  11739. {
  11740. "name": "expression",
  11741. "isAttr": true,
  11742. "type": "String"
  11743. }
  11744. ],
  11745. "meta": {
  11746. "allowedIn": ["bpmn:ServiceTask"]
  11747. }
  11748. },
  11749. {
  11750. "name": "Error",
  11751. "isAbstract": true,
  11752. "extends": [
  11753. "bpmn:Error"
  11754. ],
  11755. "properties": [
  11756. {
  11757. "name": "camunda:errorMessage",
  11758. "isAttr": true,
  11759. "type": "String"
  11760. }
  11761. ]
  11762. },
  11763. {
  11764. "name": "PotentialStarter",
  11765. "superClass": [
  11766. "Element"
  11767. ],
  11768. "properties": [
  11769. {
  11770. "name": "resourceAssignmentExpression",
  11771. "type": "bpmn:ResourceAssignmentExpression"
  11772. }
  11773. ]
  11774. },
  11775. {
  11776. "name": "FormSupported",
  11777. "isAbstract": true,
  11778. "extends": [
  11779. "bpmn:StartEvent",
  11780. "bpmn:UserTask"
  11781. ],
  11782. "properties": [
  11783. {
  11784. "name": "formHandlerClass",
  11785. "isAttr": true,
  11786. "type": "String"
  11787. },
  11788. {
  11789. "name": "formKey",
  11790. "isAttr": true,
  11791. "type": "String"
  11792. },
  11793. {
  11794. "name": "formRef",
  11795. "isAttr": true,
  11796. "type": "String"
  11797. },
  11798. {
  11799. "name": "formRefBinding",
  11800. "isAttr": true,
  11801. "type": "String"
  11802. },
  11803. {
  11804. "name": "formRefVersion",
  11805. "isAttr": true,
  11806. "type": "String"
  11807. }
  11808. ]
  11809. },
  11810. {
  11811. "name": "TemplateSupported",
  11812. "isAbstract": true,
  11813. "extends": [
  11814. "bpmn:Collaboration",
  11815. "bpmn:Process",
  11816. "bpmn:FlowElement"
  11817. ],
  11818. "properties": [
  11819. {
  11820. "name": "modelerTemplate",
  11821. "isAttr": true,
  11822. "type": "String"
  11823. },
  11824. {
  11825. "name": "modelerTemplateVersion",
  11826. "isAttr": true,
  11827. "type": "Integer"
  11828. }
  11829. ]
  11830. },
  11831. {
  11832. "name": "Initiator",
  11833. "isAbstract": true,
  11834. "extends": ["bpmn:StartEvent"],
  11835. "properties": [
  11836. {
  11837. "name": "initiator",
  11838. "isAttr": true,
  11839. "type": "String"
  11840. }
  11841. ]
  11842. },
  11843. {
  11844. "name": "ScriptTask",
  11845. "isAbstract": true,
  11846. "extends": [
  11847. "bpmn:ScriptTask"
  11848. ],
  11849. "properties": [
  11850. {
  11851. "name": "resultVariable",
  11852. "isAttr": true,
  11853. "type": "String"
  11854. },
  11855. {
  11856. "name": "resource",
  11857. "isAttr": true,
  11858. "type": "String"
  11859. }
  11860. ]
  11861. },
  11862. {
  11863. "name": "Process",
  11864. "isAbstract": true,
  11865. "extends": [
  11866. "bpmn:Process"
  11867. ],
  11868. "properties": [
  11869. {
  11870. "name": "candidateStarterGroups",
  11871. "isAttr": true,
  11872. "type": "String"
  11873. },
  11874. {
  11875. "name": "candidateStarterUsers",
  11876. "isAttr": true,
  11877. "type": "String"
  11878. },
  11879. {
  11880. "name": "versionTag",
  11881. "isAttr": true,
  11882. "type": "String"
  11883. },
  11884. {
  11885. "name": "historyTimeToLive",
  11886. "isAttr": true,
  11887. "type": "String"
  11888. },
  11889. {
  11890. "name": "isStartableInTasklist",
  11891. "isAttr": true,
  11892. "type": "Boolean",
  11893. "default": true
  11894. }
  11895. ]
  11896. },
  11897. {
  11898. "name": "EscalationEventDefinitionExtension",
  11899. "isAbstract": true,
  11900. "extends": [
  11901. "bpmn:EscalationEventDefinition"
  11902. ],
  11903. "properties": [
  11904. {
  11905. "name": "escalationCodeVariable",
  11906. "isAttr": true,
  11907. "type": "String"
  11908. }
  11909. ]
  11910. },
  11911. {
  11912. "name": "FormalExpression",
  11913. "isAbstract": true,
  11914. "extends": [
  11915. "bpmn:FormalExpression"
  11916. ],
  11917. "properties": [
  11918. {
  11919. "name": "resource",
  11920. "isAttr": true,
  11921. "type": "String"
  11922. }
  11923. ]
  11924. },
  11925. {
  11926. "name": "Assignable",
  11927. "extends": ["bpmn:UserTask"],
  11928. "properties": [
  11929. {
  11930. "name": "assignee",
  11931. "isAttr": true,
  11932. "type": "String"
  11933. },
  11934. {
  11935. "name": "candidateUsers",
  11936. "isAttr": true,
  11937. "type": "String"
  11938. },
  11939. {
  11940. "name": "candidateGroups",
  11941. "isAttr": true,
  11942. "type": "String"
  11943. },
  11944. {
  11945. "name": "dueDate",
  11946. "isAttr": true,
  11947. "type": "String"
  11948. },
  11949. {
  11950. "name": "followUpDate",
  11951. "isAttr": true,
  11952. "type": "String"
  11953. },
  11954. {
  11955. "name": "priority",
  11956. "isAttr": true,
  11957. "type": "String"
  11958. }
  11959. ]
  11960. },
  11961. {
  11962. "name": "CallActivity",
  11963. "extends": ["bpmn:CallActivity"],
  11964. "properties": [
  11965. {
  11966. "name": "calledElementBinding",
  11967. "isAttr": true,
  11968. "type": "String",
  11969. "default": "latest"
  11970. },
  11971. {
  11972. "name": "calledElementVersion",
  11973. "isAttr": true,
  11974. "type": "String"
  11975. },
  11976. {
  11977. "name": "calledElementVersionTag",
  11978. "isAttr": true,
  11979. "type": "String"
  11980. },
  11981. {
  11982. "name": "calledElementTenantId",
  11983. "isAttr": true,
  11984. "type": "String"
  11985. },
  11986. {
  11987. "name": "caseRef",
  11988. "isAttr": true,
  11989. "type": "String"
  11990. },
  11991. {
  11992. "name": "caseBinding",
  11993. "isAttr": true,
  11994. "type": "String",
  11995. "default": "latest"
  11996. },
  11997. {
  11998. "name": "caseVersion",
  11999. "isAttr": true,
  12000. "type": "String"
  12001. },
  12002. {
  12003. "name": "caseTenantId",
  12004. "isAttr": true,
  12005. "type": "String"
  12006. },
  12007. {
  12008. "name": "variableMappingClass",
  12009. "isAttr": true,
  12010. "type": "String"
  12011. },
  12012. {
  12013. "name": "variableMappingDelegateExpression",
  12014. "isAttr": true,
  12015. "type": "String"
  12016. }
  12017. ]
  12018. },
  12019. {
  12020. "name": "ServiceTaskLike",
  12021. "extends": [
  12022. "bpmn:ServiceTask",
  12023. "bpmn:BusinessRuleTask",
  12024. "bpmn:SendTask",
  12025. "bpmn:MessageEventDefinition"
  12026. ],
  12027. "properties": [
  12028. {
  12029. "name": "expression",
  12030. "isAttr": true,
  12031. "type": "String"
  12032. },
  12033. {
  12034. "name": "class",
  12035. "isAttr": true,
  12036. "type": "String"
  12037. },
  12038. {
  12039. "name": "delegateExpression",
  12040. "isAttr": true,
  12041. "type": "String"
  12042. },
  12043. {
  12044. "name": "resultVariable",
  12045. "isAttr": true,
  12046. "type": "String"
  12047. }
  12048. ]
  12049. },
  12050. {
  12051. "name": "DmnCapable",
  12052. "extends": [
  12053. "bpmn:BusinessRuleTask"
  12054. ],
  12055. "properties": [
  12056. {
  12057. "name": "decisionRef",
  12058. "isAttr": true,
  12059. "type": "String"
  12060. },
  12061. {
  12062. "name": "decisionRefBinding",
  12063. "isAttr": true,
  12064. "type": "String",
  12065. "default": "latest"
  12066. },
  12067. {
  12068. "name": "decisionRefVersion",
  12069. "isAttr": true,
  12070. "type": "String"
  12071. },
  12072. {
  12073. "name": "mapDecisionResult",
  12074. "isAttr": true,
  12075. "type": "String",
  12076. "default": "resultList"
  12077. },
  12078. {
  12079. "name": "decisionRefTenantId",
  12080. "isAttr": true,
  12081. "type": "String"
  12082. }
  12083. ]
  12084. },
  12085. {
  12086. "name": "ExternalCapable",
  12087. "extends": [
  12088. "camunda:ServiceTaskLike"
  12089. ],
  12090. "properties": [
  12091. {
  12092. "name": "type",
  12093. "isAttr": true,
  12094. "type": "String"
  12095. },
  12096. {
  12097. "name": "topic",
  12098. "isAttr": true,
  12099. "type": "String"
  12100. }
  12101. ]
  12102. },
  12103. {
  12104. "name": "TaskPriorized",
  12105. "extends": [
  12106. "bpmn:Process",
  12107. "camunda:ExternalCapable"
  12108. ],
  12109. "properties": [
  12110. {
  12111. "name": "taskPriority",
  12112. "isAttr": true,
  12113. "type": "String"
  12114. }
  12115. ]
  12116. },
  12117. {
  12118. "name": "Properties",
  12119. "superClass": [
  12120. "Element"
  12121. ],
  12122. "meta": {
  12123. "allowedIn": ["*"]
  12124. },
  12125. "properties": [
  12126. {
  12127. "name": "values",
  12128. "type": "Property",
  12129. "isMany": true
  12130. }
  12131. ]
  12132. },
  12133. {
  12134. "name": "Property",
  12135. "superClass": [
  12136. "Element"
  12137. ],
  12138. "properties": [
  12139. {
  12140. "name": "id",
  12141. "type": "String",
  12142. "isAttr": true
  12143. },
  12144. {
  12145. "name": "name",
  12146. "type": "String",
  12147. "isAttr": true
  12148. },
  12149. {
  12150. "name": "value",
  12151. "type": "String",
  12152. "isAttr": true
  12153. }
  12154. ]
  12155. },
  12156. {
  12157. "name": "Connector",
  12158. "superClass": [
  12159. "Element"
  12160. ],
  12161. "meta": {
  12162. "allowedIn": [
  12163. "camunda:ServiceTaskLike"
  12164. ]
  12165. },
  12166. "properties": [
  12167. {
  12168. "name": "inputOutput",
  12169. "type": "InputOutput"
  12170. },
  12171. {
  12172. "name": "connectorId",
  12173. "type": "String"
  12174. }
  12175. ]
  12176. },
  12177. {
  12178. "name": "InputOutput",
  12179. "superClass": [
  12180. "Element"
  12181. ],
  12182. "meta": {
  12183. "allowedIn": [
  12184. "bpmn:FlowNode",
  12185. "camunda:Connector"
  12186. ]
  12187. },
  12188. "properties": [
  12189. {
  12190. "name": "inputOutput",
  12191. "type": "InputOutput"
  12192. },
  12193. {
  12194. "name": "connectorId",
  12195. "type": "String"
  12196. },
  12197. {
  12198. "name": "inputParameters",
  12199. "isMany": true,
  12200. "type": "InputParameter"
  12201. },
  12202. {
  12203. "name": "outputParameters",
  12204. "isMany": true,
  12205. "type": "OutputParameter"
  12206. }
  12207. ]
  12208. },
  12209. {
  12210. "name": "InputOutputParameter",
  12211. "properties": [
  12212. {
  12213. "name": "name",
  12214. "isAttr": true,
  12215. "type": "String"
  12216. },
  12217. {
  12218. "name": "value",
  12219. "isBody": true,
  12220. "type": "String"
  12221. },
  12222. {
  12223. "name": "definition",
  12224. "type": "InputOutputParameterDefinition"
  12225. }
  12226. ]
  12227. },
  12228. {
  12229. "name": "InputOutputParameterDefinition",
  12230. "isAbstract": true
  12231. },
  12232. {
  12233. "name": "List",
  12234. "superClass": ["InputOutputParameterDefinition"],
  12235. "properties": [
  12236. {
  12237. "name": "items",
  12238. "isMany": true,
  12239. "type": "InputOutputParameterDefinition"
  12240. }
  12241. ]
  12242. },
  12243. {
  12244. "name": "Map",
  12245. "superClass": ["InputOutputParameterDefinition"],
  12246. "properties": [
  12247. {
  12248. "name": "entries",
  12249. "isMany": true,
  12250. "type": "Entry"
  12251. }
  12252. ]
  12253. },
  12254. {
  12255. "name": "Entry",
  12256. "properties": [
  12257. {
  12258. "name": "key",
  12259. "isAttr": true,
  12260. "type": "String"
  12261. },
  12262. {
  12263. "name": "value",
  12264. "isBody": true,
  12265. "type": "String"
  12266. },
  12267. {
  12268. "name": "definition",
  12269. "type": "InputOutputParameterDefinition"
  12270. }
  12271. ]
  12272. },
  12273. {
  12274. "name": "Value",
  12275. "superClass": [
  12276. "InputOutputParameterDefinition"
  12277. ],
  12278. "properties": [
  12279. {
  12280. "name": "id",
  12281. "isAttr": true,
  12282. "type": "String"
  12283. },
  12284. {
  12285. "name": "name",
  12286. "isAttr": true,
  12287. "type": "String"
  12288. },
  12289. {
  12290. "name": "value",
  12291. "isBody": true,
  12292. "type": "String"
  12293. }
  12294. ]
  12295. },
  12296. {
  12297. "name": "Script",
  12298. "superClass": ["InputOutputParameterDefinition"],
  12299. "properties": [
  12300. {
  12301. "name": "scriptFormat",
  12302. "isAttr": true,
  12303. "type": "String"
  12304. },
  12305. {
  12306. "name": "resource",
  12307. "isAttr": true,
  12308. "type": "String"
  12309. },
  12310. {
  12311. "name": "value",
  12312. "isBody": true,
  12313. "type": "String"
  12314. }
  12315. ]
  12316. },
  12317. {
  12318. "name": "Field",
  12319. "superClass": ["Element"],
  12320. "meta": {
  12321. "allowedIn": [
  12322. "camunda:ServiceTaskLike",
  12323. "camunda:ExecutionListener",
  12324. "camunda:TaskListener"
  12325. ]
  12326. },
  12327. "properties": [
  12328. {
  12329. "name": "name",
  12330. "isAttr": true,
  12331. "type": "String"
  12332. },
  12333. {
  12334. "name": "expression",
  12335. "type": "String"
  12336. },
  12337. {
  12338. "name": "stringValue",
  12339. "isAttr": true,
  12340. "type": "String"
  12341. },
  12342. {
  12343. "name": "string",
  12344. "type": "String"
  12345. }
  12346. ]
  12347. },
  12348. {
  12349. "name": "InputParameter",
  12350. "superClass": ["InputOutputParameter"]
  12351. },
  12352. {
  12353. "name": "OutputParameter",
  12354. "superClass": ["InputOutputParameter"]
  12355. },
  12356. {
  12357. "name": "Collectable",
  12358. "isAbstract": true,
  12359. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12360. "superClass": ["camunda:AsyncCapable"],
  12361. "properties": [
  12362. {
  12363. "name": "collection",
  12364. "isAttr": true,
  12365. "type": "String"
  12366. },
  12367. {
  12368. "name": "elementVariable",
  12369. "isAttr": true,
  12370. "type": "String"
  12371. }
  12372. ]
  12373. },
  12374. {
  12375. "name": "FailedJobRetryTimeCycle",
  12376. "superClass": ["Element"],
  12377. "meta": {
  12378. "allowedIn": [
  12379. "camunda:AsyncCapable",
  12380. "bpmn:MultiInstanceLoopCharacteristics"
  12381. ]
  12382. },
  12383. "properties": [
  12384. {
  12385. "name": "body",
  12386. "isBody": true,
  12387. "type": "String"
  12388. }
  12389. ]
  12390. },
  12391. {
  12392. "name": "ExecutionListener",
  12393. "superClass": ["Element"],
  12394. "meta": {
  12395. "allowedIn": [
  12396. "bpmn:Task",
  12397. "bpmn:ServiceTask",
  12398. "bpmn:UserTask",
  12399. "bpmn:BusinessRuleTask",
  12400. "bpmn:ScriptTask",
  12401. "bpmn:ReceiveTask",
  12402. "bpmn:ManualTask",
  12403. "bpmn:ExclusiveGateway",
  12404. "bpmn:SequenceFlow",
  12405. "bpmn:ParallelGateway",
  12406. "bpmn:InclusiveGateway",
  12407. "bpmn:EventBasedGateway",
  12408. "bpmn:StartEvent",
  12409. "bpmn:IntermediateCatchEvent",
  12410. "bpmn:IntermediateThrowEvent",
  12411. "bpmn:EndEvent",
  12412. "bpmn:BoundaryEvent",
  12413. "bpmn:CallActivity",
  12414. "bpmn:SubProcess",
  12415. "bpmn:Process"
  12416. ]
  12417. },
  12418. "properties": [
  12419. {
  12420. "name": "expression",
  12421. "isAttr": true,
  12422. "type": "String"
  12423. },
  12424. {
  12425. "name": "class",
  12426. "isAttr": true,
  12427. "type": "String"
  12428. },
  12429. {
  12430. "name": "delegateExpression",
  12431. "isAttr": true,
  12432. "type": "String"
  12433. },
  12434. {
  12435. "name": "event",
  12436. "isAttr": true,
  12437. "type": "String"
  12438. },
  12439. {
  12440. "name": "script",
  12441. "type": "Script"
  12442. },
  12443. {
  12444. "name": "fields",
  12445. "type": "Field",
  12446. "isMany": true
  12447. }
  12448. ]
  12449. },
  12450. {
  12451. "name": "TaskListener",
  12452. "superClass": ["Element"],
  12453. "meta": {
  12454. "allowedIn": [
  12455. "bpmn:UserTask"
  12456. ]
  12457. },
  12458. "properties": [
  12459. {
  12460. "name": "expression",
  12461. "isAttr": true,
  12462. "type": "String"
  12463. },
  12464. {
  12465. "name": "class",
  12466. "isAttr": true,
  12467. "type": "String"
  12468. },
  12469. {
  12470. "name": "delegateExpression",
  12471. "isAttr": true,
  12472. "type": "String"
  12473. },
  12474. {
  12475. "name": "event",
  12476. "isAttr": true,
  12477. "type": "String"
  12478. },
  12479. {
  12480. "name": "script",
  12481. "type": "Script"
  12482. },
  12483. {
  12484. "name": "fields",
  12485. "type": "Field",
  12486. "isMany": true
  12487. },
  12488. {
  12489. "name": "id",
  12490. "type": "String",
  12491. "isAttr": true
  12492. },
  12493. {
  12494. "name": "eventDefinitions",
  12495. "type": "bpmn:TimerEventDefinition",
  12496. "isMany": true
  12497. }
  12498. ]
  12499. },
  12500. {
  12501. "name": "FormProperty",
  12502. "superClass": ["Element"],
  12503. "meta": {
  12504. "allowedIn": [
  12505. "bpmn:StartEvent",
  12506. "bpmn:UserTask"
  12507. ]
  12508. },
  12509. "properties": [
  12510. {
  12511. "name": "id",
  12512. "type": "String",
  12513. "isAttr": true
  12514. },
  12515. {
  12516. "name": "name",
  12517. "type": "String",
  12518. "isAttr": true
  12519. },
  12520. {
  12521. "name": "type",
  12522. "type": "String",
  12523. "isAttr": true
  12524. },
  12525. {
  12526. "name": "required",
  12527. "type": "String",
  12528. "isAttr": true
  12529. },
  12530. {
  12531. "name": "readable",
  12532. "type": "String",
  12533. "isAttr": true
  12534. },
  12535. {
  12536. "name": "writable",
  12537. "type": "String",
  12538. "isAttr": true
  12539. },
  12540. {
  12541. "name": "variable",
  12542. "type": "String",
  12543. "isAttr": true
  12544. },
  12545. {
  12546. "name": "expression",
  12547. "type": "String",
  12548. "isAttr": true
  12549. },
  12550. {
  12551. "name": "datePattern",
  12552. "type": "String",
  12553. "isAttr": true
  12554. },
  12555. {
  12556. "name": "default",
  12557. "type": "String",
  12558. "isAttr": true
  12559. },
  12560. {
  12561. "name": "values",
  12562. "type": "Value",
  12563. "isMany": true
  12564. }
  12565. ]
  12566. },
  12567. {
  12568. "name": "FormData",
  12569. "superClass": ["Element"],
  12570. "meta": {
  12571. "allowedIn": [
  12572. "bpmn:StartEvent",
  12573. "bpmn:UserTask"
  12574. ]
  12575. },
  12576. "properties": [
  12577. {
  12578. "name": "fields",
  12579. "type": "FormField",
  12580. "isMany": true
  12581. },
  12582. {
  12583. "name": "businessKey",
  12584. "type": "String",
  12585. "isAttr": true
  12586. }
  12587. ]
  12588. },
  12589. {
  12590. "name": "FormField",
  12591. "superClass": ["Element"],
  12592. "properties": [
  12593. {
  12594. "name": "id",
  12595. "type": "String",
  12596. "isAttr": true
  12597. },
  12598. {
  12599. "name": "label",
  12600. "type": "String",
  12601. "isAttr": true
  12602. },
  12603. {
  12604. "name": "type",
  12605. "type": "String",
  12606. "isAttr": true
  12607. },
  12608. {
  12609. "name": "datePattern",
  12610. "type": "String",
  12611. "isAttr": true
  12612. },
  12613. {
  12614. "name": "defaultValue",
  12615. "type": "String",
  12616. "isAttr": true
  12617. },
  12618. {
  12619. "name": "properties",
  12620. "type": "Properties"
  12621. },
  12622. {
  12623. "name": "validation",
  12624. "type": "Validation"
  12625. },
  12626. {
  12627. "name": "values",
  12628. "type": "Value",
  12629. "isMany": true
  12630. }
  12631. ]
  12632. },
  12633. {
  12634. "name": "Validation",
  12635. "superClass": ["Element"],
  12636. "properties": [
  12637. {
  12638. "name": "constraints",
  12639. "type": "Constraint",
  12640. "isMany": true
  12641. }
  12642. ]
  12643. },
  12644. {
  12645. "name": "Constraint",
  12646. "superClass": ["Element"],
  12647. "properties": [
  12648. {
  12649. "name": "name",
  12650. "type": "String",
  12651. "isAttr": true
  12652. },
  12653. {
  12654. "name": "config",
  12655. "type": "String",
  12656. "isAttr": true
  12657. }
  12658. ]
  12659. },
  12660. {
  12661. "name": "ConditionalEventDefinitionExtension",
  12662. "isAbstract": true,
  12663. "extends": [
  12664. "bpmn:ConditionalEventDefinition"
  12665. ],
  12666. "properties": [
  12667. {
  12668. "name": "variableName",
  12669. "isAttr": true,
  12670. "type": "String"
  12671. },
  12672. {
  12673. "name": "variableEvents",
  12674. "isAttr": true,
  12675. "type": "String"
  12676. }
  12677. ]
  12678. }
  12679. ],
  12680. "emumerations": []
  12681. };
  12682. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12683. /**
  12684. * This is a sample file that should be replaced with the actual translation.
  12685. *
  12686. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12687. * translations and labels to translate.
  12688. */
  12689. var translations = {
  12690. // Labels
  12691. 'Activate the global connect tool': '激活全局连接工具',
  12692. 'Append {type}': '追加 {type}',
  12693. 'Append EndEvent': '追加 结束事件 ',
  12694. 'Append Task': '追加 任务',
  12695. 'Append Gateway': '追加 网关',
  12696. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12697. 'Add Lane above': '在上面添加道',
  12698. 'Divide into two Lanes': '分割成两个道',
  12699. 'Divide into three Lanes': '分割成三个道',
  12700. 'Add Lane below': '在下面添加道',
  12701. 'Append compensation activity': '追加补偿活动',
  12702. 'Change type': '修改类型',
  12703. 'Connect using Association': '使用关联连接',
  12704. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12705. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12706. 'Remove': '移除',
  12707. 'Activate the hand tool': '激活抓手工具',
  12708. 'Activate the lasso tool': '激活套索工具',
  12709. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12710. 'Create expanded SubProcess': '创建扩展子过程',
  12711. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12712. 'Create Pool/Participant': '创建池/参与者',
  12713. 'Parallel Multi Instance': '并行多重事件',
  12714. 'Sequential Multi Instance': '时序多重事件',
  12715. 'DataObjectReference': '数据对象参考',
  12716. 'DataStoreReference': '数据存储参考',
  12717. 'Loop': '循环',
  12718. 'Ad-hoc': '即席',
  12719. 'Create {type}': '创建 {type}',
  12720. 'Create Task': '创建任务',
  12721. 'Create StartEvent': '创建开始事件',
  12722. 'Create EndEvent': '创建结束事件',
  12723. 'Create Group': '创建组',
  12724. 'Task': '任务',
  12725. 'Send Task': '发送任务',
  12726. 'Receive Task': '接收任务',
  12727. 'User Task': '用户任务',
  12728. 'Manual Task': '手工任务',
  12729. 'Business Rule Task': '业务规则任务',
  12730. 'Service Task': '服务任务',
  12731. 'Script Task': '脚本任务',
  12732. 'Call Activity': '调用活动',
  12733. 'Sub Process (collapsed)': '子流程(折叠的)',
  12734. 'Sub Process (expanded)': '子流程(展开的)',
  12735. 'Start Event': '开始事件',
  12736. 'StartEvent': '开始事件',
  12737. 'Intermediate Throw Event': '中间事件',
  12738. 'End Event': '结束事件',
  12739. 'EndEvent': '结束事件',
  12740. 'Create Gateway': '创建网关',
  12741. 'GateWay': '网关',
  12742. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12743. 'Message Start Event': '消息开始事件',
  12744. 'Timer Start Event': '定时开始事件',
  12745. 'Conditional Start Event': '条件开始事件',
  12746. 'Signal Start Event': '信号开始事件',
  12747. 'Error Start Event': '错误开始事件',
  12748. 'Escalation Start Event': '升级开始事件',
  12749. 'Compensation Start Event': '补偿开始事件',
  12750. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12751. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12752. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12753. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12754. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12755. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12756. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12757. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12758. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12759. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12760. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12761. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12762. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12763. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12764. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12765. 'Message End Event': '消息结束事件',
  12766. 'Escalation End Event': '定时结束事件',
  12767. 'Error End Event': '错误结束事件',
  12768. 'Cancel End Event': '取消结束事件',
  12769. 'Compensation End Event': '补偿结束事件',
  12770. 'Signal End Event': '信号结束事件',
  12771. 'Terminate End Event': '终止结束事件',
  12772. 'Message Boundary Event': '消息边界事件',
  12773. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12774. 'Timer Boundary Event': '定时边界事件',
  12775. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12776. 'Escalation Boundary Event': '升级边界事件',
  12777. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12778. 'Conditional Boundary Event': '条件边界事件',
  12779. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12780. 'Error Boundary Event': '错误边界事件',
  12781. 'Cancel Boundary Event': '取消边界事件',
  12782. 'Signal Boundary Event': '信号边界事件',
  12783. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12784. 'Compensation Boundary Event': '补偿边界事件',
  12785. 'Exclusive Gateway': '互斥网关',
  12786. 'Parallel Gateway': '并行网关',
  12787. 'Inclusive Gateway': '相容网关',
  12788. 'Complex Gateway': '复杂网关',
  12789. 'Event based Gateway': '事件网关',
  12790. 'Transaction': '转运',
  12791. 'Sub Process': '子流程',
  12792. 'Event Sub Process': '事件子流程',
  12793. 'Collapsed Pool': '折叠池',
  12794. 'Expanded Pool': '展开池',
  12795. // Errors
  12796. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12797. 'no shape type specified': '没有指定的形状类型',
  12798. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12799. 'out of bounds release': 'out of bounds release',
  12800. 'more than {count} child lanes': '子道大于{count} ',
  12801. 'element required': '元素不能为空',
  12802. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12803. 'no diagram to display': '没有可展示的流程图',
  12804. 'no process or collaboration to display': '没有可展示的流程/协作',
  12805. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12806. 'already rendered {element}': '{element} 已被渲染',
  12807. 'failed to import {element}': '导入{element}失败',
  12808. // 属性面板的参数
  12809. 'Id': '编号',
  12810. 'Name': '名称',
  12811. 'General': '常规',
  12812. 'Details': '详情',
  12813. 'Message Name': '消息名称',
  12814. 'Message': '消息',
  12815. 'Initiator': '创建者',
  12816. 'Asynchronous Continuations': '持续异步',
  12817. 'Asynchronous Before': '异步前',
  12818. 'Asynchronous After': '异步后',
  12819. 'Job Configuration': '工作配置',
  12820. 'Exclusive': '排除',
  12821. 'Job Priority': '工作优先级',
  12822. 'Retry Time Cycle': '重试时间周期',
  12823. 'Documentation': '文档',
  12824. 'Element Documentation': '元素文档',
  12825. 'History Configuration': '历史配置',
  12826. 'History Time To Live': '历史的生存时间',
  12827. 'Forms': '表单',
  12828. 'Form Key': '表单key',
  12829. 'Form Fields': '表单字段',
  12830. 'Business Key': '业务key',
  12831. 'Form Field': '表单字段',
  12832. 'ID': '编号',
  12833. 'Type': '类型',
  12834. 'Label': '名称',
  12835. 'Default Value': '默认值',
  12836. 'Validation': '校验',
  12837. 'Add Constraint': '添加约束',
  12838. 'Config': '配置',
  12839. 'Properties': '属性',
  12840. 'Add Property': '添加属性',
  12841. 'Value': '值',
  12842. 'Add': '添加',
  12843. 'Values': '值',
  12844. 'Add Value': '添加值',
  12845. 'Listeners': '监听器',
  12846. 'Execution Listener': '执行监听',
  12847. 'Event Type': '事件类型',
  12848. 'Listener Type': '监听器类型',
  12849. 'Java Class': 'Java类',
  12850. 'Expression': '表达式',
  12851. 'Must provide a value': '必须提供一个值',
  12852. 'Delegate Expression': '代理表达式',
  12853. 'Script': '脚本',
  12854. 'Script Format': '脚本格式',
  12855. 'Script Type': '脚本类型',
  12856. 'Inline Script': '内联脚本',
  12857. 'External Script': '外部脚本',
  12858. 'Resource': '资源',
  12859. 'Field Injection': '字段注入',
  12860. 'Extensions': '扩展',
  12861. 'Input/Output': '输入/输出',
  12862. 'Input Parameters': '输入参数',
  12863. 'Output Parameters': '输出参数',
  12864. 'Parameters': '参数',
  12865. 'Output Parameter': '输出参数',
  12866. 'Timer Definition Type': '定时器定义类型',
  12867. 'Timer Definition': '定时器定义',
  12868. 'Date': '日期',
  12869. 'Duration': '持续',
  12870. 'Cycle': '循环',
  12871. 'Signal': '信号',
  12872. 'Signal Name': '信号名称',
  12873. 'Escalation': '升级',
  12874. 'Error': '错误',
  12875. 'Link Name': '链接名称',
  12876. 'Condition': '条件名称',
  12877. 'Variable Name': '变量名称',
  12878. 'Variable Event': '变量事件',
  12879. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12880. 'Wait for Completion': '等待完成',
  12881. 'Activity Ref': '活动参考',
  12882. 'Version Tag': '版本标签',
  12883. 'Executable': '可执行文件',
  12884. 'External Task Configuration': '扩展任务配置',
  12885. 'Task Priority': '任务优先级',
  12886. 'External': '外部',
  12887. 'Connector': '连接器',
  12888. 'Must configure Connector': '必须配置连接器',
  12889. 'Connector Id': '连接器编号',
  12890. 'Implementation': '实现方式',
  12891. 'Field Injections': '字段注入',
  12892. 'Fields': '字段',
  12893. 'Result Variable': '结果变量',
  12894. 'Topic': '主题',
  12895. 'Configure Connector': '配置连接器',
  12896. 'Input Parameter': '输入参数',
  12897. 'Assignee': '代理人',
  12898. 'Candidate Users': '候选用户',
  12899. 'Candidate Groups': '候选组',
  12900. 'Due Date': '到期时间',
  12901. 'Follow Up Date': '跟踪日期',
  12902. 'Priority': '优先级',
  12903. // eslint-disable-next-line no-template-curly-in-string
  12904. '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',
  12905. // eslint-disable-next-line no-template-curly-in-string
  12906. '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',
  12907. 'Variables': '变量',
  12908. 'Candidate Starter Configuration': '候选开始配置',
  12909. 'Task Listener': '任务监听器',
  12910. 'Candidate Starter Groups': '候选开始组',
  12911. 'Candidate Starter Users': '候选开始用户',
  12912. 'Tasklist Configuration': '任务列表配置',
  12913. 'Startable': '启动',
  12914. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12915. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12916. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12917. 'CallActivity Type': '调用活动类型',
  12918. 'Condition Type': '条件类型',
  12919. 'Create UserTask': '创建用户任务',
  12920. 'Create CallActivity': '创建调用活动',
  12921. 'Called Element': '调用元素',
  12922. 'Create DataObjectReference': '创建数据对象引用',
  12923. 'Create DataStoreReference': '创建数据存储引用',
  12924. 'Multi Instance': '多实例',
  12925. 'Loop Cardinality': '实例数量',
  12926. Collection: '任务参与人列表',
  12927. 'Element Variable': '元素变量',
  12928. 'Completion Condition': '完成条件'
  12929. };
  12930. //# sourceMappingURL=translations.js.map
  12931. function customTranslate(template, replacements) {
  12932. replacements = replacements || {};
  12933. // Translate
  12934. template = translations[template] || template;
  12935. // Replace
  12936. return template.replace(/{([^}]+)}/g, function (_, key) {
  12937. return replacements[key] || '{' + key + '}';
  12938. });
  12939. }
  12940. //# sourceMappingURL=customTranslate.js.map
  12941. var vjson$9 = {
  12942. title: '导入流程',
  12943. layout: 'fit',
  12944. width: 400,
  12945. height: 400,
  12946. items: [
  12947. {
  12948. layout: 'border',
  12949. items: [
  12950. {
  12951. xtype: 'form',
  12952. items: [
  12953. // {
  12954. // xtype: 'cols',
  12955. // items: [
  12956. // {
  12957. // xtype: 'textfield',
  12958. // allowBlank: false,
  12959. // fieldLabel: '流程名称',
  12960. // bind: '{name}'
  12961. // },
  12962. // ],
  12963. // },
  12964. {
  12965. xtype: 'cols',
  12966. items: [
  12967. {
  12968. xtype: 'filefield',
  12969. name: 'deployFile',
  12970. fieldLabel: '文件名称',
  12971. // labelWidth: '100%',
  12972. msgTarget: 'side',
  12973. reference: 'MOBANB_FILE',
  12974. fileUpload: true,
  12975. allowBlank: false,
  12976. // flex: 1,
  12977. // width: '100%',
  12978. buttonText: '请选择文件位置',
  12979. listeners: {
  12980. change: 'scope.fileChange'
  12981. }
  12982. // bind: '{FILE}'
  12983. },
  12984. ]
  12985. }
  12986. ],
  12987. region: 'center',
  12988. split: true,
  12989. },
  12990. ],
  12991. },
  12992. ],
  12993. fbar: {
  12994. xtype: 'toolbar',
  12995. items: [
  12996. {
  12997. xtype: 'button',
  12998. text: '保存',
  12999. iconCls: 'x-fa fa-save',
  13000. listeners: {
  13001. click: 'scope.save',
  13002. },
  13003. }
  13004. ],
  13005. },
  13006. };
  13007. //# sourceMappingURL=ImportBpmn.view.js.map
  13008. var model$9 = {
  13009. data: {
  13010. name: '',
  13011. file_content: ''
  13012. }
  13013. };
  13014. //# sourceMappingURL=ImportBpmn.model.js.map
  13015. var ImportBpmn = /** @class */ (function (_super) {
  13016. __extends(ImportBpmn, _super);
  13017. function ImportBpmn() {
  13018. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  13019. }
  13020. ImportBpmn.prototype.onLoad = function () {
  13021. };
  13022. ImportBpmn.prototype.save = function (sender) {
  13023. if (this.data.file_content) {
  13024. this.dialogSuccess(this.data);
  13025. }
  13026. else {
  13027. Ext.Msg.alert('提示', "请先上传文件");
  13028. }
  13029. };
  13030. ImportBpmn.prototype.fileChange = function (e) {
  13031. var _this = this;
  13032. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  13033. var file = e.fileInputEl.dom.files[0]; //获取文件
  13034. var reader = new FileReader();
  13035. reader.readAsText(file, "UTF-8");
  13036. reader.onload = function () {
  13037. _this.data.file_content = reader.result;
  13038. };
  13039. };
  13040. return ImportBpmn;
  13041. }(Scope));
  13042. //# sourceMappingURL=ImportBpmn.js.map
  13043. var model$a = {
  13044. data: {
  13045. form_id: '',
  13046. form_name: '',
  13047. save_dir_path: '',
  13048. absolute_path: '',
  13049. form: {
  13050. id: '',
  13051. code: '',
  13052. name: '',
  13053. table: '',
  13054. controller: '',
  13055. groovy: '',
  13056. fields: [],
  13057. buttons: [],
  13058. },
  13059. }
  13060. };
  13061. //# sourceMappingURL=ConfigStrategy.model.js.map
  13062. var vjson$a = {
  13063. title: '配置适配策略',
  13064. layout: 'fit',
  13065. items: [
  13066. {
  13067. layout: 'border',
  13068. items: [
  13069. {
  13070. region: 'center',
  13071. xtype: 'yvgrid',
  13072. pagination: false,
  13073. hideFootbar: true,
  13074. plugins: {
  13075. clipboard: true,
  13076. selectionreplicator: true
  13077. },
  13078. tbar: {
  13079. xtype: 'toolbar',
  13080. items: [
  13081. {
  13082. xtype: 'button',
  13083. text: '添加策略',
  13084. iconCls: 'x-fa fa-plus-circle',
  13085. listeners: {
  13086. click: 'scope.addStrategy'
  13087. }
  13088. },
  13089. {
  13090. xtype: 'button',
  13091. text: '删除',
  13092. iconCls: 'x-fa fa-minus-circle',
  13093. listeners: {}
  13094. },
  13095. '-',
  13096. {
  13097. xtype: 'button',
  13098. text: '上移',
  13099. iconCls: 'x-fa fa-arrow-up',
  13100. listeners: {}
  13101. },
  13102. {
  13103. xtype: 'button',
  13104. text: '下移',
  13105. iconCls: 'x-fa fa-arrow-down',
  13106. listeners: {}
  13107. },
  13108. ]
  13109. },
  13110. columns: [
  13111. { xtype: 'rownumberer' },
  13112. {
  13113. header: '优先级',
  13114. dataIndex: 'priority',
  13115. width: 140,
  13116. sortable: false,
  13117. menuDisabled: true,
  13118. editor: {
  13119. selectOnFocus: true
  13120. },
  13121. },
  13122. {
  13123. header: '策略编号',
  13124. dataIndex: 'strategy_code',
  13125. width: 140,
  13126. sortable: false,
  13127. menuDisabled: true,
  13128. editor: {
  13129. selectOnFocus: true
  13130. },
  13131. },
  13132. {
  13133. header: '策略名称',
  13134. dataIndex: 'strategy_name',
  13135. width: 140,
  13136. sortable: false,
  13137. menuDisabled: true,
  13138. editor: {
  13139. selectOnFocus: true
  13140. },
  13141. },
  13142. {
  13143. header: "条件表达式",
  13144. dataIndex: "strategy_exp",
  13145. },
  13146. ],
  13147. },
  13148. {
  13149. title: '适配条件',
  13150. region: 'south',
  13151. height: '50%',
  13152. xtype: 'form',
  13153. items: [
  13154. {
  13155. xtype: 'cols',
  13156. items: [
  13157. {
  13158. xtype: 'rows',
  13159. items: [
  13160. {
  13161. xtype: 'textfield',
  13162. fieldLabel: "仓库",
  13163. },
  13164. {
  13165. xtype: 'textfield',
  13166. fieldLabel: "货主",
  13167. },
  13168. {
  13169. xtype: 'textfield',
  13170. fieldLabel: "项目",
  13171. },
  13172. {
  13173. xtype: 'textfield',
  13174. fieldLabel: "行政区划",
  13175. },
  13176. {
  13177. xtype: 'textfield',
  13178. fieldLabel: "客户",
  13179. },
  13180. {
  13181. xtype: 'textfield',
  13182. fieldLabel: "商品",
  13183. }
  13184. ]
  13185. },
  13186. {
  13187. xtype: 'rows',
  13188. margin: '8 0 0 10',
  13189. items: [
  13190. {
  13191. xtype: 'label',
  13192. html: '自定义表达式',
  13193. },
  13194. {
  13195. xtype: 'textarea',
  13196. }
  13197. ]
  13198. }
  13199. ]
  13200. }
  13201. ]
  13202. }
  13203. ]
  13204. }
  13205. ]
  13206. };
  13207. //
  13208. //# sourceMappingURL=ConfigStrategy.view.js.map
  13209. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13210. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13211. // import ReportRunner from "./ReportRunner";
  13212. var ConfigStrategy = /** @class */ (function (_super) {
  13213. __extends(ConfigStrategy, _super);
  13214. function ConfigStrategy() {
  13215. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13216. }
  13217. ConfigStrategy.prototype.onLoad = function () {
  13218. this.load();
  13219. };
  13220. ConfigStrategy.prototype.load = function () {
  13221. var _this = this;
  13222. var form_id = this.viewModel.get("form_id");
  13223. var absolute_path = this.viewModel.get("absolute_path");
  13224. var save_dir_path = this.viewModel.get("save_dir_path");
  13225. if (absolute_path && form_id) {
  13226. this.setLoading(true);
  13227. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13228. if (res.success) {
  13229. // 基础属性
  13230. _this.viewModel.set('form', res.data.form);
  13231. // 字段定义
  13232. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13233. // 按钮
  13234. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13235. }
  13236. }).finally(function () {
  13237. _this.setLoading(false);
  13238. });
  13239. }
  13240. };
  13241. ConfigStrategy.prototype.saveAll = function () {
  13242. var _this = this;
  13243. var save_dir_path = this.viewModel.get("save_dir_path");
  13244. if (!save_dir_path) {
  13245. msg("save_dir_path error");
  13246. return;
  13247. }
  13248. var form_id = this.viewModel.get("form_id");
  13249. var absolute_path = this.viewModel.get("absolute_path");
  13250. // 表格校验
  13251. if (!this.refs.form1.isValid()) {
  13252. msg("请检查表单必填项!");
  13253. return;
  13254. }
  13255. // 字段数据
  13256. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13257. delete item.id;
  13258. if (item.hide) {
  13259. delete item.hide_text;
  13260. }
  13261. else {
  13262. item.hide = item.hide_text;
  13263. delete item.hide_text;
  13264. }
  13265. if (item.readonly) {
  13266. delete item.readonly_text;
  13267. }
  13268. else {
  13269. item.readonly = item.readonly_text;
  13270. delete item.readonly_text;
  13271. }
  13272. if (item.disabled) {
  13273. delete item.disabled_text;
  13274. }
  13275. else {
  13276. item.disabled = item.disabled_text;
  13277. delete item.disabled_text;
  13278. }
  13279. if (item.required) {
  13280. delete item.required_text;
  13281. }
  13282. else {
  13283. item.required = item.required_text;
  13284. delete item.required_text;
  13285. }
  13286. return item;
  13287. });
  13288. this.viewModel.set("form.fields", gridColumnRows);
  13289. // 按钮数据
  13290. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13291. delete item.id;
  13292. return item;
  13293. });
  13294. this.viewModel.set("form.buttons", gridBtnRows);
  13295. // 查询条件
  13296. // 策略
  13297. var form = this.viewModel.get("form");
  13298. this.setLoading(true);
  13299. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13300. if (res.success) {
  13301. msg('保存成功');
  13302. handles$1.mainWindow.refs['exporerTree'].reload();
  13303. }
  13304. }).finally(function () {
  13305. _this.setLoading(false);
  13306. });
  13307. };
  13308. ConfigStrategy.prototype.addColumn = function () {
  13309. this.refs.gridColumn.getStore().add({});
  13310. };
  13311. ConfigStrategy.prototype.removeColumn = function () {
  13312. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13313. };
  13314. ConfigStrategy.prototype.calcColumn = function (sender) {
  13315. var _this = this;
  13316. var table = this.viewModel.get("form.table");
  13317. if (!table) {
  13318. msg("表名不存在!");
  13319. return;
  13320. }
  13321. this.setLoading(true);
  13322. calcColumnForm({ table: table }).then(function (res) {
  13323. if (res.success) {
  13324. msg(res.msg);
  13325. if (res.data.columns.length > 0) {
  13326. _$2.forEach(res.data.columns, function (it) {
  13327. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13328. });
  13329. }
  13330. }
  13331. }).finally(function () {
  13332. _this.setLoading(false);
  13333. });
  13334. };
  13335. ConfigStrategy.prototype.addButton = function () {
  13336. this.refs.gridButton.getStore().add({});
  13337. };
  13338. ConfigStrategy.prototype.moveUp = function (sender) {
  13339. var grid = sender.up('grid');
  13340. grid.rowMoveUp();
  13341. };
  13342. ConfigStrategy.prototype.moveDown = function (sender) {
  13343. var grid = sender.up('grid');
  13344. grid.rowMoveDown();
  13345. };
  13346. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13347. var win = new Ext.Window({
  13348. autoDestroy: true,
  13349. title: "添加(编辑)策略",
  13350. width: 400,
  13351. height: 300,
  13352. resizable: true,
  13353. closable: true,
  13354. maximizable: true,
  13355. minimizable: true,
  13356. plain: true,
  13357. // constrainHeader: true,
  13358. constrain: true,
  13359. layout: 'fit',
  13360. animateTarget: sender,
  13361. buttonAlign: 'center',
  13362. items: [
  13363. {
  13364. xtype: "form",
  13365. layout: "hbox",
  13366. margin: '10px 20px',
  13367. border: 0,
  13368. items: [
  13369. {
  13370. flex: 1,
  13371. layout: 'vbox',
  13372. items: [
  13373. {
  13374. xtype: "numberfield",
  13375. fieldLabel: "优先级",
  13376. flex: 1,
  13377. allowBlank: false,
  13378. labelWidth: 50,
  13379. width: "100%",
  13380. },
  13381. {
  13382. xtype: "textfield",
  13383. fieldLabel: "策略名称",
  13384. flex: 1,
  13385. allowBlank: false,
  13386. labelWidth: 50,
  13387. width: "100%",
  13388. },
  13389. {
  13390. xtype: "textfield",
  13391. fieldLabel: "策略编号",
  13392. flex: 1,
  13393. allowBlank: false,
  13394. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13395. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13396. labelWidth: 50,
  13397. width: "100%",
  13398. },
  13399. {
  13400. xtype: "textfield",
  13401. fieldLabel: "仓库ID",
  13402. flex: 1,
  13403. allowBlank: false,
  13404. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13405. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13406. labelWidth: 50,
  13407. width: "100%",
  13408. },
  13409. ]
  13410. },
  13411. ]
  13412. }
  13413. ],
  13414. //窗口按钮
  13415. buttons: [
  13416. {
  13417. xtype: 'button', text: '保存', handler: function (btn) {
  13418. //窗口获取表单
  13419. var form = win.down('form');
  13420. var vaildSuccess = form.isValid();
  13421. if (!vaildSuccess) {
  13422. return;
  13423. }
  13424. var filename = form.down('textfield[name="filename"]').getValue();
  13425. }
  13426. },
  13427. {
  13428. xtype: 'button', text: '取消', handler: function (btn) {
  13429. //窗口关闭
  13430. win.close();
  13431. }
  13432. }
  13433. ]
  13434. });
  13435. win.show();
  13436. };
  13437. return ConfigStrategy;
  13438. }(Scope));
  13439. //# sourceMappingURL=ConfigStrategy.js.map
  13440. var buildVjson = function () {
  13441. return {
  13442. bind: {
  13443. title: '流程编辑-{text}',
  13444. },
  13445. layout: 'fit',
  13446. items: [{
  13447. layout: 'border',
  13448. tbar: {
  13449. xtype: 'toolbar',
  13450. items: [
  13451. {
  13452. xtype: 'button',
  13453. text: '撤销',
  13454. listeners: {
  13455. click: "scope.undo"
  13456. }
  13457. },
  13458. {
  13459. xtype: 'button',
  13460. text: '还原',
  13461. listeners: {
  13462. click: "scope.redo"
  13463. }
  13464. },
  13465. {
  13466. xtype: 'button',
  13467. text: '保存',
  13468. listeners: {
  13469. click: "scope.save"
  13470. }
  13471. },
  13472. {
  13473. xtype: 'button',
  13474. text: '导入BPM',
  13475. listeners: {
  13476. click: "scope.importBpm"
  13477. }
  13478. },
  13479. {
  13480. xtype: 'button',
  13481. text: '配置适配策略',
  13482. listeners: {
  13483. click: "scope.configStrategy"
  13484. }
  13485. },
  13486. {
  13487. fieldLabel: '选择配置分支',
  13488. xtype: 'combogrid',
  13489. },
  13490. ]
  13491. },
  13492. items: [
  13493. {
  13494. xtype: "panel",
  13495. region: 'center',
  13496. reference: "bpmn_view",
  13497. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13498. },
  13499. {
  13500. split: true,
  13501. xtype: "panel",
  13502. region: 'east',
  13503. width: '30%',
  13504. reference: "bpmn_properties",
  13505. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13506. }
  13507. ],
  13508. }],
  13509. listeners: {
  13510. afterrender: 'scope.onViewRender'
  13511. }
  13512. };
  13513. };
  13514. var BpmnDesign = /** @class */ (function (_super) {
  13515. __extends(BpmnDesign, _super);
  13516. function BpmnDesign() {
  13517. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13518. _this.bpmnModeler = null;
  13519. _this.bpmnModelerName = "";
  13520. return _this;
  13521. }
  13522. BpmnDesign.prototype.onLoad = function () {
  13523. var _this = this;
  13524. _super.prototype.onLoad.call(this);
  13525. this.setLoading(true);
  13526. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13527. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13528. if (res && res.success && res.data && res.data.bpmn) {
  13529. var diagramXML = res.data.bpmn;
  13530. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13531. var elements = _this.bpmnModeler._definitions.rootElements;
  13532. if (Array.isArray(elements) && elements.length > 0) {
  13533. elements[0].name = _this.bpmnModelerName;
  13534. }
  13535. }).catch(function (err) {
  13536. msgError(err);
  13537. });
  13538. }
  13539. else {
  13540. msgError(res.msg);
  13541. }
  13542. }).finally(function () {
  13543. _this.setLoading(false);
  13544. });
  13545. };
  13546. BpmnDesign.prototype.onViewRender = function (sender) {
  13547. var customTranslateModule = {
  13548. translate: ['value', customTranslate]
  13549. };
  13550. this.bpmnModeler = new BpmnModeler({
  13551. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13552. propertiesPanel: {
  13553. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13554. },
  13555. additionalModules: [
  13556. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13557. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13558. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13559. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13560. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13561. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13562. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13563. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13564. customTranslateModule,
  13565. ],
  13566. moddleExtensions: {
  13567. camunda: camundaModdleDescriptor
  13568. },
  13569. keyboard: { bindTo: document } // 使用键盘快捷键
  13570. });
  13571. };
  13572. //开启快捷键
  13573. //modeler.get('keyboard').bind(document);
  13574. //关闭快捷键
  13575. //modeler.get('keyboard').unbind();
  13576. BpmnDesign.prototype.undo = function (sender) {
  13577. this.bpmnModeler.get('commandStack').undo();
  13578. };
  13579. BpmnDesign.prototype.redo = function (sender) {
  13580. this.bpmnModeler.get('commandStack').redo();
  13581. };
  13582. BpmnDesign.prototype.save = function (sender) {
  13583. var _this = this;
  13584. this.setLoading(true);
  13585. this.bpmnModeler.saveXML().then(function (resBpm) {
  13586. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13587. if (res.success) {
  13588. msg$1("保存成功");
  13589. }
  13590. else {
  13591. msgError(res.msg);
  13592. }
  13593. }).catch(function (e) {
  13594. var _a, _b;
  13595. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13596. msgError(msg);
  13597. }).finally(function () {
  13598. _this.setLoading(false);
  13599. });
  13600. }).catch(function (e) {
  13601. msgError(e);
  13602. _this.setLoading(false);
  13603. });
  13604. };
  13605. BpmnDesign.prototype.importBpm = function (sender) {
  13606. var _this = this;
  13607. var dlg = new ImportBpmn();
  13608. //@ts-ignore
  13609. dlg.success = function (sen, data) {
  13610. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13611. var elements = _this.bpmnModeler._definitions.rootElements;
  13612. if (Array.isArray(elements) && elements.length > 0) {
  13613. elements[0].name = _this.bpmnModelerName;
  13614. }
  13615. }).catch(function (err) {
  13616. msgError(err);
  13617. });
  13618. };
  13619. dlg.showDialog(sender, {}, {});
  13620. // this.bpmnModeler.importXML()
  13621. };
  13622. BpmnDesign.prototype.configStrategy = function (sender) {
  13623. var configStrategy = new ConfigStrategy();
  13624. configStrategy.showDialog(sender, {}, {});
  13625. };
  13626. return BpmnDesign;
  13627. }(Scope));
  13628. //# sourceMappingURL=BpmnDesign.js.map
  13629. var model$b = {
  13630. data: {
  13631. id: '',
  13632. path: '',
  13633. form: {
  13634. title: '',
  13635. sqlId: '',
  13636. }
  13637. }
  13638. };
  13639. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13640. var vjson$b = {
  13641. bind: {
  13642. title: '{title}',
  13643. },
  13644. layout: 'fit',
  13645. items: [
  13646. {
  13647. layout: 'border',
  13648. items: [
  13649. {
  13650. region: 'center',
  13651. reference: 'editor',
  13652. border: true,
  13653. // html: '<div class="geEditor"></div>',
  13654. // listeners: {
  13655. // afterrender: 'scope.editorInit'
  13656. // }
  13657. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13658. listeners: {
  13659. afterrender: 'scope.iframeRender'
  13660. }
  13661. },
  13662. ]
  13663. }
  13664. ]
  13665. }; //
  13666. //
  13667. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13668. var WidgetDesign$1 = /** @class */ (function (_super) {
  13669. __extends(WidgetDesign, _super);
  13670. function WidgetDesign(layoutCode, layoutName) {
  13671. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13672. _this.layoutCode = layoutCode;
  13673. _this.layoutName = layoutName;
  13674. return _this;
  13675. }
  13676. WidgetDesign.prototype.onLoad = function () {
  13677. this.viewModel.set('layoutCode', this.layoutCode);
  13678. this.viewModel.set('layoutName', this.layoutName);
  13679. if (this.layoutCode) {
  13680. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13681. }
  13682. else {
  13683. this.viewModel.set('title', '新建图纸');
  13684. }
  13685. };
  13686. WidgetDesign.prototype.reload = function () {
  13687. var _this = this;
  13688. this.setLoading(true);
  13689. loadWhLayout({
  13690. layoutCode: this.layoutCode,
  13691. layoutName: this.layoutName,
  13692. }).then(function (res) {
  13693. if (res.success) {
  13694. var xml = res.data.layoutContent;
  13695. var doc = _this.mxUtils.parseXml(xml);
  13696. var graph = _this.editorUi.editor.graph;
  13697. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13698. }
  13699. }).finally(function () {
  13700. _this.setLoading(false);
  13701. });
  13702. };
  13703. WidgetDesign.prototype.editorInit = function (sender) {
  13704. var that = this;
  13705. var dom = $(sender.el.dom).find('.geEditor')[0];
  13706. //@ts-ignore
  13707. require(['mxgraph'], function () {
  13708. var editorUiInit = EditorUi.prototype.init;
  13709. EditorUi.prototype.init = function () {
  13710. editorUiInit.apply(this, arguments);
  13711. this.actions.get('save').funct = that.onFileSave.bind(that);
  13712. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13713. this.actions.get('open').visible = false;
  13714. this.actions.get('new').visible = false;
  13715. this.actions.get('preview').visible = false;
  13716. this.actions.get('print').visible = false;
  13717. this.actions.get('pageSetup').visible = false;
  13718. this.actions.get('help').visible = false;
  13719. this.actions.get('export').visible = false;
  13720. this.actions.get('about').visible = false;
  13721. this.menus.menus.help.setEnabled(false);
  13722. that.editorUi = this;
  13723. if (that.layoutCode) {
  13724. that.reload();
  13725. }
  13726. };
  13727. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13728. var mxLanguage = 'zh';
  13729. mxResources.loadDefaultBundle = false;
  13730. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13731. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13732. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13733. // Fixes possible asynchronous requests
  13734. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13735. // Adds bundle text to resources
  13736. mxResources.parse(xhr[0].getText());
  13737. // Configures the default graph theme
  13738. var themes = new Object();
  13739. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13740. // Main
  13741. new EditorUi(new Editor(false, themes), dom);
  13742. }, function () {
  13743. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13744. });
  13745. });
  13746. };
  13747. WidgetDesign.prototype.iframeRender = function (sender) {
  13748. var that = this;
  13749. var iframe = $(sender.el.dom).find('iframe')[0];
  13750. iframe.contentWindow['designer'] = that;
  13751. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13752. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13753. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13754. editorUi.actions.get('open').visible = false;
  13755. editorUi.actions.get('new').visible = false;
  13756. editorUi.actions.get('preview').visible = false;
  13757. editorUi.actions.get('print').visible = false;
  13758. editorUi.actions.get('pageSetup').visible = false;
  13759. editorUi.actions.get('help').visible = false;
  13760. editorUi.actions.get('export').visible = false;
  13761. editorUi.actions.get('about').visible = false;
  13762. editorUi.menus.menus.help.setEnabled(false);
  13763. that.editorUi = editorUi;
  13764. that.mxUtils = iframe.contentWindow['mxUtils'];
  13765. if (that.layoutCode) {
  13766. that.reload();
  13767. }
  13768. };
  13769. };
  13770. WidgetDesign.prototype.onDestroy = function () {
  13771. var _a;
  13772. try {
  13773. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13774. }
  13775. catch (e) {
  13776. }
  13777. };
  13778. WidgetDesign.prototype.onFileSaveAs = function () {
  13779. var _this = this;
  13780. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13781. .then(function (_a) {
  13782. var code = _a.code, name = _a.name;
  13783. _this.layoutCode = code;
  13784. _this.layoutName = name;
  13785. _this.onSave();
  13786. });
  13787. };
  13788. WidgetDesign.prototype.onSave = function () {
  13789. var _this = this;
  13790. var layoutContent = this.editorUi.getEditBlankXml();
  13791. var layoutCode = this.layoutCode;
  13792. var layoutName = this.layoutName;
  13793. if (!layoutCode || !layoutName) {
  13794. msg$1('图形编号和图形名称必填');
  13795. return;
  13796. }
  13797. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13798. this.setLoading(true);
  13799. saveWhLayout({
  13800. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13801. }).then(function (res) {
  13802. msg$1(res.msg);
  13803. handles$1.whLayout.reload();
  13804. }).finally(function () {
  13805. _this.setLoading(false);
  13806. });
  13807. };
  13808. WidgetDesign.prototype.onFileSave = function () {
  13809. if (!this.layoutCode || !this.layoutName) {
  13810. this.onFileSaveAs();
  13811. }
  13812. else {
  13813. this.onSave();
  13814. }
  13815. };
  13816. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13817. var code = _a.code, name = _a.name;
  13818. return new Promise(function (resolve, reject) {
  13819. var viewModel = new Ext.app.ViewModel({
  13820. data: {
  13821. code: code !== null && code !== void 0 ? code : '',
  13822. name: name !== null && name !== void 0 ? name : '',
  13823. }
  13824. });
  13825. var dlg = Ext.create('Ext.window.Window', {
  13826. title: '保存',
  13827. viewModel: viewModel,
  13828. layout: {
  13829. type: "vbox",
  13830. pack: "start",
  13831. align: "stretch"
  13832. },
  13833. items: [
  13834. {
  13835. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13836. bind: '{code}'
  13837. },
  13838. {
  13839. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13840. bind: '{name}'
  13841. }
  13842. ],
  13843. fbar: [
  13844. {
  13845. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13846. click: function () {
  13847. var code = viewModel.get('code');
  13848. var name = viewModel.get('name');
  13849. resolve({ code: code, name: name });
  13850. dlg.close();
  13851. }
  13852. }
  13853. },
  13854. {
  13855. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13856. click: function () {
  13857. dlg.close();
  13858. }
  13859. }
  13860. },
  13861. ]
  13862. });
  13863. dlg.show();
  13864. });
  13865. };
  13866. return WidgetDesign;
  13867. }(Scope));
  13868. //# sourceMappingURL=WhLayoutDesign.js.map
  13869. // init()
  13870. var Workbench = /** @class */ (function (_super) {
  13871. __extends(Workbench, _super);
  13872. // activeModulePage: ModulePage = null
  13873. function Workbench() {
  13874. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13875. _this.name = "MainWindow";
  13876. _this.modules = [];
  13877. _this.yvgridDesign = null;
  13878. return _this;
  13879. }
  13880. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13881. if (newCard) {
  13882. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13883. }
  13884. else {
  13885. this.viewModel.set('leftTabTitle', '未选中');
  13886. }
  13887. };
  13888. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13889. get: function () {
  13890. var _a;
  13891. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13892. },
  13893. enumerable: true,
  13894. configurable: true
  13895. });
  13896. Workbench.prototype.documentKeydown = function (event) {
  13897. if (event.ctrlKey || event.metaKey) {
  13898. if (event.key.toLowerCase() === 's') {
  13899. eventBus.publish(EventType.SaveCall, {});
  13900. event.stopPropagation();
  13901. event.preventDefault();
  13902. }
  13903. else if (event.key.toLowerCase() === 'z') {
  13904. if (event.shiftKey) {
  13905. eventBus.publish(EventType.Redo, {});
  13906. event.stopPropagation();
  13907. event.preventDefault();
  13908. }
  13909. else {
  13910. eventBus.publish(EventType.Undo, {});
  13911. event.stopPropagation();
  13912. event.preventDefault();
  13913. }
  13914. }
  13915. }
  13916. };
  13917. Workbench.prototype.onLoad = function () {
  13918. var _this = this;
  13919. window["tt"] = this.refs['tt'];
  13920. window["vm"] = this.viewModel;
  13921. $('#loading').remove();
  13922. setMainWindow(this);
  13923. setStatusbar(this.down('statusbar'));
  13924. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13925. var currentProject = getCurrentProject();
  13926. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13927. // handles.fileTree.reload()
  13928. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13929. _this.showModule(rawData);
  13930. });
  13931. eventBus.subscribe(EventType.Undo, function () {
  13932. _this.onUndo();
  13933. });
  13934. eventBus.subscribe(EventType.Redo, function () {
  13935. _this.onRedo();
  13936. });
  13937. eventBus.subscribe(EventType.Cut, function (_a) {
  13938. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13939. _this.onCut(a, b, c, d);
  13940. });
  13941. eventBus.subscribe(EventType.Copy, function (_a) {
  13942. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13943. _this.onCopy(a, b, c, d);
  13944. });
  13945. eventBus.subscribe(EventType.Paste, function (_a) {
  13946. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13947. _this.onPaste(a, b, c, d);
  13948. });
  13949. eventBus.subscribe(EventType.SelectAll, function () {
  13950. _this.onSelectAll();
  13951. });
  13952. eventBus.subscribe(EventType.SelectAll, function () {
  13953. _this.onSelectAll();
  13954. });
  13955. eventBus.subscribe(EventType.RunCheckModule, function () {
  13956. _this.runCheckModule();
  13957. });
  13958. eventBus.subscribe(EventType.StopCheckModule, function () {
  13959. _this.stopCheckModule();
  13960. });
  13961. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13962. _this.onCompoentContextMenu(args);
  13963. });
  13964. this.runCheckModule();
  13965. };
  13966. Workbench.prototype.onCompoentContextMenu = function (args) {
  13967. var _this = this;
  13968. if (!this.yvgridDesign) {
  13969. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13970. this.yvgridDesign.showDialog(null, {}, {});
  13971. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13972. this.yvgridDesign.onDestroy = function () {
  13973. fn_1();
  13974. _this.yvgridDesign = null;
  13975. };
  13976. }
  13977. };
  13978. Workbench.prototype.runCheckModule = function () {
  13979. var _this = this;
  13980. if (this.checkTimer) {
  13981. return;
  13982. }
  13983. this.checkTimer = setInterval(function () {
  13984. var _a;
  13985. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13986. _this.activeModulePage.check();
  13987. }
  13988. }, 5000);
  13989. };
  13990. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13991. var dlg = new WidgetDesign(widgetPath, widgetName);
  13992. dlg.showPage({
  13993. id: 'widget_' + widgetPath,
  13994. path: 'widget_' + widgetPath,
  13995. }, {
  13996. data: {
  13997. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13998. }
  13999. });
  14000. dlg.dialogSuccess = successCallback;
  14001. };
  14002. Workbench.prototype.stopCheckModule = function () {
  14003. clearInterval(this.checkTimer);
  14004. this.checkTimer = null;
  14005. };
  14006. Workbench.prototype.showDataSync = function () {
  14007. var ins = new DbSync();
  14008. ins.showPage({
  14009. id: 'db_sync__',
  14010. path: 'db_sync__',
  14011. }, {
  14012. data: {}
  14013. });
  14014. };
  14015. /**
  14016. * 打开一个项目
  14017. */
  14018. Workbench.prototype.openProject = function (project) {
  14019. setCurrentProject(project);
  14020. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  14021. handles$1.fileTree.reload();
  14022. };
  14023. /**
  14024. * 打开模板开发面板
  14025. */
  14026. Workbench.prototype.showTemplateDev = function () {
  14027. var ins = new TemplateDev();
  14028. ins.showPage({
  14029. id: 'template_dev__',
  14030. path: 'template_dev__',
  14031. }, {
  14032. data: {}
  14033. });
  14034. };
  14035. Workbench.prototype.openScope = function () {
  14036. };
  14037. /**
  14038. * 显示字段域管理器
  14039. */
  14040. Workbench.prototype.showColumnDomain = function () {
  14041. var instance = new DbDomain();
  14042. instance.showPage({
  14043. id: 'domain__',
  14044. path: 'domain__',
  14045. }, {
  14046. data: {}
  14047. });
  14048. };
  14049. /**
  14050. * 显示性能统计
  14051. */
  14052. Workbench.prototype.showPerform = function () {
  14053. // const instance = new PerformStats()
  14054. // instance.showPage({
  14055. // id: 'perform__',
  14056. // path: 'perform__',
  14057. //
  14058. // }, {
  14059. // data: {}
  14060. // })
  14061. };
  14062. /**
  14063. * 显示数据库代码模板库
  14064. */
  14065. Workbench.prototype.showDbCodeTemplate = function () {
  14066. // const instance = new DbCodeTemplate()
  14067. // instance.showPage({
  14068. // id: 'dbcode__',
  14069. // path: 'dbcode__',
  14070. //
  14071. // }, {
  14072. // data: {}
  14073. // })
  14074. };
  14075. /**
  14076. * 显示数据库代码模板库
  14077. */
  14078. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14079. var instance = new ReportDesign();
  14080. instance.showPage({
  14081. id: 'report_' + report_id,
  14082. path: 'report_' + report_id,
  14083. }, {
  14084. data: {
  14085. report_id: report_id,
  14086. report_name: report_name,
  14087. }
  14088. });
  14089. instance.dialogSuccess = success;
  14090. };
  14091. /**
  14092. * 显示报表
  14093. */
  14094. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14095. instance.showPage({
  14096. id: 'REPORT__' + report_id,
  14097. path: 'REPORT__' + report_id,
  14098. }, {
  14099. data: {
  14100. report_id: report_id,
  14101. }
  14102. });
  14103. var reportName = instance.viewModel.get('report_name');
  14104. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14105. };
  14106. /**
  14107. * 显示运维页面
  14108. */
  14109. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14110. // const instance = new DevOpsTerminal()
  14111. // instance.showPage({
  14112. // id: 'ops_' + opsId,
  14113. // path: 'ops_' + opsId,
  14114. //
  14115. // }, {
  14116. // data: {
  14117. // opsId: opsId,
  14118. // name: name,
  14119. // }
  14120. // })
  14121. // instance.dialogSuccess = success
  14122. };
  14123. /**
  14124. * 显示表结构
  14125. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14126. * columnName 可以为空
  14127. */
  14128. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14129. var id = 'tableColumn_' + tableName;
  14130. var isCreateTable = false;
  14131. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14132. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14133. if (!tableName) {
  14134. id = _$2.uniqueId('new_table');
  14135. tableName = id;
  14136. isCreateTable = true;
  14137. }
  14138. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14139. instance.showPage({
  14140. id: id,
  14141. path: id,
  14142. locatPath: locatPath
  14143. }, {
  14144. data: {
  14145. tableName: tableName,
  14146. columnName: columnName
  14147. }
  14148. });
  14149. };
  14150. /**
  14151. * 打开某个模块
  14152. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14153. */
  14154. Workbench.prototype.showModule = function (rawData) {
  14155. var id = rawData.id, path = rawData.path;
  14156. var separator = '/';
  14157. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14158. var module = this.modules[idx];
  14159. var pageId = path.replaceAll('/', '_');
  14160. console.log('open module', module);
  14161. var instance = new ModulePage(id, module);
  14162. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14163. instance.showPage({
  14164. id: 'module_' + pageId,
  14165. path: path,
  14166. title: module.name
  14167. }, {
  14168. data: {}
  14169. });
  14170. };
  14171. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14172. var bpmnDesign = new BpmnDesign();
  14173. bpmnDesign.showPage({}, {
  14174. data: {
  14175. absolutePath: absolutePath,
  14176. id: id,
  14177. text: text
  14178. }
  14179. });
  14180. };
  14181. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14182. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14183. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14184. layoutDesign.showPage({
  14185. id: id,
  14186. path: id,
  14187. }, {
  14188. data: {}
  14189. });
  14190. };
  14191. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14192. var _a;
  14193. // this.activeModulePage = newCard.yvanScope
  14194. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14195. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14196. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14197. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14198. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14199. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14200. eventBus.publish(EventType.MainTabChange, {
  14201. moduleId: newCard.yvanScope.moduleId,
  14202. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14203. from: this.name
  14204. });
  14205. };
  14206. Workbench.prototype.onUndo = function () {
  14207. var _a;
  14208. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14209. };
  14210. Workbench.prototype.onRedo = function () {
  14211. var _a;
  14212. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14213. };
  14214. Workbench.prototype.onCut = function (a, b, c, d) {
  14215. var _a;
  14216. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14217. };
  14218. Workbench.prototype.onCopy = function (a, b, c, d) {
  14219. var _a;
  14220. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14221. };
  14222. Workbench.prototype.onPaste = function (a, b, c, d) {
  14223. var _a;
  14224. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14225. };
  14226. Workbench.prototype.onSelectAll = function () {
  14227. var _a;
  14228. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14229. };
  14230. return Workbench;
  14231. }(Scope));
  14232. //# sourceMappingURL=Workbench.js.map
  14233. (function (FuncDomain) {
  14234. FuncDomain["SCOPE"] = "scope";
  14235. FuncDomain["SYSTEM"] = "system";
  14236. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14237. (function (BizMode) {
  14238. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14239. BizMode[BizMode["query"] = 1] = "query";
  14240. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14241. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14242. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14243. })(exports.BizMode || (exports.BizMode = {}));
  14244. (function (BizFormat) {
  14245. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14246. BizFormat[BizFormat["button"] = 1] = "button";
  14247. BizFormat[BizFormat["progress"] = 2] = "progress";
  14248. BizFormat[BizFormat["date"] = 3] = "date";
  14249. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14250. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14251. })(exports.BizFormat || (exports.BizFormat = {}));
  14252. (function (BizUnique) {
  14253. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14254. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14255. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14256. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14257. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14258. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14259. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14260. })(exports.BizUnique || (exports.BizUnique = {}));
  14261. var ScopeEngine = /** @class */ (function () {
  14262. function ScopeEngine() {
  14263. }
  14264. ScopeEngine.getBizFile = function (director) {
  14265. return new Promise(function (resolve, reject) {
  14266. debugger;
  14267. });
  14268. };
  14269. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14270. return new Promise(function (resolve, reject) {
  14271. var requireArr = [];
  14272. var requireKeyArr = [];
  14273. _$2.forOwn(billFile.domains, function (v, k) {
  14274. requireArr.push(v.domain);
  14275. requireKeyArr.push(k);
  14276. if (v.layout) {
  14277. requireArr.push(v.layout);
  14278. requireKeyArr.push(k + "_layout");
  14279. }
  14280. });
  14281. requireArr.push(billFile.layout);
  14282. requireKeyArr.push("layout");
  14283. requireArr.push(billFile.converter);
  14284. requireKeyArr.push("converter");
  14285. // @ts-ignore
  14286. require(requireArr, function () {
  14287. var requireReArr = [];
  14288. for (var _i = 0; _i < arguments.length; _i++) {
  14289. requireReArr[_i] = arguments[_i];
  14290. }
  14291. if (requireReArr.length <= 0) {
  14292. reject(new Error("没有加载到相关的文件!"));
  14293. }
  14294. var domains = {};
  14295. for (var i = 0; i < requireReArr.length - 2; i++) {
  14296. if (requireKeyArr[i].endsWith("_layout")) {
  14297. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14298. domains[key_d].layout = requireReArr[i].default;
  14299. }
  14300. else {
  14301. domains[requireKeyArr[i]] = requireReArr[i].default;
  14302. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14303. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14304. }
  14305. }
  14306. var bizFile = {
  14307. bill: billFile,
  14308. domains: domains,
  14309. layout: requireReArr[requireReArr.length - 2].default,
  14310. converter: requireReArr[requireReArr.length - 1].default,
  14311. };
  14312. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14313. scope.billSetting = bizFile;
  14314. resolve(scope);
  14315. });
  14316. });
  14317. };
  14318. ScopeEngine.buildScopeFromPath = function (path) {
  14319. return new Promise(function (resolve, reject) {
  14320. // @ts-ignore
  14321. require([path], function (bill) {
  14322. bill = bill.default;
  14323. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14324. resolve(scope);
  14325. }).catch(function (e) {
  14326. reject(e);
  14327. });
  14328. });
  14329. });
  14330. };
  14331. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14332. var controller = {};
  14333. var vjson = {
  14334. layout: 'fit',
  14335. title: bizFile.bill.name,
  14336. items: []
  14337. };
  14338. var model = {};
  14339. if (bizFile.layout.layout === "fit") {
  14340. vjson.items = bizFile.layout.items;
  14341. }
  14342. else if (bizFile.layout.layout === "border") {
  14343. vjson.items = [bizFile.layout];
  14344. }
  14345. var domainsVjson = {};
  14346. _$2.forOwn(bizFile.domains, function (v, k) {
  14347. var domainVjson = null;
  14348. var buttons = bizFile.domains[k].buttons;
  14349. if (bizFile.bill.domains[k].mode === "form") {
  14350. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14351. if (Array.isArray(buttons) && buttons.length > 0) {
  14352. if (bizFile.bill.domains[k].type === "header") {
  14353. vjson.tbar = {
  14354. xtype: 'toolbar',
  14355. items: ScopeEngine.buildButton(controller, buttons)
  14356. };
  14357. }
  14358. else {
  14359. domainVjson.items.push({
  14360. xtype: "cols",
  14361. items: ScopeEngine.buildButton(controller, buttons)
  14362. });
  14363. }
  14364. }
  14365. }
  14366. else if (bizFile.bill.domains[k].mode === "table") {
  14367. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14368. if (Array.isArray(buttons) && buttons.length > 0) {
  14369. if (bizFile.bill.domains[k].type === "header") {
  14370. vjson.tbar = {
  14371. xtype: 'toolbar',
  14372. items: ScopeEngine.buildButton(controller, buttons)
  14373. };
  14374. }
  14375. else {
  14376. domainVjson.tbar = {
  14377. xtype: 'toolbar',
  14378. items: ScopeEngine.buildButton(controller, buttons)
  14379. };
  14380. }
  14381. }
  14382. }
  14383. if (domainVjson) {
  14384. domainsVjson[k] = domainVjson;
  14385. }
  14386. });
  14387. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14388. var scope = new Scope({ model: model, vjson: vjson });
  14389. scope['bill_define'] = bizFile;
  14390. _$2.merge(scope, controller);
  14391. console.log('bill_define', vjson, scope, scope['bill_define']);
  14392. return scope;
  14393. };
  14394. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14395. var fieldGroups = {};
  14396. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14397. var field = bizFile.domains[domainKey].fields[i];
  14398. var item = { sort: field.form_sort };
  14399. item.xtype = field.xtype;
  14400. item.fieldLabel = field.column_desc;
  14401. item.bind = {
  14402. value: "{" + domainKey + "." + field.column_name + "}",
  14403. };
  14404. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14405. // if (field.disabled !== "true" && field.disabled !== "false") {
  14406. // item.bind.disabled = eval(field.disabled)
  14407. // } else {
  14408. // item.disabled = (field.disabled === "true")
  14409. // }
  14410. // if (field.readonly !== "true" && field.readonly !== "false") {
  14411. // item.bind.disabled = eval(field.readonly)
  14412. // } else {
  14413. // item.readonly = (field.readonly === "true")
  14414. // }
  14415. // if (field.required !== "true" && field.required !== "false") {
  14416. // item.bind.required = eval(field.required)
  14417. // } else {
  14418. // item.required = (field.required === "true")
  14419. // }
  14420. // if (field.hide !== "true" && field.hide !== "false") {
  14421. // item.bind.hidden = eval(field.hide)
  14422. // } else {
  14423. // item.hidden = (field.hide === "true")
  14424. // }
  14425. // item.flex = field.
  14426. if (field.dict) {
  14427. item.fix = eval(field.dict);
  14428. }
  14429. // _.set(formModel, "", "")
  14430. item.field = field;
  14431. if (field.form_group) {
  14432. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14433. fieldGroups[field.form_group] = [item];
  14434. }
  14435. else {
  14436. fieldGroups[field.form_group].push(item);
  14437. }
  14438. }
  14439. }
  14440. var formVjson = {
  14441. xtype: "form",
  14442. title: bizFile.domains[domainKey].name,
  14443. items: []
  14444. };
  14445. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14446. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14447. if (items) {
  14448. var fieldsetVjson = {
  14449. xtype: "fieldset",
  14450. title: k,
  14451. items: items
  14452. };
  14453. formVjson.items.push(fieldsetVjson);
  14454. }
  14455. });
  14456. return formVjson;
  14457. };
  14458. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14459. // const vjson = { xtype: "grid", items: []}
  14460. var gridVjson = {
  14461. xtype: "yvgrid",
  14462. columns: [],
  14463. split: true,
  14464. reference: domainKey,
  14465. listeners: {
  14466. itemdblclick: function () {
  14467. },
  14468. },
  14469. };
  14470. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14471. var field = bizFile.domains[domainKey].fields[i];
  14472. gridVjson.columns.push({
  14473. dataIndex: field.column_name,
  14474. header: field.column_desc,
  14475. });
  14476. }
  14477. return gridVjson;
  14478. };
  14479. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14480. var colGroups = [{
  14481. xtype: "cols",
  14482. items: []
  14483. }];
  14484. var colGroup = colGroups[0];
  14485. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14486. for (var i = 0; i < fieldGroup.length; i++) {
  14487. var field = fieldGroup[i];
  14488. if (field.field.form_newline === "true") {
  14489. if (colGroup.items.length > 0) {
  14490. colGroup = {
  14491. xtype: "cols",
  14492. items: [field]
  14493. };
  14494. colGroups.push(colGroup);
  14495. }
  14496. }
  14497. else {
  14498. colGroup.items.push(field);
  14499. }
  14500. delete field.field;
  14501. }
  14502. return colGroups;
  14503. };
  14504. ScopeEngine.buildButton = function (controller, buttons) {
  14505. var buttonsVjson = [];
  14506. var _loop_1 = function (i) {
  14507. var item = buttons[i];
  14508. var button = {
  14509. xtype: "button",
  14510. text: item.btn_name,
  14511. iconCls: item.icon
  14512. };
  14513. if (item.hidden === "true" || item.hidden === "false") {
  14514. button.hidden = (item.hidden === "true");
  14515. }
  14516. if (item.listeners) {
  14517. var listeners_1 = {};
  14518. _$2.forOwn(item.listeners, function (v, k) {
  14519. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14520. listeners_1[k] = v;
  14521. }
  14522. else {
  14523. try {
  14524. listeners_1[k] = eval(v);
  14525. }
  14526. catch (e) {
  14527. throw e;
  14528. }
  14529. }
  14530. });
  14531. button.listeners = listeners_1;
  14532. }
  14533. buttonsVjson.push(button);
  14534. };
  14535. for (var i = 0; i < buttons.length; i++) {
  14536. _loop_1(i);
  14537. }
  14538. return buttonsVjson;
  14539. };
  14540. ScopeEngine.buildListeners = function (controller, item) {
  14541. if (!item.hasOwnProperty("listeners")) {
  14542. return;
  14543. }
  14544. _$2.forOwn(item.listeners, function (v, k) {
  14545. if (v && typeof v === "string") {
  14546. if (v.indexOf(".") > -1) {
  14547. var strArr = v.split(".");
  14548. if (strArr.length != 2) {
  14549. console.error(item.listeners, "语法解析错误,请检查!");
  14550. }
  14551. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14552. switch (funcDomain) {
  14553. case exports.FuncDomain.SCOPE:
  14554. controller[k] = findCustFunc(item, k);
  14555. break;
  14556. case exports.FuncDomain.SYSTEM:
  14557. break;
  14558. default:
  14559. throw new Error("错误的函数域定义");
  14560. }
  14561. }
  14562. else {
  14563. var func = eval(v);
  14564. if (typeof func === 'function') {
  14565. controller[k] = func;
  14566. }
  14567. throw new Error("解析自定义函数出错");
  14568. }
  14569. }
  14570. });
  14571. var findCustFunc = function (item, funcName) {
  14572. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14573. throw new Error("没有找到相关的函数定义");
  14574. }
  14575. var func = eval(item[funcName]);
  14576. if (typeof func === 'function') {
  14577. return func;
  14578. }
  14579. throw new Error("解析自定义函数出错");
  14580. };
  14581. };
  14582. /**
  14583. * 只检索 items 的模式,深度遍历 vjson
  14584. */
  14585. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14586. if (Array.isArray(vjson)) {
  14587. for (var i = 0; i < vjson.length; i++) {
  14588. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14589. }
  14590. }
  14591. else {
  14592. _$2.forOwn(vjson, function (v, k) {
  14593. if (k !== "domain") {
  14594. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14595. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14596. }
  14597. }
  14598. else {
  14599. delete vjson.domain;
  14600. _$2.merge(vjson, domainsVjson[v]);
  14601. }
  14602. });
  14603. }
  14604. };
  14605. return ScopeEngine;
  14606. }());
  14607. //# sourceMappingURL=ScopeEngine.js.map
  14608. function initComponent () {
  14609. var ct = Ext.Component.prototype.constructor;
  14610. Ext.Component.override({
  14611. constructor: function (config) {
  14612. var _a, _b;
  14613. if (!isDesignMode(this, config)) {
  14614. var me_1 = this;
  14615. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14616. _$2.each(baseConfigProcessList, function (process) {
  14617. process.call(me_1, me_1, config);
  14618. });
  14619. }
  14620. if (config) {
  14621. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14622. config.i18nPath = config.$initParent.i18nPath;
  14623. }
  14624. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14625. var setTitle_1 = config.$initParent.setTitle;
  14626. var handel_1 = config.$initParent;
  14627. config.$initParent.setTitle = function (title) {
  14628. var t = { title: title };
  14629. var WMSTranslate = window["WMSTranslate"];
  14630. if (WMSTranslate) {
  14631. if (typeof window['viewTranslate'] === 'function') {
  14632. window['viewTranslate'](t, title, "title");
  14633. }
  14634. }
  14635. setTitle_1.call(handel_1, t.title);
  14636. }.bind(config.$initParent);
  14637. }
  14638. var WMSTranslate = window["WMSTranslate"];
  14639. if (WMSTranslate) {
  14640. if (typeof window['viewTranslate'] === 'function') {
  14641. window['viewTranslate'](config, config.text, "text");
  14642. window['viewTranslate'](config, config.title, "title");
  14643. window['viewTranslate'](config, config.header, "header");
  14644. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14645. window['viewTranslate'](config, config.emptyText, "emptyText");
  14646. }
  14647. }
  14648. }
  14649. ct.call(this, config);
  14650. }
  14651. });
  14652. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14653. Ext.picker.Date.override({
  14654. initComponent: function () {
  14655. var me = this;
  14656. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14657. _initComponent.call(me);
  14658. },
  14659. selectToday: function () {
  14660. var me = this, btn = me.todayBtn, handler = me.handler;
  14661. if (btn && !btn.disabled) {
  14662. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14663. me.fireEvent('select', me, me.value);
  14664. if (handler) {
  14665. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14666. }
  14667. me.onSelect();
  14668. }
  14669. return me;
  14670. },
  14671. });
  14672. }
  14673. //# sourceMappingURL=component.js.map
  14674. function initMainTab () {
  14675. Ext.define('Yvan.MainTab', {
  14676. extend: 'Ext.tab.Panel',
  14677. xtype: 'maintab',
  14678. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14679. closeTabText: '关闭',
  14680. closeOthersTabsText: '关闭其他',
  14681. closeAllTabsText: '关闭所有'
  14682. }),
  14683. constructor: function (config) {
  14684. var me = this;
  14685. var newConfig = _$2.defaultsDeep({
  14686. // 强制属性
  14687. }, config);
  14688. this.superclass.constructor.call(me, newConfig);
  14689. },
  14690. initComponent: function () {
  14691. var me = this;
  14692. this.on({
  14693. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14694. _$2.defer(function () {
  14695. me.changeHash(newCard.id);
  14696. window['cp'] = newCard.yvanScope;
  14697. });
  14698. $$2(window).trigger('tabChange', {
  14699. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14700. });
  14701. },
  14702. afterrender: function () {
  14703. _$2.defer(function () {
  14704. me.tryRestoryPage();
  14705. });
  14706. }
  14707. });
  14708. this.superclass.initComponent.call(me);
  14709. },
  14710. tryRestoryPage: function () {
  14711. var me = this;
  14712. var hash = '' + window.location.hash;
  14713. if (hash && hash.indexOf('page=') > 0) {
  14714. if (hash.startsWith('#')) {
  14715. hash = hash.substr(1);
  14716. }
  14717. if (hash) {
  14718. var page = Qs.parse(hash).page;
  14719. if (page) {
  14720. // this.openScope(page)
  14721. me.fireEvent('restorypage', page);
  14722. }
  14723. }
  14724. }
  14725. },
  14726. changeHash: function (id) {
  14727. window.location.hash = Qs.stringify({ page: id });
  14728. },
  14729. /**
  14730. * 添加一个业务模块实例到选项卡
  14731. * @param scopeInstance 业务对象实例
  14732. * @param config ExtJS配置对象
  14733. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14734. */
  14735. addScope: function (scopeInstance, config, panelInitCallback) {
  14736. scopeInstance.topScope = scopeInstance;
  14737. var me = this;
  14738. if (config.path) {
  14739. for (var i = 0; i < this.items.items.length; i++) {
  14740. // 找到当前 tabs 里有没有已经打开过
  14741. var tab = this.items.items[i];
  14742. if (_$2.isEqual(tab.path, config.path)) {
  14743. // 激活
  14744. this.setActiveTab(tab);
  14745. return tab;
  14746. }
  14747. }
  14748. }
  14749. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14750. if (typeof panelInitCallback === 'function') {
  14751. panelInitCallback(newPanel);
  14752. }
  14753. // 添加业务模块
  14754. var newTab = this.add(newPanel);
  14755. this.setActiveTab(newTab);
  14756. newTab.on({
  14757. destroy: function (sender) {
  14758. me.changeHash('');
  14759. delete window['cp'];
  14760. }
  14761. });
  14762. return newTab;
  14763. }
  14764. });
  14765. }
  14766. //# sourceMappingURL=MainTab.js.map
  14767. /**
  14768. * 构建所有组件的公共属性
  14769. * @param config 原始config
  14770. * @param dragType 组件模式
  14771. * 不填,代表不能在设计时被拖拽
  14772. * row-container 是一个rows容器
  14773. * col-container 是一个cols容器
  14774. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14775. * row-item rows中的一行,比如 tree / grid / panel 等等
  14776. */
  14777. function baseConfig(config, dragType) {
  14778. // if (isDesignMode(config, undefined) && dragType) {
  14779. if (typeof config === 'object') {
  14780. var cc = '';
  14781. switch (dragType) {
  14782. case "cols-container":
  14783. cc = 'design_cols_container';
  14784. break;
  14785. case "col-item":
  14786. cc = 'design_col_item';
  14787. break;
  14788. case "rows-container":
  14789. cc = 'design_rows_container';
  14790. break;
  14791. case "row-item":
  14792. cc = 'design_row_item';
  14793. break;
  14794. }
  14795. if (typeof config.cls === 'string') {
  14796. _$2.extend(config, {
  14797. cls: [config.cls, 'yvan_design', cc]
  14798. });
  14799. }
  14800. else if (_$2.isArray(config.cls)) {
  14801. _$2.extend(config, {
  14802. cls: __spread(config.cls, ['yvan_design', cc])
  14803. });
  14804. }
  14805. else {
  14806. _$2.extend(config, {
  14807. cls: ['yvan_design', cc]
  14808. });
  14809. }
  14810. }
  14811. return config;
  14812. }
  14813. //# sourceMappingURL=base.js.map
  14814. function initPanel () {
  14815. /**
  14816. *
  14817. */
  14818. var ct = Ext.panel.Panel.prototype.constructor;
  14819. Ext.panel.Panel.override({
  14820. constructor: function (config) {
  14821. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14822. ct.call(this, newConfig);
  14823. }
  14824. });
  14825. var ss = Ext.form.FieldContainer.prototype;
  14826. Ext.form.FieldContainer.override({
  14827. config: __assign({}, fieldContainer)
  14828. });
  14829. }
  14830. //# sourceMappingURL=panel.js.map
  14831. function initGridColumn () {
  14832. var ct = Ext.grid.column.Column.prototype.constructor;
  14833. Ext.grid.column.Column.override({
  14834. constructor: function (config) {
  14835. var scope = lookupScope(config.$initParent.$initParent);
  14836. var newConfig = _$2.defaults({}, config, column);
  14837. if (typeof newConfig.summaryRenderer === 'string') {
  14838. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14839. if (typeof newConfig.summaryRenderer === 'function') {
  14840. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14841. }
  14842. }
  14843. if (config.formatter === 'datetime') {
  14844. newConfig.fix = ['system.formatDate()'];
  14845. delete newConfig.formatter;
  14846. }
  14847. // 在 grid.constructor 已经转换过了
  14848. // if (typeof newConfig.renderer === 'string') {
  14849. // newConfig.renderer = lookupFn(scope, config.renderer)
  14850. // if (typeof newConfig.renderer === 'function') {
  14851. // newConfig.renderer = newConfig.renderer.bind(scope)
  14852. // }
  14853. // }
  14854. ct.call(this, newConfig);
  14855. }
  14856. });
  14857. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14858. Ext.grid.column.Action.override({
  14859. constructor: function (config) {
  14860. var scope = lookupScope(config.$initParent.$initParent);
  14861. _$2.forEach(config.items, function (item) {
  14862. if (typeof item.handler === 'string') {
  14863. item.handler = lookupFn(scope, item.handler);
  14864. if (typeof item.handler === 'function') {
  14865. item.handler = item.handler.bind(scope);
  14866. }
  14867. }
  14868. });
  14869. ctAction.call(this, config);
  14870. }
  14871. });
  14872. var ck = Ext.grid.column.Check.prototype.constructor;
  14873. Ext.grid.column.Check.override({
  14874. constructor: function (config) {
  14875. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14876. var grid = sender.view.grid.ownerGrid;
  14877. var column = grid.getColumns()[sender.fullColumnIndex];
  14878. var context = {
  14879. event: e,
  14880. column: column,
  14881. field: sender.dataIndex,
  14882. value: checked,
  14883. record: record,
  14884. rowIdx: rowIndex
  14885. };
  14886. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14887. });
  14888. ck.call(this, config);
  14889. }
  14890. });
  14891. // 227573
  14892. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14893. // Ext.define('Yvan.ColumnOverride', {
  14894. // override: 'Ext.grid.column.Column',
  14895. //
  14896. // config: {
  14897. // enableSortOnClick: false,
  14898. // },
  14899. //
  14900. // // /**@Overrides*/
  14901. // onTitleElClick: function (e, t, sortOnClick) {
  14902. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14903. // if (!$(e.target).is('.x-column-header-trigger')) {
  14904. // // 不是点击菜单的情况下,让列自适应宽度
  14905. // this.autoSize()
  14906. // }
  14907. // return onTitleElClick.call(this, e, t, false)
  14908. // }
  14909. // });
  14910. }
  14911. //# sourceMappingURL=gridcolumn.js.map
  14912. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14913. /**
  14914. * 判断目标字符串与关键字是否重叠
  14915. * @param target 目标字符串
  14916. * @param keyword 搜索关键字
  14917. */
  14918. function pinyinMatch(target, keyword) {
  14919. if (typeof target != 'string' || typeof keyword != 'string') {
  14920. return false;
  14921. }
  14922. if (!keyword || !target) {
  14923. return false;
  14924. }
  14925. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14926. keyword = _$2.toLower(keyword);
  14927. var pos1 = _$2.toLower(target).indexOf(keyword);
  14928. if (pos1 >= 0) {
  14929. return true;
  14930. }
  14931. var len = _$2.intersection(keyword.split('')).length;
  14932. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14933. return true;
  14934. }
  14935. return false;
  14936. }
  14937. /**
  14938. * 对某个表达式进行求值
  14939. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14940. *
  14941. * @example
  14942. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14943. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14944. *
  14945. * @param data 数据环境对象
  14946. * @param express 表达式对象
  14947. */
  14948. function calcExpress(data, express) {
  14949. var result = express;
  14950. if (SIMPLE_RE.test(express)) {
  14951. // '{foo}' 简单表达式
  14952. var path = express.substring(1, express.length - 1);
  14953. var ret = _$2.get(data, path);
  14954. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14955. }
  14956. while (true) {
  14957. var mlist = result.match(/{(.*?)}/);
  14958. if (!mlist) {
  14959. break;
  14960. }
  14961. var pathC = mlist[0]; // {query.a}
  14962. var path = mlist[1]; // query.a
  14963. var value = _$2.get(data, path);
  14964. result = result.replaceAll(pathC, value || '');
  14965. }
  14966. return result;
  14967. }
  14968. /**
  14969. * 对个对象进行表达式求值,不用回调
  14970. * @example
  14971. * 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}'] })
  14972. *
  14973. * {
  14974. * a: '{query.a}',
  14975. * b: {
  14976. * b1: '{query.b1}',
  14977. * b2: '{query.b2}',
  14978. * },
  14979. * c: 'aa',
  14980. * d: [
  14981. * '{query.d1}',
  14982. * '{query.d2}'
  14983. * ]
  14984. * }
  14985. *
  14986. * 计算结果为
  14987. * {
  14988. * a: 'aValue',
  14989. * b: {
  14990. * b1: 'b1Value',
  14991. * b2: 'b2Value'
  14992. * },
  14993. * c: 'aa'
  14994. * d: [
  14995. * '1',
  14996. * '2'
  14997. * ]
  14998. * }
  14999. *
  15000. * @param data
  15001. * @param paramObject
  15002. */
  15003. function calcObjectFlat(data, paramObject) {
  15004. var result = _$2.cloneDeep(paramObject);
  15005. if (typeof paramObject === 'string') {
  15006. return calcExpress(data, paramObject);
  15007. }
  15008. var trav = function (param) {
  15009. _$2.forOwn(param, function (value, key) {
  15010. if (_$2.isPlainObject(value)) {
  15011. // 深度递归,对子对象进行求解
  15012. trav(value);
  15013. }
  15014. else if (_$2.isString(value)) {
  15015. // 字符串直接用 calcExpress 表达式求解
  15016. param[key] = calcExpress(data, param[key]);
  15017. }
  15018. else if (_$2.isArray(value)) {
  15019. // 数组求解
  15020. _$2.each(value, function (v, idx) {
  15021. value[idx] = calcExpress(data, v);
  15022. });
  15023. }
  15024. });
  15025. };
  15026. trav(result);
  15027. return result;
  15028. }
  15029. /**
  15030. * 合併 data 到當前的 ViewModel 對象
  15031. */
  15032. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  15033. var newRow = {};
  15034. if (isFlat == false) {
  15035. newRow = data;
  15036. }
  15037. else {
  15038. flatObject(newRow, '', data);
  15039. }
  15040. if (!propertyName) {
  15041. _$2.forOwn(newRow, function (value, key) {
  15042. viewModel.set(key, value);
  15043. });
  15044. }
  15045. else {
  15046. _$2.forOwn(newRow, function (value, key) {
  15047. viewModel.set(propertyName + "." + key, value);
  15048. });
  15049. }
  15050. }
  15051. /**
  15052. * 转换内联结构的行,到平面结构
  15053. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  15054. *
  15055. * @param array
  15056. * @param flatOption
  15057. * @return {[]}
  15058. */
  15059. function flatRow(array) {
  15060. var ret = [];
  15061. _$2.forEach(array, function (row) {
  15062. var newRow = {};
  15063. flatObject(newRow, '', row);
  15064. ret.push(newRow);
  15065. });
  15066. return ret;
  15067. }
  15068. function flatObject(parentObj, parentProp, obj) {
  15069. _$2.forOwn(obj, function (value, key) {
  15070. var fullKey = parentProp ? parentProp + '_' + key : key;
  15071. if (_$2.isArray(value)) {
  15072. parentObj[fullKey] = _$2.map(value, function (row) {
  15073. var newRow = {};
  15074. flatObject(newRow, '', row);
  15075. return newRow;
  15076. });
  15077. }
  15078. else {
  15079. if (typeof value === 'object') {
  15080. flatObject(parentObj, fullKey, value);
  15081. }
  15082. else {
  15083. parentObj[fullKey] = value;
  15084. }
  15085. }
  15086. });
  15087. }
  15088. /**
  15089. * 替换内部结构中,所有 N/A
  15090. */
  15091. function replaceNA(obj) {
  15092. if (obj === 'N/A') {
  15093. return '';
  15094. }
  15095. if (_$2.isArray(obj)) {
  15096. _$2.forEach(obj, function (value, idx) {
  15097. if (value === 'N/A') {
  15098. obj[idx] = '';
  15099. }
  15100. else {
  15101. replaceNA(value);
  15102. }
  15103. });
  15104. }
  15105. else if (_$2.isPlainObject(obj)) {
  15106. _$2.forOwn(obj, function (value, key) {
  15107. if (value === 'N/A') {
  15108. obj[key] = '';
  15109. }
  15110. else {
  15111. replaceNA(value);
  15112. }
  15113. });
  15114. }
  15115. }
  15116. function deepTravJson(obj, resolver) {
  15117. if (_$2.isArray(obj)) {
  15118. _$2.forEach(obj, function (value, idx) {
  15119. if (typeof value === 'string') {
  15120. resolver(obj, value, idx);
  15121. }
  15122. else {
  15123. deepTravJson(value, resolver);
  15124. }
  15125. });
  15126. }
  15127. else if (_$2.isPlainObject(obj)) {
  15128. _$2.forOwn(obj, function (value, key) {
  15129. if (typeof value === 'string') {
  15130. resolver(obj, value, key);
  15131. }
  15132. else {
  15133. deepTravJson(value, resolver);
  15134. }
  15135. });
  15136. }
  15137. }
  15138. /**
  15139. * 根据表达式进入写值
  15140. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15141. * express="test-{query.a}" 写值就会失败
  15142. *
  15143. * @example
  15144. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15145. * 写值成功
  15146. *
  15147. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15148. * 写值失败
  15149. *
  15150. * @param viewModel VM对象
  15151. * @param express 表达式对象
  15152. * @param value 目标值
  15153. */
  15154. function tryWriteByExpress(viewModel, express, value) {
  15155. if (SIMPLE_RE.test(express)) {
  15156. // '{foo}' 简单表达式
  15157. express = express.substring(1, express.length - 1);
  15158. viewModel.set(express, value);
  15159. }
  15160. }
  15161. /**
  15162. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15163. * @example
  15164. * 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]})
  15165. *
  15166. * expressObject:
  15167. * {
  15168. * a: '{query.a}',
  15169. * b: {
  15170. * b1: '{query.b1}',
  15171. * b2: '{query.b2}',
  15172. * },
  15173. * c: 'aa',
  15174. * d: [
  15175. * '{query.a}',
  15176. * '{query.b2}'
  15177. * ]
  15178. * }
  15179. *
  15180. * valueObject:
  15181. * {
  15182. * a: 'aValue',
  15183. * b: {
  15184. * b1: 'b1Value',
  15185. * b2: 'b2Value'
  15186. * },
  15187. * c: 'aa'
  15188. * c: [
  15189. * 'aValue',
  15190. * 'b2Value'
  15191. * ]
  15192. * }
  15193. *
  15194. * 系统会尝试回写
  15195. * viewModel.set('query.a', 'aValue')
  15196. * viewModel.set('query.b1', 'b1Value')
  15197. * viewModel.set('query.b2', 'b2Value')
  15198. *
  15199. * @param expressObject 含表达式的对象
  15200. * @param valueObject 表达式计算完成之后的结果对象
  15201. * @param writeFn 写入的方法 (path, value)=>void
  15202. */
  15203. function tryWriteObject(expressObject, valueObject, writeFn) {
  15204. var trav = function (pathPrefix) {
  15205. var parent = expressObject;
  15206. if (_$2.size(pathPrefix) > 1) {
  15207. parent = _$2.get(parent, pathPrefix.substring(1));
  15208. }
  15209. _$2.forOwn(parent, function (value, key) {
  15210. if (_$2.isPlainObject(value)) {
  15211. // 深度递归,对子对象进行求解
  15212. trav(pathPrefix + "." + key);
  15213. }
  15214. else if (_$2.isString(value)) {
  15215. // 字符串直接用 calcExpress 表达式求解
  15216. if (SIMPLE_RE.test(value)) {
  15217. // If we have '{foo}' alone it is a literal 简单表达式
  15218. var targetPath = value.substring(1, value.length - 1);
  15219. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15220. if (!writeFn) {
  15221. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15222. }
  15223. else {
  15224. writeFn(targetPath, targetValue);
  15225. }
  15226. }
  15227. }
  15228. else if (_$2.isArray(value)) {
  15229. _$2.each(value, function (v, idx) {
  15230. if (SIMPLE_RE.test(v)) {
  15231. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15232. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15233. if (!writeFn) {
  15234. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15235. }
  15236. else {
  15237. writeFn(targetPath, targetValue);
  15238. }
  15239. }
  15240. });
  15241. }
  15242. });
  15243. };
  15244. trav("");
  15245. }
  15246. /**
  15247. * 尝试去掉变量两边括号
  15248. * {a} => a
  15249. * a => a
  15250. */
  15251. function tryVarSimple(value) {
  15252. if (SIMPLE_RE.test(value)) {
  15253. // If we have '{foo}' alone it is a literal 简单表达式
  15254. return value.substring(1, value.length - 1);
  15255. }
  15256. return value;
  15257. }
  15258. /**
  15259. * 对多个表达式进行求值. 异步回调的方式返回
  15260. * {
  15261. * a: 1,
  15262. * b: '{someBind}',
  15263. * c: ['a', 'b', 'c'],
  15264. * d: ['a', 'b', '{someBind}'],
  15265. * e: {
  15266. * y: 1,
  15267. * z: 2
  15268. * },
  15269. * f: {
  15270. * y: 1,
  15271. * z: '{someBind}'
  15272. * }
  15273. * }
  15274. *
  15275. * // Will produce
  15276. * {
  15277. * b: value,
  15278. * d: ['a', 'b', value],
  15279. * f: {
  15280. * y: 1,
  15281. * z: value
  15282. * }
  15283. * }
  15284. * @param viewModel scope.viewModel对象
  15285. * @param paramObject 求值对象
  15286. */
  15287. function calcObject(viewModel, paramObject) {
  15288. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15289. return new Promise(function (resolve) {
  15290. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15291. schedule.destroy();
  15292. // 从 Ext.data.Model 对象转换为 js-object 对象
  15293. ret = toPlainObject(ret);
  15294. resolve(ret);
  15295. }, viewModel, { single: true });
  15296. });
  15297. }
  15298. /**
  15299. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15300. * @param config 组件构造函数传入的 config 配置文件
  15301. */
  15302. function getParentGrid(config) {
  15303. var _a;
  15304. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15305. }
  15306. /**
  15307. * 解析
  15308. * {
  15309. * condition: "{skuId}",
  15310. * errorMsg: "无法编辑",
  15311. * notice: 'msg'
  15312. * }
  15313. */
  15314. function tryEnable(data, enableSetting) {
  15315. if (!enableSetting) {
  15316. // 没有这一段配置,可以编辑
  15317. return true;
  15318. }
  15319. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15320. if (!evalFunction(data, condition)) {
  15321. // 没有达成 condition 条件
  15322. // 计算 msg 消息内容
  15323. var msgContent = calcExpress(data, errorMsg);
  15324. if (msgContent) {
  15325. if (!notice || notice === 'msg') {
  15326. // 进行提示
  15327. msg$1(msgContent);
  15328. }
  15329. }
  15330. return false;
  15331. }
  15332. return true;
  15333. }
  15334. /**
  15335. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15336. * @param sender 目标对象
  15337. * @param config 目标对象的配置(在构造函数之前也可以)
  15338. * @param getDictFn 获取字典的方法
  15339. * @param bizKey 传入字典的参数
  15340. * @param multiValueSeparator 多个字典值的分割符号
  15341. */
  15342. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15343. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15344. // sender 和 config为空的时候获取值、
  15345. if (_$2.isArray(getDictFn)) {
  15346. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15347. var realArray_1 = getDictFn;
  15348. getDictFn = function () {
  15349. return realArray_1;
  15350. };
  15351. }
  15352. if (!sender) {
  15353. return new Promise(function (resolve, reject) {
  15354. getDictFn(bizKey, function (r) {
  15355. resolve({ config: config, r: r });
  15356. });
  15357. });
  15358. }
  15359. if (sender.xtype === 'combotree') {
  15360. getDictFn(bizKey, function (r) {
  15361. if (sender.store) {
  15362. // 异步回传
  15363. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15364. }
  15365. else {
  15366. // 同步回传
  15367. config.store = new Ext.data.TreeStore({ root: r });
  15368. }
  15369. });
  15370. return;
  15371. }
  15372. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15373. getDictFn(bizKey, function (r) {
  15374. var _a, _b;
  15375. if (sender.store) {
  15376. // 异步回传
  15377. sender.setStore(new Ext.data.Store(r));
  15378. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15379. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15380. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15381. if (typeof realValue !== 'undefined') {
  15382. sender.setValue(realValue);
  15383. }
  15384. }
  15385. else {
  15386. // 同步回传
  15387. config.store = new Ext.data.Store(r);
  15388. }
  15389. });
  15390. return;
  15391. }
  15392. else if (sender.xtype === 'gridcolumn') {
  15393. var grid = getParentGrid(config);
  15394. var editor_1 = config.editor, renderer = config.renderer;
  15395. getDictFn(bizKey, function (r) {
  15396. if (sender.store) {
  15397. // 已经渲染出来了, 用方法进行修改
  15398. var editor_2 = sender.getEditor();
  15399. if (editor_2 && editor_2.xtype === 'combo') {
  15400. var valueField_1 = r.field[0];
  15401. var displayField_1 = r.field[1];
  15402. editor_2.valueField = valueField_1;
  15403. editor_2.setDisplayField(displayField_1);
  15404. editor_2.setStore(new Ext.data.Store(r));
  15405. }
  15406. sender.setFilter({
  15407. type: 'list',
  15408. options: _$2.map(r.data, function (r) { return ({
  15409. id: '' + r.id,
  15410. text: r.text,
  15411. }); })
  15412. });
  15413. }
  15414. else {
  15415. // 没有渲染之前,修改 config 即可
  15416. if (editor_1 && editor_1.xtype === 'combo') {
  15417. // 带编辑模式
  15418. editor_1.store = new Ext.data.Store(r);
  15419. }
  15420. config.filter = {
  15421. type: 'list',
  15422. options: _$2.map(r.data, function (r) { return ({
  15423. id: '' + r.id,
  15424. text: r.text,
  15425. }); })
  15426. };
  15427. }
  15428. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15429. var renderer = function (value, metaData) {
  15430. if (metaData === void 0) { metaData = false; }
  15431. if (!value && value != 0) {
  15432. return '';
  15433. }
  15434. var valueField = r.field[metaData === true ? 1 : 0];
  15435. var displayField = r.field[metaData === true ? 0 : 1];
  15436. var separator = multiValueSeparator;
  15437. if (separator) {
  15438. var arr = value.split(separator);
  15439. var displayValue_1 = "";
  15440. var _loop_1 = function (i) {
  15441. var itv = arr[i];
  15442. if (i > 0) {
  15443. displayValue_1 += separator;
  15444. }
  15445. _$2.each(r.data, function (row) {
  15446. // 从 valueField 找到要显示的 displayField
  15447. if (row[valueField] == itv) {
  15448. displayValue_1 += row[displayField];
  15449. return false;
  15450. }
  15451. else {
  15452. if (i >= r.data.length - 1) {
  15453. displayValue_1 += itv;
  15454. }
  15455. }
  15456. });
  15457. };
  15458. for (var i = 0; i < arr.length; i++) {
  15459. _loop_1(i);
  15460. }
  15461. return displayValue_1;
  15462. }
  15463. _$2.each(r.data, function (row) {
  15464. // 从 valueField 找到要显示的 displayField
  15465. if (row[valueField] == value) {
  15466. value = row[displayField];
  15467. return false;
  15468. }
  15469. });
  15470. return value;
  15471. };
  15472. var dictForExcel = {};
  15473. var valueField = r.field[0];
  15474. var displayField = r.field[1];
  15475. _$2.each(r.data, function (row) {
  15476. // 从 valueField 找到要显示的 displayField
  15477. var key = row[valueField];
  15478. if (key != '' && typeof key != "undefined" && key != null) {
  15479. dictForExcel[key] = row[displayField];
  15480. }
  15481. });
  15482. if (sender.rendered) {
  15483. // 已经渲染出来了, 对列进行渲染
  15484. sender.renderer = renderer;
  15485. sender.dictForExcel = dictForExcel;
  15486. sender.getView().refresh();
  15487. }
  15488. else {
  15489. sender.renderer = renderer;
  15490. sender.dictForExcel = dictForExcel;
  15491. config.renderer = renderer;
  15492. config.dictForExcel = dictForExcel;
  15493. }
  15494. });
  15495. return;
  15496. }
  15497. throw new TypeError("无法识别的组件类型");
  15498. }
  15499. /**
  15500. * 调用服务器 Ajax
  15501. */
  15502. function invokeServer$1(url) {
  15503. var args = [];
  15504. for (var _i = 1; _i < arguments.length; _i++) {
  15505. args[_i - 1] = arguments[_i];
  15506. }
  15507. // @ts-ignore
  15508. return ajax.func({
  15509. url: url,
  15510. method: 'invoke',
  15511. args: args
  15512. });
  15513. }
  15514. function clearViewModelValues(viewModel, propertyName) {
  15515. if (!propertyName) {
  15516. var dd_1 = viewModel.getData();
  15517. _$2.forOwn(dd_1, function (value, key) {
  15518. viewModel.set(key, '');
  15519. });
  15520. return;
  15521. }
  15522. var dd = _$2.get(viewModel.getData(), propertyName);
  15523. _$2.forOwn(dd, function (value, key) {
  15524. viewModel.set(propertyName + '.' + key, '');
  15525. });
  15526. }
  15527. function reloadGrid(scope, gridRefName) {
  15528. var _a;
  15529. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15530. }
  15531. /**
  15532. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15533. */
  15534. function toPlainObject(obj) {
  15535. if (obj.isModel) {
  15536. obj = obj.data;
  15537. }
  15538. _$2.forOwn(obj, function (v, k) {
  15539. // Ext.data.Model.constructor
  15540. if (!v) {
  15541. return;
  15542. }
  15543. if (v.isModel) {
  15544. v = v.data;
  15545. }
  15546. if (typeof v === 'object') {
  15547. obj[k] = toPlainObject(v);
  15548. }
  15549. else {
  15550. obj[k] = v;
  15551. }
  15552. });
  15553. return obj;
  15554. }
  15555. function confirm(msg, sender) {
  15556. return new Promise(function (resolve) {
  15557. var _a, _b;
  15558. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15559. var t = { msg: msg };
  15560. var WMSTranslate = window["WMSTranslate"];
  15561. if (WMSTranslate) {
  15562. if (typeof window['viewTranslate'] === 'function') {
  15563. window['viewTranslate'](t, msg, "msg");
  15564. }
  15565. }
  15566. var config = {
  15567. title: '请确认',
  15568. modal: true,
  15569. animateTarget: sender,
  15570. // resizable: false,
  15571. // constrainHeader: true,
  15572. // constrain: true,
  15573. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15574. layout: {
  15575. type: 'hbox',
  15576. pack: 'start',
  15577. align: 'stretch'
  15578. },
  15579. items: [
  15580. {
  15581. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15582. border: false,
  15583. },
  15584. {
  15585. flex: 1,
  15586. border: false,
  15587. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15588. }
  15589. ],
  15590. buttons: [
  15591. {
  15592. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15593. handler: function () {
  15594. resolve();
  15595. win.close();
  15596. }
  15597. },
  15598. {
  15599. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15600. handler: function () {
  15601. win.close();
  15602. }
  15603. }
  15604. ],
  15605. keyMapEnabled: true,
  15606. keyMap: {
  15607. ENTER: function () {
  15608. resolve();
  15609. win.close();
  15610. }
  15611. }
  15612. };
  15613. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15614. config.constrain = true;
  15615. }
  15616. var win = new Ext.Window(config);
  15617. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15618. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15619. }
  15620. win.show();
  15621. });
  15622. }
  15623. /**
  15624. * 任何符号字符串都替换成下换线
  15625. */
  15626. function normId(value) {
  15627. return _$2.replace(value, /[^\w]/g, '_');
  15628. }
  15629. /**
  15630. *
  15631. * @param sender
  15632. * @param propertyName
  15633. * @param gridRefName
  15634. */
  15635. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15636. var _a, _b;
  15637. var scope = lookupScope(sender);
  15638. clearViewModelValues(scope.viewModel, propertyName);
  15639. if (!gridRefName) {
  15640. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15641. }
  15642. else {
  15643. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15644. }
  15645. }
  15646. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15647. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15648. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15649. var value = _$2.trim(sender.rawValue);
  15650. raiseClick(eOpts.handle);
  15651. }
  15652. }, 150);
  15653. function saveGridRow(grid1) {
  15654. var _a;
  15655. var config = grid1.config;
  15656. var scope = lookupScope(grid1);
  15657. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15658. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15659. // "表格保存"的相关配置
  15660. var dbSaveConfig = {
  15661. columns: [],
  15662. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15663. saveRowValues: saveRowValues,
  15664. path: scope.originalVjson.__custom_path,
  15665. };
  15666. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15667. if (err) {
  15668. // 如果有异常就不保存
  15669. return;
  15670. }
  15671. // 构建"表格保存"的相关配置
  15672. for (var i = 0; i < config.columns.length; i++) {
  15673. var c = config.columns[i];
  15674. var v = {
  15675. dataIndex: c.dataIndex,
  15676. header: c.header,
  15677. dbColumn: c.dbColumn,
  15678. serverCreateValue: c.serverCreateValue,
  15679. dbIsDeleteKey: c.dbIsDeleteKey,
  15680. dbIsUpdateKey: c.dbIsUpdateKey,
  15681. dbUpdateEnable: c.dbUpdateEnable,
  15682. serverValueConvert: c.dbUpdateEnable,
  15683. };
  15684. if (c.editor) {
  15685. v.editor = {
  15686. xtype: c.editor.xtype,
  15687. required: c.editor.required,
  15688. };
  15689. }
  15690. dbSaveConfig.columns.push(v);
  15691. }
  15692. // 进行业务上的逻辑校验
  15693. var hasError = false;
  15694. _$2.forEach(rows, function (row, i) {
  15695. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15696. var c = config.columns[i_1];
  15697. var value = row[c.dataIndex];
  15698. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15699. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15700. hasError = true;
  15701. return false;
  15702. }
  15703. if (c.xtype === 'checkcolumn') {
  15704. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15705. row[c.dataIndex] = c.uncheckedValue;
  15706. }
  15707. if (value === true && typeof c.checkedValue !== 'undefined') {
  15708. row[c.dataIndex] = c.checkedValue;
  15709. }
  15710. }
  15711. }
  15712. });
  15713. if (hasError) {
  15714. return;
  15715. }
  15716. // 设置当前界面为 "保存中..." 状态
  15717. grid1.setLoading(true);
  15718. invokeServer$1('/Dev@batchSave', {
  15719. newRows: newRows,
  15720. modifyRows: modifyRows,
  15721. removeRecords: removeRecords,
  15722. config: dbSaveConfig,
  15723. }).then(function (res) {
  15724. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15725. msg$1(res.msg);
  15726. grid1.reload();
  15727. }).catch(function (e) {
  15728. console.error(e);
  15729. showErrorDialog$1(_$2.toString(e));
  15730. }).finally(function () {
  15731. // 无论正常异常,关闭 "保存中..." 状态
  15732. grid1.setLoading(false);
  15733. });
  15734. }
  15735. function insertGridRow(grid1) {
  15736. var config = grid1.config;
  15737. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15738. var insertRow = {};
  15739. _$2.forEach(config.columns, function (c) {
  15740. var fn = c.createValue;
  15741. if (_$2.startsWith(fn, 'scope.') ||
  15742. _$2.startsWith(fn, 'system.')) {
  15743. var scope = lookupScope(grid1);
  15744. var fn2 = lookupFn(scope, fn, c);
  15745. if (_$2.isFunction(fn2)) {
  15746. var newValue = fn2();
  15747. if (!_$2.isUndefined(newValue)) {
  15748. insertRow[c.dataIndex] = newValue;
  15749. }
  15750. }
  15751. }
  15752. else if (_$2.isString(fn) && fn) {
  15753. insertRow[c.dataIndex] = fn;
  15754. }
  15755. });
  15756. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15757. }
  15758. function commitMe(sender) {
  15759. var window = sender.up('window');
  15760. var scope = lookupScope(sender);
  15761. if (typeof scope['commit'] === 'function') {
  15762. scope['commit']().then(function (res) {
  15763. window.close();
  15764. });
  15765. }
  15766. }
  15767. function removeGridRow(grid1) {
  15768. var _a;
  15769. var config = grid1.config;
  15770. var rows = [];
  15771. if (grid1.selModel.selType === "rowmodel") {
  15772. rows.push(grid1.selection);
  15773. }
  15774. else {
  15775. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15776. rows.push(r);
  15777. });
  15778. }
  15779. if (rows.length > 1) {
  15780. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15781. if (_$2.isUndefined(batchRemoveConfirm)) {
  15782. //不需要提示
  15783. _$2.forEach(rows, function (r) {
  15784. grid1.getStore().remove(r);
  15785. });
  15786. }
  15787. else {
  15788. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15789. confirm(tip).then(function () {
  15790. _$2.forEach(rows, function (r) {
  15791. grid1.getStore().remove(r);
  15792. });
  15793. });
  15794. }
  15795. }
  15796. else if (rows.length === 1) {
  15797. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15798. if (_$2.isUndefined(singleRemoveConfirm)) {
  15799. //不需要提示
  15800. grid1.getStore().remove(rows[0]);
  15801. }
  15802. else {
  15803. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15804. _$2.forEach(config.columns, function (c) {
  15805. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15806. });
  15807. confirm(tip_1).then(function () {
  15808. grid1.getStore().remove(rows[0]);
  15809. });
  15810. }
  15811. }
  15812. else {
  15813. msg$1('请选择要删除的数据!');
  15814. }
  15815. }
  15816. function moveUpGridRow(grid) {
  15817. grid.rowMoveUp();
  15818. }
  15819. function moveDownGridRow(grid) {
  15820. grid.rowMoveDown();
  15821. }
  15822. var SystemEventFu = /** @class */ (function () {
  15823. function SystemEventFu() {
  15824. }
  15825. SystemEventFu.prototype.moveUpGridRow = function () {
  15826. return function (sender) {
  15827. var grid1 = sender.up('yvgrid');
  15828. moveUpGridRow(grid1);
  15829. };
  15830. };
  15831. SystemEventFu.prototype.commitMe = function () {
  15832. return function (sender) {
  15833. commitMe(sender);
  15834. };
  15835. };
  15836. SystemEventFu.prototype.moveDownGridRow = function () {
  15837. return function (sender) {
  15838. var grid1 = sender.up('yvgrid');
  15839. moveDownGridRow(grid1);
  15840. };
  15841. };
  15842. SystemEventFu.prototype.saveGridRow = function () {
  15843. return function (sender) {
  15844. var grid1 = sender.up('yvgrid');
  15845. saveGridRow(grid1);
  15846. };
  15847. };
  15848. SystemEventFu.prototype.insertGridRow = function () {
  15849. return function (sender) {
  15850. var grid1 = sender.up('yvgrid');
  15851. insertGridRow(grid1);
  15852. };
  15853. };
  15854. SystemEventFu.prototype.removeGridRow = function () {
  15855. return function (sender) {
  15856. var grid1 = sender.up('yvgrid');
  15857. removeGridRow(grid1);
  15858. };
  15859. };
  15860. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15861. return function (sender, config) {
  15862. if (!config.listeners) {
  15863. config.listeners = {};
  15864. }
  15865. config.listeners.afterrender = function (sender) {
  15866. var scope = lookupScope(sender);
  15867. // $(sender.el.dom).on('keydown', (e) => {
  15868. // const xtype = Ext.fly(e.target).component.xtype
  15869. // if (xtype === 'textfield' && e.keyCode === 13) {
  15870. // Ext.defer(() => {
  15871. // raiseClick(scope.refs[btnReferenceName])
  15872. // })
  15873. // e.preventDefault()
  15874. // e.stopPropagation()
  15875. // return false
  15876. // }
  15877. // })
  15878. $(sender.el.dom).on('keyup', function (e) {
  15879. var tt = Ext.fly(e.target).component;
  15880. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15881. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15882. ![10, 13, 20, 40].includes(e.keyCode)) {
  15883. return;
  15884. }
  15885. e.preventDefault();
  15886. e.stopPropagation();
  15887. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15888. return;
  15889. });
  15890. };
  15891. };
  15892. };
  15893. SystemEventFu.prototype.confirm = function (text, fn) {
  15894. return function (sender) {
  15895. var scope = lookupScope(sender);
  15896. var msg = calcExpress(scope.viewModel.data, text);
  15897. confirm(msg, sender).then(function () {
  15898. fn.call(scope, sender);
  15899. });
  15900. };
  15901. };
  15902. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15903. return function (sender) {
  15904. var scope = lookupScope(sender);
  15905. var grid = scope.refs[gridRefName];
  15906. if (grid) {
  15907. var records = grid.getSelectionModel().getLastSelected();
  15908. grid.store.remove(records);
  15909. }
  15910. };
  15911. };
  15912. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15913. //可以是 scope.XX / system.XX / string / lookup表达式
  15914. writeTarget) {
  15915. return function (sender) {
  15916. if (!invokeUrl) {
  15917. return;
  15918. }
  15919. var scope = lookupScope(sender);
  15920. scope.setLoading(true);
  15921. var data = scope.viewModel.data;
  15922. if (invokeParam) {
  15923. data = calcObjectFlat(data, invokeParam);
  15924. }
  15925. invokeServer$1(invokeUrl, data).then(function (res) {
  15926. if (res.success) {
  15927. if (typeof writeTarget === "string") {
  15928. _$2.forOwn(res.data, function (v, k) {
  15929. scope.viewModel.set(writeTarget + "." + k, v);
  15930. });
  15931. }
  15932. else if (typeof writeTarget === 'function') {
  15933. writeTarget.call(scope, res.data);
  15934. }
  15935. else if (typeof writeTarget === 'object') {
  15936. var ret = calcObjectFlat(res.data, writeTarget);
  15937. _$2.forOwn(ret, function (v, k) {
  15938. scope.viewModel.set(k, v);
  15939. });
  15940. }
  15941. }
  15942. else {
  15943. showErrorDialog$1(res.msg || '未知错误', sender);
  15944. }
  15945. }).catch(function (e) {
  15946. var _a, _b;
  15947. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15948. showErrorDialog$1(msg || e.toString(), sender);
  15949. }).finally(function () {
  15950. scope.setLoading(false);
  15951. });
  15952. };
  15953. };
  15954. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15955. return function (sender) {
  15956. var scope = lookupScope(sender);
  15957. scope.setLoading(true);
  15958. var data = scope.viewModel.data;
  15959. if (arg0) {
  15960. data = calcObjectFlat(data, arg0);
  15961. }
  15962. invokeServer$1(groovyUrl, data).then(function (res) {
  15963. if (res.success) {
  15964. if (res.msg) {
  15965. msg(res.msg);
  15966. }
  15967. if (typeof successCallback === 'function') {
  15968. successCallback.call(scope, sender, res.data);
  15969. }
  15970. }
  15971. else {
  15972. showErrorDialog$1(res.msg || '未知错误', sender);
  15973. }
  15974. }).catch(function (e) {
  15975. var _a, _b;
  15976. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15977. showErrorDialog$1(msg || e.toString(), sender);
  15978. }).finally(function () {
  15979. scope.setLoading(false);
  15980. });
  15981. };
  15982. };
  15983. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15984. return function (sender) {
  15985. var scope = lookupScope(sender);
  15986. var form = scope.down('form');
  15987. if (form) {
  15988. // 如果下级有表单,就做表单校验
  15989. var valid = form.isValid();
  15990. if (!valid) {
  15991. return;
  15992. }
  15993. }
  15994. scope.setLoading(true);
  15995. var data = scope.viewModel.data;
  15996. if (arg0) {
  15997. data = calcObjectFlat(data, arg0);
  15998. }
  15999. invokeServer$1(groovyUrl, data).then(function (res) {
  16000. if (res.success) {
  16001. if (res.msg) {
  16002. msg(res.msg);
  16003. }
  16004. scope.dialogSuccess(res);
  16005. }
  16006. else {
  16007. showErrorDialog$1(res.msg || '未知错误', sender);
  16008. }
  16009. }).catch(function (e) {
  16010. var _a, _b;
  16011. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  16012. showErrorDialog$1(msg || e.toString(), sender);
  16013. }).finally(function () {
  16014. scope.setLoading(false);
  16015. });
  16016. };
  16017. };
  16018. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16019. return function (sender) {
  16020. var scope = lookupScope(sender);
  16021. if (lookupObject) {
  16022. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16023. }
  16024. else {
  16025. scope.dialogSuccess();
  16026. }
  16027. };
  16028. };
  16029. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16030. return function (sender) {
  16031. var scope = lookupScope(sender);
  16032. clearViewModelValues(scope.viewModel, propertyName);
  16033. };
  16034. };
  16035. SystemEventFu.prototype.getGrid = function (url) {
  16036. return function (sender, config) {
  16037. if (config.xtype == "combogridmulti") {
  16038. // @ts-ignore
  16039. require([url], function (grid) {
  16040. _$2.forOwn(grid.default, function (v, k) {
  16041. sender[k] = v;
  16042. sender.config[k] = v;
  16043. if (sender.rendered) {
  16044. // 已经渲染出来了,重新调用 reload 强制刷新
  16045. sender.reload();
  16046. }
  16047. });
  16048. });
  16049. }
  16050. else {
  16051. // @ts-ignore
  16052. require([url], function (grid) {
  16053. sender.grid = grid.default;
  16054. config.grid = grid.default;
  16055. });
  16056. }
  16057. };
  16058. };
  16059. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16060. return function (sender) {
  16061. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16062. };
  16063. };
  16064. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16065. return function (sender) {
  16066. var _a, _b;
  16067. var scope = lookupScope(sender);
  16068. if (!gridRefName) {
  16069. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16070. }
  16071. else {
  16072. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16073. }
  16074. };
  16075. };
  16076. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16077. return function (sender) {
  16078. var scope = lookupScope(sender);
  16079. var data = scope.viewModel.data;
  16080. var param = calcObjectFlat(data, lookupForData);
  16081. // @ts-ignore
  16082. require([url], function (module) {
  16083. var ScopeClass = module.default;
  16084. var scope = new ScopeClass();
  16085. scope.success = successCallback;
  16086. scope.showDialog(sender, {}, { data: param });
  16087. });
  16088. };
  16089. };
  16090. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16091. return function (sender, queryValue) {
  16092. showWidget(widgetUrl, lookup, sender, queryValue);
  16093. };
  16094. };
  16095. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16096. return function (sender) {
  16097. clearViewModelByLookup(sender, lookup);
  16098. };
  16099. };
  16100. SystemEventFu.prototype.closeMe = function (callBack) {
  16101. return function (sender) {
  16102. var scope = lookupScope(sender);
  16103. scope.close();
  16104. if (callBack) {
  16105. callBack.call(sender);
  16106. }
  16107. };
  16108. };
  16109. // 未完成
  16110. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16111. return function (sender) {
  16112. var scope = lookupScope(sender);
  16113. var data = scope.viewModel.data;
  16114. var billSetting = scope.billSetting;
  16115. var param = calcObjectFlat(data, lookupForData);
  16116. return new Promise(function (resolve, reject) {
  16117. var sf = function (scope) {
  16118. scope.success = function (dlgScope, dlgSender, reData) {
  16119. };
  16120. scope.showDialog(sender, {}, { data: param });
  16121. };
  16122. // @ts-ignore
  16123. require([url], function (module) {
  16124. // 业务描述文件
  16125. if (url.endsWith(".bill")) {
  16126. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16127. sf(scope);
  16128. });
  16129. }
  16130. else { //原生yvanui文件
  16131. var ScopeClass = module.default;
  16132. var scope_1 = new ScopeClass();
  16133. sf(scope_1);
  16134. }
  16135. });
  16136. });
  16137. };
  16138. };
  16139. __decorate([
  16140. Lib({
  16141. title: '为某个表格,上移行',
  16142. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16143. }),
  16144. __metadata("design:type", Function),
  16145. __metadata("design:paramtypes", []),
  16146. __metadata("design:returntype", void 0)
  16147. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16148. __decorate([
  16149. Lib({
  16150. title: '为某个表格,上移行',
  16151. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16152. }),
  16153. __metadata("design:type", Function),
  16154. __metadata("design:paramtypes", []),
  16155. __metadata("design:returntype", void 0)
  16156. ], SystemEventFu.prototype, "commitMe", null);
  16157. __decorate([
  16158. Lib({
  16159. title: '为某个表格,下移行',
  16160. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16161. }),
  16162. __metadata("design:type", Function),
  16163. __metadata("design:paramtypes", []),
  16164. __metadata("design:returntype", void 0)
  16165. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16166. __decorate([
  16167. Lib({
  16168. title: '为某个表格,批量保存至数据库',
  16169. author: '罗一帆',
  16170. createAt: '2022-07-19',
  16171. updateAt: '2022-07-19',
  16172. type: 'system',
  16173. category: '表格',
  16174. }),
  16175. __metadata("design:type", Function),
  16176. __metadata("design:paramtypes", []),
  16177. __metadata("design:returntype", void 0)
  16178. ], SystemEventFu.prototype, "saveGridRow", null);
  16179. __decorate([
  16180. Lib({
  16181. title: '为某个表格插入数据行',
  16182. author: '罗一帆',
  16183. createAt: '2022-07-19',
  16184. updateAt: '2022-07-19',
  16185. type: 'system',
  16186. category: '表格',
  16187. }),
  16188. __metadata("design:type", Function),
  16189. __metadata("design:paramtypes", []),
  16190. __metadata("design:returntype", void 0)
  16191. ], SystemEventFu.prototype, "insertGridRow", null);
  16192. __decorate([
  16193. Lib({
  16194. title: '为某个表格删除所选数据行',
  16195. author: '罗一帆',
  16196. createAt: '2022-07-19',
  16197. updateAt: '2022-07-19',
  16198. type: 'system',
  16199. category: '表格',
  16200. }),
  16201. __metadata("design:type", Function),
  16202. __metadata("design:paramtypes", []),
  16203. __metadata("design:returntype", void 0)
  16204. ], SystemEventFu.prototype, "removeGridRow", null);
  16205. __decorate([
  16206. Lib({
  16207. title: '按下回车键之后默认是否按下某个按钮',
  16208. author: '罗一帆',
  16209. createAt: '2021-07-02',
  16210. updateAt: '2021-07-02',
  16211. type: 'system',
  16212. category: '字典',
  16213. }),
  16214. __metadata("design:type", Function),
  16215. __metadata("design:paramtypes", [Object]),
  16216. __metadata("design:returntype", void 0)
  16217. ], SystemEventFu.prototype, "enterToClick", null);
  16218. __decorate([
  16219. Lib({
  16220. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16221. author: '罗一帆',
  16222. createAt: '2021-07-06',
  16223. updateAt: '2021-07-06',
  16224. type: 'system',
  16225. category: '对话框',
  16226. }),
  16227. __param(0, LibParam('对话框的确认文字', 'string')),
  16228. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16229. __metadata("design:type", Function),
  16230. __metadata("design:paramtypes", [Object, Object]),
  16231. __metadata("design:returntype", void 0)
  16232. ], SystemEventFu.prototype, "confirm", null);
  16233. __decorate([
  16234. Lib({
  16235. title: '删除表格当前的选中行(前端删除)',
  16236. author: '罗一帆',
  16237. createAt: '2021-07-08',
  16238. updateAt: '2021-07-08',
  16239. type: 'system',
  16240. category: '表格',
  16241. }),
  16242. __param(0, LibParam('表格引用名', 'refs')),
  16243. __metadata("design:type", Function),
  16244. __metadata("design:paramtypes", [Object]),
  16245. __metadata("design:returntype", void 0)
  16246. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16247. __decorate([
  16248. Lib({
  16249. title: '查询表单,如果 url 为空值,就取消查询',
  16250. author: '罗一帆',
  16251. createAt: '2021-07-06',
  16252. updateAt: '2021-07-06',
  16253. type: 'system',
  16254. category: '表单',
  16255. }),
  16256. __param(0, LibParam('后端服务路径', 'string')),
  16257. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16258. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16259. __metadata("design:type", Function),
  16260. __metadata("design:paramtypes", [String, Object, Object]),
  16261. __metadata("design:returntype", void 0)
  16262. ], SystemEventFu.prototype, "loadForm", null);
  16263. __decorate([
  16264. Lib({
  16265. title: '提交(不做校验、不关闭窗体)',
  16266. author: '罗一帆',
  16267. createAt: '2021-07-02',
  16268. updateAt: '2021-07-02',
  16269. type: 'system',
  16270. category: '表单',
  16271. }),
  16272. __param(0, LibParam('后端服务路径', 'string')),
  16273. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16274. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16275. __metadata("design:type", Function),
  16276. __metadata("design:paramtypes", [String, Object, Object]),
  16277. __metadata("design:returntype", void 0)
  16278. ], SystemEventFu.prototype, "commit", null);
  16279. __decorate([
  16280. Lib({
  16281. title: '提交表单',
  16282. author: '罗一帆',
  16283. createAt: '2021-07-02',
  16284. updateAt: '2021-07-02',
  16285. type: 'system',
  16286. category: '表单',
  16287. }),
  16288. __param(0, LibParam('后端服务路径', 'string')),
  16289. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16290. __metadata("design:type", Function),
  16291. __metadata("design:paramtypes", [String, Object]),
  16292. __metadata("design:returntype", void 0)
  16293. ], SystemEventFu.prototype, "formCommit", null);
  16294. __decorate([
  16295. Lib({
  16296. title: '对话框成功回调',
  16297. author: '罗一帆',
  16298. createAt: '2021-07-02',
  16299. updateAt: '2021-07-02',
  16300. type: 'system',
  16301. category: '对话框',
  16302. }),
  16303. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16304. __metadata("design:type", Function),
  16305. __metadata("design:paramtypes", [Object]),
  16306. __metadata("design:returntype", void 0)
  16307. ], SystemEventFu.prototype, "dialogSuccess", null);
  16308. __decorate([
  16309. Lib({
  16310. title: '清空 viewModel 某个属性',
  16311. author: '罗一帆',
  16312. createAt: '2021-07-02',
  16313. updateAt: '2021-07-02',
  16314. type: 'system',
  16315. category: '表单',
  16316. }),
  16317. __param(0, LibParam('属性路径', 'viewModel', true)),
  16318. __metadata("design:type", Function),
  16319. __metadata("design:paramtypes", [String]),
  16320. __metadata("design:returntype", void 0)
  16321. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16322. __decorate([
  16323. Lib({
  16324. title: '从其他资源获取表格设置',
  16325. author: '罗一帆',
  16326. createAt: '2021-07-02',
  16327. updateAt: '2021-07-02',
  16328. type: 'system',
  16329. category: '表单',
  16330. }),
  16331. __param(0, LibParam('定义文件', 'module')),
  16332. __metadata("design:type", Function),
  16333. __metadata("design:paramtypes", [Object]),
  16334. __metadata("design:returntype", void 0)
  16335. ], SystemEventFu.prototype, "getGrid", null);
  16336. __decorate([
  16337. Lib({
  16338. title: '清空 viewModel 某个属性,并刷新表格',
  16339. author: '罗一帆',
  16340. createAt: '2021-07-02',
  16341. updateAt: '2021-07-02',
  16342. type: 'system',
  16343. category: '表单',
  16344. }),
  16345. __param(0, LibParam('清空的属性', 'viewModel')),
  16346. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16347. __metadata("design:type", Function),
  16348. __metadata("design:paramtypes", [String, String]),
  16349. __metadata("design:returntype", void 0)
  16350. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16351. __decorate([
  16352. Lib({
  16353. title: '刷新表格',
  16354. author: '罗一帆',
  16355. createAt: '2021-07-02',
  16356. updateAt: '2021-07-02',
  16357. type: 'system',
  16358. category: '表单',
  16359. }),
  16360. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16361. __metadata("design:type", Function),
  16362. __metadata("design:paramtypes", [String]),
  16363. __metadata("design:returntype", void 0)
  16364. ], SystemEventFu.prototype, "reloadGrid", null);
  16365. __decorate([
  16366. Lib({
  16367. title: '显示对话框',
  16368. author: '罗一帆',
  16369. createAt: '2021-07-02',
  16370. updateAt: '2021-07-02',
  16371. type: 'system',
  16372. category: '对话框',
  16373. }),
  16374. __param(0, LibParam('业务模块名', 'module')),
  16375. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16376. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16377. __metadata("design:type", Function),
  16378. __metadata("design:paramtypes", [String, Object, Object]),
  16379. __metadata("design:returntype", void 0)
  16380. ], SystemEventFu.prototype, "showDialog", null);
  16381. __decorate([
  16382. Lib({
  16383. title: '弹出查找框(不借助 search)',
  16384. author: '罗一帆',
  16385. createAt: '2021-07-02',
  16386. updateAt: '2021-07-02',
  16387. type: 'system',
  16388. category: '对话框',
  16389. }),
  16390. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16391. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16392. __metadata("design:type", Function),
  16393. __metadata("design:paramtypes", [Object, Object]),
  16394. __metadata("design:returntype", void 0)
  16395. ], SystemEventFu.prototype, "showWidget", null);
  16396. __decorate([
  16397. Lib({
  16398. title: '根据 lookup 清空 viewModel',
  16399. author: '罗一帆',
  16400. createAt: '2021-07-05',
  16401. updateAt: '2021-07-05',
  16402. type: 'system',
  16403. category: '表单',
  16404. }),
  16405. __param(0, LibParam('设值表达式', 'lookup')),
  16406. __metadata("design:type", Function),
  16407. __metadata("design:paramtypes", [Object]),
  16408. __metadata("design:returntype", void 0)
  16409. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16410. __decorate([
  16411. Lib({
  16412. title: '关闭对话框',
  16413. author: '罗一帆',
  16414. createAt: '2021-07-05',
  16415. updateAt: '2021-07-05',
  16416. type: 'system',
  16417. category: '对话框',
  16418. }),
  16419. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16420. __metadata("design:type", Function),
  16421. __metadata("design:paramtypes", [Object]),
  16422. __metadata("design:returntype", void 0)
  16423. ], SystemEventFu.prototype, "closeMe", null);
  16424. __decorate([
  16425. Lib({
  16426. title: '打开对话框并返回数据',
  16427. author: '余亮',
  16428. createAt: '2022-07-07',
  16429. updateAt: '2022-07-07',
  16430. type: 'system',
  16431. category: '对话框',
  16432. }),
  16433. __param(0, LibParam('业务模块名', 'module')),
  16434. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16435. __param(2, LibParam('结果映射关系', 'string', true)),
  16436. __metadata("design:type", Function),
  16437. __metadata("design:paramtypes", [String, Object, Object]),
  16438. __metadata("design:returntype", void 0)
  16439. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16440. return SystemEventFu;
  16441. }());
  16442. /**
  16443. * 清空 viewmodel 里下属的所有属性
  16444. * @param viewModel VM对象
  16445. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16446. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16447. */
  16448. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16449. var data = viewModel.data;
  16450. if (propertyKey) {
  16451. data = _$2.get(data, propertyKey);
  16452. }
  16453. _$2.forOwn(data, function (value, key) {
  16454. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16455. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16456. return;
  16457. }
  16458. viewModel.set(targetKey, '');
  16459. });
  16460. }
  16461. function clearViewModelByLookup(sender, lookup) {
  16462. if (_$2.isPlainObject(lookup)) {
  16463. var parentScope_1 = lookupScope(sender);
  16464. _$2.forOwn(lookup, function (value, key) {
  16465. if (SIMPLE_RE.test(value)) {
  16466. // '{foo}' 简单表达式
  16467. var path = value.substring(1, value.length - 1);
  16468. if (path !== 'queryValue') {
  16469. parentScope_1.viewModel.set(path, '');
  16470. }
  16471. }
  16472. });
  16473. }
  16474. }
  16475. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16476. if (vjson === void 0) { vjson = {}; }
  16477. var parentScope = lookupScope(sender);
  16478. var me = sender;
  16479. // @ts-ignore
  16480. require([widgetUrl], function (widgetScope) {
  16481. var WidgetScopeClass = widgetScope.default;
  16482. widgetScope = new WidgetScopeClass();
  16483. // 传递进 widget.model 的数据
  16484. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16485. widgetScope.parentScope = parentScope;
  16486. widgetScope.searchWidgetSuccess = function (data) {
  16487. if (typeof lookup === 'string') {
  16488. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16489. me.setValue(data[lookup]);
  16490. return;
  16491. }
  16492. /**
  16493. * lookup: {
  16494. * // 扩展到 viewModel 的值做更改
  16495. * WH_CODE: "{queryValue}",
  16496. * WH_NAME: "{query.WH_NAME}",
  16497. * }
  16498. */
  16499. if (_$2.isPlainObject(lookup)) {
  16500. var parentScope_2 = lookupScope(sender);
  16501. tryWriteObject(lookup, data, function (path, value) {
  16502. if (path === 'queryValue') {
  16503. me.setValue(value);
  16504. }
  16505. else {
  16506. parentScope_2.viewModel.set(path, value);
  16507. }
  16508. });
  16509. }
  16510. return true;
  16511. };
  16512. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16513. });
  16514. }
  16515. /**
  16516. * 停止事件的默认行为
  16517. * @param e
  16518. */
  16519. function stopEvent(e) {
  16520. e.preventDefault();
  16521. e.stopPropagation();
  16522. // @ts-ignore
  16523. window.event.cancelBubble = true;
  16524. e.returnValue = false;
  16525. e.cancelBubble = true;
  16526. }
  16527. /**
  16528. * 屏幕中央显示一个黑框提示
  16529. */
  16530. function msg$1(content) {
  16531. msg(content);
  16532. }
  16533. /**
  16534. * 错误对话框的强提醒
  16535. */
  16536. function showErrorDialog$1(msg, sender) {
  16537. showErrorDialog(msg, sender);
  16538. }
  16539. /**
  16540. * 错误对话框的强提醒
  16541. */
  16542. function showInfoDialog(msg, sender) {
  16543. showInfoDialogSimple(msg, sender);
  16544. }
  16545. /**
  16546. * 错误对话框的强提醒
  16547. */
  16548. function prompt$2(message, defaultValue, multiLine) {
  16549. if (defaultValue === void 0) { defaultValue = ""; }
  16550. if (multiLine === void 0) { multiLine = false; }
  16551. return prompt$1(message, defaultValue, multiLine);
  16552. }
  16553. /**
  16554. * 用于计算 express 表达式
  16555. */
  16556. function evalFunction(data, express) {
  16557. var keys = [];
  16558. var values = [];
  16559. _$2.forOwn(data, function (value, key) {
  16560. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16561. if (match) {
  16562. key = key.substring(0, match.index);
  16563. }
  16564. keys.push(key);
  16565. values.push(value);
  16566. });
  16567. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16568. try {
  16569. return func.apply(void 0, __spread(values));
  16570. }
  16571. catch (e) {
  16572. return;
  16573. }
  16574. }
  16575. /**
  16576. * 获取表格编辑的行数据
  16577. */
  16578. function getGridEditRows(grid) {
  16579. return grid.getGridEditRows();
  16580. }
  16581. //# sourceMappingURL=systemLib.js.map
  16582. var SystemLib = /*#__PURE__*/Object.freeze({
  16583. __proto__: null,
  16584. SIMPLE_RE: SIMPLE_RE,
  16585. pinyinMatch: pinyinMatch,
  16586. calcExpress: calcExpress,
  16587. calcObjectFlat: calcObjectFlat,
  16588. mergeViewModel: mergeViewModel,
  16589. flatRow: flatRow,
  16590. replaceNA: replaceNA,
  16591. deepTravJson: deepTravJson,
  16592. tryWriteByExpress: tryWriteByExpress,
  16593. tryWriteObject: tryWriteObject,
  16594. tryVarSimple: tryVarSimple,
  16595. calcObject: calcObject,
  16596. getParentGrid: getParentGrid,
  16597. tryEnable: tryEnable,
  16598. setComboStore: setComboStore,
  16599. invokeServer: invokeServer$1,
  16600. clearViewModelValues: clearViewModelValues,
  16601. reloadGrid: reloadGrid,
  16602. toPlainObject: toPlainObject,
  16603. confirm: confirm,
  16604. normId: normId,
  16605. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16606. saveGridRow: saveGridRow,
  16607. insertGridRow: insertGridRow,
  16608. commitMe: commitMe,
  16609. removeGridRow: removeGridRow,
  16610. moveUpGridRow: moveUpGridRow,
  16611. moveDownGridRow: moveDownGridRow,
  16612. SystemEventFu: SystemEventFu,
  16613. clearViewModel: clearViewModel,
  16614. clearViewModelByLookup: clearViewModelByLookup,
  16615. showWidget: showWidget,
  16616. stopEvent: stopEvent,
  16617. msg: msg$1,
  16618. showErrorDialog: showErrorDialog$1,
  16619. showInfoDialog: showInfoDialog,
  16620. prompt: prompt$2,
  16621. evalFunction: evalFunction,
  16622. getGridEditRows: getGridEditRows
  16623. });
  16624. function initTree () {
  16625. Ext.define('Yvan.Tree', {
  16626. extend: 'Ext.tree.Panel',
  16627. alias: 'widget.yvtree',
  16628. xtype: 'yvtree',
  16629. constructor: function (config) {
  16630. var newConfig = _$2.defaultsDeep({
  16631. // 强制性属性
  16632. }, baseConfig(config, 'row-item'), config, tree);
  16633. _$2.assign(newConfig, {
  16634. tbar: [
  16635. {
  16636. xtype: 'textfield',
  16637. // triggerCls: 'x-form-clear-trigger',
  16638. flex: 1,
  16639. emptyText: '搜索过滤',
  16640. enableKeyEvents: true,
  16641. listeners: {
  16642. change: function (sender) {
  16643. var tree = sender.up("treepanel");
  16644. tree.filterByText(this.getRawValue());
  16645. },
  16646. keyup: function (sender, e) {
  16647. var tree = sender.up("treepanel");
  16648. if (e.ESC === e.getKey()) {
  16649. sender.setValue('');
  16650. tree.filterByText('');
  16651. }
  16652. }
  16653. }
  16654. },
  16655. ],
  16656. });
  16657. if (!newConfig.hideRefresh) {
  16658. newConfig.tbar.push({
  16659. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16660. listeners: {
  16661. click: function (sender) {
  16662. var scope = sender.up("yvtree");
  16663. scope.reload();
  16664. }
  16665. }
  16666. });
  16667. }
  16668. if (!newConfig.hideExpand) {
  16669. newConfig.tbar.push({
  16670. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16671. listeners: {
  16672. click: function (sender) {
  16673. var scope = sender.up("yvtree");
  16674. scope.expandAll();
  16675. }
  16676. }
  16677. });
  16678. }
  16679. if (!newConfig.hideCollapse) {
  16680. newConfig.tbar.push({
  16681. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16682. listeners: {
  16683. click: function (sender) {
  16684. var scope = sender.up("yvtree");
  16685. scope.collapseAll();
  16686. }
  16687. }
  16688. });
  16689. }
  16690. this.superclass.constructor.call(this, newConfig);
  16691. },
  16692. /**
  16693. * 在根节点上增加一个节点,会触发 addNode 事件
  16694. * @param props
  16695. */
  16696. addRoot: function (props) {
  16697. var me = this;
  16698. var tableNode = me.getRootNode();
  16699. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16700. if (_$2.isFunction(props)) {
  16701. props = props.call(this, parent);
  16702. }
  16703. _$2.forOwn(props, function (value, key) {
  16704. fieldNode.set(key, value);
  16705. });
  16706. var node = tableNode.appendChild(fieldNode);
  16707. me.ensureVisible(node);
  16708. me.setSelection(node);
  16709. me.fireEvent('addNode', me, {
  16710. parent: tableNode,
  16711. node: node,
  16712. });
  16713. },
  16714. addLast: function (props) {
  16715. var me = this;
  16716. var sel = me.selModel.getSelection();
  16717. if (!sel || sel.length <= 0) {
  16718. msg('请选择一个要添加的同级节点路径');
  16719. return;
  16720. }
  16721. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16722. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16723. if (_$2.isFunction(props)) {
  16724. props = props.call(this, parent);
  16725. }
  16726. _$2.forOwn(props, function (value, key) {
  16727. fieldNode.set(key, value);
  16728. });
  16729. var node = parent.appendChild(fieldNode);
  16730. me.ensureVisible(node);
  16731. me.setSelection(node);
  16732. me.fireEvent('addNode', me, {
  16733. parent: parent,
  16734. node: node,
  16735. });
  16736. },
  16737. addChildren: function (props) {
  16738. var me = this;
  16739. var sel = me.selModel.getSelection();
  16740. if (!sel || sel.length <= 0) {
  16741. msg('请选择一个要添加子节点的路径');
  16742. return;
  16743. }
  16744. var parent = sel[0];
  16745. if (_$2.isFunction(props)) {
  16746. props = props.call(this, parent);
  16747. }
  16748. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16749. _$2.forOwn(props, function (value, key) {
  16750. fieldNode.set(key, value);
  16751. });
  16752. var node = parent.appendChild(fieldNode);
  16753. parent.expand();
  16754. me.ensureVisible(node);
  16755. me.setSelection(node);
  16756. me.fireEvent('addNode', me, {
  16757. parent: parent,
  16758. node: node,
  16759. });
  16760. },
  16761. initComponent: function () {
  16762. var me = this;
  16763. var config = me.config;
  16764. var scope = lookupScope(this);
  16765. if (!isDesignMode(scope, config)) {
  16766. // 转换 dataSource 属性
  16767. convertDataSource(me, scope, config);
  16768. }
  16769. this.superclass.initComponent.call(this);
  16770. this.on({
  16771. afterrender: function (sender) {
  16772. var me = this;
  16773. var config = this.config;
  16774. var dataSource = config.dataSource;
  16775. if (config.autoLoad) {
  16776. if (config.dataSourceCallbackFn) {
  16777. me.reload();
  16778. }
  16779. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16780. me.reload();
  16781. }
  16782. }
  16783. }
  16784. });
  16785. },
  16786. _setDataReal: function (value) {
  16787. var me = this;
  16788. // me.setStore(new Ext.data.TreeStore({
  16789. // root: {
  16790. // expanded: true,
  16791. // // children: value
  16792. // children: [
  16793. // {
  16794. // id: '1', text: 'A',
  16795. // children: [
  16796. // {id: '1', text: 'A',},
  16797. // {id: '2', text: 'B'},
  16798. // ]
  16799. // },
  16800. // {id: '2', text: 'B'},
  16801. // ]
  16802. // }
  16803. // }))
  16804. me.store.setRoot({
  16805. expanded: true,
  16806. children: value
  16807. });
  16808. // me.store = new Ext.data.TreeStore({
  16809. // root: {
  16810. // expanded: true,
  16811. // // children: value
  16812. // children: [
  16813. // {
  16814. // id: '1', text: 'A',
  16815. // children: [
  16816. // {id: '1', text: 'A',},
  16817. // {id: '2', text: 'B'},
  16818. // ]
  16819. // },
  16820. // {id: '2', text: 'B'},
  16821. // ]
  16822. // }
  16823. // })
  16824. },
  16825. /**
  16826. * 重新载入数据(重新计算参数)
  16827. */
  16828. reload: function (reloadParams) {
  16829. if (reloadParams === void 0) { reloadParams = {}; }
  16830. var me = this;
  16831. var config = me.config;
  16832. if (config.dataSourceCallbackFn) {
  16833. // 函数请求刷新
  16834. var scope_1 = lookupScope(this);
  16835. // me.setLoading(true)
  16836. config.dataSourceCallbackFn.call(scope_1, me, {
  16837. successCallback: function (value) {
  16838. me._setDataReal(value);
  16839. // me.setLoading(false)
  16840. me.fireEvent('dataLoadComplete', me, true, value);
  16841. },
  16842. failCallback: function (error) {
  16843. // me.setLoading(false)
  16844. me.fireEvent('dataLoadComplete', me, false, error);
  16845. }
  16846. });
  16847. return;
  16848. }
  16849. var scope = lookupScope(me);
  16850. var dataSource = config.dataSource;
  16851. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16852. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16853. me.setLoading(true);
  16854. invokeServer$1(dataSource.url, params)
  16855. .then(function (res) {
  16856. me._setDataReal(res.data);
  16857. me.fireEvent('dataLoadComplete', me, res);
  16858. })
  16859. .finally(function () {
  16860. me.setLoading(false);
  16861. });
  16862. }
  16863. },
  16864. filterByText: function (text) {
  16865. this._filterText = text;
  16866. this._filterBy(this, text, 'text');
  16867. },
  16868. _filterBy: _$2.debounce(function (me, text, by) {
  16869. var view = me.getView();
  16870. me.store.clearFilter();
  16871. if (!me._filterText) {
  16872. // 没有筛选内容,还原状态
  16873. var selections = me.getSelection();
  16874. var selectionPaths_1 = [];
  16875. _$2.forEach(me.getSelection(), function (item) {
  16876. selectionPaths_1.push(item.getPath());
  16877. });
  16878. me.collapseAll();
  16879. _$2.forEach(selectionPaths_1, function (path) {
  16880. me.expandPath(path);
  16881. });
  16882. me.setSelection(selections);
  16883. return;
  16884. }
  16885. // 递归查找所有需要可见的节点 id 数组
  16886. var nodesAndParents = [];
  16887. var expandPaths = [];
  16888. me.getRootNode().cascadeBy(function (tree, view) {
  16889. var currNode = this;
  16890. currNode.collapse();
  16891. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16892. // 展开到匹配的路径
  16893. // me.expandPath(currNode.getPath());
  16894. expandPaths.push(currNode.getPath());
  16895. // 沿途父节点全部设定为可见
  16896. while (currNode.parentNode) {
  16897. nodesAndParents.push(currNode.id);
  16898. currNode = currNode.parentNode;
  16899. }
  16900. }
  16901. }, null, [me, view]);
  16902. me.store.filterBy(function (r) {
  16903. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16904. });
  16905. _$2.forEach(expandPaths, function (path) {
  16906. me.expandPath(path);
  16907. });
  16908. }, 1000),
  16909. });
  16910. }
  16911. function convertDataSource(sender, scope, newConfig) {
  16912. if (typeof newConfig.store !== 'undefined') {
  16913. // 有 store 属性的情况下,不做任何事
  16914. return;
  16915. }
  16916. if (typeof newConfig.dataSource === 'undefined') {
  16917. // 没有定义 dataSource 的情况下,不做任何事
  16918. return;
  16919. }
  16920. var dataSource = newConfig.dataSource;
  16921. if (typeof dataSource === 'string') {
  16922. // dataSource 是字符串的情况下,找到成员函数
  16923. dataSource = lookupFn(scope, dataSource);
  16924. }
  16925. if (typeof dataSource === 'function') {
  16926. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16927. newConfig.store = new Ext.data.TreeStore({
  16928. root: {
  16929. expanded: true,
  16930. children: []
  16931. }
  16932. });
  16933. newConfig.dataSourceCallbackFn = dataSource;
  16934. return;
  16935. }
  16936. // throw new TypeError('无法识别的调用方法')
  16937. }
  16938. //# sourceMappingURL=yvtree.js.map
  16939. /**
  16940. * 构建一个 grid 支持的 dataSource
  16941. */
  16942. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16943. if (reloadParams === void 0) { reloadParams = {}; }
  16944. if (isExcelExport === void 0) { isExcelExport = false; }
  16945. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16946. var _a;
  16947. var me = grid;
  16948. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16949. var storeOption = {};
  16950. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16951. if (dataSource.sqlId) {
  16952. dataSource.method = 'invoke';
  16953. dataSource.url = '/Dev@executeSQL';
  16954. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16955. // sqlId 是 @ 开头,代表直接带中文名
  16956. var scope_1 = lookupScope(grid);
  16957. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16958. params.sqlId = dataSource.sqlId.substring(1);
  16959. }
  16960. else {
  16961. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16962. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16963. params.path = path;
  16964. params.sqlId = sqlId;
  16965. }
  16966. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16967. }
  16968. var fields_1 = [];
  16969. _$2.forEach(grid.columns, function (col) {
  16970. var c = {};
  16971. if (col.dataIndex) {
  16972. c.name = col.dataIndex;
  16973. fields_1.push(c);
  16974. }
  16975. if (col.dataType) {
  16976. c.type = col.dataType;
  16977. }
  16978. });
  16979. // 默认支持 gridInvoke
  16980. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16981. //@ts-ignore
  16982. storeOption = {
  16983. fields: fields_1,
  16984. remoteSort: config.remoteSort,
  16985. remoteFilter: config.remoteFilter,
  16986. autoLoad: true,
  16987. pageSize: me.store.pageSize || config.pageSize,
  16988. proxy: {
  16989. type: 'jsonAjax',
  16990. $owner: me,
  16991. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16992. extraParams: extraParams,
  16993. reader: {
  16994. type: 'json',
  16995. rootProperty: 'data',
  16996. totalProperty: 'pagination.total',
  16997. successProperty: 'success',
  16998. messageProperty: 'msg',
  16999. transform: function (data) {
  17000. if (typeof window['ajaxProcess'] === 'function') {
  17001. window['ajaxProcess'](data);
  17002. }
  17003. if (typeof window['apiTranslate'] === 'function') {
  17004. window['apiTranslate'](data, dataSource.url);
  17005. }
  17006. if (typeof grid._transform === 'function') {
  17007. // 系统转换函数
  17008. grid._transform(data.data);
  17009. }
  17010. if (grid.dataTransform) {
  17011. if (typeof grid.dataTransform === 'string') {
  17012. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17013. }
  17014. return grid.dataTransform.call(scope, grid, data);
  17015. }
  17016. return data;
  17017. }
  17018. }
  17019. },
  17020. listeners: {
  17021. load: function (store, records, successful, operation) {
  17022. var _a, _b, _c;
  17023. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17024. if (rep.pagination) {
  17025. grid.dbInfo = rep.pagination.dbInfo;
  17026. grid.exportDataSql = rep.pagination.exportDataSql;
  17027. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17028. }
  17029. 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;
  17030. if (isExcelExport) {
  17031. if (typeof excelExportCallBack === 'function') {
  17032. excelExportCallBack(rep);
  17033. }
  17034. else if (excelExportCallBack) {
  17035. console.error("导出回调方法错误!");
  17036. }
  17037. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17038. }
  17039. else {
  17040. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17041. // 自动选中第一行
  17042. var data = grid.getStore().data;
  17043. if (data.length > 0) {
  17044. grid.setSelection(data.items[0]);
  17045. }
  17046. }
  17047. me.fireEvent('dataLoadComplete', me, successful, records);
  17048. }
  17049. }
  17050. }
  17051. };
  17052. }
  17053. else if (exports.apiConvert) {
  17054. // 外部扩展的 apiConvert
  17055. //@ts-ignore
  17056. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17057. }
  17058. else {
  17059. throw new TypeError("不支持的 API 请求方式");
  17060. }
  17061. if (isExcelExport) {
  17062. var excelStore = new Ext.data.Store(storeOption);
  17063. excelStore.load();
  17064. }
  17065. else {
  17066. if (me.groupField) {
  17067. console.log('groupField', storeOption.groupField);
  17068. storeOption.groupField = me.groupField;
  17069. }
  17070. me.setStore(new Ext.data.Store(storeOption));
  17071. }
  17072. }
  17073. function initStores () {
  17074. Ext.define('Yvan.JsonAjaxProxy', {
  17075. extend: 'Ext.data.proxy.Ajax',
  17076. alias: 'proxy.jsonAjax',
  17077. actionMethods: {
  17078. create: "POST",
  17079. read: "POST",
  17080. update: "POST",
  17081. destroy: "POST"
  17082. },
  17083. timeout: storeAjax.timeout,
  17084. buildRequest: function (operation) {
  17085. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17086. var me = this;
  17087. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17088. var scope = lookupScope($owner);
  17089. var gridParam = me.getParams(operation);
  17090. var customParam = {};
  17091. // 提取 srot 元素
  17092. if (gridParam.sort) {
  17093. var sort = JSON.parse(gridParam.sort);
  17094. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17095. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17096. customParam.sortModel = [];
  17097. _$2.forEach(sort, function (s) {
  17098. customParam.sortModel.push({
  17099. colId: s.property,
  17100. sort: _$2.toLower(s.direction)
  17101. });
  17102. });
  17103. delete gridParam.sort;
  17104. }
  17105. // 提取筛选元素
  17106. if (gridParam.filter) {
  17107. var filter = JSON.parse(gridParam.filter);
  17108. console.log('gridParam.filter', gridParam.filter);
  17109. // "[{"operator":"like","value":"1","property":"id"}]"
  17110. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17111. customParam.filterModel = {};
  17112. _$2.forEach(filter, function (s) {
  17113. var newFilterItem = {};
  17114. if (s.operator === 'like') {
  17115. newFilterItem.filterType = 'text';
  17116. newFilterItem.type = 'contains';
  17117. newFilterItem.filter = s.value;
  17118. }
  17119. else {
  17120. // 无法识别的筛选类型
  17121. newFilterItem.filterType = 'dict';
  17122. newFilterItem.type = 'in';
  17123. newFilterItem.filter = s.value;
  17124. }
  17125. customParam.filterModel[s.property] = newFilterItem;
  17126. });
  17127. delete gridParam.filter;
  17128. }
  17129. // 被 grid.constructor 作为方法存在
  17130. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17131. var params = _$2.defaultsDeep(gridParam, extraParams);
  17132. // var request = this.superclass.buildRequest.apply(this, arguments);
  17133. var request = new Ext.data.Request({
  17134. params: {},
  17135. action: operation.getAction(),
  17136. records: operation.getRecords(),
  17137. url: me.buildUrl(),
  17138. jsonData: __assign({ args: [
  17139. params
  17140. ] }, customParam),
  17141. proxy: me
  17142. });
  17143. operation.setRequest(request);
  17144. return request;
  17145. },
  17146. afterRequest: function (req, res) {
  17147. // Extend.afterExtRequest(req, res)
  17148. }
  17149. });
  17150. Ext.define('Ext.ux.data.MyReader', {
  17151. extend: 'Ext.data.reader.Json',
  17152. xtype: 'yvgridreader',
  17153. useSimpleAccessors: false,
  17154. });
  17155. }
  17156. //# sourceMappingURL=stores.js.map
  17157. function initBehaviorEdit(config) {
  17158. var _a, _b, _c;
  17159. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17160. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17161. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17162. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17163. if (dbTableName) {
  17164. // 生成增删查改
  17165. var tbar = [
  17166. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17167. click: 'system.saveGridRow()'
  17168. }, bind: {
  17169. disabled: '{!' + config.reference + '.ischanged}'
  17170. } }, saveButtonConfig),
  17171. '-',
  17172. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17173. click: 'system.insertGridRow()'
  17174. } }, addButtonConfig),
  17175. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17176. click: 'system.removeGridRow()'
  17177. } }, deleteButtonConfig),
  17178. ];
  17179. if (_$2.isArray(config.tbar)) {
  17180. config.tbar = __spread(tbar, [
  17181. '-'
  17182. ], config.tbar);
  17183. }
  17184. else if (_$2.isPlainObject(config.tbar)) {
  17185. config.tbar = {
  17186. border: false,
  17187. layout: {
  17188. type: 'vbox',
  17189. align: 'stretch'
  17190. },
  17191. items: [
  17192. {
  17193. xtype: 'toolbar',
  17194. border: false,
  17195. items: tbar
  17196. },
  17197. config.tbar,
  17198. ]
  17199. };
  17200. }
  17201. else if (_$2.isUndefined(config.tbar)) {
  17202. config.tbar = tbar;
  17203. }
  17204. else {
  17205. console.error("can't build tbar property!", config.tbar);
  17206. }
  17207. }
  17208. }
  17209. //# sourceMappingURL=grid_behavior.js.map
  17210. function initGridDialog(config) {
  17211. var detailDialog = _$2.get(config, 'detailDialog');
  17212. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17213. if (_$2.isPlainObject(detailDialog)) {
  17214. var tbar = [
  17215. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17216. click: 'system.showGridRowDetail()',
  17217. }, bind: {
  17218. disabled: '{!' + config.reference + '.selection}'
  17219. } }, detailButtonConfig)
  17220. ];
  17221. if (_$2.isArray(config.tbar)) {
  17222. config.tbar = __spread(config.tbar, [
  17223. '-'
  17224. ], tbar);
  17225. }
  17226. else if (_$2.isPlainObject(config.tbar)) {
  17227. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17228. config.tbar.items = __spread(config.tbar.items);
  17229. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17230. if (!toolbar) {
  17231. config.tbar.items = __spread(config.tbar.items, [
  17232. {
  17233. xtype: 'toolbar',
  17234. border: false,
  17235. items: tbar
  17236. },
  17237. ]);
  17238. }
  17239. else {
  17240. toolbar.items = __spread(toolbar.items, [
  17241. '-'
  17242. ], tbar);
  17243. }
  17244. }
  17245. else {
  17246. config.tbar = {
  17247. border: false,
  17248. layout: {
  17249. type: 'vbox',
  17250. align: 'stretch'
  17251. },
  17252. items: [
  17253. {
  17254. xtype: 'toolbar',
  17255. border: false,
  17256. items: tbar
  17257. },
  17258. config.tbar,
  17259. ]
  17260. };
  17261. }
  17262. }
  17263. else if (_$2.isUndefined(config.tbar)) {
  17264. config.tbar = tbar;
  17265. }
  17266. else {
  17267. console.error("can't build tbar property!", config.tbar);
  17268. }
  17269. }
  17270. }
  17271. var SystemEventFu$1 = /** @class */ (function () {
  17272. function SystemEventFu() {
  17273. }
  17274. SystemEventFu.prototype.showGridRowDetail = function () {
  17275. return function (sender) {
  17276. var grid1 = sender.up('yvgrid');
  17277. showGridRowDetail(grid1);
  17278. };
  17279. };
  17280. __decorate([
  17281. Lib({
  17282. title: '为某个表格所选数据行, 显示其对话框',
  17283. author: '罗一帆',
  17284. createAt: '2022-07-27',
  17285. updateAt: '2022-07-27',
  17286. type: 'system',
  17287. category: '表格',
  17288. }),
  17289. __metadata("design:type", Function),
  17290. __metadata("design:paramtypes", []),
  17291. __metadata("design:returntype", void 0)
  17292. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17293. return SystemEventFu;
  17294. }());
  17295. function showGridRowDetail(grid1, isEdit) {
  17296. if (isEdit === void 0) { isEdit = true; }
  17297. var _a, _b, _c;
  17298. if (!grid1.selection) {
  17299. msg$1('请选中要展示的数据行!');
  17300. return;
  17301. }
  17302. var record = grid1.selection;
  17303. if (_$2.isArray(record)) {
  17304. record = record[0];
  17305. }
  17306. if (!record) {
  17307. msg$1('请选中要展示的数据行!');
  17308. return;
  17309. }
  17310. var config = grid1._originVJson;
  17311. var detailDialog = config.detailDialog;
  17312. var vjson = {};
  17313. var parentScope = lookupScope(grid1);
  17314. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17315. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17316. _$2.defaultsDeep(vjson, {
  17317. // 强制属性
  17318. layout: 'fit',
  17319. __custom_path: __custom_path,
  17320. __custom_version: __custom_version,
  17321. fbar: __spread([
  17322. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17323. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17324. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17325. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17326. }, detailDialog, {
  17327. // 默认属性
  17328. width: 800,
  17329. height: 450,
  17330. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17331. });
  17332. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17333. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17334. vjson.items.push(tabpanel);
  17335. if (tabpanel) {
  17336. // 有多个选项卡,按每个选项卡进行过滤
  17337. _$2.forEach(tabpanel.items, function (tab) {
  17338. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17339. if (tabColumns.length > 0) {
  17340. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17341. _$2.extend(tab, tabVjson);
  17342. }
  17343. });
  17344. }
  17345. }
  17346. else {
  17347. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17348. }
  17349. var model = {
  17350. data: {
  17351. _edit: isEdit,
  17352. _editType: isEdit ? '编辑' : '添加',
  17353. }
  17354. };
  17355. _$2.forOwn(record.data, function (value, key) {
  17356. if (key === 'id') {
  17357. // 忽略 ID 属性
  17358. return;
  17359. }
  17360. if (_$2.startsWith(key, '_')) {
  17361. // 忽略 _ 开头的所有属性
  17362. return;
  17363. }
  17364. model.data[key] = value;
  17365. });
  17366. console.log(vjson);
  17367. var scope = new Scope({ vjson: vjson, model: model, });
  17368. //@ts-ignore
  17369. scope.commit = function () {
  17370. return new Promise(function (resolve) {
  17371. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17372. if (_$2.startsWith(key, '_')) {
  17373. // _origin 等属性可以被忽略
  17374. return;
  17375. }
  17376. if (key === 'id') {
  17377. // id 属性被忽略
  17378. return;
  17379. }
  17380. record.set(key, value);
  17381. });
  17382. resolve();
  17383. });
  17384. };
  17385. scope.showDialog(grid1, {}, {});
  17386. }
  17387. function buildForm(columns, tabpanel, detailDialog) {
  17388. var vjson = __assign({ border: false, layout: {
  17389. type: 'vbox',
  17390. pack: 'start',
  17391. align: 'stretch'
  17392. }, defaults: {
  17393. border: false,
  17394. anchor: '100%',
  17395. margin: '5',
  17396. }, scrollable: true, items: [] }, detailDialog.form);
  17397. var emptyFieldset = [];
  17398. var fieldsetList = [];
  17399. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17400. _$2.forEach(columns, function (c) {
  17401. var fieldset = _$2.get(c, 'form.fieldset');
  17402. if (fieldset) {
  17403. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17404. if (idx < 0) {
  17405. fieldsetList.push({
  17406. fieldset: fieldset,
  17407. columns: [c]
  17408. });
  17409. }
  17410. else {
  17411. fieldsetList[idx].columns.push(c);
  17412. }
  17413. }
  17414. else {
  17415. emptyFieldset.push(c);
  17416. }
  17417. });
  17418. _$2.forEach(fieldsetList, function (fs) {
  17419. var fieldSetVjson = {
  17420. xtype: 'fieldset',
  17421. title: fs.fieldset,
  17422. items: []
  17423. };
  17424. buildFieldItems(fieldSetVjson.items, fs.columns);
  17425. vjson.items.push(fieldSetVjson);
  17426. });
  17427. buildFieldItems(vjson.items, emptyFieldset);
  17428. return vjson;
  17429. }
  17430. // 构建字段组
  17431. function buildFieldItems(items, columns) {
  17432. var _a, _b, _c, _d, _e;
  17433. var row = {
  17434. xtype: 'cols',
  17435. items: []
  17436. };
  17437. for (var i = 0; i < columns.length; i++) {
  17438. var column = columns[i];
  17439. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17440. delete row.xtype;
  17441. row.layout = column.form.rowlayout;
  17442. }
  17443. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17444. row.items.push({ border: false, flex: column.form.prefix });
  17445. }
  17446. var fieldVjson = buildField(column, row.items.length);
  17447. if (!fieldVjson) {
  17448. continue;
  17449. }
  17450. row.items.push(fieldVjson);
  17451. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17452. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17453. }
  17454. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17455. items.push(row);
  17456. row = {
  17457. xtype: 'cols',
  17458. items: []
  17459. };
  17460. }
  17461. }
  17462. if (row.items.length > 0) {
  17463. items.push(row);
  17464. }
  17465. }
  17466. // 构建字段
  17467. function buildField(column, colIdx) {
  17468. var ret;
  17469. if (column.xtype === 'checkcolumn') {
  17470. ret = _$2.defaultsDeep({
  17471. xtype: 'checkbox',
  17472. uncheckedValue: column.uncheckedValue,
  17473. checkedValue: column.checkedValue,
  17474. boxLabel: column.header,
  17475. bind: {
  17476. value: '{' + column.dataIndex + '}'
  17477. }
  17478. }, column.form);
  17479. if (colIdx == 0) {
  17480. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17481. ret.margin = '0 0 0 85';
  17482. }
  17483. }
  17484. else {
  17485. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17486. fieldLabel: column.header,
  17487. bind: {
  17488. value: '{' + column.dataIndex + '}'
  17489. },
  17490. });
  17491. }
  17492. if (!ret.xtype) {
  17493. return;
  17494. }
  17495. if (!ret.dict && ret.xtype === 'combo') {
  17496. ret.dict = column.dict;
  17497. }
  17498. // 删除辅助属性
  17499. delete ret.order;
  17500. delete ret.wrap;
  17501. return ret;
  17502. }
  17503. //# sourceMappingURL=grid_dialog.js.map
  17504. var model$c = {
  17505. data: {}
  17506. };
  17507. //# sourceMappingURL=GridColumnCustom.model.js.map
  17508. var vjson$c = {
  17509. title: '自定义表格属性',
  17510. layout: 'fit',
  17511. width: 980,
  17512. height: 500,
  17513. fbar: [
  17514. {
  17515. xtype: "button",
  17516. text: "保存",
  17517. iconCls: 'x-fa fa-save',
  17518. listeners: {
  17519. click: 'scope.commit',
  17520. }
  17521. },
  17522. {
  17523. xtype: "button",
  17524. text: "关闭",
  17525. iconCls: 'x-fa fa-times',
  17526. listeners: {
  17527. click: 'system.closeMe()',
  17528. }
  17529. },
  17530. ],
  17531. items: [
  17532. {
  17533. region: 'center',
  17534. xtype: 'tabpanel',
  17535. items: [
  17536. {
  17537. title: '基本信息', reference: 'basic',
  17538. layout: {
  17539. type: 'vbox',
  17540. pack: 'start',
  17541. align: 'stretch'
  17542. },
  17543. defaults: {
  17544. border: false,
  17545. anchor: '100%',
  17546. margin: '5',
  17547. },
  17548. scrollable: true,
  17549. items: [
  17550. {
  17551. xtype: 'cols',
  17552. items: [
  17553. {
  17554. fieldLabel: '路径',
  17555. bind: { value: '{__custom_path}' },
  17556. xtype: 'textfield',
  17557. flex: 2,
  17558. },
  17559. {
  17560. fieldLabel: '版本',
  17561. bind: { value: '{__custom_version}' },
  17562. xtype: 'textfield',
  17563. },
  17564. ]
  17565. },
  17566. {
  17567. xtype: 'cols',
  17568. items: [
  17569. {
  17570. fieldLabel: '配置点',
  17571. bind: { value: '{__custom_point}' },
  17572. xtype: 'textfield',
  17573. },
  17574. {
  17575. fieldLabel: 'reference',
  17576. bind: { value: '{reference}' },
  17577. xtype: 'textfield',
  17578. },
  17579. {
  17580. fieldLabel: '编辑模式',
  17581. bind: { value: '{_mode}' },
  17582. xtype: 'combo',
  17583. dict: 'GRID_MODE',
  17584. },
  17585. ]
  17586. },
  17587. {
  17588. layout: 'hbox',
  17589. defaults: {
  17590. margin: '0 0 0 15',
  17591. },
  17592. items: [
  17593. {
  17594. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17595. bind: {
  17596. value: "{hideFootbar}"
  17597. }
  17598. },
  17599. {
  17600. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17601. bind: {
  17602. value: "{hideRefresh}"
  17603. }
  17604. },
  17605. {
  17606. boxLabel: '隐藏导出', xtype: 'checkbox',
  17607. bind: {
  17608. value: "{hideExport}"
  17609. }
  17610. },
  17611. {
  17612. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17613. bind: {
  17614. value: "{hideAutoSize}"
  17615. }
  17616. },
  17617. {
  17618. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17619. bind: {
  17620. value: "{hideClearFilter}"
  17621. }
  17622. },
  17623. {
  17624. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17625. bind: {
  17626. value: "{hideSaveGridUIConfig}"
  17627. }
  17628. },
  17629. {
  17630. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17631. bind: {
  17632. value: "{hideClearGridUIConfig}"
  17633. }
  17634. },
  17635. ]
  17636. },
  17637. {
  17638. layout: 'hbox',
  17639. defaults: {
  17640. margin: '0 0 0 15',
  17641. },
  17642. items: [
  17643. {
  17644. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17645. bind: { value: '{autoLoad}' },
  17646. margin: '0 0 0 85',
  17647. },
  17648. {
  17649. boxLabel: '分页模式', xtype: 'checkbox',
  17650. bind: { value: '{pagination}' },
  17651. },
  17652. {
  17653. boxLabel: '显示行序号', xtype: 'checkbox',
  17654. bind: { value: '{show_rownum}' },
  17655. },
  17656. {
  17657. boxLabel: '后端排序', xtype: 'checkbox',
  17658. bind: {
  17659. value: "{remoteSort}"
  17660. }
  17661. },
  17662. {
  17663. boxLabel: '后端过滤', xtype: 'checkbox',
  17664. bind: {
  17665. value: "{remoteFilter}"
  17666. }
  17667. },
  17668. {
  17669. boxLabel: '隐藏', xtype: 'checkbox',
  17670. bind: {
  17671. value: "{hidden}"
  17672. }
  17673. },
  17674. ]
  17675. },
  17676. {
  17677. layout: 'hbox',
  17678. defaults: {
  17679. margin: '0 0 0 15',
  17680. },
  17681. items: [
  17682. {
  17683. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17684. bind: {
  17685. value: "{enableColumnHide}"
  17686. }
  17687. },
  17688. {
  17689. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17690. bind: {
  17691. value: "{enableColumnMove}"
  17692. }
  17693. },
  17694. {
  17695. boxLabel: '自定义筛选', xtype: 'checkbox',
  17696. bind: {
  17697. value: "{gridfilters}"
  17698. }
  17699. },
  17700. {
  17701. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17702. bind: {
  17703. value: "{enableColumnResize}"
  17704. }
  17705. },
  17706. {
  17707. boxLabel: '点击列头排序', xtype: 'checkbox',
  17708. bind: {
  17709. value: "{sortOnClick}"
  17710. }
  17711. },
  17712. ]
  17713. },
  17714. {
  17715. xtype: 'cols',
  17716. items: [
  17717. {
  17718. fieldLabel: 'dbTableName',
  17719. labelWidth: 110,
  17720. bind: { value: '{behavior.dbTableName}' },
  17721. xtype: 'textfield',
  17722. },
  17723. {
  17724. fieldLabel: 'theid',
  17725. bind: { value: '{theid}' },
  17726. xtype: 'textfield',
  17727. },
  17728. {
  17729. fieldLabel: '添加行聚焦',
  17730. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17731. xtype: 'textfield',
  17732. },
  17733. ]
  17734. },
  17735. {
  17736. xtype: 'cols',
  17737. items: [
  17738. {
  17739. fieldLabel: '批量删除提示',
  17740. labelWidth: 110,
  17741. bind: { value: '{behavior.batchRemoveConfirm}' },
  17742. xtype: 'textfield',
  17743. },
  17744. {
  17745. fieldLabel: '删除提示',
  17746. bind: { value: '{behavior.singleRemoveConfirm}' },
  17747. xtype: 'textfield',
  17748. },
  17749. {
  17750. fieldLabel: '触发刷新',
  17751. labelWidth: 110,
  17752. bind: { value: '{behavior.selectToReload}' },
  17753. xtype: 'textfield',
  17754. },
  17755. ]
  17756. },
  17757. ]
  17758. },
  17759. {
  17760. title: '字段', reference: 'grid1',
  17761. xtype: 'yvgrid',
  17762. pagination: false,
  17763. _mode: 'edit',
  17764. listeners: {
  17765. buttonclick: 'scope.grid1Buttonclick',
  17766. },
  17767. hideFootbar: true,
  17768. tbar: [
  17769. {
  17770. xtype: 'button',
  17771. text: '添加',
  17772. iconCls: 'x-fa fa-plus-circle',
  17773. listeners: {
  17774. click: 'scope.addField'
  17775. }
  17776. },
  17777. {
  17778. xtype: 'button',
  17779. text: '删除',
  17780. iconCls: 'x-fa fa-minus-circle',
  17781. listeners: {
  17782. click: 'scope.removeField'
  17783. }
  17784. },
  17785. '-',
  17786. {
  17787. xtype: 'button',
  17788. text: '自动分析',
  17789. iconCls: 'x-fa fa-code-fork',
  17790. listeners: {
  17791. click: 'scope.calcField'
  17792. }
  17793. },
  17794. {
  17795. xtype: 'button',
  17796. text: '上移',
  17797. iconCls: 'x-fa fa-arrow-up',
  17798. listeners: {
  17799. click: 'scope.moveUp'
  17800. }
  17801. },
  17802. {
  17803. xtype: 'button',
  17804. text: '下移',
  17805. iconCls: 'x-fa fa-arrow-down',
  17806. listeners: {
  17807. click: 'scope.moveDown'
  17808. }
  17809. },
  17810. ],
  17811. store: {},
  17812. columns: [
  17813. {
  17814. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17815. editor: { xtype: 'textfield' }
  17816. },
  17817. {
  17818. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17819. editor: { xtype: 'textfield' }
  17820. },
  17821. {
  17822. dataIndex: 'header', header: '中文', width: 140,
  17823. editor: { xtype: 'textfield' }
  17824. },
  17825. {
  17826. dataIndex: 'dict', header: '字典', width: 110,
  17827. editor: { xtype: 'combogrid' }
  17828. },
  17829. {
  17830. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17831. editor: { xtype: 'combogrid' }, hidden: true,
  17832. },
  17833. {
  17834. dataIndex: 'width', header: '宽度', width: 80,
  17835. editor: { xtype: 'numberfield' }, hidden: true,
  17836. },
  17837. {
  17838. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17839. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17840. },
  17841. {
  17842. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17843. editor: { xtype: 'textfield' },
  17844. },
  17845. {
  17846. dataIndex: 'createValue', text: '客户端新创建值',
  17847. editor: { xtype: 'textfield' },
  17848. },
  17849. {
  17850. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17851. resizable: false, sortable: false, menuDisabled: true,
  17852. checkedValue: true, uncheckedValue: false,
  17853. },
  17854. {
  17855. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17856. resizable: false, sortable: false, menuDisabled: true,
  17857. checkedValue: true, uncheckedValue: false,
  17858. },
  17859. {
  17860. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17861. resizable: false, sortable: false, menuDisabled: true,
  17862. checkedValue: true, uncheckedValue: false,
  17863. },
  17864. {
  17865. dataIndex: 'formatter', header: '格式化', width: 110,
  17866. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17867. },
  17868. {
  17869. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17870. resizable: false, sortable: false, menuDisabled: true,
  17871. checkedValue: true, uncheckedValue: false, hidden: true,
  17872. },
  17873. {
  17874. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17875. resizable: false, sortable: false, menuDisabled: true,
  17876. hidden: true,
  17877. },
  17878. {
  17879. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17880. resizable: false, sortable: false, menuDisabled: true,
  17881. checkedValue: true, uncheckedValue: false, hidden: true,
  17882. },
  17883. {
  17884. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17885. resizable: false, sortable: false, menuDisabled: true,
  17886. },
  17887. {
  17888. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17889. resizable: false, sortable: false, menuDisabled: true,
  17890. checkedValue: true, uncheckedValue: false, hidden: true,
  17891. },
  17892. {
  17893. dataIndex: 'form_order', text: '对话框序号',
  17894. editor: { xtype: 'numberfield' },
  17895. },
  17896. {
  17897. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17898. resizable: false, sortable: false, menuDisabled: true,
  17899. checkedValue: true, uncheckedValue: false,
  17900. },
  17901. {
  17902. dataIndex: 'form_xtype', text: '对话框编辑器',
  17903. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17904. },
  17905. {
  17906. dataIndex: 'form_fieldset', text: '对话框字段组',
  17907. editor: { xtype: 'textfield' }, hidden: true,
  17908. },
  17909. {
  17910. dataIndex: 'form_tab', text: '对话框选项卡',
  17911. editor: { xtype: 'textfield' }, hidden: true,
  17912. },
  17913. {
  17914. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17915. resizable: false, sortable: false, menuDisabled: true,
  17916. checkedValue: true, uncheckedValue: false, hidden: true,
  17917. },
  17918. ],
  17919. },
  17920. {
  17921. title: 'SQL和查询条件', reference: 'sql',
  17922. layout: 'border',
  17923. border: false,
  17924. items: [
  17925. {
  17926. region: 'north',
  17927. height: 200,
  17928. border: false,
  17929. split: true,
  17930. xtype: 'yvgrid',
  17931. reference: 'gridCondition',
  17932. pagination: false,
  17933. hideFootbar: true,
  17934. _mode: 'edit',
  17935. listeners: {
  17936. buttonclick: 'scope.conditionButtonclick',
  17937. },
  17938. store: {},
  17939. tbar: {
  17940. xtype: 'toolbar',
  17941. border: false,
  17942. items: [
  17943. {
  17944. xtype: 'button',
  17945. text: '添加条件',
  17946. iconCls: 'x-fa fa-plus-circle',
  17947. listeners: {
  17948. click: 'scope.addCondition'
  17949. }
  17950. },
  17951. {
  17952. xtype: 'button',
  17953. text: '删除条件',
  17954. iconCls: 'x-fa fa-minus-circle',
  17955. listeners: {
  17956. click: 'scope.removeCondition'
  17957. }
  17958. },
  17959. '-',
  17960. {
  17961. xtype: 'button',
  17962. text: '自动分析条件变量',
  17963. iconCls: 'x-fa fa-code-fork',
  17964. listeners: {
  17965. click: 'scope.calcCondition'
  17966. }
  17967. },
  17968. {
  17969. xtype: 'button',
  17970. text: '上移',
  17971. iconCls: 'x-fa fa-arrow-up',
  17972. listeners: {
  17973. click: 'scope.moveUpCondition'
  17974. }
  17975. },
  17976. {
  17977. xtype: 'button',
  17978. text: '下移',
  17979. iconCls: 'x-fa fa-arrow-down',
  17980. listeners: {
  17981. click: 'scope.moveDownCondition'
  17982. }
  17983. },
  17984. ]
  17985. },
  17986. columns: [
  17987. {
  17988. text: '条件变量',
  17989. dataIndex: 'param_name',
  17990. width: 140,
  17991. sortable: false,
  17992. menuDisabled: true,
  17993. editor: {
  17994. selectOnFocus: true
  17995. },
  17996. },
  17997. {
  17998. text: '中文标题',
  17999. dataIndex: 'fieldLabel',
  18000. width: 120,
  18001. sortable: false,
  18002. menuDisabled: true,
  18003. editor: {
  18004. selectOnFocus: true
  18005. },
  18006. },
  18007. {
  18008. text: '编辑类型',
  18009. dataIndex: 'xtype',
  18010. width: 80,
  18011. sortable: false,
  18012. menuDisabled: true,
  18013. editor: {
  18014. xtype: 'combo',
  18015. typeAhead: true,
  18016. triggerAction: 'all',
  18017. selectOnFocus: true,
  18018. store: [
  18019. ['textfield', 'textfield'],
  18020. ['combo', 'combo'],
  18021. ['datefield', 'datefield'],
  18022. ['datetimefield', 'datetimefield'],
  18023. ['numberfield', 'numberfield'],
  18024. ['multiplesearch', 'multiplesearch'],
  18025. ]
  18026. }
  18027. },
  18028. {
  18029. text: '权重',
  18030. dataIndex: 'conditionFieldFlex',
  18031. align: 'right',
  18032. width: 60,
  18033. sortable: false,
  18034. menuDisabled: true,
  18035. editor: {
  18036. xtype: 'numberfield',
  18037. selectOnFocus: false,
  18038. minValue: 0,
  18039. maxValue: 10
  18040. },
  18041. },
  18042. {
  18043. text: '字典',
  18044. dataIndex: 'conditionFieldDict',
  18045. width: 160,
  18046. sortable: false,
  18047. menuDisabled: true,
  18048. editor: {
  18049. selectOnFocus: false
  18050. },
  18051. },
  18052. {
  18053. xtype: 'checkcolumn',
  18054. dataIndex: "conditionFieldWrap", header: "换行",
  18055. width: 65,
  18056. sortable: false,
  18057. menuDisabled: true,
  18058. },
  18059. {
  18060. text: '扩展参数',
  18061. dataIndex: 'conditionFieldExtend',
  18062. sortable: false,
  18063. menuDisabled: true,
  18064. editor: {
  18065. selectOnFocus: false
  18066. },
  18067. },
  18068. ]
  18069. },
  18070. {
  18071. region: 'center',
  18072. xtype: 'sqleditor',
  18073. layout: 'fit',
  18074. reference: 'sqlEditor',
  18075. split: true,
  18076. },
  18077. ]
  18078. },
  18079. {
  18080. title: '详情对话框',
  18081. layout: {
  18082. type: 'vbox',
  18083. pack: 'start',
  18084. align: 'stretch'
  18085. },
  18086. defaults: {
  18087. border: false,
  18088. anchor: '100%',
  18089. margin: '5',
  18090. },
  18091. scrollable: true,
  18092. items: [
  18093. {
  18094. xtype: 'cols',
  18095. items: [
  18096. {
  18097. fieldLabel: '对话框标题',
  18098. bind: { value: '{detailDialog.title}' },
  18099. xtype: 'textfield',
  18100. flex: 2,
  18101. },
  18102. {
  18103. fieldLabel: '宽度',
  18104. bind: { value: '{detailDialog.width}' },
  18105. xtype: 'numberfield',
  18106. },
  18107. {
  18108. fieldLabel: '高度',
  18109. bind: { value: '{detailDialog.height}' },
  18110. xtype: 'numberfield',
  18111. },
  18112. ]
  18113. },
  18114. ]
  18115. },
  18116. {
  18117. title: '界面源码',
  18118. xtype: 'jseditor',
  18119. reference: 'jseditor'
  18120. }
  18121. ]
  18122. }
  18123. ]
  18124. };
  18125. //# sourceMappingURL=GridColumnCustom.view.js.map
  18126. var GridColumnCustom = /** @class */ (function (_super) {
  18127. __extends(GridColumnCustom, _super);
  18128. function GridColumnCustom() {
  18129. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18130. }
  18131. GridColumnCustom.prototype.commit = function () {
  18132. };
  18133. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18134. };
  18135. GridColumnCustom.prototype.conditionButtonclick = function () {
  18136. };
  18137. GridColumnCustom.prototype.addField = function () {
  18138. };
  18139. GridColumnCustom.prototype.removeField = function () {
  18140. };
  18141. GridColumnCustom.prototype.calcField = function () {
  18142. };
  18143. GridColumnCustom.prototype.moveUp = function () {
  18144. };
  18145. GridColumnCustom.prototype.moveDown = function () {
  18146. };
  18147. GridColumnCustom.prototype.addCondition = function () {
  18148. };
  18149. GridColumnCustom.prototype.removeCondition = function () {
  18150. };
  18151. GridColumnCustom.prototype.calcCondition = function () {
  18152. };
  18153. GridColumnCustom.prototype.moveUpCondition = function () {
  18154. };
  18155. GridColumnCustom.prototype.moveDownCondition = function () {
  18156. };
  18157. return GridColumnCustom;
  18158. }(Scope));
  18159. //# sourceMappingURL=GridColumnCustom.js.map
  18160. function initGridCode(grid, newConfig, buttons) {
  18161. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18162. buttons.push({
  18163. xtype: 'button',
  18164. tooltip: '定义表格属性',
  18165. iconCls: 'x-fa fa-codepen',
  18166. handler: function (btn) {
  18167. var customWindow = new GridColumnCustom();
  18168. customWindow.showDialog(btn, {}, {});
  18169. }
  18170. });
  18171. buttons.push({
  18172. xtype: 'button',
  18173. tooltip: '定义表格数据源',
  18174. iconCls: 'x-fa fa-database',
  18175. handler: function () {
  18176. // showCustomGridDataSource(grid)
  18177. }
  18178. });
  18179. }
  18180. }
  18181. //# sourceMappingURL=grid_code.js.map
  18182. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18183. var hexToString = function (hex) {
  18184. var arr = hex.split("");
  18185. var out = "";
  18186. for (var i = 0; i < arr.length / 2; i++) {
  18187. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18188. // @ts-ignore
  18189. var charValue = String.fromCharCode(tmp);
  18190. out += charValue;
  18191. }
  18192. return out;
  18193. };
  18194. var defaultGrid = grid;
  18195. function initGrid () {
  18196. Ext.define('Yvan.Grid', {
  18197. extend: 'Ext.grid.Panel',
  18198. xtype: 'yvgrid',
  18199. __suspendReload: false,
  18200. _originVJson: {},
  18201. constructor: function (config) {
  18202. var _this = this;
  18203. var _a, _b, _c, _d, _e, _f;
  18204. var me = this;
  18205. var dataSource = config.dataSource;
  18206. 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);
  18207. me._originVJson = config;
  18208. if (!isDesignMode(scope, config)) {
  18209. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18210. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18211. var cacheData = this.getColumnConfigCache();
  18212. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18213. var newColumns = [];
  18214. for (var j = 0; j < cacheData.length; j++) {
  18215. var itData = cacheData[j];
  18216. for (var i = 0; i < config.columns.length; i++) {
  18217. var column = config.columns[i];
  18218. if (itData.dataIndex === column.dataIndex) {
  18219. if (itData.width) {
  18220. column.width = itData.width;
  18221. }
  18222. column.hidden = itData.hidden;
  18223. column.locked = itData.locked;
  18224. newColumns.push(column);
  18225. break;
  18226. }
  18227. }
  18228. }
  18229. config.columns = newColumns;
  18230. }
  18231. }
  18232. }
  18233. var newConfig = _$2.defaultsDeep({
  18234. // 强制性属性 bug.
  18235. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18236. // enableLocking: false,
  18237. // syncRowHeight: false,
  18238. }, baseConfig(config, 'row-item'), config, grid);
  18239. // 在面板上的组件
  18240. // const scope = newConfig.$initParent?.yvanScope ||
  18241. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18242. // config.$vmParent?.yvanScope ||
  18243. // newConfig.$vmParent?._parent?.yvanScope;
  18244. var buttons = [];
  18245. var getRowClass = newConfig.getRowClass;
  18246. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18247. _$2.startsWith(getRowClass, "system."))) {
  18248. var fn = lookupFn(scope, getRowClass);
  18249. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18250. }
  18251. if (!newConfig.hideExport) {
  18252. buttons.push({
  18253. xtype: 'button',
  18254. tooltip: '导出Excel',
  18255. iconCls: 'x-fa fa-download',
  18256. listeners: {
  18257. click: this.exportExcel
  18258. },
  18259. });
  18260. }
  18261. if (!newConfig.hideAutoSize) {
  18262. buttons.push({
  18263. xtype: 'button',
  18264. iconCls: 'x-fa fa-text-width',
  18265. tooltip: '自适应宽度',
  18266. listeners: {
  18267. click: this.autoSizeColumns
  18268. }
  18269. });
  18270. }
  18271. if (!newConfig.hideClearFilter) {
  18272. buttons.push({
  18273. xtype: 'button',
  18274. tooltip: '清空筛选',
  18275. iconCls: 'x-fa fa-filter',
  18276. handler: this.clearFilter
  18277. });
  18278. }
  18279. if (!newConfig.hideSaveGridUIConfig) {
  18280. buttons.push({
  18281. xtype: 'button',
  18282. tooltip: '保存布局',
  18283. iconCls: 'x-fa fa-cogs',
  18284. handler: this.saveGridUIConfig
  18285. });
  18286. }
  18287. if (!newConfig.hideClearGridUIConfig) {
  18288. buttons.push({
  18289. xtype: 'button',
  18290. tooltip: '还原布局',
  18291. iconCls: 'x-fa fa-reply-all',
  18292. handler: this.clearGridUIConfig
  18293. });
  18294. }
  18295. initGridCode(me, newConfig, buttons);
  18296. if (!newConfig.hideFootbar) {
  18297. if (newConfig.pagination) {
  18298. newConfig.bbar = new Ext.PagingToolbar({
  18299. // pageSize: newConfig.pageSize, 这个值是无效的
  18300. displayInfo: true,
  18301. store: this.store,
  18302. emptyMsg: '没有记录',
  18303. cls: 'grid-bbar',
  18304. items: __spread([
  18305. {
  18306. xtype: 'combobox',
  18307. tooltip: '分页',
  18308. queryMode: 'local',
  18309. editable: false,
  18310. allowBlank: true,
  18311. labelAlign: 'right',
  18312. width: 90,
  18313. // labelWidth: 30,
  18314. listConfig: {
  18315. minWidth: null
  18316. },
  18317. value: 50,
  18318. valueField: undefined,
  18319. displayField: undefined,
  18320. hideClear: true,
  18321. store: newConfig.pageSizeOption,
  18322. listeners: {
  18323. change: function (sender, nv, ov) {
  18324. _this.store.pageSize = nv;
  18325. _this.store.loadPage(1);
  18326. }
  18327. }
  18328. }
  18329. ], buttons),
  18330. doRefresh: function () {
  18331. me.reload();
  18332. }
  18333. });
  18334. }
  18335. else {
  18336. newConfig.bbar = {
  18337. xtype: 'toolbar', overflowHandler: 'menu',
  18338. cls: 'grid-bbar',
  18339. items: __spread([
  18340. {
  18341. xtype: 'button',
  18342. tooltip: '刷新',
  18343. iconCls: 'x-fa fa-refresh',
  18344. handler: function () {
  18345. _this.reload();
  18346. }
  18347. },
  18348. '-'
  18349. ], buttons)
  18350. };
  18351. if (newConfig.hideRefresh) {
  18352. newConfig.bbar.items.splice(0, 1);
  18353. }
  18354. }
  18355. }
  18356. if (_$2.isArray(newConfig.condition)) {
  18357. // 带查询条件
  18358. var conditionRows_1 = [];
  18359. var newRow_1 = false;
  18360. var currentRow_1 = { xtype: 'cols', items: [], };
  18361. conditionRows_1.push(currentRow_1);
  18362. _$2.forEach(newConfig.condition, function (item) {
  18363. var _a;
  18364. if (newRow_1) {
  18365. currentRow_1 = { xtype: 'cols', items: [], };
  18366. conditionRows_1.push(currentRow_1);
  18367. }
  18368. var vj = _$2.cloneDeep(item);
  18369. if (vj.xtype) {
  18370. if (item.xtype === 'combo' && item.dict) {
  18371. vj.fix = ['system.getDict("' + item.dict + '")'];
  18372. }
  18373. if (item.xtype === 'datetimefield') {
  18374. _$2.defer(function () {
  18375. //@ts-ignore
  18376. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18377. });
  18378. }
  18379. else if (item.xtype === 'datefield') {
  18380. _$2.defer(function () {
  18381. //@ts-ignore
  18382. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18383. });
  18384. }
  18385. else {
  18386. scope.viewModel.set(item.param_name, '');
  18387. }
  18388. }
  18389. else {
  18390. // 没有组件类型,是个空占位符
  18391. vj.border = false;
  18392. }
  18393. if (item.param_name) {
  18394. vj.bind = {
  18395. value: '{' + item.param_name + '}'
  18396. };
  18397. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18398. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18399. }
  18400. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18401. currentRow_1.items.push(vj);
  18402. });
  18403. newConfig.tbar = {
  18404. xtype: 'form',
  18405. border: false,
  18406. items: conditionRows_1,
  18407. defaults: {
  18408. margin: '8 0 8 0'
  18409. },
  18410. };
  18411. console.log('newConfig', newConfig);
  18412. }
  18413. _$2.each(newConfig.columns, function (c) {
  18414. var renderer = c.renderer, formatter = c.formatter;
  18415. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18416. _$2.startsWith(renderer, "system."))) {
  18417. if (newConfig.$initParent) {
  18418. if (scope) {
  18419. var rendererFn = lookupFn(scope, renderer);
  18420. c.renderer = rendererFn.bind(scope);
  18421. }
  18422. }
  18423. }
  18424. if (c.dict) {
  18425. c.fix = ['system.getDict("' + c.dict + '")'];
  18426. if (c.editor && c.editor.xtype === 'combo') {
  18427. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18428. c.editor.typeAhead = true;
  18429. c.editor.triggerAction = 'all';
  18430. c.editor.selectOnFocus = false;
  18431. c.editor.listConfig = {
  18432. minWidth: 200
  18433. };
  18434. }
  18435. }
  18436. if (formatter === 'button') {
  18437. c.tdCls = 'td-btn';
  18438. if (!c.listeners) {
  18439. c.listeners = {};
  18440. }
  18441. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18442. if ($(event.target).is('input')) {
  18443. me.fireEvent('buttonclick', me, this, record);
  18444. }
  18445. };
  18446. }
  18447. else if (formatter === 'percentRenderer') {
  18448. c.tdCls = 'td-percent';
  18449. }
  18450. });
  18451. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18452. // 强制为编辑模式
  18453. newConfig.selModel = {
  18454. type: 'spreadsheet',
  18455. columnSelect: true,
  18456. pruneRemoved: false,
  18457. extensible: 'y'
  18458. };
  18459. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18460. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18461. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18462. }
  18463. else {
  18464. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18465. }
  18466. }
  18467. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18468. // 强制为勾选模式
  18469. newConfig.selModel = {
  18470. type: 'checkboxmodel',
  18471. mode: 'MULTI',
  18472. };
  18473. }
  18474. else if (newConfig._mode === 'checkonly') {
  18475. newConfig.selModel = {
  18476. type: 'checkboxmodel',
  18477. mode: 'MULTI',
  18478. checkOnly: true,
  18479. };
  18480. }
  18481. else if (newConfig._mode === 'select') {
  18482. // 强制为选择模式
  18483. newConfig.selModel = {
  18484. selType: 'rowmodel',
  18485. mode: 'SINGLE',
  18486. };
  18487. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18488. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18489. }
  18490. }
  18491. initBehaviorEdit(newConfig);
  18492. initGridDialog(newConfig);
  18493. this.superclass.constructor.call(this, newConfig);
  18494. this.store.pageSize = newConfig.pageSize;
  18495. },
  18496. setData: function (value) {
  18497. var me = this;
  18498. me._setDataReal(value);
  18499. },
  18500. /**
  18501. * 添加行,并进入编辑状态
  18502. * @param record 新行的属性集
  18503. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18504. */
  18505. appendEditRow: function (record, editRowCol) {
  18506. var records = this.getStore().add(record);
  18507. var recNew = records[0];
  18508. this.setSelection(records);
  18509. if (typeof editRowCol === 'string' && editRowCol) {
  18510. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18511. }
  18512. if (typeof editRowCol === 'number') {
  18513. var ce = this.findPlugin('cellediting');
  18514. this.editingPlugin = ce;
  18515. ce.startEdit(recNew, editRowCol);
  18516. }
  18517. },
  18518. beginEdit: function (record, editRowCol) {
  18519. if (typeof record === 'number') {
  18520. record = this.store.data.getAt(record);
  18521. }
  18522. if (record.isEntity === true) {
  18523. this.setSelection([record]);
  18524. if (typeof editRowCol === 'string' && editRowCol) {
  18525. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18526. }
  18527. if (typeof editRowCol === 'number') {
  18528. var ce = this.findPlugin('cellediting');
  18529. this.editingPlugin = ce;
  18530. ce.startEdit(record, editRowCol);
  18531. }
  18532. }
  18533. },
  18534. /**
  18535. * 移除行
  18536. * @param record 如果记录传空,就是当前选中的行
  18537. */
  18538. removeEditRow: function (record) {
  18539. if (!record) {
  18540. record = this.selection;
  18541. }
  18542. if (!record) {
  18543. msg('请选中要删除的行');
  18544. return;
  18545. }
  18546. this.getStore().remove(record);
  18547. },
  18548. /**
  18549. * 获取全部原始数据
  18550. */
  18551. getDataRows: function () {
  18552. return this.getStore().data.items.map(function (r) { return r.data; });
  18553. },
  18554. /**
  18555. * 获取全部原始数据, 不带 id/ 不带 origin
  18556. */
  18557. getDataRowsOnlyData: function () {
  18558. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18559. delete r.id;
  18560. delete r._origin;
  18561. return r;
  18562. });
  18563. },
  18564. rowMoveUp: function () {
  18565. var grid = this;
  18566. if (!grid.selection) {
  18567. msg('无法对多行进行移动');
  18568. return;
  18569. }
  18570. var record = grid.selection;
  18571. if (_$2.isArray(record)) {
  18572. record = record[0];
  18573. }
  18574. if (!record) {
  18575. msg('无法对多行进行移动');
  18576. return;
  18577. }
  18578. // const records = grid.selModel.getSelection()
  18579. // if (records.length !== 1) {
  18580. // msg('无法对多行进行移动')
  18581. // return
  18582. // }
  18583. //
  18584. // const [record] = records
  18585. var index = grid.store.indexOf(record);
  18586. if (index > 0) {
  18587. grid.store.removeAt(index);
  18588. grid.store.insert(index - 1, record);
  18589. grid.getView().refresh();
  18590. grid.selModel.select([record]);
  18591. }
  18592. },
  18593. rowMoveDown: function () {
  18594. var grid = this;
  18595. // const records = grid.selModel.getSelection()
  18596. // if (records.length !== 1) {
  18597. // msg('无法对多行进行移动')
  18598. // return
  18599. // }
  18600. if (!grid.selection) {
  18601. msg('无法对多行进行移动');
  18602. return;
  18603. }
  18604. var record = grid.selection;
  18605. if (_$2.isArray(record)) {
  18606. record = record[0];
  18607. }
  18608. if (!record) {
  18609. msg('无法对多行进行移动');
  18610. return;
  18611. }
  18612. var index = grid.store.indexOf(record);
  18613. if (index < grid.store.getCount() - 1) {
  18614. grid.store.removeAt(index);
  18615. grid.store.insert(index + 1, record);
  18616. grid.getView().refresh();
  18617. grid.selModel.select([record]);
  18618. }
  18619. },
  18620. getEditRecord: function () {
  18621. var _a, _b;
  18622. var me = this;
  18623. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18624. 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;
  18625. var record;
  18626. if (typeof rowIdx === 'undefined') {
  18627. record = me.getSelectionModel().getLastSelected();
  18628. }
  18629. else {
  18630. record = me.store.getAt(rowIdx);
  18631. }
  18632. return record;
  18633. },
  18634. getEditRow: function () {
  18635. var _a;
  18636. var me = this;
  18637. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18638. },
  18639. setEditRow: function (rowValues) {
  18640. var me = this;
  18641. var record = me.getEditRecord();
  18642. if (record) {
  18643. _$2.forOwn(rowValues, function (v, k) {
  18644. record.set(k, v);
  18645. });
  18646. }
  18647. },
  18648. _transform: function (data) {
  18649. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18650. _$2.forEach(data, function (row) {
  18651. row._origin = _$2.clone(row);
  18652. });
  18653. },
  18654. _setDataReal: function (value) {
  18655. var me = this;
  18656. this._transform(value);
  18657. var storeOpt = {
  18658. fields: getFileds(this),
  18659. data: value,
  18660. };
  18661. if (this.groupField) {
  18662. storeOpt.groupField = this.groupField;
  18663. }
  18664. var store = new Ext.data.Store(storeOpt);
  18665. me.setStore(store);
  18666. },
  18667. setStore: function (store) {
  18668. var me = this;
  18669. if (_$2.isArray(store)) {
  18670. var value = store;
  18671. this._transform(value);
  18672. var storeOpt = {
  18673. fields: getFileds(this),
  18674. data: value,
  18675. };
  18676. if (this.groupField) {
  18677. storeOpt.groupField = this.groupField;
  18678. }
  18679. store = new Ext.data.Store(storeOpt);
  18680. }
  18681. me.superclass.setStore.call(this, store);
  18682. var reference = this.reference;
  18683. if (reference) {
  18684. var scope = lookupScope(this);
  18685. scope.viewModel.set(reference + '.ischanged', false);
  18686. scope.viewModel.set(reference + '.theid', null);
  18687. scope.viewModel.set(reference + '.theid2', null);
  18688. scope.viewModel.set(reference + '.theid3', null);
  18689. }
  18690. if (store) {
  18691. store.on({
  18692. add: function (store, records, index, eOpts) {
  18693. me._raiseChange(store, 'add');
  18694. },
  18695. remove: function (store, records, index, isMove, eOpts) {
  18696. me._raiseChange(store, 'remove');
  18697. },
  18698. datachanged: function (sender, opt) {
  18699. me._raiseChange(store, 'datachanged');
  18700. }
  18701. });
  18702. }
  18703. },
  18704. _raiseChange: function (store, type) {
  18705. var _a, _b;
  18706. var reference = this.reference;
  18707. if (reference && store) {
  18708. var ischanged = false;
  18709. if (store.getModifiedRecords().length > 0 ||
  18710. store.getNewRecords().length > 0 ||
  18711. store.getRemovedRecords().length > 0) {
  18712. ischanged = true;
  18713. }
  18714. else {
  18715. ischanged = false;
  18716. }
  18717. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18718. }
  18719. },
  18720. /**
  18721. * 轻量级刷新
  18722. */
  18723. refreshData: function () {
  18724. var store = this.getStore();
  18725. if (store) {
  18726. store.reload();
  18727. }
  18728. },
  18729. /**
  18730. * 为表格强制设置焦点
  18731. * @param seq 顺序号
  18732. */
  18733. focusRow: function (seq) {
  18734. this.setSelection(this.store.getAt(seq));
  18735. this.getView().focusRow(seq);
  18736. },
  18737. /**
  18738. * 重新载入数据(重新计算参数)
  18739. */
  18740. reload: function (reloadParams) {
  18741. if (reloadParams === void 0) { reloadParams = {}; }
  18742. var me = this;
  18743. var config = me.config;
  18744. if (config.dataSourceCallbackFn) {
  18745. // 函数请求刷新
  18746. var scope_1 = lookupScope(this);
  18747. _$2.defer(function () {
  18748. me.setLoading(true);
  18749. });
  18750. config.dataSourceCallbackFn.call(scope_1, me, {
  18751. successCallback: function (value) {
  18752. me._setDataReal(value);
  18753. _$2.defer(function () {
  18754. me.setLoading(false);
  18755. });
  18756. // 自动选中第一行
  18757. var data = me.getStore().data;
  18758. if (data.length > 0) {
  18759. me.setSelection(data.items[0]);
  18760. }
  18761. me.fireEvent('dataLoadComplete', me, true, value);
  18762. },
  18763. failCallback: function (error) {
  18764. _$2.defer(function () {
  18765. me.setLoading(false);
  18766. });
  18767. me.fireEvent('dataLoadComplete', me, false, error);
  18768. }
  18769. });
  18770. return;
  18771. }
  18772. // if (this.store) {
  18773. // this.store.reload({aaaa: 1, bbbb: 2})
  18774. // }
  18775. var dataSource = config.dataSource;
  18776. var scope = lookupScope(me);
  18777. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18778. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18779. }
  18780. },
  18781. exportCurrentExcelClick: function () {
  18782. var _a;
  18783. var me = this;
  18784. var config = me.config;
  18785. var scope = lookupScope(me);
  18786. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18787. if (excelFileName.endsWith(".xlsx")) {
  18788. excelFileName = excelFileName.split(".xlsx")[0];
  18789. }
  18790. excelFileName += ".xlsx";
  18791. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18792. var excelData = me.makeExcelData(rowsAll);
  18793. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18794. },
  18795. exportExcelClick: function (excelExportParams) {
  18796. var me = this;
  18797. var config = me.config;
  18798. excelExportParams.isExcelExport = true;
  18799. var scope = lookupScope(me);
  18800. var dataSource = config.dataSource;
  18801. scope.setLoading(true);
  18802. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18803. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18804. var _a, _b, _c, _d;
  18805. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18806. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18807. 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;
  18808. me.exportExcelCurrentPage = page;
  18809. me.exportExcelPageSize = size;
  18810. me.exportExcelTotal = total;
  18811. if (excelFileName.endsWith(".xlsx")) {
  18812. excelFileName = excelFileName.split(".xlsx")[0];
  18813. }
  18814. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18815. excelFileName += ".xlsx";
  18816. var excelData = me.makeExcelData(responseData.data);
  18817. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18818. if (page < total / size) {
  18819. page++;
  18820. me.exportExcelCurrentPage = page;
  18821. }
  18822. scope.setLoading(false);
  18823. });
  18824. },
  18825. exportBigExcelClick: function () {
  18826. var _a;
  18827. var me = this;
  18828. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18829. showErrorDialog('当前表格不支持大批量导出');
  18830. return;
  18831. }
  18832. var config = me.config;
  18833. var scope = lookupScope(me);
  18834. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18835. var head = [];
  18836. var dict = {};
  18837. _$2.forEach(me.columns, function (column) {
  18838. if (column.isHidden())
  18839. return;
  18840. if (!column.dataIndex)
  18841. return;
  18842. if (!column.text)
  18843. return;
  18844. head.push({ field: column.dataIndex, name: column.text });
  18845. if (column.dictForExcel) {
  18846. dict[column.dataIndex] = column.dictForExcel;
  18847. }
  18848. });
  18849. // 判断是否需要解密
  18850. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18851. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18852. me.dbInfo.password = hexToString(me.dbInfo.password);
  18853. me.dbInfo.username = hexToString(me.dbInfo.username);
  18854. }
  18855. scope.setLoading(true);
  18856. Ext.Ajax.request({
  18857. timeout: 15000,
  18858. url: window["EXPORT_DATA_HOST"],
  18859. method: "POST",
  18860. jsonData: {
  18861. file: excelFileName,
  18862. dbInfo: me.dbInfo,
  18863. exportDataSql: me.exportDataSql,
  18864. exportDataSqlParams: me.exportDataSqlParams,
  18865. head: head,
  18866. dict: dict,
  18867. },
  18868. }).then(function () {
  18869. scope.setLoading(false);
  18870. msg('请求成功');
  18871. }).catch(function () {
  18872. scope.setLoading(false);
  18873. showErrorDialog('请求失败,请确认是否已安装客户端');
  18874. });
  18875. },
  18876. makeExcelData: function (jsonData) {
  18877. var me = this;
  18878. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18879. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18880. return;
  18881. }
  18882. var data = [];
  18883. // 获取表格的列定义
  18884. var headerTextArr = [];
  18885. var headers = [];
  18886. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18887. var header = me.headerCt.getGridColumns()[i];
  18888. if (!header.isHidden()) {
  18889. var textStr = _$2.trim(header.text);
  18890. var dataIndexStr = _$2.trim(header.dataIndex);
  18891. if (dataIndexStr) {
  18892. if (textStr === '') {
  18893. headerTextArr.push(dataIndexStr);
  18894. }
  18895. else {
  18896. headerTextArr.push(textStr);
  18897. }
  18898. headers.push(header);
  18899. }
  18900. }
  18901. }
  18902. if (headers.length === 0) {
  18903. return;
  18904. }
  18905. data.push(headerTextArr);
  18906. for (var i = 0; i < jsonData.length; i++) {
  18907. var dataRow = jsonData[i];
  18908. var row = [];
  18909. for (var j = 0; j < headers.length; j++) {
  18910. var key = headers[j].dataIndex;
  18911. var value = dataRow[key];
  18912. if (!value && value !== 0) {
  18913. value = '';
  18914. }
  18915. var oValue = value;
  18916. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18917. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18918. try {
  18919. value = headers[j].renderer(value);
  18920. if (!value && value !== 0) {
  18921. value = oValue;
  18922. }
  18923. }
  18924. catch (e) {
  18925. value = oValue;
  18926. }
  18927. }
  18928. row.push(value);
  18929. }
  18930. data.push(row);
  18931. }
  18932. return data;
  18933. },
  18934. initComponent: function () {
  18935. var _this = this;
  18936. var _a;
  18937. var me = this;
  18938. var config = me.config;
  18939. var scope = lookupScope(this);
  18940. if (isDesignMode(scope, config)) {
  18941. this.superclass.initComponent.call(this);
  18942. return;
  18943. }
  18944. // 转换 dataSource 属性
  18945. convertDataSource$1(me, scope, config);
  18946. this.on({
  18947. afterrender: function (sender) {
  18948. var me = this;
  18949. var config = this.config;
  18950. var dataSource = config.dataSource;
  18951. if (config.autoLoad) {
  18952. if (config.dataSourceCallbackFn) {
  18953. me.reload();
  18954. }
  18955. else if (_$2.isPlainObject(dataSource)) {
  18956. me.reload();
  18957. }
  18958. }
  18959. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18960. var vm = this.lookupViewModel();
  18961. this.contextMenu = this.add(new Ext.menu.Menu({
  18962. viewModel: vm,
  18963. items: _$2.map(config.tbar, function (item) {
  18964. var menuItem = __assign({}, item);
  18965. if (menuItem.xtype === 'button') {
  18966. delete menuItem.xtype;
  18967. }
  18968. return menuItem;
  18969. })
  18970. }));
  18971. }
  18972. else if (_$2.isPlainObject(config.contextMenu)) {
  18973. this.contextMenu = this.add(config.contextMenu);
  18974. }
  18975. var $dom = $(sender.el.dom);
  18976. $dom.on('keydown', function (e) {
  18977. me.fireEvent('keydown', me, e);
  18978. }).on('keyup', function (e) {
  18979. me.fireEvent('keyup', me, e);
  18980. });
  18981. // 默认显示提示
  18982. if (this.cellTip) {
  18983. this.tip = Ext.create('Ext.tip.ToolTip', {
  18984. target: this.el,
  18985. delegate: '.x-grid-cell-inner',
  18986. trackMouse: true,
  18987. ancor: 'top',
  18988. style: 'background-color: #0D6EFD;',
  18989. listeners: {
  18990. beforeshow: function (tip) {
  18991. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18992. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18993. return false;
  18994. }
  18995. tip.update(tipText);
  18996. }
  18997. }
  18998. });
  18999. }
  19000. },
  19001. itemcontextmenu: function (view, rec, node, index, e) {
  19002. if (this.contextMenu) {
  19003. e.stopEvent();
  19004. this.contextMenu.show().setLocalXY(e.getXY());
  19005. return false;
  19006. }
  19007. },
  19008. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  19009. // this.setColumnConfigCache()
  19010. // },
  19011. // columnhide(sender, column, eOpts) {
  19012. // this.setColumnConfigCache()
  19013. // },
  19014. // columnshow(sender, column, eOpts) {
  19015. // this.setColumnConfigCache()
  19016. // },
  19017. // columnresize(sender, column, width, eOpts) {
  19018. // this.setColumnConfigCache()
  19019. // },
  19020. destory: function () {
  19021. },
  19022. selectionchange: function (sender, param) {
  19023. var record = undefined;
  19024. if (_$2.isArray(param)) {
  19025. record = param[0];
  19026. }
  19027. else if (_$2.isObject(param)) {
  19028. record = _$2.get(param, 'endCell.record');
  19029. }
  19030. itemselectFun(this, sender, record);
  19031. },
  19032. itemclick: function (sender, record) {
  19033. itemselectFun(this, sender, record);
  19034. },
  19035. show: function (sender) {
  19036. if (sender.__suspendReload) {
  19037. sender.__suspendReload = false;
  19038. sender.reload();
  19039. }
  19040. }
  19041. });
  19042. _$2.defer(function () {
  19043. var ce = _this.findPlugin('cellediting');
  19044. ce.on({
  19045. beforeedit: function (editor, context, eOpts) {
  19046. me.fireEvent('editbefore', me, editor, context, eOpts);
  19047. },
  19048. canceledit: function (editor, context, eOpts) {
  19049. me.fireEvent('editcancel', me, editor, context, eOpts);
  19050. },
  19051. edit: function (editor, context, eOpts) {
  19052. me.fireEvent('editfinish', me, editor, context, eOpts);
  19053. },
  19054. validateedit: function (editor, context, eOpts) {
  19055. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19056. },
  19057. });
  19058. });
  19059. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19060. var reference = me.reference;
  19061. var scope = lookupScope(me);
  19062. var theid = _$2.get(config, 'behavior.theid');
  19063. if (theid && reference) {
  19064. if (!record) {
  19065. scope.viewModel.set(reference + '.theid', null);
  19066. }
  19067. else {
  19068. scope.viewModel.set(reference + '.theid', record.get(theid));
  19069. }
  19070. }
  19071. var theid2 = _$2.get(config, 'behavior.theid2');
  19072. if (theid2 && reference) {
  19073. if (!record) {
  19074. scope.viewModel.set(reference + '.theid2', null);
  19075. }
  19076. else {
  19077. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19078. }
  19079. }
  19080. var theid3 = _$2.get(config, 'behavior.theid3');
  19081. if (theid3 && reference) {
  19082. if (!record) {
  19083. scope.viewModel.set(reference + '.theid3', null);
  19084. }
  19085. else {
  19086. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19087. }
  19088. }
  19089. me.fireEvent('itemselect', sender, record);
  19090. }, 50);
  19091. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19092. // 为 stores.proxy.buildRequest 做准备
  19093. this.store.proxy.$owner = this;
  19094. }
  19095. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19096. if (selectToReload) {
  19097. // 点击后触发某个目标表格刷新
  19098. this.on({
  19099. itemselect: function (sender) {
  19100. if (_$2.isArray(selectToReload)) {
  19101. _$2.forEach(selectToReload, function (ref) {
  19102. if (ref) {
  19103. var ctlTarget = scope.refs[ref];
  19104. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19105. if (ctlTarget.isVisible()) {
  19106. ctlTarget.reload();
  19107. }
  19108. else {
  19109. ctlTarget.__suspendReload = true;
  19110. }
  19111. }
  19112. }
  19113. });
  19114. }
  19115. else if (_$2.isString(selectToReload)) {
  19116. var ctlTarget = scope.refs[selectToReload];
  19117. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19118. ctlTarget.reload();
  19119. }
  19120. }
  19121. }
  19122. });
  19123. }
  19124. this.superclass.initComponent.call(this);
  19125. },
  19126. // 生成列自定义的缓存key
  19127. makeColumnConfigCacheKey: function (config) {
  19128. var _a, _b, _c, _d, _e, _f;
  19129. 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);
  19130. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19131. if (config.reference) {
  19132. key += config.reference;
  19133. }
  19134. else {
  19135. var subKey = "";
  19136. for (var i = 0; i < config.columns.length; i++) {
  19137. var column = config.columns[i];
  19138. if (column.dataIndex) {
  19139. subKey += column.dataIndex;
  19140. }
  19141. }
  19142. key += subKey;
  19143. }
  19144. return key;
  19145. },
  19146. getColumnConfigCache: function () {
  19147. var key = this.columnConfigCacheKey;
  19148. var dataStr = localStorage.getItem(key);
  19149. if (dataStr) {
  19150. return JSON.parse(dataStr);
  19151. }
  19152. return "";
  19153. },
  19154. setColumnConfigCache: function () {
  19155. var key = this.columnConfigCacheKey;
  19156. var cacheData = [];
  19157. var columns = this.headerCt.getGridColumns();
  19158. var index = 0;
  19159. for (var i = 0; i < columns.length; i++) {
  19160. var column = columns[i];
  19161. if (column.dataIndex) {
  19162. cacheData.push({
  19163. dataIndex: column.dataIndex,
  19164. width: column.width,
  19165. hidden: column.hidden,
  19166. locked: column.locked,
  19167. index: index
  19168. });
  19169. index++;
  19170. }
  19171. }
  19172. localStorage.setItem(key, JSON.stringify(cacheData));
  19173. },
  19174. autoSizeColumns: function (sender) {
  19175. var grid = sender ? sender.up('grid') : this;
  19176. // const columns = grid.columns;
  19177. // for (let i = 0; i < columns.length; i++) {
  19178. // const column = columns[i];
  19179. // grid.getView().autoSizeColumn(column);
  19180. // column.setWidth(column.getWidth() + 5);
  19181. // }
  19182. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19183. grid.headerCt.getGridColumns()[i].autoSize(i);
  19184. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19185. }
  19186. },
  19187. clearFilter: function (sender) {
  19188. var grid = sender.up('grid');
  19189. grid.filters.clearFilters();
  19190. grid.getStore().sorters.removeAll();
  19191. // grid.getStore().reload()
  19192. },
  19193. saveGridUIConfig: function (sender) {
  19194. var grid = sender.up('grid');
  19195. grid.setColumnConfigCache();
  19196. msg('保存设置成功!');
  19197. },
  19198. clearGridUIConfig: function (sender) {
  19199. var grid = sender.up('grid');
  19200. var key = grid.columnConfigCacheKey;
  19201. localStorage.setItem(key, "");
  19202. msg('清空设置成功,重新打开后生效!');
  19203. },
  19204. setLoading: function (value) {
  19205. if (value) {
  19206. this.mask('读取中');
  19207. }
  19208. else {
  19209. this.unmask();
  19210. }
  19211. },
  19212. exportExcel: function (sender) {
  19213. var rect = sender.btnEl.dom.getBoundingClientRect();
  19214. var scope = lookupScope(this);
  19215. var grid = sender.up('grid');
  19216. var menuItems = [];
  19217. if (grid.dataSource.method === 'invoke' || grid.dataSource.sqlId) {
  19218. menuItems.push({
  19219. text: '大批量导出 (需要客户端支持!)',
  19220. iconCls: 'x-fa fa-download',
  19221. listeners: {
  19222. click: function (sender, value) {
  19223. // @ts-ignore
  19224. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19225. .then(function (res) {
  19226. grid.exportBigExcelClick();
  19227. });
  19228. }
  19229. }
  19230. });
  19231. menuItems.push('-');
  19232. }
  19233. menuItems.push({
  19234. text: '导出当前数据',
  19235. iconCls: 'x-fa fa-download',
  19236. listeners: {
  19237. click: function (sender, value) {
  19238. grid.exportCurrentExcelClick();
  19239. }
  19240. }
  19241. }, {
  19242. xtype: "textfield",
  19243. fieldLabel: '当前导出页',
  19244. maskRe: /[0-9]/,
  19245. value: grid.exportExcelCurrentPage,
  19246. listeners: {
  19247. render: function (sender) {
  19248. grid.exportExcelCurrentPageCmp = sender;
  19249. },
  19250. change: function (sender, value) {
  19251. var v = parseInt(value);
  19252. if (isNaN(v) || v === 0) {
  19253. window['system'].msg("页码不能为0");
  19254. v = 1;
  19255. sender.setValue(v);
  19256. }
  19257. var size = parseInt(grid.exportExcelPageSize);
  19258. var total = parseInt(grid.exportExcelTotal);
  19259. if (v > total / size) {
  19260. v = parseInt(total / size + "");
  19261. }
  19262. grid.exportExcelCurrentPage = v + "";
  19263. }
  19264. }
  19265. }, {
  19266. xtype: "textfield",
  19267. fieldLabel: '导出页大小',
  19268. maskRe: /[0-9]/,
  19269. value: grid.exportExcelPageSize,
  19270. listeners: {
  19271. render: function (sender) {
  19272. grid.exportExcelPageSizeCmp = sender;
  19273. },
  19274. change: function (sender, value) {
  19275. var v = parseInt(value);
  19276. if (isNaN(v) || v === 0) {
  19277. window['system'].msg("导出页大小不能为0");
  19278. v = defaultGrid.exportExcelPageSize;
  19279. sender.setValue(v);
  19280. }
  19281. if (v > 10000) {
  19282. window['system'].msg("导出页大小不能大于10000");
  19283. v = 10000;
  19284. sender.setValue(v);
  19285. }
  19286. var page = parseInt(grid.exportExcelCurrentPage);
  19287. var total = parseInt(grid.exportExcelTotal);
  19288. if (page > total / v) {
  19289. page = parseInt(total / v + "") + 1;
  19290. grid.exportExcelCurrentPageCmp.setValue(page);
  19291. }
  19292. grid.exportExcelPageSize = v + "";
  19293. }
  19294. }
  19295. }, {
  19296. xtype: "textfield",
  19297. fieldLabel: '总条数',
  19298. value: grid.exportExcelTotal,
  19299. readOnly: true
  19300. }, {
  19301. text: '导出',
  19302. iconCls: 'x-fa fa-download',
  19303. listeners: {
  19304. click: function (sender, value) {
  19305. grid.exportExcelClick({
  19306. exportExcelPageSize: grid.exportExcelPageSize,
  19307. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19308. });
  19309. }
  19310. }
  19311. });
  19312. var treeMenu = new Ext.menu.Menu({
  19313. xtype: 'menu',
  19314. floated: false,
  19315. width: 300,
  19316. docked: 'left',
  19317. items: menuItems
  19318. });
  19319. treeMenu.showAt(rect.left, rect.top - 120);
  19320. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19321. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19322. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19323. // }
  19324. },
  19325. /**
  19326. * 获取表格编辑的行数据
  19327. */
  19328. getGridEditRows: function () {
  19329. var grid = this;
  19330. var store = grid.getStore();
  19331. var rows = [];
  19332. var modifyRows = [];
  19333. var newRows = [];
  19334. var err = "";
  19335. var records = store.getModifiedRecords();
  19336. var newRecords = store.getNewRecords();
  19337. var removeRecords = [];
  19338. _$2.forEach(store.getRemovedRecords(), function (row) {
  19339. removeRecords.push(row.data);
  19340. });
  19341. _$2.forEach(records, function (record) {
  19342. var colums = grid.columns;
  19343. var errFunc = undefined;
  19344. _$2.forEach(colums, function (col) {
  19345. var name = col.dataIndex;
  19346. var value = record.data[name];
  19347. var colIndex = col.getIndex(); //获得列号
  19348. var rowIndex = store.indexOfId(record.id); //获得行号
  19349. var editor = col.getEditor(); //使用的编辑器
  19350. var tmpErrFunc = function () {
  19351. var text = col.text || col.name;
  19352. msg(text + ' 校验失败, 请确保输入的数据正确');
  19353. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19354. };
  19355. if (editor && !editor.allowBlank && isEmpty(value)) {
  19356. errFunc = tmpErrFunc;
  19357. return false;
  19358. }
  19359. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19360. errFunc = tmpErrFunc;
  19361. return false;
  19362. }
  19363. });
  19364. if (typeof errFunc === 'function') {
  19365. err = "1";
  19366. _$2.remove(rows, function (n) {
  19367. return true;
  19368. });
  19369. //@ts-ignore
  19370. errFunc();
  19371. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19372. return false;
  19373. }
  19374. else {
  19375. if (_$2.findIndex(newRecords, function (item) {
  19376. return item === record;
  19377. }) >= 0) {
  19378. newRows.push(record.data);
  19379. }
  19380. else {
  19381. modifyRows.push(record.data);
  19382. }
  19383. rows.push(record.data);
  19384. }
  19385. });
  19386. return {
  19387. rows: rows,
  19388. newRows: newRows,
  19389. modifyRows: modifyRows,
  19390. removeRecords: removeRecords,
  19391. err: err
  19392. };
  19393. }
  19394. // reload() {
  19395. // dataSourceReload(this)
  19396. // },
  19397. });
  19398. }
  19399. /**
  19400. * 获取 columns 中所有的 dataIndex
  19401. */
  19402. function getFileds(newConfig) {
  19403. var fields = [];
  19404. _$2.forEach(newConfig.columns, function (c) {
  19405. if (c.dataIndex) {
  19406. fields.push(c.dataIndex);
  19407. }
  19408. });
  19409. return fields;
  19410. }
  19411. function convertDataSource$1(sender, scope, newConfig) {
  19412. if (typeof newConfig.store !== 'undefined') {
  19413. // 有 store 属性的情况下,不做任何事
  19414. return;
  19415. }
  19416. if (typeof newConfig.dataSource === 'undefined') {
  19417. // 没有定义 dataSource 的情况下,不做任何事
  19418. return;
  19419. }
  19420. if (_$2.isArray(newConfig.data)) {
  19421. // 有 data 属性赋值的情况下
  19422. newConfig.store = {
  19423. fields: getFileds(newConfig),
  19424. data: newConfig.data
  19425. };
  19426. delete newConfig.data;
  19427. return;
  19428. }
  19429. var dataSource = newConfig.dataSource;
  19430. if (typeof dataSource === 'string') {
  19431. // dataSource 是字符串的情况下,找到成员函数
  19432. dataSource = lookupFn(scope, dataSource);
  19433. }
  19434. if (typeof dataSource === 'function') {
  19435. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19436. newConfig.store = new Ext.data.Store({
  19437. fields: getFileds(newConfig),
  19438. // data: [],
  19439. autoLoad: true,
  19440. proxy: {
  19441. type: 'memory',
  19442. data: [],
  19443. }
  19444. });
  19445. newConfig.dataSourceCallbackFn = dataSource;
  19446. return;
  19447. }
  19448. // throw new TypeError('无法识别的调用方法')
  19449. }
  19450. //# sourceMappingURL=grid.js.map
  19451. function initTextfield () {
  19452. var cc = Ext.form.field.Text.prototype.constructor;
  19453. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19454. Ext.form.field.Text.override({
  19455. constructor: function (config) {
  19456. var newConfig = _$2.defaultsDeep({
  19457. // 强制属性
  19458. triggers: {
  19459. clear: {
  19460. weight: -1,
  19461. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19462. hidden: true,
  19463. handler: 'onClearClick',
  19464. },
  19465. }
  19466. }, baseConfig(config, 'col-item'), config, text);
  19467. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19468. newConfig.enableKeyEvents = true;
  19469. }
  19470. cc.call(this, newConfig);
  19471. },
  19472. /**
  19473. * 清空所有值
  19474. */
  19475. onClearClick: function (sender, e) {
  19476. var me = this;
  19477. me.setValue('');
  19478. },
  19479. /**
  19480. * 尝试获取下一个要获取焦点的控件
  19481. */
  19482. _raiseNextFocus: function (sender) {
  19483. var config = sender.config;
  19484. var scope = lookupScope(sender);
  19485. if (typeof config.nextFocus === 'function') {
  19486. config.nextFocus(sender);
  19487. }
  19488. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19489. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19490. var fn = lookupFn(scope, config.nextFocus);
  19491. if (typeof fn === 'function') {
  19492. var nextCtlReference = fn(sender);
  19493. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19494. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19495. if (ctl) {
  19496. if (typeof ctl.focus2 === 'function') {
  19497. ctl.focus2();
  19498. }
  19499. else {
  19500. ctl.focus();
  19501. }
  19502. }
  19503. }
  19504. }
  19505. }
  19506. else {
  19507. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19508. if (ctl) {
  19509. if (typeof ctl.focus2 === 'function') {
  19510. ctl.focus2();
  19511. }
  19512. else {
  19513. ctl.focus();
  19514. }
  19515. }
  19516. }
  19517. }
  19518. },
  19519. initComponent: function () {
  19520. /**
  19521. * 改变必填项之前加星号
  19522. */
  19523. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19524. // this.beforeLabelTextTpl = [
  19525. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19526. // ];
  19527. this.afterLabelTextTpl = [
  19528. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19529. ];
  19530. }
  19531. var me = this;
  19532. this.on({
  19533. change: function (sender, newVal) {
  19534. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19535. if (hideTrigger || disabled || readOnly || hideClear) {
  19536. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19537. return;
  19538. }
  19539. var value = newVal;
  19540. if (value) {
  19541. me.getTrigger('clear').show();
  19542. me.updateLayout();
  19543. }
  19544. else {
  19545. me.getTrigger('clear').hide();
  19546. me.updateLayout();
  19547. }
  19548. },
  19549. afterrender: function (sender) {
  19550. var _this = this;
  19551. var _a;
  19552. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19553. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19554. $$2(sender.inputEl.dom).on('click', function (e) {
  19555. sender.fireEvent('click', _this, e);
  19556. });
  19557. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19558. var _a, _b, _c, _d;
  19559. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19560. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19561. if (sender.isExpanded === true) {
  19562. // 弹开下拉框的基础上,不干预上下选择
  19563. return;
  19564. }
  19565. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19566. var grid = sender.ownerCt.up('grid');
  19567. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19568. if (editingPlugin) {
  19569. 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;
  19570. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19571. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19572. // editingPlugin
  19573. var targetRecord = void 0;
  19574. if (e.code === 'ArrowDown') {
  19575. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19576. }
  19577. else {
  19578. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19579. }
  19580. if (targetRecord) {
  19581. grid.setSelection([targetRecord]);
  19582. editingPlugin.startEdit(targetRecord, column);
  19583. }
  19584. e.stopPropagation();
  19585. e.preventDefault();
  19586. }
  19587. }
  19588. }
  19589. }
  19590. });
  19591. }
  19592. var config = sender.config;
  19593. if (config.ff && config.ff > 0) {
  19594. setTimeout(function () {
  19595. if (typeof sender.focus2 === 'function') {
  19596. sender.focus2();
  19597. }
  19598. else {
  19599. sender.focus();
  19600. }
  19601. }, config.ff);
  19602. }
  19603. }
  19604. });
  19605. var config = this.config;
  19606. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19607. this.on({
  19608. keyup: function (sender, e) {
  19609. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19610. sender._raiseNextFocus(sender);
  19611. }
  19612. }
  19613. });
  19614. }
  19615. var that = this;
  19616. this.on({
  19617. keyup: function (sender, e, eOpts) {
  19618. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19619. return;
  19620. }
  19621. that.keydown_fun_item(sender, e, eOpts);
  19622. }
  19623. });
  19624. initComponent.call(this);
  19625. },
  19626. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19627. var that = sender;
  19628. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19629. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19630. var value = _$2.trim(sender.rawValue);
  19631. var r = that.fireEvent('scancode', that, value, event);
  19632. if (r === 'OK') {
  19633. // 停止事件的默认处理程序,停止事件的冒泡
  19634. // event.stopEvent();
  19635. event.preventDefault();
  19636. event.stopPropagation();
  19637. }
  19638. }
  19639. }, 100)
  19640. });
  19641. }
  19642. //# sourceMappingURL=textfield.js.map
  19643. function initTbFill () {
  19644. /**
  19645. *
  19646. */
  19647. var ct = Ext.toolbar.Fill.prototype.constructor;
  19648. Ext.toolbar.Fill.override({
  19649. constructor: function (config) {
  19650. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19651. ct.call(this, newConfig);
  19652. }
  19653. });
  19654. }
  19655. //# sourceMappingURL=tbfill.js.map
  19656. function initTbSeparator () {
  19657. /**
  19658. *
  19659. */
  19660. var ct = Ext.toolbar.Separator.prototype.constructor;
  19661. Ext.toolbar.Separator.override({
  19662. constructor: function (config) {
  19663. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19664. ct.call(this, newConfig);
  19665. }
  19666. });
  19667. }
  19668. //# sourceMappingURL=tbseparator.js.map
  19669. function initToolbar () {
  19670. /**
  19671. *
  19672. */
  19673. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19674. Ext.toolbar.Toolbar.override({
  19675. constructor: function (config) {
  19676. var newConfig = _$2.defaultsDeep({
  19677. // 强制性属性
  19678. }, baseConfig(config, 'cols-container'), config, toolbar);
  19679. ct.call(this, newConfig);
  19680. }
  19681. });
  19682. initTbFill();
  19683. initTbSeparator();
  19684. }
  19685. //# sourceMappingURL=toolbar.js.map
  19686. function initSplitter () {
  19687. var ct = Ext.resizer.Splitter.prototype.constructor;
  19688. Ext.resizer.Splitter.override({
  19689. constructor: function (config) {
  19690. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19691. ct.call(this, newConfig);
  19692. }
  19693. });
  19694. }
  19695. //# sourceMappingURL=splitter.js.map
  19696. /**
  19697. * 通用 dataSource 解析,
  19698. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19699. */
  19700. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19701. var config = ctl.config;
  19702. return new Promise(function (resolve, reject) {
  19703. if (!config.dataSource) {
  19704. // 没有设置数据源,直接置空
  19705. return Promise.resolve();
  19706. }
  19707. var option = {
  19708. extraParam: extraParam,
  19709. _successCb: _successCb,
  19710. successCallback: function (value) {
  19711. if (typeof successCallback === "function") {
  19712. successCallback(value);
  19713. }
  19714. else {
  19715. ctl.setData(value);
  19716. }
  19717. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19718. ctl.setLoading(false);
  19719. resolve(value);
  19720. },
  19721. failCallback: function (error) {
  19722. if (typeof failCallback === "function") {
  19723. failCallback(error);
  19724. }
  19725. ctl.fireEvent('dataLoadComplete', ctl, false);
  19726. ctl.setLoading(false);
  19727. reject(error);
  19728. }
  19729. };
  19730. // 请求前要求确认一下
  19731. var isCanceled = false;
  19732. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19733. isCanceled = true;
  19734. } }, option));
  19735. if (!isCanceled) {
  19736. // 请求没有被取消
  19737. // 调用异步接口返回 Promise
  19738. return _innerReload(ctl, option);
  19739. }
  19740. return reject();
  19741. });
  19742. }
  19743. function _innerReload(ctl, option) {
  19744. var config = ctl.config;
  19745. ctl.setLoading(true);
  19746. var scope = lookupScope(ctl);
  19747. var dataSource = config.dataSource;
  19748. if (typeof dataSource == 'string') {
  19749. dataSource = lookupFn(scope, config.dataSource);
  19750. }
  19751. if (typeof dataSource === 'function') {
  19752. // @ts-ignore
  19753. dataSource.call(scope, ctl, option);
  19754. return;
  19755. }
  19756. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19757. if (!ajax.func) {
  19758. console.error("没有配置 ajax");
  19759. return;
  19760. }
  19761. var params_1 = {};
  19762. var sortModel = null;
  19763. var filterModel = null;
  19764. if (option.extraParam && option.extraParam.filterModel) {
  19765. filterModel = option.extraParam.filterModel;
  19766. }
  19767. if (option.extraParam && option.extraParam.sortModel) {
  19768. sortModel = option.extraParam.sortModel;
  19769. }
  19770. _$2.forOwn(option.extraParam, function (v, key) {
  19771. if (key != "filterModel" && key != "sortModel") {
  19772. if (typeof v === 'function') {
  19773. params_1[key] = v();
  19774. }
  19775. else {
  19776. params_1[key] = v;
  19777. }
  19778. }
  19779. });
  19780. var ds = dataSource;
  19781. _$2.forOwn(ds.params, function (v, key) {
  19782. if (typeof v === 'function') {
  19783. params_1[key] = v();
  19784. }
  19785. else {
  19786. params_1[key] = v;
  19787. }
  19788. });
  19789. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19790. // @ts-ignore
  19791. ajax.func({
  19792. method: dataSource.method,
  19793. url: ds.url,
  19794. data: params_1,
  19795. filterModel: filterModel,
  19796. sortModel: sortModel,
  19797. }).then(function (res) {
  19798. if (res.success) {
  19799. option.successCallback(res.data);
  19800. }
  19801. else {
  19802. option.failCallback(res.msg);
  19803. }
  19804. }).catch(function (e) {
  19805. option.failCallback(e);
  19806. });
  19807. }
  19808. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19809. var ds_1 = ctl.dataSource;
  19810. // @ts-ignore
  19811. Extend.ajax.func({
  19812. url: ds_1.sqlId,
  19813. data: params_1,
  19814. db: ds_1.db,
  19815. method: 'sql',
  19816. filterModel: filterModel,
  19817. sortModel: sortModel,
  19818. }).then(function (res) {
  19819. if (res.success) {
  19820. option.successCallback(res.data);
  19821. }
  19822. else {
  19823. option.failCallback(res.msg);
  19824. }
  19825. }).catch(function (e) {
  19826. option.failCallback(e);
  19827. }).finally(function () {
  19828. ctl.loading = false;
  19829. });
  19830. return;
  19831. }
  19832. else {
  19833. console.error("非法的 dataSource", ctl.dataSource);
  19834. debugger;
  19835. throw new Error("非法的 dataSource");
  19836. }
  19837. }
  19838. }
  19839. //# sourceMappingURL=DataSourceHelper.js.map
  19840. function initCombo () {
  19841. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19842. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19843. Ext.form.field.ComboBox.override({
  19844. constructor: function (config) {
  19845. var newConfig = _$2.defaultsDeep({
  19846. // 强制性属性
  19847. }, baseConfig(config, 'col-item'), config, combo);
  19848. if (typeof config.dict === 'string') {
  19849. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19850. }
  19851. else if (typeof newConfig.store == 'undefined') {
  19852. if (_$2.isArray(newConfig.data)) {
  19853. // ExtJS 无法直接接受数组模式
  19854. newConfig.store = {
  19855. fields: [newConfig.valueField, newConfig.displayField],
  19856. data: newConfig.data
  19857. };
  19858. delete newConfig.data;
  19859. }
  19860. else if (typeof newConfig.data !== 'object') {
  19861. newConfig.store = {
  19862. fields: [newConfig.valueField, newConfig.displayField],
  19863. data: []
  19864. };
  19865. delete newConfig.data;
  19866. }
  19867. }
  19868. cc.call(this, newConfig);
  19869. },
  19870. setDict: function (bizKey) {
  19871. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19872. this.dict = bizKey;
  19873. },
  19874. getDict: function () {
  19875. return this.dict;
  19876. },
  19877. setData: function (value) {
  19878. if (!value) {
  19879. return;
  19880. }
  19881. var config = value.config;
  19882. if (!this.store) {
  19883. this.store = new Ext.data.Store({
  19884. fields: [config.valueField, config.displayField],
  19885. data: value
  19886. });
  19887. }
  19888. else {
  19889. this.store.getProxy().setData(value);
  19890. this.store.load();
  19891. }
  19892. },
  19893. setLoading: function (value) {
  19894. if (value) {
  19895. if (!this.loadMask) {
  19896. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19897. }
  19898. }
  19899. else {
  19900. if (this.loadMask) {
  19901. this.loadMask.destroy();
  19902. delete this.loadMask;
  19903. }
  19904. }
  19905. },
  19906. reload: function () {
  19907. dataSourceReload(this);
  19908. },
  19909. initComponent: function () {
  19910. var that = this;
  19911. var toggle = function (e) {
  19912. var readOnly = that.readOnly, disabled = that.disabled;
  19913. if (readOnly || disabled) {
  19914. return;
  19915. }
  19916. if ($(e.target).is('.x-form-trigger')) {
  19917. return;
  19918. }
  19919. // 点击后下拉
  19920. if (that.isExpanded) {
  19921. that.collapse();
  19922. }
  19923. else {
  19924. that.expand();
  19925. that.doQuery(that.allQuery, true);
  19926. }
  19927. };
  19928. this.on({
  19929. afterrender: function (sender) {
  19930. var config = this.config;
  19931. if (config.dataSource && config.autoLoad) {
  19932. dataSourceReload(this);
  19933. }
  19934. // 点击后下拉
  19935. $(this.el.dom).on('click', toggle.bind(this));
  19936. },
  19937. focusenter: function (sender, event, opt) {
  19938. var _a;
  19939. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19940. // 表格内编辑框,获取焦点后自动弹开
  19941. toggle.call(this, event);
  19942. }
  19943. },
  19944. destory: function () {
  19945. $(this.el.dom).off('click', toggle.bind(this));
  19946. },
  19947. beforequery: function (context) {
  19948. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19949. // console.log('beforequery', query)
  19950. if (!forceAll && query) {
  19951. combo.store.clearFilter();
  19952. combo.store.filterBy(function (record, id) {
  19953. var text = record.get(combo.displayField);
  19954. // 用拼音筛选的方式
  19955. return keywordFilter(query, text, id);
  19956. });
  19957. combo.expand();
  19958. return false;
  19959. }
  19960. combo.store.clearFilter();
  19961. combo.expand();
  19962. return false;
  19963. },
  19964. });
  19965. initComponent.call(this);
  19966. },
  19967. focus2: function () {
  19968. this.focus();
  19969. var that = this;
  19970. _$2.defer(function () {
  19971. if (that.isExpanded) {
  19972. that.collapse();
  19973. }
  19974. else {
  19975. that.expand();
  19976. that.doQuery(that.allQuery, true);
  19977. }
  19978. });
  19979. }
  19980. });
  19981. }
  19982. //# sourceMappingURL=combo.js.map
  19983. /**
  19984. xtype: 'tagfield',
  19985. displayField: 'show',
  19986. valueField: 'id',
  19987. queryMode: 'local',
  19988. filterPickList: true,
  19989. store: {
  19990. fields: ['id', 'show'],
  19991. data: [
  19992. {id: 0, show: 'Battlestar Galactica'},
  19993. {id: 1, show: 'Doctor Who'},
  19994. {id: 2, show: 'Farscape'},
  19995. {id: 3, show: 'Firefly'},
  19996. {id: 4, show: 'Star Trek'},
  19997. {id: 5, show: 'Star Wars: Christmas Special'}
  19998. ]
  19999. }
  20000. */
  20001. function initTag () {
  20002. var cc = Ext.form.field.Tag.prototype.constructor;
  20003. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20004. Ext.form.field.Tag.override({
  20005. constructor: function (config) {
  20006. var newConfig = _$2.defaultsDeep({
  20007. // 强制性属性
  20008. }, baseConfig(config, 'col-item'), config, tagfield);
  20009. if (typeof config.dict === 'string') {
  20010. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20011. }
  20012. else if (typeof newConfig.store == 'undefined') {
  20013. if (_$2.isArray(newConfig.data)) {
  20014. // ExtJS 无法直接接受数组模式
  20015. newConfig.store = {
  20016. fields: [newConfig.valueField, newConfig.displayField],
  20017. data: newConfig.data
  20018. };
  20019. delete newConfig.data;
  20020. }
  20021. else if (typeof newConfig.data !== 'object') {
  20022. newConfig.store = {
  20023. fields: [newConfig.valueField, newConfig.displayField],
  20024. data: []
  20025. };
  20026. delete newConfig.data;
  20027. }
  20028. }
  20029. cc.call(this, newConfig);
  20030. },
  20031. setDict: function (bizKey) {
  20032. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20033. this.dict = bizKey;
  20034. },
  20035. getDict: function () {
  20036. return this.dict;
  20037. },
  20038. setData: function (value) {
  20039. if (!value) {
  20040. return;
  20041. }
  20042. var config = value.config;
  20043. if (!this.store) {
  20044. this.store = new Ext.data.Store({
  20045. fields: [config.valueField, config.displayField],
  20046. data: value
  20047. });
  20048. }
  20049. else {
  20050. this.store.getProxy().setData(value);
  20051. this.store.load();
  20052. }
  20053. },
  20054. setLoading: function (value) {
  20055. if (value) {
  20056. if (!this.loadMask) {
  20057. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20058. }
  20059. }
  20060. else {
  20061. if (this.loadMask) {
  20062. this.loadMask.destroy();
  20063. delete this.loadMask;
  20064. }
  20065. }
  20066. },
  20067. reload: function () {
  20068. dataSourceReload(this);
  20069. },
  20070. initComponent: function () {
  20071. var that = this;
  20072. var toggle = function (e) {
  20073. var readOnly = that.readOnly, disabled = that.disabled;
  20074. if (readOnly || disabled) {
  20075. return;
  20076. }
  20077. if ($(e.target).is('.x-form-trigger')) {
  20078. return;
  20079. }
  20080. // 点击后下拉
  20081. if (that.isExpanded) {
  20082. that.collapse();
  20083. }
  20084. else {
  20085. that.expand();
  20086. that.doQuery(that.allQuery, true);
  20087. }
  20088. };
  20089. this.on({
  20090. afterrender: function (sender) {
  20091. var config = this.config;
  20092. if (config.dataSource && config.autoLoad) {
  20093. dataSourceReload(this);
  20094. }
  20095. // 点击后下拉
  20096. $(this.el.dom).on('click', toggle.bind(this));
  20097. },
  20098. focusenter: function (sender, event, opt) {
  20099. var _a;
  20100. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20101. // 表格内编辑框,获取焦点后自动弹开
  20102. toggle.call(this, event);
  20103. }
  20104. },
  20105. destory: function () {
  20106. $(this.el.dom).off('click', toggle.bind(this));
  20107. },
  20108. });
  20109. initComponent.call(this);
  20110. },
  20111. focus2: function () {
  20112. this.focus();
  20113. var that = this;
  20114. _$2.defer(function () {
  20115. if (that.isExpanded) {
  20116. that.collapse();
  20117. }
  20118. else {
  20119. that.expand();
  20120. that.doQuery(that.allQuery, true);
  20121. }
  20122. });
  20123. }
  20124. });
  20125. }
  20126. //# sourceMappingURL=tagfield.js.map
  20127. function initComboGridMulti () {
  20128. Ext.define('Yvan.LocalComboGrid', {
  20129. extend: 'Ext.form.field.Picker',
  20130. // extend: 'Yvan.PickerAlignCenter',
  20131. xtype: 'combogridmulti',
  20132. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20133. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20134. editable: false,
  20135. initComponent: function () {
  20136. this.on({
  20137. afterrender: function () {
  20138. var config = this.config;
  20139. if (config.dataSource && config.autoLoad) {
  20140. dataSourceReload(this);
  20141. }
  20142. },
  20143. });
  20144. this.superclass.initComponent.apply(this, arguments);
  20145. },
  20146. setStore: function (store) {
  20147. this.store = store;
  20148. var me = this;
  20149. if (me.store) {
  20150. if (me.picker) {
  20151. me.picker.setStore(store);
  20152. if (me.isExpanded) {
  20153. me.collapse();
  20154. delete me.picker;
  20155. me.expand();
  20156. }
  20157. }
  20158. this.onLoad();
  20159. me.mon(me.store, {
  20160. scope: me,
  20161. load: me.onLoad,
  20162. update: me.onUpdate
  20163. });
  20164. }
  20165. },
  20166. reload: function () {
  20167. dataSourceReload(this);
  20168. },
  20169. setData: function (value) {
  20170. var me = this;
  20171. var config = me.config;
  20172. if (!value) {
  20173. return;
  20174. }
  20175. if (!this.store) {
  20176. this.store = new Ext.data.Store({
  20177. fields: [config.valueField, config.displayField],
  20178. data: value
  20179. });
  20180. }
  20181. else {
  20182. this.store.getProxy().setData(value);
  20183. this.store.load();
  20184. }
  20185. this.onLoad();
  20186. },
  20187. createPicker: function () {
  20188. var me = this;
  20189. 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: {
  20190. scope: me,
  20191. selectionchange: me.onSelectionChange,
  20192. itemkeydown: me.onPickerKeyDown
  20193. } })), view = picker.getView();
  20194. if (Ext.isIE9 && Ext.isStrict) {
  20195. view.on({
  20196. scope: me,
  20197. highlightitem: me.repaintPickerView,
  20198. unhighlightitem: me.repaintPickerView,
  20199. afteritemexpand: me.repaintPickerView,
  20200. afteritemcollapse: me.repaintPickerView
  20201. });
  20202. }
  20203. return picker;
  20204. },
  20205. repaintPickerView: function () {
  20206. var style = this.picker.getView().getEl().dom.style;
  20207. style.display = style.display;
  20208. },
  20209. onSelectionChange: function (view, record, node, rowIndex, e) {
  20210. this.selectItem(view, record);
  20211. },
  20212. onPickerKeyDown: function (treeView, record, item, index, e) {
  20213. var key = e.getKey();
  20214. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20215. this.selectItem(treeView, record);
  20216. }
  20217. },
  20218. selectItem: function (sender, record) {
  20219. var me = this;
  20220. var ids = [];
  20221. _$2.forEach(me.picker.getSelection(), function (record) {
  20222. ids.push(record.get(me.valueField));
  20223. });
  20224. me.fireEvent('select', me, record);
  20225. me.setValue(ids.join(me.splitChar));
  20226. // me.collapse();
  20227. },
  20228. onExpand: function () {
  20229. var me = this;
  20230. var picker = this.picker;
  20231. var value = this.value;
  20232. if (!me.store) {
  20233. msg('正在初始化数据,请稍后');
  20234. me.collapse();
  20235. return;
  20236. }
  20237. var vs = _$2.split(value, me.splitChar);
  20238. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20239. picker.setSelection(records);
  20240. },
  20241. setValue: function (value) {
  20242. var me = this;
  20243. console.log('setValue', value);
  20244. me.value = value;
  20245. if (!me.store || me.store.loading) {
  20246. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20247. return me.mixins.field.setValue.call(me, value);
  20248. // return me;
  20249. }
  20250. var vs = _$2.split(value, me.splitChar);
  20251. var displayValues = [];
  20252. _$2.forEach(vs, function (v) {
  20253. var _a;
  20254. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20255. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20256. if (dv) {
  20257. displayValues.push(dv);
  20258. }
  20259. else {
  20260. displayValues.push(v);
  20261. }
  20262. });
  20263. // set the raw value to the record's display field if a record was found
  20264. me.setRawValue(displayValues.join(me.splitChar));
  20265. return me.mixins.field.setValue.call(me, value);
  20266. },
  20267. getSubmitValue: function () {
  20268. return this.value;
  20269. },
  20270. getValue: function () {
  20271. return this.value;
  20272. },
  20273. onLoad: function () {
  20274. var value = this.value;
  20275. if (value) {
  20276. this.setValue(value);
  20277. }
  20278. },
  20279. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20280. var display = this.displayField;
  20281. var me = this;
  20282. if (type === 'edit' && modifiedFieldNames &&
  20283. Ext.Array.contains(modifiedFieldNames, display) &&
  20284. this.value === rec.getId()) {
  20285. me.mixins.field.setValue.call(me, this.value);
  20286. this.setRawValue(rec.get(display));
  20287. }
  20288. }
  20289. });
  20290. }
  20291. //# sourceMappingURL=combogridmulti.js.map
  20292. function initSearch () {
  20293. Ext.define('Yvan.Search', {
  20294. extend: 'Ext.form.field.Text',
  20295. alias: 'widget.searchfield',
  20296. xtype: 'searchfield',
  20297. constructor: function (config) {
  20298. var self = this;
  20299. var newConfig = _$2.defaultsDeep({
  20300. // 强制性属性
  20301. triggers: {
  20302. clear: {
  20303. weight: 0,
  20304. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20305. hidden: true,
  20306. handler: 'onClearClick',
  20307. },
  20308. search: {
  20309. weight: 1,
  20310. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20311. handler: 'onSearchClick'
  20312. },
  20313. },
  20314. listeners: {
  20315. blur: function (sender, e) {
  20316. this.revertOnblur();
  20317. },
  20318. specialkey: function (sender, e) {
  20319. var _a;
  20320. var me = this;
  20321. if (e.getKey() === e.ENTER) {
  20322. me.onSearchClick(sender, {}, e);
  20323. return;
  20324. }
  20325. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20326. },
  20327. afterrender: function (sender, e) {
  20328. var _a;
  20329. this.replaceRawInputEvent();
  20330. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20331. }
  20332. },
  20333. }, baseConfig(config, 'col-item'), config, search);
  20334. this.superclass.constructor.call(self, newConfig);
  20335. },
  20336. revertOnblur: function () {
  20337. this.setRawValue(this.lastValue);
  20338. },
  20339. onSearchClick: function (sender, vv, e) {
  20340. var me = this;
  20341. var config = me.config;
  20342. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20343. if (e) {
  20344. e.preventDefault();
  20345. e.stopPropagation();
  20346. }
  20347. this.fireEvent('search', sender, e);
  20348. if (!widget) {
  20349. return;
  20350. }
  20351. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20352. },
  20353. replaceRawInputEvent: function () {
  20354. var me = this;
  20355. var $dom = $(me.inputEl.dom);
  20356. $dom.on('input', function (e) {
  20357. stopEvent(e);
  20358. // console.log('has input', e)
  20359. });
  20360. $dom.on('keyup', function (e) {
  20361. if (e.key === "Enter") {
  20362. me.onSearchClick(me, {}, e);
  20363. return;
  20364. }
  20365. stopEvent(e);
  20366. });
  20367. $dom.on('change', function (e) {
  20368. stopEvent(e);
  20369. });
  20370. },
  20371. onChange: function (newVal, oldVal) {
  20372. var me = this;
  20373. var value = newVal;
  20374. if (value) {
  20375. me.getTrigger('clear').show();
  20376. me.updateLayout();
  20377. }
  20378. else {
  20379. me.getTrigger('clear').hide();
  20380. me.updateLayout();
  20381. }
  20382. },
  20383. /**
  20384. * 清空所有值
  20385. */
  20386. onClearClick: function (sender, e) {
  20387. var me = this;
  20388. var config = me.config;
  20389. var lookup = config.lookup;
  20390. me.setValue('');
  20391. clearViewModelByLookup(sender, lookup);
  20392. }
  20393. });
  20394. }
  20395. //# sourceMappingURL=search.js.map
  20396. function initMultipleSearch () {
  20397. Ext.define('Yvan.MultipleSearch', {
  20398. extend: 'Ext.form.field.Text',
  20399. xtype: 'multiplesearch',
  20400. bindTargert: '',
  20401. constructor: function (config) {
  20402. var _a, _b, _c, _d;
  20403. var self = this;
  20404. var newConfig = _$2.defaultsDeep({
  20405. // 强制性属性
  20406. triggers: {
  20407. clear: {
  20408. weight: 0,
  20409. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20410. hidden: true,
  20411. handler: 'onClearClick',
  20412. }
  20413. },
  20414. transformRawValue: function (o) {
  20415. return o;
  20416. },
  20417. listeners: {
  20418. specialkey: function (sender, e) {
  20419. var me = this;
  20420. if (e.getKey() === e.ENTER) {
  20421. me.fireEvent('search', me, e);
  20422. }
  20423. },
  20424. afterrender: function (sender, e) {
  20425. var _a;
  20426. this.replaceRawInputEvent();
  20427. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20428. }
  20429. },
  20430. }, baseConfig(config, 'col-item'), config, search);
  20431. this.superclass.constructor.call(self, newConfig);
  20432. 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 : '';
  20433. vv = _$2.replace(vv, "{", "");
  20434. vv = _$2.replace(vv, "}", "");
  20435. this.bindTargert = vv;
  20436. this.bindTargert = _$2.trim(this.bindTargert);
  20437. },
  20438. setBindValue: function (arrValue) {
  20439. if (this.bindTargert) {
  20440. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20441. }
  20442. },
  20443. replaceRawInputEvent: function () {
  20444. var me = this;
  20445. var $dom = $(me.inputEl.dom);
  20446. $dom.on('input', function (e) {
  20447. var _a, _b, _c, _d, _e, _f;
  20448. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20449. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20450. if (!a.endsWith(",") && a.length > 0) {
  20451. e.currentTarget.value = a + ",";
  20452. }
  20453. else {
  20454. e.currentTarget.value = a;
  20455. }
  20456. }
  20457. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20458. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20459. _$2.remove(arr, function (it) {
  20460. return !it;
  20461. });
  20462. me.setBindValue(arr);
  20463. stopEvent(e);
  20464. });
  20465. $dom.on('keyup', function (e) {
  20466. me.fireEvent('keyup', me, e);
  20467. // invokeMethod(me.config.listeners?.keyup, me, e)
  20468. stopEvent(e);
  20469. });
  20470. $dom.on('keydown', function (e) {
  20471. me.fireEvent('keydown', me, e);
  20472. // invokeMethod(me.config.listeners?.keydown, me, e)
  20473. //stopEvent(e)
  20474. });
  20475. $dom.on('change', function (e) {
  20476. stopEvent(e);
  20477. });
  20478. $dom.on('paste', function (e) {
  20479. var _a;
  20480. // @ts-ignore
  20481. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20482. var text = clipdata.getData("text/plain");
  20483. var spliter = ',';
  20484. text = text.replaceAll("\r", "");
  20485. text = text.replaceAll("\n", spliter);
  20486. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20487. var arr = text.split(spliter);
  20488. if (arr && Array.isArray(arr)) {
  20489. for (var i = 0; i < arr.length; i++) {
  20490. arr[i] = _$2.trim(arr[i]);
  20491. }
  20492. }
  20493. _$2.remove(arr, function (it) {
  20494. return !it;
  20495. });
  20496. me.setBindValue(arr);
  20497. stopEvent(e);
  20498. });
  20499. },
  20500. onChange: function (newVal, oldVal) {
  20501. var me = this;
  20502. var value = newVal;
  20503. if (value) {
  20504. me.getTrigger('clear').show();
  20505. me.updateLayout();
  20506. }
  20507. else {
  20508. me.getTrigger('clear').hide();
  20509. me.updateLayout();
  20510. }
  20511. },
  20512. /**
  20513. * 清空所有值
  20514. */
  20515. onClearClick: function (sender, e) {
  20516. var me = this;
  20517. var config = me.config;
  20518. var lookup = config.lookup;
  20519. me.setValue('');
  20520. clearViewModelByLookup(sender, lookup);
  20521. }
  20522. });
  20523. }
  20524. //# sourceMappingURL=multiplesearch.js.map
  20525. function initDate () {
  20526. var cc = Ext.form.field.Date.prototype.constructor;
  20527. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20528. Ext.form.field.Date.override({
  20529. format: 'Y-m-d',
  20530. altFormats: 'Y-m-d',
  20531. constructor: function (config) {
  20532. var newConfig = _$2.defaultsDeep({
  20533. // 强制属性
  20534. }, baseConfig(config, 'col-item'), config, date);
  20535. cc.call(this, newConfig);
  20536. },
  20537. getValue: function () {
  20538. var ov = getValue.call(this);
  20539. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20540. // console.log('cc:', nv, ov)
  20541. return nv;
  20542. },
  20543. // focus2() {
  20544. // const that = this
  20545. // if (that.isExpanded) {
  20546. // that.collapse()
  20547. //
  20548. // } else {
  20549. // that.expand();
  20550. // }
  20551. // _.defer(() => {
  20552. // that.focus()
  20553. // })
  20554. // },
  20555. initComponent: function () {
  20556. this.on({
  20557. afterrender: function () {
  20558. var config = this.config;
  20559. // 日期框,不要默认弹出
  20560. // $(this.el.dom).on('click', toggle.bind(this))
  20561. },
  20562. destory: function () {
  20563. // 日期框,不要默认弹出
  20564. // $(this.el.dom).off('click', toggle.bind(this))
  20565. },
  20566. change: {
  20567. fn: function (sender) {
  20568. if (sender.format === 'Y-m-d') {
  20569. // 年月日格式
  20570. var value = sender.getRawValue();
  20571. if (/^\d{8}$/.test(value)) {
  20572. // 8位数字,自动转换为 YYYY-MM-DD
  20573. var newValue = [
  20574. value.substr(0, 4),
  20575. value.substr(4, 2),
  20576. value.substr(6, 2)
  20577. ].join('-');
  20578. sender.setValue(newValue);
  20579. }
  20580. }
  20581. },
  20582. }
  20583. // focus: {
  20584. // // 获得焦点后自动下拉
  20585. // fn(sender) {
  20586. // sender.expand();
  20587. // this.doQuery(this.allQuery, true);
  20588. // },
  20589. // },
  20590. });
  20591. initComponent.call(this);
  20592. },
  20593. createInitialDate: function (value) {
  20594. var minValue = this.minValue, maxValue = this.maxValue;
  20595. value = value || syncDate(new Date());
  20596. if (minValue && minValue > value) {
  20597. value = minValue;
  20598. }
  20599. else if (maxValue && maxValue < value) {
  20600. value = maxValue;
  20601. }
  20602. return value;
  20603. },
  20604. });
  20605. }
  20606. //# sourceMappingURL=datefield.js.map
  20607. function initDateTimePicker () {
  20608. Ext.define('Yvan.DateTimePicker', {
  20609. extend: 'Ext.picker.Date',
  20610. alias: 'datetimepicker',
  20611. alternateClassName: 'Ext.DateTimePicker',
  20612. renderTpl: [
  20613. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20614. '<div class="{baseCls}-header">',
  20615. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20616. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20617. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20618. '</div>',
  20619. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20620. '<thead>',
  20621. '<tr role="row">',
  20622. '<tpl for="dayNames">',
  20623. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20624. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20625. '</th>',
  20626. '</tpl>',
  20627. '</tr>',
  20628. '</thead>',
  20629. '<tbody>',
  20630. '<tr role="row">',
  20631. '<tpl for="days">',
  20632. '{#:this.isEndOfWeek}',
  20633. '<td role="gridcell">',
  20634. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20635. '</td>',
  20636. '</tpl>',
  20637. '</tr>',
  20638. '</tbody>',
  20639. '</table>',
  20640. '<tpl if="showToday">',
  20641. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20642. '</tpl>',
  20643. // These elements are used with Assistive Technologies such as screen readers
  20644. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20645. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20646. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20647. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20648. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20649. '</div>',
  20650. {
  20651. firstInitial: function (value) {
  20652. return Ext.picker.Date.prototype.getDayInitial(value);
  20653. },
  20654. isEndOfWeek: function (value) {
  20655. // convert from 1 based index to 0 based
  20656. // by decrementing value once.
  20657. value--;
  20658. // eslint-disable-next-line vars-on-top
  20659. var end = value % 7 === 0 && value !== 0;
  20660. return end ? '</tr><tr role="row">' : '';
  20661. },
  20662. renderTodayBtn: function (values, out) {
  20663. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20664. },
  20665. renderMonthBtn: function (values, out) {
  20666. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20667. }
  20668. }
  20669. ],
  20670. beforeRender: function () {
  20671. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20672. this.superclass.beforeRender.call(this);
  20673. function handleInput(extHandle, $input) {
  20674. var $dom = $(extHandle.el.dom);
  20675. // const $up = $dom.find('.x-form-spinner-up')
  20676. // const $down = $dom.find('.x-form-spinner-down')
  20677. // debugger
  20678. // $up.on('mousedown', () => {
  20679. // debugger
  20680. // });
  20681. // $up.on('click', () => {
  20682. // debugger
  20683. // });
  20684. extHandle.on('click', function (sender) {
  20685. var hideBak = me.hide;
  20686. me.hide = Ext.emptyFn;
  20687. extHandle.focus();
  20688. me.hide = hideBak;
  20689. });
  20690. var changeValue = function (delta) {
  20691. if (_$2.trim(extHandle.getValue()) === '') {
  20692. extHandle.setValue(extHandle.minValue);
  20693. }
  20694. else {
  20695. var v = parseInt('' + extHandle.getValue());
  20696. if (v + delta > extHandle.maxValue) {
  20697. extHandle.setValue(extHandle.minValue);
  20698. }
  20699. else if (v + delta < extHandle.minValue) {
  20700. extHandle.setValue(extHandle.maxValue);
  20701. }
  20702. else {
  20703. extHandle.setValue(v + delta);
  20704. }
  20705. }
  20706. };
  20707. $input.on('mousewheel', function (e) {
  20708. e.stopPropagation();
  20709. var event = e.originalEvent;
  20710. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20711. // if (event.wheelDelta) {
  20712. // delta = event.wheelDelta / 120;
  20713. // } else if (event.detail) {
  20714. // delta = -event.detail / 3;
  20715. // }
  20716. var zoomSize = Math.ceil(eventDelta / 120);
  20717. changeValue(zoomSize);
  20718. // console.log('delta', delta)
  20719. // $input.focus()
  20720. });
  20721. }
  20722. me.input1 = Ext.create('Ext.form.field.Number', {
  20723. minValue: 0,
  20724. maxValue: 23,
  20725. flex: 1,
  20726. enableKeyEvents: true,
  20727. fieldLabel: '时',
  20728. labelWidth: 20,
  20729. hideLabel: true,
  20730. spinDownEnabled: false,
  20731. spinUpEnabled: false,
  20732. style: {
  20733. marginLeft: '5px',
  20734. },
  20735. listeners: {
  20736. afterrender: function (sender) {
  20737. var $input = $(sender.inputEl.dom);
  20738. handleInput(me.input1, $input);
  20739. },
  20740. change: function (sender, e) {
  20741. if (me.getValue()) {
  20742. me.value.setHours(sender.getValue());
  20743. }
  20744. },
  20745. }
  20746. });
  20747. me.input2 = Ext.create('Ext.form.field.Number', {
  20748. minValue: 0,
  20749. maxValue: 59,
  20750. flex: 1,
  20751. enableKeyEvents: true,
  20752. fieldLabel: ' ',
  20753. hideLabel: false,
  20754. labelWidth: 8,
  20755. spinDownEnabled: false,
  20756. spinUpEnabled: false,
  20757. listeners: {
  20758. afterrender: function (sender) {
  20759. var $input = $(sender.inputEl.dom);
  20760. handleInput(me.input2, $input);
  20761. },
  20762. change: function (sender, e) {
  20763. if (me.getValue()) {
  20764. me.value.setMinutes(sender.getValue());
  20765. }
  20766. },
  20767. }
  20768. });
  20769. me.input3 = Ext.create('Ext.form.field.Number', {
  20770. minValue: 0,
  20771. maxValue: 59,
  20772. flex: 1,
  20773. enableKeyEvents: true,
  20774. fieldLabel: ' ',
  20775. hideLabel: false,
  20776. labelWidth: 8,
  20777. spinDownEnabled: false,
  20778. spinUpEnabled: false,
  20779. style: {
  20780. marginRight: '5px',
  20781. },
  20782. listeners: {
  20783. afterrender: function (sender) {
  20784. var $input = $(sender.inputEl.dom);
  20785. handleInput(me.input3, $input);
  20786. },
  20787. change: function (sender, e) {
  20788. if (me.getValue()) {
  20789. me.value.setSeconds(sender.getValue());
  20790. }
  20791. },
  20792. }
  20793. });
  20794. me.confirmBtn = new Ext.button.Button({
  20795. text: '确认',
  20796. handler: me.confirmClick,
  20797. scope: me
  20798. });
  20799. me.tdBtn = new Ext.button.Button({
  20800. text: '现在',
  20801. handler: me.selectToday,
  20802. scope: me
  20803. });
  20804. me.todayBtn = Ext.create('Ext.container.Container', {
  20805. layout: 'anchor', border: false,
  20806. defaults: {
  20807. border: false, anchor: '100%',
  20808. margin: '0 0 5 0',
  20809. },
  20810. items: [
  20811. {
  20812. layout: 'hbox',
  20813. items: [
  20814. me.input1,
  20815. me.input2,
  20816. me.input3,
  20817. ]
  20818. },
  20819. {
  20820. layout: 'hbox',
  20821. items: [
  20822. me.confirmBtn,
  20823. me.tdBtn,
  20824. ]
  20825. }
  20826. ]
  20827. });
  20828. },
  20829. // finishRenderChildren() {
  20830. // var me = this;
  20831. //
  20832. // this.superclass.finishRenderChildren.call(this);
  20833. // //*
  20834. // me.input1.finishRender();
  20835. // me.input2.finishRender();
  20836. // me.input3.finishRender();
  20837. // //
  20838. // me.tdBtn.finishRender();
  20839. // me.confirmBtn.finishRender();
  20840. // },
  20841. setValue: function (value) {
  20842. //this.value = Ext.Date.clearTime(value, true);
  20843. this.value = value;
  20844. this.input1.setValue(this.value.getHours());
  20845. this.input2.setValue(this.value.getMinutes());
  20846. this.input3.setValue(this.value.getSeconds());
  20847. return this.update(this.value);
  20848. },
  20849. selectDate: function (value) {
  20850. if (this.showTime) {
  20851. value.setHours(this.input1.getValue());
  20852. value.setMinutes(this.input2.getValue());
  20853. value.setSeconds(this.input3.getValue());
  20854. }
  20855. this.value = value;
  20856. return this.update(this.value);
  20857. },
  20858. setDisabledStatus: function (disabled) {
  20859. var me = this;
  20860. debugger;
  20861. // me.callParent();
  20862. if (me.showTime) {
  20863. me.confirmBtn.setDisabled(disabled);
  20864. }
  20865. if (me.isShowFooter()) {
  20866. me.footerContainer.setDisabled(disabled);
  20867. }
  20868. },
  20869. handleDateClick: function (e, t) {
  20870. var me = this, handler = me.handler;
  20871. // e.stopEvent();
  20872. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20873. me.doCancelFocus = me.focusOnSelect === false;
  20874. me.selectDate(new Date(t.dateValue));
  20875. delete me.doCancelFocus;
  20876. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20877. if (me.showTime) {
  20878. return;
  20879. }
  20880. me.fireEvent('select', me, me.value);
  20881. if (handler) {
  20882. handler.call(me.scope || me, me, me.value);
  20883. }
  20884. me.onSelect();
  20885. }
  20886. },
  20887. selectToday: function () {
  20888. var me = this, btn = me.todayBtn, handler = me.handler;
  20889. if (btn && !btn.disabled) {
  20890. me.value = syncDate(new Date());
  20891. me.update(me.value);
  20892. me.fireEvent('select', me, me.value);
  20893. if (handler) {
  20894. handler.call(me.scope || me, me, me.value);
  20895. }
  20896. me.onSelect();
  20897. me.hide();
  20898. }
  20899. return me;
  20900. },
  20901. confirmClick: function () {
  20902. var me = this, btn = me.confirmBtn, handler = me.handler;
  20903. if (btn && !btn.disabled) {
  20904. me.fireEvent('select', me, me.value);
  20905. if (handler) {
  20906. handler.call(me.scope || me, me, me.value);
  20907. }
  20908. me.onSelect();
  20909. me.hide();
  20910. }
  20911. return me;
  20912. },
  20913. selectedUpdate: function (date) {
  20914. var me = this,
  20915. //t = date.getTime(),
  20916. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20917. cells.removeCls(cls);
  20918. for (c = 0; c < cLen; c++) {
  20919. cell = Ext.fly(cellItems[c]);
  20920. if (cell.dom.firstChild.dateValue == t) {
  20921. me.fireEvent('highlightitem', me, cell);
  20922. cell.addCls(cls);
  20923. if (me.isVisible() && !me.doCancelFocus) {
  20924. Ext.fly(cell.dom.firstChild).focus(50);
  20925. }
  20926. break;
  20927. }
  20928. }
  20929. },
  20930. // private, inherit docs
  20931. beforeDestroy: function () {
  20932. var me = this;
  20933. if (me.rendered) {
  20934. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20935. }
  20936. me.superclass.beforeDestroy.call(this);
  20937. }
  20938. });
  20939. }
  20940. //# sourceMappingURL=datetimepicker.js.map
  20941. function initDateTime () {
  20942. Ext.define('Yvan.DateTimeField', {
  20943. extend: 'Ext.form.field.Date',
  20944. xtype: 'datetimefield',
  20945. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20946. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20947. showTime: true,
  20948. format: "Y-m-d H:i:s",
  20949. constructor: function (config) {
  20950. var newConfig = _$2.defaultsDeep({
  20951. // 强制属性
  20952. }, baseConfig(config, 'col-item'), config, date);
  20953. this.superclass.constructor.call(this, newConfig);
  20954. },
  20955. initComponent: function () {
  20956. this.superclass.initComponent.call(this);
  20957. var setInitValue = function () {
  20958. var value = this.getRawValue();
  20959. if (!value) {
  20960. // 没填内容的时候,自动设置当前时间
  20961. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20962. }
  20963. };
  20964. this.on({
  20965. afterrender: function () {
  20966. var config = this.config;
  20967. // 日期框,不要默认弹出
  20968. $(this.el.dom).on('click', setInitValue.bind(this));
  20969. },
  20970. destory: function () {
  20971. // 日期框,不要默认弹出
  20972. $(this.el.dom).off('click', setInitValue.bind(this));
  20973. },
  20974. change: {
  20975. fn: function (sender) {
  20976. if (sender.format === "Y-m-d H:i:s") {
  20977. // 年月日格式
  20978. var value = sender.getRawValue();
  20979. if (/^\d{14}$/.test(value)) {
  20980. // 8位数字,自动转换为 YYYY-MM-DD
  20981. var newValue = [
  20982. value.substr(0, 4),
  20983. '-',
  20984. value.substr(4, 2),
  20985. '-',
  20986. value.substr(6, 2),
  20987. ' ',
  20988. value.substr(8, 2),
  20989. ':',
  20990. value.substr(10, 2),
  20991. ':',
  20992. value.substr(12, 2)
  20993. ].join('');
  20994. sender.setValue(newValue);
  20995. }
  20996. }
  20997. },
  20998. }
  20999. });
  21000. },
  21001. getValue: function () {
  21002. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  21003. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  21004. // console.log('cc:', nv, ov)
  21005. return nv;
  21006. },
  21007. onExpand: function () {
  21008. var strValue = this.getValue();
  21009. var value;
  21010. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21011. 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)));
  21012. }
  21013. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21014. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21015. }
  21016. else {
  21017. value = syncDate(new Date());
  21018. }
  21019. this.picker.setValue(value);
  21020. },
  21021. createPicker: function () {
  21022. var me = this, format = Ext.String.format;
  21023. //@ts-ignore
  21024. return new Yvan.DateTimePicker({
  21025. pickerField: me,
  21026. ownerCt: me.ownerCt,
  21027. renderTo: document.body,
  21028. floating: true,
  21029. hidden: true,
  21030. focusOnShow: true,
  21031. minDate: me.minValue,
  21032. maxDate: me.maxValue,
  21033. disabledDatesRE: me.disabledDatesRE,
  21034. disabledDatesText: me.disabledDatesText,
  21035. disabledDays: me.disabledDays,
  21036. disabledDaysText: me.disabledDaysText,
  21037. format: me.format,
  21038. showToday: me.showToday,
  21039. showTime: me.showTime,
  21040. startDay: me.startDay,
  21041. minText: format(me.minText, me.formatDate(me.minValue)),
  21042. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21043. listeners: {
  21044. scope: me,
  21045. select: me.onSelect
  21046. },
  21047. keyNavConfig: {
  21048. esc: function () {
  21049. me.collapse();
  21050. }
  21051. }
  21052. });
  21053. },
  21054. });
  21055. }
  21056. //# sourceMappingURL=datetimefield.js.map
  21057. function initNumber () {
  21058. var cc = Ext.form.field.Number.prototype.constructor;
  21059. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21060. Ext.form.field.Number.override({
  21061. constructor: function (config) {
  21062. var newConfig = _$2.defaultsDeep({
  21063. // 强制属性
  21064. }, baseConfig(config, 'col-item'), config, numberfield);
  21065. cc.call(this, newConfig);
  21066. },
  21067. initComponent: function () {
  21068. this.on({
  21069. afterrender: function (sender) {
  21070. var _this = this;
  21071. var _a;
  21072. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21073. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21074. $$2(sender.inputEl.dom).on('click', function (e) {
  21075. sender.fireEvent('click', _this, e);
  21076. });
  21077. }
  21078. }
  21079. });
  21080. initComponent.call(this);
  21081. },
  21082. });
  21083. }
  21084. //# sourceMappingURL=numberfield.js.map
  21085. function initCheckbox () {
  21086. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21087. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21088. Ext.form.field.Checkbox.override({
  21089. constructor: function (config) {
  21090. var newConfig = _$2.defaultsDeep({
  21091. // 强制属性
  21092. }, baseConfig(config, 'col-item'), config, checkbox);
  21093. cc.call(this, newConfig);
  21094. },
  21095. getValue: function () {
  21096. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21097. var ov = getValue.call(this);
  21098. // const ov = this.getRawValue()
  21099. return (ov ? checkedValue : uncheckedValue);
  21100. },
  21101. setValue: function (nv) {
  21102. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21103. var value;
  21104. if (nv === checkedValue) {
  21105. value = true;
  21106. }
  21107. else if (nv === uncheckedValue) {
  21108. value = false;
  21109. }
  21110. else {
  21111. value = !!nv;
  21112. }
  21113. // me.setRawValue(value)
  21114. // me.checked = value
  21115. // return me.mixins.field.setValue.call(me, value);
  21116. setValue.call(this, value);
  21117. },
  21118. updateCheckedCls: function (checked) {
  21119. var me = this;
  21120. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21121. checked = checked != null ? checked : me.getValue();
  21122. if (checked === uncheckedValue) {
  21123. checked = false;
  21124. }
  21125. else if (checked === checkedValue) {
  21126. checked = true;
  21127. }
  21128. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21129. },
  21130. initComponent: function () {
  21131. initComponent.call(this);
  21132. },
  21133. });
  21134. }
  21135. //# sourceMappingURL=checkbox.js.map
  21136. function initCheckboxGroup () {
  21137. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21138. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21139. Ext.form.CheckboxGroup.override({
  21140. constructor: function (config) {
  21141. var newConfig = _$2.defaultsDeep({
  21142. // 强制属性
  21143. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21144. cc.call(this, newConfig);
  21145. },
  21146. initComponent: function () {
  21147. initComponent.call(this);
  21148. },
  21149. });
  21150. }
  21151. //# sourceMappingURL=checkboxgroup.js.map
  21152. function initRadio () {
  21153. var cc = Ext.form.field.Radio.prototype.constructor;
  21154. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21155. Ext.form.field.Radio.override({
  21156. constructor: function (config) {
  21157. var newConfig = _$2.defaultsDeep({
  21158. // 强制属性
  21159. }, baseConfig(config, 'col-item'), config, radio);
  21160. cc.call(this, newConfig);
  21161. },
  21162. initComponent: function () {
  21163. initComponent.call(this);
  21164. },
  21165. });
  21166. }
  21167. //# sourceMappingURL=radio.js.map
  21168. function initRadioGroup () {
  21169. var cc = Ext.form.RadioGroup.prototype.constructor;
  21170. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21171. Ext.form.RadioGroup.override({
  21172. constructor: function (config) {
  21173. var newConfig = _$2.defaultsDeep({
  21174. // 强制属性
  21175. }, baseConfig(config, 'col-item'), config, radiogroup);
  21176. cc.call(this, newConfig);
  21177. },
  21178. initComponent: function () {
  21179. initComponent.call(this);
  21180. },
  21181. });
  21182. }
  21183. //# sourceMappingURL=radiogroup.js.map
  21184. function initFieldset () {
  21185. /**
  21186. *
  21187. */
  21188. var ct = Ext.form.FieldSet.prototype.constructor;
  21189. Ext.form.FieldSet.override({
  21190. constructor: function (config) {
  21191. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21192. ct.call(this, newConfig);
  21193. }
  21194. });
  21195. }
  21196. //# sourceMappingURL=fieldset.js.map
  21197. function initCombotree () {
  21198. Ext.define('Yvan.ComboTree', {
  21199. extend: 'Ext.form.field.Picker',
  21200. xtype: 'combotree',
  21201. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21202. config: {
  21203. store: null,
  21204. displayField: null,
  21205. columns: null,
  21206. selectOnTab: true,
  21207. maxPickerHeight: 300,
  21208. minPickerHeight: 100,
  21209. minPickerWidth: 350,
  21210. rootVisible: true,
  21211. },
  21212. editable: false,
  21213. setStore: function (store) {
  21214. this.store = store;
  21215. var me = this;
  21216. if (me.store) {
  21217. if (me.picker) {
  21218. me.picker.setStore(store);
  21219. if (me.isExpanded) {
  21220. me.collapse();
  21221. delete me.picker;
  21222. me.expand();
  21223. }
  21224. }
  21225. this.onLoad();
  21226. me.mon(me.store, {
  21227. scope: me,
  21228. load: me.onLoad,
  21229. update: me.onUpdate
  21230. });
  21231. }
  21232. },
  21233. createPicker: function () {
  21234. var me = this;
  21235. var picker = new Ext.tree.Panel({
  21236. border: false,
  21237. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21238. shrinkWrapDock: 2,
  21239. store: me.store,
  21240. floating: true,
  21241. rootVisible: me.rootVisible,
  21242. displayField: me.displayField,
  21243. columns: me.columns,
  21244. minHeight: me.minPickerHeight,
  21245. maxHeight: me.maxPickerHeight,
  21246. minWidth: me.minPickerWidth,
  21247. manageHeight: false,
  21248. shadow: false,
  21249. scrollable: true,
  21250. // modal: true,
  21251. // constrain: true,
  21252. // constrainTo: topScope._handle.el.dom,
  21253. // renderTo: topScope._handle.el.dom,
  21254. // alignTarget: topScope._handle,
  21255. listeners: {
  21256. scope: me,
  21257. itemclick: me.onItemClick,
  21258. itemkeydown: me.onPickerKeyDown
  21259. }
  21260. }), view = picker.getView();
  21261. if (Ext.isIE9 && Ext.isStrict) {
  21262. view.on({
  21263. scope: me,
  21264. highlightitem: me.repaintPickerView,
  21265. unhighlightitem: me.repaintPickerView,
  21266. afteritemexpand: me.repaintPickerView,
  21267. afteritemcollapse: me.repaintPickerView
  21268. });
  21269. }
  21270. return picker;
  21271. },
  21272. repaintPickerView: function () {
  21273. var style = this.picker.getView().getEl().dom.style;
  21274. style.display = style.display;
  21275. },
  21276. onItemClick: function (view, record, node, rowIndex, e) {
  21277. this.selectItem(view, record);
  21278. },
  21279. onPickerKeyDown: function (treeView, record, item, index, e) {
  21280. var key = e.getKey();
  21281. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21282. this.selectItem(treeView, record);
  21283. }
  21284. },
  21285. selectItem: function (sender, record) {
  21286. var me = this;
  21287. me.setValue(record.getId());
  21288. me.fireEvent('select', me, record);
  21289. me.collapse();
  21290. },
  21291. onExpand: function () {
  21292. var picker = this.picker;
  21293. var store = picker.store;
  21294. var value = this.value;
  21295. var node;
  21296. if (value) {
  21297. node = store.getNodeById(value);
  21298. }
  21299. if (!node) {
  21300. node = store.getRoot();
  21301. }
  21302. picker.ensureVisible(node, {
  21303. select: true,
  21304. focus: true
  21305. });
  21306. },
  21307. setValue: function (value) {
  21308. var me = this;
  21309. console.log('setValue', value);
  21310. me.value = value;
  21311. if (!me.store || me.store.loading) {
  21312. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21313. return me.mixins.field.setValue.call(me, value);
  21314. // return me;
  21315. }
  21316. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21317. if (value === undefined) {
  21318. record = me.store.getRoot();
  21319. console.log('setValue', record.getId());
  21320. me.value = record.getId();
  21321. return me.mixins.field.setValue.call(me, value);
  21322. }
  21323. else {
  21324. record = me.store.getNodeById(value);
  21325. }
  21326. // set the raw value to the record's display field if a record was found
  21327. me.setRawValue(record ? record.get(me.displayField) : '');
  21328. return me.mixins.field.setValue.call(me, value);
  21329. },
  21330. getSubmitValue: function () {
  21331. return this.value;
  21332. },
  21333. getValue: function () {
  21334. return this.value;
  21335. },
  21336. onLoad: function () {
  21337. var value = this.value;
  21338. if (value) {
  21339. this.setValue(value);
  21340. }
  21341. },
  21342. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21343. var display = this.displayField;
  21344. var me = this;
  21345. if (type === 'edit' && modifiedFieldNames &&
  21346. Ext.Array.contains(modifiedFieldNames, display) &&
  21347. this.value === rec.getId()) {
  21348. me.mixins.field.setValue.call(me, this.value);
  21349. this.setRawValue(rec.get(display));
  21350. }
  21351. }
  21352. });
  21353. }
  21354. //# sourceMappingURL=combotree.js.map
  21355. function initPickerPlus () {
  21356. Ext.define('Yvan.PickerAlignCenter', {
  21357. extend: 'Ext.form.field.Picker',
  21358. /**
  21359. * Performs the alignment on the picker using the class defaults
  21360. * @private
  21361. */
  21362. doAlign: function () {
  21363. // 不要挪动就好
  21364. },
  21365. });
  21366. }
  21367. //# sourceMappingURL=pickerplus.js.map
  21368. function initCombogrid () {
  21369. Ext.define('Yvan.ComboGrid', {
  21370. extend: 'Ext.form.field.Picker',
  21371. // extend: 'Yvan.PickerAlignCenter',
  21372. xtype: 'combogrid',
  21373. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21374. triggers: {
  21375. clear: {
  21376. weight: 0,
  21377. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21378. hidden: true,
  21379. handler: 'onClearClick',
  21380. },
  21381. },
  21382. config: __assign({}, comboGrid),
  21383. editable: true,
  21384. _superBlur: false,
  21385. allowCustomInput: false,
  21386. pressEnterPopup: true,
  21387. initComponent: function () {
  21388. var that = this;
  21389. var scope = lookupScope(that);
  21390. var config = that.config;
  21391. if (isDesignMode(scope, config)) {
  21392. this.superclass.initComponent.call(this, arguments);
  21393. return;
  21394. }
  21395. this.on({
  21396. blur: function (sender, e) {
  21397. if (this._superBlur) {
  21398. // 挂起时不恢复内容
  21399. return;
  21400. }
  21401. // 离开焦点时,恢复原来的值
  21402. sender.setRawValue(sender.value);
  21403. },
  21404. afterrender: function (sender) {
  21405. var $dom = $(sender.inputEl.dom);
  21406. that.scope = lookupScope(sender);
  21407. if (sender.column) {
  21408. // 列模式,拦截 keydown
  21409. $dom.on('keydown', function (e) {
  21410. if (isChartEvent(e) && !that.tryEnable()) {
  21411. // 没有达成 editEnable 条件,不用响应
  21412. stopEvent(e);
  21413. return;
  21414. }
  21415. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21416. stopEvent(e);
  21417. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21418. return;
  21419. }
  21420. });
  21421. }
  21422. else {
  21423. // 常规模式,拦截 keyup
  21424. $dom.on('keyup', function (e) {
  21425. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21426. return;
  21427. }
  21428. if (isChartEvent(e) && !that.tryEnable()) {
  21429. // 没有达成 editEnable 条件,不用响应
  21430. stopEvent(e);
  21431. return;
  21432. }
  21433. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21434. stopEvent(e);
  21435. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21436. return;
  21437. }
  21438. if (!that.allowCustomInput) {
  21439. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21440. stopEvent(e);
  21441. }
  21442. });
  21443. $dom.on('change', function (e) {
  21444. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21445. // if (that.isExpanded) {
  21446. // that.filterChange(that, e.target.value)
  21447. // }
  21448. stopEvent(e);
  21449. });
  21450. }
  21451. $dom.on('input', function (e) {
  21452. stopEvent(e);
  21453. });
  21454. },
  21455. });
  21456. this.superclass.initComponent.apply(this, arguments);
  21457. },
  21458. createPicker: function () {
  21459. var me = this;
  21460. var cfg = {
  21461. layout: 'fit',
  21462. border: 0,
  21463. // border: 5,
  21464. style: {
  21465. // borderColor: 'black',
  21466. // borderWidth: '5px',
  21467. // borderStyle: 'solid',
  21468. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21469. },
  21470. shadow: 'side',
  21471. shadowOffset: 100,
  21472. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21473. shrinkWrapDock: 2,
  21474. floating: true,
  21475. width: me.pickerWidth,
  21476. height: me.pickerHeight,
  21477. minWidth: me.pickerWidth,
  21478. minHeight: me.pickerHeight,
  21479. maxWidth: me.pickerWidth,
  21480. maxHeight: me.pickerHeight,
  21481. items: [
  21482. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21483. xtype: 'toolbar',
  21484. items: [
  21485. { xtype: 'textfield', fieldLabel: '筛选' },
  21486. {
  21487. xtype: 'button',
  21488. text: '查询',
  21489. iconCls: 'x-fa fa-search',
  21490. cssType: 'primary',
  21491. listeners: {
  21492. click: function () {
  21493. me.reloadGrid();
  21494. }
  21495. }
  21496. },
  21497. ]
  21498. }, autoLoad: false, listeners: {
  21499. afterrender: function (grid) {
  21500. me.grid = grid;
  21501. grid.focus();
  21502. grid.on({
  21503. rowdblclick: function (sender, row) {
  21504. me.selectItem(row);
  21505. },
  21506. dataLoadComplete: function (sender) {
  21507. _$2.defer(function () {
  21508. me.setFocus();
  21509. });
  21510. },
  21511. keydown: function (sender, e) {
  21512. if (me.column) {
  21513. // 列模式,拦截 keydown
  21514. me.processKey(e);
  21515. }
  21516. },
  21517. keyup: function (sender, e) {
  21518. if (!me.column) {
  21519. // 常规模式,拦截 keyup
  21520. me.processKey(e);
  21521. }
  21522. }
  21523. });
  21524. },
  21525. } })
  21526. ]
  21527. };
  21528. // @ts-ignore
  21529. var picker = new Ext.container.Container(cfg);
  21530. return picker;
  21531. },
  21532. setFocus: function () {
  21533. if (this.grid.store.getCount() > 0) {
  21534. this.grid.focusRow(0);
  21535. }
  21536. },
  21537. processKey: function (e) {
  21538. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21539. this.selectItem(this.grid.selection);
  21540. stopEvent(e);
  21541. }
  21542. else if (e.key === 'Escape') {
  21543. this.collapse();
  21544. }
  21545. },
  21546. repaintPickerView: function () {
  21547. var style = this.picker.getView().getEl().dom.style;
  21548. style.display = style.display;
  21549. },
  21550. onItemClick: function (view, record, node, rowIndex, e) {
  21551. this.selectItem(record);
  21552. },
  21553. onPickerKeyDown: function (treeView, record, item, index, e) {
  21554. var key = e.getKey();
  21555. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21556. this.selectItem(record);
  21557. }
  21558. },
  21559. filterChange: _$2.debounce(function (sender, value) {
  21560. sender.onExpand();
  21561. }, 1000),
  21562. selectItem: function (record) {
  21563. var me = this;
  21564. var lookup = this.lookup;
  21565. var scope = lookupScope(this);
  21566. me.fireEvent('select', me, record);
  21567. if (record.isModel) {
  21568. record = record.data;
  21569. }
  21570. tryWriteObject(lookup, record, function (path, value) {
  21571. me._lookupSet(path, value);
  21572. });
  21573. // lookup
  21574. // fromColumn: 'toTarget'
  21575. // fromColumn: 'toTarget'
  21576. // fromColumn: 'toTarget'
  21577. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21578. var value = _$2.get(record, fromColumn);
  21579. me._lookupSet(toTarget, value);
  21580. });
  21581. // 选定之后不能做清空
  21582. // const {lookupClearOnChange} = me
  21583. // if (_.isArray(lookupClearOnChange)) {
  21584. // _.each(lookupClearOnChange, item => {
  21585. // me._lookupSet(item, '')
  21586. // })
  21587. // }
  21588. me.collapse();
  21589. // 触发 _raiseNextFocus
  21590. me._raiseNextFocus(me);
  21591. },
  21592. onExpand: function () {
  21593. // 展开时,根据 lookup 带入查询参数
  21594. var expressData = this.getExpressData();
  21595. var txtField = this.grid.down('toolbar').down('textfield');
  21596. txtField.setValue(expressData.queryValue);
  21597. this.reloadGrid();
  21598. },
  21599. reloadGrid: function () {
  21600. // 展开时,根据 lookup 带入查询参数
  21601. var expressData = this.getExpressData();
  21602. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21603. var txtField = this.grid.down('toolbar').down('textfield');
  21604. // 每个 combogrid 默认带上 __queryValue 属性
  21605. reloadParam["__queryValue"] = txtField.getValue();
  21606. this.grid.reload(reloadParam);
  21607. },
  21608. onTriggerClick: function (sender) {
  21609. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21610. if (!grid) {
  21611. msg('正在初始化,请稍后');
  21612. return;
  21613. }
  21614. if (!this.tryEnable()) {
  21615. // 没有达成 editEnable 条件,不用弹出
  21616. return;
  21617. }
  21618. if (isExpanded || readOnly || disabled) {
  21619. // 已弹出、只读、禁用状态下,不允许弹出
  21620. return;
  21621. }
  21622. this._superBlur = true;
  21623. this.superclass.onTriggerClick.apply(this, arguments);
  21624. this._superBlur = false;
  21625. },
  21626. onCollapse: function () {
  21627. // 每次收回时,删除下拉组件
  21628. // delete this.picker
  21629. },
  21630. /**
  21631. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21632. */
  21633. setValue: function (value) {
  21634. var me = this;
  21635. // 设值用户看到的表面内容
  21636. this.setRawValue(value);
  21637. // 设值 setValue 调用链,正常触发 change 事件等
  21638. return me.mixins.field.setValue.call(me, value);
  21639. },
  21640. _lookupSet: function (path, value) {
  21641. var me = this;
  21642. path = tryVarSimple(path);
  21643. if (me.column) {
  21644. // 判断写入目标,是否与自己绑定的属性相等
  21645. if (path === 'queryValue' || me.column.dataIndex === path) {
  21646. me.setValue(value);
  21647. }
  21648. // 列模式下,写当前编辑行
  21649. var parentRecord = me._lookupEditorRecord();
  21650. if (parentRecord) {
  21651. // Ext.data.Record / Ext.data.Model
  21652. parentRecord.set(path, value);
  21653. }
  21654. else {
  21655. debugger;
  21656. }
  21657. }
  21658. else {
  21659. // 常规模式下,写 viewModel
  21660. me.scope.viewModel.set(path, value);
  21661. }
  21662. },
  21663. _lookupGrid: function () {
  21664. return this.column.up('grid');
  21665. },
  21666. _lookupEditorRecord: function () {
  21667. var _a, _b, _c, _d;
  21668. // parentGrid.getSelectionModel().getLastSelected()
  21669. var grid = this._lookupGrid();
  21670. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21671. if (!editingPlugin) {
  21672. return grid.getSelectionModel().getLastSelected();
  21673. }
  21674. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21675. if (_$2.isNumber(rowIdx)) {
  21676. return grid.store.getAt(rowIdx);
  21677. }
  21678. else {
  21679. return grid.getSelectionModel().getLastSelected();
  21680. }
  21681. },
  21682. onChange: function (newVal, oldVal) {
  21683. var me = this;
  21684. var value = newVal;
  21685. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21686. if (hideTrigger || disabled || readOnly || hideClear) {
  21687. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21688. return;
  21689. }
  21690. if (value) {
  21691. me.getTrigger('clear').show();
  21692. me.updateLayout();
  21693. }
  21694. else {
  21695. me.getTrigger('clear').hide();
  21696. me.updateLayout();
  21697. }
  21698. },
  21699. /**
  21700. * 得到能用于 express 表达式计算的上下文数据
  21701. */
  21702. getExpressData: function () {
  21703. var queryValue = this.getRawValue();
  21704. if (!queryValue) {
  21705. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21706. queryValue = this.getPicker().down('textfield').getRawValue();
  21707. }
  21708. if (this.column) {
  21709. // 列模式, 准备好判断 editEnable 表达式用的数据
  21710. var parentRecord = this._lookupEditorRecord();
  21711. if (!parentRecord) {
  21712. debugger;
  21713. }
  21714. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21715. }
  21716. else {
  21717. // 编辑模式,准备好判断用的数据
  21718. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21719. }
  21720. },
  21721. tryEnable: function () {
  21722. return tryEnable(this.getExpressData(), this.editEnable);
  21723. },
  21724. /**
  21725. * 清空所有值
  21726. */
  21727. onClearClick: function (sender, e) {
  21728. var me = this;
  21729. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21730. me.fireEvent('clear', sender, e);
  21731. me.setValue('');
  21732. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21733. me._lookupSet(toTarget, '');
  21734. });
  21735. _$2.each(lookupClearOnChange, function (item) {
  21736. me._lookupSet(item, '');
  21737. });
  21738. }
  21739. });
  21740. }
  21741. //# sourceMappingURL=combogrid.js.map
  21742. function initContainer () {
  21743. var cc = Ext.container.Container.prototype.constructor;
  21744. //const {initComponent} = Ext.container.Container.prototype
  21745. Ext.container.Container.override({
  21746. constructor: function (config) {
  21747. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21748. cc.call(this, newConfig);
  21749. },
  21750. });
  21751. }
  21752. //# sourceMappingURL=container.js.map
  21753. function initRows () {
  21754. Ext.define('Yvan.Rows', {
  21755. extend: 'Ext.container.Container',
  21756. xtype: 'rows',
  21757. constructor: function (config) {
  21758. var self = this;
  21759. var newConfig = _$2.defaultsDeep({
  21760. // 强制性属性
  21761. layout: 'anchor', border: false,
  21762. defaults: {
  21763. border: false, anchor: '100%',
  21764. margin: '0 0 5 0',
  21765. },
  21766. }, baseConfig(config, 'rows-container'), config, rows);
  21767. this.superclass.constructor.call(self, newConfig);
  21768. },
  21769. });
  21770. }
  21771. //# sourceMappingURL=rows.js.map
  21772. function initForm () {
  21773. var ct = Ext.form.Panel.prototype.constructor;
  21774. Ext.form.Panel.override({
  21775. constructor: function (config) {
  21776. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21777. ct.call(this, newConfig);
  21778. }
  21779. });
  21780. }
  21781. //# sourceMappingURL=form.js.map
  21782. function initCols () {
  21783. Ext.define('Yvan.Cols', {
  21784. extend: 'Ext.container.Container',
  21785. xtype: 'cols',
  21786. constructor: function (config) {
  21787. var self = this;
  21788. var newConfig = _$2.defaultsDeep({
  21789. // 强制性属性
  21790. layout: 'hbox',
  21791. minHeight: config.designMode ? 32 : 0
  21792. }, baseConfig(config, 'cols-container'), config, cols);
  21793. this.superclass.constructor.call(self, newConfig);
  21794. },
  21795. });
  21796. }
  21797. //# sourceMappingURL=cols.js.map
  21798. function initButton () {
  21799. /**
  21800. *
  21801. */
  21802. var ct = Ext.button.Button.prototype.constructor;
  21803. Ext.button.Button.override({
  21804. constructor: function (config) {
  21805. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21806. ct.call(this, newConfig);
  21807. },
  21808. setLoading: function (value) {
  21809. if (value) {
  21810. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21811. this._originIconCls = this.iconCls;
  21812. }
  21813. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21814. this.setDisabled(true);
  21815. }
  21816. else {
  21817. this.setIconCls(this._originIconCls);
  21818. this.setDisabled(false);
  21819. }
  21820. }
  21821. });
  21822. }
  21823. //# sourceMappingURL=button.js.map
  21824. function initIframe () {
  21825. Ext.define('Ext.ux.IFrame', {
  21826. extend: 'Ext.Component',
  21827. alias: 'widget.uxiframe',
  21828. loadMask: 'Loading...',
  21829. src: 'about:blank',
  21830. renderTpl: [
  21831. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21832. ],
  21833. childEls: ['iframeEl'],
  21834. initComponent: function () {
  21835. this.superclass.initComponent.call(this);
  21836. this.superclass.initEvents.call(this);
  21837. this.frameName = this.frameName || this.id + '-frame';
  21838. },
  21839. initEvents: function () {
  21840. var me = this;
  21841. this.superclass.initEvents.call(this);
  21842. me.iframeEl.on('load', me.onLoad, me);
  21843. },
  21844. initRenderData: function () {
  21845. return Ext.apply(this.superclass.initRenderData.call(this), {
  21846. src: this.src,
  21847. frameName: this.frameName
  21848. });
  21849. },
  21850. getBody: function () {
  21851. var doc = this.getDoc();
  21852. return doc.body || doc.documentElement;
  21853. },
  21854. getDoc: function () {
  21855. try {
  21856. return this.getWin().document;
  21857. }
  21858. catch (ex) {
  21859. return null;
  21860. }
  21861. },
  21862. getWin: function () {
  21863. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21864. return win;
  21865. },
  21866. getFrame: function () {
  21867. var me = this;
  21868. return me.iframeEl.dom;
  21869. },
  21870. onLoad: function () {
  21871. var me = this, doc = me.getDoc();
  21872. if (doc) {
  21873. this.el.unmask();
  21874. this.fireEvent('load', this);
  21875. }
  21876. else if (me.src) {
  21877. this.el.unmask();
  21878. this.fireEvent('error', this);
  21879. }
  21880. },
  21881. load: function (src) {
  21882. var me = this, text = me.loadMask, frame = me.getFrame();
  21883. if (me.fireEvent('beforeload', me, src) !== false) {
  21884. if (text && me.el) {
  21885. me.el.mask(text);
  21886. }
  21887. frame.src = me.src = (src || me.src);
  21888. }
  21889. }
  21890. });
  21891. }
  21892. //# sourceMappingURL=iframe.js.map
  21893. /**
  21894. * 属性:
  21895. * - autoLoad: true
  21896. * - dataSource: ''
  21897. * 方法:
  21898. * - handleZoomBig
  21899. * - handleZoomSmall
  21900. * - handleZoomReset
  21901. * - openDiagram
  21902. * - getBpmn
  21903. * - getBpmnCanvas
  21904. * - getBpmnOverlays
  21905. * - getBpmnZoomScroll
  21906. * 事件:
  21907. * - initFinish
  21908. * - failed
  21909. * - success
  21910. * - itemHover
  21911. * - itemOut
  21912. * - itemClick
  21913. * - itemDblclick
  21914. * - itemMousedown
  21915. * - itemMouseup
  21916. */
  21917. function initBpmn () {
  21918. Ext.define('Yvan.Bpmn', {
  21919. // extend: 'Ext.container.Container',
  21920. extend: 'Ext.panel.Panel',
  21921. alias: 'widget.bpmn',
  21922. xtype: 'bpmn',
  21923. constructor: function (config) {
  21924. var self = this;
  21925. var newConfig = _$2.defaultsDeep({
  21926. // 强制性属性
  21927. }, baseConfig(config, 'row-item'), config, bpmn);
  21928. if (!newConfig.hideToolbar) {
  21929. newConfig.tbar = [];
  21930. newConfig.tbar.push({
  21931. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21932. listeners: {
  21933. click: function (sender) {
  21934. self.reload();
  21935. }
  21936. }
  21937. });
  21938. newConfig.tbar.push({
  21939. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21940. listeners: {
  21941. click: function (sender) {
  21942. self.handleZoomBig();
  21943. }
  21944. },
  21945. });
  21946. newConfig.tbar.push({
  21947. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21948. listeners: {
  21949. click: function (sender) {
  21950. self.handleZoomSmall();
  21951. }
  21952. },
  21953. });
  21954. newConfig.tbar.push({
  21955. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21956. listeners: {
  21957. click: function (sender) {
  21958. self.handleZoomReset();
  21959. }
  21960. },
  21961. });
  21962. }
  21963. this.superclass.constructor.call(self, newConfig);
  21964. },
  21965. initComponent: function () {
  21966. var _this = this;
  21967. var me = this;
  21968. var config = me.config;
  21969. var scope = lookupScope(this);
  21970. if (!isDesignMode(scope, config)) {
  21971. //@ts-ignore
  21972. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21973. console.log('BpNavigated', me, BpNavigated);
  21974. var dom = me.el.dom;
  21975. var $dom = $(dom);
  21976. var $container = $dom.find('.x-autocontainer-innerCt');
  21977. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21978. _this._bpmn = bpmn;
  21979. if (_this.autoLoad) {
  21980. _this.reload();
  21981. }
  21982. _this.fireEvent('initFinish', _this);
  21983. var eventBus = bpmn.get('eventBus');
  21984. eventBus.on('element.hover', function (e) {
  21985. // this.fireEvent('itemHover', this, e);
  21986. });
  21987. eventBus.on('element.out', function (e) {
  21988. _this.fireEvent('itemOut', _this, e);
  21989. });
  21990. eventBus.on('element.click', function (e) {
  21991. _this.fireEvent('itemClick', _this, e);
  21992. });
  21993. eventBus.on('element.dblclick', function (e) {
  21994. _this.fireEvent('itemDblclick', _this, e);
  21995. });
  21996. eventBus.on('element.mousedown', function (e) {
  21997. _this.fireEvent('itemMousedown', _this, e);
  21998. });
  21999. eventBus.on('element.mouseup', function (e) {
  22000. _this.fireEvent('itemMouseup', _this, e);
  22001. });
  22002. });
  22003. }
  22004. this.superclass.initComponent.call(this);
  22005. this.on({
  22006. afterrender: function (sender) {
  22007. }
  22008. });
  22009. },
  22010. /**
  22011. * 重新载入
  22012. */
  22013. reload: function () {
  22014. var _this = this;
  22015. var _a;
  22016. if (typeof this.dataSource === 'string' && this.dataSource) {
  22017. var scope = lookupScope(this);
  22018. var fn = lookupFn(scope, this.dataSource);
  22019. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22020. _this.openDiagram(res.data);
  22021. });
  22022. }
  22023. },
  22024. /**
  22025. * 获取bpmn
  22026. */
  22027. getBpmn: function () {
  22028. return this._bpmn;
  22029. },
  22030. getBpmnCanvas: function () {
  22031. var _a;
  22032. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22033. },
  22034. getBpmnOverlays: function () {
  22035. var _a;
  22036. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22037. },
  22038. getBpmnZoomScroll: function () {
  22039. var _a;
  22040. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22041. },
  22042. handleZoomBig: function () {
  22043. var _a;
  22044. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22045. },
  22046. handleZoomSmall: function () {
  22047. var _a;
  22048. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22049. },
  22050. handleZoomReset: function () {
  22051. var _a;
  22052. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22053. },
  22054. openDiagram: function (diagram) {
  22055. var _this = this;
  22056. if (!this.getBpmn()) {
  22057. return;
  22058. }
  22059. this.getBpmn().importXML(diagram, function (err) {
  22060. if (err) {
  22061. // YvEventDispatch(this.onFailed, this, undefined);
  22062. _this.fireEvent('failed', _this, err);
  22063. return console.error('could not import BPMN 2.0 diagram', err);
  22064. }
  22065. // zoom to fit full viewport
  22066. _this.getBpmnCanvas().zoom('fit-viewport');
  22067. _this.fireEvent('success', _this);
  22068. });
  22069. },
  22070. });
  22071. }
  22072. //# sourceMappingURL=bpmn.js.map
  22073. function initSqlComplex () {
  22074. Ext.define('Yvan.SqlComplex', {
  22075. extend: 'Ext.panel.Panel',
  22076. xtype: 'sqlcomplex',
  22077. alias: 'widget.sqlcomplex',
  22078. getSqlExpress: function () {
  22079. },
  22080. constructor: function (config) {
  22081. var reference = config.reference;
  22082. var me = this;
  22083. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22084. {
  22085. region: 'west',
  22086. width: 280,
  22087. border: false,
  22088. split: true,
  22089. reference: reference + '_tree',
  22090. xtype: 'yvtree',
  22091. hideRefresh: true,
  22092. hideExpand: true,
  22093. hideCollapse: true,
  22094. listeners: {
  22095. itemdblclick: function (sender, record, item, index, e) {
  22096. var field = record.get('field');
  22097. var defaultValue = record.get('defaultValue');
  22098. if (!field) {
  22099. return;
  22100. }
  22101. var tabExpress = me.down('tabpanel');
  22102. var sqleditor = me.down('sqleditor');
  22103. var expressGrid = me.down('yvgrid');
  22104. if (tabExpress.getActiveTab().key !== 'grid') {
  22105. // SQL 模式
  22106. sqleditor.insertText(field + '=');
  22107. }
  22108. else {
  22109. // 表格模式
  22110. expressGrid.appendEditRow({
  22111. field: field,
  22112. operator: '=',
  22113. value: defaultValue,
  22114. remark: '',
  22115. });
  22116. _$2.defer(function () {
  22117. gridChanged(me, expressGrid);
  22118. });
  22119. }
  22120. }
  22121. },
  22122. },
  22123. {
  22124. region: 'center',
  22125. xtype: 'tabpanel',
  22126. reference: reference + '_tab',
  22127. tabPosition: 'bottom',
  22128. listeners: {
  22129. afterrender: function (sender) {
  22130. var scope = lookupScope(me);
  22131. var value = scope.viewModel.get(me.config.bindValue);
  22132. // sql 转换为 grid
  22133. try {
  22134. var list_1 = parseSqlToGrid(value);
  22135. _$2.defer(function () {
  22136. var grid = me.down('yvgrid');
  22137. grid.setData(list_1);
  22138. });
  22139. }
  22140. catch (e) {
  22141. console.error(e);
  22142. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22143. var tabSql = sender.down('sqleditor');
  22144. sender.setActiveTab(tabSql);
  22145. }
  22146. },
  22147. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22148. var scope = lookupScope(me);
  22149. var value = scope.viewModel.get(me.config.bindValue);
  22150. if (newCard.key === 'grid') {
  22151. // sql 转换为 grid
  22152. try {
  22153. var list_2 = parseSqlToGrid(value);
  22154. _$2.defer(function () {
  22155. var grid = me.down('yvgrid');
  22156. grid.setData(list_2);
  22157. });
  22158. return true;
  22159. }
  22160. catch (e) {
  22161. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22162. console.error(e);
  22163. return false;
  22164. }
  22165. }
  22166. else if (newCard.key === 'sql') {
  22167. // grid 转换为 sql
  22168. _$2.defer(function () {
  22169. var editor = me.down('sqleditor');
  22170. editor.setValue(value);
  22171. });
  22172. return true;
  22173. }
  22174. }
  22175. },
  22176. items: [
  22177. {
  22178. title: '表格模式',
  22179. key: 'grid',
  22180. xtype: 'yvgrid',
  22181. _mode: 'select',
  22182. reference: reference + '_grid',
  22183. hideFootbar: true,
  22184. pagination: false,
  22185. tbar: [
  22186. {
  22187. xtype: 'button',
  22188. text: '删除',
  22189. iconCls: 'x-fa fa-minus-circle',
  22190. cls: 'ext-btn-danger',
  22191. bind: {
  22192. disabled: '{!' + reference + '_grid.selection}',
  22193. },
  22194. listeners: {
  22195. click: function (sender) {
  22196. var grid = sender.up('yvgrid');
  22197. removeGridRow(grid);
  22198. gridChanged(me, grid);
  22199. }
  22200. },
  22201. },
  22202. ],
  22203. store: {},
  22204. listeners: {
  22205. editfinish: function (sender) {
  22206. gridChanged(me, sender);
  22207. },
  22208. },
  22209. columns: [
  22210. {
  22211. dataIndex: 'field',
  22212. header: '字段', sortable: false, menuDisabled: true,
  22213. width: 190,
  22214. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22215. var column = context.column;
  22216. var propertyConfig = me.config.propertyConfig;
  22217. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22218. var field = record.get('field');
  22219. if (field) {
  22220. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22221. if (idx >= 0) {
  22222. var meta = propertyConfig[idx];
  22223. return meta.text;
  22224. }
  22225. }
  22226. return value;
  22227. }
  22228. },
  22229. {
  22230. dataIndex: 'operator',
  22231. header: '运算符', sortable: false, menuDisabled: true,
  22232. dict: 'operator',
  22233. width: 65,
  22234. editor: { xtype: 'combo' },
  22235. },
  22236. {
  22237. dataIndex: 'value',
  22238. header: '值', sortable: false, menuDisabled: true,
  22239. flex: 1,
  22240. getEditor: function (record) {
  22241. var column = this;
  22242. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22243. var propertyConfig = me.config.propertyConfig;
  22244. var field = record.get('field');
  22245. if (!field) {
  22246. // 没有填 propertyName
  22247. return;
  22248. }
  22249. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22250. if (idx < 0) {
  22251. console.error('没有找到 field=' + field + ". propertyConfig");
  22252. return;
  22253. }
  22254. var meta = propertyConfig[idx];
  22255. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22256. return new Ext.grid.CellEditor({
  22257. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22258. });
  22259. }
  22260. return new Ext.grid.CellEditor({
  22261. field: __assign({ dict: meta.dict }, meta.editor)
  22262. });
  22263. },
  22264. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22265. var column = context.column;
  22266. var grid = _$2.get(view, 'ownerGrid');
  22267. var propertyConfig = me.config.propertyConfig;
  22268. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22269. var field = record.get('field');
  22270. if (field) {
  22271. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22272. if (idx >= 0) {
  22273. var meta = propertyConfig[idx];
  22274. var dictName = _$2.get(meta, 'dict');
  22275. if (dictName && window['DICT_CACHE'][dictName]) {
  22276. var dict_1 = window['DICT_CACHE'][dictName];
  22277. var valueText_1 = [];
  22278. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22279. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22280. if (idxKv >= 0) {
  22281. valueText_1.push(dict_1[idxKv].text);
  22282. }
  22283. else {
  22284. valueText_1.push(value);
  22285. }
  22286. });
  22287. return valueText_1.join(',');
  22288. }
  22289. }
  22290. }
  22291. return valueList;
  22292. },
  22293. },
  22294. ]
  22295. },
  22296. {
  22297. title: 'SQL模式',
  22298. key: 'sql',
  22299. xtype: 'sqleditor',
  22300. reference: reference + '_sql',
  22301. listeners: {
  22302. change: function (sender) {
  22303. var scope = lookupScope(me);
  22304. // 保存 editor 写入的值
  22305. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22306. }
  22307. }
  22308. },
  22309. ]
  22310. }
  22311. ] });
  22312. this.superclass.constructor.call(this, newConfig);
  22313. },
  22314. initComponent: function () {
  22315. // 货位条件树
  22316. var me = this;
  22317. me.superclass.initComponent.apply(this, arguments);
  22318. var tree = this.down('yvtree');
  22319. var config = me.config;
  22320. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22321. },
  22322. });
  22323. function gridChanged(me, grid) {
  22324. var data = grid.getDataRows();
  22325. var propertyConfig = me.config.propertyConfig;
  22326. var bindValue = me.config.bindValue;
  22327. var scope = lookupScope(me);
  22328. var sql = parseGridToSql(data);
  22329. scope.viewModel.set(bindValue, sql);
  22330. }
  22331. /**
  22332. * 用于从 propertyConfig 解析出树形结构
  22333. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22334. * ->
  22335. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22336. */
  22337. function buildConfigTree(propertyConfig) {
  22338. var root = {
  22339. expanded: true,
  22340. leaf: false,
  22341. children: []
  22342. };
  22343. var categoryObj = {};
  22344. var cfgList = propertyConfig;
  22345. _$2.forEach(cfgList, function (cfg) {
  22346. var cateNode = categoryObj[cfg.category];
  22347. if (!cateNode) {
  22348. cateNode = {
  22349. text: cfg.category, expanded: true, leaf: false,
  22350. children: []
  22351. };
  22352. categoryObj[cfg.category] = cateNode;
  22353. root.children.push(cateNode);
  22354. }
  22355. cateNode.children.push({
  22356. text: cfg.text,
  22357. field: cfg.field,
  22358. operator: cfg.operator,
  22359. defaultValue: cfg.defaultValue,
  22360. leaf: true,
  22361. });
  22362. });
  22363. return root;
  22364. }
  22365. /**
  22366. * 将表格变成 SQL where语句 [
  22367. * {field: 'f1', value: 1, operator: '='}
  22368. * {field: 'f2', value: 2, operator: '='}
  22369. * {field: 'f3', value: '3', operator: '>='}
  22370. * {field: 'f4', value: 4, operator: '='}
  22371. * ]
  22372. * ->
  22373. * f1=v1 and f2=v2
  22374. */
  22375. function parseGridToSql(list) {
  22376. var sqls = [];
  22377. _$2.forEach(list, function (i) {
  22378. var _a;
  22379. if (i.operator === 'in') {
  22380. sqls.push(i.field + ' in (' + (i.value) + ')');
  22381. }
  22382. else if (i.operator === 'notIn') {
  22383. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22384. }
  22385. else {
  22386. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22387. }
  22388. });
  22389. return sqls.join(' AND ');
  22390. }
  22391. /**
  22392. * 将 SQL 语句的 where 片段变成表格
  22393. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22394. * @return [
  22395. {field: 'f1', value: 1, operator: '='}
  22396. {field: 'f2', value: 2, operator: '='}
  22397. {field: 'f3', value: '3', operator: '>='}
  22398. {field: 'f4', value: 4, operator: '='}
  22399. ]
  22400. */
  22401. function parseSqlToGrid(sql) {
  22402. if (!sql || !_$2.trim(sql)) {
  22403. return [];
  22404. }
  22405. var parser = new window['NodeSQLParser'].Parser();
  22406. var ast = parser.astify('select * from dual where ' + sql);
  22407. var ret = [];
  22408. exp(ast.where, ret);
  22409. return ret;
  22410. }
  22411. function exp(ast, ret) {
  22412. if (ast.type === 'binary_expr') {
  22413. if (_$2.toUpper(ast.operator) === 'AND') {
  22414. if (ast.left.type === 'binary_expr') {
  22415. exp(ast.left, ret);
  22416. }
  22417. if (ast.right.type === 'binary_expr') {
  22418. exp(ast.right, ret);
  22419. }
  22420. }
  22421. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22422. if (ast.left.type === 'column_ref') {
  22423. if (ast.right.type === 'number' ||
  22424. ast.right.type === 'single_quote_string' ||
  22425. ast.right.type === 'double_quote_string') {
  22426. // 具体值相等
  22427. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22428. }
  22429. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22430. && ast.right.type === 'expr_list') {
  22431. // in / not in
  22432. var valueList_1 = [];
  22433. _$2.forEach(ast.right.value, function (item) {
  22434. valueList_1.push(item.value);
  22435. });
  22436. var operator = void 0;
  22437. if (_$2.toUpper(ast.operator) === 'IN') {
  22438. operator = 'in';
  22439. }
  22440. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22441. operator = 'notIn';
  22442. }
  22443. ret.push({
  22444. field: ast.left.column, value: valueList_1.join(','),
  22445. operator: operator
  22446. });
  22447. }
  22448. else {
  22449. throw new Error('ast.right must is value.');
  22450. }
  22451. }
  22452. else {
  22453. throw new Error('ast.left must is column_ref.');
  22454. }
  22455. }
  22456. else {
  22457. // 必须用 AND 条件符匹配
  22458. throw new Error('ast.operator must is "AND / =".');
  22459. }
  22460. }
  22461. else {
  22462. throw new Error('ast.type must is "binary_expr".');
  22463. }
  22464. }
  22465. /**
  22466. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22467. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22468. {
  22469. type: 'binary_expr',
  22470. operator: 'AND',
  22471. left: {
  22472. type: 'binary_expr',
  22473. operator: 'AND',
  22474. left: {
  22475. type: 'binary_expr',
  22476. operator: 'AND',
  22477. left: {
  22478. type: 'binary_expr',
  22479. operator: 'AND',
  22480. left: {
  22481. type: 'binary_expr',
  22482. operator: '=',
  22483. left: {
  22484. type: 'column_ref',
  22485. table: null,
  22486. column: 'f1'
  22487. },
  22488. right: {
  22489. type: 'number',
  22490. value: 1
  22491. }
  22492. },
  22493. right: {
  22494. type: 'binary_expr',
  22495. operator: '=',
  22496. left: {
  22497. type: 'column_ref',
  22498. table: null,
  22499. column: 'f2'
  22500. },
  22501. right: {
  22502. type: 'number',
  22503. value: 2
  22504. }
  22505. }
  22506. },
  22507. right: {
  22508. type: 'binary_expr',
  22509. operator: '=',
  22510. left: {
  22511. type: 'column_ref',
  22512. table: null,
  22513. column: 'f3'
  22514. },
  22515. right: {
  22516. type: 'single_quote_string',
  22517. value: '3'
  22518. }
  22519. }
  22520. },
  22521. right: {
  22522. type: 'binary_expr',
  22523. operator: '>=',
  22524. left: {
  22525. type: 'column_ref',
  22526. table: null,
  22527. column: 'f4'
  22528. },
  22529. right: {
  22530. type: 'number',
  22531. value: 4
  22532. }
  22533. }
  22534. },
  22535. right: {
  22536. type: 'binary_expr',
  22537. operator: '<',
  22538. left: {
  22539. type: 'column_ref',
  22540. table: null,
  22541. column: 'f4'
  22542. },
  22543. right: {
  22544. type: 'number',
  22545. value: 3
  22546. }
  22547. }
  22548. }
  22549. * */
  22550. }
  22551. //# sourceMappingURL=SqlComplex.js.map
  22552. function initParamComplex () {
  22553. Ext.define('Yvan.ParamComplex', {
  22554. extend: 'Ext.panel.Panel',
  22555. xtype: 'paramcomplex',
  22556. alias: 'widget.paramcomplex',
  22557. getSqlExpress: function () {
  22558. },
  22559. constructor: function (config) {
  22560. var reference = config.reference;
  22561. var me = this;
  22562. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22563. {
  22564. region: 'west',
  22565. width: 280,
  22566. border: false,
  22567. split: true,
  22568. reference: reference + '_tree',
  22569. xtype: 'yvtree',
  22570. hideRefresh: true,
  22571. hideExpand: true,
  22572. hideCollapse: true,
  22573. listeners: {
  22574. itemdblclick: function (sender, record, item, index, e) {
  22575. var field = record.get('field');
  22576. var defaultValue = record.get('defaultValue');
  22577. if (!field) {
  22578. return;
  22579. }
  22580. var tabExpress = me.down('tabpanel');
  22581. var sqleditor = me.down('sqleditor');
  22582. var expressGrid = me.down('yvgrid');
  22583. if (tabExpress.getActiveTab().key !== 'grid') {
  22584. // SQL 模式
  22585. sqleditor.insertText(field + '=');
  22586. }
  22587. else {
  22588. // 表格模式
  22589. expressGrid.appendEditRow({
  22590. field: field,
  22591. operator: '=',
  22592. value: defaultValue,
  22593. remark: '',
  22594. });
  22595. _$2.defer(function () {
  22596. gridChanged(me, expressGrid);
  22597. });
  22598. }
  22599. }
  22600. },
  22601. },
  22602. {
  22603. region: 'center',
  22604. xtype: 'tabpanel',
  22605. reference: reference + '_tab',
  22606. tabPosition: 'bottom',
  22607. listeners: {
  22608. afterrender: function (sender) {
  22609. var scope = lookupScope(me);
  22610. var value = scope.viewModel.get(me.config.bindValue);
  22611. // sql 转换为 grid
  22612. try {
  22613. var list_1 = parseParamToGrid(value);
  22614. _$2.defer(function () {
  22615. var grid = me.down('yvgrid');
  22616. grid.setData(list_1);
  22617. });
  22618. }
  22619. catch (e) {
  22620. console.error(e);
  22621. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22622. var tabSql = sender.down('sqleditor');
  22623. sender.setActiveTab(tabSql);
  22624. }
  22625. },
  22626. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22627. var scope = lookupScope(me);
  22628. var value = scope.viewModel.get(me.config.bindValue);
  22629. if (newCard.key === 'grid') {
  22630. // sql 转换为 grid
  22631. try {
  22632. var list_2 = parseParamToGrid(value);
  22633. _$2.defer(function () {
  22634. var grid = me.down('yvgrid');
  22635. grid.setData(list_2);
  22636. });
  22637. return true;
  22638. }
  22639. catch (e) {
  22640. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22641. console.error(e);
  22642. return false;
  22643. }
  22644. }
  22645. else if (newCard.key === 'sql') {
  22646. // grid 转换为 sql
  22647. _$2.defer(function () {
  22648. var editor = me.down('sqleditor');
  22649. editor.setValue(value);
  22650. });
  22651. return true;
  22652. }
  22653. }
  22654. },
  22655. items: [
  22656. {
  22657. title: '表格模式',
  22658. key: 'grid',
  22659. xtype: 'yvgrid',
  22660. _mode: 'select',
  22661. reference: reference + '_grid',
  22662. hideFootbar: true,
  22663. pagination: false,
  22664. tbar: [
  22665. {
  22666. xtype: 'button',
  22667. text: '删除',
  22668. iconCls: 'x-fa fa-minus-circle',
  22669. cls: 'ext-btn-danger',
  22670. bind: {
  22671. disabled: '{!' + reference + '_grid.selection}',
  22672. },
  22673. listeners: {
  22674. click: function (sender) {
  22675. var grid = sender.up('yvgrid');
  22676. removeGridRow(grid);
  22677. gridChanged(me, grid);
  22678. }
  22679. },
  22680. },
  22681. ],
  22682. store: {},
  22683. listeners: {
  22684. editfinish: function (sender) {
  22685. gridChanged(me, sender);
  22686. },
  22687. },
  22688. columns: [
  22689. {
  22690. dataIndex: 'field',
  22691. header: '字段', sortable: false, menuDisabled: true,
  22692. width: 190,
  22693. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22694. var column = context.column;
  22695. var propertyConfig = me.config.propertyConfig;
  22696. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22697. var field = record.get('field');
  22698. if (field) {
  22699. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22700. if (idx >= 0) {
  22701. var meta = propertyConfig[idx];
  22702. return meta.text;
  22703. }
  22704. }
  22705. return value;
  22706. }
  22707. },
  22708. {
  22709. dataIndex: 'value',
  22710. header: '值', sortable: false, menuDisabled: true,
  22711. flex: 1,
  22712. getEditor: function (record) {
  22713. var column = this;
  22714. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22715. var propertyConfig = me.config.propertyConfig;
  22716. var field = record.get('field');
  22717. if (!field) {
  22718. // 没有填 propertyName
  22719. return;
  22720. }
  22721. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22722. if (idx < 0) {
  22723. console.error('没有找到 field=' + field + ". propertyConfig");
  22724. return;
  22725. }
  22726. var meta = propertyConfig[idx];
  22727. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22728. return new Ext.grid.CellEditor({
  22729. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22730. });
  22731. }
  22732. return new Ext.grid.CellEditor({
  22733. field: __assign({ dict: meta.dict }, meta.editor)
  22734. });
  22735. },
  22736. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22737. var column = context.column;
  22738. var grid = _$2.get(view, 'ownerGrid');
  22739. var propertyConfig = me.config.propertyConfig;
  22740. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22741. var field = record.get('field');
  22742. if (field) {
  22743. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22744. if (idx >= 0) {
  22745. var meta = propertyConfig[idx];
  22746. var dictName = _$2.get(meta, 'dict');
  22747. if (dictName && window['DICT_CACHE'][dictName]) {
  22748. var dict_1 = window['DICT_CACHE'][dictName];
  22749. var valueText_1 = [];
  22750. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22751. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22752. if (idxKv >= 0) {
  22753. valueText_1.push(dict_1[idxKv].text);
  22754. }
  22755. else {
  22756. valueText_1.push(value);
  22757. }
  22758. });
  22759. return valueText_1.join(',');
  22760. }
  22761. }
  22762. }
  22763. return valueList;
  22764. },
  22765. },
  22766. ]
  22767. },
  22768. {
  22769. title: '文本模式',
  22770. key: 'sql',
  22771. xtype: 'sqleditor',
  22772. reference: reference + '_sql',
  22773. listeners: {
  22774. change: function (sender) {
  22775. var scope = lookupScope(me);
  22776. // 保存 editor 写入的值
  22777. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22778. }
  22779. }
  22780. },
  22781. ]
  22782. }
  22783. ] });
  22784. this.superclass.constructor.call(this, newConfig);
  22785. },
  22786. initComponent: function () {
  22787. // 货位条件树
  22788. var me = this;
  22789. me.superclass.initComponent.apply(this, arguments);
  22790. var tree = this.down('yvtree');
  22791. var config = me.config;
  22792. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22793. },
  22794. });
  22795. function gridChanged(me, grid) {
  22796. var data = grid.getDataRows();
  22797. var propertyConfig = me.config.propertyConfig;
  22798. var bindValue = me.config.bindValue;
  22799. var scope = lookupScope(me);
  22800. var sql = parseGridToParam(data);
  22801. scope.viewModel.set(bindValue, sql);
  22802. }
  22803. /**
  22804. * 用于从 propertyConfig 解析出树形结构
  22805. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22806. * ->
  22807. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22808. */
  22809. function buildConfigTree(propertyConfig) {
  22810. var root = {
  22811. expanded: true,
  22812. leaf: false,
  22813. children: []
  22814. };
  22815. var categoryObj = {};
  22816. var cfgList = propertyConfig;
  22817. _$2.forEach(cfgList, function (cfg) {
  22818. var cateNode = categoryObj[cfg.category];
  22819. if (!cateNode) {
  22820. cateNode = {
  22821. text: cfg.category, expanded: true, leaf: false,
  22822. children: []
  22823. };
  22824. categoryObj[cfg.category] = cateNode;
  22825. root.children.push(cateNode);
  22826. }
  22827. cateNode.children.push({
  22828. text: cfg.text,
  22829. field: cfg.field,
  22830. operator: cfg.operator,
  22831. defaultValue: cfg.defaultValue,
  22832. leaf: true,
  22833. });
  22834. });
  22835. return root;
  22836. }
  22837. /**
  22838. * 将表格变成参数语句 [
  22839. * {field: 'f1', value: 1}
  22840. * {field: 'f2', value: 2}
  22841. * {field: 'f3', value: '3'}
  22842. * {field: 'f4', value: 4}
  22843. * ]
  22844. * ->
  22845. * f1=v1, f2=v2
  22846. */
  22847. function parseGridToParam(list) {
  22848. var sqls = [];
  22849. _$2.forEach(list, function (i) {
  22850. sqls.push(i.field + '=' + (i.value));
  22851. });
  22852. return sqls.join('; ');
  22853. }
  22854. /**
  22855. * 将 分号分割的的参数设置 变成表格
  22856. * @param param a=1; b=2; c='3'
  22857. * @return [
  22858. {field: 'a', value: 1}
  22859. {field: 'b', value: 2}
  22860. {field: 'c', value: '3'}
  22861. ]
  22862. */
  22863. function parseParamToGrid(param) {
  22864. if (!param || !_$2.trim(param)) {
  22865. return [];
  22866. }
  22867. var ret = [];
  22868. var sp = _$2.split(param, ';');
  22869. _$2.forEach(sp, function (v) {
  22870. var vi = _$2.indexOf(v, '=');
  22871. var field = _$2.trim(v.substr(0, vi));
  22872. var value = eval(v.substr(vi + 1));
  22873. ret.push({ field: field, value: value });
  22874. });
  22875. return ret;
  22876. }
  22877. }
  22878. //# sourceMappingURL=ParamComplex.js.map
  22879. function initSqlEditor () {
  22880. Ext.define('com.yvan.studio.SqlEditor', {
  22881. extend: 'Ext.panel.Panel',
  22882. alias: 'widget.sqleditor',
  22883. xtype: 'sqleditor',
  22884. layout: 'fit',
  22885. border: false,
  22886. html: "<div class=\"editor\"/>",
  22887. config: {
  22888. value: ''
  22889. },
  22890. codeChange: undefined,
  22891. isChangeFromOuter: false,
  22892. setCode: function (value) {
  22893. var _this = this;
  22894. this.code = value;
  22895. this.value = value;
  22896. _$2.defer(function () {
  22897. _this.isChangeFromOuter = true;
  22898. if (_this.editor) {
  22899. _this.editor.setValue(value);
  22900. }
  22901. });
  22902. },
  22903. getCode: function () {
  22904. return this.getValue();
  22905. },
  22906. updateOptions: function (options) {
  22907. if (this.editor && options) {
  22908. this.editor.updateOptions(options);
  22909. }
  22910. },
  22911. getValue: function () {
  22912. if (!this.editor) {
  22913. return this.code;
  22914. }
  22915. return this.editor.getValue();
  22916. },
  22917. applyPosition: function () {
  22918. var _this = this;
  22919. if (this.autoFocusMethod) {
  22920. if (this.editor) {
  22921. _$2.defer(function () {
  22922. if (_this.autoFocusStartLine) {
  22923. _this.editor.setPosition({
  22924. lineNumber: _this.autoFocusStartLine,
  22925. column: _this.autoFocusStartColumn
  22926. });
  22927. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22928. }
  22929. _this.editor.focus();
  22930. });
  22931. delete this.autoFocusMethod;
  22932. }
  22933. }
  22934. this.editor.layout();
  22935. },
  22936. insertText: function (text) {
  22937. var editor = this.editor;
  22938. var position = editor.getPosition();
  22939. editor.executeEdits('', [
  22940. {
  22941. range: {
  22942. startLineNumber: position.lineNumber,
  22943. startColumn: position.column,
  22944. endLineNumber: position.lineNumber,
  22945. endColumn: position.column
  22946. },
  22947. text: text
  22948. }
  22949. ]);
  22950. },
  22951. setValue: function (value, fromEditor) {
  22952. this.setCode(value);
  22953. var me = this;
  22954. if (me.value === value) {
  22955. // 值相等,不需要变化
  22956. return;
  22957. }
  22958. if (fromEditor !== true && me.editor) {
  22959. // 不是来源于编辑器的变化,才设置编辑器的值
  22960. me.editor.setValue(value);
  22961. }
  22962. // 通知mixins setValue
  22963. me.value = value;
  22964. me.fireEvent('change', value);
  22965. },
  22966. initComponent: function () {
  22967. var that = this;
  22968. this.superclass.initComponent.call(this);
  22969. that.on({
  22970. resize: function () {
  22971. if (that.editor) {
  22972. that.editor.layout();
  22973. }
  22974. },
  22975. destory: function () {
  22976. if (that.editor) {
  22977. that.editor.dispose();
  22978. delete that.editor;
  22979. }
  22980. },
  22981. afterrender: function (sender) {
  22982. var $dom = $(that.el.dom).find('.editor');
  22983. attach_2($dom[0], {
  22984. value: that.code
  22985. }).then(function (editor) {
  22986. that.editor = editor;
  22987. that.applyPosition();
  22988. that.editor.onDidChangeModelContent(function (e) {
  22989. that.fireEvent('change', that.editor, e);
  22990. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22991. that.codeChange(that.editor.getValue(), that.name, e);
  22992. }
  22993. that.isChangeFromOuter = false;
  22994. });
  22995. });
  22996. }
  22997. });
  22998. }
  22999. });
  23000. function attach_2(element, opts) {
  23001. if (!window['monaco']) {
  23002. return;
  23003. }
  23004. var monaco = window['monaco'];
  23005. return new Promise(function (resolve) {
  23006. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  23007. enabled: false
  23008. } }));
  23009. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  23010. // const sql = editor.getValue()
  23011. // if (_.trim(sql).length > 0) {
  23012. // editor.setValue(format(sql, {
  23013. // indent: ' ',
  23014. // uppercase: true,
  23015. // }))
  23016. // }
  23017. // })
  23018. editor.onKeyUp(function (e) {
  23019. // console.log(e)
  23020. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23021. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23022. }
  23023. });
  23024. resolve(editor);
  23025. });
  23026. }
  23027. }
  23028. //# sourceMappingURL=SqlEditor.js.map
  23029. function initJsonEditor () {
  23030. Ext.define('com.yvan.studio.JsonEditor', {
  23031. extend: 'Ext.panel.Panel',
  23032. alias: 'widget.jsoneditor',
  23033. xtype: 'jsoneditor',
  23034. layout: 'fit',
  23035. border: false,
  23036. html: "<div class=\"editor\"/>",
  23037. autoFocusMethod: true,
  23038. autoFocusStartLine: 0,
  23039. autoFocusStartColumn: 0,
  23040. codeChange: undefined,
  23041. funcArr: [],
  23042. modulePage: null,
  23043. isChangeFromOuter: false,
  23044. name: "",
  23045. /**
  23046. * 设置代码
  23047. */
  23048. setCode: function (value) {
  23049. var _this = this;
  23050. this.code = value;
  23051. _$2.defer(function () {
  23052. _this.isChangeFromOuter = true;
  23053. if (_this.editor) {
  23054. _this.editor.setValue(value);
  23055. }
  23056. });
  23057. },
  23058. updateOptions: function (options) {
  23059. if (this.editor && options) {
  23060. this.editor.updateOptions(options);
  23061. }
  23062. },
  23063. setLanguage: function (lang) {
  23064. if (!window['monaco']) {
  23065. return;
  23066. }
  23067. var monaco = window['monaco'];
  23068. if (this.editor && lang) {
  23069. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23070. }
  23071. },
  23072. getCode: function () {
  23073. var _a;
  23074. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23075. },
  23076. applyPosition: function () {
  23077. var _this = this;
  23078. if (this.autoFocusMethod) {
  23079. if (this.editor) {
  23080. _$2.defer(function () {
  23081. if (_this.autoFocusStartLine) {
  23082. _this.editor.setPosition({
  23083. lineNumber: _this.autoFocusStartLine,
  23084. column: _this.autoFocusStartColumn
  23085. });
  23086. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23087. }
  23088. _this.editor.focus();
  23089. });
  23090. delete this.autoFocusMethod;
  23091. }
  23092. }
  23093. this.editor.layout();
  23094. },
  23095. initComponent: function () {
  23096. var that = this;
  23097. this.superclass.initComponent.apply(this, arguments);
  23098. this.on({
  23099. resize: function (sender, width, height) {
  23100. if (that.editor) {
  23101. that.editor.layout();
  23102. }
  23103. },
  23104. destory: function () {
  23105. if (that.editor) {
  23106. that.editor.dispose();
  23107. delete that.editor;
  23108. }
  23109. },
  23110. afterrender: function (sender) {
  23111. var $dom = $(that.el.dom).find('.editor');
  23112. attach_116($dom[0], {
  23113. value: that.code
  23114. }).then(function (editor) {
  23115. that.editor = editor;
  23116. that.applyPosition();
  23117. that.editor.onDidChangeModelContent(function (e) {
  23118. that.fireEvent('change', that.editor, e);
  23119. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23120. that.codeChange(that.editor.getValue(), that.name, e);
  23121. }
  23122. that.isChangeFromOuter = false;
  23123. });
  23124. });
  23125. }
  23126. });
  23127. },
  23128. });
  23129. function attach_116(element, opts) {
  23130. if (!window['monaco']) {
  23131. return;
  23132. }
  23133. var monaco = window['monaco'];
  23134. return new Promise(function (resolve) {
  23135. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23136. enabled: false
  23137. } }));
  23138. editor.onKeyUp(function (e) {
  23139. // console.log(e)
  23140. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23141. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23142. }
  23143. });
  23144. resolve(editor);
  23145. });
  23146. }
  23147. }
  23148. //# sourceMappingURL=JsonEditor.js.map
  23149. function initJsEditor () {
  23150. Ext.define('com.yvan.studio.JsEditor', {
  23151. extend: 'Ext.panel.Panel',
  23152. alias: 'widget.jseditor',
  23153. xtype: 'jseditor',
  23154. layout: 'fit',
  23155. border: false,
  23156. html: "<div class=\"editor\"/>",
  23157. autoFocusMethod: true,
  23158. autoFocusStartLine: 0,
  23159. autoFocusStartColumn: 0,
  23160. codeChange: undefined,
  23161. funcArr: [],
  23162. modulePage: null,
  23163. isChangeFromOuter: false,
  23164. name: "",
  23165. /**
  23166. * 设置代码
  23167. */
  23168. setCode: function (value) {
  23169. var _this = this;
  23170. this.code = value;
  23171. _$2.defer(function () {
  23172. _this.isChangeFromOuter = true;
  23173. if (_this.editor) {
  23174. _this.editor.setValue(value);
  23175. if (_this.name === "controllerEditor") {
  23176. _this.funcArr = _this.getAllFunction();
  23177. }
  23178. }
  23179. });
  23180. },
  23181. getCode: function () {
  23182. var _a;
  23183. if (!this.editor) {
  23184. return this.code;
  23185. }
  23186. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23187. },
  23188. applyPosition: function () {
  23189. var _this = this;
  23190. if (this.autoFocusMethod) {
  23191. if (this.editor) {
  23192. _$2.defer(function () {
  23193. if (_this.autoFocusStartLine) {
  23194. _this.editor.setPosition({
  23195. lineNumber: _this.autoFocusStartLine,
  23196. column: _this.autoFocusStartColumn
  23197. });
  23198. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23199. }
  23200. _this.editor.focus();
  23201. });
  23202. delete this.autoFocusMethod;
  23203. }
  23204. }
  23205. this.editor.layout();
  23206. },
  23207. initComponent: function () {
  23208. var that = this;
  23209. this.superclass.initComponent.apply(this, arguments);
  23210. this.on({
  23211. resize: function (sender, width, height) {
  23212. if (that.editor) {
  23213. that.editor.layout();
  23214. }
  23215. },
  23216. destory: function () {
  23217. if (that.editor) {
  23218. that.editor.dispose();
  23219. delete that.editor;
  23220. }
  23221. },
  23222. afterrender: function () {
  23223. var $dom = $(that.el.dom).find('.editor');
  23224. attach_1($dom[0], {
  23225. value: that.code
  23226. }).then(function (editor) {
  23227. that.editor = editor;
  23228. that.applyPosition();
  23229. that.editor.onDidChangeModelContent(function (e) {
  23230. that.fireEvent('change', that.editor, e);
  23231. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23232. that.codeChange(that.editor.getValue(), that.name, e);
  23233. }
  23234. that.isChangeFromOuter = false;
  23235. });
  23236. });
  23237. }
  23238. });
  23239. },
  23240. getAllFunction: function () {
  23241. var funcArr = [];
  23242. var ast = window['YvanUI'].recast.parse(this.code);
  23243. if (ast && ast.program && ast.program.body) {
  23244. if (Array.isArray(ast.program.body)) {
  23245. for (var i = 0; i < ast.program.body.length; i++) {
  23246. var m = ast.program.body[i];
  23247. if (m.type === "ExportDefaultDeclaration") {
  23248. if (m.declaration.type === "ClassDeclaration") {
  23249. if (m.declaration.body.type === "ClassBody") {
  23250. if (Array.isArray(m.declaration.body.body)) {
  23251. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23252. var ob = m.declaration.body.body[j];
  23253. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23254. var funcItem = { name: ob.key.name, args: [] };
  23255. if (Array.isArray(ob.value.params)) {
  23256. for (var k = 0; k < ob.value.params.length; k++) {
  23257. var p = ob.value.params[k];
  23258. funcItem.args.push(p.name);
  23259. }
  23260. }
  23261. funcArr.push(funcItem);
  23262. }
  23263. }
  23264. }
  23265. }
  23266. }
  23267. }
  23268. }
  23269. }
  23270. }
  23271. return funcArr;
  23272. }
  23273. });
  23274. var isInited = false;
  23275. function attach_1(element, opts) {
  23276. if (!window['monaco']) {
  23277. return;
  23278. }
  23279. var monaco = window['monaco'];
  23280. return new Promise(function (resolve) {
  23281. if (!isInited) {
  23282. isInited = true;
  23283. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23284. noSemanticValidation: true,
  23285. noSyntaxValidation: false
  23286. });
  23287. // compiler options
  23288. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23289. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23290. allowNonTsExtensions: true,
  23291. });
  23292. // extra libraries
  23293. var libSource = [
  23294. 'declare class Facts {',
  23295. ' /**',
  23296. ' * Returns the next fact',
  23297. ' */',
  23298. ' static next():string',
  23299. ' static next222():string',
  23300. '}',
  23301. "\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 ",
  23302. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23303. ].join('\n');
  23304. var libUri = 'file:///index.d.ts';
  23305. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23306. // When resolving definitions and references, the editor will try to use created models.
  23307. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23308. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23309. }
  23310. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23311. resolve(editor);
  23312. });
  23313. }
  23314. }
  23315. //# sourceMappingURL=JsEditor.js.map
  23316. function initClipboard () {
  23317. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23318. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23319. Ext.grid.plugin.Clipboard.override({
  23320. getCellData: function (format, erase) {
  23321. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23322. if (selection) {
  23323. selection.eachCell(function (cellContext) {
  23324. column = cellContext.column;
  23325. view = cellContext.column.getView();
  23326. record = cellContext.record;
  23327. // Do not copy the check column or row numberer column
  23328. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23329. return;
  23330. }
  23331. if (lastRecord !== record) {
  23332. lastRecord = record;
  23333. ret.push(row = []);
  23334. }
  23335. dataIndex = column.dataIndex;
  23336. // 记录原始数据
  23337. var rData = record.data[dataIndex];
  23338. if (isRaw) {
  23339. data = record.data[dataIndex];
  23340. }
  23341. else {
  23342. // Try to access the view node.
  23343. viewNode = view.all.item(cellContext.rowIdx);
  23344. // If we could not, it's because it's outside of the rendered block -
  23345. // recreate it.
  23346. if (!viewNode) {
  23347. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23348. }
  23349. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23350. data = cell.innerHTML;
  23351. if (isText) {
  23352. data = Ext.util.Format.stripTags(data);
  23353. }
  23354. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23355. data = data || rData;
  23356. }
  23357. row.push(data);
  23358. if (erase && dataIndex) {
  23359. record.set(dataIndex, null);
  23360. }
  23361. });
  23362. }
  23363. // See decode() comment below
  23364. return Ext.util.TSV.encode(ret, undefined, null);
  23365. },
  23366. getCells: function (format, erase) {
  23367. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23368. if (selection) {
  23369. selection.eachCell(function (cellContext) {
  23370. record = cellContext.record;
  23371. if (lastRecord !== record) {
  23372. lastRecord = record;
  23373. ret.push(row = {
  23374. model: record.self,
  23375. fields: []
  23376. });
  23377. }
  23378. dataIndex = cellContext.column.dataIndex;
  23379. row.fields.push({
  23380. name: dataIndex,
  23381. value: record.data[dataIndex]
  23382. });
  23383. if (erase && dataIndex) {
  23384. record.set(dataIndex, null);
  23385. }
  23386. });
  23387. }
  23388. return ret;
  23389. },
  23390. getTextData: function (format, erase) {
  23391. return this.getCellData(format, erase);
  23392. },
  23393. putCellData: function (data, format) {
  23394. var _a;
  23395. 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 = {};
  23396. // If the view is not focused, use the first cell of the selection as the destination.
  23397. if (!destination && selected) {
  23398. selected.eachCell(function (c) {
  23399. destination = c;
  23400. return false;
  23401. });
  23402. }
  23403. if (destination) {
  23404. // Create a new Context based upon the outermost View.
  23405. // NavigationModel works on local views.
  23406. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23407. // At that point, we can use navModel.getPosition()
  23408. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23409. }
  23410. else {
  23411. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23412. }
  23413. destinationStartColumn = destination.colIdx;
  23414. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23415. row = values[sourceRowIdx];
  23416. // Collect new values in dataObject
  23417. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23418. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23419. continue;
  23420. }
  23421. dataIndex = destination.column.dataIndex;
  23422. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23423. if (dataIndex) {
  23424. switch (format) {
  23425. // Raw field values
  23426. case 'raw':
  23427. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23428. break;
  23429. // Textual data with HTML tags stripped
  23430. case 'text':
  23431. {
  23432. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23433. // 获取字典原始的value
  23434. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23435. }
  23436. else {
  23437. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23438. }
  23439. break;
  23440. }
  23441. }
  23442. }
  23443. // If we are at the end of the destination row, break the column loop.
  23444. if (destination.colIdx === maxColIdx) {
  23445. break;
  23446. }
  23447. destination.setColumn(destination.colIdx + 1);
  23448. }
  23449. // Update the record in one go.
  23450. destination.record.set(dataObject);
  23451. // If we are at the end of the destination store, break the row loop.
  23452. if (destination.rowIdx === maxRowIdx) {
  23453. break;
  23454. }
  23455. // Jump to next row in destination
  23456. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23457. }
  23458. },
  23459. putTextData: function (data, format) {
  23460. var _a, _b, _c;
  23461. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23462. // 根据复制的行数自动添加新的行
  23463. 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;
  23464. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23465. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23466. this.cmp.getStore().add({});
  23467. }
  23468. }
  23469. this.putCellData(data, format);
  23470. },
  23471. });
  23472. }
  23473. //# sourceMappingURL=clipboard.js.map
  23474. function initDict () {
  23475. var DICT_CACHE = window['DICT_CACHE'];
  23476. if (!DICT_CACHE) {
  23477. DICT_CACHE = {};
  23478. window['DICT_CACHE'] = DICT_CACHE;
  23479. }
  23480. DICT_CACHE.XTYPE = [
  23481. { id: 'datefield', text: '日期' },
  23482. { id: 'datetimefield', text: '日期时间' },
  23483. { id: 'textfield', text: '文本' },
  23484. { id: 'numberfield', text: '数字' },
  23485. { id: 'combo', text: '下拉框' },
  23486. ];
  23487. DICT_CACHE.operator = [
  23488. { id: '=', text: '=' },
  23489. { id: '>', text: '>' },
  23490. { id: '<', text: '<' },
  23491. { id: '>=', text: '>=' },
  23492. { id: '<=', text: '<=' },
  23493. { id: 'in', text: 'in' },
  23494. { id: 'notIn', text: 'notIn' },
  23495. ];
  23496. DICT_CACHE.GRID_MODE = [
  23497. { id: 'edit1', text: '单机编辑模式' },
  23498. { id: 'edit2', text: '双击编辑模式' },
  23499. { id: 'checkbox', text: '勾选' },
  23500. { id: 'checkonly', text: '只勾选' },
  23501. { id: 'select', text: '行选择模式' },
  23502. ];
  23503. DICT_CACHE.BOTH_SELECT = [
  23504. { id: 'N/A', text: '<无>' },
  23505. { id: 'textfield', text: '文本' },
  23506. { id: 'numberfield', text: '数字框' },
  23507. { id: 'datefield', text: '日期' },
  23508. { id: 'datetimefield', text: '日期时间' },
  23509. { id: 'combo', text: '下拉框' },
  23510. { id: 'combogrid', text: '下拉表' },
  23511. { id: 'checkbox', text: '勾选' },
  23512. ];
  23513. DICT_CACHE.ROW_LAYOUT = [
  23514. { id: 'flex', text: '按权重摆放' },
  23515. { id: 'hbox', text: '按宽度摆放' },
  23516. ];
  23517. DICT_CACHE.GRID_XTYPE = [
  23518. { id: 'N/A', text: '<无>' },
  23519. { id: 'textfield', text: '文本-textfield' },
  23520. { id: 'numberfield', text: '数字框-numberfield' },
  23521. { id: 'datefield', text: '日期-datefield' },
  23522. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23523. { id: 'combo', text: '下拉框-combo' },
  23524. { id: 'combogrid', text: '下拉表-combogrid' },
  23525. { id: 'checkbox', text: '勾选-checkbox' },
  23526. ];
  23527. DICT_CACHE.FORM_XTYPE = [
  23528. { id: 'N/A', text: '<无>' },
  23529. { id: 'textfield', text: '文本-textfield' },
  23530. { id: 'numberfield', text: '数字框-numberfield' },
  23531. { id: 'datefield', text: '日期-datefield' },
  23532. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23533. { id: 'combo', text: '下拉框-combo' },
  23534. { id: 'combogrid', text: '下拉表-combogrid' },
  23535. { id: 'checkbox', text: '勾选-checkbox' },
  23536. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23537. ];
  23538. DICT_CACHE.GRID_FORMATTER = [
  23539. { id: 'N/A', text: '默认' },
  23540. { id: 'rownum', text: '序号-rownum' },
  23541. { id: 'button', text: '按钮-button' },
  23542. { id: 'checkbox', text: '勾选-checkbox' },
  23543. { id: 'progres', text: '进度条-progres' },
  23544. ];
  23545. }
  23546. //# sourceMappingURL=dict.js.map
  23547. function initDesigner () {
  23548. Ext.define('com.yvan.studio.designer', {
  23549. extend: 'Ext.panel.Panel',
  23550. alias: 'widget.designer',
  23551. xtype: 'designer',
  23552. layout: 'fit',
  23553. items: [],
  23554. constructor: function (config) {
  23555. var self = this;
  23556. var newConfig = _$2.defaultsDeep({
  23557. // 强制性属性
  23558. }, config);
  23559. this.superclass.constructor.call(self, newConfig);
  23560. },
  23561. initComponent: function () {
  23562. var me = this;
  23563. me.on({
  23564. afterrender: function () {
  23565. }
  23566. });
  23567. this.superclass.initComponent.call(me);
  23568. }
  23569. });
  23570. }
  23571. //# sourceMappingURL=designer.js.map
  23572. var FixClass = /** @class */ (function () {
  23573. function FixClass() {
  23574. }
  23575. FixClass.prototype.fix = function (me, config) {
  23576. var _this = this;
  23577. if (isDesignMode(me, config)) {
  23578. return;
  23579. }
  23580. if (!config) {
  23581. return;
  23582. }
  23583. var fix = config.fix;
  23584. if (!fix) {
  23585. return;
  23586. }
  23587. delete config.fix;
  23588. // 这里有个 bug
  23589. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23590. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23591. var scope;
  23592. if (config.$initParent) {
  23593. // 在面板上的组件
  23594. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23595. }
  23596. else if (config.column) {
  23597. // 在列上的组件
  23598. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23599. }
  23600. if (_$2.isArray(fix)) {
  23601. _$2.each(fix, function (f) {
  23602. var fn = lookupFn(scope, f);
  23603. fn.call(_this, me, config);
  23604. });
  23605. }
  23606. else if (_$2.isString(fix)) {
  23607. var fn = lookupFn(scope, fix);
  23608. fn.call(this, me, config);
  23609. }
  23610. };
  23611. __decorate([
  23612. baseConfigProcess(),
  23613. __metadata("design:type", Function),
  23614. __metadata("design:paramtypes", [Object, Object]),
  23615. __metadata("design:returntype", void 0)
  23616. ], FixClass.prototype, "fix", null);
  23617. return FixClass;
  23618. }());
  23619. //# sourceMappingURL=fix.js.map
  23620. function init$1() {
  23621. // 引入 filters 过滤插件
  23622. Ext.require([
  23623. 'Ext.grid.filters.Filters'
  23624. ]);
  23625. // 启用 tooltip 快捷提示
  23626. Ext.QuickTips.init();
  23627. // 定义日期格式化方法
  23628. if (Ext.util && Ext.util.Format) {
  23629. Ext.apply(Ext.util.Format, {
  23630. dateFormat: 'Y-m-d'
  23631. });
  23632. }
  23633. Ext.form.field.Display.override({
  23634. cls: 'yvan-display-field',
  23635. labelAlign: 'right'
  23636. });
  23637. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23638. override: "Ext.picker.Date",
  23639. format: "Y-m-d",
  23640. });
  23641. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23642. override: "Ext.form.field.Date",
  23643. format: "Y-m-d",
  23644. });
  23645. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23646. override: "Ext.grid.PropertyColumnModel",
  23647. format: "Y-m-d",
  23648. });
  23649. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23650. override: "Ext.view.AbstractView",
  23651. loadingText: "读取中..."
  23652. });
  23653. Ext.LoadMask.prototype.msg = '请稍后...';
  23654. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23655. override: "Ext.grid.header.Container",
  23656. sortClearText: '不排序',
  23657. sortAscText: "正序",
  23658. sortDescText: "倒序",
  23659. lockText: "锁定列",
  23660. unlockText: "解除锁定",
  23661. columnsText: "字段隐藏"
  23662. });
  23663. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23664. override: "Ext.grid.filters.filter.Date",
  23665. fields: {
  23666. lt: { text: '之前' },
  23667. gt: { text: '之后' },
  23668. eq: { text: '相等' },
  23669. },
  23670. // Defaults to Ext.Date.defaultFormat
  23671. dateFormat: null
  23672. });
  23673. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23674. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23675. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23676. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23677. override: "Ext.grid.locking.Lockable",
  23678. lockText: "锁定",
  23679. unlockText: '解锁',
  23680. });
  23681. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23682. override: "Ext.grid.filters.Filters",
  23683. menuFilterText: "过滤"
  23684. });
  23685. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23686. override: "Ext.grid.filters.filter.Boolean",
  23687. yesText: "已钩选",
  23688. noText: "未勾选"
  23689. });
  23690. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23691. override: "Ext.grid.filters.filter.String",
  23692. emptyText: "输入过滤文本..."
  23693. });
  23694. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23695. override: "Ext.grid.filters.filter.Number",
  23696. emptyText: "输入数字..."
  23697. });
  23698. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23699. override: "Ext.PagingToolbar",
  23700. beforePageText: "第",
  23701. // update
  23702. afterPageText: "/ {0} 页",
  23703. // update
  23704. firstText: "第一页",
  23705. prevText: "上一页",
  23706. // update
  23707. nextText: "下一页",
  23708. lastText: "最后页",
  23709. refreshText: "刷新",
  23710. displayMsg: "总共 {2} 条",
  23711. // update
  23712. emptyMsg: '没有数据'
  23713. });
  23714. /**
  23715. * 改变事件的获取方式.
  23716. * 具体见: ext-all-debug.js:23216 addListener
  23717. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23718. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23719. */
  23720. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23721. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23722. if (typeof fn === 'string' &&
  23723. (_$2.startsWith(fn, 'scope.') ||
  23724. _$2.startsWith(fn, 'system.') ||
  23725. _$2.startsWith(fn, 'format.'))) {
  23726. scope = lookupScope(this);
  23727. if (isDesignMode(scope, undefined)) {
  23728. fn = Ext.emptyFn;
  23729. }
  23730. else {
  23731. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23732. // const vm = this.lookupViewModel()
  23733. // if (vm && vm.yvanScope) {
  23734. // scope = vm.yvanScope
  23735. // fn = scope[fn.substr('scope.'.length)]
  23736. // }
  23737. fn = lookupFn(scope, fn, this);
  23738. }
  23739. }
  23740. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23741. };
  23742. // 将 SystemLib 扩展到 window.system 下
  23743. if (!window['system']) {
  23744. window['system'] = {};
  23745. }
  23746. _$2.extend(window['system'], SystemLib);
  23747. _$2.extend(window['system'], {
  23748. showGridRowDetail: showGridRowDetail
  23749. });
  23750. Ext.apply(Ext.util.Format, {
  23751. // 百分比
  23752. percentRenderer: function (v, rd, model) {
  23753. if (!v) {
  23754. v = 0;
  23755. }
  23756. if (typeof v === 'string') {
  23757. v = parseInt(v);
  23758. }
  23759. var valueString = v.toFixed(2);
  23760. var valueFixed = v > 100 ? 100 : v;
  23761. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23762. var cls = '';
  23763. if (v < 90) {
  23764. cls = 'danger';
  23765. }
  23766. else if (v < 100) {
  23767. cls = 'warning';
  23768. }
  23769. else {
  23770. cls = 'success';
  23771. }
  23772. return Ext.String
  23773. .format(
  23774. // '<div>'
  23775. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23776. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23777. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23778. // + '</div></div>', valueString, valueFixed, cls);
  23779. '<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(
  23780. // '<div>'
  23781. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23782. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23783. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23784. // + '</div></div>', v, valueFixed, valueString);
  23785. },
  23786. //button
  23787. button: function (v, rd, model) {
  23788. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23789. }
  23790. });
  23791. initComponent();
  23792. initPanel();
  23793. initGridColumn();
  23794. initTree();
  23795. initGrid();
  23796. initMainTab();
  23797. initTextfield();
  23798. initCombo();
  23799. initTag();
  23800. initContainer();
  23801. initRows();
  23802. initCols();
  23803. initForm();
  23804. initToolbar();
  23805. initSplitter();
  23806. initButton();
  23807. initStores();
  23808. initSearch();
  23809. initMultipleSearch();
  23810. initDate();
  23811. initDateTimePicker();
  23812. initDateTime();
  23813. initNumber();
  23814. initCheckbox();
  23815. initCheckboxGroup();
  23816. initRadio();
  23817. initRadioGroup();
  23818. initFieldset();
  23819. initCombotree();
  23820. initPickerPlus();
  23821. initCombogrid();
  23822. initComboGridMulti();
  23823. initIframe();
  23824. initBpmn();
  23825. initSqlEditor();
  23826. initJsonEditor();
  23827. initJsEditor();
  23828. initClipboard();
  23829. initSqlComplex();
  23830. initParamComplex();
  23831. initDict();
  23832. initDesigner();
  23833. }
  23834. //# sourceMappingURL=init.js.map
  23835. /**
  23836. * 创建一个 Ajax 客户端
  23837. */
  23838. function createAjax(createOption) {
  23839. if (createOption.baseUrl) {
  23840. axios__default.defaults.baseURL = createOption.baseUrl;
  23841. axios__default.defaults.timeout = createOption.timeout;
  23842. storeAjax.timeout = createOption.timeout;
  23843. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23844. }
  23845. return function (option) {
  23846. //@ts-ignore
  23847. option.method = (option.method || 'get').toLocaleLowerCase();
  23848. //@ts-ignore
  23849. var ax = __assign({}, option);
  23850. switch (option.method) {
  23851. case 'get':
  23852. ax.method = 'GET';
  23853. ax.params = option.param;
  23854. ax.headers = __assign({}, option.headers);
  23855. break;
  23856. case 'post':
  23857. ax.method = 'POST';
  23858. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23859. ax.params = option.param;
  23860. ax.data = Qs.stringify(option.data);
  23861. break;
  23862. case 'put':
  23863. case 'patch':
  23864. case 'delete':
  23865. ax.method = option.method;
  23866. ax.headers = option.headers;
  23867. ax.params = option.param;
  23868. ax.data = Qs.stringify(option.data);
  23869. break;
  23870. case 'download':
  23871. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23872. return new Promise(function (resolver, reject) {
  23873. });
  23874. case "invoke":
  23875. ax.url = serverInvokeUrlTransform(option.url, option);
  23876. ax.method = 'POST';
  23877. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23878. if (typeof option.args === 'object') {
  23879. ax.data = JSON.stringify({
  23880. args: option.args,
  23881. });
  23882. }
  23883. else {
  23884. ax.data = JSON.stringify({
  23885. args: [
  23886. __assign(__assign({}, option.data), option.param)
  23887. ],
  23888. filterModel: option.filterModel,
  23889. sortModel: option.sortModel
  23890. });
  23891. }
  23892. break;
  23893. case 'post-json':
  23894. ax.method = 'POST';
  23895. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23896. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23897. break;
  23898. case 'post-file':
  23899. //TODO 刘壮. 上传文件
  23900. var forms = new FormData();
  23901. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23902. _$2.forOwn(option.data, function (value, key) {
  23903. if (key === 'files') {
  23904. var i_1 = 0;
  23905. _$2.each(value, function (f) {
  23906. // @ts-ignore
  23907. forms.append('file' + (++i_1), f);
  23908. });
  23909. }
  23910. else {
  23911. forms.append(key, value);
  23912. }
  23913. });
  23914. ax.data = forms;
  23915. ax.method = 'POST';
  23916. break;
  23917. case "sql":
  23918. ax.url = sqlUrlTransform(option.url);
  23919. ax.method = 'POST';
  23920. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23921. ax.data = JSON.stringify({
  23922. args: [option.data],
  23923. db: option.db,
  23924. filterModel: option.filterModel,
  23925. sortModel: option.sortModel
  23926. });
  23927. break;
  23928. default:
  23929. throw new Error('not implements');
  23930. }
  23931. return new Promise(function (resolver, reject) {
  23932. axios__default(ax).then(function (resolverRaw) {
  23933. var apiResult = {
  23934. rawData: resolverRaw.data,
  23935. status: resolverRaw.status,
  23936. success: (resolverRaw.data && resolverRaw.data.success),
  23937. data: resolverRaw.data.data,
  23938. pagination: resolverRaw.data.pagination,
  23939. msg: (resolverRaw.data.msg),
  23940. errors: resolverRaw.data.errors,
  23941. headers: resolverRaw.headers
  23942. };
  23943. if (typeof window['apiTranslate'] === 'function') {
  23944. window['apiTranslate'](apiResult.rawData, option.url);
  23945. }
  23946. resolver(apiResult);
  23947. }).catch(function (reason) {
  23948. reject(reason);
  23949. });
  23950. });
  23951. };
  23952. }
  23953. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23954. if (isJson === void 0) { isJson = false; }
  23955. var YvanUI = _$2.get(window, 'YvanUI');
  23956. YvanUI.loading();
  23957. var createObjectURL = function (object) {
  23958. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23959. };
  23960. // const formData = new FormData();
  23961. // _.forOwn(data, (v, k) => {
  23962. // formData.append(k, v);
  23963. // });
  23964. var formData = '';
  23965. var xhr = new XMLHttpRequest();
  23966. xhr.open('POST', downLoadUrl);
  23967. xhr.responseType = 'blob';
  23968. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23969. if (isJson) {
  23970. formData = data ? JSON.stringify(data) : '';
  23971. xhr.setRequestHeader('Content-Type', 'application/json');
  23972. }
  23973. else {
  23974. formData = data ? Qs.stringify(data) : '';
  23975. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23976. }
  23977. //
  23978. if (header) {
  23979. _$2.forOwn(header, function (v, k) {
  23980. xhr.setRequestHeader(k, v);
  23981. });
  23982. }
  23983. xhr.onload = function (e) {
  23984. if (this.status === 200) {
  23985. var blob = this.response;
  23986. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23987. navigator.msSaveBlob(blob, filename);
  23988. YvanUI.clearLoading();
  23989. }
  23990. else {
  23991. var a = document.createElement('a');
  23992. var url = createObjectURL(blob);
  23993. a.href = url;
  23994. a.download = filename;
  23995. document.append(a);
  23996. a.click();
  23997. a.remove();
  23998. window.URL.revokeObjectURL(url);
  23999. YvanUI.clearLoading();
  24000. }
  24001. }
  24002. };
  24003. xhr.send(formData);
  24004. }
  24005. //# sourceMappingURL=ajax.js.map
  24006. function readExcel(file) {
  24007. return new Promise(function (resolve, reject) {
  24008. if (!file) {
  24009. reject("文件读取失败!!!");
  24010. return;
  24011. }
  24012. var reader = new FileReader();
  24013. reader.onload = function (e) {
  24014. if (e.target) {
  24015. var data = e.target.result;
  24016. var workbook = XLSX.read(data, { type: 'binary' });
  24017. resolve(workbook);
  24018. }
  24019. else {
  24020. reject("文件读取失败!!!");
  24021. }
  24022. };
  24023. try {
  24024. reader.readAsBinaryString(file);
  24025. }
  24026. catch (e) {
  24027. reject(e);
  24028. }
  24029. });
  24030. }
  24031. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24032. if (dataStartRow === void 0) { dataStartRow = 2; }
  24033. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24034. if (rowValidate === void 0) { rowValidate = undefined; }
  24035. if (otherValidate === void 0) { otherValidate = undefined; }
  24036. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24037. return new Promise(function (resolve, reject) {
  24038. var promiseArr = [];
  24039. for (var i = 0; i < columnsSet.length; i++) {
  24040. var fix = columnsSet[i].fix;
  24041. if (_$2.isArray(fix) && fix.length > 0) {
  24042. var ss = fix[0].toLowerCase();
  24043. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24044. columnsSet[i].importFormatter = function (vdata) {
  24045. // @ts-ignore
  24046. return window.moment(vdata.ov) - 0;
  24047. };
  24048. }
  24049. else {
  24050. var fn = lookupFn(topScope, fix[0]);
  24051. promiseArr.push(fn(null, columnsSet[i]));
  24052. delete columnsSet[i].fix;
  24053. }
  24054. }
  24055. else if (_$2.isString(fix)) {
  24056. var ss = fix.toLowerCase();
  24057. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24058. columnsSet[i].importFormatter = function (vdata) {
  24059. // @ts-ignore
  24060. return window.moment(vdata.ov) - 0;
  24061. };
  24062. }
  24063. else {
  24064. var fn = lookupFn(topScope, fix);
  24065. promiseArr.push(fn(null, columnsSet[i]));
  24066. delete columnsSet[i].fix;
  24067. }
  24068. }
  24069. }
  24070. var read = function () {
  24071. readExcel(file).then(function (workbook) {
  24072. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24073. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24074. var titleRowValue = [];
  24075. var titleRowKey = [];
  24076. var needLoop = false; // 是否需要迭代
  24077. var columns = [];
  24078. if (worksheet && worksheet["!ref"]) {
  24079. var t = worksheet["!ref"];
  24080. var tempArr = t.split(':');
  24081. if (tempArr.length >= 2) {
  24082. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24083. // 选取title的行,删除之前的行
  24084. if (titleRowNumber > firstRowNumber) {
  24085. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24086. for (var key in worksheet) {
  24087. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24088. delete worksheet[key];
  24089. }
  24090. }
  24091. }
  24092. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24093. firstRowNumber = titleRowNumber + '';
  24094. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24095. }
  24096. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24097. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24098. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24099. for (var key in worksheet) {
  24100. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24101. titleRowKey.push(key);
  24102. titleRowValue.push(worksheet[key].v);
  24103. }
  24104. }
  24105. if (columnsSet && columnsSet.length > 0) {
  24106. var length = columnsSet.length;
  24107. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24108. for (var i = 0; i < length; i++) {
  24109. var vk = titleRowKey[i];
  24110. var item = columnsSet[i];
  24111. var column = {};
  24112. if (typeof item === 'string') {
  24113. column.dataIndex = item;
  24114. column.header = worksheet[vk].v;
  24115. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24116. }
  24117. else if (typeof item.dataIndex === "string") {
  24118. column.dataIndex = item.dataIndex;
  24119. column.header = worksheet[vk].v;
  24120. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24121. if (typeof item.validate === "function") {
  24122. column.validate = item.validate;
  24123. needLoop = true;
  24124. }
  24125. if (typeof item.importFormatter === "function") {
  24126. column.importFormatter = item.importFormatter;
  24127. needLoop = true;
  24128. }
  24129. if ((item.data instanceof Array && item.data.length > 0)
  24130. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24131. column.data = item.data;
  24132. needLoop = true;
  24133. }
  24134. }
  24135. columns.push(column);
  24136. }
  24137. }
  24138. }
  24139. }
  24140. if (fieldValidate && typeof fieldValidate === "function") {
  24141. if (fieldValidate(columns, titleRowValue) !== true) {
  24142. reject("fields validate error");
  24143. return;
  24144. }
  24145. }
  24146. var allData = XLSX.utils.sheet_to_json(worksheet);
  24147. var okData = [], errorData = [], errorMsgData = [];
  24148. var needItemLoop = needLoop;
  24149. if (rowValidate && typeof rowValidate === "function") {
  24150. needLoop = true;
  24151. }
  24152. if (needLoop === true) {
  24153. for (var index = 0; index < allData.length; index++) {
  24154. var row = allData[index];
  24155. var rowNumber = dataStartRow + index;
  24156. row.__importID__ = rowNumber;
  24157. var isRowOk = true;
  24158. if (needItemLoop) {
  24159. var _loop_1 = function (num) {
  24160. var column = columns[num];
  24161. var ov = row[column.dataIndex];
  24162. var nv = ov;
  24163. var hasError = false;
  24164. var rowNumber_1 = dataStartRow + index;
  24165. var ei = {
  24166. errorId: rowNumber_1 + '_' + column.dataIndex,
  24167. importID: rowNumber_1,
  24168. dataIndex: column.dataIndex,
  24169. header: column.header,
  24170. value: ov,
  24171. errormessage: ""
  24172. };
  24173. // 格式化
  24174. if (column.data instanceof Array) {
  24175. nv = undefined;
  24176. ei.errormessage = "字典匹配失败";
  24177. _$2.forEach(column.data, function (v, index) {
  24178. if (v.text === ov) {
  24179. nv = v.id;
  24180. return;
  24181. }
  24182. });
  24183. }
  24184. else if (_$2.isPlainObject(column.data)) {
  24185. nv = undefined;
  24186. ei.errormessage = "字典匹配失败";
  24187. _$2.forEach(column.data, function (value, key) {
  24188. if (value === ov) {
  24189. nv = key;
  24190. return;
  24191. }
  24192. });
  24193. }
  24194. if (typeof column.importFormatter === 'function') {
  24195. var vdata = {
  24196. column: column,
  24197. ov: ov,
  24198. nv: nv,
  24199. rowIndex: index,
  24200. data: row,
  24201. rowDatas: allData
  24202. };
  24203. nv = undefined;
  24204. ei.errormessage = "格式化失败";
  24205. nv = column.importFormatter(vdata);
  24206. }
  24207. if (!nv && nv != 0) {
  24208. hasError = true;
  24209. }
  24210. else {
  24211. row[column.dataIndex] = nv;
  24212. ei.errormessage = "";
  24213. }
  24214. // 校验
  24215. if (typeof column.validate === 'function') {
  24216. var vdata = {
  24217. column: column,
  24218. ov: ov,
  24219. nv: nv,
  24220. rowIndex: index,
  24221. data: row,
  24222. rowDatas: allData
  24223. };
  24224. var errormessage = column.validate(vdata);
  24225. if (errormessage === true) ;
  24226. else {
  24227. hasError = true;
  24228. ei.errormessage = ei.errormessage + "/" + errormessage;
  24229. }
  24230. }
  24231. if (hasError === true) {
  24232. isRowOk = false;
  24233. errorMsgData.push(ei);
  24234. }
  24235. };
  24236. for (var num = 0; num < columns.length; num++) {
  24237. _loop_1(num);
  24238. }
  24239. }
  24240. if (rowValidate && typeof rowValidate === "function") {
  24241. var errormessage = rowValidate({
  24242. columns: columns,
  24243. data: row,
  24244. rowIndex: index,
  24245. rowDatas: allData
  24246. });
  24247. if (errormessage === true) ;
  24248. else {
  24249. isRowOk = false;
  24250. var ei = {
  24251. errorId: rowNumber + '',
  24252. dataIndex: "row",
  24253. header: "数据行",
  24254. value: "当前行的数据",
  24255. importID: rowNumber,
  24256. errormessage: errormessage
  24257. };
  24258. errorMsgData.push(ei);
  24259. }
  24260. }
  24261. row.__hasError__ = !isRowOk;
  24262. if (isRowOk === true) {
  24263. okData.push(row);
  24264. }
  24265. else {
  24266. errorData.push(row);
  24267. }
  24268. }
  24269. }
  24270. else {
  24271. // 添加数据的唯一标识
  24272. for (var index = 0; index < allData.length; index++) {
  24273. var row = allData[index];
  24274. var rowNumber = dataStartRow + index;
  24275. row.__importID__ = rowNumber;
  24276. row.__hasError__ = false;
  24277. }
  24278. okData = allData;
  24279. }
  24280. if (otherValidate && typeof otherValidate === "function") {
  24281. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24282. }
  24283. else {
  24284. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24285. }
  24286. // clearLoading()
  24287. }).catch(function (e) {
  24288. reject(e);
  24289. });
  24290. };
  24291. if (promiseArr.length > 0) {
  24292. Promise.all(promiseArr).then(function (resArr) {
  24293. for (var i = 0; i < resArr.length; i++) {
  24294. var tmp = resArr[i];
  24295. tmp.config.data = [];
  24296. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24297. if (tmp.r.field.length > 1) {
  24298. var keyKey = tmp.r.field[0];
  24299. var valueKey = tmp.r.field[1];
  24300. for (var j = 0; j < tmp.r.data.length; j++) {
  24301. var it = tmp.r.data[j];
  24302. var newIt = {};
  24303. newIt.id = it[keyKey];
  24304. newIt.text = it[valueKey];
  24305. tmp.config.data.push(newIt);
  24306. }
  24307. }
  24308. }
  24309. }
  24310. read();
  24311. });
  24312. }
  24313. else {
  24314. setTimeout(read, 50);
  24315. }
  24316. });
  24317. }
  24318. //# sourceMappingURL=xlsx.js.map
  24319. var ExcelImportDialog = /** @class */ (function (_super) {
  24320. __extends(ExcelImportDialog, _super);
  24321. function ExcelImportDialog(option) {
  24322. var _this = this;
  24323. var vjson = vjsonFunc(option);
  24324. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24325. _this.importExcelOption = option;
  24326. return _this;
  24327. }
  24328. ExcelImportDialog.prototype.onLoad = function () {
  24329. _super.prototype.onLoad.call(this);
  24330. };
  24331. ExcelImportDialog.prototype.fileChange = function (sender) {
  24332. var _this = this;
  24333. var file = sender.fileInputEl.dom.files[0];
  24334. // const senderScope = lookupScope(sender)
  24335. var topScope = this.topScope;
  24336. var rowValidate = this.importExcelOption.rowValidate;
  24337. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24338. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24339. }
  24340. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24341. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24342. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24343. }
  24344. var fieldValidate = this.importExcelOption.fieldValidate;
  24345. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24346. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24347. }
  24348. this.setLoading(true);
  24349. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24350. _this.importData = res;
  24351. _this.refs.dataGrid.setData(res.allData);
  24352. _this.viewModel.set("dataCount", res.allData.length);
  24353. _this.refs.errGrid.setData(res.errorMsgData);
  24354. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24355. }).catch(function (e) {
  24356. _this.importData = null;
  24357. _this.refs.dataGrid.setData();
  24358. _this.refs.errGrid.setData();
  24359. msg(e.toString());
  24360. }).finally(function () {
  24361. _this.setLoading(false);
  24362. });
  24363. };
  24364. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24365. if (record.get('__hasError__')) {
  24366. return "x-grid-record-bg-red";
  24367. }
  24368. };
  24369. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24370. return "x-grid-record-bg-red";
  24371. };
  24372. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24373. var _a;
  24374. var id = record.data.__importID__;
  24375. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24376. var selectRecord = null;
  24377. var dataIndex = -1;
  24378. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24379. for (var i = 0; i < rows.length; i++) {
  24380. if (rows[i].importID === id) {
  24381. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24382. dataIndex = i;
  24383. }
  24384. if (rows[i].errorId === id + "_" + subId) {
  24385. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24386. dataIndex = i;
  24387. break;
  24388. }
  24389. }
  24390. if (selectRecord) {
  24391. this.refs.errGrid.ensureVisible(selectRecord);
  24392. this.refs.errGrid.selModel.select(dataIndex);
  24393. // this.refs.errGrid.reload()
  24394. }
  24395. };
  24396. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24397. var _a;
  24398. var id = record.data.importID;
  24399. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24400. var selectRecord = null;
  24401. var dataIndex = -1;
  24402. for (var i = 0; i < rows.length; i++) {
  24403. if (rows[i].__importID__ === id) {
  24404. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24405. dataIndex = i;
  24406. break;
  24407. }
  24408. }
  24409. if (selectRecord) {
  24410. this.refs.dataGrid.ensureVisible(selectRecord);
  24411. this.refs.dataGrid.selModel.select(dataIndex);
  24412. // this.refs.dataGrid.reload()
  24413. }
  24414. };
  24415. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24416. this.viewModel.set("dataType", newValue);
  24417. if (this.importData) {
  24418. this.refs.dataGrid.setData(this.importData[newValue]);
  24419. this.viewModel.set("dataCount", this.importData[newValue].length);
  24420. }
  24421. };
  24422. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24423. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24424. window.location.href = this.importExcelOption.dowLoadUrl;
  24425. return;
  24426. }
  24427. var xt = [];
  24428. _$2.forEach(this.importExcelOption.columns, function (v) {
  24429. xt.push(v.header);
  24430. });
  24431. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24432. if (filename.endsWith(".xlsx")) {
  24433. filename = filename.split(".xlsx")[0];
  24434. }
  24435. filename = filename + ".xlsx";
  24436. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24437. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24438. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24439. XLSX.writeFile(wb, filename); //导出Excel
  24440. };
  24441. ExcelImportDialog.prototype.getData = function (sender) {
  24442. _$2.each(this.importData.okData, function (item) {
  24443. delete item.id;
  24444. delete item.__hasError__;
  24445. delete item.__importID__;
  24446. delete item._origin;
  24447. });
  24448. _$2.each(this.importData.allData, function (item) {
  24449. delete item.id;
  24450. delete item.__hasError__;
  24451. delete item.__importID__;
  24452. delete item._origin;
  24453. });
  24454. _$2.each(this.importData.errorData, function (item) {
  24455. delete item.id;
  24456. delete item.__hasError__;
  24457. delete item.__importID__;
  24458. delete item._origin;
  24459. });
  24460. this.dialogSuccess(this.importData);
  24461. };
  24462. return ExcelImportDialog;
  24463. }(Scope));
  24464. var model$d = {
  24465. data: {
  24466. dataType: "all",
  24467. errMsgCount: 0,
  24468. dataCount: 0
  24469. }
  24470. };
  24471. var vjsonFunc = function (option) {
  24472. return {
  24473. title: option.title || 'excel导入',
  24474. layout: 'fit',
  24475. items: [
  24476. {
  24477. layout: 'border',
  24478. tbar: {
  24479. xtype: "form",
  24480. items: [
  24481. {
  24482. xtype: "cols",
  24483. items: [
  24484. {
  24485. xtype: "filefield",
  24486. fieldLabel: 'excel文件',
  24487. buttonText: '请选择excel文件',
  24488. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24489. flex: 3,
  24490. listeners: {
  24491. change: "scope.fileChange"
  24492. }
  24493. }, {
  24494. xtype: "button",
  24495. iconCls: "x-fa fa-download",
  24496. text: "下载模版",
  24497. listeners: {
  24498. click: "scope.downloadTemplate"
  24499. }
  24500. }, {
  24501. xtype: 'container',
  24502. border: false,
  24503. layout: 'hbox',
  24504. }, {
  24505. xtype: "button",
  24506. iconCls: "x-fa fa-upload",
  24507. text: option.tQButtonText || "提取数据",
  24508. listeners: {
  24509. click: "scope.getData"
  24510. }
  24511. }
  24512. ]
  24513. },
  24514. ]
  24515. },
  24516. items: [
  24517. {
  24518. tbar: {
  24519. xtype: "toolbar",
  24520. title: "导入的数据",
  24521. items: [{
  24522. xtype: 'label',
  24523. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24524. }, {
  24525. xtype: 'radiogroup',
  24526. items: [
  24527. {
  24528. boxLabel: '所有数据',
  24529. checked: true,
  24530. inputValue: 'allData',
  24531. }, {
  24532. boxLabel: '正确数据',
  24533. inputValue: 'okData',
  24534. }, {
  24535. boxLabel: '错误数据',
  24536. inputValue: 'errorData',
  24537. }
  24538. ],
  24539. listeners: {
  24540. change: 'scope.filterData',
  24541. },
  24542. }, {
  24543. xtype: "textfield",
  24544. readOnly: true,
  24545. fieldLabel: "条目数",
  24546. bind: "{dataCount}"
  24547. }]
  24548. },
  24549. xtype: 'yvgrid',
  24550. reference: 'dataGrid',
  24551. layout: 'fit',
  24552. pagination: false,
  24553. // pageSize: 50,
  24554. getRowClass: 'scope.getDataGridRowRecord',
  24555. columns: option.columns,
  24556. region: 'center',
  24557. split: true,
  24558. listeners: {
  24559. cellclick: "scope.dataGridClick",
  24560. },
  24561. selModel: {
  24562. // type: 'rowmodel',
  24563. mode: 'SINGLE',
  24564. },
  24565. }, {
  24566. tbar: {
  24567. xtype: "toolbar", items: [
  24568. {
  24569. xtype: 'label',
  24570. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24571. }, {
  24572. xtype: "textfield",
  24573. readOnly: true,
  24574. fieldLabel: "条目数",
  24575. bind: "{errMsgCount}"
  24576. }
  24577. ]
  24578. },
  24579. xtype: 'yvgrid',
  24580. reference: 'errGrid',
  24581. layout: 'fit',
  24582. pagination: false,
  24583. getRowClass: 'scope.getErrGridRowRecord',
  24584. height: "40%",
  24585. columns: [
  24586. { dataIndex: "errorId", header: "ID", hidden: true },
  24587. { dataIndex: "importID", header: "行号", width: 80 },
  24588. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24589. { dataIndex: "value", header: "值", width: 120 },
  24590. { dataIndex: "header", header: "字段名", width: 120 },
  24591. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24592. ],
  24593. region: 'south',
  24594. split: true,
  24595. listeners: {
  24596. itemclick: "scope.errGridClick"
  24597. },
  24598. selModel: {
  24599. // type: 'rowmodel',
  24600. mode: 'SINGLE',
  24601. },
  24602. },
  24603. ],
  24604. },
  24605. ],
  24606. referenceHolder: true,
  24607. };
  24608. };
  24609. //# sourceMappingURL=ExcelImportDialog.js.map
  24610. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24611. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24612. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24613. ret.report_id = reportId;
  24614. ret.report = report;
  24615. return ret;
  24616. }
  24617. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24618. var e_1, _a, e_2, _b;
  24619. var model = {
  24620. data: {
  24621. report_name: config.report_name,
  24622. query: {},
  24623. sum: {},
  24624. }
  24625. };
  24626. var json5 = window['YvanUI'].json5;
  24627. var report = config.report ? json5.parse(config.report) : {};
  24628. var conditionRows = [];
  24629. var sumRows = [];
  24630. model.data.has_sum = _$2.size(report.summary) > 0;
  24631. // query 查询条件
  24632. var newRow = false;
  24633. var currentRow = { xtype: 'cols', items: [], };
  24634. conditionRows.push(currentRow);
  24635. _$2.forEach(report.query, function (item) {
  24636. if (newRow) {
  24637. currentRow = { xtype: 'cols', items: [], };
  24638. conditionRows.push(currentRow);
  24639. }
  24640. var vj = json5.parse(item.conditionFieldExtend);
  24641. if (item.conditionFieldXtype) {
  24642. vj.xtype = item.conditionFieldXtype;
  24643. if (item.conditionFieldXtype === 'combo') {
  24644. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24645. }
  24646. if (item.conditionFieldXtype === 'datetimefield') {
  24647. //@ts-ignore
  24648. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24649. }
  24650. else if (item.conditionFieldXtype === 'datefield') {
  24651. //@ts-ignore
  24652. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24653. }
  24654. else {
  24655. model.data.query[item.conditionFieldBind] = '';
  24656. }
  24657. }
  24658. else {
  24659. // 没有组件类型,是个空占位符
  24660. vj.border = false;
  24661. }
  24662. if (item.conditionFieldBind) {
  24663. vj.bind = {
  24664. value: '{query.' + item.conditionFieldBind + '}'
  24665. };
  24666. }
  24667. if (item.conditionFieldFlex) {
  24668. vj.flex = item.conditionFieldFlex;
  24669. }
  24670. if (item.conditionFieldXtype) {
  24671. vj.fieldLabel = item.conditionFieldLabel;
  24672. }
  24673. if (item.fieldLabel) {
  24674. vj.fieldLabel = item.fieldLabel;
  24675. }
  24676. newRow = item.conditionFieldWrap || false;
  24677. currentRow.items.push(vj);
  24678. });
  24679. if (currentRow) {
  24680. currentRow.margin = '10 0 10 0';
  24681. }
  24682. // sum 汇总条件
  24683. newRow = true;
  24684. try {
  24685. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24686. var item = _d.value;
  24687. if (newRow) {
  24688. currentRow = {
  24689. xtype: 'cols',
  24690. defaultType: 'displayfield',
  24691. defaults: {
  24692. labelWidth: 70,
  24693. },
  24694. items: []
  24695. };
  24696. sumRows.push(currentRow);
  24697. }
  24698. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24699. if (item.sumFieldBind) {
  24700. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24701. model.data.sum[item.sumFieldBind] = '';
  24702. }
  24703. else {
  24704. // 没有组件类型,是个空占位符
  24705. vj.border = false;
  24706. }
  24707. if (item.sumFieldFlex) {
  24708. vj.flex = item.sumFieldFlex;
  24709. }
  24710. if (item.sumFieldLabel) {
  24711. vj.fieldLabel = item.sumFieldLabel;
  24712. }
  24713. // sumFieldBind: "zs"
  24714. // sumFieldExtend: "{}"
  24715. // sumFieldFlex: 1
  24716. // sumFieldLabel: "总数"
  24717. // sumFieldWrap: false
  24718. newRow = item.sumFieldWrap || false;
  24719. currentRow.items.push(vj);
  24720. }
  24721. }
  24722. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24723. finally {
  24724. try {
  24725. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24726. }
  24727. finally { if (e_1) throw e_1.error; }
  24728. }
  24729. if (currentRow) {
  24730. currentRow.margin = '10 0 10 0';
  24731. }
  24732. // column 结果字段
  24733. var columns = [];
  24734. try {
  24735. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24736. var item = _f.value;
  24737. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24738. if (item.xtype) {
  24739. if (item.xtype == 'checkbox') {
  24740. vj.xtype = 'checkcolumn';
  24741. vj.disabled = true;
  24742. }
  24743. else {
  24744. vj.xtype = item.xtype;
  24745. }
  24746. }
  24747. if (item.dataType) {
  24748. vj.dataType = item.dataType;
  24749. }
  24750. if (item.align) {
  24751. vj.align = item.align;
  24752. }
  24753. if (item.width) {
  24754. vj.width = item.width;
  24755. }
  24756. if (item.dict) {
  24757. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24758. }
  24759. columns.push(vj);
  24760. }
  24761. }
  24762. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24763. finally {
  24764. try {
  24765. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24766. }
  24767. finally { if (e_2) throw e_2.error; }
  24768. }
  24769. var vjson = {
  24770. bind: {
  24771. title: '{report_name}',
  24772. },
  24773. layout: 'fit',
  24774. referenceHolder: true,
  24775. items: [
  24776. {
  24777. layout: 'border',
  24778. border: false,
  24779. items: [
  24780. {
  24781. region: 'north',
  24782. border: false,
  24783. tbar: {
  24784. xtype: 'toolbar',
  24785. border: false,
  24786. items: [
  24787. {
  24788. xtype: 'button',
  24789. text: '查询',
  24790. reference: 'btnSearch',
  24791. iconCls: 'x-fa fa-search',
  24792. listeners: {
  24793. click: 'scope.reload',
  24794. },
  24795. },
  24796. {
  24797. xtype: 'button',
  24798. text: '关闭',
  24799. iconCls: 'x-fa fa-times',
  24800. listeners: {
  24801. click: 'system.closeMe()',
  24802. },
  24803. },
  24804. ],
  24805. },
  24806. defaults: {
  24807. margin: '8 0 0 0'
  24808. },
  24809. items: __spread(conditionRows, sumRows),
  24810. fix: ['system.enterToClick("btnSearch")'],
  24811. },
  24812. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24813. method: 'invoke',
  24814. url: '/report/Report@execute',
  24815. params: {
  24816. dataSource: report.dataSource,
  24817. pagination: report.grid.pagination || true,
  24818. report_id: config.report_id,
  24819. query: '{query}',
  24820. },
  24821. }, columns: columns }, report.grid),
  24822. ],
  24823. },
  24824. ],
  24825. };
  24826. return { model: model, vjson: vjson, report: report };
  24827. }
  24828. var ReportScope = /** @class */ (function (_super) {
  24829. __extends(ReportScope, _super);
  24830. function ReportScope(_a, invokeServerFn) {
  24831. var model = _a.model, vjson = _a.vjson;
  24832. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24833. _this.invokeServerFn = invokeServerFn;
  24834. return _this;
  24835. }
  24836. ReportScope.prototype.onLoad = function () {
  24837. // this.reload()
  24838. };
  24839. ReportScope.prototype.reload = function () {
  24840. var _this = this;
  24841. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24842. if (this.viewModel.get('has_sum')) {
  24843. this.invokeServerFn('/report/Report@executeSum', {
  24844. dataSource: this.report.dataSource,
  24845. report_id: this.report_id,
  24846. query: this.viewModel.get('query'),
  24847. }).then(function (res) {
  24848. if (!res.success) {
  24849. showErrorDialog$1(res.msg);
  24850. }
  24851. else {
  24852. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24853. }
  24854. });
  24855. }
  24856. this.refs.grid1.reload();
  24857. };
  24858. return ReportScope;
  24859. }(Scope));
  24860. //# sourceMappingURL=Report.js.map
  24861. var model$e = {
  24862. data: {
  24863. form: {
  24864. resource_parent: '',
  24865. resource_name: '',
  24866. resource_icon: '',
  24867. scope_url: '',
  24868. scope_params: '',
  24869. resource_order: '',
  24870. permission_code: '',
  24871. },
  24872. }
  24873. };
  24874. //# sourceMappingURL=RegisterModule.model.js.map
  24875. var vjson$d = {
  24876. title: '注册模块',
  24877. layout: 'fit',
  24878. width: "40%",
  24879. height: "50%",
  24880. fbar: {
  24881. xtype: 'toolbar',
  24882. items: [
  24883. {
  24884. xtype: "button",
  24885. text: "确定",
  24886. iconCls: 'x-fa fa-check',
  24887. listeners: {
  24888. click: 'scope.saveNode',
  24889. }
  24890. },
  24891. {
  24892. xtype: "button",
  24893. text: "关闭",
  24894. iconCls: 'x-fa fa-times',
  24895. listeners: {
  24896. click: 'system.closeMe()',
  24897. }
  24898. },
  24899. ]
  24900. },
  24901. items: [
  24902. {
  24903. layout: 'border',
  24904. items: [
  24905. {
  24906. region: 'west',
  24907. layout: 'fit',
  24908. xtype: 'tabpanel',
  24909. reference: 'tabs',
  24910. width: "50%",
  24911. split: true,
  24912. listeners: {
  24913. tabchange: 'scope.tabchange',
  24914. },
  24915. items: [
  24916. {
  24917. region: 'center',
  24918. layout: 'fit',
  24919. title: 'PC菜单',
  24920. key: "1",
  24921. items: [
  24922. {
  24923. xtype: 'treepanel',
  24924. layout: 'fit',
  24925. region: 'west',
  24926. rootVisible: false,
  24927. useArrows: true,
  24928. reference: 'tree1',
  24929. listeners: {
  24930. itemclick: "scope.tree1NodeClick",
  24931. }
  24932. },
  24933. ]
  24934. },
  24935. {
  24936. region: 'center',
  24937. layout: 'fit',
  24938. title: 'PDA菜单',
  24939. key: "2",
  24940. items: [
  24941. {
  24942. xtype: 'treepanel',
  24943. layout: 'fit',
  24944. region: 'west',
  24945. reference: 'tree2',
  24946. rootVisible: false,
  24947. useArrows: true,
  24948. listeners: {
  24949. itemclick: "scope.tree1NodeClick",
  24950. }
  24951. },
  24952. ]
  24953. },
  24954. ]
  24955. },
  24956. {
  24957. region: 'center',
  24958. xtype: 'form',
  24959. margin: '0 0 0 0',
  24960. split: true,
  24961. width: '50%',
  24962. items: [
  24963. {
  24964. xtype: 'cols',
  24965. items: [
  24966. {
  24967. xtype: 'textfield',
  24968. fieldLabel: '上级资源ID',
  24969. bind: {
  24970. readOnly: true,
  24971. disabled: true,
  24972. value: '{form.resource_parent}'
  24973. },
  24974. },
  24975. ],
  24976. },
  24977. {
  24978. xtype: 'cols',
  24979. items: [
  24980. {
  24981. xtype: 'textfield',
  24982. fieldLabel: '资源名称',
  24983. bind: {
  24984. value: '{form.resource_name}'
  24985. },
  24986. allowBlank: false,
  24987. },
  24988. ],
  24989. },
  24990. {
  24991. xtype: 'cols',
  24992. items: [
  24993. {
  24994. xtype: 'numberfield',
  24995. fieldLabel: '资源排序',
  24996. bind: {
  24997. value: '{form.resource_order}'
  24998. },
  24999. allowBlank: false,
  25000. },
  25001. ],
  25002. },
  25003. {
  25004. xtype: 'cols',
  25005. items: [
  25006. {
  25007. xtype: 'textfield',
  25008. fieldLabel: '功能URL',
  25009. bind: {
  25010. disabled: true,
  25011. value: '{form.scope_url}'
  25012. },
  25013. },
  25014. ]
  25015. },
  25016. {
  25017. xtype: 'cols',
  25018. items: [
  25019. {
  25020. xtype: 'textfield',
  25021. fieldLabel: '权限编码',
  25022. bind: {
  25023. value: '{form.permission_code}'
  25024. }
  25025. },
  25026. ],
  25027. },
  25028. {
  25029. xtype: 'cols',
  25030. items: [
  25031. {
  25032. xtype: 'textfield',
  25033. fieldLabel: '功能参数',
  25034. bind: {
  25035. value: '{form.scope_params}'
  25036. }
  25037. },
  25038. ],
  25039. },
  25040. ],
  25041. },
  25042. ],
  25043. },
  25044. ],
  25045. referenceHolder: true,
  25046. };
  25047. //# sourceMappingURL=RegisterModule.view.js.map
  25048. var RegisterModule = /** @class */ (function (_super) {
  25049. __extends(RegisterModule, _super);
  25050. function RegisterModule() {
  25051. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25052. }
  25053. RegisterModule.prototype.onLoad = function () {
  25054. this.reloadTree("PC");
  25055. };
  25056. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25057. var currTabKey = b.key;
  25058. if (currTabKey === '1') {
  25059. this.viewModel.set('form', '');
  25060. this.reloadTree("PC");
  25061. }
  25062. else {
  25063. this.viewModel.set('form', '');
  25064. this.reloadTree("PDA");
  25065. }
  25066. };
  25067. RegisterModule.prototype.reloadTree = function (type) {
  25068. var _this = this;
  25069. if ("PC" === type) {
  25070. this.setLoading(true);
  25071. getMenuTree({ type: "PC" }).then(function (res) {
  25072. if (res.success) {
  25073. _this.refs.tree1.store.setRootNode({
  25074. expanded: true,
  25075. children: res.data
  25076. });
  25077. }
  25078. }).finally(function () {
  25079. _this.setLoading(false);
  25080. });
  25081. }
  25082. else {
  25083. this.setLoading(true);
  25084. getMenuTree({ type: "PDA" }).then(function (res) {
  25085. if (res.success) {
  25086. _this.refs.tree2.store.setRoot({
  25087. expanded: true,
  25088. children: res.data
  25089. });
  25090. }
  25091. }).finally(function () {
  25092. _this.setLoading(false);
  25093. });
  25094. }
  25095. };
  25096. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25097. var id = _$2.split(node.data.id, '_')[1];
  25098. if (!id) {
  25099. return;
  25100. }
  25101. this.viewModel.set('form.resource_parent', id);
  25102. };
  25103. RegisterModule.prototype.saveNode = function () {
  25104. var _this = this;
  25105. var tabKey = this.refs.tabs.activeTab.key;
  25106. // 检验菜单数据
  25107. var param = this.viewModel.get('form');
  25108. if (!param.resource_parent) {
  25109. msg('请选择一个父节点');
  25110. return;
  25111. }
  25112. if (!param.resource_name) {
  25113. msg('资源名称不能为空');
  25114. return;
  25115. }
  25116. if (!param.scope_url) {
  25117. msg('功能URL不能为空');
  25118. return;
  25119. }
  25120. var type;
  25121. if (tabKey === '1') {
  25122. type = 'PC';
  25123. }
  25124. else {
  25125. type = 'PDA';
  25126. }
  25127. this.setLoading(true);
  25128. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25129. if (res.success) {
  25130. msg("注册成功");
  25131. _this.close();
  25132. }
  25133. }).finally(function () {
  25134. _this.setLoading(false);
  25135. });
  25136. };
  25137. return RegisterModule;
  25138. }(Scope));
  25139. //# sourceMappingURL=RegisterModule.js.map
  25140. var model$f = {
  25141. data: {
  25142. title: "模板选择",
  25143. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25144. moduleType: 1,
  25145. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25146. packagePath: "",
  25147. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25148. fileSavePath: "",
  25149. // 模块名称 "Dict"
  25150. moduleName: "NewModule",
  25151. // 页面标题 "字典维护"
  25152. pageTitle: "新模块",
  25153. // 单表查询
  25154. singleTable: {
  25155. sql: "select * from bas_dict",
  25156. // 新增或者删除所用的表
  25157. tableName: "",
  25158. // 是否分页查询
  25159. pagination: true,
  25160. // 是否需要删除
  25161. delete: true,
  25162. // 删除条件字段
  25163. deleteWhereColumn: "",
  25164. // 删除提示语
  25165. deleteTips: "确定要删除?",
  25166. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25167. editType: 2,
  25168. },
  25169. singleTableView: {
  25170. tableNameList: [
  25171. // { value: "aaa"},
  25172. ],
  25173. columnList: [
  25174. // { value: "aaa"},
  25175. ],
  25176. }
  25177. }
  25178. };
  25179. //# sourceMappingURL=CreateModule.model.js.map
  25180. var vjson$e = {
  25181. bind: {
  25182. title: '新建模块-{title}',
  25183. },
  25184. width: "55%",
  25185. height: "60%",
  25186. minWidth: 500,
  25187. minHeight: 400,
  25188. modal: true,
  25189. frame: true,
  25190. layout: 'card',
  25191. bbar: [
  25192. '->',
  25193. {
  25194. itemId: 'card-prev',
  25195. text: '&laquo; 上一步',
  25196. disabled: true,
  25197. listeners: {
  25198. click: 'scope.showPrevious',
  25199. },
  25200. },
  25201. {
  25202. itemId: 'card-next',
  25203. text: '下一步 &raquo;',
  25204. listeners: {
  25205. click: 'scope.showNext',
  25206. },
  25207. },
  25208. {
  25209. itemId: 'card-finish',
  25210. text: '立刻执行',
  25211. iconCls: 'x-fa fa-flash',
  25212. hidden: true,
  25213. listeners: {
  25214. click: 'scope.finish',
  25215. },
  25216. },
  25217. ],
  25218. items: [
  25219. {
  25220. vtitle: '模板选择',
  25221. reference: 'templateSelection',
  25222. layout: {
  25223. type: 'hbox',
  25224. pack: 'start',
  25225. align: 'stretch'
  25226. },
  25227. listeners: {
  25228. cardEnter: 'scope.templateEnter',
  25229. cardLevel: 'scope.templateLevel'
  25230. },
  25231. items: [
  25232. {
  25233. width: 150,
  25234. xtype: 'form',
  25235. border: false,
  25236. layout: {
  25237. type: 'vbox',
  25238. align: 'stretch'
  25239. },
  25240. defaults: {
  25241. border: false,
  25242. anchor: '100%',
  25243. margin: '5',
  25244. },
  25245. items: [
  25246. {
  25247. xtype: 'radiogroup',
  25248. bind: {
  25249. value: '{moduleType}'
  25250. },
  25251. layout: 'vbox',
  25252. defaults: {
  25253. border: false,
  25254. anchor: '100%',
  25255. margin: '5',
  25256. },
  25257. items: [
  25258. { boxLabel: '单表查询', inputValue: 1 },
  25259. { boxLabel: '主/明细查询', inputValue: 2 },
  25260. { boxLabel: '树/明细查询', inputValue: 3 },
  25261. { boxLabel: '卡片表单', inputValue: 4 },
  25262. { boxLabel: '主/详情查询', inputValue: 5 },
  25263. ]
  25264. },
  25265. ]
  25266. },
  25267. {
  25268. flex: 1,
  25269. region: 'center',
  25270. xtype: "panel",
  25271. border: false,
  25272. frame: true,
  25273. padding: "4px 8px",
  25274. html: "描述...",
  25275. }
  25276. ]
  25277. },
  25278. {
  25279. vtitle: '模块名称',
  25280. reference: 'moduleName',
  25281. layout: 'fit',
  25282. listeners: {
  25283. cardEnter: 'scope.moduleEnter',
  25284. cardLevel: 'scope.moduleLevel'
  25285. },
  25286. items: [
  25287. {
  25288. xtype: 'form',
  25289. border: false,
  25290. layout: {
  25291. type: 'vbox',
  25292. align: 'stretch'
  25293. },
  25294. defaults: {
  25295. border: false,
  25296. anchor: '100%',
  25297. margin: '5',
  25298. },
  25299. items: [
  25300. {
  25301. xtype: 'textfield',
  25302. fieldLabel: '包路径',
  25303. allowBlank: false,
  25304. bind: { value: '{packagePath}' },
  25305. },
  25306. {
  25307. xtype: 'textfield',
  25308. fieldLabel: '文件路径',
  25309. allowBlank: false,
  25310. bind: { value: '{fileSavePath}' },
  25311. },
  25312. {
  25313. xtype: 'textfield',
  25314. fieldLabel: '模块名',
  25315. allowBlank: false,
  25316. bind: { value: '{moduleName}' },
  25317. },
  25318. {
  25319. xtype: 'textfield',
  25320. fieldLabel: '菜单名',
  25321. allowBlank: false,
  25322. bind: { value: '{pageTitle}' },
  25323. },
  25324. ]
  25325. },
  25326. ]
  25327. },
  25328. {
  25329. vtitle: '确认结果',
  25330. reference: 'confirmResult',
  25331. layout: 'fit',
  25332. listeners: {
  25333. cardEnter: 'scope.optionEnter',
  25334. cardLevel: 'scope.optionLevel',
  25335. },
  25336. items: [
  25337. {
  25338. xtype: 'jsoneditor',
  25339. reference: 'jsoneditor'
  25340. }
  25341. ]
  25342. },
  25343. // ---------------------------------------------------------------------------------- 单表查询
  25344. {
  25345. vtitle: '查询SQL',
  25346. reference: 'singleTable_1',
  25347. layout: 'fit',
  25348. listeners: {
  25349. cardEnter: 'scope.editorEnter',
  25350. cardLevel: 'scope.editorLevel'
  25351. },
  25352. items: [
  25353. {
  25354. xtype: 'sqleditor',
  25355. }
  25356. ],
  25357. },
  25358. {
  25359. vtitle: '字段选项',
  25360. reference: 'singleTable_2',
  25361. layout: 'fit',
  25362. listeners: {
  25363. cardEnter: 'scope.columnEnter',
  25364. cardLevel: 'scope.columnLevel',
  25365. },
  25366. items: [
  25367. {
  25368. xtype: 'yvgrid',
  25369. border: false,
  25370. selModel: {
  25371. type: 'spreadsheet',
  25372. columnSelect: true,
  25373. pruneRemoved: false,
  25374. extensible: 'y'
  25375. },
  25376. plugins: {
  25377. clipboard: true,
  25378. selectionreplicator: true
  25379. },
  25380. reference: 'grid1',
  25381. idField: 'column_name',
  25382. hideFootbar: true,
  25383. tbar: {
  25384. xtype: 'toolbar',
  25385. items: [
  25386. {
  25387. xtype: 'button',
  25388. text: '添加',
  25389. iconCls: 'x-fa fa-plus-circle',
  25390. listeners: {
  25391. click: 'scope.addField'
  25392. }
  25393. },
  25394. {
  25395. xtype: 'button',
  25396. text: '删除',
  25397. iconCls: 'x-fa fa-minus-circle',
  25398. listeners: {
  25399. click: 'scope.removeField'
  25400. }
  25401. },
  25402. {
  25403. xtype: 'button',
  25404. text: '分析SQL',
  25405. iconCls: 'x-fa fa-refresh',
  25406. listeners: {
  25407. click: 'scope.parseSQL'
  25408. }
  25409. },
  25410. ]
  25411. },
  25412. columns: [
  25413. {
  25414. text: '字段名', dataIndex: 'column_name',
  25415. sortable: false,
  25416. menuDisabled: true,
  25417. width: 150,
  25418. editor: {
  25419. allowBlank: true,
  25420. selectOnFocus: false,
  25421. }
  25422. },
  25423. {
  25424. text: '字段中文', dataIndex: 'column_comment',
  25425. width: 150,
  25426. sortable: false,
  25427. menuDisabled: true,
  25428. editor: {
  25429. allowBlank: true,
  25430. selectOnFocus: false,
  25431. }
  25432. },
  25433. {
  25434. dataIndex: "column_useto",
  25435. // fix: ['system.getDict("column_useto")'],
  25436. header: "用途",
  25437. editor: {
  25438. xtype: 'combo',
  25439. allowBlank: false,
  25440. },
  25441. },
  25442. {
  25443. text: '主键', dataIndex: 'is_primary_key',
  25444. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25445. width: 48, resizable: false,
  25446. },
  25447. {
  25448. text: '必填', dataIndex: 'not_null',
  25449. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25450. width: 48, resizable: false,
  25451. },
  25452. {
  25453. text: '长度', dataIndex: 'column_size',
  25454. sortable: false, menuDisabled: true,
  25455. xtype: 'numbercolumn', format: '0',
  25456. editor: { allowBlank: true, selectOnFocus: true }
  25457. },
  25458. {
  25459. text: '字典', dataIndex: 'column_dict',
  25460. sortable: false, menuDisabled: true,
  25461. width: 200,
  25462. editor: {
  25463. allowBlank: true,
  25464. }
  25465. },
  25466. {
  25467. text: 'UI组件', dataIndex: 'column_ui',
  25468. sortable: false, menuDisabled: true,
  25469. // fix: ['system.getDict("column_ui")'],
  25470. width: 150,
  25471. editor: {
  25472. xtype: 'combo',
  25473. allowBlank: true,
  25474. }
  25475. },
  25476. {
  25477. dataIndex: 'data_type',
  25478. hidden: true,
  25479. },
  25480. ]
  25481. }
  25482. ],
  25483. },
  25484. {
  25485. vtitle: '其他选项',
  25486. reference: 'singleTable_3',
  25487. isEnd: true,
  25488. listeners: {
  25489. cardEnter: 'scope.extendEnter',
  25490. cardLevel: 'scope.extendLevel',
  25491. },
  25492. layout: 'fit',
  25493. items: [
  25494. {
  25495. xtype: 'form',
  25496. border: false,
  25497. layout: {
  25498. type: 'vbox',
  25499. align: 'stretch'
  25500. },
  25501. defaults: {
  25502. border: false,
  25503. anchor: '100%',
  25504. margin: '5',
  25505. },
  25506. items: [
  25507. {
  25508. xtype: 'checkbox',
  25509. fieldLabel: '需要分页',
  25510. labelWidth: 100,
  25511. bind: {
  25512. value: '{singleTable.pagination}',
  25513. },
  25514. },
  25515. {
  25516. xtype: 'combobox',
  25517. fieldLabel: '操作数据库表',
  25518. labelWidth: 100,
  25519. publishes: 'singleTable.tableName',
  25520. displayField: 'value',
  25521. valueField: 'value',
  25522. bind: {
  25523. data: '{singleTableView.tableNameList}',
  25524. value: '{singleTable.tableName}',
  25525. },
  25526. },
  25527. {
  25528. xtype: 'checkboxfield',
  25529. fieldLabel: '需要删除',
  25530. labelWidth: 100,
  25531. bind: {
  25532. value: '{singleTable.delete}',
  25533. },
  25534. },
  25535. {
  25536. xtype: 'combobox',
  25537. fieldLabel: '删除条件字段',
  25538. labelWidth: 100,
  25539. publishes: 'singleTable.deleteWhereColumn',
  25540. displayField: 'value',
  25541. valueField: 'value',
  25542. bind: {
  25543. data: '{singleTableView.columnList}',
  25544. hidden: '{!singleTable.delete}',
  25545. value: '{singleTable.deleteWhereColumn}',
  25546. },
  25547. },
  25548. {
  25549. xtype: 'textfield',
  25550. fieldLabel: '删除提示语句',
  25551. labelWidth: 100,
  25552. bind: {
  25553. hidden: '{!singleTable.delete}',
  25554. value: '{singleTable.deleteTips}',
  25555. },
  25556. },
  25557. {
  25558. fieldLabel: '新增与编辑',
  25559. labelWidth: 100,
  25560. xtype: 'radiogroup',
  25561. bind: {
  25562. value: '{singleTable.editType}'
  25563. },
  25564. layout: 'vbox',
  25565. defaults: {
  25566. border: false,
  25567. anchor: '100%',
  25568. margin: '5',
  25569. },
  25570. items: [
  25571. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25572. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25573. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25574. ]
  25575. },
  25576. ]
  25577. }
  25578. ]
  25579. },
  25580. // ---------------------------------------------------------------------------------- 主/明细查询
  25581. {
  25582. vtitle: '主表查询SQL',
  25583. reference: 'mainDetailTable_1',
  25584. layout: 'fit',
  25585. listeners: {},
  25586. items: [],
  25587. },
  25588. {
  25589. vtitle: '主表字段选项',
  25590. reference: 'mainDetailTable_2',
  25591. layout: 'fit',
  25592. listeners: {},
  25593. items: [],
  25594. },
  25595. {
  25596. vtitle: '主表其他选项',
  25597. reference: 'mainDetailTable_3',
  25598. layout: 'fit',
  25599. listeners: {},
  25600. items: [],
  25601. },
  25602. {
  25603. vtitle: '子表查询SQL',
  25604. reference: 'mainDetailTable_4',
  25605. layout: 'fit',
  25606. listeners: {},
  25607. items: [],
  25608. },
  25609. {
  25610. vtitle: '子表字段选项',
  25611. reference: 'mainDetailTable_5',
  25612. layout: 'fit',
  25613. listeners: {},
  25614. items: [],
  25615. },
  25616. {
  25617. vtitle: '子表其他选项',
  25618. reference: 'mainDetailTable_6',
  25619. isEnd: true,
  25620. layout: 'fit',
  25621. listeners: {},
  25622. items: [],
  25623. },
  25624. // ---------------------------------------------------------------------------------- 树/明细查询
  25625. // ---------------------------------------------------------------------------------- 卡片表单
  25626. {
  25627. vtitle: '表单字段',
  25628. reference: 'cardForm_1',
  25629. layout: 'fit',
  25630. listeners: {},
  25631. items: [],
  25632. },
  25633. {
  25634. vtitle: '表单初始化',
  25635. reference: 'cardForm_2',
  25636. isEnd: true,
  25637. layout: 'fit',
  25638. listeners: {},
  25639. items: [],
  25640. },
  25641. ]
  25642. };
  25643. //# sourceMappingURL=CreateModule.view.js.map
  25644. // noinspection TypeScriptCheckImport
  25645. function getSingleTableData(origin) {
  25646. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25647. var _a, _b, _c;
  25648. var data = {
  25649. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25650. package: _$2.replace(origin.packagePath, /\//g, "."),
  25651. groovyClass: origin.moduleName,
  25652. qClass: queryDslInfo.qClass,
  25653. qClassTable: queryDslInfo.qClassTable,
  25654. queryColumns: [],
  25655. insertColumns: [],
  25656. updateColumns: [],
  25657. updateWheres: [],
  25658. deleteWheres: [],
  25659. gridColumns: [],
  25660. sql: origin.sql,
  25661. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25662. addButton: origin.editType !== 1,
  25663. saveButton: origin.editType === 2,
  25664. deleteButton: true,
  25665. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25666. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25667. fileSavePath: origin.fileSavePath,
  25668. };
  25669. origin.columnList.forEach(function (column) {
  25670. 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;
  25671. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25672. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25673. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25674. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25675. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25676. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25677. if (query) {
  25678. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25679. }
  25680. if (insert) {
  25681. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25682. }
  25683. if (update) {
  25684. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25685. }
  25686. if (grid) {
  25687. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25688. if (column_dict) {
  25689. gridColumn.fix = { dictName: column_dict };
  25690. }
  25691. if (origin.editType == 2 && (insert || update)) {
  25692. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25693. if (column_dict) {
  25694. gridColumn.editor.fix = { dictName: column_dict };
  25695. }
  25696. }
  25697. data.gridColumns.push(gridColumn);
  25698. }
  25699. if (is_primary_key) {
  25700. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25701. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25702. }
  25703. });
  25704. return data;
  25705. });
  25706. }
  25707. // noinspection HttpUrlsUsage
  25708. var urlPrefix = "/static/studio-template/single_table";
  25709. function generateCode(data) {
  25710. return Promise.all([
  25711. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25712. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25713. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25714. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25715. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25716. ]).then(function (values) {
  25717. var groovy = handlebars.compile(values[0]);
  25718. var mybatis = handlebars.compile(values[1]);
  25719. var controller = handlebars.compile(values[2]);
  25720. var view = handlebars.compile(values[3]);
  25721. var model = handlebars.compile(values[4]);
  25722. var code = {
  25723. groovy: groovy(data),
  25724. mybatis: mybatis(data),
  25725. controller: controller(data),
  25726. view: view(data),
  25727. model: model(data),
  25728. };
  25729. return code;
  25730. });
  25731. }
  25732. //# sourceMappingURL=SingleTableCodegen.js.map
  25733. var CreateModule = /** @class */ (function (_super) {
  25734. __extends(CreateModule, _super);
  25735. function CreateModule() {
  25736. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25737. _this.columns = [];
  25738. return _this;
  25739. }
  25740. CreateModule.prototype.onLoad = function () {
  25741. this.refs.grid1.setData([]);
  25742. };
  25743. CreateModule.prototype.addField = function () {
  25744. this.refs.grid1.appendEditRow({
  25745. column_name: '',
  25746. column_comment: '',
  25747. is_primary_key: false,
  25748. not_null: true,
  25749. column_domain: '',
  25750. data_type: '',
  25751. column_size: 0,
  25752. decimal_digits: 0,
  25753. default_value: '',
  25754. column_dict: '',
  25755. column_ui: '',
  25756. column_note: '',
  25757. }, 0);
  25758. };
  25759. CreateModule.prototype.removeField = function () {
  25760. var _this = this;
  25761. var rows = [];
  25762. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25763. rows.push(r);
  25764. });
  25765. _$2.forEach(rows, function (r) {
  25766. _this.refs.grid1.getStore().remove(r);
  25767. });
  25768. };
  25769. CreateModule.prototype.parseSQL = function (sender) {
  25770. var _this = this;
  25771. var sql = this.viewModel.get('singleTable.sql');
  25772. sender.up('window').setLoading(true);
  25773. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25774. parseSqlApi(sql).then(function (parseResult) {
  25775. if (!parseResult.success) {
  25776. msg(parseResult.msg);
  25777. return;
  25778. }
  25779. var tableNameList = [];
  25780. var columnList = [];
  25781. var singleTableTableName;
  25782. var singleTableDeleteWhereColumn;
  25783. _this.refs.grid1.setData([]);
  25784. var rows = _this.refs.grid1.getDataRows();
  25785. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25786. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25787. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25788. return;
  25789. }
  25790. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25791. tableNameList.push({ value: tableName });
  25792. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25793. columnList.push({ value: columnName });
  25794. if (!singleTableTableName)
  25795. singleTableTableName = tableName;
  25796. if (!singleTableDeleteWhereColumn)
  25797. singleTableDeleteWhereColumn = columnName;
  25798. // 已经加过这个列了
  25799. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25800. if (rowExists) {
  25801. return;
  25802. }
  25803. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25804. if (columnRow) {
  25805. _this.refs.grid1.appendEditRow({
  25806. table_name: tableName,
  25807. column_name: columnRow.column_name,
  25808. column_comment: columnRow.column_comment,
  25809. column_useto: 2,
  25810. is_primary_key: columnRow.is_primary_key,
  25811. not_null: columnRow.not_null,
  25812. column_size: columnRow.column_size,
  25813. column_dict: columnRow.column_dict,
  25814. column_ui: columnRow.column_ui,
  25815. data_type: columnRow.data_type,
  25816. });
  25817. if (columnRow.is_primary_key)
  25818. singleTableDeleteWhereColumn = columnName;
  25819. }
  25820. else {
  25821. _this.refs.grid1.appendEditRow({
  25822. table_name: tableName,
  25823. column_name: columnName,
  25824. column_useto: 2,
  25825. });
  25826. }
  25827. });
  25828. _this.viewModel.set("singleTableView.columnList", columnList);
  25829. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25830. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25831. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25832. }).finally(function () {
  25833. sender.up('window').setLoading(false);
  25834. });
  25835. }).catch(function () {
  25836. sender.up('window').setLoading(false);
  25837. });
  25838. };
  25839. CreateModule.prototype.templateEnter = function (sender) {
  25840. };
  25841. CreateModule.prototype.templateLevel = function (sender, opt) {
  25842. if (!this.viewModel.get('moduleType')) {
  25843. msg('请选择模板类型');
  25844. opt.cancel = true;
  25845. return;
  25846. }
  25847. };
  25848. CreateModule.prototype.moduleEnter = function (sender) {
  25849. };
  25850. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25851. if (!sender.down('form').isValid()) {
  25852. opt.cancel = true;
  25853. return;
  25854. }
  25855. };
  25856. CreateModule.prototype.editorEnter = function (sender) {
  25857. var editor = sender.down('sqleditor');
  25858. editor.setValue(this.viewModel.get('singleTable.sql'));
  25859. };
  25860. CreateModule.prototype.editorLevel = function (sender, opt) {
  25861. var editor = sender.down('sqleditor');
  25862. var sql = editor.getValue();
  25863. if (!sql) {
  25864. msg('查询SQL语句必填');
  25865. opt.cancel = true;
  25866. return;
  25867. }
  25868. this.viewModel.set('singleTable.sql', sql);
  25869. };
  25870. CreateModule.prototype.columnEnter = function (sender) {
  25871. };
  25872. CreateModule.prototype.columnLevel = function (sender, opt) {
  25873. };
  25874. CreateModule.prototype.extendEnter = function (sender) {
  25875. };
  25876. CreateModule.prototype.extendLevel = function (sender, opt) {
  25877. };
  25878. // 确认结果 - Enter
  25879. CreateModule.prototype.optionEnter = function (sender) {
  25880. var _this = this;
  25881. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25882. var moduleType = this.viewModel.get("moduleType");
  25883. var data = this.viewModel.getData();
  25884. var code = "";
  25885. var origin = {};
  25886. if (moduleType === 1) {
  25887. var singleTable = data.singleTable;
  25888. var editColumns = this.refs.grid1.getDataRows();
  25889. origin.moduleType = data.moduleType;
  25890. origin.packagePath = data.packagePath;
  25891. origin.fileSavePath = data.fileSavePath;
  25892. origin.moduleName = data.moduleName;
  25893. origin.pageTitle = data.pageTitle;
  25894. if (singleTable) {
  25895. origin.sql = singleTable.sql;
  25896. origin.tableName = singleTable.tableName;
  25897. origin.pagination = singleTable.pagination;
  25898. origin.delete = singleTable.delete;
  25899. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25900. origin.deleteTips = singleTable.deleteTips;
  25901. origin.editType = singleTable.editType;
  25902. }
  25903. origin.columnList = [];
  25904. origin.queryColumns = [];
  25905. origin.insertColumns = [];
  25906. origin.updateColumns = [];
  25907. origin.gridColumns = [];
  25908. editColumns.forEach(function (column) {
  25909. var row = {
  25910. table_name: column.table_name,
  25911. column_name: column.column_name,
  25912. column_comment: column.column_comment,
  25913. is_primary_key: column.is_primary_key,
  25914. not_null: column.not_null,
  25915. column_size: column.column_size,
  25916. column_dict: column.column_dict,
  25917. column_ui: column.column_ui,
  25918. data_type: column.data_type,
  25919. column_type: column.column_type,
  25920. };
  25921. origin.columnList.push(row);
  25922. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25923. var column_name = column.column_name, column_useto = column.column_useto;
  25924. switch (column_useto) {
  25925. case 1:
  25926. origin.queryColumns.push(column_name);
  25927. break;
  25928. case 2:
  25929. origin.gridColumns.push(column_name);
  25930. break;
  25931. case 3:
  25932. origin.queryColumns.push(column_name);
  25933. origin.gridColumns.push(column_name);
  25934. break;
  25935. }
  25936. origin.insertColumns.push(column_name);
  25937. origin.updateColumns.push(column_name);
  25938. });
  25939. }
  25940. this.setLoading(true);
  25941. getSingleTableData(origin).then(function (data) {
  25942. code = JSON.stringify(data, null, 4);
  25943. window['lastTemplateData'] = code;
  25944. var editor = _this.refs.jsoneditor;
  25945. editor.setCode(code);
  25946. }).finally(function () { return _this.setLoading(false); });
  25947. };
  25948. // 确认结果 - Level
  25949. CreateModule.prototype.optionLevel = function (sender, opt) {
  25950. };
  25951. // 上一步
  25952. CreateModule.prototype.showPrevious = function () {
  25953. this.doCardNavigation(false);
  25954. };
  25955. // 下一步
  25956. CreateModule.prototype.showNext = function () {
  25957. this.doCardNavigation(true, true);
  25958. };
  25959. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25960. if (isNext === void 0) { isNext = true; }
  25961. if (isCancelable === void 0) { isCancelable = false; }
  25962. var layout = this._handle.getLayout();
  25963. var activeItem = layout.activeItem;
  25964. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25965. if (isNext)
  25966. this.prevCard = reference;
  25967. var activeCard;
  25968. if (reference === "templateSelection") {
  25969. if (isNext) {
  25970. activeCard = this.refs['moduleName'];
  25971. }
  25972. }
  25973. else if (reference === "moduleName") {
  25974. if (isNext) {
  25975. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25976. var moduleType = this.viewModel.get("moduleType");
  25977. switch (moduleType) {
  25978. case 1:
  25979. activeCard = this.refs['singleTable_1'];
  25980. break;
  25981. case 2:
  25982. activeCard = this.refs['mainDetailTable_1'];
  25983. break;
  25984. case 3:
  25985. // activeCard =
  25986. break;
  25987. case 4:
  25988. activeCard = this.refs['cardForm_1'];
  25989. break;
  25990. }
  25991. }
  25992. else {
  25993. activeCard = this.refs['templateSelection'];
  25994. }
  25995. }
  25996. else if (reference === "confirmResult") {
  25997. if (!isNext) {
  25998. activeCard = this.refs[this.prevCard];
  25999. }
  26000. }
  26001. else {
  26002. var name = reference.split('_')[0];
  26003. var idx = parseInt(reference.split('_')[1], 10);
  26004. if (isNext) {
  26005. if (isEnd) {
  26006. activeCard = this.refs['confirmResult'];
  26007. }
  26008. else {
  26009. idx += 1;
  26010. }
  26011. }
  26012. else {
  26013. idx -= 1;
  26014. }
  26015. if (idx <= 0) {
  26016. activeCard = this.refs['moduleName'];
  26017. }
  26018. else if (!activeCard) {
  26019. activeCard = this.refs[name + "_" + idx];
  26020. }
  26021. }
  26022. // 按钮状态
  26023. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26024. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26025. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26026. // 设置下一页显示
  26027. if (activeCard) {
  26028. var optCancel = { cancel: false };
  26029. // 发出 cardLevel 事件
  26030. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26031. if (isCancelable && optCancel.cancel) {
  26032. // 取消了
  26033. return;
  26034. }
  26035. layout.setActiveItem(activeCard);
  26036. this.viewModel.set('title', layout.activeItem.vtitle);
  26037. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26038. }
  26039. };
  26040. // 立刻执行
  26041. CreateModule.prototype.finish = function (sender) {
  26042. var _this = this;
  26043. var parent = sender.up('window');
  26044. var editor = this.refs.jsoneditor;
  26045. var data = JSON.parse(editor.getCode());
  26046. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26047. var moduleType = this.viewModel.get("moduleType");
  26048. if (moduleType === 1) {
  26049. this.setLoading(true);
  26050. generateCode(data).then(function (code) {
  26051. console.log("===> ", code);
  26052. _this.setLoading(true);
  26053. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26054. .then(function () {
  26055. msg("创建成功!");
  26056. parent.close();
  26057. handles$1.fileTree.reload();
  26058. }).finally(function () { return _this.setLoading(false); });
  26059. }).finally(function () { return _this.setLoading(false); });
  26060. }
  26061. };
  26062. return CreateModule;
  26063. }(Scope));
  26064. //# sourceMappingURL=CreateModule.js.map
  26065. function getModuleId(path) {
  26066. var separator = "/";
  26067. var sps = path.split(separator);
  26068. var joinSps = sps.join('$');
  26069. if (!joinSps) {
  26070. return "ROOT";
  26071. }
  26072. return joinSps;
  26073. }
  26074. /**
  26075. * Module数据转换成Tree数据
  26076. */
  26077. function modulesToTreeData(modules) {
  26078. var separator = "/";
  26079. var treeNodeMap = new Map();
  26080. var root = {
  26081. type: "Dir",
  26082. path: "",
  26083. expanded: true,
  26084. leaf: false,
  26085. children: [],
  26086. };
  26087. root.id = getModuleId(root.path);
  26088. treeNodeMap.set(root.path, root);
  26089. modules.forEach(function (module) {
  26090. var _a;
  26091. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26092. if (paths.length <= 0)
  26093. return;
  26094. var path = [];
  26095. var parent = root;
  26096. paths.forEach(function (dirName, idx) {
  26097. var parentPath = path.join(separator);
  26098. parent = treeNodeMap.get(parentPath);
  26099. path.push(dirName);
  26100. var currentPath = path.join(separator);
  26101. var child = treeNodeMap.get(currentPath);
  26102. if (child == null) {
  26103. // 获取当前path 绝对路径
  26104. var indexLength = module.absolutePath.indexOf(currentPath);
  26105. var currentAbsolutePath = "";
  26106. if (indexLength > 0) {
  26107. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26108. }
  26109. child = {
  26110. type: "Dir",
  26111. path: currentPath,
  26112. absolutePath: currentAbsolutePath,
  26113. leaf: false,
  26114. children: [],
  26115. text: dirName
  26116. };
  26117. child.id = getModuleId(child.path);
  26118. parent.children.push(child);
  26119. treeNodeMap.set(child.path, child);
  26120. }
  26121. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26122. var leaf = {
  26123. type: "Module",
  26124. path: module.path + separator + module.name,
  26125. absolutePath: module.absolutePath,
  26126. leaf: true,
  26127. text: module.name,
  26128. module: module,
  26129. };
  26130. leaf.id = getModuleId(leaf.path);
  26131. child.children.push(leaf);
  26132. treeNodeMap.set(leaf.path, leaf);
  26133. }
  26134. });
  26135. });
  26136. // 排序处理
  26137. treeNodeMap.forEach(function (module) {
  26138. if (module.children) {
  26139. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26140. module.children.length = 0;
  26141. children.forEach(function (item) { return module.children.push(item); });
  26142. }
  26143. });
  26144. return root;
  26145. }
  26146. function showDialog(sender, option) {
  26147. var _a, _b;
  26148. var win = new Ext.Window({
  26149. autoDestroy: true,
  26150. title: option.title,
  26151. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26152. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26153. resizable: false,
  26154. closable: true,
  26155. modal: true,
  26156. maximizable: false,
  26157. minimizable: false,
  26158. // constrainHeader: true,
  26159. constrain: true,
  26160. layout: 'fit',
  26161. animateTarget: sender,
  26162. buttonAlign: 'center',
  26163. items: [
  26164. {
  26165. xtype: "form",
  26166. layout: "hbox",
  26167. margin: '10px 20px',
  26168. border: 0,
  26169. items: option.items
  26170. }
  26171. ],
  26172. //窗口按钮
  26173. fbar: [
  26174. {
  26175. xtype: 'button', text: '保存', handler: function (btn) {
  26176. //窗口获取表单
  26177. var form = win.down('form');
  26178. var vaildSuccess = form.isValid();
  26179. if (!vaildSuccess) {
  26180. return;
  26181. }
  26182. option.submitFunc(form);
  26183. }
  26184. },
  26185. {
  26186. xtype: 'button', text: '取消', handler: function (btn) {
  26187. //窗口关闭
  26188. btn.up('window').close();
  26189. }
  26190. }
  26191. ],
  26192. });
  26193. win.show();
  26194. }
  26195. function showCreateFolderWin(sender, parentPath) {
  26196. showDialog(sender, {
  26197. title: '新建文件夹',
  26198. height: 150,
  26199. items: [
  26200. {
  26201. xtype: "textfield",
  26202. name: "filename",
  26203. fieldLabel: "文件夹名称",
  26204. allowBlank: false,
  26205. selectOnFocus: true,
  26206. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26207. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26208. labelWidth: 80,
  26209. width: "100%",
  26210. listeners: {
  26211. afterrender: function (sender) {
  26212. _$2.defer(function () {
  26213. sender.focus();
  26214. });
  26215. }
  26216. }
  26217. },
  26218. ],
  26219. submitFunc: function (form) {
  26220. var filename = form.down('textfield[name="filename"]').getValue();
  26221. createFolder(parentPath, filename).then(function (res) {
  26222. if (res.success) {
  26223. msg$1('创建成功');
  26224. handles$1.fileTree.reload();
  26225. form.up('window').close();
  26226. }
  26227. else {
  26228. showErrorDialog$1(res.msg);
  26229. }
  26230. }).catch(function (e) {
  26231. showErrorDialog$1(e.responseJSON.msg);
  26232. });
  26233. }
  26234. });
  26235. }
  26236. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26237. var dlg = new CreateModule();
  26238. dlg.showDialog(sender, {}, {
  26239. data: {
  26240. packagePath: path,
  26241. fileSavePath: absolutePath,
  26242. }
  26243. });
  26244. }
  26245. function registerModule$1(sender, path, name, icon) {
  26246. // 前缀 com/galaxis/wms 写死了
  26247. var dlg = new RegisterModule();
  26248. dlg.showDialog(sender, {}, {
  26249. data: {
  26250. form: {
  26251. scope_url: path.replace("com/galaxis/wms", "."),
  26252. resource_name: name,
  26253. resource_icon: icon,
  26254. }
  26255. }
  26256. });
  26257. }
  26258. function showCreateEmptyModule(sender, path) {
  26259. var win = new Ext.Window({
  26260. autoDestroy: true,
  26261. title: "新建空模块",
  26262. width: 400,
  26263. height: 150,
  26264. resizable: true,
  26265. closable: true,
  26266. maximizable: true,
  26267. minimizable: true,
  26268. plain: true,
  26269. // constrainHeader: true,
  26270. constrain: true,
  26271. layout: 'fit',
  26272. animateTarget: sender,
  26273. buttonAlign: 'center',
  26274. items: [
  26275. {
  26276. xtype: "form",
  26277. layout: "hbox",
  26278. margin: '10px 20px',
  26279. border: 0,
  26280. items: [
  26281. {
  26282. flex: 1,
  26283. layout: 'vbox',
  26284. items: [
  26285. {
  26286. xtype: "textfield",
  26287. name: "filename",
  26288. fieldLabel: "模块名",
  26289. flex: 1,
  26290. allowBlank: false,
  26291. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26292. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26293. labelWidth: 50,
  26294. width: "100%",
  26295. },
  26296. ]
  26297. },
  26298. ]
  26299. }
  26300. ],
  26301. //窗口按钮
  26302. buttons: [
  26303. {
  26304. xtype: 'button', text: '保存', handler: function (btn) {
  26305. //窗口获取表单
  26306. var form = win.down('form');
  26307. var vaildSuccess = form.isValid();
  26308. if (!vaildSuccess) {
  26309. return;
  26310. }
  26311. var filename = form.down('textfield[name="filename"]').getValue();
  26312. createEmptyModule(path, filename).then(function (res) {
  26313. if (res.success) {
  26314. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26315. handles$1.fileTree.reload();
  26316. win.close();
  26317. }
  26318. else {
  26319. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26320. }
  26321. }).catch(function (e) {
  26322. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26323. });
  26324. }
  26325. },
  26326. {
  26327. xtype: 'button', text: '取消', handler: function (btn) {
  26328. //窗口关闭
  26329. win.close();
  26330. }
  26331. }
  26332. ]
  26333. });
  26334. win.show();
  26335. }
  26336. //# sourceMappingURL=FileHelp.js.map
  26337. function initFileTree () {
  26338. Ext.define('com.yvan.studio.FileTree', {
  26339. extend: 'com.yvan.studio.StateTree',
  26340. xtype: 'filetree',
  26341. tooltip: '文件',
  26342. iconCls: 'x-fa fa-file',
  26343. rootVisible: false,
  26344. useArrows: true,
  26345. colspan: 2,
  26346. lines: true,
  26347. reference: 'filetree',
  26348. multiSelect: true,
  26349. getStateFilename: function () {
  26350. return getCurrentProject().uuid + "/filetree.json";
  26351. },
  26352. openNode: function () {
  26353. var selection = this.getSelection();
  26354. var _a = __read(selection, 1), record = _a[0];
  26355. if (!record) {
  26356. return;
  26357. }
  26358. var raw = record.raw;
  26359. if (raw.type === 'Dir') {
  26360. return;
  26361. }
  26362. if (raw.type === "Module" && raw.module) {
  26363. eventBus.publish(EventType.ModuleOpen, raw);
  26364. }
  26365. },
  26366. openInIdea: function () {
  26367. var _a = __read(this.getSelection(), 1), record = _a[0];
  26368. if (record) {
  26369. var data = record.data;
  26370. if (data.type === "Module") {
  26371. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26372. native.openInIdea(data.module.groovyFile.absolutePath);
  26373. }
  26374. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26375. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26376. }
  26377. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26378. native.openInIdea(data.module.jsViewFile.absolutePath);
  26379. }
  26380. return;
  26381. }
  26382. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26383. }
  26384. },
  26385. deleteSelection: function () {
  26386. var selection = this.getSelection();
  26387. var pathList = [];
  26388. _.forEach(selection, function (item) {
  26389. if (item.data.type === "Dir") {
  26390. pathList.push({ path: item.data.path, isFolder: true });
  26391. }
  26392. else {
  26393. pathList.push({ path: item.data.path, isFolder: false });
  26394. }
  26395. });
  26396. {
  26397. return;
  26398. }
  26399. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26400. //
  26401. // Ext.Msg.confirm('提示', title, (btn) => {
  26402. // if (btn === 'yes') {
  26403. // deleteFileOrFolder(raw.path, title, true)
  26404. // }
  26405. // })
  26406. // const title = '您确定要删除(' + raw.path + ')吗?'
  26407. // deleteFileOrFolder(raw.path, title, false)
  26408. },
  26409. listeners: {
  26410. itemverify: function () {
  26411. this.openNode();
  26412. },
  26413. afterrender: function (me) {
  26414. console.log('filetree_afterrender', 'reloadIfNeed');
  26415. moduleStore.registe(me.subscribeModule.bind(this));
  26416. moduleStore.reloadIfNeed("PC");
  26417. },
  26418. destroy: function (me) {
  26419. console.log('filetree_destroy');
  26420. moduleStore.unregiste(me.subscribeModule.bind(this));
  26421. },
  26422. itemcontextmenu: function (sender, node, element, idx, e) {
  26423. e.preventDefault();
  26424. var raw = node.raw;
  26425. var option = {};
  26426. if (raw.type === 'Dir') {
  26427. // 文件夹右键
  26428. option = {
  26429. shadow: 'frame', allowOtherMenus: true,
  26430. items: [
  26431. {
  26432. text: '新建空模块',
  26433. iconCls: 'x-fa fa-plus-circle',
  26434. handler: function (sender) {
  26435. showCreateEmptyModule(sender, raw.path);
  26436. }
  26437. },
  26438. {
  26439. text: '新建模块',
  26440. iconCls: 'x-fa fa-plus-circle',
  26441. handler: function (sender) {
  26442. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26443. }
  26444. },
  26445. '-',
  26446. {
  26447. text: '新建文件夹',
  26448. iconCls: 'x-fa fa-folder-o',
  26449. handler: function (sender) {
  26450. var parentPath = raw.path;
  26451. showCreateFolderWin(sender, parentPath);
  26452. }
  26453. },
  26454. {
  26455. text: '复制路径',
  26456. iconCls: 'x-fa fa-external-link',
  26457. handler: function (sender) {
  26458. native.clipboardSet(raw.path);
  26459. }
  26460. },
  26461. ]
  26462. };
  26463. }
  26464. else {
  26465. // 文件右键
  26466. option = {
  26467. shadow: 'frame', allowOtherMenus: true,
  26468. items: [
  26469. // {
  26470. // text: '重命名',
  26471. // iconCls: 'x-fa fa-terminal',
  26472. // handler(sender) {
  26473. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26474. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26475. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26476. // }
  26477. // },
  26478. // {
  26479. // text: '另存为',
  26480. // iconCls: 'x-fa fa-exchange',
  26481. // handler(sender) {
  26482. // console.error('没做')
  26483. // }
  26484. // },
  26485. {
  26486. text: '复制路径',
  26487. iconCls: 'x-fa fa-external-link',
  26488. handler: function (sender) {
  26489. native.clipboardSet(raw.path);
  26490. }
  26491. },
  26492. '-',
  26493. {
  26494. text: '注册模块',
  26495. iconCls: 'x-fa fa-sign-in',
  26496. handler: function (sender) {
  26497. registerModule$1(sender, raw.path);
  26498. }
  26499. },
  26500. ]
  26501. };
  26502. }
  26503. var treeMenu = new Ext.menu.Menu(option);
  26504. treeMenu.showAt(e.getXY());
  26505. },
  26506. },
  26507. tbar: [
  26508. {
  26509. xtype: 'button',
  26510. iconCls: 'x-fa fa-crosshairs',
  26511. tooltip: '选中当前打开的文件',
  26512. handler: function (sender) {
  26513. msg$1('没做');
  26514. }
  26515. },
  26516. {
  26517. xtype: 'button',
  26518. iconCls: 'x-fa fa-link',
  26519. tooltip: '在IDEA中打开',
  26520. handler: function (sender) {
  26521. var scope = sender.up("filetree");
  26522. scope.openInIdea();
  26523. }
  26524. },
  26525. {
  26526. xtype: 'button',
  26527. iconCls: 'x-fa fa-refresh',
  26528. tooltip: '刷新',
  26529. handler: function (sender) {
  26530. var scope = sender.up("filetree");
  26531. scope.reload();
  26532. }
  26533. },
  26534. {
  26535. xtype: 'button',
  26536. iconCls: 'x-fa fa-percent',
  26537. tooltip: '监控',
  26538. handler: function (sender) {
  26539. // handles.mainWindow.showPerform()
  26540. }
  26541. },
  26542. ],
  26543. initComponent: function () {
  26544. setFileTree(this);
  26545. this.superclass.initComponent.apply(this, arguments);
  26546. // super.initComponent.apply(this, arguments)
  26547. },
  26548. subscribeModule: function (res) {
  26549. if (typeof res === 'object') {
  26550. var rootNode = modulesToTreeData(res.data);
  26551. this.setRootNode(rootNode);
  26552. this.restoreState();
  26553. handles$1.mainWindow.modules = res.data;
  26554. }
  26555. else if (typeof res === 'boolean') {
  26556. this.setLoading(res);
  26557. }
  26558. },
  26559. reload: function () {
  26560. console.log('filetree_reloadForce');
  26561. moduleStore.reloadForce("PC").then(function (res) {
  26562. });
  26563. }
  26564. });
  26565. }
  26566. //# sourceMappingURL=FileTree.js.map
  26567. function initDbTree () {
  26568. var define = {
  26569. extend: 'com.yvan.studio.StateTree',
  26570. xtype: 'dbtree',
  26571. tooltip: '数据库',
  26572. iconCls: 'x-fa fa-database',
  26573. rootVisible: false,
  26574. useArrows: true,
  26575. reference: 'dbtree',
  26576. multiSelect: true,
  26577. getStateFilename: function () {
  26578. return getCurrentProject().uuid + "/dbtree.json";
  26579. },
  26580. tbar: [
  26581. {
  26582. xtype: 'button',
  26583. iconCls: 'x-fa fa-crosshairs',
  26584. tooltip: '选中当前打开的表',
  26585. handler: function (sender) {
  26586. var _a;
  26587. // 获取当前选中的活动标签 tableColumn_bas_car
  26588. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26589. if (!locatPath) {
  26590. return;
  26591. }
  26592. handles$1.dbTree.selectPath(locatPath);
  26593. }
  26594. },
  26595. {
  26596. xtype: 'button',
  26597. iconCls: 'x-fa fa-refresh',
  26598. tooltip: '刷新',
  26599. handler: function (sender) {
  26600. handles$1.dbTree.reload();
  26601. }
  26602. },
  26603. {
  26604. xtype: 'button',
  26605. iconCls: 'x-fa fa-cloud-download',
  26606. tooltip: '重新拉取生成元数据(耗时很长!)',
  26607. handler: function (sender) {
  26608. handles$1.dbTree.dbToMetaAndReload(sender);
  26609. }
  26610. },
  26611. // {
  26612. // xtype: 'button',
  26613. // iconCls: 'x-fa fa-files-o',
  26614. // tooltip: '数据同步',
  26615. // handler(sender) {
  26616. //
  26617. // }
  26618. // },
  26619. {
  26620. xtype: 'button',
  26621. iconCls: 'x-fa fa-exchange',
  26622. tooltip: '数据结构同步',
  26623. handler: function (sender) {
  26624. // handles.mainWindow.showDataSync(sender)
  26625. }
  26626. },
  26627. {
  26628. xtype: 'button',
  26629. iconCls: 'x-fa fa-window-maximize',
  26630. tooltip: 'SQL查询分析器',
  26631. handler: function (sender) {
  26632. // handles.mainWindow.showDbCodeTemplate(sender)
  26633. }
  26634. },
  26635. {
  26636. xtype: 'button',
  26637. iconCls: 'x-fa fa-cubes',
  26638. tooltip: '数据域管理',
  26639. handler: function (sender) {
  26640. // handles.mainWindow.showColumnDomain()
  26641. }
  26642. },
  26643. {
  26644. xtype: 'button',
  26645. iconCls: 'x-fa fa-edit',
  26646. tooltip: '修改结构',
  26647. handler: function (sender) {
  26648. var tree = sender.up("treepanel");
  26649. var selection = tree.getSelection();
  26650. var _a = __read(selection, 1), node = _a[0];
  26651. if (!node) {
  26652. msg$1('请选择一个表');
  26653. return;
  26654. }
  26655. var raw = node.data.raw;
  26656. if (node.get('type') === 'table') ;
  26657. else if (node.get('type') === 'column') ;
  26658. }
  26659. },
  26660. ],
  26661. listeners: {
  26662. afterrender: function (me) {
  26663. setDbTree(this);
  26664. // 找管理器订阅刷新的事件
  26665. instance$1.registe(this.refreshData.bind(this));
  26666. instance$1.reloadIfNeed(undefined);
  26667. },
  26668. destory: function (me) {
  26669. setDbTree(undefined);
  26670. instance$1.unregiste(this.refreshData.bind(this));
  26671. },
  26672. itemcontextmenu: function (sender, node, element, idx, e) {
  26673. var _this = this;
  26674. e.preventDefault();
  26675. var option = {};
  26676. var raw = node.raw.raw;
  26677. if (node.get('type') === 'column') {
  26678. option = {
  26679. shadow: 'frame', allowOtherMenus: true,
  26680. items: [
  26681. {
  26682. text: '设计结构',
  26683. iconCls: 'x-fa fa-edit',
  26684. handler: function (sender) {
  26685. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26686. }
  26687. },
  26688. ]
  26689. };
  26690. }
  26691. else if (node.get('type') === 'table') {
  26692. option = {
  26693. shadow: 'frame', allowOtherMenus: true,
  26694. items: [
  26695. {
  26696. text: '新建',
  26697. iconCls: 'x-fa fa-plus',
  26698. handler: function (sender) {
  26699. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26700. }
  26701. },
  26702. {
  26703. text: '设计结构',
  26704. iconCls: 'x-fa fa-edit',
  26705. handler: function (sender) {
  26706. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26707. }
  26708. },
  26709. {
  26710. text: '重命名',
  26711. iconCls: 'x-fa fa-pencil',
  26712. handler: function (sender) {
  26713. _this.renameTable(sender, node.data.raw);
  26714. }
  26715. },
  26716. '-',
  26717. {
  26718. text: '删除',
  26719. iconCls: 'x-fa fa-minus',
  26720. handler: function (sender) {
  26721. _this.removeTable(sender, node.data.raw);
  26722. }
  26723. },
  26724. ]
  26725. };
  26726. }
  26727. var treeMenu = new Ext.menu.Menu(option);
  26728. treeMenu.showAt(e.getXY());
  26729. }
  26730. },
  26731. // DbTreeStore 刷新时,会回调到这个方法
  26732. refreshData: function (isLoadingState) {
  26733. var me = this;
  26734. if (typeof isLoadingState === 'boolean') {
  26735. me.setLoading(isLoadingState);
  26736. return;
  26737. }
  26738. var rootNode = getDbTree(instance$1.apiResponse);
  26739. me.setRootNode(rootNode);
  26740. this.restoreState();
  26741. },
  26742. renameTable: function (sender, tableRow) {
  26743. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26744. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26745. if (!res.data)
  26746. return;
  26747. var window = Ext.create('Ext.window.Window', {
  26748. title: 'SQL 预览',
  26749. height: 400,
  26750. width: 600,
  26751. modal: true,
  26752. animateTarget: sender,
  26753. maximizable: true,
  26754. layout: 'fit',
  26755. items: {
  26756. xtype: 'sqleditor',
  26757. value: res.data,
  26758. },
  26759. buttons: [
  26760. {
  26761. xtype: 'button',
  26762. text: '执行',
  26763. iconCls: 'x-fa fa-save',
  26764. handler: function (sender) {
  26765. var editor = sender.up('window').down('sqleditor');
  26766. var ddl = editor.getValue();
  26767. window.setLoading(true);
  26768. instance$1.pushToDbCommit({
  26769. schema_name: tableRow.schema_name,
  26770. table_name: name,
  26771. old_table_name: tableRow.table_name,
  26772. ddl: ddl,
  26773. }).then(function () {
  26774. handles$1.dbTree.reload();
  26775. window.close();
  26776. }).finally(function () { return window.setLoading(false); });
  26777. },
  26778. },
  26779. {
  26780. xtype: 'button',
  26781. text: '取消',
  26782. iconCls: 'x-fa fa-times',
  26783. handler: function () {
  26784. window.close();
  26785. }
  26786. },
  26787. ]
  26788. }).show();
  26789. });
  26790. });
  26791. },
  26792. removeTable: function (sender, tableRow) {
  26793. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26794. if (!res.data)
  26795. return;
  26796. var window = Ext.create('Ext.window.Window', {
  26797. title: 'SQL 预览',
  26798. height: 400,
  26799. width: 600,
  26800. modal: true,
  26801. animateTarget: sender,
  26802. maximizable: true,
  26803. layout: 'fit',
  26804. items: {
  26805. xtype: 'sqleditor',
  26806. value: res.data,
  26807. },
  26808. buttons: [
  26809. {
  26810. xtype: 'button',
  26811. text: '执行',
  26812. iconCls: 'x-fa fa-save',
  26813. handler: function (sender) {
  26814. var editor = sender.up('window').down('sqleditor');
  26815. var ddl = editor.getValue();
  26816. window.setLoading(true);
  26817. instance$1.pushToDbCommit({
  26818. schema_name: tableRow.schema_name,
  26819. table_name: tableRow.table_name,
  26820. ddl: ddl
  26821. })
  26822. .then(function () {
  26823. handles$1.dbTree.reload();
  26824. window.close();
  26825. }).finally(function () { return window.setLoading(false); });
  26826. }
  26827. },
  26828. {
  26829. xtype: 'button',
  26830. text: '取消',
  26831. iconCls: 'x-fa fa-times',
  26832. handler: function () {
  26833. window.close();
  26834. }
  26835. }
  26836. ]
  26837. }).show();
  26838. });
  26839. },
  26840. // hideHeaders: true,
  26841. // columns: [
  26842. // {
  26843. // xtype: 'treecolumn',
  26844. // text: '名称',
  26845. // dataIndex: 'text',
  26846. // flex: 2,
  26847. // }, {
  26848. // text: '描述',
  26849. // dataIndex: 'comment',
  26850. // flex: 1,
  26851. // }
  26852. // ],
  26853. reload: function () {
  26854. // 强制刷新 DbManager
  26855. instance$1.reloadForce(undefined);
  26856. },
  26857. dbToMetaAndReload: function () {
  26858. // 从数据库结构重新生成元数据
  26859. instance$1.dbToMetaAndReload();
  26860. }
  26861. };
  26862. Ext.define('com.yvan.studio.DbTree', define);
  26863. }
  26864. /**
  26865. * 将数据构建成 dbTree 需要的格式
  26866. */
  26867. function getDbTree(apiResponse) {
  26868. var rootNode = {
  26869. children: [],
  26870. expanded: true,
  26871. id: "ROOT",
  26872. leaf: false,
  26873. };
  26874. _$2.forEach(apiResponse, function (schemaRow) {
  26875. var schemaNode = {
  26876. id: 'schema$' + schemaRow.schema_name,
  26877. type: "schema",
  26878. expanded: true,
  26879. leaf: false,
  26880. iconCls: 'x-fa fa-th-large ',
  26881. text: schemaRow.schema_name,
  26882. raw: __assign({}, schemaRow),
  26883. children: [],
  26884. };
  26885. delete schemaNode.raw.table_list;
  26886. rootNode.children.push(schemaNode);
  26887. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26888. var _a;
  26889. var tableNode = {
  26890. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26891. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26892. comment: tableRow.description,
  26893. type: "table",
  26894. iconCls: 'x-fa fa-table',
  26895. expanded: false,
  26896. leaf: false,
  26897. children: [],
  26898. raw: __assign({}, tableRow)
  26899. };
  26900. delete tableNode.raw.column_list;
  26901. schemaNode.children.push(tableNode);
  26902. _$2.forEach(tableRow.column_list, function (columnRow) {
  26903. var _a;
  26904. var iconCls = 'x-fa fa-square-o';
  26905. if (columnRow.is_primary_key) {
  26906. iconCls = 'x-fa fa-key';
  26907. }
  26908. else if (columnRow.not_null) {
  26909. iconCls = 'x-fa fa-check-square';
  26910. }
  26911. var columnNode = {
  26912. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26913. type: "column",
  26914. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26915. comment: columnRow.column_comment,
  26916. leaf: true,
  26917. iconCls: iconCls,
  26918. raw: __assign({}, columnRow)
  26919. };
  26920. tableNode.children.push(columnNode);
  26921. }); // column
  26922. }); // table
  26923. }); // schema
  26924. return rootNode;
  26925. }
  26926. //# sourceMappingURL=DbTree.js.map
  26927. var ReportGridController = /** @class */ (function () {
  26928. function ReportGridController() {
  26929. }
  26930. ReportGridController.prototype.onLoad = function (sender) {
  26931. this.reload();
  26932. setReport(this);
  26933. };
  26934. ReportGridController.prototype.showSingle = function (sender) {
  26935. var _this = this;
  26936. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26937. if (record) {
  26938. handles.mainWindow.showFormSingle(record.data, function () {
  26939. _this.reload();
  26940. });
  26941. }
  26942. };
  26943. ReportGridController.prototype.filterChanged = function (sender, value) {
  26944. console.log('filterChange', sender, value);
  26945. this.view.store.clearFilter();
  26946. if (value) {
  26947. this.view.store.filterBy(function (record) {
  26948. var code = _.lowerCase(record.get('report_name'));
  26949. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26950. return (code.includes(value) ||
  26951. dict_desc_py.includes(value));
  26952. });
  26953. }
  26954. };
  26955. ReportGridController.prototype.onClearClick = function () {
  26956. var _a, _b;
  26957. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26958. };
  26959. ReportGridController.prototype.reload = function () {
  26960. var me = this;
  26961. me.getView().setLoading(true);
  26962. reportListApi().then(function (res) {
  26963. _.forEach(res.data, function (r) {
  26964. r.report_enable = r.report_enable === 1;
  26965. });
  26966. me.getView().setStore(new Ext.data.Store({
  26967. fields: ['report_id', 'report_name', 'report_enable'],
  26968. data: res.data,
  26969. }));
  26970. }).finally(function () {
  26971. me.getView().setLoading(false);
  26972. });
  26973. };
  26974. ReportGridController.prototype.reportAdd = function () {
  26975. var _this = this;
  26976. prompt$2('请输入报表名称').then(function (name) {
  26977. createReportApi(name).then(function (res) {
  26978. if (res.success) {
  26979. msg$1('添加成功');
  26980. handles.mainWindow.showReport(res.data, name, function () {
  26981. _this.reload();
  26982. });
  26983. }
  26984. _this.reload();
  26985. });
  26986. });
  26987. };
  26988. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26989. e.preventDefault();
  26990. var me = sender.up('grid').ownerGrid.getController();
  26991. var option = {
  26992. shadow: 'frame', allowOtherMenus: true,
  26993. items: [
  26994. {
  26995. text: '添加',
  26996. iconCls: 'x-fa fa-plus-circle',
  26997. handler: function (sender) {
  26998. me.reportAdd();
  26999. }
  27000. },
  27001. {
  27002. text: '编辑',
  27003. iconCls: 'x-fa fa-edit',
  27004. handler: function (sender) {
  27005. me.reportEdit();
  27006. }
  27007. },
  27008. {
  27009. text: '删除',
  27010. iconCls: 'x-fa fa-minus-circle',
  27011. handler: function (sender) {
  27012. me.reportRemove();
  27013. }
  27014. },
  27015. '-',
  27016. {
  27017. text: '注册(至菜单)',
  27018. iconCls: 'x-fa fa-sign-in',
  27019. handler: function (sender) {
  27020. me.reportRegiste(sender);
  27021. }
  27022. },
  27023. {
  27024. text: '卸载',
  27025. iconCls: 'x-fa fa-sign-out',
  27026. handler: function (sender) {
  27027. console.error('没做');
  27028. }
  27029. },
  27030. ]
  27031. };
  27032. var treeMenu = new Ext.menu.Menu(option);
  27033. treeMenu.showAt(e.getXY());
  27034. };
  27035. ReportGridController.prototype.reportRegiste = function (sender) {
  27036. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27037. if (record) {
  27038. var reportName = record.get('report_name');
  27039. var reportId = record.get('report_id');
  27040. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27041. }
  27042. };
  27043. ReportGridController.prototype.reportRemove = function () {
  27044. var _this = this;
  27045. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27046. if (record) {
  27047. var reportName = record.get('report_name');
  27048. var reportId_1 = record.get('report_id');
  27049. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27050. delReportApi(reportId_1).then(function (res) {
  27051. if (res.success) {
  27052. msg$1('删除成功');
  27053. _this.reload();
  27054. }
  27055. });
  27056. });
  27057. }
  27058. };
  27059. ReportGridController.prototype.reportEdit = function () {
  27060. var _this = this;
  27061. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27062. if (record) {
  27063. var reportName = record.get('report_name');
  27064. var reportId = record.get('report_id');
  27065. handles.mainWindow.showReport(reportId, reportName, function () {
  27066. _this.reload();
  27067. });
  27068. }
  27069. };
  27070. ReportGridController.prototype.onDblClick = function (sender) {
  27071. this.reportEdit();
  27072. };
  27073. return ReportGridController;
  27074. }());
  27075. //# sourceMappingURL=ReportGridController.js.map
  27076. function initReportGrid () {
  27077. var controller = new ReportGridController();
  27078. Ext.define('com.yvan.studio.ReportGrid', {
  27079. extend: 'Ext.grid.Panel',
  27080. xtype: 'reportGrid',
  27081. controller: controller,
  27082. scope: controller,
  27083. referenceHolder: true,
  27084. tooltip: '查询报表',
  27085. iconCls: 'x-fa fa-bar-chart',
  27086. useArrows: true,
  27087. reference: 'reportgrid',
  27088. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27089. listeners: {
  27090. itemdblclick: 'onDblClick',
  27091. afterrender: 'onLoad',
  27092. },
  27093. viewConfig: {
  27094. enableTextSelection: true,
  27095. listeners: {
  27096. itemcontextmenu: 'onGridContextMenu',
  27097. },
  27098. },
  27099. tbar: {
  27100. xtype: 'toolbar',
  27101. items: [
  27102. {
  27103. xtype: 'button',
  27104. tooltip: '测试',
  27105. iconCls: 'x-fa fa-bars',
  27106. listeners: {
  27107. click: 'showSingle'
  27108. }
  27109. },
  27110. {
  27111. xtype: 'button',
  27112. tooltip: '刷新',
  27113. iconCls: 'x-fa fa-refresh',
  27114. listeners: {
  27115. click: 'reload'
  27116. }
  27117. },
  27118. {
  27119. xtype: 'button',
  27120. tooltip: '添加',
  27121. iconCls: 'x-fa fa-plus-circle',
  27122. listeners: {
  27123. click: 'reportAdd'
  27124. }
  27125. },
  27126. {
  27127. xtype: 'button',
  27128. tooltip: '删除',
  27129. iconCls: 'x-fa fa-minus-circle',
  27130. listeners: {
  27131. click: 'reportRemove'
  27132. }
  27133. },
  27134. {
  27135. xtype: 'textfield',
  27136. flex: 1,
  27137. reference: "txtFilter",
  27138. emptyText: '搜索过滤',
  27139. enableKeyEvents: true,
  27140. listeners: {
  27141. change: {
  27142. fn: 'filterChanged',
  27143. buffer: 50
  27144. }
  27145. }
  27146. },
  27147. ]
  27148. },
  27149. columns: [
  27150. {
  27151. text: 'ID', dataIndex: 'report_id',
  27152. hidden: true,
  27153. },
  27154. {
  27155. text: '报表名称', dataIndex: 'report_name',
  27156. flex: 1,
  27157. },
  27158. ]
  27159. });
  27160. }
  27161. //# sourceMappingURL=ReportGrid.js.map
  27162. /** 所有变量类型 */
  27163. var TypeEnum;
  27164. (function (TypeEnum) {
  27165. TypeEnum["string"] = "string";
  27166. TypeEnum["number"] = "number";
  27167. TypeEnum["object"] = "object";
  27168. TypeEnum["array"] = "array";
  27169. TypeEnum["function"] = "function";
  27170. TypeEnum["null"] = "null";
  27171. TypeEnum["boolean"] = "boolean";
  27172. TypeEnum["symbol"] = "symbol";
  27173. TypeEnum["json"] = "json";
  27174. TypeEnum["math"] = "math";
  27175. TypeEnum["regexp"] = "regexp";
  27176. TypeEnum["date"] = "date";
  27177. TypeEnum["undefined"] = "undefined";
  27178. TypeEnum["nan"] = "nan";
  27179. TypeEnum["reactNode"] = "react_node";
  27180. })(TypeEnum || (TypeEnum = {}));
  27181. /**
  27182. * 判断对象类型
  27183. * @param object 对象
  27184. */
  27185. var variableTypeOf = function (object) {
  27186. var typeStr = Object.prototype.toString.call(object);
  27187. var typeName;
  27188. switch (("" + typeStr).toLowerCase()) {
  27189. case '[object string]':
  27190. typeName = TypeEnum.string;
  27191. break;
  27192. case '[object number]':
  27193. if (Number.isNaN(object)) {
  27194. return TypeEnum.nan;
  27195. }
  27196. typeName = TypeEnum.number;
  27197. break;
  27198. case '[object object]':
  27199. if (object.$$typeof && object.props) {
  27200. var type = variableTypeOf(object.$$typeof);
  27201. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27202. return TypeEnum.reactNode;
  27203. }
  27204. }
  27205. typeName = TypeEnum.object;
  27206. break;
  27207. case '[object array]':
  27208. typeName = TypeEnum.array;
  27209. break;
  27210. case '[object function]':
  27211. typeName = TypeEnum.function;
  27212. break;
  27213. case '[object null]':
  27214. typeName = TypeEnum.null;
  27215. break;
  27216. case '[object boolean]':
  27217. typeName = TypeEnum.boolean;
  27218. break;
  27219. case '[object date]':
  27220. typeName = TypeEnum.date;
  27221. break;
  27222. // 不常用
  27223. case '[object symbol]':
  27224. typeName = TypeEnum.symbol;
  27225. break;
  27226. case '[object json]':
  27227. typeName = TypeEnum.json;
  27228. break;
  27229. case '[object math]':
  27230. typeName = TypeEnum.math;
  27231. break;
  27232. case '[object regexp]':
  27233. typeName = TypeEnum.regexp;
  27234. break;
  27235. // 貌似不会走的分支
  27236. case '[object undefined]':
  27237. typeName = TypeEnum.undefined;
  27238. break;
  27239. // 无法识别
  27240. default:
  27241. if (object === undefined) {
  27242. return TypeEnum.undefined;
  27243. }
  27244. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27245. typeName = TypeEnum.object;
  27246. }
  27247. return typeName;
  27248. };
  27249. //# sourceMappingURL=typeof.js.map
  27250. function initGroovyEditor () {
  27251. Ext.define('com.yvan.studio.GroovyEditor', {
  27252. extend: 'Ext.panel.Panel',
  27253. alias: 'widget.groovyeditor',
  27254. xtype: 'groovyeditor',
  27255. layout: 'fit',
  27256. border: false,
  27257. html: "<div class=\"editor\"/>",
  27258. config: {
  27259. value: ''
  27260. },
  27261. codeChange: undefined,
  27262. isChangeFromOuter: false,
  27263. getCode: function () {
  27264. if (this.editor) {
  27265. return this.editor.getValue();
  27266. }
  27267. else {
  27268. return this.code;
  27269. }
  27270. },
  27271. setCode: function (value) {
  27272. var _this = this;
  27273. this.code = value;
  27274. this.value = value;
  27275. _$2.defer(function () {
  27276. _this.isChangeFromOuter = true;
  27277. if (_this.editor) {
  27278. _this.editor.setValue(value);
  27279. }
  27280. });
  27281. },
  27282. applyPosition: function () {
  27283. var _this = this;
  27284. if (this.autoFocusMethod) {
  27285. if (this.editor) {
  27286. _$2.defer(function () {
  27287. if (_this.autoFocusStartLine) {
  27288. _this.editor.setPosition({
  27289. lineNumber: _this.autoFocusStartLine,
  27290. column: _this.autoFocusStartColumn
  27291. });
  27292. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27293. }
  27294. _this.editor.focus();
  27295. });
  27296. delete this.autoFocusMethod;
  27297. }
  27298. }
  27299. this.editor.layout();
  27300. },
  27301. getValue: function () {
  27302. return this.value;
  27303. },
  27304. setValue: function (value, fromEditor) {
  27305. var me = this;
  27306. if (me.value === value) {
  27307. // 值相等,不需要变化
  27308. return;
  27309. }
  27310. if (fromEditor !== true && me.editor) {
  27311. // 不是来源于编辑器的变化,才设置编辑器的值
  27312. me.editor.setValue(value);
  27313. }
  27314. // 通知mixins setValue
  27315. me.value = value;
  27316. me.fireEvent('change', value);
  27317. },
  27318. initComponent: function () {
  27319. var that = this;
  27320. this.superclass.initComponent.call(this, arguments);
  27321. that.on({
  27322. resize: function () {
  27323. if (that.editor) {
  27324. that.editor.layout();
  27325. }
  27326. },
  27327. destory: function () {
  27328. if (that.editor) {
  27329. that.editor.dispose();
  27330. delete that.editor;
  27331. }
  27332. },
  27333. afterrender: function (sender) {
  27334. var $dom = $(that.el.dom).find('.editor');
  27335. attach_3($dom[0], {
  27336. value: that.code
  27337. }).then(function (editor) {
  27338. that.editor = editor;
  27339. that.applyPosition();
  27340. that.editor.onDidChangeModelContent(function (e) {
  27341. that.fireEvent('change', that.editor, e);
  27342. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27343. that.codeChange(that.editor.getValue(), that.name, e);
  27344. }
  27345. that.isChangeFromOuter = false;
  27346. });
  27347. });
  27348. }
  27349. });
  27350. }
  27351. });
  27352. }
  27353. function attach_3(element, opts) {
  27354. return new Promise(function (resolve) {
  27355. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27356. enabled: false
  27357. } }));
  27358. editor.onKeyUp(function (e) {
  27359. // console.log(e)
  27360. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27361. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27362. }
  27363. });
  27364. resolve(editor);
  27365. });
  27366. }
  27367. //# sourceMappingURL=GroovyEditor.js.map
  27368. function initJsEditor$1 () {
  27369. Ext.define('com.yvan.studio.JsEditor', {
  27370. extend: 'Ext.panel.Panel',
  27371. alias: 'widget.jseditor',
  27372. xtype: 'jseditor',
  27373. layout: 'fit',
  27374. border: false,
  27375. html: "<div class=\"editor\"/>",
  27376. autoFocusMethod: true,
  27377. autoFocusStartLine: 0,
  27378. autoFocusStartColumn: 0,
  27379. codeChange: undefined,
  27380. funcArr: [],
  27381. modulePage: null,
  27382. isChangeFromOuter: false,
  27383. name: "",
  27384. /**
  27385. * 设置代码
  27386. */
  27387. setCode: function (value) {
  27388. var _this = this;
  27389. this.code = value;
  27390. _$2.defer(function () {
  27391. _this.isChangeFromOuter = true;
  27392. if (_this.editor) {
  27393. _this.editor.setValue(value);
  27394. if (_this.name === "controllerEditor") {
  27395. _this.funcArr = _this.getAllFunction();
  27396. }
  27397. }
  27398. });
  27399. },
  27400. getCode: function () {
  27401. var _a;
  27402. if (!this.editor) {
  27403. return this.code;
  27404. }
  27405. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27406. },
  27407. applyPosition: function () {
  27408. var _this = this;
  27409. if (this.autoFocusMethod) {
  27410. if (this.editor) {
  27411. _$2.defer(function () {
  27412. if (_this.autoFocusStartLine) {
  27413. _this.editor.setPosition({
  27414. lineNumber: _this.autoFocusStartLine,
  27415. column: _this.autoFocusStartColumn
  27416. });
  27417. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27418. }
  27419. _this.editor.focus();
  27420. });
  27421. delete this.autoFocusMethod;
  27422. }
  27423. }
  27424. this.editor.layout();
  27425. },
  27426. initComponent: function () {
  27427. var that = this;
  27428. this.superclass.initComponent.apply(this, arguments);
  27429. this.on({
  27430. resize: function (sender, width, height) {
  27431. if (that.editor) {
  27432. that.editor.layout();
  27433. }
  27434. },
  27435. destory: function () {
  27436. if (that.editor) {
  27437. that.editor.dispose();
  27438. delete that.editor;
  27439. }
  27440. },
  27441. afterrender: function () {
  27442. var $dom = $(that.el.dom).find('.editor');
  27443. attach_1($dom[0], {
  27444. value: that.code
  27445. }).then(function (editor) {
  27446. that.editor = editor;
  27447. that.applyPosition();
  27448. that.editor.onDidChangeModelContent(function (e) {
  27449. that.fireEvent('change', that.editor, e);
  27450. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27451. that.codeChange(that.editor.getValue(), that.name, e);
  27452. }
  27453. that.isChangeFromOuter = false;
  27454. });
  27455. });
  27456. }
  27457. });
  27458. },
  27459. getAllFunction: function () {
  27460. var funcArr = [];
  27461. var ast = window['YvanUI'].recast.parse(this.code);
  27462. if (ast && ast.program && ast.program.body) {
  27463. if (Array.isArray(ast.program.body)) {
  27464. for (var i = 0; i < ast.program.body.length; i++) {
  27465. var m = ast.program.body[i];
  27466. if (m.type === "ExportDefaultDeclaration") {
  27467. if (m.declaration.type === "ClassDeclaration") {
  27468. if (m.declaration.body.type === "ClassBody") {
  27469. if (Array.isArray(m.declaration.body.body)) {
  27470. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27471. var ob = m.declaration.body.body[j];
  27472. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27473. var funcItem = { name: ob.key.name, args: [] };
  27474. if (Array.isArray(ob.value.params)) {
  27475. for (var k = 0; k < ob.value.params.length; k++) {
  27476. var p = ob.value.params[k];
  27477. funcItem.args.push(p.name);
  27478. }
  27479. }
  27480. funcArr.push(funcItem);
  27481. }
  27482. }
  27483. }
  27484. }
  27485. }
  27486. }
  27487. }
  27488. }
  27489. }
  27490. return funcArr;
  27491. }
  27492. });
  27493. }
  27494. var isInited = false;
  27495. function attach_1(element, opts) {
  27496. return new Promise(function (resolve) {
  27497. var monaco = window['monaco'];
  27498. if (!isInited) {
  27499. isInited = true;
  27500. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27501. noSemanticValidation: true,
  27502. noSyntaxValidation: false
  27503. });
  27504. // compiler options
  27505. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27506. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27507. allowNonTsExtensions: true,
  27508. });
  27509. // extra libraries
  27510. var libSource = [
  27511. 'declare class Facts {',
  27512. ' /**',
  27513. ' * Returns the next fact',
  27514. ' */',
  27515. ' static next():string',
  27516. ' static next222():string',
  27517. '}',
  27518. "\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 ",
  27519. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27520. ].join('\n');
  27521. var libUri = 'file:///index.d.ts';
  27522. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27523. // When resolving definitions and references, the editor will try to use created models.
  27524. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27525. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27526. }
  27527. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27528. resolve(editor);
  27529. });
  27530. }
  27531. //# sourceMappingURL=JsEditor.js.map
  27532. function initJsonEditor$1 () {
  27533. Ext.define('com.yvan.studio.JsonEditor', {
  27534. extend: 'Ext.panel.Panel',
  27535. alias: 'widget.jsoneditor',
  27536. xtype: 'jsoneditor',
  27537. layout: 'fit',
  27538. border: false,
  27539. html: "<div class=\"editor\"/>",
  27540. autoFocusMethod: true,
  27541. autoFocusStartLine: 0,
  27542. autoFocusStartColumn: 0,
  27543. codeChange: undefined,
  27544. funcArr: [],
  27545. modulePage: null,
  27546. isChangeFromOuter: false,
  27547. name: "",
  27548. /**
  27549. * 设置代码
  27550. */
  27551. setCode: function (value) {
  27552. var _this = this;
  27553. this.code = value;
  27554. _$2.defer(function () {
  27555. _this.isChangeFromOuter = true;
  27556. if (_this.editor) {
  27557. _this.editor.setValue(value);
  27558. }
  27559. });
  27560. },
  27561. updateOptions: function (options) {
  27562. if (this.editor && options) {
  27563. this.editor.updateOptions(options);
  27564. }
  27565. },
  27566. setLanguage: function (lang) {
  27567. if (this.editor && lang) {
  27568. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27569. }
  27570. },
  27571. getCode: function () {
  27572. var _a;
  27573. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27574. },
  27575. applyPosition: function () {
  27576. var _this = this;
  27577. if (this.autoFocusMethod) {
  27578. if (this.editor) {
  27579. _$2.defer(function () {
  27580. if (_this.autoFocusStartLine) {
  27581. _this.editor.setPosition({
  27582. lineNumber: _this.autoFocusStartLine,
  27583. column: _this.autoFocusStartColumn
  27584. });
  27585. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27586. }
  27587. _this.editor.focus();
  27588. });
  27589. delete this.autoFocusMethod;
  27590. }
  27591. }
  27592. this.editor.layout();
  27593. },
  27594. initComponent: function () {
  27595. var that = this;
  27596. this.superclass.initComponent.apply(this, arguments);
  27597. this.on({
  27598. resize: function (sender, width, height) {
  27599. if (that.editor) {
  27600. that.editor.layout();
  27601. }
  27602. },
  27603. destory: function () {
  27604. if (that.editor) {
  27605. that.editor.dispose();
  27606. delete that.editor;
  27607. }
  27608. },
  27609. afterrender: function (sender) {
  27610. var $dom = $(that.el.dom).find('.editor');
  27611. attach_116($dom[0], {
  27612. value: that.code
  27613. }).then(function (editor) {
  27614. that.editor = editor;
  27615. that.applyPosition();
  27616. that.editor.onDidChangeModelContent(function (e) {
  27617. that.fireEvent('change', that.editor, e);
  27618. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27619. that.codeChange(that.editor.getValue(), that.name, e);
  27620. }
  27621. that.isChangeFromOuter = false;
  27622. });
  27623. });
  27624. }
  27625. });
  27626. },
  27627. });
  27628. }
  27629. function attach_116(element, opts) {
  27630. return new Promise(function (resolve) {
  27631. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27632. enabled: false
  27633. } }));
  27634. editor.onKeyUp(function (e) {
  27635. // console.log(e)
  27636. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27637. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27638. }
  27639. });
  27640. resolve(editor);
  27641. });
  27642. }
  27643. //# sourceMappingURL=JsonEditor.js.map
  27644. function initSqlEditor$1 () {
  27645. Ext.define('com.yvan.studio.SqlEditor', {
  27646. extend: 'Ext.panel.Panel',
  27647. alias: 'widget.sqleditor',
  27648. xtype: 'sqleditor',
  27649. layout: 'fit',
  27650. border: false,
  27651. html: "<div class=\"editor\"/>",
  27652. config: {
  27653. value: ''
  27654. },
  27655. codeChange: undefined,
  27656. isChangeFromOuter: false,
  27657. setCode: function (value) {
  27658. var _this = this;
  27659. this.code = value;
  27660. this.value = value;
  27661. _$2.defer(function () {
  27662. _this.isChangeFromOuter = true;
  27663. if (_this.editor) {
  27664. _this.editor.setValue(value);
  27665. }
  27666. });
  27667. },
  27668. getCode: function () {
  27669. return this.getValue();
  27670. },
  27671. updateOptions: function (options) {
  27672. if (this.editor && options) {
  27673. this.editor.updateOptions(options);
  27674. }
  27675. },
  27676. getValue: function () {
  27677. if (!this.editor) {
  27678. return this.code;
  27679. }
  27680. return this.editor.getValue();
  27681. },
  27682. applyPosition: function () {
  27683. var _this = this;
  27684. if (this.autoFocusMethod) {
  27685. if (this.editor) {
  27686. _$2.defer(function () {
  27687. if (_this.autoFocusStartLine) {
  27688. _this.editor.setPosition({
  27689. lineNumber: _this.autoFocusStartLine,
  27690. column: _this.autoFocusStartColumn
  27691. });
  27692. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27693. }
  27694. _this.editor.focus();
  27695. });
  27696. delete this.autoFocusMethod;
  27697. }
  27698. }
  27699. this.editor.layout();
  27700. },
  27701. setValue: function (value, fromEditor) {
  27702. this.setCode(value);
  27703. var me = this;
  27704. if (me.value === value) {
  27705. // 值相等,不需要变化
  27706. return;
  27707. }
  27708. if (fromEditor !== true && me.editor) {
  27709. // 不是来源于编辑器的变化,才设置编辑器的值
  27710. me.editor.setValue(value);
  27711. }
  27712. // 通知mixins setValue
  27713. me.value = value;
  27714. me.fireEvent('change', value);
  27715. },
  27716. initComponent: function () {
  27717. var that = this;
  27718. this.superclass.initComponent.call(this);
  27719. that.on({
  27720. resize: function () {
  27721. if (that.editor) {
  27722. that.editor.layout();
  27723. }
  27724. },
  27725. destory: function () {
  27726. if (that.editor) {
  27727. that.editor.dispose();
  27728. delete that.editor;
  27729. }
  27730. },
  27731. afterrender: function (sender) {
  27732. var $dom = $(that.el.dom).find('.editor');
  27733. attach_2($dom[0], {
  27734. value: that.code
  27735. }).then(function (editor) {
  27736. that.editor = editor;
  27737. that.applyPosition();
  27738. that.editor.onDidChangeModelContent(function (e) {
  27739. that.fireEvent('change', that.editor, e);
  27740. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27741. that.codeChange(that.editor.getValue(), that.name, e);
  27742. }
  27743. that.isChangeFromOuter = false;
  27744. });
  27745. });
  27746. }
  27747. });
  27748. }
  27749. });
  27750. }
  27751. function attach_2(element, opts) {
  27752. return new Promise(function (resolve) {
  27753. var monaco = window['monaco'];
  27754. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27755. enabled: false
  27756. } }));
  27757. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27758. // const sql = editor.getValue()
  27759. // if (_.trim(sql).length > 0) {
  27760. // editor.setValue(format(sql, {
  27761. // indent: ' ',
  27762. // uppercase: true,
  27763. // }))
  27764. // }
  27765. msg$1('没做');
  27766. });
  27767. editor.onKeyUp(function (e) {
  27768. // console.log(e)
  27769. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27770. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27771. }
  27772. });
  27773. resolve(editor);
  27774. });
  27775. }
  27776. //# sourceMappingURL=SqlEditor.js.map
  27777. function initTemplateEditor () {
  27778. Ext.define('com.yvan.studio.TemplateEditor', {
  27779. extend: 'Ext.panel.Panel',
  27780. alias: 'widget.templateeditor',
  27781. xtype: 'templateeditor',
  27782. layout: 'fit',
  27783. border: false,
  27784. html: "<div class=\"editor\"/>",
  27785. autoFocusMethod: true,
  27786. autoFocusStartLine: 0,
  27787. autoFocusStartColumn: 0,
  27788. codeChange: undefined,
  27789. funcArr: [],
  27790. modulePage: null,
  27791. isChangeFromOuter: false,
  27792. name: "",
  27793. /**
  27794. * 设置代码
  27795. */
  27796. setCode: function (value) {
  27797. var _this = this;
  27798. this.code = value;
  27799. _$2.defer(function () {
  27800. _this.isChangeFromOuter = true;
  27801. if (_this.editor) {
  27802. _this.editor.setValue(value);
  27803. }
  27804. });
  27805. },
  27806. getCode: function () {
  27807. var _a;
  27808. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27809. },
  27810. applyPosition: function () {
  27811. var _this = this;
  27812. if (this.autoFocusMethod) {
  27813. if (this.editor) {
  27814. _$2.defer(function () {
  27815. if (_this.autoFocusStartLine) {
  27816. _this.editor.setPosition({
  27817. lineNumber: _this.autoFocusStartLine,
  27818. column: _this.autoFocusStartColumn
  27819. });
  27820. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27821. }
  27822. _this.editor.focus();
  27823. });
  27824. delete this.autoFocusMethod;
  27825. }
  27826. }
  27827. this.editor.layout();
  27828. },
  27829. initComponent: function () {
  27830. var that = this;
  27831. this.superclass.initComponent.apply(this, arguments);
  27832. this.on({
  27833. resize: function (sender, width, height) {
  27834. if (that.editor) {
  27835. that.editor.layout();
  27836. }
  27837. },
  27838. destory: function () {
  27839. if (that.editor) {
  27840. that.editor.dispose();
  27841. delete that.editor;
  27842. }
  27843. },
  27844. afterrender: function (sender) {
  27845. var $dom = $(that.el.dom).find('.editor');
  27846. attach_117($dom[0], {
  27847. value: that.code
  27848. }).then(function (editor) {
  27849. that.editor = editor;
  27850. that.applyPosition();
  27851. that.editor.onDidChangeModelContent(function (e) {
  27852. that.fireEvent('change', that.editor, e);
  27853. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27854. that.codeChange(that.editor.getValue(), that.name, e);
  27855. }
  27856. that.isChangeFromOuter = false;
  27857. });
  27858. });
  27859. }
  27860. });
  27861. },
  27862. });
  27863. }
  27864. function attach_117(element, opts) {
  27865. return new Promise(function (resolve) {
  27866. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27867. enabled: false
  27868. } }));
  27869. editor.onKeyUp(function (e) {
  27870. // console.log(e)
  27871. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27872. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27873. }
  27874. });
  27875. resolve(editor);
  27876. });
  27877. }
  27878. //# sourceMappingURL=TemplateEditor.js.map
  27879. var DictStore = /** @class */ (function (_super) {
  27880. __extends(DictStore, _super);
  27881. function DictStore() {
  27882. return _super !== null && _super.apply(this, arguments) || this;
  27883. }
  27884. DictStore.prototype.getCacheKey = function (param) {
  27885. return "dict_data.json";
  27886. };
  27887. DictStore.prototype.invokeApi = function (param) {
  27888. return getDict(param);
  27889. };
  27890. DictStore.prototype.getDicts = function () {
  27891. return this.apiResponse.data.dict;
  27892. };
  27893. DictStore.prototype.getDictCodes = function () {
  27894. return new Promise(function (resolve) {
  27895. // reloadIfNeedPromise().then(() => {
  27896. // const result = []
  27897. // _.forEach(this.getDicts(), dictRow => {
  27898. // result.push({
  27899. // id: dictRow.dict_code,
  27900. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27901. // })
  27902. // })
  27903. // resolve(result)
  27904. // })
  27905. });
  27906. };
  27907. DictStore.prototype.saveDict = function (param) {
  27908. return saveDictApi(param);
  27909. };
  27910. DictStore.prototype.saveDictItems = function (param) {
  27911. return saveDictItemsApi(param);
  27912. };
  27913. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27914. var results = [];
  27915. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27916. if (dictItemRow.dict_code === dict_code) {
  27917. results.push(_$2.clone(dictItemRow));
  27918. }
  27919. });
  27920. return results;
  27921. };
  27922. return DictStore;
  27923. }(CacheStore));
  27924. var instance$2 = new DictStore();
  27925. //# sourceMappingURL=DictStore.js.map
  27926. var DictTreeController = /** @class */ (function () {
  27927. function DictTreeController() {
  27928. this._saveStateFlag = true;
  27929. }
  27930. DictTreeController.prototype.dictSave = function () {
  27931. var _this = this;
  27932. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27933. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27934. if (err) {
  27935. // 如果有异常就不保存
  27936. return;
  27937. }
  27938. // 进行业务上的逻辑校验,比如说必填校验等等
  27939. var hasError = false;
  27940. _$2.forEach(rows, function (row, i) {
  27941. if (isEmpty(row.dict_code)) {
  27942. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27943. hasError = true;
  27944. return false;
  27945. }
  27946. });
  27947. if (hasError) {
  27948. return;
  27949. }
  27950. // 设置当前界面为 "保存中..." 状态
  27951. this.view.setLoading(true);
  27952. instance$2.saveDict({
  27953. newRows: newRows,
  27954. modifyRows: modifyRows,
  27955. removeRecords: removeRecords,
  27956. }).then(function (res) {
  27957. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27958. msg$1(res.msg);
  27959. _this.reload();
  27960. }).finally(function () {
  27961. // 无论正常异常,关闭 "保存中..." 状态
  27962. _this.view.setLoading(false);
  27963. });
  27964. };
  27965. DictTreeController.prototype.dictItemSave = function () {
  27966. var _this = this;
  27967. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27968. var currentDictCode = undefined;
  27969. if (record) {
  27970. currentDictCode = record.get('dict_code');
  27971. }
  27972. if (!currentDictCode) {
  27973. msg$1('请选择一个字典');
  27974. return;
  27975. }
  27976. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27977. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27978. if (err) {
  27979. // 如果有异常就不保存
  27980. return;
  27981. }
  27982. // 进行业务上的逻辑校验,比如说必填校验等等
  27983. var hasError = false;
  27984. _$2.forEach(rows, function (row, i) {
  27985. if (!row.dict_value && row.dict_value !== 0) {
  27986. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27987. hasError = true;
  27988. return false;
  27989. }
  27990. });
  27991. if (hasError) {
  27992. return;
  27993. }
  27994. // 设置当前界面为 "保存中..." 状态
  27995. this.view.setLoading(true);
  27996. instance$2.saveDictItems({
  27997. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27998. newRows: newRows,
  27999. modifyRows: modifyRows,
  28000. removeRecords: removeRecords,
  28001. dict_code: currentDictCode
  28002. }).then(function (res) {
  28003. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28004. msg$1(res.msg);
  28005. _this.reload();
  28006. }).finally(function () {
  28007. // 无论正常异常,关闭 "保存中..." 状态
  28008. _this.view.setLoading(false);
  28009. });
  28010. };
  28011. DictTreeController.prototype.createDictEnum = function () {
  28012. var _this = this;
  28013. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28014. var currentDictCode = undefined;
  28015. if (record) {
  28016. currentDictCode = record.get('dict_code');
  28017. }
  28018. if (!currentDictCode) {
  28019. msg$1('请选择一个字典');
  28020. return;
  28021. }
  28022. // 设置当前界面为 "保存中..." 状态
  28023. this.view.setLoading(true);
  28024. createDictEnum({ dictCode: currentDictCode })
  28025. .then(function () { return _this.reload(); })
  28026. .finally(function () { return _this.view.setLoading(false); });
  28027. };
  28028. DictTreeController.prototype.onLoad = function () {
  28029. setDictTree(this);
  28030. this.grid1 = this.view.lookupReference('grid1');
  28031. this.grid2 = this.view.lookupReference('grid2');
  28032. this.grid1.setData([]);
  28033. this.grid2.setData([]);
  28034. // this.grid1.columns[0].hide()
  28035. this.grid2.columns[0].hide();
  28036. // 找管理器订阅刷新的事件
  28037. instance$2.registe(this.refreshData.bind(this));
  28038. // 非强制性刷新 DbManager
  28039. instance$2.reloadIfNeed(undefined);
  28040. };
  28041. DictTreeController.prototype.onDestory = function () {
  28042. instance$2.unregiste(this.refreshData.bind(this));
  28043. };
  28044. // dictStore 刷新时,会回调到这个方法
  28045. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28046. var me = this;
  28047. if (typeof isLoadingState === 'boolean') {
  28048. me.view.setLoading(isLoadingState);
  28049. return;
  28050. }
  28051. this.grid1.setData(instance$2.getDicts());
  28052. this.restoreState();
  28053. };
  28054. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28055. var _this = this;
  28056. _$2.defer(function () {
  28057. _this.saveState();
  28058. });
  28059. if (!record) {
  28060. this.grid2.setData([]);
  28061. return;
  28062. }
  28063. var dict_code = record.get('dict_code');
  28064. var data = instance$2.getDictItemByDictcode(dict_code);
  28065. this.grid2.setData(data);
  28066. };
  28067. DictTreeController.prototype.reload = function () {
  28068. var _this = this;
  28069. // 强制刷新 DbManager
  28070. instance$2.reloadForce(undefined).then(function (res) {
  28071. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28072. });
  28073. };
  28074. DictTreeController.prototype.dictAdd = function () {
  28075. this.grid1.appendEditRow({
  28076. _createFlag: true,
  28077. dict_code: '',
  28078. dict_desc: '',
  28079. }, 0);
  28080. };
  28081. DictTreeController.prototype.dictRemove = function () {
  28082. this.grid1.removeEditRow();
  28083. };
  28084. DictTreeController.prototype.dictItemAdd = function () {
  28085. var _a, _b;
  28086. 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;
  28087. if (!dict_code) {
  28088. msg$1('请先保存字典');
  28089. return;
  28090. }
  28091. this.grid2.appendEditRow({
  28092. dict_code: dict_code,
  28093. dict_text: '',
  28094. dict_value: '',
  28095. }, 0);
  28096. };
  28097. DictTreeController.prototype.dictItemRemove = function () {
  28098. var _this = this;
  28099. var rows = [];
  28100. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28101. rows.push(r);
  28102. });
  28103. _$2.forEach(rows, function (r) {
  28104. _this.grid2.getStore().remove(r);
  28105. });
  28106. };
  28107. DictTreeController.prototype.clearSearch1 = function () {
  28108. this.grid1.store.clearFilter();
  28109. };
  28110. DictTreeController.prototype.search1 = function (sender) {
  28111. this.grid1.store.clearFilter();
  28112. this.getViewModel().set('grid1.selection', null);
  28113. this.grid1.fireEvent('itemselect');
  28114. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28115. if (!value) {
  28116. return;
  28117. }
  28118. this.grid1.store.filterBy(function (record) {
  28119. if (record.get('_createFlag')) {
  28120. return true;
  28121. }
  28122. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28123. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28124. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28125. return (dict_code.includes(value) ||
  28126. dict_desc.includes(value) ||
  28127. dict_desc_py.includes(value));
  28128. });
  28129. };
  28130. DictTreeController.prototype.clearSearch2 = function () {
  28131. this.grid2.store.clearFilter();
  28132. };
  28133. DictTreeController.prototype.search2 = function (sender) {
  28134. this.grid2.store.clearFilter();
  28135. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28136. if (!value) {
  28137. return;
  28138. }
  28139. this.grid2.store.filterBy(function (record) {
  28140. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28141. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28142. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28143. return (dict_text.includes(value) ||
  28144. dict_value === value ||
  28145. dict_text_py.includes(value));
  28146. });
  28147. };
  28148. DictTreeController.prototype.getStateFilename = function () {
  28149. return getCurrentProject().uuid + "/dicttree.json";
  28150. };
  28151. DictTreeController.prototype.restoreState = function () {
  28152. var _this = this;
  28153. var grid = this.grid1;
  28154. native.loadFile(this.getStateFilename(), function (content) {
  28155. if (!content)
  28156. return;
  28157. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28158. _this._saveStateFlag = false;
  28159. if (selection) {
  28160. var idx = grid.store.findExact('dict_code', selection);
  28161. if (idx >= 0) {
  28162. var record = grid.store.getAt(idx);
  28163. if (record) {
  28164. grid.setSelection([record]);
  28165. }
  28166. }
  28167. }
  28168. if (scrollPosition && scrollSize) {
  28169. var size = grid.scrollable.getSize();
  28170. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28171. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28172. }
  28173. }
  28174. setTimeout(function () {
  28175. _this._saveStateFlag = true;
  28176. }, 200);
  28177. });
  28178. };
  28179. DictTreeController.prototype.saveState = function () {
  28180. if (!this._saveStateFlag) {
  28181. return;
  28182. }
  28183. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28184. var selection = undefined;
  28185. if (record) {
  28186. selection = record.get('dict_code');
  28187. }
  28188. var scrollPosition = this.grid1.scrollable.position;
  28189. var scrollSize = this.grid1.scrollable.getSize();
  28190. native.saveFile(this.getStateFilename(), {
  28191. selection: selection,
  28192. scrollPosition: scrollPosition,
  28193. scrollSize: scrollSize
  28194. });
  28195. };
  28196. return DictTreeController;
  28197. }());
  28198. //# sourceMappingURL=DictTreeController.js.map
  28199. function initDict$1 () {
  28200. var controller = new DictTreeController();
  28201. Ext.define('com.yvan.studio.DictTree', {
  28202. extend: 'Ext.panel.Panel',
  28203. xtype: 'dicttree',
  28204. controller: controller,
  28205. scope: controller,
  28206. referenceHolder: true,
  28207. tooltip: '字典',
  28208. iconCls: 'x-fa fa-book',
  28209. rootVisible: false,
  28210. useArrows: true,
  28211. reference: 'dicttree',
  28212. layout: 'border',
  28213. listeners: {
  28214. afterrender: 'onLoad',
  28215. destory: 'onDestory',
  28216. },
  28217. items: [
  28218. {
  28219. region: 'center',
  28220. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28221. _mode: 'select',
  28222. tbar: [
  28223. {
  28224. xtype: 'button',
  28225. tooltip: '刷新',
  28226. iconCls: 'x-fa fa-refresh',
  28227. listeners: {
  28228. click: 'reload'
  28229. }
  28230. },
  28231. {
  28232. xtype: 'button',
  28233. tooltip: '添加',
  28234. iconCls: 'x-fa fa-plus-circle',
  28235. listeners: {
  28236. click: 'dictAdd'
  28237. }
  28238. },
  28239. {
  28240. xtype: 'button',
  28241. tooltip: '删除',
  28242. iconCls: 'x-fa fa-minus-circle',
  28243. bind: {
  28244. disabled: '{!grid1.selection}'
  28245. },
  28246. listeners: {
  28247. click: 'dictRemove'
  28248. }
  28249. },
  28250. {
  28251. xtype: 'button',
  28252. tooltip: '保存',
  28253. iconCls: 'x-fa fa-save',
  28254. bind: {
  28255. disabled: '{!grid1.ischanged}'
  28256. },
  28257. listeners: {
  28258. click: 'dictSave'
  28259. }
  28260. },
  28261. {
  28262. xtype: 'textfield',
  28263. hideClear: true,
  28264. triggers: {
  28265. clear: {
  28266. cls: 'x-form-clear-trigger',
  28267. handler: 'clearSearch1'
  28268. },
  28269. },
  28270. flex: 1,
  28271. emptyText: '搜索过滤',
  28272. enableKeyEvents: true,
  28273. listeners: {
  28274. keyup: {
  28275. fn: 'search1',
  28276. buffer: 50
  28277. }
  28278. }
  28279. },
  28280. ],
  28281. listeners: {
  28282. itemselect: 'grid1Selected',
  28283. },
  28284. idField: 'dict_code',
  28285. columns: [
  28286. {
  28287. text: '字典编号', dataIndex: 'dict_code',
  28288. menuDisabled: true, flex: 1,
  28289. editor: {
  28290. allowBlank: true,
  28291. selectOnFocus: false
  28292. }
  28293. },
  28294. {
  28295. text: '中文描述', dataIndex: 'dict_desc',
  28296. menuDisabled: true, flex: 1,
  28297. editor: {
  28298. allowBlank: true,
  28299. selectOnFocus: false
  28300. }
  28301. },
  28302. ]
  28303. },
  28304. {
  28305. region: 'south', height: '50%',
  28306. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28307. split: true,
  28308. _mode: 'edit1',
  28309. listeners: {},
  28310. tbar: [
  28311. {
  28312. xtype: 'button',
  28313. tooltip: '添加',
  28314. iconCls: 'x-fa fa-plus-circle',
  28315. bind: {
  28316. disabled: '{!grid1.selection}'
  28317. },
  28318. listeners: {
  28319. click: 'dictItemAdd'
  28320. }
  28321. },
  28322. {
  28323. xtype: 'button',
  28324. tooltip: '删除',
  28325. iconCls: 'x-fa fa-minus-circle',
  28326. bind: {
  28327. disabled: '{!grid1.selection}'
  28328. },
  28329. listeners: {
  28330. click: 'dictItemRemove'
  28331. }
  28332. },
  28333. {
  28334. xtype: 'button',
  28335. tooltip: '保存',
  28336. iconCls: 'x-fa fa-save',
  28337. bind: {
  28338. disabled: '{!grid2.ischanged}'
  28339. },
  28340. listeners: {
  28341. click: 'dictItemSave'
  28342. }
  28343. },
  28344. {
  28345. xtype: 'button',
  28346. tooltip: '刷新代码',
  28347. iconCls: 'x-fa fa-code',
  28348. bind: {
  28349. disabled: '{!grid1.selection}'
  28350. },
  28351. listeners: {
  28352. click: 'createDictEnum'
  28353. }
  28354. },
  28355. ],
  28356. columns: [
  28357. {
  28358. text: '字典项', dataIndex: 'dict_text',
  28359. menuDisabled: true, flex: 1,
  28360. editor: {
  28361. allowBlank: true,
  28362. selectOnFocus: false
  28363. }
  28364. },
  28365. {
  28366. text: '字典值', dataIndex: 'dict_value',
  28367. menuDisabled: true, flex: 1,
  28368. dataType: 'int',
  28369. editor: {
  28370. xtype: 'numberfield',
  28371. allowBlank: true,
  28372. selectOnFocus: false
  28373. }
  28374. },
  28375. {
  28376. text: '激活', dataIndex: 'is_enable',
  28377. xtype: 'checkcolumn', menuDisabled: true,
  28378. },
  28379. {
  28380. text: '变量名', dataIndex: 'var_name',
  28381. menuDisabled: true, flex: 1,
  28382. editor: {
  28383. allowBlank: true,
  28384. selectOnFocus: false
  28385. }
  28386. },
  28387. ]
  28388. }
  28389. ]
  28390. });
  28391. }
  28392. //# sourceMappingURL=DictTree.js.map
  28393. var model$g = {
  28394. data: {
  28395. form: {
  28396. path: "",
  28397. requestBody: "",
  28398. responseBody: "",
  28399. }
  28400. }
  28401. };
  28402. var vjson$f = {
  28403. title: '接口信息',
  28404. layout: 'fit',
  28405. width: 800,
  28406. height: 500,
  28407. items: [
  28408. {
  28409. xtype: 'form',
  28410. layout: {
  28411. type: 'vbox',
  28412. pack: 'start',
  28413. align: 'stretch'
  28414. },
  28415. defaults: {
  28416. border: false,
  28417. anchor: '100%',
  28418. margin: '5',
  28419. },
  28420. items: [
  28421. {
  28422. xtype: 'textfield',
  28423. fieldLabel: '接口路径',
  28424. bind: {
  28425. value: "{form.path}",
  28426. },
  28427. },
  28428. {
  28429. xtype: 'textareafield',
  28430. // height: 150,
  28431. flex: 2,
  28432. fieldLabel: '请求数据',
  28433. bind: {
  28434. value: "{form.requestBody}",
  28435. },
  28436. },
  28437. {
  28438. xtype: 'textareafield',
  28439. // height: 150,
  28440. flex: 5,
  28441. fieldLabel: '响应数据',
  28442. bind: {
  28443. value: "{form.responseBody}",
  28444. },
  28445. },
  28446. ]
  28447. }
  28448. ]
  28449. };
  28450. var ApiInfoDialog = /** @class */ (function (_super) {
  28451. __extends(ApiInfoDialog, _super);
  28452. function ApiInfoDialog() {
  28453. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28454. }
  28455. return ApiInfoDialog;
  28456. }(Scope));
  28457. //# sourceMappingURL=apiInfoDialog.js.map
  28458. var model$h = {
  28459. data: {
  28460. query: {
  28461. role_id: '',
  28462. resource_id: '',
  28463. },
  28464. form: {},
  28465. form2: {
  28466. key: "",
  28467. start_at: "",
  28468. end_at: "",
  28469. }
  28470. }
  28471. };
  28472. var vjson$g = {
  28473. title: '接口信息',
  28474. layout: 'fit',
  28475. items: [
  28476. {
  28477. layout: 'border',
  28478. border: false,
  28479. items: [
  28480. {
  28481. region: 'center',
  28482. layout: 'border',
  28483. items: [
  28484. {
  28485. region: 'north',
  28486. bind: {
  28487. title: '{form.title}',
  28488. },
  28489. xtype: 'form',
  28490. scrollable: true,
  28491. layout: {
  28492. type: 'vbox',
  28493. pack: 'start',
  28494. align: 'stretch'
  28495. },
  28496. defaults: {
  28497. border: false,
  28498. anchor: '100%',
  28499. margin: '5',
  28500. },
  28501. tbar: {
  28502. xtype: 'toolbar',
  28503. items: [
  28504. {
  28505. xtype: 'button',
  28506. text: '查询',
  28507. iconCls: 'x-fa fa-search',
  28508. listeners: {
  28509. click: 'scope.requestLogs'
  28510. },
  28511. },
  28512. {
  28513. xtype: 'button',
  28514. text: '保存',
  28515. iconCls: 'x-fa fa-save',
  28516. listeners: {},
  28517. },
  28518. {
  28519. xtype: 'button',
  28520. text: '禁用',
  28521. iconCls: 'x-fa fa-stop-circle',
  28522. bind: {},
  28523. listeners: {},
  28524. },
  28525. {
  28526. xtype: 'button',
  28527. text: '启用',
  28528. iconCls: 'x-fa fa-play-circle',
  28529. bind: {},
  28530. listeners: {},
  28531. },
  28532. ],
  28533. },
  28534. items: [
  28535. {
  28536. xtype: 'cols',
  28537. defaults: { labelWidth: 120 },
  28538. items: [
  28539. {
  28540. xtype: 'textfield',
  28541. fieldLabel: 'URL',
  28542. bind: {
  28543. value: '{form.api_url}',
  28544. },
  28545. readOnly: true,
  28546. },
  28547. {
  28548. xtype: 'textfield',
  28549. fieldLabel: '名称',
  28550. bind: {
  28551. value: '{form.api_name}',
  28552. },
  28553. readOnly: true,
  28554. },
  28555. ],
  28556. },
  28557. {
  28558. xtype: 'cols',
  28559. defaults: { labelWidth: 120 },
  28560. items: [
  28561. {
  28562. xtype: 'textfield',
  28563. fieldLabel: '实现类',
  28564. bind: {
  28565. value: '{form.api_class}',
  28566. },
  28567. readOnly: true,
  28568. },
  28569. {
  28570. border: false,
  28571. flex: 1
  28572. },
  28573. ]
  28574. },
  28575. {
  28576. xtype: 'cols',
  28577. defaults: { labelWidth: 120 },
  28578. items: [
  28579. {
  28580. xtype: 'textfield',
  28581. fieldLabel: '超时时间',
  28582. bind: {
  28583. value: '{form.timeout}',
  28584. },
  28585. readOnly: true,
  28586. },
  28587. {
  28588. border: false,
  28589. flex: 1
  28590. },
  28591. ]
  28592. },
  28593. {
  28594. xtype: 'cols',
  28595. defaults: { labelWidth: 120 },
  28596. items: [
  28597. {
  28598. xtype: 'textfield',
  28599. fieldLabel: 'Remote IP',
  28600. bind: {
  28601. value: '{form.remote_ip}',
  28602. },
  28603. readOnly: true,
  28604. },
  28605. {
  28606. border: false,
  28607. flex: 1
  28608. },
  28609. ]
  28610. },
  28611. {
  28612. xtype: 'cols',
  28613. defaults: { labelWidth: 120 },
  28614. items: [
  28615. {
  28616. xtype: 'textfield',
  28617. fieldLabel: '解析表单',
  28618. bind: {
  28619. value: '{form.chandi}',
  28620. },
  28621. readOnly: true,
  28622. },
  28623. {
  28624. border: false,
  28625. flex: 1
  28626. },
  28627. ]
  28628. },
  28629. ],
  28630. },
  28631. {
  28632. region: 'center',
  28633. // title: 'Request',
  28634. layout: 'border',
  28635. items: [
  28636. {
  28637. region: 'north',
  28638. xtype: 'form',
  28639. reference: 'form2',
  28640. split: true,
  28641. items: [
  28642. {
  28643. xtype: 'cols',
  28644. width: 700,
  28645. items: [
  28646. {
  28647. xtype: 'textfield',
  28648. fieldLabel: '关键字',
  28649. bind: {
  28650. value: "{form2.key}"
  28651. },
  28652. },
  28653. {
  28654. xtype: 'datefield',
  28655. fieldLabel: '开始时间',
  28656. bind: {
  28657. value: "{form2.start_at}"
  28658. },
  28659. },
  28660. {
  28661. xtype: 'datefield',
  28662. fieldLabel: '结束时间',
  28663. bind: {
  28664. value: "{form2.end_at}"
  28665. },
  28666. },
  28667. ]
  28668. }
  28669. ]
  28670. },
  28671. {
  28672. region: 'center',
  28673. xtype: 'yvgrid',
  28674. layout: 'fit',
  28675. reference: 'grid1',
  28676. pagination: true,
  28677. autoLoad: false,
  28678. selModel: {
  28679. selType: 'rowmodel',
  28680. mode: 'SINGLE',
  28681. },
  28682. dataSource: {
  28683. method: 'invoke',
  28684. url: '/sys/api/Api@requestLogs',
  28685. params: {
  28686. formData: '{form2}',
  28687. path: '{form.api_url}',
  28688. },
  28689. },
  28690. listeners: {
  28691. rowdblclick: 'scope.showDialog',
  28692. },
  28693. columns: [
  28694. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28695. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28696. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28697. { dataIndex: "size", header: "大小", width: 80 },
  28698. { dataIndex: "path", header: "path", flex: 1 },
  28699. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28700. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28701. ]
  28702. }
  28703. ]
  28704. },
  28705. ],
  28706. },
  28707. ],
  28708. },
  28709. ],
  28710. referenceHolder: true,
  28711. };
  28712. var Api = /** @class */ (function (_super) {
  28713. __extends(Api, _super);
  28714. function Api() {
  28715. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28716. }
  28717. Api.prototype.onLoad = function () {
  28718. _super.prototype.onLoad.call(this);
  28719. this.requestLogs();
  28720. };
  28721. Api.prototype.selectList = function (sender, selected, eOpts) {
  28722. this.viewModel.set("form", selected.data);
  28723. if (selected.data.api_type === '1') {
  28724. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28725. }
  28726. else {
  28727. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28728. }
  28729. };
  28730. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28731. var sel = [];
  28732. _$2.forEach(records, function (item) {
  28733. if (item.data.flg === 'Y') {
  28734. sel.push(item);
  28735. }
  28736. });
  28737. this.refs.methodGrid.selModel.select(sel);
  28738. };
  28739. Api.prototype.saveAll = function () {
  28740. var _this = this;
  28741. var _a, _b, _c;
  28742. var role_id = this.viewModel.get("query.role_id");
  28743. if (!role_id) {
  28744. msg$1("请先选择一个角色");
  28745. return;
  28746. }
  28747. var wh_id = this.viewModel.get("form.wh_id");
  28748. if (!wh_id) {
  28749. msg$1("请先选择一个仓库");
  28750. return;
  28751. }
  28752. var menus = this.refs.theTree.getChecked();
  28753. var rowsMenus = [];
  28754. _$2.forEach(menus, function (m) {
  28755. if (m.data.resource_id) {
  28756. rowsMenus.push(m.data.resource_id);
  28757. }
  28758. });
  28759. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28760. 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; });
  28761. _$2.remove(mm, function (x) {
  28762. return methodsArry.includes(x.resource_id);
  28763. });
  28764. var rowsBtn = [];
  28765. _$2.forEach(mm, function (m) {
  28766. rowsBtn.push({ resource_id: m.resource_id });
  28767. });
  28768. this.setLoading(true);
  28769. invokeServer$1('/sys/role/Role@saveAll', {
  28770. wh_id: wh_id,
  28771. role_id: role_id,
  28772. rowsMenus: rowsMenus,
  28773. rowsBtn: rowsBtn,
  28774. }).then(function (res) {
  28775. msg$1(res.msg);
  28776. if (res.success) {
  28777. _this.reloadTree();
  28778. // this.viewModel.set('query.role_id', '')
  28779. _this.viewModel.set('query.resource_id', '');
  28780. _this.refs.methodGrid.reload();
  28781. }
  28782. }).finally(function () {
  28783. _this.setLoading(false);
  28784. });
  28785. };
  28786. Api.prototype.editRoleSuccess = function (sender, data) {
  28787. if (data.success) {
  28788. this.refs.roleGrid.reload();
  28789. this.viewModel.set("query.JIAOS_ID", "");
  28790. this.reloadTree();
  28791. this.viewModel.set("query.CAID_ID", "");
  28792. this.refs.methodGrid.reload();
  28793. }
  28794. };
  28795. Api.prototype.deleteRole = function (sender) {
  28796. var _this = this;
  28797. var role_id = this.viewModel.get("query.role_id");
  28798. if (!role_id) {
  28799. msg$1("请先选择一个角色");
  28800. return;
  28801. }
  28802. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28803. if (btn === 'yes') {
  28804. invokeServer$1('/sys/role/Role@deleteRole', {
  28805. role_id: role_id,
  28806. wh_id: window['whId']
  28807. }).then(function (res) {
  28808. msg$1(res.msg);
  28809. if (res.success) {
  28810. _this.refs.roleGrid.reload();
  28811. _this.viewModel.set("query.role_id", "");
  28812. _this.reloadTree();
  28813. _this.refs.methodGrid.reload();
  28814. }
  28815. });
  28816. }
  28817. });
  28818. };
  28819. Api.prototype.reloadTree = function () {
  28820. showErrorDialog$1('reloadTree 不存在');
  28821. };
  28822. Api.prototype.whChange = function (sender, value) {
  28823. this.viewModel.set("form.wh_id", value);
  28824. this.reloadTree();
  28825. this.refs.methodGrid.reload();
  28826. };
  28827. Api.prototype.requestLogs = function () {
  28828. var path = this.viewModel.get("form.api_url");
  28829. if (!path)
  28830. return;
  28831. this.refs.grid1.reload();
  28832. };
  28833. Api.prototype.showDialog = function (sender) {
  28834. var _a, _b;
  28835. 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; });
  28836. if (!rows || rows.length <= 0)
  28837. return;
  28838. var dialog = new ApiInfoDialog();
  28839. dialog.showDialog(null, {}, {
  28840. data: {
  28841. form: __assign({}, rows[0])
  28842. }
  28843. });
  28844. };
  28845. return Api;
  28846. }(Scope));
  28847. //# sourceMappingURL=ApiPage.js.map
  28848. var Controller = /** @class */ (function () {
  28849. function Controller() {
  28850. }
  28851. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28852. var _a, _b, _c, _d, _e, _f, _g, _h;
  28853. // @ts-ignore
  28854. 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; });
  28855. if (!rows || rows.length <= 0)
  28856. return;
  28857. var apiPage = new Api();
  28858. apiPage.showPage({
  28859. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28860. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28861. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28862. }, {
  28863. data: {
  28864. form: __assign({}, rows[0])
  28865. }
  28866. });
  28867. };
  28868. return Controller;
  28869. }());
  28870. var controller = new Controller();
  28871. function initApiTree () {
  28872. Ext.define('com.yvan.studio.ApiGrid', {
  28873. extend: 'Ext.Panel',
  28874. xtype: 'apigrid',
  28875. controller: controller,
  28876. scope: controller,
  28877. referenceHolder: true,
  28878. layout: 'fit',
  28879. items: [
  28880. {
  28881. width: 400,
  28882. split: true,
  28883. xtype: 'yvgrid',
  28884. reference: 'roleGrid',
  28885. border: false,
  28886. pagination: false,
  28887. autoLoad: true,
  28888. remoteFilter: false,
  28889. selModel: {
  28890. selType: 'rowmodel',
  28891. mode: 'SINGLE',
  28892. },
  28893. tbar: {
  28894. xtype: 'toolbar',
  28895. items: [
  28896. {
  28897. xtype: 'button',
  28898. text: '新增',
  28899. iconCls: 'x-fa fa-plus-circle',
  28900. listeners: {},
  28901. },
  28902. {
  28903. xtype: 'button',
  28904. text: '删除',
  28905. iconCls: 'x-fa fa-trash',
  28906. bind: {
  28907. disabled: '{roleGrid.selection==null}',
  28908. },
  28909. listeners: {},
  28910. },
  28911. ],
  28912. },
  28913. dataSource: {
  28914. url: '/sys/api/Api@getApiList',
  28915. method: 'invoke',
  28916. params: {},
  28917. },
  28918. listeners: {
  28919. itemdblclick: "selectList",
  28920. },
  28921. columns: [
  28922. {
  28923. dataIndex: 'api_name',
  28924. header: '接口名称',
  28925. filter: { type: 'string' },
  28926. flex: 1,
  28927. },
  28928. ],
  28929. },
  28930. ]
  28931. });
  28932. }
  28933. //# sourceMappingURL=ApiTree.js.map
  28934. var model$i = {
  28935. data: {
  28936. iframeSrc: ''
  28937. }
  28938. };
  28939. var vjson$h = {
  28940. layout: 'fit',
  28941. border: false,
  28942. iconCls: 'x-fa fa-newspaper-o',
  28943. referenceHolder: true,
  28944. items: [
  28945. {
  28946. // title: 'view.design',
  28947. xtype: 'uxiframe',
  28948. layout: 'fit',
  28949. // cls: 'module_page_iframe',
  28950. reference: 'iframe',
  28951. listeners: {
  28952. afterrender: 'scope.iframeRender'
  28953. }
  28954. },
  28955. ]
  28956. };
  28957. var Iframe = /** @class */ (function (_super) {
  28958. __extends(Iframe, _super);
  28959. function Iframe(path) {
  28960. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28961. _this.path = "";
  28962. _this.path = path;
  28963. return _this;
  28964. }
  28965. Iframe.prototype.iframeRender = function (sender) {
  28966. var $dom = $(sender.el.dom).find('iframe');
  28967. var iframe = $dom[0];
  28968. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28969. iframe.onload = function () {
  28970. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28971. };
  28972. };
  28973. return Iframe;
  28974. }(Scope));
  28975. //# sourceMappingURL=Iframe.js.map
  28976. var Controller$1 = /** @class */ (function () {
  28977. function Controller() {
  28978. }
  28979. Controller.prototype.onDblClick = function (sender, record) {
  28980. var data = record.raw;
  28981. if (data.text === "运行报表") {
  28982. this.openIframe("/xxl-job/index", "运行报表");
  28983. }
  28984. else if (data.text === "任务管理") {
  28985. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28986. }
  28987. else if (data.text === "调度日志") {
  28988. this.openIframe("/xxl-job/joblog", "调度日志");
  28989. }
  28990. else if (data.text === "执行器管理") {
  28991. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28992. }
  28993. };
  28994. Controller.prototype.openIframe = function (path, title) {
  28995. var page = new Iframe(path);
  28996. page.showPage({
  28997. title: title,
  28998. id: 'xxljob__' + path.replaceAll("/", "_"),
  28999. path: 'xxljob__' + path.replaceAll("/", "_"),
  29000. }, {});
  29001. };
  29002. Controller.prototype.onLoad = function () {
  29003. var me = this;
  29004. me.getView().setRootNode({
  29005. expanded: true,
  29006. leaf: false,
  29007. children: [
  29008. { leaf: true, text: '运行报表' },
  29009. { leaf: true, text: '任务管理' },
  29010. { leaf: true, text: '调度日志' },
  29011. { leaf: true, text: '执行器管理' },
  29012. ]
  29013. });
  29014. };
  29015. return Controller;
  29016. }());
  29017. var controller$1 = new Controller$1();
  29018. function initTaskTree () {
  29019. Ext.define('com.yvan.studio.TaskTree', {
  29020. extend: 'Ext.tree.Panel',
  29021. xtype: 'tasktree',
  29022. controller: controller$1,
  29023. scope: controller$1,
  29024. reference: 'roleGrid',
  29025. tooltip: '表单定义',
  29026. iconCls: 'x-fa fa-bar-chart',
  29027. useArrows: true,
  29028. rootVisible: false,
  29029. colspan: 2,
  29030. lines: true,
  29031. multiSelect: false,
  29032. referenceHolder: true,
  29033. // openNode() {
  29034. // const selection = this.getSelection()
  29035. // const [record] = selection
  29036. // if (!record) {
  29037. // return
  29038. // }
  29039. //
  29040. // const {raw} = record;
  29041. // if (raw.type === 'Dir') {
  29042. // return
  29043. // }
  29044. // if (raw.type === "Module" && raw.module) {
  29045. // // eventBus.publish(EventType.ModuleOpen, raw)
  29046. // }
  29047. // },
  29048. listeners: {
  29049. itemdblclick: 'onDblClick',
  29050. afterrender: "onLoad",
  29051. },
  29052. });
  29053. }
  29054. //# sourceMappingURL=TaskTree.js.map
  29055. var model$j = {
  29056. data: {
  29057. form: {
  29058. address: "",
  29059. level: "",
  29060. logger: "",
  29061. message: "",
  29062. nodeName: "",
  29063. serverName: "",
  29064. thread: "",
  29065. whId: "",
  29066. userId: "",
  29067. }
  29068. }
  29069. };
  29070. var vjson$i = {
  29071. title: '接口信息',
  29072. layout: 'fit',
  29073. width: 800,
  29074. height: 600,
  29075. items: [
  29076. {
  29077. xtype: 'form',
  29078. layout: {
  29079. type: 'vbox',
  29080. pack: 'start',
  29081. align: 'stretch'
  29082. },
  29083. defaults: {
  29084. border: false,
  29085. anchor: '100%',
  29086. margin: '5',
  29087. },
  29088. items: [
  29089. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29090. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29091. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29092. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29093. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29094. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29095. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29096. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29097. {
  29098. xtype: 'textareafield',
  29099. flex: 5,
  29100. fieldLabel: '响应数据',
  29101. bind: {
  29102. value: "{form.message}",
  29103. },
  29104. },
  29105. ]
  29106. }
  29107. ]
  29108. };
  29109. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29110. __extends(ApiInfoDialog, _super);
  29111. function ApiInfoDialog() {
  29112. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29113. }
  29114. return ApiInfoDialog;
  29115. }(Scope));
  29116. //# sourceMappingURL=LogPageDialog.js.map
  29117. var model$k = {
  29118. data: {
  29119. form2: {}
  29120. }
  29121. };
  29122. var vjson$j = {
  29123. title: '日志查询',
  29124. layout: 'fit',
  29125. width: "70%",
  29126. height: "80%",
  29127. items: [
  29128. {
  29129. region: 'center',
  29130. xtype: 'yvgrid',
  29131. layout: 'fit',
  29132. reference: 'grid1',
  29133. pagination: false,
  29134. autoLoad: false,
  29135. selModel: {
  29136. selType: 'rowmodel',
  29137. mode: 'SINGLE',
  29138. },
  29139. dataSource: {
  29140. method: 'invoke',
  29141. url: '/sys/api/Api@aroundLogs',
  29142. params: {
  29143. formData: '{form2}',
  29144. },
  29145. },
  29146. listeners: {
  29147. rowdblclick: 'scope.showDialog2',
  29148. },
  29149. columns: [
  29150. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29151. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29152. { dataIndex: "thread", header: "thread", width: 150 },
  29153. { dataIndex: "message", header: "message", flex: 1 },
  29154. ]
  29155. }
  29156. ]
  29157. };
  29158. var AroundLog = /** @class */ (function (_super) {
  29159. __extends(AroundLog, _super);
  29160. function AroundLog() {
  29161. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29162. }
  29163. AroundLog.prototype.onLoad = function () {
  29164. _super.prototype.onLoad.call(this);
  29165. this.queryLog();
  29166. };
  29167. AroundLog.prototype.queryLog = function () {
  29168. this.refs.grid1.reload();
  29169. };
  29170. AroundLog.prototype.showDialog2 = function () {
  29171. var _a, _b;
  29172. 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; });
  29173. if (!rows || rows.length <= 0)
  29174. return;
  29175. var dialog = new ApiInfoDialog$1();
  29176. dialog.showDialog(null, {}, {
  29177. data: {
  29178. form: __assign({}, rows[0])
  29179. }
  29180. });
  29181. };
  29182. return AroundLog;
  29183. }(Scope));
  29184. //# sourceMappingURL=AroundLog.js.map
  29185. var model$l = {
  29186. data: {
  29187. form2: {
  29188. key: "",
  29189. start_at: "",
  29190. end_at: "",
  29191. }
  29192. }
  29193. };
  29194. var vjson$k = {
  29195. title: '日志查询',
  29196. layout: 'fit',
  29197. tbar: {
  29198. xtype: 'toolbar',
  29199. items: [
  29200. {
  29201. xtype: 'button',
  29202. text: '刷新',
  29203. listeners: {
  29204. click: 'scope.queryLog'
  29205. },
  29206. },
  29207. {
  29208. xtype: 'button',
  29209. text: '周围日志',
  29210. bind: {},
  29211. listeners: {
  29212. click: 'scope.aroundLogs'
  29213. },
  29214. },
  29215. ],
  29216. },
  29217. items: [
  29218. {
  29219. region: 'center',
  29220. xtype: 'yvgrid',
  29221. layout: 'fit',
  29222. reference: 'grid1',
  29223. pagination: true,
  29224. autoLoad: false,
  29225. selModel: {
  29226. selType: 'rowmodel',
  29227. mode: 'SINGLE',
  29228. },
  29229. dataSource: {
  29230. method: 'invoke',
  29231. url: '/sys/api/Api@queryLog',
  29232. params: {
  29233. formData: '{form2}',
  29234. path: '{form.api_url}',
  29235. },
  29236. },
  29237. listeners: {
  29238. rowdblclick: 'scope.showDialog',
  29239. },
  29240. columns: [
  29241. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29242. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29243. { dataIndex: "thread", header: "thread", width: 150 },
  29244. { dataIndex: "message", header: "message", flex: 1 },
  29245. ]
  29246. }
  29247. ]
  29248. };
  29249. var LogPage = /** @class */ (function (_super) {
  29250. __extends(LogPage, _super);
  29251. function LogPage() {
  29252. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29253. }
  29254. LogPage.prototype.onLoad = function () {
  29255. _super.prototype.onLoad.call(this);
  29256. this.queryLog();
  29257. };
  29258. LogPage.prototype.queryLog = function () {
  29259. this.refs.grid1.reload();
  29260. };
  29261. LogPage.prototype.showDialog = function () {
  29262. var _a, _b;
  29263. 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; });
  29264. if (!rows || rows.length <= 0)
  29265. return;
  29266. var dialog = new ApiInfoDialog$1();
  29267. dialog.showDialog(null, {}, {
  29268. data: {
  29269. form: __assign({}, rows[0])
  29270. }
  29271. });
  29272. };
  29273. LogPage.prototype.aroundLogs = function () {
  29274. var _a, _b;
  29275. 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; });
  29276. if (!rows || rows.length <= 0)
  29277. return;
  29278. var dialog = new AroundLog();
  29279. dialog.showDialog(null, {}, {
  29280. data: {
  29281. form2: __assign({}, rows[0])
  29282. }
  29283. });
  29284. };
  29285. return LogPage;
  29286. }(Scope));
  29287. //# sourceMappingURL=LogPage.js.map
  29288. var Controller$2 = /** @class */ (function () {
  29289. function Controller() {
  29290. }
  29291. Controller.prototype.queryLog = function () {
  29292. var form2 = this.getViewModel().get("form2");
  29293. var logPage = new LogPage();
  29294. logPage.showPage({}, {
  29295. data: {
  29296. form2: __assign({}, form2)
  29297. }
  29298. });
  29299. };
  29300. return Controller;
  29301. }());
  29302. var controller$2 = new Controller$2();
  29303. function initLogsTree () {
  29304. Ext.define('com.yvan.studio.LogsTree', {
  29305. extend: 'Ext.panel.Panel',
  29306. xtype: 'logstree',
  29307. controller: controller$2,
  29308. scope: controller$2,
  29309. viewModel: {
  29310. data: {
  29311. form2: {
  29312. key: "",
  29313. start_at: "",
  29314. end_at: "",
  29315. }
  29316. }
  29317. },
  29318. reference: 'logstree',
  29319. tooltip: '表单定义',
  29320. iconCls: 'x-fa fa-bar-chart',
  29321. useArrows: true,
  29322. rootVisible: false,
  29323. colspan: 2,
  29324. lines: true,
  29325. multiSelect: false,
  29326. referenceHolder: true,
  29327. items: [
  29328. {
  29329. region: 'north',
  29330. xtype: 'form',
  29331. reference: 'form2',
  29332. split: true,
  29333. items: [
  29334. {
  29335. xtype: 'textfield',
  29336. fieldLabel: '关键字',
  29337. bind: {
  29338. value: "{form2.key}"
  29339. },
  29340. },
  29341. {
  29342. xtype: 'datefield',
  29343. fieldLabel: '开始时间',
  29344. bind: {
  29345. value: "{form2.start_at}"
  29346. },
  29347. },
  29348. {
  29349. xtype: 'datefield',
  29350. fieldLabel: '结束时间',
  29351. bind: {
  29352. value: "{form2.end_at}"
  29353. },
  29354. },
  29355. ]
  29356. },
  29357. {
  29358. xtype: "cols",
  29359. items: [
  29360. {
  29361. xtype: "box",
  29362. },
  29363. {
  29364. xtype: "button",
  29365. text: '查询',
  29366. listeners: {
  29367. click: 'queryLog'
  29368. },
  29369. },
  29370. {
  29371. xtype: "box",
  29372. },
  29373. ]
  29374. },
  29375. ],
  29376. });
  29377. }
  29378. //# sourceMappingURL=LogsTree.js.map
  29379. var model$m = {
  29380. data: {
  29381. // opsId: "",
  29382. // name: "",
  29383. running: false,
  29384. }
  29385. };
  29386. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29387. var vjson$l = {
  29388. bind: {
  29389. title: '运维-{name}',
  29390. },
  29391. layout: 'fit',
  29392. items: [
  29393. {
  29394. layout: 'border',
  29395. items: [
  29396. {
  29397. region: 'north',
  29398. items: [
  29399. {
  29400. xtype: 'toolbar',
  29401. border: false,
  29402. items: [
  29403. {
  29404. xtype: 'button',
  29405. text: '执行',
  29406. iconCls: 'x-fa fa-play',
  29407. bind: {
  29408. hidden: "{running}",
  29409. },
  29410. listeners: {
  29411. click: 'scope.start'
  29412. }
  29413. },
  29414. {
  29415. xtype: 'button',
  29416. text: '停止',
  29417. iconCls: 'x-fa fa-stop',
  29418. bind: {
  29419. hidden: "{!running}",
  29420. },
  29421. listeners: {
  29422. click: 'scope.stop'
  29423. }
  29424. },
  29425. ],
  29426. },
  29427. ]
  29428. },
  29429. {
  29430. region: 'center',
  29431. reference: 'terminal',
  29432. xtype: 'terminal',
  29433. },
  29434. ],
  29435. },
  29436. ],
  29437. };
  29438. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29439. var DevOpsTerminal = /** @class */ (function (_super) {
  29440. __extends(DevOpsTerminal, _super);
  29441. function DevOpsTerminal() {
  29442. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29443. _this.websocket = undefined;
  29444. return _this;
  29445. }
  29446. DevOpsTerminal.prototype.onLoad = function () {
  29447. this.load();
  29448. };
  29449. DevOpsTerminal.prototype.onDestroy = function () {
  29450. if (this.websocket) {
  29451. this.websocket.close();
  29452. this.websocket = undefined;
  29453. }
  29454. };
  29455. DevOpsTerminal.prototype.load = function () {
  29456. var _this = this;
  29457. var opsId = this.viewModel.get('opsId');
  29458. this.setLoading(true);
  29459. devOpsById(opsId).then(function (res) {
  29460. _this.viewModel.set('devOps', res.data);
  29461. }).finally(function () {
  29462. _this.setLoading(false);
  29463. });
  29464. };
  29465. DevOpsTerminal.prototype.start = function () {
  29466. var me = this;
  29467. var running = this.viewModel.get('running');
  29468. var devOps = this.viewModel.get('devOps');
  29469. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29470. return;
  29471. var devopsServer = "ws://122.9.140.63:9999";
  29472. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29473. this.websocket.addEventListener('open', function () {
  29474. me.viewModel.set('running', true);
  29475. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29476. });
  29477. this.websocket.addEventListener('message', function (event) {
  29478. me.refs.terminal.write(event.data);
  29479. });
  29480. this.websocket.addEventListener('close', function () {
  29481. me.stop();
  29482. });
  29483. this.websocket.addEventListener('error', function () {
  29484. me.stop();
  29485. });
  29486. };
  29487. DevOpsTerminal.prototype.stop = function () {
  29488. if (this.websocket) {
  29489. this.websocket.close();
  29490. this.websocket = undefined;
  29491. }
  29492. this.viewModel.set('running', false);
  29493. };
  29494. return DevOpsTerminal;
  29495. }(Scope));
  29496. //# sourceMappingURL=DevOpsTerminal.js.map
  29497. var Controller$3 = /** @class */ (function () {
  29498. function Controller() {
  29499. }
  29500. Controller.prototype.onLoad = function (sender) {
  29501. this.reload();
  29502. };
  29503. Controller.prototype.reload = function () {
  29504. var me = this;
  29505. // @ts-ignore
  29506. var view = me.getView();
  29507. view.setLoading(true);
  29508. devOpsList().then(function (res) {
  29509. view.setStore(new Ext.data.Store({
  29510. fields: ['ops_id', 'host', 'name'],
  29511. data: res.data,
  29512. }));
  29513. }).finally(function () {
  29514. view.setLoading(false);
  29515. });
  29516. };
  29517. Controller.prototype.onDblClick = function (sender) {
  29518. this.devOpsTerminal();
  29519. };
  29520. Controller.prototype.devOpsTerminal = function () {
  29521. // @ts-ignore
  29522. var view = this.getView();
  29523. var _a = __read(view.getSelection(), 1), record = _a[0];
  29524. if (record) {
  29525. var name = record.get('name');
  29526. var opsId = record.get('ops_id');
  29527. var instance = new DevOpsTerminal();
  29528. instance.showPage({
  29529. id: 'ops_' + opsId,
  29530. path: 'ops_' + opsId,
  29531. }, {
  29532. data: {
  29533. opsId: opsId,
  29534. name: name,
  29535. }
  29536. });
  29537. instance.dialogSuccess = function () {
  29538. };
  29539. }
  29540. };
  29541. return Controller;
  29542. }());
  29543. var controller$3 = new Controller$3();
  29544. function initDevOpsTree () {
  29545. Ext.define('com.yvan.studio.DevOpsGrid', {
  29546. extend: 'Ext.grid.Panel',
  29547. xtype: 'devopsgrid',
  29548. controller: controller$3,
  29549. scope: controller$3,
  29550. referenceHolder: true,
  29551. tooltip: '运维',
  29552. iconCls: 'x-fa fa-terminal',
  29553. useArrows: true,
  29554. reference: 'devopsgrid',
  29555. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29556. listeners: {
  29557. afterrender: 'onLoad',
  29558. itemdblclick: 'onDblClick',
  29559. },
  29560. viewConfig: {
  29561. // listeners: {
  29562. // itemcontextmenu: 'onGridContextMenu',
  29563. // },
  29564. },
  29565. tbar: {
  29566. xtype: 'toolbar',
  29567. items: [
  29568. {
  29569. xtype: 'button',
  29570. tooltip: '刷新',
  29571. iconCls: 'x-fa fa-refresh',
  29572. listeners: {
  29573. click: 'reload'
  29574. }
  29575. },
  29576. {
  29577. xtype: 'textfield',
  29578. flex: 1,
  29579. emptyText: '搜索过滤',
  29580. enableKeyEvents: true,
  29581. listeners: {
  29582. change: {
  29583. fn: 'filterChanged',
  29584. buffer: 50
  29585. }
  29586. }
  29587. },
  29588. ]
  29589. },
  29590. columns: [
  29591. {
  29592. text: 'ID', dataIndex: 'report_id',
  29593. hidden: true,
  29594. },
  29595. {
  29596. text: '服务器',
  29597. dataIndex: 'host',
  29598. width: 100,
  29599. menuDisabled: true,
  29600. },
  29601. {
  29602. text: '操作名称',
  29603. dataIndex: 'name',
  29604. flex: 1,
  29605. menuDisabled: true,
  29606. },
  29607. ]
  29608. });
  29609. }
  29610. //# sourceMappingURL=DevOpsTree.js.map
  29611. function initTerminal () {
  29612. Ext.define('com.yvan.studio.Terminal', {
  29613. extend: 'Ext.panel.Panel',
  29614. alias: 'widget.terminal',
  29615. xtype: 'terminal',
  29616. layout: 'fit',
  29617. border: false,
  29618. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29619. config: {},
  29620. write: function (str) {
  29621. if (this.term) {
  29622. this.term.write(str);
  29623. }
  29624. },
  29625. initComponent: function () {
  29626. var that = this;
  29627. this.superclass.initComponent.call(this, arguments);
  29628. that.on({
  29629. resize: function () {
  29630. var _a;
  29631. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29632. that.fitAddon.fit();
  29633. }
  29634. },
  29635. destory: function () {
  29636. if (that.term) {
  29637. that.term.dispose();
  29638. delete that.term;
  29639. }
  29640. if (that.fitAddon) {
  29641. that.fitAddon.dispose();
  29642. delete that.fitAddon;
  29643. }
  29644. },
  29645. afterrender: function (sender) {
  29646. _.defer(function () {
  29647. var $dom = $(that.el.dom).find('.terminal');
  29648. that.term = new xterm.Terminal({
  29649. // cursorBlink: false,
  29650. // cursorStyle: 'bar', // block underline bar
  29651. // enableBold: false,
  29652. // bellStyle: "sound",
  29653. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29654. // scrollback: 10000,
  29655. // tabStopWidth: 4,
  29656. disableStdin: true,
  29657. theme: {
  29658. // foreground: "#111",
  29659. // background: "#fdfdfd",
  29660. // background: "#fafafa",
  29661. },
  29662. });
  29663. that.fitAddon = new xtermAddonFit.FitAddon();
  29664. that.term.loadAddon(that.fitAddon);
  29665. that.term.open($dom[0]);
  29666. that.fitAddon.fit();
  29667. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29668. });
  29669. }
  29670. });
  29671. }
  29672. });
  29673. }
  29674. //# sourceMappingURL=Terminal.js.map
  29675. var vjson$m = {
  29676. title: '接口统计',
  29677. layout: 'fit',
  29678. items: [
  29679. {
  29680. title: '接口统计',
  29681. xtype: 'yvgrid',
  29682. enableLocking: false,
  29683. reference: 'grid1',
  29684. pagination: false,
  29685. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29686. tbar: {
  29687. xtype: 'form',
  29688. items: [
  29689. {
  29690. xtype: 'cols',
  29691. items: [
  29692. {
  29693. xtype: 'textfield',
  29694. fieldLabel: '搜索',
  29695. listeners: {
  29696. change: 'scope.requestFilterChange'
  29697. }
  29698. },
  29699. ]
  29700. },
  29701. ]
  29702. },
  29703. columns: [
  29704. { text: '地址', dataIndex: 'url', flex: 1 },
  29705. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29706. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29707. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29708. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29709. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29710. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29711. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29712. ],
  29713. leadingBufferZone: 8,
  29714. trailingBufferZone: 8,
  29715. viewConfig: {
  29716. listeners: {
  29717. expandbody: 'scope.onChildExpand'
  29718. }
  29719. },
  29720. listeners: {
  29721. itemdblclick: 'scope.itemClick1'
  29722. },
  29723. plugins: {
  29724. rowwidget: {
  29725. widget: {
  29726. xtype: 'yvgrid',
  29727. hideFootbar: true,
  29728. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29729. listeners: {
  29730. itemdblclick: 'scope.itemClick1'
  29731. },
  29732. columns: [
  29733. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29734. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29735. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29736. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29737. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29738. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29739. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29740. ]
  29741. }
  29742. }
  29743. }
  29744. },
  29745. ]
  29746. };
  29747. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29748. var model$n = {
  29749. data: {
  29750. count: 0,
  29751. dataSourceName: '',
  29752. sql: "",
  29753. histogram: '',
  29754. maxCost: 0,
  29755. minCost: 0,
  29756. avgCost: '',
  29757. sumCost: 0,
  29758. histogramInfos: [
  29759. // count: 1
  29760. // gteCost: 20
  29761. // ltCost: 50
  29762. // 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"
  29763. // topN: [
  29764. // cost: 24
  29765. // occurrenceTime: "1648004895171"
  29766. // 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"
  29767. // ]
  29768. ]
  29769. }
  29770. };
  29771. //# sourceMappingURL=PerformDialog.model.js.map
  29772. var vjson$n = {
  29773. title: '性能统计详情',
  29774. height: 400,
  29775. width: 800,
  29776. modal: true,
  29777. layout: 'fit',
  29778. items: [
  29779. {
  29780. xtype: 'tabpanel',
  29781. items: [
  29782. {
  29783. title: '摘要',
  29784. key: "1",
  29785. layout: 'border',
  29786. items: [
  29787. {
  29788. region: 'north',
  29789. border: false,
  29790. defaults: {
  29791. margin: '8 0 0 0'
  29792. },
  29793. items: [
  29794. {
  29795. xtype: 'cols',
  29796. defaultType: 'displayfield',
  29797. defaults: {
  29798. labelWidth: 70,
  29799. },
  29800. items: [
  29801. {
  29802. fieldLabel: 'count',
  29803. bind: {
  29804. value: '{count}'
  29805. }
  29806. },
  29807. {
  29808. fieldLabel: 'maxCost',
  29809. bind: {
  29810. value: '{maxCost}'
  29811. }
  29812. },
  29813. {
  29814. fieldLabel: 'minCost',
  29815. bind: {
  29816. value: '{minCost}'
  29817. }
  29818. },
  29819. {
  29820. fieldLabel: 'avgCost',
  29821. bind: {
  29822. value: '{avgCost}'
  29823. }
  29824. },
  29825. {
  29826. fieldLabel: 'sumCost',
  29827. bind: {
  29828. value: '{sumCost}'
  29829. }
  29830. },
  29831. ]
  29832. },
  29833. {
  29834. xtype: 'cols',
  29835. items: [
  29836. {
  29837. flex: 5,
  29838. border: false,
  29839. items: [
  29840. {
  29841. xtype: 'segmentedbutton',
  29842. reference: 'histogram',
  29843. allowToggle: false,
  29844. border: false,
  29845. items: []
  29846. }
  29847. ]
  29848. },
  29849. ]
  29850. },
  29851. ],
  29852. },
  29853. {
  29854. region: 'center',
  29855. xtype: 'sqleditor',
  29856. reference: 'sqlEditor',
  29857. },
  29858. ]
  29859. },
  29860. {
  29861. title: '直方图',
  29862. key: "2",
  29863. }
  29864. ]
  29865. }
  29866. ]
  29867. };
  29868. //# sourceMappingURL=PerformDialog.view.js.map
  29869. var PerformDialog = /** @class */ (function (_super) {
  29870. __extends(PerformDialog, _super);
  29871. function PerformDialog() {
  29872. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29873. }
  29874. PerformDialog.prototype.onLoad = function () {
  29875. var _this = this;
  29876. var sql = this.viewModel.get('sql');
  29877. var sql2 = sqlFormat.format(sql, {
  29878. indent: ' ',
  29879. uppercase: true,
  29880. });
  29881. var histogramInfos = this.viewModel.get('histogramInfos');
  29882. var vs = _$2.map(histogramInfos, function (v) {
  29883. if (v.ltCost > 2100000000) {
  29884. return {
  29885. text: "[" + v.gteCost + ", \u221E):" + v.count
  29886. };
  29887. }
  29888. return {
  29889. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29890. };
  29891. });
  29892. this.refs.sqlEditor.setCode(sql2);
  29893. _$2.forEach(vs, function (v) {
  29894. _this.refs.histogram.add(v);
  29895. });
  29896. };
  29897. return PerformDialog;
  29898. }(Scope));
  29899. //# sourceMappingURL=PerformDialog.js.map
  29900. var model$o = {
  29901. data: {}
  29902. };
  29903. var PerformStats = /** @class */ (function (_super) {
  29904. __extends(PerformStats, _super);
  29905. function PerformStats() {
  29906. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29907. _this.requestFilterChange = _.debounce(function (sender, value) {
  29908. var store = _this.refs.grid1.store;
  29909. store.clearFilter();
  29910. if (value) {
  29911. store.filterBy(function (record, id) {
  29912. var text = toString(record.get('url'));
  29913. // 用拼音筛选的方式
  29914. return text.includes(value);
  29915. });
  29916. }
  29917. }, 100);
  29918. return _this;
  29919. }
  29920. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29921. widget.setData(record.data.children);
  29922. };
  29923. PerformStats.prototype.itemClick1 = function (sender, record) {
  29924. console.log('itemClick1', record.data);
  29925. new PerformDialog().showDialog(sender, {}, {
  29926. data: record.data
  29927. });
  29928. };
  29929. PerformStats.prototype.onLoad = function () {
  29930. var _this = this;
  29931. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29932. .then(function (_a) {
  29933. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29934. var resData = reqRes.data;
  29935. var jdbcData = jdbcRes.data;
  29936. _.forEach(jdbcData, function (item) {
  29937. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29938. });
  29939. _.forEach(resData, function (item) {
  29940. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29941. if (_.isArray(item.sqls)) {
  29942. item.children = _.map(item.sqls, function (sql) {
  29943. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29944. }).filter(function (v) { return !!v; });
  29945. }
  29946. item.jdbcCount = _.size(item.children);
  29947. });
  29948. _this.refs.grid1.setData(resData);
  29949. // this.refs.grid2.setData(jdbcData)
  29950. });
  29951. };
  29952. return PerformStats;
  29953. }(Scope));
  29954. //# sourceMappingURL=InterfaceStatistics.js.map
  29955. var vjson$o = {
  29956. title: '性能统计',
  29957. layout: 'fit',
  29958. items: [
  29959. {
  29960. title: '数据库统计',
  29961. xtype: 'yvgrid',
  29962. enableLocking: false,
  29963. reference: 'grid2',
  29964. pagination: false,
  29965. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29966. tbar: {
  29967. xtype: 'form',
  29968. items: [
  29969. {
  29970. xtype: 'cols',
  29971. items: [
  29972. {
  29973. fieldLabel: '搜索',
  29974. listeners: {
  29975. change: 'scope.jdbcFilterChange'
  29976. }
  29977. },
  29978. ]
  29979. },
  29980. ]
  29981. },
  29982. listeners: {
  29983. itemdblclick: 'scope.itemClick1'
  29984. },
  29985. columns: [
  29986. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29987. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29988. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29989. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29990. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29991. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29992. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29993. ]
  29994. },
  29995. ]
  29996. };
  29997. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29998. var model$p = {
  29999. data: {}
  30000. };
  30001. var PerformStats$1 = /** @class */ (function (_super) {
  30002. __extends(PerformStats, _super);
  30003. function PerformStats() {
  30004. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  30005. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  30006. var store = _this.refs.grid2.store;
  30007. store.clearFilter();
  30008. if (value) {
  30009. store.filterBy(function (record, id) {
  30010. var text = toString(record.get('sql'));
  30011. // 用拼音筛选的方式
  30012. return text.includes(value);
  30013. });
  30014. }
  30015. }, 100);
  30016. return _this;
  30017. }
  30018. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30019. widget.setData(record.data.children);
  30020. };
  30021. PerformStats.prototype.itemClick1 = function (sender, record) {
  30022. console.log('itemClick1', record.data);
  30023. new PerformDialog().showDialog(sender, {}, {
  30024. data: record.data
  30025. });
  30026. };
  30027. PerformStats.prototype.onLoad = function () {
  30028. var _this = this;
  30029. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30030. .then(function (_a) {
  30031. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30032. var resData = reqRes.data;
  30033. var jdbcData = jdbcRes.data;
  30034. _.forEach(jdbcData, function (item) {
  30035. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30036. });
  30037. _.forEach(resData, function (item) {
  30038. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30039. if (_.isArray(item.sqls)) {
  30040. item.children = _.map(item.sqls, function (sql) {
  30041. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30042. }).filter(function (v) { return !!v; });
  30043. }
  30044. item.jdbcCount = _.size(item.children);
  30045. });
  30046. _this.refs.grid2.setData(jdbcData);
  30047. });
  30048. };
  30049. return PerformStats;
  30050. }(Scope));
  30051. //# sourceMappingURL=DatabaseStatistics.js.map
  30052. var Controller$4 = /** @class */ (function () {
  30053. function Controller() {
  30054. }
  30055. Controller.prototype.onDblClick = function (sender, record) {
  30056. var data = record.raw;
  30057. if (data.text === "接口统计") {
  30058. var page = new PerformStats();
  30059. page.showPage({
  30060. title: "接口统计",
  30061. id: '_InterfaceStatistics',
  30062. path: '_InterfaceStatistics',
  30063. }, {});
  30064. }
  30065. else if (data.text === "数据库统计") {
  30066. var page = new PerformStats$1();
  30067. page.showPage({
  30068. title: "数据库统计",
  30069. id: '_DatabaseStatistics',
  30070. path: '_DatabaseStatistics',
  30071. }, {});
  30072. }
  30073. };
  30074. Controller.prototype.onLoad = function () {
  30075. var me = this;
  30076. //@ts-ignore
  30077. var view = me.getView();
  30078. view.setRootNode({
  30079. expanded: true,
  30080. leaf: false,
  30081. children: [
  30082. { leaf: true, text: '接口统计' },
  30083. { leaf: true, text: '数据库统计' },
  30084. ]
  30085. });
  30086. };
  30087. return Controller;
  30088. }());
  30089. var controller$4 = new Controller$4();
  30090. function initMonitorTree () {
  30091. Ext.define('com.yvan.studio.MonitorTree', {
  30092. extend: 'Ext.tree.Panel',
  30093. xtype: 'monitortree',
  30094. controller: controller$4,
  30095. scope: controller$4,
  30096. reference: 'roleGrid',
  30097. tooltip: '表单定义',
  30098. iconCls: 'x-fa fa-bar-chart',
  30099. useArrows: true,
  30100. rootVisible: false,
  30101. colspan: 2,
  30102. lines: true,
  30103. multiSelect: false,
  30104. referenceHolder: true,
  30105. // openNode() {
  30106. // const selection = this.getSelection()
  30107. // const [record] = selection
  30108. // if (!record) {
  30109. // return
  30110. // }
  30111. //
  30112. // const {raw} = record;
  30113. // if (raw.type === 'Dir') {
  30114. // return
  30115. // }
  30116. // if (raw.type === "Module" && raw.module) {
  30117. // // eventBus.publish(EventType.ModuleOpen, raw)
  30118. // }
  30119. // },
  30120. listeners: {
  30121. itemdblclick: 'onDblClick',
  30122. afterrender: "onLoad",
  30123. },
  30124. });
  30125. }
  30126. //# sourceMappingURL=MonitorTree.js.map
  30127. var Controller$5 = /** @class */ (function () {
  30128. function Controller() {
  30129. }
  30130. return Controller;
  30131. }());
  30132. var controller$5 = new Controller$5();
  30133. function initHomeTree () {
  30134. Ext.define('com.yvan.studio.HomeTree', {
  30135. extend: 'Ext.Panel',
  30136. xtype: 'hometree',
  30137. controller: controller$5,
  30138. scope: controller$5,
  30139. referenceHolder: true,
  30140. bodyCls: 'home',
  30141. // layout: 'fit',
  30142. tbar: {
  30143. xtype: 'toolbar',
  30144. items: [
  30145. {
  30146. xtype: 'button',
  30147. iconCls: 'x-fa fa-exchange',
  30148. text: '数据结构同步',
  30149. handler: function (sender) {
  30150. handles$1.mainWindow.showDataSync(sender);
  30151. }
  30152. },
  30153. {
  30154. xtype: 'button',
  30155. iconCls: 'x-fa fa-cubes',
  30156. text: '数据域管理',
  30157. handler: function (sender) {
  30158. handles$1.mainWindow.showColumnDomain();
  30159. }
  30160. },
  30161. ],
  30162. },
  30163. // items: [
  30164. //
  30165. // ],
  30166. layout: {
  30167. type: 'vbox',
  30168. pack: 'start',
  30169. align: 'stretch',
  30170. },
  30171. items: [
  30172. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30173. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30174. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30175. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30176. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30177. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30178. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30179. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30180. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30181. ],
  30182. });
  30183. }
  30184. //# sourceMappingURL=HomeTree.js.map
  30185. var WidgetStore = /** @class */ (function (_super) {
  30186. __extends(WidgetStore, _super);
  30187. function WidgetStore() {
  30188. return _super !== null && _super.apply(this, arguments) || this;
  30189. }
  30190. WidgetStore.prototype.getCacheKey = function (param) {
  30191. return "widget_data.json";
  30192. };
  30193. /*invokeApi(param: any): Promise<any> {
  30194. return new Promise<any>(resolve => {
  30195. //@ts-ignore
  30196. require(["../../widget/all"], function (res) {
  30197. const widgetList = res.default
  30198. resolve(widgetList)
  30199. })
  30200. })
  30201. }*/
  30202. WidgetStore.prototype.invokeApi = function (param) {
  30203. return widgetListApi(param);
  30204. };
  30205. return WidgetStore;
  30206. }(CacheStore));
  30207. var instance$3 = new WidgetStore();
  30208. //# sourceMappingURL=WidgetStore.js.map
  30209. var WidgetGridController = /** @class */ (function () {
  30210. function WidgetGridController() {
  30211. }
  30212. WidgetGridController.prototype.onLoad = function (sender) {
  30213. var me = this;
  30214. setWidget(me);
  30215. instance$3.registe(me.reloadData.bind(this));
  30216. instance$3.reloadIfNeed(undefined);
  30217. };
  30218. WidgetGridController.prototype.widgetAdd = function (sender) {
  30219. var me = this;
  30220. var win = new Ext.Window({
  30221. autoDestroy: true,
  30222. title: "新建弹框",
  30223. width: 400,
  30224. height: 220,
  30225. resizable: true,
  30226. closable: true,
  30227. maximizable: true,
  30228. minimizable: true,
  30229. plain: true,
  30230. // constrainHeader: true,
  30231. constrain: true,
  30232. layout: 'fit',
  30233. animateTarget: sender,
  30234. buttonAlign: 'center',
  30235. items: [
  30236. {
  30237. xtype: "form",
  30238. layout: "hbox",
  30239. margin: '10px 20px',
  30240. border: 0,
  30241. items: [
  30242. {
  30243. flex: 1,
  30244. layout: 'vbox',
  30245. items: [
  30246. {
  30247. xtype: "textfield",
  30248. name: "widgetcode",
  30249. fieldLabel: "弹窗文件",
  30250. flex: 1,
  30251. allowBlank: false,
  30252. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30253. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30254. labelWidth: 80,
  30255. width: "100%",
  30256. },
  30257. {
  30258. xtype: "textfield",
  30259. name: "widgetname",
  30260. fieldLabel: "弹窗名称",
  30261. flex: 1,
  30262. allowBlank: false,
  30263. labelWidth: 80,
  30264. width: "100%",
  30265. },
  30266. ]
  30267. },
  30268. ]
  30269. }
  30270. ],
  30271. //窗口按钮
  30272. buttons: [
  30273. {
  30274. xtype: 'button', text: '保存', handler: function (btn) {
  30275. //窗口获取表单
  30276. var form = win.down('form');
  30277. var vaildSuccess = form.isValid();
  30278. if (!vaildSuccess) {
  30279. return;
  30280. }
  30281. var title = form.down('textfield[name="widgetname"]').getValue();
  30282. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30283. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30284. if (res.success) {
  30285. msg$1('添加成功');
  30286. // 添加
  30287. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30288. me.reload();
  30289. });
  30290. win.close();
  30291. }
  30292. });
  30293. }
  30294. },
  30295. {
  30296. xtype: 'button', text: '取消', handler: function (btn) {
  30297. //窗口关闭
  30298. win.close();
  30299. }
  30300. }
  30301. ]
  30302. });
  30303. win.show();
  30304. };
  30305. WidgetGridController.prototype.widgetRemove = function (sender) {
  30306. var _this = this;
  30307. //@ts-ignore
  30308. var record = this.getView().selection.data;
  30309. if (!record) {
  30310. msg$1('请选择一行');
  30311. return;
  30312. }
  30313. var widgetPath = record.widget_path;
  30314. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30315. if (btn === 'yes') {
  30316. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30317. if (res.success) {
  30318. msg$1(res.msg);
  30319. _this.reload();
  30320. }
  30321. });
  30322. }
  30323. });
  30324. };
  30325. WidgetGridController.prototype.widgetEdit = function (record) {
  30326. var _this = this;
  30327. if (record) {
  30328. var widgetPath = record.widget_path;
  30329. var widgetName = record.widget_name;
  30330. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30331. _this.reload();
  30332. });
  30333. }
  30334. };
  30335. WidgetGridController.prototype.onDestory = function (sender) {
  30336. var me = this;
  30337. setWidget(undefined);
  30338. instance$3.unregiste(me.reloadData.bind(this));
  30339. };
  30340. WidgetGridController.prototype.reloadData = function (res) {
  30341. var me = this;
  30342. //@ts-ignore
  30343. var view = me.getView();
  30344. if (typeof res === 'object') {
  30345. // const data = []
  30346. // _.forOwn(res, (v, k) => {
  30347. // data.push({
  30348. // widget_path: k,
  30349. // widget_name: v.title,
  30350. // vjson : v
  30351. // })
  30352. // })
  30353. view.setStore(new Ext.data.Store({
  30354. fields: ['widget_path', 'widget_name'],
  30355. data: res.data,
  30356. }));
  30357. }
  30358. else if (typeof res === 'boolean') {
  30359. view.setLoading(res);
  30360. }
  30361. };
  30362. WidgetGridController.prototype.reload = function () {
  30363. instance$3.reloadForce(undefined);
  30364. };
  30365. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30366. //@ts-ignore
  30367. this.view.store.clearFilter();
  30368. if (value) {
  30369. //@ts-ignore
  30370. this.view.store.filterBy(function (record) {
  30371. var widget_path = record.get('widget_path');
  30372. var widget_name = record.get('widget_name');
  30373. return (window['system'].pinyinMatch(widget_name, value) ||
  30374. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30375. });
  30376. }
  30377. };
  30378. WidgetGridController.prototype.onClearClick = function () {
  30379. var _a, _b;
  30380. //@ts-ignore
  30381. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30382. };
  30383. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30384. this.widgetEdit(record.data);
  30385. };
  30386. return WidgetGridController;
  30387. }());
  30388. //# sourceMappingURL=WidgetGridController.js.map
  30389. function initWidget () {
  30390. var controller = new WidgetGridController();
  30391. Ext.define('com.yvan.studio.WidgetGrid', {
  30392. extend: 'Ext.grid.Panel',
  30393. xtype: 'widgetgrid',
  30394. controller: controller,
  30395. scope: controller,
  30396. referenceHolder: true,
  30397. tooltip: '检索窗口',
  30398. iconCls: 'x-fa fa-search',
  30399. useArrows: true,
  30400. reference: 'widgetgrid',
  30401. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30402. listeners: {
  30403. itemdblclick: 'onDblClick',
  30404. afterrender: 'onLoad',
  30405. destory: 'onDestory',
  30406. },
  30407. viewConfig: {
  30408. listeners: {
  30409. itemcontextmenu: 'onGridContextMenu',
  30410. },
  30411. },
  30412. tbar: [
  30413. {
  30414. xtype: 'button',
  30415. tooltip: '刷新',
  30416. iconCls: 'x-fa fa-refresh',
  30417. listeners: {
  30418. click: 'reload'
  30419. }
  30420. },
  30421. {
  30422. xtype: 'button',
  30423. tooltip: '添加',
  30424. iconCls: 'x-fa fa-plus-circle',
  30425. listeners: {
  30426. click: 'widgetAdd'
  30427. }
  30428. },
  30429. {
  30430. xtype: 'button',
  30431. tooltip: '删除',
  30432. iconCls: 'x-fa fa-minus-circle',
  30433. listeners: {
  30434. click: 'widgetRemove'
  30435. }
  30436. },
  30437. ],
  30438. fbar: [
  30439. {
  30440. xtype: 'textfield',
  30441. flex: 1,
  30442. reference: "txtFilter",
  30443. emptyText: '搜索过滤',
  30444. enableKeyEvents: true,
  30445. listeners: {
  30446. change: {
  30447. fn: 'filterChanged',
  30448. buffer: 50
  30449. }
  30450. }
  30451. },
  30452. ],
  30453. columns: [
  30454. {
  30455. text: '弹窗文件', dataIndex: 'widget_path',
  30456. menuDisabled: true, flex: 1,
  30457. },
  30458. {
  30459. text: '弹窗名称', dataIndex: 'widget_name',
  30460. menuDisabled: true, flex: 1,
  30461. },
  30462. ]
  30463. });
  30464. }
  30465. //# sourceMappingURL=WidgetGrid.js.map
  30466. var WhLayoutController = /** @class */ (function () {
  30467. function WhLayoutController() {
  30468. }
  30469. WhLayoutController.prototype.onLoad = function (sender) {
  30470. var _this = this;
  30471. var me = this;
  30472. setWhLayout(me);
  30473. _$2.defer(function () {
  30474. _this.reload();
  30475. });
  30476. };
  30477. WhLayoutController.prototype.reload = function () {
  30478. //@ts-ignore
  30479. var view = this.getView();
  30480. view.setLoading(true);
  30481. loadWhLayoutAll().then(function (res) {
  30482. view.setStore(new Ext.data.Store({
  30483. fields: ['layout_code', 'layout_name'],
  30484. data: res.data,
  30485. }));
  30486. }).finally(function () {
  30487. view.setLoading(false);
  30488. });
  30489. };
  30490. WhLayoutController.prototype.add = function () {
  30491. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30492. };
  30493. WhLayoutController.prototype.edit = function (data) {
  30494. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30495. };
  30496. WhLayoutController.prototype.remove = function () {
  30497. var _this = this;
  30498. var _a;
  30499. //@ts-ignore
  30500. var view = this.getView();
  30501. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30502. if (!record) {
  30503. msg$1('请选择一行数据');
  30504. return;
  30505. }
  30506. var layoutCode = record.layout_code;
  30507. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30508. if (btn === 'yes') {
  30509. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30510. if (res.success) {
  30511. msg$1(res.msg);
  30512. _this.reload();
  30513. }
  30514. });
  30515. }
  30516. });
  30517. };
  30518. WhLayoutController.prototype.onDblClick = function () {
  30519. var _a;
  30520. //@ts-ignore
  30521. var view = this.getView();
  30522. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30523. if (!record) {
  30524. msg$1('请选择一行数据');
  30525. return;
  30526. }
  30527. this.edit(record);
  30528. };
  30529. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30530. //@ts-ignore
  30531. this.view.store.clearFilter();
  30532. if (value) {
  30533. //@ts-ignore
  30534. this.view.store.filterBy(function (record) {
  30535. var widget_path = record.get('widget_path');
  30536. var widget_name = record.get('widget_name');
  30537. return (window['system'].pinyinMatch(widget_name, value) ||
  30538. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30539. });
  30540. }
  30541. };
  30542. WhLayoutController.prototype.onClearClick = function () {
  30543. var _a, _b;
  30544. //@ts-ignore
  30545. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30546. };
  30547. return WhLayoutController;
  30548. }());
  30549. //# sourceMappingURL=WhLayoutController.js.map
  30550. function initWhLayout () {
  30551. var controller = new WhLayoutController();
  30552. Ext.define('com.yvan.studio.WhLayout', {
  30553. extend: 'Ext.grid.Panel',
  30554. xtype: 'whlayout',
  30555. alias: 'widget.whlayout',
  30556. controller: controller,
  30557. scope: controller,
  30558. referenceHolder: true,
  30559. tooltip: '检索窗口',
  30560. iconCls: 'x-fa fa-search',
  30561. useArrows: true,
  30562. reference: 'whlayout',
  30563. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30564. listeners: {
  30565. itemdblclick: 'onDblClick',
  30566. afterrender: 'onLoad',
  30567. destory: 'onDestory',
  30568. },
  30569. viewConfig: {
  30570. listeners: {
  30571. itemcontextmenu: 'onGridContextMenu',
  30572. },
  30573. },
  30574. tbar: [
  30575. {
  30576. xtype: 'button',
  30577. tooltip: '刷新',
  30578. iconCls: 'x-fa fa-refresh',
  30579. listeners: {
  30580. click: 'reload'
  30581. }
  30582. },
  30583. {
  30584. xtype: 'button',
  30585. tooltip: '添加',
  30586. iconCls: 'x-fa fa-plus-circle',
  30587. listeners: {
  30588. click: 'add'
  30589. }
  30590. },
  30591. {
  30592. xtype: 'button',
  30593. tooltip: '删除',
  30594. iconCls: 'x-fa fa-minus-circle',
  30595. listeners: {
  30596. click: 'remove'
  30597. }
  30598. },
  30599. ],
  30600. fbar: [
  30601. {
  30602. xtype: 'textfield',
  30603. flex: 1,
  30604. reference: "txtFilter",
  30605. emptyText: '搜索过滤',
  30606. enableKeyEvents: true,
  30607. listeners: {
  30608. change: {
  30609. fn: 'filterChanged',
  30610. buffer: 50
  30611. }
  30612. }
  30613. },
  30614. ],
  30615. columns: [
  30616. {
  30617. text: '图编号', dataIndex: 'layout_code',
  30618. menuDisabled: true, flex: 1,
  30619. },
  30620. {
  30621. text: '图名称', dataIndex: 'layout_name',
  30622. menuDisabled: true, flex: 1,
  30623. },
  30624. ]
  30625. });
  30626. }
  30627. //# sourceMappingURL=WhLayout.js.map
  30628. var BpmnTreeController = /** @class */ (function () {
  30629. function BpmnTreeController() {
  30630. }
  30631. BpmnTreeController.prototype.onLoad = function (sender) {
  30632. this.reload();
  30633. };
  30634. BpmnTreeController.prototype.reload = function () {
  30635. var me = this;
  30636. me.getView().setLoading(true);
  30637. exporerList().then(function (res) {
  30638. // handles.mainWindow.modules = res.data
  30639. // const rootNode = modulesToTreeData(res.data)
  30640. var rootNode = res.data.tree;
  30641. me.getView().setRootNode({
  30642. expanded: true,
  30643. leaf: false,
  30644. children: rootNode
  30645. });
  30646. // const lastId = window.location.hash.substring(1);
  30647. // file.selectPath(lastId)
  30648. // if (lastId) {
  30649. // const node = getModuleById(rootNode, lastId)
  30650. // if (node) {
  30651. // showDesign(node.id, node.path, node.text, node.module)
  30652. // }
  30653. // }
  30654. // this.restoreState()
  30655. }).finally(function () {
  30656. me.getView().setLoading(false);
  30657. });
  30658. };
  30659. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30660. var _this = this;
  30661. e.preventDefault();
  30662. var raw = node.raw;
  30663. //const me = sender.up("treepanel").scope
  30664. var option;
  30665. if (raw.exporerType === 1) ;
  30666. else if (raw.exporerType === 21) {
  30667. if (raw.type === 'Dir') {
  30668. option = {
  30669. shadow: 'frame', allowOtherMenus: true,
  30670. items: [
  30671. {
  30672. text: '添加',
  30673. iconCls: 'x-fa fa-plus-circle',
  30674. handler: function (sender) {
  30675. var dirPath = raw.dirPath;
  30676. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30677. }
  30678. },
  30679. '-',
  30680. {
  30681. text: '新建文件夹',
  30682. iconCls: 'x-fa fa-folder-o',
  30683. handler: function (sender) {
  30684. }
  30685. }
  30686. ]
  30687. };
  30688. }
  30689. else if (raw.type === 'Model') {
  30690. option = {
  30691. shadow: 'frame', allowOtherMenus: true,
  30692. items: [
  30693. {
  30694. text: '编辑',
  30695. iconCls: 'x-fa fa-edit',
  30696. handler: function (sender) {
  30697. }
  30698. },
  30699. {
  30700. text: '删除',
  30701. iconCls: 'x-fa fa-minus-circle',
  30702. handler: function (sender) {
  30703. }
  30704. },
  30705. '-',
  30706. {
  30707. text: '注册(至菜单)',
  30708. iconCls: 'x-fa fa-sign-in',
  30709. handler: function (sender) {
  30710. }
  30711. },
  30712. {
  30713. text: '新建文件夹',
  30714. iconCls: 'x-fa fa-folder-o',
  30715. handler: function (sender) {
  30716. }
  30717. }
  30718. ]
  30719. };
  30720. }
  30721. }
  30722. else if (raw.exporerType === 22) {
  30723. if (raw.type === 'Dir') {
  30724. option = {
  30725. shadow: 'frame', allowOtherMenus: true,
  30726. items: [
  30727. {
  30728. text: '添加',
  30729. iconCls: 'x-fa fa-plus-circle',
  30730. handler: function (sender) {
  30731. var dirPath = raw.dirPath;
  30732. handles$1.mainWindow.showFormBill();
  30733. }
  30734. },
  30735. '-',
  30736. {
  30737. text: '新建文件夹',
  30738. iconCls: 'x-fa fa-folder-o',
  30739. handler: function (sender) {
  30740. }
  30741. }
  30742. ]
  30743. };
  30744. }
  30745. else if (raw.type === 'Model') {
  30746. option = {
  30747. shadow: 'frame', allowOtherMenus: true,
  30748. items: [
  30749. {
  30750. text: '编辑',
  30751. iconCls: 'x-fa fa-edit',
  30752. handler: function (sender) {
  30753. }
  30754. },
  30755. {
  30756. text: '删除',
  30757. iconCls: 'x-fa fa-minus-circle',
  30758. handler: function (sender) {
  30759. }
  30760. },
  30761. '-',
  30762. {
  30763. text: '注册(至菜单)',
  30764. iconCls: 'x-fa fa-sign-in',
  30765. handler: function (sender) {
  30766. }
  30767. },
  30768. {
  30769. text: '新建文件夹',
  30770. iconCls: 'x-fa fa-folder-o',
  30771. handler: function (sender) {
  30772. }
  30773. }
  30774. ]
  30775. };
  30776. }
  30777. }
  30778. else if (raw.exporerType === 3) ;
  30779. else if (raw.exporerType === 50) {
  30780. option = {
  30781. shadow: 'frame', allowOtherMenus: true,
  30782. items: [
  30783. {
  30784. text: '新建流程',
  30785. iconCls: 'x-fa fa-new',
  30786. handler: function (sender) {
  30787. _this.bpmnAdd(sender);
  30788. }
  30789. },
  30790. ]
  30791. };
  30792. }
  30793. else if (raw.exporerType === 51) {
  30794. option = {
  30795. shadow: 'frame', allowOtherMenus: true,
  30796. items: [
  30797. {
  30798. text: '新建流程',
  30799. iconCls: 'x-fa fa-new',
  30800. handler: function (sender) {
  30801. _this.bpmnAdd(sender);
  30802. }
  30803. },
  30804. {
  30805. text: '删除',
  30806. iconCls: 'x-fa fa-minus-circle',
  30807. handler: function (sender) {
  30808. _this.bpmnDelete(sender, raw);
  30809. }
  30810. },
  30811. ]
  30812. };
  30813. }
  30814. else {
  30815. throw Error('暂时不支持!');
  30816. }
  30817. if (option) {
  30818. var treeMenu = new Ext.menu.Menu(option);
  30819. treeMenu.showAt(e.getXY());
  30820. }
  30821. };
  30822. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30823. var _this = this;
  30824. prompt$2('输入工作流名称').then(function (name) {
  30825. createBpmn("", name).then(function (res) {
  30826. if (res.success) {
  30827. msg$1('添加成功');
  30828. }
  30829. _this.reload();
  30830. });
  30831. });
  30832. };
  30833. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30834. var _this = this;
  30835. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30836. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30837. if (res.success) {
  30838. msg$1('添加成功');
  30839. }
  30840. _this.reload();
  30841. });
  30842. });
  30843. };
  30844. BpmnTreeController.prototype.reportAdd = function (sender) {
  30845. var _this = this;
  30846. prompt$2('请输入报表名称').then(function (name) {
  30847. createReportApi(name).then(function (res) {
  30848. if (res.success) {
  30849. msg$1('添加成功');
  30850. handles$1.mainWindow.showReport(res.data, name, function () {
  30851. _this.reload();
  30852. });
  30853. }
  30854. _this.reload();
  30855. });
  30856. });
  30857. };
  30858. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30859. if (record) {
  30860. var reportName = record.get('report_name');
  30861. var reportId = record.get('report_id');
  30862. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30863. }
  30864. };
  30865. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30866. var _this = this;
  30867. if (record) {
  30868. var reportName = record.get('report_name');
  30869. var reportId_1 = record.get('report_id');
  30870. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30871. delReportApi(reportId_1).then(function (res) {
  30872. if (res.success) {
  30873. msg$1('删除成功');
  30874. _this.reload();
  30875. }
  30876. });
  30877. });
  30878. }
  30879. };
  30880. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30881. var _this = this;
  30882. if (!record || record.type !== 'Module') {
  30883. return;
  30884. }
  30885. var reportName = record.text;
  30886. var reportId = record.target;
  30887. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30888. _this.reload();
  30889. });
  30890. };
  30891. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30892. var data = record.raw;
  30893. if (data.type !== 'Module' && data.type !== 'Dir') {
  30894. return;
  30895. }
  30896. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30897. if (data.exporerType === 10) { // 表单
  30898. // this.reportEdit(sender, data)
  30899. handles$1.mainWindow.showReport();
  30900. }
  30901. else if (data.exporerType === 21) {
  30902. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30903. }
  30904. else if (data.exporerType === 22) {
  30905. handles$1.mainWindow.showFormBill();
  30906. }
  30907. else if (data.exporerType === 30) {
  30908. handles$1.mainWindow.showWidgetDesign();
  30909. }
  30910. else if (data.exporerType === 51) {
  30911. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30912. }
  30913. else {
  30914. throw Error('暂时不支持!');
  30915. }
  30916. };
  30917. return BpmnTreeController;
  30918. }());
  30919. var controller$6 = new BpmnTreeController();
  30920. function initBpmnTree () {
  30921. Ext.define('com.yvan.studio.BpmnTree', {
  30922. extend: 'Ext.tree.Panel',
  30923. //extend: 'com.yvan.studio.StateTree',
  30924. xtype: 'bpmntree',
  30925. controller: controller$6,
  30926. scope: controller$6,
  30927. tooltip: '表单定义',
  30928. iconCls: 'x-fa fa-random',
  30929. useArrows: true,
  30930. rootVisible: false,
  30931. colspan: 2,
  30932. lines: true,
  30933. multiSelect: true,
  30934. reload: function () {
  30935. this.controller.reload.call(this, arguments);
  30936. },
  30937. openNode: function () {
  30938. var selection = this.getSelection();
  30939. var _a = __read(selection, 1), record = _a[0];
  30940. if (!record) {
  30941. return;
  30942. }
  30943. var raw = record.raw;
  30944. if (raw.type === 'Dir') {
  30945. return;
  30946. }
  30947. if (raw.type === "Module" && raw.module) ;
  30948. },
  30949. listeners: {
  30950. itemdblclick: 'onDblClick',
  30951. afterrender: 'onLoad',
  30952. // itemverify() {
  30953. // this.openNode()
  30954. // },
  30955. itemcontextmenu: 'onLisenContextMenu'
  30956. },
  30957. tbar: {
  30958. xtype: 'toolbar',
  30959. items: [
  30960. {
  30961. xtype: 'button',
  30962. tooltip: '刷新',
  30963. iconCls: 'x-fa fa-refresh',
  30964. listeners: {
  30965. click: 'reload'
  30966. }
  30967. },
  30968. /*{
  30969. xtype: 'button',
  30970. tooltip: '添加',
  30971. iconCls: 'x-fa fa-plus-circle',
  30972. menu: [
  30973. {
  30974. text: '类别',
  30975. listeners: {
  30976. click: 'classAdd'
  30977. }
  30978. },
  30979. {
  30980. text: '查询',
  30981. listeners: {
  30982. click: 'reportAdd'
  30983. }
  30984. },
  30985. '-',
  30986. {
  30987. text: '单表定义',
  30988. listeners: {
  30989. click: 'singleTableAdd'
  30990. }
  30991. },
  30992. {
  30993. text: '多表定义',
  30994. listeners: {
  30995. click: 'complexTableAdd'
  30996. }
  30997. },
  30998. {
  30999. text: '查询窗口定义',
  31000. listeners: {
  31001. click: 'widgetAdd'
  31002. }
  31003. },
  31004. ],
  31005. },
  31006. {
  31007. xtype: 'button',
  31008. tooltip: '删除',
  31009. iconCls: 'x-fa fa-minus-circle',
  31010. listeners: {
  31011. click: 'reportRemove'
  31012. }
  31013. },*/
  31014. {
  31015. xtype: 'textfield',
  31016. flex: 1,
  31017. reference: "txtFilter",
  31018. emptyText: '搜索过滤',
  31019. enableKeyEvents: true,
  31020. listeners: {
  31021. change: {
  31022. fn: 'filterChanged',
  31023. buffer: 50
  31024. }
  31025. }
  31026. },
  31027. ]
  31028. },
  31029. });
  31030. }
  31031. //# sourceMappingURL=BpmnTree.js.map
  31032. function initToolBox () {
  31033. Ext.define('com.yvan.studio.ToolBox', {
  31034. extend: 'Ext.panel.Panel',
  31035. xtype: 'toolbox',
  31036. tooltip: '工具箱',
  31037. layout: 'fit',
  31038. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31039. border: false,
  31040. beforeRender: function () {
  31041. console.log('beforeRender', this);
  31042. },
  31043. afterRender: function () {
  31044. var $dom = $(this.body.dom).children('div');
  31045. $dom.append(createComponent());
  31046. $dom.css("height", '100%');
  31047. // @ts-ignore
  31048. $('#_toolbox_list').find('li').each(function () {
  31049. var id = $(this).children(':first').attr('drag_id');
  31050. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31051. setDrag(this, node);
  31052. });
  31053. }
  31054. });
  31055. }
  31056. function setDrag(el, node) {
  31057. new Ext.drag.Source({
  31058. element: el,
  31059. proxy: {
  31060. type: 'placeholder',
  31061. getElement: function (info) {
  31062. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31063. return Ext.getBody().createChild({
  31064. html: html
  31065. });
  31066. }
  31067. },
  31068. listeners: {
  31069. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31070. dragend: delegateDragend.bind(getDesignInstance(), node),
  31071. },
  31072. sourceVjson: node.code,
  31073. dragType: node.dragType
  31074. });
  31075. }
  31076. function createComponent() {
  31077. var template = [];
  31078. for (var i = 0; i < codeLines.length; i++) {
  31079. var item = codeLines[i];
  31080. if (!item.dragHtml) {
  31081. continue;
  31082. }
  31083. var $ele = $("<li>" + item.dragHtml + "</li>");
  31084. $ele.children(':first').attr('drag_id', item.id);
  31085. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31086. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31087. }
  31088. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31089. return html;
  31090. }
  31091. var codeLines = [
  31092. {
  31093. id: '$label',
  31094. value: layoutOrXtypeNameMap.label + ' - label',
  31095. icon: "fa fa-font",
  31096. dragType: "col-item",
  31097. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31098. code: {
  31099. xtype: 'label',
  31100. text: '文本' + _$2.uniqueId('_l')
  31101. }
  31102. },
  31103. {
  31104. id: '$text',
  31105. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31106. icon: "fa fa-edit",
  31107. dragType: "col-item",
  31108. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31109. code: {
  31110. xtype: 'textfield',
  31111. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31112. }
  31113. },
  31114. {
  31115. id: '$textarea',
  31116. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31117. icon: "fa fa-edit",
  31118. dragType: "col-item",
  31119. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31120. code: {
  31121. xtype: 'textareafield',
  31122. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31123. }
  31124. },
  31125. {
  31126. id: '$number',
  31127. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31128. icon: "fa fa-edit",
  31129. dragType: "col-item",
  31130. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31131. code: {
  31132. xtype: 'numberfield',
  31133. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31134. }
  31135. },
  31136. {
  31137. id: '$combo',
  31138. value: layoutOrXtypeNameMap.combo + ' - combo',
  31139. icon: "fa fa-angle-double-down",
  31140. dragType: "col-item",
  31141. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31142. code: {
  31143. xtype: 'combo',
  31144. fieldLabel: '请选择',
  31145. data: [
  31146. { id: 'id1', text: '选项1' },
  31147. { id: 'id2', text: '选项2' },
  31148. { id: 'id3', text: '选项3' },
  31149. ],
  31150. }
  31151. },
  31152. {
  31153. id: '$datebox',
  31154. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31155. icon: "fa fa-calendar",
  31156. dragType: "col-item",
  31157. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31158. code: {
  31159. xtype: "datefield",
  31160. fieldLabel: '日期',
  31161. }
  31162. },
  31163. {
  31164. id: '$searchbox',
  31165. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31166. icon: "fa fa-search",
  31167. dragType: "col-item",
  31168. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31169. code: {
  31170. xtype: 'searchfield',
  31171. fieldLabel: '搜索框',
  31172. }
  31173. },
  31174. {
  31175. id: '$combogrid',
  31176. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31177. icon: "fa fa-table",
  31178. dragType: "col-item",
  31179. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31180. code: {
  31181. xtype: 'combogrid',
  31182. fieldLabel: '下拉表'
  31183. }
  31184. },
  31185. {
  31186. id: '$combotree',
  31187. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31188. icon: "fa fa-tree",
  31189. dragType: "col-item",
  31190. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31191. code: {
  31192. xtype: 'combotree',
  31193. fieldLabel: '下拉树',
  31194. displayField: 'text',
  31195. rootVisible: false
  31196. }
  31197. },
  31198. {
  31199. id: '$button',
  31200. value: layoutOrXtypeNameMap.button + ' - button',
  31201. icon: 'fa fa-sign-in',
  31202. dragType: "col-item",
  31203. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31204. code: {
  31205. text: '按钮',
  31206. iconCls: 'x-fa fa-bars',
  31207. xtype: 'button'
  31208. }
  31209. },
  31210. {
  31211. id: '$checkbox',
  31212. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31213. icon: 'fa fa-check-square',
  31214. dragType: "col-item",
  31215. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31216. code: {
  31217. xtype: 'checkbox',
  31218. boxLabel: '勾选框',
  31219. hideLabel: true,
  31220. margin: '0 0 0 15',
  31221. flex: 0,
  31222. }
  31223. },
  31224. {
  31225. id: '$checkboxgroup',
  31226. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31227. icon: 'fa fa-check-square',
  31228. dragType: "col-item",
  31229. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31230. code: {
  31231. xtype: 'checkboxgroup',
  31232. fieldLabel: '勾选组',
  31233. items: [
  31234. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31235. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31236. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31237. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31238. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31239. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31240. ]
  31241. }
  31242. },
  31243. {
  31244. id: '$radio',
  31245. value: layoutOrXtypeNameMap.radio + ' - radio',
  31246. icon: 'fa fa-dot-circle-o',
  31247. dragType: "col-item",
  31248. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31249. code: {
  31250. xtype: "radio",
  31251. fieldLabel: "请选择",
  31252. }
  31253. },
  31254. {
  31255. id: '$radiogroup',
  31256. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31257. icon: 'fa fa-dot-circle-o',
  31258. dragType: "col-item",
  31259. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31260. code: {
  31261. xtype: "radiogroup",
  31262. fieldLabel: "请选择",
  31263. items: [
  31264. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31265. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31266. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31267. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31268. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31269. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31270. ]
  31271. }
  31272. },
  31273. {
  31274. id: '$cols',
  31275. value: layoutOrXtypeNameMap.cols + ' - cols',
  31276. icon: 'fa fa-list-alt',
  31277. dragType: "cols-container",
  31278. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31279. code: {
  31280. xtype: 'cols',
  31281. items: [
  31282. {
  31283. xtype: 'textfield',
  31284. fieldLabel: '输入框',
  31285. },
  31286. ],
  31287. }
  31288. },
  31289. {
  31290. id: '$container',
  31291. value: layoutOrXtypeNameMap.container + ' - container',
  31292. icon: 'fa fa-flag',
  31293. dragType: "col-item",
  31294. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31295. code: {
  31296. xtype: 'container',
  31297. border: false,
  31298. layout: 'hbox',
  31299. }
  31300. },
  31301. {
  31302. id: '$fit',
  31303. value: layoutOrXtypeNameMap.fit + ' - fit',
  31304. icon: 'fa fa-flag',
  31305. dragType: "rows-container",
  31306. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31307. code: {
  31308. border: false,
  31309. layout: 'fit',
  31310. items: [
  31311. {
  31312. xtype: 'container',
  31313. border: false,
  31314. layout: 'hbox',
  31315. }
  31316. ]
  31317. }
  31318. },
  31319. ];
  31320. // @ts-ignore
  31321. // export default ToolBoxCmp
  31322. //# sourceMappingURL=ToolBox.js.map
  31323. var that = undefined;
  31324. function initPropertyDesign () {
  31325. Ext.define('com.yvan.studio.PropertyDesign', {
  31326. extend: 'Ext.panel.Panel',
  31327. xtype: 'propertydesign',
  31328. name: "PropertyDesign",
  31329. tooltip: '属性',
  31330. iconCls: 'x-fa fa-newspaper-o',
  31331. reference: 'propertygrid',
  31332. layout: 'border',
  31333. border: false,
  31334. moduleId: null,
  31335. currentComponentVJson: null,
  31336. currentComponentPropertyEditSource: null,
  31337. vjson: null,
  31338. propertyHandle: null,
  31339. moduleSubscribe: null,
  31340. items: [
  31341. new Ext.grid.property.Grid({
  31342. sortableColumns: false,
  31343. region: 'center',
  31344. listeners: {
  31345. propertychange: function (source, propName, value, oldValue, eOpts) {
  31346. value = _.trim(value);
  31347. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31348. return item.label === propName;
  31349. });
  31350. if (a.type === 'listeners') {
  31351. if (value) {
  31352. if (that.currentComponentVJson.listeners) {
  31353. that.currentComponentVJson.listeners[propName] = value;
  31354. }
  31355. else {
  31356. var t = {};
  31357. t[propName] = value;
  31358. that.currentComponentVJson.listeners = t;
  31359. }
  31360. }
  31361. else {
  31362. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31363. if (!value1) {
  31364. delete that.currentComponentVJson.listeners[key];
  31365. }
  31366. else if (key === propName) {
  31367. delete that.currentComponentVJson.listeners[key];
  31368. }
  31369. });
  31370. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31371. delete that.currentComponentVJson.listeners;
  31372. }
  31373. }
  31374. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31375. vjson: that.vjson,
  31376. from: that.name,
  31377. ignoreRenderUI: true
  31378. });
  31379. }
  31380. else if (a.type === 'fix') {
  31381. if (!value) {
  31382. delete that.currentComponentVJson[propName];
  31383. }
  31384. else {
  31385. that.currentComponentVJson[propName] = value.split("\r\n");
  31386. }
  31387. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31388. vjson: that.vjson,
  31389. from: that.name,
  31390. ignoreRenderUI: true
  31391. });
  31392. }
  31393. else if (a.type === 'bind') {
  31394. var bind_1 = that.currentComponentVJson.bind;
  31395. if (typeof bind_1 === 'string' && a.id === "value") {
  31396. if (value) {
  31397. that.currentComponentVJson.bind = value;
  31398. }
  31399. else {
  31400. delete that.currentComponentVJson.bind;
  31401. }
  31402. }
  31403. else {
  31404. // 转成bind对象
  31405. if (typeof bind_1 === 'string') {
  31406. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31407. }
  31408. if (value) {
  31409. if (bind_1) {
  31410. bind_1[a.id] = value;
  31411. }
  31412. else {
  31413. var t = {};
  31414. t[a.id] = value;
  31415. that.currentComponentVJson.bind = t;
  31416. }
  31417. }
  31418. else {
  31419. _.forOwn(bind_1, function (value1, key) {
  31420. if (!value1) {
  31421. delete bind_1[key];
  31422. }
  31423. else if (key === a.id) {
  31424. delete bind_1[key];
  31425. }
  31426. });
  31427. if (Object.keys(bind_1).length <= 0) {
  31428. delete that.currentComponentVJson.bind;
  31429. }
  31430. }
  31431. }
  31432. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31433. vjson: that.vjson,
  31434. from: that.name,
  31435. ignoreRenderUI: true
  31436. });
  31437. }
  31438. else if (a.type === 'boolean') {
  31439. if (!value) {
  31440. delete that.currentComponentVJson[propName];
  31441. }
  31442. else if (value === 'false') {
  31443. that.currentComponentVJson[propName] = false;
  31444. }
  31445. else if (value === 'true') {
  31446. that.currentComponentVJson[propName] = true;
  31447. }
  31448. else {
  31449. that.currentComponentVJson[propName] = value;
  31450. }
  31451. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31452. vjson: that.vjson,
  31453. from: that.name
  31454. });
  31455. }
  31456. else {
  31457. that.currentComponentVJson[propName] = value;
  31458. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31459. vjson: that.vjson,
  31460. from: that.name
  31461. });
  31462. }
  31463. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31464. },
  31465. }
  31466. })
  31467. ],
  31468. listeners: {
  31469. // afterrender() {
  31470. // this.propertyHandle.setSource({
  31471. // "(name)": "My Object",
  31472. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31473. // "Available": false, // boolean type
  31474. // "Version": .01, // decimal type
  31475. // "Description": "A test object"
  31476. // });
  31477. // }
  31478. },
  31479. initComponent: function () {
  31480. var _this = this;
  31481. this.propertyHandle = this.items[0];
  31482. setPropertyPanel(this);
  31483. that = this;
  31484. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31485. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31486. _this.setVjson(moduleId, from, ignoreRenderUI);
  31487. });
  31488. return this.superclass.initComponent.apply(this, arguments);
  31489. },
  31490. setVjson: function (moduleId, from, ignoreRenderUI) {
  31491. var _this = this;
  31492. // if (this.moduleId === null && moduleId) {
  31493. // this.moduleId = moduleId
  31494. // }
  31495. if (moduleId !== this.moduleId || from === this.name) {
  31496. return;
  31497. }
  31498. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31499. if (!moduleObj) {
  31500. return;
  31501. }
  31502. this.vjson = moduleObj.moduleObj.vjson;
  31503. this.setPropertyAndEventSource();
  31504. if (this.componentSelectionChangeSubscribe) {
  31505. this.componentSelectionChangeSubscribe.cancel();
  31506. this.componentSelectionChangeSubscribe = null;
  31507. }
  31508. if (this.updateVjsonChangeSubscribe) {
  31509. this.updateVjsonChangeSubscribe.cancel();
  31510. this.updateVjsonChangeSubscribe = null;
  31511. }
  31512. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31513. var id = _a.id, from = _a.from;
  31514. _this.onComponentSelectionChange(id, from);
  31515. });
  31516. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31517. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31518. _this.updateVjson(vjson, from, ignoreRenderUI);
  31519. });
  31520. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31521. this.onComponentSelectionChange(id, from);
  31522. },
  31523. updateVjson: function (vjson, from, ignoreRenderUI) {
  31524. if (!vjson || from === this.name) {
  31525. return;
  31526. }
  31527. this.vjson = vjson;
  31528. this.setPropertyAndEventSource();
  31529. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31530. this.onComponentSelectionChange(id, from);
  31531. },
  31532. onComponentSelectionChange: function (id, from) {
  31533. if (from !== this.name) {
  31534. this.currentComponentVJson = findInCode(this.vjson, id);
  31535. this.setPropertyAndEventSource();
  31536. }
  31537. },
  31538. setPropertyAndEventSource: function () {
  31539. var _this = this;
  31540. this.propertyHandle.setSource({});
  31541. if (!this.currentComponentVJson) {
  31542. return;
  31543. }
  31544. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31545. var v = xtype;
  31546. // 选中的对象可能是组
  31547. if (!v) {
  31548. if (_.has(this.currentComponentVJson, "cols")) {
  31549. v = "cols";
  31550. }
  31551. else if (_.has(this.currentComponentVJson, "rows")) {
  31552. v = "rows";
  31553. }
  31554. }
  31555. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31556. if (!pd) {
  31557. // 这个组件没有属性
  31558. this.propertyHandle.setSource({});
  31559. return;
  31560. }
  31561. var funcArr = this.getAllfuncs();
  31562. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31563. // disabled: true,
  31564. displayField: 'name',
  31565. valueField: 'name',
  31566. store: funcArr,
  31567. }); };
  31568. // ====================== 属性
  31569. var elements = [];
  31570. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31571. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31572. var props = pd.getPropsByGroup(group);
  31573. if (props.length <= 0)
  31574. return; //没有这一组属性
  31575. // 显示 group 的中文名
  31576. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31577. if (caption[i] === '绑定') {
  31578. _.each(props, function (prop) {
  31579. elements.push({
  31580. label: "_" + prop.name,
  31581. type: "bind",
  31582. id: prop.name,
  31583. desc: prop.desc,
  31584. editor: new Ext.form.field.Text()
  31585. });
  31586. });
  31587. }
  31588. else {
  31589. _.each(props, function (prop) {
  31590. if (_.isArray(prop.type)) {
  31591. elements.push({
  31592. label: prop.name,
  31593. type: "combo",
  31594. options: prop.type,
  31595. id: prop.name,
  31596. desc: prop.desc
  31597. });
  31598. return;
  31599. }
  31600. switch (prop.type) {
  31601. case 'boolean': {
  31602. elements.push({
  31603. label: prop.name,
  31604. id: prop.name,
  31605. desc: prop.desc,
  31606. type: 'boolean',
  31607. editor: new Ext.form.field.ComboBox({
  31608. displayField: 'text',
  31609. valueField: 'id',
  31610. store: new Ext.data.Store({
  31611. field: ['id', 'text'],
  31612. data: [
  31613. { id: 'true', text: 'True' },
  31614. { id: 'false', text: 'False' },
  31615. ]
  31616. })
  31617. }),
  31618. });
  31619. break;
  31620. }
  31621. case 'number': {
  31622. elements.push({
  31623. label: prop.name,
  31624. type: "number",
  31625. id: prop.name,
  31626. isNum: true,
  31627. desc: prop.desc,
  31628. editor: new Ext.form.field.Number()
  31629. });
  31630. break;
  31631. }
  31632. case 'string': {
  31633. elements.push({
  31634. label: prop.name,
  31635. type: "string",
  31636. id: prop.name,
  31637. desc: prop.desc,
  31638. editor: new Ext.form.field.Text()
  31639. });
  31640. break;
  31641. }
  31642. case 'listeners': {
  31643. elements.push({
  31644. label: prop.name,
  31645. type: "listeners",
  31646. id: prop.name,
  31647. desc: prop.desc,
  31648. editor: createFuncEditor()
  31649. });
  31650. break;
  31651. }
  31652. case 'fix': {
  31653. elements.push({
  31654. label: prop.name,
  31655. type: "fix",
  31656. id: prop.name,
  31657. desc: prop.desc,
  31658. editor: new Ext.form.field.Text()
  31659. });
  31660. break;
  31661. }
  31662. case 'object': {
  31663. break;
  31664. }
  31665. // case 'dataSource' : {
  31666. // break;
  31667. // }
  31668. case 'valid': {
  31669. break;
  31670. }
  31671. default:
  31672. elements.push({
  31673. label: prop.name,
  31674. type: prop.type,
  31675. id: prop.name,
  31676. desc: prop.desc,
  31677. editor: new Ext.form.field.Text({ disabled: true })
  31678. });
  31679. console.error('不支持的编辑类型', prop);
  31680. }
  31681. });
  31682. }
  31683. });
  31684. this.currentComponentPropertyEditSource = elements;
  31685. var panel1Source = {};
  31686. var panel1SourceConfig = {};
  31687. _.each(elements, function (item) {
  31688. var _a;
  31689. if (item.type === "listeners") {
  31690. var listeners = _this.currentComponentVJson.listeners;
  31691. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31692. }
  31693. else if (item.type === "fix") {
  31694. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31695. }
  31696. else if (item.type === "bind") {
  31697. var bind = _this.currentComponentVJson.bind;
  31698. if (typeof bind === 'string' && item.id === 'value') {
  31699. panel1Source[item.label] = bind;
  31700. }
  31701. else {
  31702. panel1Source[item.label] = bind ? bind[item.id] : '';
  31703. }
  31704. }
  31705. else {
  31706. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31707. }
  31708. panel1Source[item.label] = panel1Source[item.label] || '';
  31709. panel1SourceConfig[item.label] = { editor: item.editor };
  31710. });
  31711. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31712. },
  31713. getAllfuncs: function () {
  31714. var _a, _b;
  31715. 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;
  31716. var scopeFuncs = [];
  31717. _.forEach(arr, function (item) {
  31718. scopeFuncs.push({ name: "scope." + item.name });
  31719. });
  31720. return scopeFuncs;
  31721. }
  31722. });
  31723. }
  31724. //# sourceMappingURL=PropertyDesign.js.map
  31725. function initViewOutlineTree () {
  31726. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31727. extend: 'Ext.tree.Panel',
  31728. xtype: 'viewoutlinetree',
  31729. name: "ViewOutlineTree",
  31730. tooltip: '设计大纲',
  31731. iconCls: 'x-fa fa-list',
  31732. rootVisible: false,
  31733. useArrows: true,
  31734. allowDeselect: true,
  31735. colspan: 2,
  31736. lines: false,
  31737. reference: 'viewoutlinetree',
  31738. multiSelect: true,
  31739. _saveStateFlag: true,
  31740. keyMapEnabled: true,
  31741. moduleId: null,
  31742. vjson: null,
  31743. columns: [
  31744. {
  31745. xtype: 'treecolumn',
  31746. text: '布局',
  31747. dataIndex: 'layoutNameDesc',
  31748. flex: 2,
  31749. sortable: true
  31750. }, {
  31751. text: '组件',
  31752. dataIndex: 'xtype',
  31753. flex: 1,
  31754. sortable: true,
  31755. align: 'center',
  31756. }
  31757. ],
  31758. listeners: {
  31759. itemcontextmenu: function (sender, node, element, idx, e) {
  31760. e.preventDefault();
  31761. this.rightClickTreeNode(sender, node, element, idx, e);
  31762. },
  31763. select: function (sender, node, index, e) {
  31764. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31765. },
  31766. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31767. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31768. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31769. }
  31770. }
  31771. },
  31772. initComponent: function () {
  31773. var _this = this;
  31774. setViewoutlinetree(this);
  31775. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31776. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31777. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31778. });
  31779. return this.superclass.initComponent.apply(this, arguments);
  31780. },
  31781. clear: function () {
  31782. this.setRootNode(null);
  31783. },
  31784. onChangModule: function (moduleId, oldModuleId, from) {
  31785. if (!moduleId || moduleId !== this.moduleId) {
  31786. return;
  31787. }
  31788. if (moduleStore.getModuleObject(moduleId)) {
  31789. this.setVjson(moduleId, from);
  31790. }
  31791. },
  31792. setVjson: function (moduleId, from, ignoreRenderUI) {
  31793. var _this = this;
  31794. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31795. return;
  31796. }
  31797. this.moduleId = moduleId;
  31798. // if (from === this.name) {
  31799. // return
  31800. // }
  31801. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31802. this.setTreeValue();
  31803. if (this.componentSelectionChangeSubscribe) {
  31804. this.componentSelectionChangeSubscribe.cancel();
  31805. this.componentSelectionChangeSubscribe = null;
  31806. }
  31807. if (this.setVjsonChangeSubscribe) {
  31808. this.setVjsonChangeSubscribe.cancel();
  31809. this.setVjsonChangeSubscribe = null;
  31810. }
  31811. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31812. var id = _a.id, from = _a.from;
  31813. return _this.onComponentSelectionChange(id, from);
  31814. });
  31815. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31816. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31817. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31818. });
  31819. },
  31820. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31821. if (!vjson || from === this.name) {
  31822. return;
  31823. }
  31824. this.vjson = vjson;
  31825. this.setTreeValue();
  31826. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31827. if (id) {
  31828. this.selectPath(id);
  31829. }
  31830. },
  31831. onComponentSelectionChange: function (id, from) {
  31832. if (from !== this.name) {
  31833. if (id) {
  31834. this.selectPath(id);
  31835. }
  31836. else {
  31837. this.setTreeValue();
  31838. }
  31839. }
  31840. },
  31841. setTreeValue: function () {
  31842. var outlineVj = {};
  31843. _.forOwn(this.vjson, function (obj, key) {
  31844. if (key !== 'viewModel' && key !== 'store') {
  31845. outlineVj[key] = _.cloneDeep(obj);
  31846. }
  31847. });
  31848. getLayoutOutline(outlineVj);
  31849. this.setRootNode(outlineVj);
  31850. },
  31851. rightClickTreeNode: function (sender, node, element, idx, e) {
  31852. var raw = node.data;
  31853. var option = {};
  31854. // 右键
  31855. option = {
  31856. shadow: 'frame',
  31857. allowOtherMenus: true,
  31858. items: []
  31859. };
  31860. var switchType = raw.layoutName;
  31861. if (raw.layoutName === 'north' ||
  31862. raw.layoutName === 'south' ||
  31863. raw.layoutName === 'west' ||
  31864. raw.layoutName === 'east' ||
  31865. raw.layoutName === 'center' ||
  31866. raw.layoutName === 'tbar' ||
  31867. raw.layoutName === 'fbar') {
  31868. switchType = raw.xtype || raw.layout;
  31869. }
  31870. var itemArr = [];
  31871. var hasTbar = false, hasFbar = false, hasBody = false;
  31872. if (raw.hasOwnProperty("children")) {
  31873. _.forEach(raw.children, function (value) {
  31874. if (value.layoutName === 'tbar') {
  31875. hasTbar = true;
  31876. }
  31877. else if (value.layoutName === 'fbar') {
  31878. hasFbar = true;
  31879. }
  31880. else {
  31881. hasBody = true;
  31882. }
  31883. });
  31884. }
  31885. switch (switchType) {
  31886. case 'fit':
  31887. if (!hasTbar) {
  31888. itemArr.push('tbar');
  31889. }
  31890. if (!hasFbar) {
  31891. itemArr.push('fbar');
  31892. }
  31893. if (!hasBody) {
  31894. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31895. }
  31896. option.items = this.menuNew(itemArr, raw);
  31897. break;
  31898. case 'border':
  31899. if (!hasTbar) {
  31900. itemArr.push('tbar');
  31901. }
  31902. if (!hasFbar) {
  31903. itemArr.push('fbar');
  31904. }
  31905. itemArr.push('cnsew');
  31906. option.items = this.menuNew(itemArr, raw);
  31907. break;
  31908. // case 'tbar':
  31909. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31910. // break;
  31911. // case 'fbar':
  31912. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31913. // break;
  31914. case 'tabpanel':
  31915. if (!hasTbar) {
  31916. itemArr.push('tbar');
  31917. }
  31918. if (!hasFbar) {
  31919. itemArr.push('fbar');
  31920. }
  31921. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31922. option.items = this.menuNew(itemArr, raw);
  31923. break;
  31924. case 'yvgrid':
  31925. if (!hasTbar) {
  31926. itemArr.push('tbar');
  31927. }
  31928. option.items = this.menuNew(itemArr, raw);
  31929. break;
  31930. case 'tree':
  31931. if (!hasTbar) {
  31932. itemArr.push('tbar');
  31933. }
  31934. if (!hasFbar) {
  31935. itemArr.push('fbar');
  31936. }
  31937. option.items = this.menuNew(itemArr, raw);
  31938. break;
  31939. case 'fieldset':
  31940. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31941. break;
  31942. case 'form':
  31943. if (!hasTbar) {
  31944. itemArr.push('tbar');
  31945. }
  31946. if (!hasFbar) {
  31947. itemArr.push('fbar');
  31948. }
  31949. itemArr.push('form', 'fieldset', 'cols');
  31950. option.items = this.menuNew(itemArr, raw);
  31951. break;
  31952. case 'toolbar':
  31953. itemArr.push('button', 'textfield', 'label', 'combo');
  31954. option.items = this.menuNew(itemArr, raw);
  31955. break;
  31956. // case 'fbar':
  31957. // itemArr.push('button', 'textfield', 'label', 'combo')
  31958. // option.items = this.menuNew(itemArr, raw)
  31959. // break
  31960. default:
  31961. option.items = this.menuNew(itemArr, raw);
  31962. break;
  31963. }
  31964. var treeMenu = new Ext.menu.Menu(option);
  31965. treeMenu.showAt(e.getXY());
  31966. },
  31967. newItem: function (viewType, raw, region) {
  31968. var itemVjson = {};
  31969. switch (viewType) {
  31970. case 'fit':
  31971. itemVjson.layout = 'fit';
  31972. itemVjson.items = [];
  31973. break;
  31974. case 'border':
  31975. itemVjson.layout = 'border';
  31976. itemVjson.items = [];
  31977. break;
  31978. case 'toolbar':
  31979. itemVjson.xtype = 'toolbar';
  31980. itemVjson.title = 'toolbar';
  31981. itemVjson.items = [
  31982. {
  31983. xtype: 'button',
  31984. text: 'button'
  31985. }
  31986. ];
  31987. break;
  31988. case 'tabpanel':
  31989. itemVjson.xtype = 'tabpanel';
  31990. itemVjson.layout = 'fit';
  31991. itemVjson.items = [];
  31992. break;
  31993. case 'yvgrid':
  31994. itemVjson.xtype = 'yvgrid';
  31995. itemVjson.layout = 'fit';
  31996. itemVjson.pagination = false;
  31997. itemVjson.columns = [
  31998. {
  31999. dataIndex: "skuId",
  32000. header: "SKU_ID",
  32001. },
  32002. ];
  32003. break;
  32004. case 'tree':
  32005. itemVjson.xtype = 'treepanel';
  32006. itemVjson.layout = 'fit';
  32007. break;
  32008. case 'fieldset':
  32009. case 'form':
  32010. itemVjson.xtype = viewType;
  32011. itemVjson.title = viewType;
  32012. itemVjson.items = [
  32013. {
  32014. xtype: 'cols',
  32015. items: [
  32016. {
  32017. xtype: 'textfield',
  32018. fieldLabel: '输入框'
  32019. }
  32020. ]
  32021. }
  32022. ];
  32023. break;
  32024. case 'cols':
  32025. itemVjson.xtype = 'cols';
  32026. itemVjson.items = [
  32027. {
  32028. xtype: 'textfield',
  32029. fieldLabel: '输入框'
  32030. }
  32031. ];
  32032. break;
  32033. case 'button':
  32034. itemVjson.xtype = 'button';
  32035. itemVjson.text = '按钮';
  32036. itemVjson.iconCls = 'x-fa fa-plus';
  32037. break;
  32038. case 'textfield':
  32039. itemVjson.xtype = 'textfield';
  32040. itemVjson.fieldLabel = '输入框';
  32041. break;
  32042. case 'combo':
  32043. itemVjson.xtype = 'combo';
  32044. itemVjson.fieldLabel = '下拉框';
  32045. break;
  32046. case 'label':
  32047. itemVjson.xtype = 'label';
  32048. itemVjson.text = '文本';
  32049. break;
  32050. }
  32051. var target = findInCode(this.vjson, raw.id);
  32052. if (region) {
  32053. if (region === 'tbar' || region === 'fbar') {
  32054. target[region] = itemVjson;
  32055. }
  32056. else {
  32057. itemVjson.region = region;
  32058. itemVjson.split = true;
  32059. if (region === 'north' || region === 'south') {
  32060. itemVjson.height = '30%';
  32061. itemVjson.collapsible = true;
  32062. }
  32063. else if (region === 'west' || region === 'east') {
  32064. itemVjson.width = '30%';
  32065. itemVjson.collapsible = true;
  32066. }
  32067. target.items.push(itemVjson);
  32068. }
  32069. }
  32070. else {
  32071. if (target.xtype === 'tabpanel') {
  32072. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32073. }
  32074. target.items.push(itemVjson);
  32075. }
  32076. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32077. },
  32078. menuNew: function (typeArr, raw, region) {
  32079. var that = this;
  32080. var reArr = [];
  32081. typeArr.forEach(function (value) {
  32082. if (value === 'cnsew') {
  32083. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32084. }
  32085. else if (value === 'tbar' || value === 'fbar') {
  32086. reArr.push(that.menuNewTFBar(value, raw));
  32087. }
  32088. else {
  32089. reArr.push({
  32090. text: '新建' + layoutOrXtypeNameMap[value],
  32091. iconCls: 'x-fa fa-plus',
  32092. handler: function (sender) {
  32093. that.newItem(value, raw, region);
  32094. }
  32095. });
  32096. }
  32097. reArr.push("-");
  32098. });
  32099. if (region) {
  32100. reArr.pop();
  32101. return reArr;
  32102. }
  32103. reArr.push({
  32104. text: '高级属性',
  32105. iconCls: 'x-fa fa-cog',
  32106. handler: function (sender) {
  32107. var vj = findInCode(that.vjson, raw.id);
  32108. that.advancedSettingWindow(vj);
  32109. }
  32110. }, {
  32111. text: '上移',
  32112. iconCls: 'x-fa fa-trash',
  32113. handler: function (sender) {
  32114. that.moveCmp(raw.id, 'up');
  32115. }
  32116. }, {
  32117. text: '置顶',
  32118. iconCls: 'x-fa fa-trash',
  32119. handler: function (sender) {
  32120. that.moveCmp(raw.id, 'top');
  32121. }
  32122. }, {
  32123. text: '置底',
  32124. iconCls: 'x-fa fa-trash',
  32125. handler: function (sender) {
  32126. that.moveCmp(raw.id, 'bottom');
  32127. }
  32128. }, {
  32129. text: '下移',
  32130. iconCls: 'x-fa fa-trash',
  32131. handler: function (sender) {
  32132. that.moveCmp(raw.id, 'down');
  32133. }
  32134. }, {
  32135. text: '删除',
  32136. iconCls: 'x-fa fa-trash',
  32137. handler: function (sender) {
  32138. deletVjsonById(that.vjson, raw.id);
  32139. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32140. }
  32141. });
  32142. return reArr;
  32143. },
  32144. menuNewCNSEW: function (raw) {
  32145. var that = this;
  32146. var arr = ['center', 'north', 'south', 'west', 'east'];
  32147. if (raw.hasOwnProperty("children")) {
  32148. _.forEach(raw.children, function (value) {
  32149. _.remove(arr, function (it) {
  32150. return it === value.layoutName;
  32151. });
  32152. });
  32153. }
  32154. var reArr = [];
  32155. arr.forEach(function (value) {
  32156. reArr.push({
  32157. text: layoutOrXtypeNameMap[value],
  32158. iconCls: 'x-fa fa-plus',
  32159. menu: {
  32160. showSeparator: true,
  32161. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32162. }
  32163. });
  32164. reArr.push("-");
  32165. });
  32166. reArr.pop();
  32167. return reArr;
  32168. },
  32169. menuNewTFBar: function (barType, raw) {
  32170. var that = this;
  32171. var reObj = {
  32172. text: layoutOrXtypeNameMap[barType],
  32173. iconCls: 'x-fa fa-plus',
  32174. menu: {
  32175. showSeparator: true,
  32176. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32177. }
  32178. };
  32179. return reObj;
  32180. },
  32181. moveCmp: function (id, moveType) {
  32182. var arr = findArrayContainer(this.vjson, id);
  32183. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32184. if (index < 0) {
  32185. return;
  32186. }
  32187. switch (moveType) {
  32188. case 'up':
  32189. if (index > 0) {
  32190. var o = arr[index];
  32191. arr[index] = arr[index - 1];
  32192. arr[index - 1] = o;
  32193. }
  32194. else {
  32195. return;
  32196. }
  32197. break;
  32198. case 'down':
  32199. if (index < arr.length - 1) {
  32200. var o = arr[index];
  32201. arr[index] = arr[index + 1];
  32202. arr[index + 1] = o;
  32203. }
  32204. else {
  32205. return;
  32206. }
  32207. break;
  32208. case 'top':
  32209. if (index > 0) {
  32210. var o = arr[index];
  32211. arr[index] = arr[0];
  32212. arr[0] = o;
  32213. }
  32214. else {
  32215. return;
  32216. }
  32217. break;
  32218. case 'bottom':
  32219. if (index < arr.length - 1) {
  32220. var o = arr[index];
  32221. arr[index] = arr[arr.length - 1];
  32222. arr[arr.length - 1] = o;
  32223. }
  32224. else {
  32225. return;
  32226. }
  32227. break;
  32228. }
  32229. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32230. }
  32231. });
  32232. }
  32233. //# sourceMappingURL=ViewOutlineTree.js.map
  32234. function init$2 () {
  32235. window['native'] = native;
  32236. native.init();
  32237. init();
  32238. instance.getAllDomain().finally(function () {
  32239. });
  32240. initStateTree();
  32241. initDashboard();
  32242. initFileTree();
  32243. initDbTree();
  32244. initReportGrid();
  32245. initGroovyEditor();
  32246. initJsEditor$1();
  32247. initJsonEditor$1();
  32248. initSqlEditor$1();
  32249. initTemplateEditor();
  32250. initDict$1();
  32251. initBpmnTree();
  32252. initToolBox();
  32253. initPropertyDesign();
  32254. initViewOutlineTree();
  32255. initWidget();
  32256. initWhLayout();
  32257. initApiTree();
  32258. initTaskTree();
  32259. initLogsTree();
  32260. initDevOpsTree();
  32261. initTerminal();
  32262. initMonitorTree();
  32263. initHomeTree();
  32264. }
  32265. //# sourceMappingURL=init.js.map
  32266. var studio = {
  32267. init: init$2,
  32268. handles: handles$1,
  32269. Workbench: Workbench
  32270. };
  32271. //# sourceMappingURL=index.js.map
  32272. exports.axios = axios;
  32273. exports.qs = Qs;
  32274. exports.lodash = _$2;
  32275. exports.jquery = $$2;
  32276. exports.moment = moment$1;
  32277. exports.recast = recast;
  32278. exports.XLSX = XLSX;
  32279. exports.Defaults = Defaults;
  32280. exports.ExcelImportDialog = ExcelImportDialog;
  32281. exports.Lib = Lib;
  32282. exports.LibParam = LibParam;
  32283. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32284. exports.ReportScope = ReportScope;
  32285. exports.SIMPLE_RE = SIMPLE_RE;
  32286. exports.Scope = Scope;
  32287. exports.ScopeEngine = ScopeEngine;
  32288. exports.SystemEventFu = SystemEventFu;
  32289. exports.ajax = ajax;
  32290. exports.baseConfigProcess = baseConfigProcess;
  32291. exports.baseConfigProcessList = baseConfigProcessList;
  32292. exports.buildPlus = buildPlus;
  32293. exports.buildReportScope = buildReportScope;
  32294. exports.calcExpress = calcExpress;
  32295. exports.calcObject = calcObject;
  32296. exports.calcObjectFlat = calcObjectFlat;
  32297. exports.clearViewModel = clearViewModel;
  32298. exports.clearViewModelByLookup = clearViewModelByLookup;
  32299. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32300. exports.clearViewModelValues = clearViewModelValues;
  32301. exports.commitMe = commitMe;
  32302. exports.confirm = confirm;
  32303. exports.createAjax = createAjax;
  32304. exports.createUUID = createUUID;
  32305. exports.deepTravJson = deepTravJson;
  32306. exports.downLoad = downLoad;
  32307. exports.evalFunction = evalFunction;
  32308. exports.extend = extend;
  32309. exports.flatRow = flatRow;
  32310. exports.getApiConvert = getApiConvert;
  32311. exports.getGridEditRows = getGridEditRows;
  32312. exports.getParentGrid = getParentGrid;
  32313. exports.getPinyin = getPinyin;
  32314. exports.getRegList = getRegList;
  32315. exports.getRegParamList = getRegParamList;
  32316. exports.getScopeOnCreate = getScopeOnCreate;
  32317. exports.init = init$1;
  32318. exports.insertGridRow = insertGridRow;
  32319. exports.invokeServer = invokeServer$1;
  32320. exports.isDesignMode = isDesignMode;
  32321. exports.isEmpty = isEmpty;
  32322. exports.json5 = dist;
  32323. exports.keywordFilter = keywordFilter;
  32324. exports.lookupFn = lookupFn;
  32325. exports.lookupScope = lookupScope;
  32326. exports.mergeViewModel = mergeViewModel;
  32327. exports.moveDownGridRow = moveDownGridRow;
  32328. exports.moveUpGridRow = moveUpGridRow;
  32329. exports.msg = msg$1;
  32330. exports.msgError = msgError;
  32331. exports.normId = normId;
  32332. exports.pinyinMatch = pinyinMatch;
  32333. exports.prompt = prompt$2;
  32334. exports.raiseClick = raiseClick;
  32335. exports.reloadGrid = reloadGrid;
  32336. exports.removeGridRow = removeGridRow;
  32337. exports.replaceNA = replaceNA;
  32338. exports.saveGridRow = saveGridRow;
  32339. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32340. exports.setComboStore = setComboStore;
  32341. exports.showErrorDialog = showErrorDialog$1;
  32342. exports.showInfoDialog = showInfoDialog;
  32343. exports.showWidget = showWidget;
  32344. exports.sqlUrlTransform = sqlUrlTransform;
  32345. exports.stopEvent = stopEvent;
  32346. exports.studio = studio;
  32347. exports.toPlainObject = toPlainObject;
  32348. exports.toString = toString;
  32349. exports.tryEnable = tryEnable;
  32350. exports.tryVarSimple = tryVarSimple;
  32351. exports.tryWriteByExpress = tryWriteByExpress;
  32352. exports.tryWriteObject = tryWriteObject;
  32353. exports.watch = watch;
  32354. Object.defineProperty(exports, '__esModule', { value: true });
  32355. });
  32356. //# sourceMappingURL=yvan-ext.js.map