yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869
  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. //# sourceMappingURL=Defaults.js.map
  229. var Defaults = /*#__PURE__*/Object.freeze({
  230. __proto__: null,
  231. windows: windows,
  232. date: date,
  233. tagfield: tagfield,
  234. combo: combo,
  235. comboGrid: comboGrid,
  236. comboGridPicker: comboGridPicker,
  237. comboGridMulti: comboGridMulti,
  238. comboGridMultiPicker: comboGridMultiPicker,
  239. numberfield: numberfield,
  240. checkbox: checkbox,
  241. checkboxgroup: checkboxgroup,
  242. radio: radio,
  243. radiogroup: radiogroup,
  244. form: form,
  245. column: column,
  246. grid: grid,
  247. fieldContainer: fieldContainer,
  248. tree: tree,
  249. search: search,
  250. text: text,
  251. toolbar: toolbar,
  252. tbfill: tbfill,
  253. tbseparator: tbseparator,
  254. button: button,
  255. fieldSet: fieldSet,
  256. storeAjax: storeAjax,
  257. panel: panel,
  258. splitter: splitter,
  259. maintab: maintab,
  260. rows: rows,
  261. cols: cols,
  262. bpmn: bpmn
  263. });
  264. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  265. function createCommonjsModule(fn, module) {
  266. return module = { exports: {} }, fn(module, module.exports), module.exports;
  267. }
  268. var dist = createCommonjsModule(function (module, exports) {
  269. (function (global, factory) {
  270. module.exports = factory() ;
  271. }(commonjsGlobal, (function () {
  272. function createCommonjsModule(fn, module) {
  273. return module = { exports: {} }, fn(module, module.exports), module.exports;
  274. }
  275. var _global = createCommonjsModule(function (module) {
  276. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  277. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  278. ? window : typeof self != 'undefined' && self.Math == Math ? self
  279. // eslint-disable-next-line no-new-func
  280. : Function('return this')();
  281. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  282. });
  283. var _core = createCommonjsModule(function (module) {
  284. var core = module.exports = { version: '2.6.5' };
  285. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  286. });
  287. var _core_1 = _core.version;
  288. var _isObject = function (it) {
  289. return typeof it === 'object' ? it !== null : typeof it === 'function';
  290. };
  291. var _anObject = function (it) {
  292. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  293. return it;
  294. };
  295. var _fails = function (exec) {
  296. try {
  297. return !!exec();
  298. } catch (e) {
  299. return true;
  300. }
  301. };
  302. // Thank's IE8 for his funny defineProperty
  303. var _descriptors = !_fails(function () {
  304. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  305. });
  306. var document = _global.document;
  307. // typeof document.createElement is 'object' in old IE
  308. var is = _isObject(document) && _isObject(document.createElement);
  309. var _domCreate = function (it) {
  310. return is ? document.createElement(it) : {};
  311. };
  312. var _ie8DomDefine = !_descriptors && !_fails(function () {
  313. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  314. });
  315. // 7.1.1 ToPrimitive(input [, PreferredType])
  316. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  317. // and the second argument - flag - preferred type is a string
  318. var _toPrimitive = function (it, S) {
  319. if (!_isObject(it)) { return it; }
  320. var fn, val;
  321. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  323. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  324. throw TypeError("Can't convert object to primitive value");
  325. };
  326. var dP = Object.defineProperty;
  327. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  328. _anObject(O);
  329. P = _toPrimitive(P, true);
  330. _anObject(Attributes);
  331. if (_ie8DomDefine) { try {
  332. return dP(O, P, Attributes);
  333. } catch (e) { /* empty */ } }
  334. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  335. if ('value' in Attributes) { O[P] = Attributes.value; }
  336. return O;
  337. };
  338. var _objectDp = {
  339. f: f
  340. };
  341. var _propertyDesc = function (bitmap, value) {
  342. return {
  343. enumerable: !(bitmap & 1),
  344. configurable: !(bitmap & 2),
  345. writable: !(bitmap & 4),
  346. value: value
  347. };
  348. };
  349. var _hide = _descriptors ? function (object, key, value) {
  350. return _objectDp.f(object, key, _propertyDesc(1, value));
  351. } : function (object, key, value) {
  352. object[key] = value;
  353. return object;
  354. };
  355. var hasOwnProperty = {}.hasOwnProperty;
  356. var _has = function (it, key) {
  357. return hasOwnProperty.call(it, key);
  358. };
  359. var id = 0;
  360. var px = Math.random();
  361. var _uid = function (key) {
  362. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  363. };
  364. var _shared = createCommonjsModule(function (module) {
  365. var SHARED = '__core-js_shared__';
  366. var store = _global[SHARED] || (_global[SHARED] = {});
  367. (module.exports = function (key, value) {
  368. return store[key] || (store[key] = value !== undefined ? value : {});
  369. })('versions', []).push({
  370. version: _core.version,
  371. mode: 'global',
  372. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  373. });
  374. });
  375. var _functionToString = _shared('native-function-to-string', Function.toString);
  376. var _redefine = createCommonjsModule(function (module) {
  377. var SRC = _uid('src');
  378. var TO_STRING = 'toString';
  379. var TPL = ('' + _functionToString).split(TO_STRING);
  380. _core.inspectSource = function (it) {
  381. return _functionToString.call(it);
  382. };
  383. (module.exports = function (O, key, val, safe) {
  384. var isFunction = typeof val == 'function';
  385. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  386. if (O[key] === val) { return; }
  387. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  388. if (O === _global) {
  389. O[key] = val;
  390. } else if (!safe) {
  391. delete O[key];
  392. _hide(O, key, val);
  393. } else if (O[key]) {
  394. O[key] = val;
  395. } else {
  396. _hide(O, key, val);
  397. }
  398. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  399. })(Function.prototype, TO_STRING, function toString() {
  400. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  401. });
  402. });
  403. var _aFunction = function (it) {
  404. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  405. return it;
  406. };
  407. // optional / simple context binding
  408. var _ctx = function (fn, that, length) {
  409. _aFunction(fn);
  410. if (that === undefined) { return fn; }
  411. switch (length) {
  412. case 1: return function (a) {
  413. return fn.call(that, a);
  414. };
  415. case 2: return function (a, b) {
  416. return fn.call(that, a, b);
  417. };
  418. case 3: return function (a, b, c) {
  419. return fn.call(that, a, b, c);
  420. };
  421. }
  422. return function (/* ...args */) {
  423. return fn.apply(that, arguments);
  424. };
  425. };
  426. var PROTOTYPE = 'prototype';
  427. var $export = function (type, name, source) {
  428. var IS_FORCED = type & $export.F;
  429. var IS_GLOBAL = type & $export.G;
  430. var IS_STATIC = type & $export.S;
  431. var IS_PROTO = type & $export.P;
  432. var IS_BIND = type & $export.B;
  433. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  434. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  435. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  436. var key, own, out, exp;
  437. if (IS_GLOBAL) { source = name; }
  438. for (key in source) {
  439. // contains in native
  440. own = !IS_FORCED && target && target[key] !== undefined;
  441. // export native or passed
  442. out = (own ? target : source)[key];
  443. // bind timers to global for call from export context
  444. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  445. // extend global
  446. if (target) { _redefine(target, key, out, type & $export.U); }
  447. // export
  448. if (exports[key] != out) { _hide(exports, key, exp); }
  449. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  450. }
  451. };
  452. _global.core = _core;
  453. // type bitmap
  454. $export.F = 1; // forced
  455. $export.G = 2; // global
  456. $export.S = 4; // static
  457. $export.P = 8; // proto
  458. $export.B = 16; // bind
  459. $export.W = 32; // wrap
  460. $export.U = 64; // safe
  461. $export.R = 128; // real proto method for `library`
  462. var _export = $export;
  463. // 7.1.4 ToInteger
  464. var ceil = Math.ceil;
  465. var floor = Math.floor;
  466. var _toInteger = function (it) {
  467. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  468. };
  469. // 7.2.1 RequireObjectCoercible(argument)
  470. var _defined = function (it) {
  471. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  472. return it;
  473. };
  474. // true -> String#at
  475. // false -> String#codePointAt
  476. var _stringAt = function (TO_STRING) {
  477. return function (that, pos) {
  478. var s = String(_defined(that));
  479. var i = _toInteger(pos);
  480. var l = s.length;
  481. var a, b;
  482. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  483. a = s.charCodeAt(i);
  484. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  485. ? TO_STRING ? s.charAt(i) : a
  486. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  487. };
  488. };
  489. var $at = _stringAt(false);
  490. _export(_export.P, 'String', {
  491. // 21.1.3.3 String.prototype.codePointAt(pos)
  492. codePointAt: function codePointAt(pos) {
  493. return $at(this, pos);
  494. }
  495. });
  496. var codePointAt = _core.String.codePointAt;
  497. var max = Math.max;
  498. var min = Math.min;
  499. var _toAbsoluteIndex = function (index, length) {
  500. index = _toInteger(index);
  501. return index < 0 ? max(index + length, 0) : min(index, length);
  502. };
  503. var fromCharCode = String.fromCharCode;
  504. var $fromCodePoint = String.fromCodePoint;
  505. // length should be 1, old FF problem
  506. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  507. // 21.1.2.2 String.fromCodePoint(...codePoints)
  508. fromCodePoint: function fromCodePoint(x) {
  509. var arguments$1 = arguments;
  510. // eslint-disable-line no-unused-vars
  511. var res = [];
  512. var aLen = arguments.length;
  513. var i = 0;
  514. var code;
  515. while (aLen > i) {
  516. code = +arguments$1[i++];
  517. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  518. res.push(code < 0x10000
  519. ? fromCharCode(code)
  520. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  521. );
  522. } return res.join('');
  523. }
  524. });
  525. var fromCodePoint = _core.String.fromCodePoint;
  526. // This is a generated file. Do not edit.
  527. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  528. 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]/;
  529. 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]/;
  530. var unicode = {
  531. Space_Separator: Space_Separator,
  532. ID_Start: ID_Start,
  533. ID_Continue: ID_Continue
  534. };
  535. var util = {
  536. isSpaceSeparator: function isSpaceSeparator (c) {
  537. return typeof c === 'string' && unicode.Space_Separator.test(c)
  538. },
  539. isIdStartChar: function isIdStartChar (c) {
  540. return typeof c === 'string' && (
  541. (c >= 'a' && c <= 'z') ||
  542. (c >= 'A' && c <= 'Z') ||
  543. (c === '$') || (c === '_') ||
  544. unicode.ID_Start.test(c)
  545. )
  546. },
  547. isIdContinueChar: function isIdContinueChar (c) {
  548. return typeof c === 'string' && (
  549. (c >= 'a' && c <= 'z') ||
  550. (c >= 'A' && c <= 'Z') ||
  551. (c >= '0' && c <= '9') ||
  552. (c === '$') || (c === '_') ||
  553. (c === '\u200C') || (c === '\u200D') ||
  554. unicode.ID_Continue.test(c)
  555. )
  556. },
  557. isDigit: function isDigit (c) {
  558. return typeof c === 'string' && /[0-9]/.test(c)
  559. },
  560. isHexDigit: function isHexDigit (c) {
  561. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  562. },
  563. };
  564. var source;
  565. var parseState;
  566. var stack;
  567. var pos;
  568. var line;
  569. var column;
  570. var token;
  571. var key;
  572. var root;
  573. var parse = function parse (text, reviver) {
  574. source = String(text);
  575. parseState = 'start';
  576. stack = [];
  577. pos = 0;
  578. line = 1;
  579. column = 0;
  580. token = undefined;
  581. key = undefined;
  582. root = undefined;
  583. do {
  584. token = lex();
  585. // This code is unreachable.
  586. // if (!parseStates[parseState]) {
  587. // throw invalidParseState()
  588. // }
  589. parseStates[parseState]();
  590. } while (token.type !== 'eof')
  591. if (typeof reviver === 'function') {
  592. return internalize({'': root}, '', reviver)
  593. }
  594. return root
  595. };
  596. function internalize (holder, name, reviver) {
  597. var value = holder[name];
  598. if (value != null && typeof value === 'object') {
  599. for (var key in value) {
  600. var replacement = internalize(value, key, reviver);
  601. if (replacement === undefined) {
  602. delete value[key];
  603. } else {
  604. value[key] = replacement;
  605. }
  606. }
  607. }
  608. return reviver.call(holder, name, value)
  609. }
  610. var lexState;
  611. var buffer;
  612. var doubleQuote;
  613. var sign;
  614. var c;
  615. function lex () {
  616. lexState = 'default';
  617. buffer = '';
  618. doubleQuote = false;
  619. sign = 1;
  620. for (;;) {
  621. c = peek();
  622. // This code is unreachable.
  623. // if (!lexStates[lexState]) {
  624. // throw invalidLexState(lexState)
  625. // }
  626. var token = lexStates[lexState]();
  627. if (token) {
  628. return token
  629. }
  630. }
  631. }
  632. function peek () {
  633. if (source[pos]) {
  634. return String.fromCodePoint(source.codePointAt(pos))
  635. }
  636. }
  637. function read () {
  638. var c = peek();
  639. if (c === '\n') {
  640. line++;
  641. column = 0;
  642. } else if (c) {
  643. column += c.length;
  644. } else {
  645. column++;
  646. }
  647. if (c) {
  648. pos += c.length;
  649. }
  650. return c
  651. }
  652. var lexStates = {
  653. default: function default$1 () {
  654. switch (c) {
  655. case '\t':
  656. case '\v':
  657. case '\f':
  658. case ' ':
  659. case '\u00A0':
  660. case '\uFEFF':
  661. case '\n':
  662. case '\r':
  663. case '\u2028':
  664. case '\u2029':
  665. read();
  666. return
  667. case '/':
  668. read();
  669. lexState = 'comment';
  670. return
  671. case undefined:
  672. read();
  673. return newToken('eof')
  674. }
  675. if (util.isSpaceSeparator(c)) {
  676. read();
  677. return
  678. }
  679. // This code is unreachable.
  680. // if (!lexStates[parseState]) {
  681. // throw invalidLexState(parseState)
  682. // }
  683. return lexStates[parseState]()
  684. },
  685. comment: function comment () {
  686. switch (c) {
  687. case '*':
  688. read();
  689. lexState = 'multiLineComment';
  690. return
  691. case '/':
  692. read();
  693. lexState = 'singleLineComment';
  694. return
  695. }
  696. throw invalidChar(read())
  697. },
  698. multiLineComment: function multiLineComment () {
  699. switch (c) {
  700. case '*':
  701. read();
  702. lexState = 'multiLineCommentAsterisk';
  703. return
  704. case undefined:
  705. throw invalidChar(read())
  706. }
  707. read();
  708. },
  709. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  710. switch (c) {
  711. case '*':
  712. read();
  713. return
  714. case '/':
  715. read();
  716. lexState = 'default';
  717. return
  718. case undefined:
  719. throw invalidChar(read())
  720. }
  721. read();
  722. lexState = 'multiLineComment';
  723. },
  724. singleLineComment: function singleLineComment () {
  725. switch (c) {
  726. case '\n':
  727. case '\r':
  728. case '\u2028':
  729. case '\u2029':
  730. read();
  731. lexState = 'default';
  732. return
  733. case undefined:
  734. read();
  735. return newToken('eof')
  736. }
  737. read();
  738. },
  739. value: function value () {
  740. switch (c) {
  741. case '{':
  742. case '[':
  743. return newToken('punctuator', read())
  744. case 'n':
  745. read();
  746. literal('ull');
  747. return newToken('null', null)
  748. case 't':
  749. read();
  750. literal('rue');
  751. return newToken('boolean', true)
  752. case 'f':
  753. read();
  754. literal('alse');
  755. return newToken('boolean', false)
  756. case '-':
  757. case '+':
  758. if (read() === '-') {
  759. sign = -1;
  760. }
  761. lexState = 'sign';
  762. return
  763. case '.':
  764. buffer = read();
  765. lexState = 'decimalPointLeading';
  766. return
  767. case '0':
  768. buffer = read();
  769. lexState = 'zero';
  770. return
  771. case '1':
  772. case '2':
  773. case '3':
  774. case '4':
  775. case '5':
  776. case '6':
  777. case '7':
  778. case '8':
  779. case '9':
  780. buffer = read();
  781. lexState = 'decimalInteger';
  782. return
  783. case 'I':
  784. read();
  785. literal('nfinity');
  786. return newToken('numeric', Infinity)
  787. case 'N':
  788. read();
  789. literal('aN');
  790. return newToken('numeric', NaN)
  791. case '"':
  792. case "'":
  793. doubleQuote = (read() === '"');
  794. buffer = '';
  795. lexState = 'string';
  796. return
  797. }
  798. throw invalidChar(read())
  799. },
  800. identifierNameStartEscape: function identifierNameStartEscape () {
  801. if (c !== 'u') {
  802. throw invalidChar(read())
  803. }
  804. read();
  805. var u = unicodeEscape();
  806. switch (u) {
  807. case '$':
  808. case '_':
  809. break
  810. default:
  811. if (!util.isIdStartChar(u)) {
  812. throw invalidIdentifier()
  813. }
  814. break
  815. }
  816. buffer += u;
  817. lexState = 'identifierName';
  818. },
  819. identifierName: function identifierName () {
  820. switch (c) {
  821. case '$':
  822. case '_':
  823. case '\u200C':
  824. case '\u200D':
  825. buffer += read();
  826. return
  827. case '\\':
  828. read();
  829. lexState = 'identifierNameEscape';
  830. return
  831. }
  832. if (util.isIdContinueChar(c)) {
  833. buffer += read();
  834. return
  835. }
  836. return newToken('identifier', buffer)
  837. },
  838. identifierNameEscape: function identifierNameEscape () {
  839. if (c !== 'u') {
  840. throw invalidChar(read())
  841. }
  842. read();
  843. var u = unicodeEscape();
  844. switch (u) {
  845. case '$':
  846. case '_':
  847. case '\u200C':
  848. case '\u200D':
  849. break
  850. default:
  851. if (!util.isIdContinueChar(u)) {
  852. throw invalidIdentifier()
  853. }
  854. break
  855. }
  856. buffer += u;
  857. lexState = 'identifierName';
  858. },
  859. sign: function sign$1 () {
  860. switch (c) {
  861. case '.':
  862. buffer = read();
  863. lexState = 'decimalPointLeading';
  864. return
  865. case '0':
  866. buffer = read();
  867. lexState = 'zero';
  868. return
  869. case '1':
  870. case '2':
  871. case '3':
  872. case '4':
  873. case '5':
  874. case '6':
  875. case '7':
  876. case '8':
  877. case '9':
  878. buffer = read();
  879. lexState = 'decimalInteger';
  880. return
  881. case 'I':
  882. read();
  883. literal('nfinity');
  884. return newToken('numeric', sign * Infinity)
  885. case 'N':
  886. read();
  887. literal('aN');
  888. return newToken('numeric', NaN)
  889. }
  890. throw invalidChar(read())
  891. },
  892. zero: function zero () {
  893. switch (c) {
  894. case '.':
  895. buffer += read();
  896. lexState = 'decimalPoint';
  897. return
  898. case 'e':
  899. case 'E':
  900. buffer += read();
  901. lexState = 'decimalExponent';
  902. return
  903. case 'x':
  904. case 'X':
  905. buffer += read();
  906. lexState = 'hexadecimal';
  907. return
  908. }
  909. return newToken('numeric', sign * 0)
  910. },
  911. decimalInteger: function decimalInteger () {
  912. switch (c) {
  913. case '.':
  914. buffer += read();
  915. lexState = 'decimalPoint';
  916. return
  917. case 'e':
  918. case 'E':
  919. buffer += read();
  920. lexState = 'decimalExponent';
  921. return
  922. }
  923. if (util.isDigit(c)) {
  924. buffer += read();
  925. return
  926. }
  927. return newToken('numeric', sign * Number(buffer))
  928. },
  929. decimalPointLeading: function decimalPointLeading () {
  930. if (util.isDigit(c)) {
  931. buffer += read();
  932. lexState = 'decimalFraction';
  933. return
  934. }
  935. throw invalidChar(read())
  936. },
  937. decimalPoint: function decimalPoint () {
  938. switch (c) {
  939. case 'e':
  940. case 'E':
  941. buffer += read();
  942. lexState = 'decimalExponent';
  943. return
  944. }
  945. if (util.isDigit(c)) {
  946. buffer += read();
  947. lexState = 'decimalFraction';
  948. return
  949. }
  950. return newToken('numeric', sign * Number(buffer))
  951. },
  952. decimalFraction: function decimalFraction () {
  953. switch (c) {
  954. case 'e':
  955. case 'E':
  956. buffer += read();
  957. lexState = 'decimalExponent';
  958. return
  959. }
  960. if (util.isDigit(c)) {
  961. buffer += read();
  962. return
  963. }
  964. return newToken('numeric', sign * Number(buffer))
  965. },
  966. decimalExponent: function decimalExponent () {
  967. switch (c) {
  968. case '+':
  969. case '-':
  970. buffer += read();
  971. lexState = 'decimalExponentSign';
  972. return
  973. }
  974. if (util.isDigit(c)) {
  975. buffer += read();
  976. lexState = 'decimalExponentInteger';
  977. return
  978. }
  979. throw invalidChar(read())
  980. },
  981. decimalExponentSign: function decimalExponentSign () {
  982. if (util.isDigit(c)) {
  983. buffer += read();
  984. lexState = 'decimalExponentInteger';
  985. return
  986. }
  987. throw invalidChar(read())
  988. },
  989. decimalExponentInteger: function decimalExponentInteger () {
  990. if (util.isDigit(c)) {
  991. buffer += read();
  992. return
  993. }
  994. return newToken('numeric', sign * Number(buffer))
  995. },
  996. hexadecimal: function hexadecimal () {
  997. if (util.isHexDigit(c)) {
  998. buffer += read();
  999. lexState = 'hexadecimalInteger';
  1000. return
  1001. }
  1002. throw invalidChar(read())
  1003. },
  1004. hexadecimalInteger: function hexadecimalInteger () {
  1005. if (util.isHexDigit(c)) {
  1006. buffer += read();
  1007. return
  1008. }
  1009. return newToken('numeric', sign * Number(buffer))
  1010. },
  1011. string: function string () {
  1012. switch (c) {
  1013. case '\\':
  1014. read();
  1015. buffer += escape();
  1016. return
  1017. case '"':
  1018. if (doubleQuote) {
  1019. read();
  1020. return newToken('string', buffer)
  1021. }
  1022. buffer += read();
  1023. return
  1024. case "'":
  1025. if (!doubleQuote) {
  1026. read();
  1027. return newToken('string', buffer)
  1028. }
  1029. buffer += read();
  1030. return
  1031. case '\n':
  1032. case '\r':
  1033. throw invalidChar(read())
  1034. case '\u2028':
  1035. case '\u2029':
  1036. separatorChar(c);
  1037. break
  1038. case undefined:
  1039. throw invalidChar(read())
  1040. }
  1041. buffer += read();
  1042. },
  1043. start: function start () {
  1044. switch (c) {
  1045. case '{':
  1046. case '[':
  1047. return newToken('punctuator', read())
  1048. // This code is unreachable since the default lexState handles eof.
  1049. // case undefined:
  1050. // return newToken('eof')
  1051. }
  1052. lexState = 'value';
  1053. },
  1054. beforePropertyName: function beforePropertyName () {
  1055. switch (c) {
  1056. case '$':
  1057. case '_':
  1058. buffer = read();
  1059. lexState = 'identifierName';
  1060. return
  1061. case '\\':
  1062. read();
  1063. lexState = 'identifierNameStartEscape';
  1064. return
  1065. case '}':
  1066. return newToken('punctuator', read())
  1067. case '"':
  1068. case "'":
  1069. doubleQuote = (read() === '"');
  1070. lexState = 'string';
  1071. return
  1072. }
  1073. if (util.isIdStartChar(c)) {
  1074. buffer += read();
  1075. lexState = 'identifierName';
  1076. return
  1077. }
  1078. throw invalidChar(read())
  1079. },
  1080. afterPropertyName: function afterPropertyName () {
  1081. if (c === ':') {
  1082. return newToken('punctuator', read())
  1083. }
  1084. throw invalidChar(read())
  1085. },
  1086. beforePropertyValue: function beforePropertyValue () {
  1087. lexState = 'value';
  1088. },
  1089. afterPropertyValue: function afterPropertyValue () {
  1090. switch (c) {
  1091. case ',':
  1092. case '}':
  1093. return newToken('punctuator', read())
  1094. }
  1095. throw invalidChar(read())
  1096. },
  1097. beforeArrayValue: function beforeArrayValue () {
  1098. if (c === ']') {
  1099. return newToken('punctuator', read())
  1100. }
  1101. lexState = 'value';
  1102. },
  1103. afterArrayValue: function afterArrayValue () {
  1104. switch (c) {
  1105. case ',':
  1106. case ']':
  1107. return newToken('punctuator', read())
  1108. }
  1109. throw invalidChar(read())
  1110. },
  1111. end: function end () {
  1112. // This code is unreachable since it's handled by the default lexState.
  1113. // if (c === undefined) {
  1114. // read()
  1115. // return newToken('eof')
  1116. // }
  1117. throw invalidChar(read())
  1118. },
  1119. };
  1120. function newToken (type, value) {
  1121. return {
  1122. type: type,
  1123. value: value,
  1124. line: line,
  1125. column: column,
  1126. }
  1127. }
  1128. function literal (s) {
  1129. for (var i = 0, list = s; i < list.length; i += 1) {
  1130. var c = list[i];
  1131. var p = peek();
  1132. if (p !== c) {
  1133. throw invalidChar(read())
  1134. }
  1135. read();
  1136. }
  1137. }
  1138. function escape () {
  1139. var c = peek();
  1140. switch (c) {
  1141. case 'b':
  1142. read();
  1143. return '\b'
  1144. case 'f':
  1145. read();
  1146. return '\f'
  1147. case 'n':
  1148. read();
  1149. return '\n'
  1150. case 'r':
  1151. read();
  1152. return '\r'
  1153. case 't':
  1154. read();
  1155. return '\t'
  1156. case 'v':
  1157. read();
  1158. return '\v'
  1159. case '0':
  1160. read();
  1161. if (util.isDigit(peek())) {
  1162. throw invalidChar(read())
  1163. }
  1164. return '\0'
  1165. case 'x':
  1166. read();
  1167. return hexEscape()
  1168. case 'u':
  1169. read();
  1170. return unicodeEscape()
  1171. case '\n':
  1172. case '\u2028':
  1173. case '\u2029':
  1174. read();
  1175. return ''
  1176. case '\r':
  1177. read();
  1178. if (peek() === '\n') {
  1179. read();
  1180. }
  1181. return ''
  1182. case '1':
  1183. case '2':
  1184. case '3':
  1185. case '4':
  1186. case '5':
  1187. case '6':
  1188. case '7':
  1189. case '8':
  1190. case '9':
  1191. throw invalidChar(read())
  1192. case undefined:
  1193. throw invalidChar(read())
  1194. }
  1195. return read()
  1196. }
  1197. function hexEscape () {
  1198. var buffer = '';
  1199. var c = peek();
  1200. if (!util.isHexDigit(c)) {
  1201. throw invalidChar(read())
  1202. }
  1203. buffer += read();
  1204. c = peek();
  1205. if (!util.isHexDigit(c)) {
  1206. throw invalidChar(read())
  1207. }
  1208. buffer += read();
  1209. return String.fromCodePoint(parseInt(buffer, 16))
  1210. }
  1211. function unicodeEscape () {
  1212. var buffer = '';
  1213. var count = 4;
  1214. while (count-- > 0) {
  1215. var c = peek();
  1216. if (!util.isHexDigit(c)) {
  1217. throw invalidChar(read())
  1218. }
  1219. buffer += read();
  1220. }
  1221. return String.fromCodePoint(parseInt(buffer, 16))
  1222. }
  1223. var parseStates = {
  1224. start: function start () {
  1225. if (token.type === 'eof') {
  1226. throw invalidEOF()
  1227. }
  1228. push();
  1229. },
  1230. beforePropertyName: function beforePropertyName () {
  1231. switch (token.type) {
  1232. case 'identifier':
  1233. case 'string':
  1234. key = token.value;
  1235. parseState = 'afterPropertyName';
  1236. return
  1237. case 'punctuator':
  1238. // This code is unreachable since it's handled by the lexState.
  1239. // if (token.value !== '}') {
  1240. // throw invalidToken()
  1241. // }
  1242. pop();
  1243. return
  1244. case 'eof':
  1245. throw invalidEOF()
  1246. }
  1247. // This code is unreachable since it's handled by the lexState.
  1248. // throw invalidToken()
  1249. },
  1250. afterPropertyName: function afterPropertyName () {
  1251. // This code is unreachable since it's handled by the lexState.
  1252. // if (token.type !== 'punctuator' || token.value !== ':') {
  1253. // throw invalidToken()
  1254. // }
  1255. if (token.type === 'eof') {
  1256. throw invalidEOF()
  1257. }
  1258. parseState = 'beforePropertyValue';
  1259. },
  1260. beforePropertyValue: function beforePropertyValue () {
  1261. if (token.type === 'eof') {
  1262. throw invalidEOF()
  1263. }
  1264. push();
  1265. },
  1266. beforeArrayValue: function beforeArrayValue () {
  1267. if (token.type === 'eof') {
  1268. throw invalidEOF()
  1269. }
  1270. if (token.type === 'punctuator' && token.value === ']') {
  1271. pop();
  1272. return
  1273. }
  1274. push();
  1275. },
  1276. afterPropertyValue: function afterPropertyValue () {
  1277. // This code is unreachable since it's handled by the lexState.
  1278. // if (token.type !== 'punctuator') {
  1279. // throw invalidToken()
  1280. // }
  1281. if (token.type === 'eof') {
  1282. throw invalidEOF()
  1283. }
  1284. switch (token.value) {
  1285. case ',':
  1286. parseState = 'beforePropertyName';
  1287. return
  1288. case '}':
  1289. pop();
  1290. }
  1291. // This code is unreachable since it's handled by the lexState.
  1292. // throw invalidToken()
  1293. },
  1294. afterArrayValue: function afterArrayValue () {
  1295. // This code is unreachable since it's handled by the lexState.
  1296. // if (token.type !== 'punctuator') {
  1297. // throw invalidToken()
  1298. // }
  1299. if (token.type === 'eof') {
  1300. throw invalidEOF()
  1301. }
  1302. switch (token.value) {
  1303. case ',':
  1304. parseState = 'beforeArrayValue';
  1305. return
  1306. case ']':
  1307. pop();
  1308. }
  1309. // This code is unreachable since it's handled by the lexState.
  1310. // throw invalidToken()
  1311. },
  1312. end: function end () {
  1313. // This code is unreachable since it's handled by the lexState.
  1314. // if (token.type !== 'eof') {
  1315. // throw invalidToken()
  1316. // }
  1317. },
  1318. };
  1319. function push () {
  1320. var value;
  1321. switch (token.type) {
  1322. case 'punctuator':
  1323. switch (token.value) {
  1324. case '{':
  1325. value = {};
  1326. break
  1327. case '[':
  1328. value = [];
  1329. break
  1330. }
  1331. break
  1332. case 'null':
  1333. case 'boolean':
  1334. case 'numeric':
  1335. case 'string':
  1336. value = token.value;
  1337. break
  1338. // This code is unreachable.
  1339. // default:
  1340. // throw invalidToken()
  1341. }
  1342. if (root === undefined) {
  1343. root = value;
  1344. } else {
  1345. var parent = stack[stack.length - 1];
  1346. if (Array.isArray(parent)) {
  1347. parent.push(value);
  1348. } else {
  1349. parent[key] = value;
  1350. }
  1351. }
  1352. if (value !== null && typeof value === 'object') {
  1353. stack.push(value);
  1354. if (Array.isArray(value)) {
  1355. parseState = 'beforeArrayValue';
  1356. } else {
  1357. parseState = 'beforePropertyName';
  1358. }
  1359. } else {
  1360. var current = stack[stack.length - 1];
  1361. if (current == null) {
  1362. parseState = 'end';
  1363. } else if (Array.isArray(current)) {
  1364. parseState = 'afterArrayValue';
  1365. } else {
  1366. parseState = 'afterPropertyValue';
  1367. }
  1368. }
  1369. }
  1370. function pop () {
  1371. stack.pop();
  1372. var current = stack[stack.length - 1];
  1373. if (current == null) {
  1374. parseState = 'end';
  1375. } else if (Array.isArray(current)) {
  1376. parseState = 'afterArrayValue';
  1377. } else {
  1378. parseState = 'afterPropertyValue';
  1379. }
  1380. }
  1381. // This code is unreachable.
  1382. // function invalidParseState () {
  1383. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1384. // }
  1385. // This code is unreachable.
  1386. // function invalidLexState (state) {
  1387. // return new Error(`JSON5: invalid lex state '${state}'`)
  1388. // }
  1389. function invalidChar (c) {
  1390. if (c === undefined) {
  1391. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1392. }
  1393. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1394. }
  1395. function invalidEOF () {
  1396. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1397. }
  1398. // This code is unreachable.
  1399. // function invalidToken () {
  1400. // if (token.type === 'eof') {
  1401. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1402. // }
  1403. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1404. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1405. // }
  1406. function invalidIdentifier () {
  1407. column -= 5;
  1408. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1409. }
  1410. function separatorChar (c) {
  1411. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1412. }
  1413. function formatChar (c) {
  1414. var replacements = {
  1415. "'": "\\'",
  1416. '"': '\\"',
  1417. '\\': '\\\\',
  1418. '\b': '\\b',
  1419. '\f': '\\f',
  1420. '\n': '\\n',
  1421. '\r': '\\r',
  1422. '\t': '\\t',
  1423. '\v': '\\v',
  1424. '\0': '\\0',
  1425. '\u2028': '\\u2028',
  1426. '\u2029': '\\u2029',
  1427. };
  1428. if (replacements[c]) {
  1429. return replacements[c]
  1430. }
  1431. if (c < ' ') {
  1432. var hexString = c.charCodeAt(0).toString(16);
  1433. return '\\x' + ('00' + hexString).substring(hexString.length)
  1434. }
  1435. return c
  1436. }
  1437. function syntaxError (message) {
  1438. var err = new SyntaxError(message);
  1439. err.lineNumber = line;
  1440. err.columnNumber = column;
  1441. return err
  1442. }
  1443. var stringify = function stringify (value, replacer, space) {
  1444. var stack = [];
  1445. var indent = '';
  1446. var propertyList;
  1447. var replacerFunc;
  1448. var gap = '';
  1449. var quote;
  1450. if (
  1451. replacer != null &&
  1452. typeof replacer === 'object' &&
  1453. !Array.isArray(replacer)
  1454. ) {
  1455. space = replacer.space;
  1456. quote = replacer.quote;
  1457. replacer = replacer.replacer;
  1458. }
  1459. if (typeof replacer === 'function') {
  1460. replacerFunc = replacer;
  1461. } else if (Array.isArray(replacer)) {
  1462. propertyList = [];
  1463. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1464. var v = list[i];
  1465. var item = (void 0);
  1466. if (typeof v === 'string') {
  1467. item = v;
  1468. } else if (
  1469. typeof v === 'number' ||
  1470. v instanceof String ||
  1471. v instanceof Number
  1472. ) {
  1473. item = String(v);
  1474. }
  1475. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1476. propertyList.push(item);
  1477. }
  1478. }
  1479. }
  1480. if (space instanceof Number) {
  1481. space = Number(space);
  1482. } else if (space instanceof String) {
  1483. space = String(space);
  1484. }
  1485. if (typeof space === 'number') {
  1486. if (space > 0) {
  1487. space = Math.min(10, Math.floor(space));
  1488. gap = ' '.substr(0, space);
  1489. }
  1490. } else if (typeof space === 'string') {
  1491. gap = space.substr(0, 10);
  1492. }
  1493. return serializeProperty('', {'': value})
  1494. function serializeProperty (key, holder) {
  1495. var value = holder[key];
  1496. if (value != null) {
  1497. if (typeof value.toJSON5 === 'function') {
  1498. value = value.toJSON5(key);
  1499. } else if (typeof value.toJSON === 'function') {
  1500. value = value.toJSON(key);
  1501. }
  1502. }
  1503. if (replacerFunc) {
  1504. value = replacerFunc.call(holder, key, value);
  1505. }
  1506. if (value instanceof Number) {
  1507. value = Number(value);
  1508. } else if (value instanceof String) {
  1509. value = String(value);
  1510. } else if (value instanceof Boolean) {
  1511. value = value.valueOf();
  1512. }
  1513. switch (value) {
  1514. case null: return 'null'
  1515. case true: return 'true'
  1516. case false: return 'false'
  1517. }
  1518. if (typeof value === 'string') {
  1519. return quoteString(value)
  1520. }
  1521. if (typeof value === 'number') {
  1522. return String(value)
  1523. }
  1524. if (typeof value === 'object') {
  1525. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1526. }
  1527. return undefined
  1528. }
  1529. function quoteString (value) {
  1530. var quotes = {
  1531. "'": 0.1,
  1532. '"': 0.2,
  1533. };
  1534. var replacements = {
  1535. "'": "\\'",
  1536. '"': '\\"',
  1537. '\\': '\\\\',
  1538. '\b': '\\b',
  1539. '\f': '\\f',
  1540. '\n': '\\n',
  1541. '\r': '\\r',
  1542. '\t': '\\t',
  1543. '\v': '\\v',
  1544. '\0': '\\0',
  1545. '\u2028': '\\u2028',
  1546. '\u2029': '\\u2029',
  1547. };
  1548. var product = '';
  1549. for (var i = 0; i < value.length; i++) {
  1550. var c = value[i];
  1551. switch (c) {
  1552. case "'":
  1553. case '"':
  1554. quotes[c]++;
  1555. product += c;
  1556. continue
  1557. case '\0':
  1558. if (util.isDigit(value[i + 1])) {
  1559. product += '\\x00';
  1560. continue
  1561. }
  1562. }
  1563. if (replacements[c]) {
  1564. product += replacements[c];
  1565. continue
  1566. }
  1567. if (c < ' ') {
  1568. var hexString = c.charCodeAt(0).toString(16);
  1569. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1570. continue
  1571. }
  1572. product += c;
  1573. }
  1574. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1575. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1576. return quoteChar + product + quoteChar
  1577. }
  1578. function serializeObject (value) {
  1579. if (stack.indexOf(value) >= 0) {
  1580. throw TypeError('Converting circular structure to JSON5')
  1581. }
  1582. stack.push(value);
  1583. var stepback = indent;
  1584. indent = indent + gap;
  1585. var keys = propertyList || Object.keys(value);
  1586. var partial = [];
  1587. for (var i = 0, list = keys; i < list.length; i += 1) {
  1588. var key = list[i];
  1589. var propertyString = serializeProperty(key, value);
  1590. if (propertyString !== undefined) {
  1591. var member = serializeKey(key) + ':';
  1592. if (gap !== '') {
  1593. member += ' ';
  1594. }
  1595. member += propertyString;
  1596. partial.push(member);
  1597. }
  1598. }
  1599. var final;
  1600. if (partial.length === 0) {
  1601. final = '{}';
  1602. } else {
  1603. var properties;
  1604. if (gap === '') {
  1605. properties = partial.join(',');
  1606. final = '{' + properties + '}';
  1607. } else {
  1608. var separator = ',\n' + indent;
  1609. properties = partial.join(separator);
  1610. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1611. }
  1612. }
  1613. stack.pop();
  1614. indent = stepback;
  1615. return final
  1616. }
  1617. function serializeKey (key) {
  1618. if (key.length === 0) {
  1619. return quoteString(key)
  1620. }
  1621. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1622. if (!util.isIdStartChar(firstChar)) {
  1623. return quoteString(key)
  1624. }
  1625. for (var i = firstChar.length; i < key.length; i++) {
  1626. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1627. return quoteString(key)
  1628. }
  1629. }
  1630. return key
  1631. }
  1632. function serializeArray (value) {
  1633. if (stack.indexOf(value) >= 0) {
  1634. throw TypeError('Converting circular structure to JSON5')
  1635. }
  1636. stack.push(value);
  1637. var stepback = indent;
  1638. indent = indent + gap;
  1639. var partial = [];
  1640. for (var i = 0; i < value.length; i++) {
  1641. var propertyString = serializeProperty(String(i), value);
  1642. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1643. }
  1644. var final;
  1645. if (partial.length === 0) {
  1646. final = '[]';
  1647. } else {
  1648. if (gap === '') {
  1649. var properties = partial.join(',');
  1650. final = '[' + properties + ']';
  1651. } else {
  1652. var separator = ',\n' + indent;
  1653. var properties$1 = partial.join(separator);
  1654. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1655. }
  1656. }
  1657. stack.pop();
  1658. indent = stepback;
  1659. return final
  1660. }
  1661. };
  1662. var JSON5 = {
  1663. parse: parse,
  1664. stringify: stringify,
  1665. };
  1666. var lib = JSON5;
  1667. var es5 = lib;
  1668. return es5;
  1669. })));
  1670. });
  1671. /*! *****************************************************************************
  1672. Copyright (c) Microsoft Corporation.
  1673. Permission to use, copy, modify, and/or distribute this software for any
  1674. purpose with or without fee is hereby granted.
  1675. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1676. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1677. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1678. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1679. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1680. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1681. PERFORMANCE OF THIS SOFTWARE.
  1682. ***************************************************************************** */
  1683. /* global Reflect, Promise */
  1684. var extendStatics = function(d, b) {
  1685. extendStatics = Object.setPrototypeOf ||
  1686. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1687. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1688. return extendStatics(d, b);
  1689. };
  1690. function __extends(d, b) {
  1691. extendStatics(d, b);
  1692. function __() { this.constructor = d; }
  1693. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1694. }
  1695. var __assign = function() {
  1696. __assign = Object.assign || function __assign(t) {
  1697. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1698. s = arguments[i];
  1699. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1700. }
  1701. return t;
  1702. };
  1703. return __assign.apply(this, arguments);
  1704. };
  1705. function __decorate(decorators, target, key, desc) {
  1706. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1707. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1708. 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;
  1709. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1710. }
  1711. function __param(paramIndex, decorator) {
  1712. return function (target, key) { decorator(target, key, paramIndex); }
  1713. }
  1714. function __metadata(metadataKey, metadataValue) {
  1715. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1716. }
  1717. function __values(o) {
  1718. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1719. if (m) return m.call(o);
  1720. if (o && typeof o.length === "number") return {
  1721. next: function () {
  1722. if (o && i >= o.length) o = void 0;
  1723. return { value: o && o[i++], done: !o };
  1724. }
  1725. };
  1726. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1727. }
  1728. function __read(o, n) {
  1729. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1730. if (!m) return o;
  1731. var i = m.call(o), r, ar = [], e;
  1732. try {
  1733. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1734. }
  1735. catch (error) { e = { error: error }; }
  1736. finally {
  1737. try {
  1738. if (r && !r.done && (m = i["return"])) m.call(i);
  1739. }
  1740. finally { if (e) throw e.error; }
  1741. }
  1742. return ar;
  1743. }
  1744. function __spread() {
  1745. for (var ar = [], i = 0; i < arguments.length; i++)
  1746. ar = ar.concat(__read(arguments[i]));
  1747. return ar;
  1748. }
  1749. var PropertyDescription = /** @class */ (function () {
  1750. function PropertyDescription() {
  1751. var _this = this;
  1752. var args = [];
  1753. for (var _i = 0; _i < arguments.length; _i++) {
  1754. args[_i] = arguments[_i];
  1755. }
  1756. this.propertyes = {
  1757. props: [],
  1758. events: []
  1759. };
  1760. _$2.each(args, function (arg) {
  1761. _this.merge(arg);
  1762. });
  1763. }
  1764. PropertyDescription.prototype.merge = function (pd) {
  1765. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1766. if (pd.events) {
  1767. if (this.propertyes.events) {
  1768. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1769. }
  1770. else {
  1771. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1772. }
  1773. }
  1774. };
  1775. /**
  1776. * 根据分组名 获取属性定义
  1777. */
  1778. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1779. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1780. };
  1781. /**
  1782. * 获取全部事件
  1783. */
  1784. PropertyDescription.prototype.getEvents = function () {
  1785. return this.propertyes.events;
  1786. };
  1787. return PropertyDescription;
  1788. }());
  1789. //# sourceMappingURL=PropertyDescription.js.map
  1790. var PropertyDescriptionTable = new Map();
  1791. var width = {
  1792. name: 'width',
  1793. default: '',
  1794. group: 'common',
  1795. desc: '宽',
  1796. type: 'string'
  1797. };
  1798. var height = {
  1799. name: 'height',
  1800. default: '',
  1801. group: 'common',
  1802. desc: '高',
  1803. type: 'string'
  1804. };
  1805. var fieldLabel = {
  1806. name: 'fieldLabel',
  1807. default: '',
  1808. group: 'common',
  1809. desc: '文本描述',
  1810. type: 'string',
  1811. expr: true,
  1812. };
  1813. var text$1 = {
  1814. name: 'text',
  1815. default: '',
  1816. group: 'common',
  1817. desc: '文本描述',
  1818. type: 'string',
  1819. expr: true,
  1820. };
  1821. var iconCls = {
  1822. name: 'iconCls',
  1823. default: '',
  1824. group: 'common',
  1825. desc: '图标',
  1826. type: 'string',
  1827. expr: true,
  1828. };
  1829. var disabled = {
  1830. name: 'disabled',
  1831. default: false,
  1832. group: 'common',
  1833. desc: '禁用',
  1834. type: 'boolean',
  1835. expr: true,
  1836. };
  1837. var value = {
  1838. name: 'value',
  1839. default: '',
  1840. group: 'common',
  1841. desc: '字段值',
  1842. type: 'string',
  1843. expr: true,
  1844. };
  1845. var template = {
  1846. name: 'template',
  1847. default: '',
  1848. group: 'common',
  1849. desc: 'HTML内容',
  1850. type: 'string',
  1851. expr: true,
  1852. };
  1853. var reference = {
  1854. name: 'reference',
  1855. default: '',
  1856. group: 'common',
  1857. desc: '组件句柄',
  1858. type: 'string',
  1859. expr: true,
  1860. };
  1861. var tooltip = {
  1862. name: 'tooltip',
  1863. default: '',
  1864. group: 'common',
  1865. desc: '悬停提示',
  1866. type: 'string'
  1867. };
  1868. // =============事件 ==============
  1869. var click = {
  1870. name: 'click',
  1871. default: '',
  1872. group: 'listeners',
  1873. desc: '点击事件',
  1874. eventParamter: [
  1875. 'sender',
  1876. 'e: any'
  1877. ],
  1878. type: 'listeners'
  1879. };
  1880. var change = {
  1881. name: 'change',
  1882. default: '',
  1883. group: 'listeners',
  1884. desc: 'value change事件',
  1885. eventParamter: [
  1886. 'sender',
  1887. 'e: any'
  1888. ],
  1889. type: 'listeners'
  1890. };
  1891. var keyup = {
  1892. name: 'keyup',
  1893. default: '',
  1894. group: 'listeners',
  1895. desc: '键盘按键抬起事件',
  1896. eventParamter: [
  1897. 'sender',
  1898. 'e'
  1899. ],
  1900. type: 'listeners'
  1901. };
  1902. var afterrender = {
  1903. name: 'afterrender',
  1904. default: '',
  1905. group: 'listeners',
  1906. desc: '控件渲染后触发',
  1907. eventParamter: [
  1908. 'sender',
  1909. 'e'
  1910. ],
  1911. type: 'listeners'
  1912. };
  1913. // =============特性 ==============
  1914. var fix = {
  1915. name: 'fix',
  1916. default: '',
  1917. group: 'fix',
  1918. desc: '特性',
  1919. type: 'fix',
  1920. expr: true,
  1921. };
  1922. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1923. props: [
  1924. height
  1925. ]
  1926. }));
  1927. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1928. props: [
  1929. {
  1930. name: 'borderless',
  1931. default: true,
  1932. group: 'css',
  1933. desc: '有无边框',
  1934. type: 'boolean'
  1935. },
  1936. {
  1937. name: 'type',
  1938. default: '',
  1939. group: 'css',
  1940. desc: '布局类型',
  1941. type: ['line', 'clean', 'wide', 'space', 'form']
  1942. },
  1943. {
  1944. name: '_designMode',
  1945. default: 'module',
  1946. group: 'common',
  1947. desc: '设计类型',
  1948. type: ['none', 'module', 'scroll-module']
  1949. }
  1950. ]
  1951. }));
  1952. var YvBase = {
  1953. props: [
  1954. width, height, reference, afterrender, fix
  1955. ],
  1956. events: [
  1957. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1958. ]
  1959. };
  1960. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1961. props: [
  1962. template
  1963. ]
  1964. }));
  1965. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1966. props: [
  1967. {
  1968. name: 'label',
  1969. default: '',
  1970. group: 'common',
  1971. desc: '字段组标题',
  1972. type: 'string'
  1973. }
  1974. ]
  1975. }));
  1976. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1977. props: [
  1978. {
  1979. name: 'src',
  1980. default: '',
  1981. group: 'common',
  1982. desc: '地址路径',
  1983. type: 'string'
  1984. }
  1985. ]
  1986. }));
  1987. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1988. props: [
  1989. width, height,
  1990. {
  1991. name: 'value',
  1992. default: '上传',
  1993. group: 'common',
  1994. desc: '文本描述',
  1995. type: 'string'
  1996. },
  1997. {
  1998. name: 'upload',
  1999. default: '/upload',
  2000. group: 'common',
  2001. desc: '上传地址',
  2002. type: 'string'
  2003. },
  2004. ],
  2005. events: [
  2006. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2007. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2008. ]
  2009. }));
  2010. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2011. props: [
  2012. value,
  2013. {
  2014. name: 'imgWidth',
  2015. default: '',
  2016. group: 'common',
  2017. desc: '图片宽',
  2018. type: 'string'
  2019. },
  2020. {
  2021. name: 'imgHeight',
  2022. default: '',
  2023. group: 'common',
  2024. desc: '图片高',
  2025. type: 'string'
  2026. }
  2027. ]
  2028. }));
  2029. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2030. props: [
  2031. value,
  2032. {
  2033. name: 'imgWidth',
  2034. default: '',
  2035. group: 'common',
  2036. desc: '图片宽',
  2037. type: 'string'
  2038. },
  2039. {
  2040. name: 'imgHeight',
  2041. default: '',
  2042. group: 'common',
  2043. desc: '图片高',
  2044. type: 'string'
  2045. }
  2046. ]
  2047. }));
  2048. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2049. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2050. }));
  2051. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2052. props: [
  2053. fieldLabel, value, disabled,
  2054. tooltip, width, height
  2055. ],
  2056. }));
  2057. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2058. props: [
  2059. fieldLabel, value, disabled,
  2060. tooltip, width, height, keyup, afterrender, change
  2061. ],
  2062. }));
  2063. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2064. props: [
  2065. fieldLabel, value, disabled,
  2066. tooltip, width, height, keyup, afterrender, change
  2067. ],
  2068. }));
  2069. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2070. props: [
  2071. fieldLabel, value, disabled,
  2072. tooltip, width, height, keyup, afterrender, change
  2073. ],
  2074. }));
  2075. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2076. props: [
  2077. fieldLabel, value, disabled,
  2078. tooltip, width, height, keyup, afterrender, change
  2079. ],
  2080. }));
  2081. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2082. props: [
  2083. fieldLabel, value, disabled,
  2084. tooltip, width, height, keyup, afterrender, change
  2085. ],
  2086. }));
  2087. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2088. props: [
  2089. fieldLabel, value, disabled,
  2090. tooltip, width, height, keyup, afterrender, change
  2091. ],
  2092. }));
  2093. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2094. props: [
  2095. fieldLabel, value, disabled,
  2096. tooltip, width, height, keyup, afterrender, change
  2097. ],
  2098. }));
  2099. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2100. props: [
  2101. fieldLabel, value, disabled,
  2102. tooltip, width, height, keyup, afterrender, change
  2103. ],
  2104. }));
  2105. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2106. props: [
  2107. fieldLabel, value, disabled,
  2108. tooltip, width, height
  2109. ],
  2110. }));
  2111. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2112. props: [
  2113. fieldLabel, value, disabled,
  2114. tooltip, width, height, keyup, afterrender, change
  2115. ],
  2116. }));
  2117. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2118. props: [
  2119. fieldLabel, value, disabled,
  2120. tooltip, width, height, keyup, afterrender, change
  2121. ],
  2122. }));
  2123. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2124. props: [
  2125. fieldLabel, value, disabled,
  2126. tooltip, width, height, keyup, afterrender, change
  2127. ],
  2128. }));
  2129. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2130. props: [
  2131. fieldLabel, value, disabled,
  2132. tooltip, width, height, afterrender, change
  2133. ],
  2134. }));
  2135. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2136. /**
  2137. * 弹出输入框,输入文字
  2138. * @param message 提示文字
  2139. * @param defaultValue 默认值
  2140. * @param multiLine 是否多行输入
  2141. */
  2142. function prompt$1(message, defaultValue, multiLine) {
  2143. if (defaultValue === void 0) { defaultValue = ""; }
  2144. if (multiLine === void 0) { multiLine = false; }
  2145. return new Promise(function (resolve) {
  2146. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2147. if (button === 'ok') {
  2148. resolve(value);
  2149. }
  2150. }, null, multiLine, defaultValue);
  2151. });
  2152. }
  2153. /**
  2154. * 显示错误异常信息
  2155. * @param msg 错误内容
  2156. * @param sender 发送者按钮(可以为空)
  2157. */
  2158. function showErrorDialog(msg, sender) {
  2159. console.error(msg);
  2160. Ext.MessageBox.show({
  2161. title: '错误',
  2162. msg: msg,
  2163. buttons: Ext.MessageBox.OK,
  2164. animateTarget: sender,
  2165. icon: 'error',
  2166. cls: 'show-icon-messagebox',
  2167. });
  2168. }
  2169. /**
  2170. * 显示错误异常信息
  2171. * @param msg 错误内容
  2172. * @param sender 发送者按钮(可以为空)
  2173. */
  2174. function showInfoDialogSimple(msg, sender) {
  2175. console.info(msg);
  2176. Ext.MessageBox.show({
  2177. title: '提示',
  2178. msg: msg,
  2179. buttons: Ext.MessageBox.OK,
  2180. animateTarget: sender,
  2181. icon: 'info',
  2182. cls: 'show-icon-messagebox',
  2183. });
  2184. }
  2185. function msgError(msg, sender) {
  2186. showErrorDialog(msg, sender);
  2187. }
  2188. /**
  2189. * 中间灰底白字提示
  2190. */
  2191. function msg(message) {
  2192. console.log(message);
  2193. var t = { message: message };
  2194. var WMSTranslate = window["WMSTranslate"];
  2195. if (WMSTranslate) {
  2196. if (typeof window['viewTranslate'] === 'function') {
  2197. window['viewTranslate'](t, message, "message");
  2198. }
  2199. }
  2200. var $body = $$2('body');
  2201. $body.find('[xtype=tooltip]').remove();
  2202. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2203. ' <div class="yvan-msg-content">' +
  2204. _$2.escape(t.message) +
  2205. '</div></div>');
  2206. $body.append($w);
  2207. var iframeWidth = $w.parent().width();
  2208. var iframeHeight = $w.parent().height();
  2209. var windowWidth = $w.width();
  2210. var windowHeight = $w.height();
  2211. var setWidth = (iframeWidth - windowWidth) / 2;
  2212. var setHeight = (iframeHeight - windowHeight) / 2;
  2213. if (iframeHeight < windowHeight || setHeight < 0) {
  2214. setHeight = 0;
  2215. }
  2216. if (iframeWidth < windowWidth || setWidth < 0) {
  2217. setWidth = 0;
  2218. }
  2219. $w.css({ left: setWidth, top: setHeight });
  2220. setTimeout(function () {
  2221. $w.remove();
  2222. }, 3000);
  2223. }
  2224. //# sourceMappingURL=message.js.map
  2225. localforage.config({
  2226. name: "studio",
  2227. storeName: "item",
  2228. });
  2229. function getItem(key, callback) {
  2230. localforage.getItem(key).then(function (value) {
  2231. if (callback) {
  2232. callback(value);
  2233. }
  2234. });
  2235. }
  2236. function setItem(key, value, callback) {
  2237. localforage.setItem(key, value).then(function (val) {
  2238. if (callback) {
  2239. callback();
  2240. }
  2241. });
  2242. }
  2243. var native = {
  2244. /**
  2245. * 读取文件
  2246. */
  2247. loadFile: function (fileName, callback) {
  2248. console.log('loadFile', fileName);
  2249. getItem('NATIVE_' + fileName, callback);
  2250. },
  2251. /**
  2252. * 保存文件
  2253. */
  2254. saveFile: function (fileName, content) {
  2255. console.log('saveFile', fileName, content);
  2256. setItem('NATIVE_' + fileName, content);
  2257. },
  2258. openInIdea: function (path) {
  2259. msg(path);
  2260. },
  2261. /**
  2262. * 初始化 native 工具类
  2263. */
  2264. init: function () {
  2265. var ClipboardJS = window['ClipboardJS'];
  2266. if (!ClipboardJS) {
  2267. msg('没有引入 ClipboardJS');
  2268. return;
  2269. }
  2270. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2271. var clipboard = new ClipboardJS('.__btnClipboard');
  2272. },
  2273. /**
  2274. * 设置剪切板
  2275. */
  2276. clipboardSet: function (c) {
  2277. var $btn = $('.__btnClipboard');
  2278. $btn.attr('data-clipboard-text', c);
  2279. $btn.trigger("click");
  2280. },
  2281. };
  2282. /**
  2283. * 判断变量是否有值 value === null || value === undefined
  2284. * @param value 目标变量
  2285. */
  2286. var noValue = function (value) {
  2287. return value === null || value === undefined;
  2288. };
  2289. //# sourceMappingURL=Utils.js.map
  2290. function initStateTree () {
  2291. Ext.define('com.yvan.studio.StateTree', {
  2292. extend: 'Ext.tree.Panel',
  2293. _saveStateFlag: true,
  2294. _filterText: '',
  2295. fbar: [
  2296. {
  2297. xtype: 'textfield',
  2298. flex: 1,
  2299. emptyText: '搜索过滤',
  2300. enableKeyEvents: true,
  2301. listeners: {
  2302. change: function (sender) {
  2303. var tree = sender.up("treepanel");
  2304. tree.filterByText(this.getRawValue());
  2305. },
  2306. keyup: function (sender, e) {
  2307. var tree = sender.up("treepanel");
  2308. if (e.ESC === e.getKey()) {
  2309. sender.setValue('');
  2310. tree.filterByText('');
  2311. }
  2312. }
  2313. }
  2314. },
  2315. ],
  2316. getStateFilename: function () {
  2317. throw Error('没有实现这个函数');
  2318. },
  2319. initComponent: function () {
  2320. var me = this;
  2321. this.on({
  2322. afterrender: function () {
  2323. var _this = this;
  2324. // 回车后打开节点
  2325. $(me.el.dom).keydown(function (event) {
  2326. if (event.keyCode === 13) {
  2327. event.preventDefault();
  2328. _this.fireEvent('itemverify');
  2329. return;
  2330. }
  2331. });
  2332. },
  2333. afteritemexpand: {
  2334. fn: function (node, index, item, eOpts) {
  2335. this.saveState();
  2336. },
  2337. buffer: 100,
  2338. },
  2339. afteritemcollapse: {
  2340. fn: function (node, index, item, eOpts) {
  2341. this.saveState();
  2342. },
  2343. buffer: 100,
  2344. },
  2345. itemdblclick: function (sender, record) {
  2346. this.fireEvent('itemverify');
  2347. },
  2348. itemclick: {
  2349. fn: function (node, index, item, eOpts) {
  2350. this.saveState();
  2351. },
  2352. buffer: 100,
  2353. }
  2354. });
  2355. this.superclass.superclass.initComponent.apply(this, arguments);
  2356. },
  2357. restoreState: function () {
  2358. var _this = this;
  2359. native.loadFile(this.getStateFilename(), function (content) {
  2360. if (!content)
  2361. return;
  2362. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2363. _this._saveStateFlag = false;
  2364. if (_.isArray(expands)) {
  2365. _.forEach(expands, function (p) {
  2366. _this.expandPath(p);
  2367. });
  2368. }
  2369. if (_.isArray(selections) && selections[0]) {
  2370. try {
  2371. _this.selectPath(selections[0]);
  2372. }
  2373. catch (e) {
  2374. }
  2375. }
  2376. if (scrollPosition && scrollSize) {
  2377. var size = _this.scrollable.getSize();
  2378. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2379. try {
  2380. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2381. }
  2382. catch (e) {
  2383. }
  2384. }
  2385. }
  2386. setTimeout(function () {
  2387. _this._saveStateFlag = true;
  2388. }, 200);
  2389. });
  2390. },
  2391. saveState: function () {
  2392. if (!this._saveStateFlag) {
  2393. return;
  2394. }
  2395. if (this._filterText) {
  2396. // 有筛选,不保存展开状态
  2397. return;
  2398. }
  2399. var expands = [];
  2400. var selections = [];
  2401. var selection = this.getSelection();
  2402. _.forEach(selection, function (item) {
  2403. selections.push(item.getPath());
  2404. });
  2405. var data = this.getStore().data;
  2406. _.forEach(data.items, function (item) {
  2407. if (item.data.expanded === true) {
  2408. expands.push(item.getPath());
  2409. }
  2410. });
  2411. var scrollPosition = this.scrollable.position;
  2412. var scrollSize = this.scrollable.getSize();
  2413. native.saveFile(this.getStateFilename(), {
  2414. selections: selections,
  2415. expands: expands,
  2416. scrollPosition: scrollPosition,
  2417. scrollSize: scrollSize
  2418. });
  2419. },
  2420. filterByText: function (text) {
  2421. this._filterText = text;
  2422. this._filterBy(this, text, 'text');
  2423. },
  2424. _filterBy: _.debounce(function (me, text, by) {
  2425. var view = me.getView();
  2426. me.store.clearFilter();
  2427. if (!me._filterText) {
  2428. // 没有筛选内容,还原状态
  2429. var selections = me.getSelection();
  2430. var selectionPaths_1 = [];
  2431. _.forEach(me.getSelection(), function (item) {
  2432. selectionPaths_1.push(item.getPath());
  2433. });
  2434. me.collapseAll();
  2435. me.restoreState();
  2436. _.forEach(selectionPaths_1, function (path) {
  2437. me.expandPath(path);
  2438. });
  2439. me.setSelection(selections);
  2440. return;
  2441. }
  2442. // 递归查找所有需要可见的节点 id 数组
  2443. var nodesAndParents = [];
  2444. var expandPaths = [];
  2445. me.getRootNode().cascadeBy(function (tree, view) {
  2446. var currNode = this;
  2447. currNode.collapse();
  2448. if (currNode && currNode.data[by] &&
  2449. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2450. // 展开到匹配的路径
  2451. // me.expandPath(currNode.getPath());
  2452. expandPaths.push(currNode.getPath());
  2453. // 沿途父节点全部设定为可见
  2454. while (currNode.parentNode) {
  2455. nodesAndParents.push(currNode.id);
  2456. currNode = currNode.parentNode;
  2457. }
  2458. }
  2459. }, null, [me, view]);
  2460. me.store.filterBy(function (r) {
  2461. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2462. });
  2463. _.forEach(expandPaths, function (path) {
  2464. me.expandPath(path);
  2465. });
  2466. }, 1000),
  2467. });
  2468. }
  2469. //# sourceMappingURL=StateTree.js.map
  2470. function initDashboard () {
  2471. Ext.define('com.yvan.studio.Dashboard', {
  2472. extend: 'Ext.panel.Panel',
  2473. alias: 'widget.dashboard',
  2474. xtype: 'dashboard',
  2475. html: ''
  2476. });
  2477. }
  2478. //# sourceMappingURL=dashboard.js.map
  2479. var handles$1 = {
  2480. mainWindow: undefined,
  2481. fileTree: undefined,
  2482. dbTree: undefined,
  2483. viewoutlinetree: undefined,
  2484. statusbar: undefined,
  2485. dictTree: undefined,
  2486. property: undefined,
  2487. dbcode: undefined,
  2488. report: undefined,
  2489. widget: undefined,
  2490. whLayout: undefined,
  2491. };
  2492. window['handles'] = handles$1;
  2493. function setDictTree(value) {
  2494. handles$1.dictTree = value;
  2495. }
  2496. function setMainWindow(value) {
  2497. handles$1.mainWindow = value;
  2498. }
  2499. function setReport(value) {
  2500. handles$1.report = value;
  2501. }
  2502. function setStatusbar(statusbar) {
  2503. handles$1.statusbar = statusbar;
  2504. }
  2505. function setFileTree(value) {
  2506. handles$1.fileTree = value;
  2507. }
  2508. function setDbTree(value) {
  2509. handles$1.dbTree = value;
  2510. }
  2511. function setWidget(value) {
  2512. handles$1.widget = value;
  2513. }
  2514. function setWhLayout(value) {
  2515. handles$1.whLayout = value;
  2516. }
  2517. function setViewoutlinetree(value) {
  2518. handles$1.viewoutlinetree = value;
  2519. }
  2520. function setPropertyPanel(value) {
  2521. handles$1.property = value;
  2522. }
  2523. function setDbCode(value) {
  2524. handles$1.dbcode = value;
  2525. }
  2526. //# sourceMappingURL=Handles.js.map
  2527. /**
  2528. * 调用方法
  2529. */
  2530. function invokeMethod(fn, sender, args) {
  2531. if (typeof fn === 'function') {
  2532. fn.apply.apply(fn, __spread([sender], args));
  2533. }
  2534. }
  2535. /**
  2536. * 判断事件是否为有效的输入字符
  2537. * @param e
  2538. */
  2539. function isChartEvent(e) {
  2540. if (e.key === 'Shift' ||
  2541. e.key === 'Control' ||
  2542. e.key === 'Alt' ||
  2543. e.key === 'Escape' ||
  2544. e.key === 'ArrowRight' ||
  2545. e.key === 'Tab' ||
  2546. e.key === 'ArrowLeft') {
  2547. return false;
  2548. }
  2549. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2550. // 0-9
  2551. return true;
  2552. }
  2553. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2554. // a-z
  2555. return true;
  2556. }
  2557. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2558. // 小键盘 0-9
  2559. return true;
  2560. }
  2561. return false;
  2562. }
  2563. if (!window["time_offset"]) {
  2564. window["time_offset"] = 0;
  2565. }
  2566. function syncDate(date) {
  2567. if (date && date.setTime && date.getTime) {
  2568. date.setTime(date.getTime() + window["time_offset"]);
  2569. }
  2570. return date;
  2571. }
  2572. //# sourceMappingURL=utils.js.map
  2573. function isDesignMode(control, config) {
  2574. var _a, _b;
  2575. if (window["IS_DESIGN_MODE"]) {
  2576. return true;
  2577. }
  2578. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2579. return true;
  2580. }
  2581. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2582. return true;
  2583. }
  2584. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2585. return true;
  2586. }
  2587. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2588. return true;
  2589. }
  2590. return false;
  2591. }
  2592. function toString(value) {
  2593. if (typeof value === 'undefined' || value === null) {
  2594. return "";
  2595. }
  2596. if (typeof value === 'number' && isNaN(value)) {
  2597. return "";
  2598. }
  2599. if (value == 'N/A') {
  2600. return "";
  2601. }
  2602. return ("" + value);
  2603. }
  2604. function isEmpty(value) {
  2605. if (typeof value === 'undefined' || value === null) {
  2606. return true;
  2607. }
  2608. if (typeof value === 'number' && isNaN(value)) {
  2609. return true;
  2610. }
  2611. if (value == 'N/A') {
  2612. return true;
  2613. }
  2614. return ("" + value).trim().length <= 0;
  2615. }
  2616. function createUUID() {
  2617. //@ts-ignore
  2618. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2619. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2620. });
  2621. }
  2622. function getRegList() {
  2623. var regList = _$2.get(window, 'yvanLib.regList');
  2624. if (!regList) {
  2625. regList = [];
  2626. _$2.set(window, 'yvanLib.regList', regList);
  2627. }
  2628. return regList;
  2629. }
  2630. function getRegParamList(methodName) {
  2631. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2632. if (!regParamList) {
  2633. regParamList = {};
  2634. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2635. }
  2636. if (!_$2.has(regParamList, methodName)) {
  2637. regParamList[methodName] = [];
  2638. }
  2639. return regParamList[methodName];
  2640. }
  2641. /**
  2642. * 模拟点击按钮
  2643. */
  2644. function raiseClick(buttonHandle) {
  2645. if (!buttonHandle) {
  2646. return false;
  2647. }
  2648. if (buttonHandle.disabled) {
  2649. // 按钮是禁止状态
  2650. return false;
  2651. }
  2652. if (buttonHandle.hidden) {
  2653. // 按钮是隐藏状态
  2654. return false;
  2655. }
  2656. // 按钮点击
  2657. buttonHandle.click();
  2658. return true;
  2659. }
  2660. /**
  2661. * 标注系统全局函数的参数
  2662. * @param title 函数名称
  2663. * @param type 函数类型
  2664. * @param allowEmpty 可否为空
  2665. */
  2666. function LibParam(title, type, allowEmpty) {
  2667. if (allowEmpty === void 0) { allowEmpty = false; }
  2668. return function (target, methodName, paramsIndex) {
  2669. var systemFnArgs = getRegParamList(methodName);
  2670. systemFnArgs[paramsIndex] = {
  2671. type: type,
  2672. title: title,
  2673. name: methodName,
  2674. allowEmpty: allowEmpty,
  2675. };
  2676. };
  2677. }
  2678. /**
  2679. * 标注函数变成"系统全局函数"
  2680. */
  2681. function Lib(registe) {
  2682. return function (target, propertyKey, descriptor) {
  2683. var libList = getRegList();
  2684. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2685. if (registe.type === 'system') {
  2686. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2687. }
  2688. else if (registe.type === 'format') {
  2689. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2690. }
  2691. return target;
  2692. };
  2693. }
  2694. /**
  2695. * 解析事件
  2696. * 'scope.私有方法名'
  2697. * 'system.系统函数名'
  2698. * 'format.格式化名'
  2699. */
  2700. function lookupFn(scope, event, errorWho) {
  2701. if (isDesignMode(scope, undefined)) {
  2702. return Ext.emptyFn;
  2703. }
  2704. if (!_$2.startsWith(event, 'scope.') &&
  2705. !_$2.startsWith(event, 'system.') &&
  2706. !_$2.startsWith(event, 'format.')) {
  2707. console.error('无法识别的事件响应类型', event);
  2708. throw new TypeError('无法识别的事件响应类型');
  2709. }
  2710. // 为 eval 准备环境
  2711. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2712. var data = scope.viewModel.data;
  2713. var keys = [];
  2714. var values = [];
  2715. _$2.forOwn(data, function (value, key) {
  2716. var idxKey = key.indexOf('//');
  2717. if (idxKey >= 0) {
  2718. keys.push(key.substr(0, idxKey));
  2719. }
  2720. else {
  2721. keys.push(key);
  2722. }
  2723. values.push(value);
  2724. });
  2725. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2726. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2727. if (typeof funcResult !== 'function') {
  2728. console.error('无法识别的事件响应类型', event, func, errorWho);
  2729. throw new TypeError('无法识别的事件响应类型');
  2730. }
  2731. return funcResult;
  2732. }
  2733. /**
  2734. * 从 ext.element 获取 scope 对象
  2735. */
  2736. function lookupScope(extHandle) {
  2737. if (!extHandle) {
  2738. // @ts-ignore
  2739. return;
  2740. }
  2741. if (extHandle.isScope) {
  2742. return extHandle;
  2743. }
  2744. if (extHandle.column) {
  2745. // 列上的组件
  2746. return extHandle.column.lookupReferenceHolder().yvanScope;
  2747. }
  2748. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2749. if (typeof extHandle.lookupViewModel === 'function') {
  2750. var vm = extHandle.lookupViewModel();
  2751. return vm.yvanScope;
  2752. }
  2753. return;
  2754. }
  2755. //# sourceMappingURL=lib.js.map
  2756. /**
  2757. * 全局 ajax 方法
  2758. */
  2759. var ajax = {};
  2760. /**
  2761. * 计算拼音的函数
  2762. */
  2763. var pinyinFunc = function (str) { return (str); };
  2764. exports.scopeOnLoad = null;
  2765. exports.apiConvert = undefined;
  2766. var baseConfigProcessList = [];
  2767. /**
  2768. * 在基类添加 Config 的处理方法
  2769. */
  2770. function baseConfigProcess(option) {
  2771. return function (target, propertyKey) {
  2772. baseConfigProcessList.push(target[propertyKey]);
  2773. };
  2774. }
  2775. // let designMode: boolean = false
  2776. //
  2777. // export function isDesignMode(): boolean {
  2778. // return designMode
  2779. // }
  2780. //
  2781. // export function setDesignMode(v: boolean) {
  2782. // designMode = v
  2783. // }
  2784. /**
  2785. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2786. */
  2787. function serverInvokeUrlTransform(url, option) {
  2788. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2789. }
  2790. /**
  2791. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2792. */
  2793. function sqlUrlTransform(url) {
  2794. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2795. }
  2796. /**
  2797. * YvanUI 全局扩展配置
  2798. */
  2799. function extend(option) {
  2800. if (option.ajax) {
  2801. ajax.func = option.ajax;
  2802. }
  2803. if (option.serverInvokeUrlTransform) {
  2804. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2805. }
  2806. if (option.sqlUrlTransform) {
  2807. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2808. }
  2809. if (option.pinyinFunction) {
  2810. pinyinFunc = option.pinyinFunction;
  2811. }
  2812. if (option.scopeOnLoad) {
  2813. exports.scopeOnLoad = option.scopeOnLoad;
  2814. }
  2815. if (option.scopeOnCreate) {
  2816. exports.scopeOnCreate = option.scopeOnCreate;
  2817. }
  2818. if (option.apiConvert) {
  2819. exports.apiConvert = option.apiConvert;
  2820. }
  2821. // if (typeof option.designMode !== 'undefined') {
  2822. // setDesignMode(option.designMode)
  2823. // }
  2824. }
  2825. function getApiConvert() {
  2826. return exports.apiConvert;
  2827. }
  2828. function getScopeOnCreate() {
  2829. return exports.scopeOnCreate;
  2830. }
  2831. function getPinyin(v) {
  2832. return pinyinFunc(v);
  2833. }
  2834. /**
  2835. * 适用于 Select / Tree 等,作筛选的通用方法.
  2836. * 1.首字母模糊匹配(不区分大小写)
  2837. * 2.标识的模糊匹配(不区分大小写)
  2838. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2839. */
  2840. function keywordFilter(keyword, label, value) {
  2841. if (!keyword) {
  2842. return true;
  2843. }
  2844. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2845. // const labelPy = _.toLower(getPinyin(label))
  2846. //@ts-ignore
  2847. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2848. value = _$2.toLower(_$2.trim(value));
  2849. var found = 0;
  2850. _$2.some(ws, function (word) {
  2851. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2852. found++;
  2853. return;
  2854. }
  2855. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2856. found++;
  2857. return;
  2858. }
  2859. });
  2860. return found >= ws.length;
  2861. }
  2862. //# sourceMappingURL=config.js.map
  2863. var idPrefix = "_ds_";
  2864. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2865. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2866. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2867. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2868. var layoutOrXtypeNameMap = {
  2869. fit: 'fit布局',
  2870. border: 'border布局',
  2871. center: '中部',
  2872. north: '上部',
  2873. south: '下部',
  2874. west: '左部',
  2875. east: '右部',
  2876. yvgrid: '表格',
  2877. tree: '树',
  2878. tabpanel: '标签页',
  2879. form: '表单',
  2880. fieldset: '字段组',
  2881. tbar: '顶部工具栏',
  2882. fbar: '底部工具栏',
  2883. toolbar: '工具栏',
  2884. cols: '列容器',
  2885. rows: '行容器',
  2886. textfield: '文本框',
  2887. textareafield: '长文本框',
  2888. numberfield: '数字框',
  2889. label: "文本",
  2890. combo: "下拉框",
  2891. combobox: "下拉框",
  2892. combotree: "下拉树",
  2893. combogrid: "下拉表",
  2894. datefield: "日期框",
  2895. searchfield: "搜索框",
  2896. button: "按钮",
  2897. checkbox: "勾选",
  2898. checkboxgroup: "勾选组",
  2899. radio: "点选",
  2900. radiogroup: "点选组",
  2901. container: "占位"
  2902. };
  2903. /**
  2904. * 从 VJSON 中找到 rows/cols 的数组
  2905. */
  2906. function findArrayContainer(vjson, id) {
  2907. var parentVJson = getSuperVjson(vjson, id);
  2908. if (_$2.isArray(parentVJson)) {
  2909. return parentVJson;
  2910. }
  2911. if (parentVJson.hasOwnProperty('items')) {
  2912. return parentVJson.items;
  2913. }
  2914. }
  2915. /**
  2916. * 根据id查找上级vjson
  2917. * @param vjson 原始 vjson 视图
  2918. * @param targetId 子元素的id
  2919. */
  2920. function getSuperVjson(vjson, targetId) {
  2921. return deepTravFindSuper(vjson, vjson, targetId);
  2922. }
  2923. /**
  2924. * 根据id查找上级vjson id
  2925. * @param vjson 原始 vjson 视图
  2926. * @param targetId 子元素的id
  2927. */
  2928. function getSuperVjsonId(vjson, targetId) {
  2929. var vj = getSuperVjson(vjson, targetId);
  2930. return vj.id;
  2931. }
  2932. function deepTravFindSuper(superVjson, vjson, targetId) {
  2933. var rObj = null;
  2934. _$2.forOwn(vjson, function (value, key) {
  2935. if (rObj) {
  2936. return;
  2937. }
  2938. if (typeof value !== "object") {
  2939. return;
  2940. }
  2941. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2942. if (key !== 'items') {
  2943. return;
  2944. }
  2945. }
  2946. else {
  2947. // 模型、数据、数据源不扫描
  2948. if (key === 'data' ||
  2949. key === 'dataSource' ||
  2950. key === 'suggest' ||
  2951. key === 'options' ||
  2952. key === 'config' ||
  2953. key === 'columns' ||
  2954. key === 'viewModel' ||
  2955. key === 'store') {
  2956. return;
  2957. }
  2958. }
  2959. //事件不扫描
  2960. if (key === "on" && _$2.isObject(value)) {
  2961. return;
  2962. }
  2963. if (key.startsWith("on") && _$2.size(key) > 2) {
  2964. return;
  2965. }
  2966. if (value.id === targetId) {
  2967. if (_$2.isArray(vjson)) {
  2968. rObj = superVjson;
  2969. }
  2970. else {
  2971. rObj = vjson;
  2972. }
  2973. return;
  2974. }
  2975. rObj = deepTravFindSuper(vjson, value, targetId);
  2976. });
  2977. return rObj;
  2978. }
  2979. /**
  2980. * 深度遍历 vjson
  2981. * @param vjson 视图JSON
  2982. * @param resolver 分析函数
  2983. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  2984. */
  2985. function deepTravVJson(vjson, resolver, propDeep) {
  2986. if (propDeep === void 0) { propDeep = false; }
  2987. var markerList = [];
  2988. deepTrav1(vjson, resolver, markerList, propDeep);
  2989. return markerList;
  2990. }
  2991. function deepTrav1(obj, resolver, marker, propDeep) {
  2992. if (propDeep === void 0) { propDeep = false; }
  2993. var isMarker = resolver(obj);
  2994. if (marker && isMarker === true) {
  2995. marker.unshift({ id: 0, keyName: '', object: obj });
  2996. }
  2997. _$2.forOwn(obj, function (value, key) {
  2998. if (typeof value !== 'object') {
  2999. return;
  3000. }
  3001. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3002. if (key !== 'items' && key !== 'children') {
  3003. return;
  3004. }
  3005. }
  3006. else {
  3007. // 模型、数据、数据源不扫描
  3008. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3009. return;
  3010. }
  3011. if (!propDeep &&
  3012. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3013. key === 'listeners' || key === 'bind')) {
  3014. return;
  3015. }
  3016. }
  3017. //事件不扫描
  3018. if (key === 'on' && _$2.isObject(value)) {
  3019. return;
  3020. }
  3021. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3022. return;
  3023. }
  3024. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3025. if (marker && isMarkerChild === true) {
  3026. isMarker = true;
  3027. marker.unshift({ id: obj.id, keyName: key, object: value });
  3028. }
  3029. });
  3030. // @ts-ignore 删除作废对象
  3031. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3032. return isMarker;
  3033. }
  3034. /**
  3035. * 在代码中找到 reference 对应的对象
  3036. */
  3037. function findInCode(code, id) {
  3038. try {
  3039. deepTravVJson(code, function (child) {
  3040. if (child.id === id) {
  3041. throw child;
  3042. }
  3043. });
  3044. return undefined;
  3045. }
  3046. catch (err) {
  3047. return err;
  3048. }
  3049. }
  3050. function replaceVjsonById(vjson, itemVjson, itemId) {
  3051. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3052. msgError('无法定位组件!');
  3053. debugger;
  3054. return;
  3055. }
  3056. var id = itemId || itemVjson.id;
  3057. deepTravVJson(vjson, function (obj) {
  3058. if (obj.id == id) {
  3059. _$2.assign(obj, itemVjson, { id: id });
  3060. }
  3061. });
  3062. }
  3063. function deepTravDeleteVjson(obj, targetId) {
  3064. var isDelete = false;
  3065. _$2.forOwn(obj, function (value, key) {
  3066. if (isDelete) {
  3067. return;
  3068. }
  3069. if (typeof value !== 'object') {
  3070. return;
  3071. }
  3072. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3073. if (key !== 'items') {
  3074. return;
  3075. }
  3076. }
  3077. else {
  3078. // 模型、数据、数据源不扫描
  3079. if (key === 'data' ||
  3080. key === 'dataSource' ||
  3081. key === 'suggest' ||
  3082. key === 'options' ||
  3083. key === 'config' ||
  3084. key === 'columns' ||
  3085. key === 'viewModel' ||
  3086. key === 'store') {
  3087. return;
  3088. }
  3089. }
  3090. //事件不扫描
  3091. if (key === 'on' && _$2.isObject(value)) {
  3092. return;
  3093. }
  3094. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3095. return;
  3096. }
  3097. if (value.id === targetId) {
  3098. isDelete = true;
  3099. /** 如果是数组的元素*/
  3100. if (_$2.isArray(obj)) {
  3101. obj.splice(key, 1);
  3102. }
  3103. else {
  3104. delete obj[key];
  3105. }
  3106. return;
  3107. }
  3108. isDelete = deepTravDeleteVjson(value, targetId);
  3109. });
  3110. return isDelete;
  3111. }
  3112. /**
  3113. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3114. * @param obj 原始 vjson 视图
  3115. * @param targetId 子元素的id
  3116. */
  3117. function deletVjsonById(vjson, targetId) {
  3118. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3119. // if (_.isArray(obj)) {
  3120. // if (obj.length <= 0) {
  3121. // let T: any = {
  3122. // view: "template",
  3123. // template: "拖动任何组件到此处",
  3124. // role: "placeholder",
  3125. // id: webix.uid()
  3126. // }
  3127. // obj.push(T);
  3128. // }
  3129. // }
  3130. return isDeleted;
  3131. }
  3132. function removeDesignProp(vjson) {
  3133. deepTravVJson(vjson, function (obj) {
  3134. if (obj.hasOwnProperty('id')) {
  3135. delete obj.id;
  3136. }
  3137. if (obj.hasOwnProperty("designMode")) {
  3138. delete obj.designMode;
  3139. }
  3140. });
  3141. if (vjson.hasOwnProperty("cls")) {
  3142. delete vjson.cls;
  3143. }
  3144. if (vjson.hasOwnProperty("viewModel")) {
  3145. delete vjson.viewModel;
  3146. }
  3147. if (vjson.hasOwnProperty("store")) {
  3148. delete vjson.store;
  3149. }
  3150. }
  3151. function getLayoutOutline(vjson) {
  3152. deepTravVJson(vjson, function (obj) {
  3153. if (!Array.isArray(obj)) {
  3154. _$2.forOwn(obj, function (value, key) {
  3155. if (key === 'id' || key === 'region' || key === 'layoutName'
  3156. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3157. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3158. if (key === 'region'
  3159. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3160. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3161. if (!_$2.has(obj, 'layoutName')) {
  3162. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3163. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3164. // console.log(obj.layoutName, obj.layoutNameDesc)
  3165. }
  3166. }
  3167. }
  3168. else {
  3169. if (key === 'items') {
  3170. obj.children = obj[key];
  3171. }
  3172. if (key === 'tbar') {
  3173. var t = obj[key];
  3174. t.layoutName = key;
  3175. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3176. // console.log(t.layoutName, t.layoutNameDesc)
  3177. if (_$2.has(obj, "items")) {
  3178. obj.items.splice(0, 0, t);
  3179. }
  3180. else if (_$2.has(obj, "children")) {
  3181. obj.children.splice(0, 0, t);
  3182. }
  3183. else {
  3184. obj.children = [t];
  3185. }
  3186. }
  3187. if (key === 'fbar') {
  3188. var t = obj[key];
  3189. t.layoutName = key;
  3190. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3191. // console.log(t.layoutName, t.layoutNameDesc)
  3192. if (_$2.has(obj, "items")) {
  3193. obj.items.push(t);
  3194. }
  3195. else if (_$2.has(obj, "children")) {
  3196. obj.children.push(t);
  3197. }
  3198. else {
  3199. obj.children = [t];
  3200. }
  3201. }
  3202. delete obj[key];
  3203. }
  3204. });
  3205. if (!obj.hasOwnProperty("children")) {
  3206. obj.leaf = true;
  3207. }
  3208. if (!obj.hasOwnProperty("expanded")) {
  3209. obj.expanded = true;
  3210. }
  3211. }
  3212. });
  3213. return vjson;
  3214. }
  3215. //# sourceMappingURL=ViewHelper.js.map
  3216. var Scope = /** @class */ (function () {
  3217. function Scope(args) {
  3218. /**
  3219. * 业务模块的唯一编号
  3220. */
  3221. this.id = _$2.uniqueId('scope_');
  3222. this.IS_DESIGN_MODE = false;
  3223. /**
  3224. * onload 运行完成之后才会设置本标记为 true
  3225. */
  3226. this.isLoadFinish = false;
  3227. this._isLoading = false;
  3228. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  3229. this.model = model;
  3230. if (typeof vjson.layout === 'undefined') {
  3231. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3232. var ret = buildPlus({ model: model, vjson: vjson });
  3233. model = ret.model;
  3234. vjson = ret.vjson;
  3235. }
  3236. this.originalVjson = _$2.cloneDeep(vjson);
  3237. this.vjson = this.originalVjson; // this.buildVjson()
  3238. var WMSTranslate = window["WMSTranslate"];
  3239. if (WMSTranslate) {
  3240. var i18nPath_1 = this.constructor.name;
  3241. if (i18n) {
  3242. WMSTranslate[i18nPath_1] = i18n;
  3243. }
  3244. this.vjson.i18nPath = i18nPath_1;
  3245. deepTravVJson(this.vjson, function (obj) {
  3246. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3247. return;
  3248. }
  3249. obj.i18nPath = i18nPath_1;
  3250. });
  3251. }
  3252. var extScope = getScopeOnCreate();
  3253. if (typeof extScope === 'function') {
  3254. extScope({ vjson: vjson, model: model }, this);
  3255. }
  3256. }
  3257. Scope.prototype._addWatch = function (tplExpress, fn) {
  3258. if (!this._watchList) {
  3259. this._watchList = [];
  3260. }
  3261. this._watchList.push({ watch: tplExpress, fn: fn });
  3262. };
  3263. Scope.prototype._applyWatchList = function () {
  3264. var _this = this;
  3265. _$2.forEach(this._watchList, function (item) {
  3266. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3267. });
  3268. };
  3269. Object.defineProperty(Scope.prototype, "isScope", {
  3270. get: function () {
  3271. return true;
  3272. },
  3273. enumerable: true,
  3274. configurable: true
  3275. });
  3276. /**
  3277. * 产生一个当前模块有效的唯一id
  3278. * @param key 唯一编号
  3279. */
  3280. Scope.prototype.uid = function (key) {
  3281. return this.id + key;
  3282. };
  3283. /**
  3284. * 对话框"保存"成功.
  3285. * 关闭对话框,并响应 success 方法
  3286. * @param data 要傳回的數據(可以為空)
  3287. */
  3288. Scope.prototype.dialogSuccess = function (data) {
  3289. this._handle.fireEvent('success', this, data);
  3290. var sender = this._handle.config.animateTarget;
  3291. var scope = lookupScope(sender);
  3292. if (typeof this['success'] === 'function') {
  3293. this['success'].call(scope, sender, data);
  3294. }
  3295. this.close();
  3296. };
  3297. /**
  3298. * 设置等待状态
  3299. * @param value
  3300. * @param msg
  3301. */
  3302. Scope.prototype.setLoading = function (value) {
  3303. var _a;
  3304. var scope = this;
  3305. this._isLoading = value;
  3306. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3307. };
  3308. Scope.prototype.getLoading = function () {
  3309. return this._isLoading;
  3310. };
  3311. /**
  3312. * 以对话框模式打开当前模块
  3313. * @param sender 发送者(按钮或Scope对象)
  3314. * @param vjsonOption 界面覆盖选项(可以为空)
  3315. * @param dataOption 数据覆盖选项(可以为空)
  3316. */
  3317. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3318. var _a;
  3319. var that = this;
  3320. var vmodel = _$2.defaultsDeep({
  3321. //
  3322. }, dataOption, that.model);
  3323. this.viewModel = new Ext.app.ViewModel(vmodel);
  3324. this.viewModel.yvanScope = this;
  3325. this._applyWatchList();
  3326. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3327. var config = _$2.defaultsDeep({
  3328. animateTarget: sender,
  3329. viewModel: this.viewModel,
  3330. yvanScope: this,
  3331. referenceHolder: true,
  3332. }, vjsonOption, that.vjson, windows);
  3333. if (config.height === 'unset') {
  3334. delete config.height;
  3335. }
  3336. if (config.width === 'unset') {
  3337. delete config.width;
  3338. }
  3339. // const holder = sender?.lookupReferenceHolder()
  3340. // delete config.constrain
  3341. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3342. if (topScope) {
  3343. config.constrain = true;
  3344. this.topScope = topScope;
  3345. }
  3346. var win = new Ext.Window(config);
  3347. // if (holder) {
  3348. // holder.add(win)
  3349. // }
  3350. if (topScope) {
  3351. topScope._handle.add(win);
  3352. }
  3353. win.addListener('beforerender', function (sender) {
  3354. // 记录句柄
  3355. if (sender && !that._handle) {
  3356. that._handle = sender;
  3357. }
  3358. });
  3359. win.addListener('afterrender', function (sender) {
  3360. // 调用onLoad回调
  3361. try {
  3362. that._onLoad();
  3363. }
  3364. catch (e) {
  3365. console.error('errorAt onLoad', e);
  3366. }
  3367. window['cw'] = that;
  3368. });
  3369. win.addListener('destroy', this._destroy.bind(this));
  3370. win.show();
  3371. };
  3372. /**
  3373. * 以标签模式打开当前模块
  3374. * @param vjsonOption 界面覆盖选项(可以为空)
  3375. * @param dataOption 数据覆盖选项(可以为空)
  3376. */
  3377. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3378. var _this = this;
  3379. var that = this;
  3380. this._vjsonOption = vjsonOption;
  3381. this._dataOption = dataOption;
  3382. var vmodel = _$2.defaultsDeep({
  3383. data: {}
  3384. }, dataOption, that.model);
  3385. this.viewModel = new Ext.app.ViewModel(vmodel);
  3386. this.viewModel.yvanScope = this;
  3387. this._applyWatchList();
  3388. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3389. // 根级不能设置id
  3390. delete that.vjson.id;
  3391. var config = _$2.defaultsDeep({
  3392. viewModel: this.viewModel,
  3393. yvanScope: this,
  3394. referenceHolder: true,
  3395. }, vjsonOption, that.vjson);
  3396. var tt = Ext.getCmp('TT');
  3397. var handle = tt.addScope(this, config, function (handle) {
  3398. handle.addListener('added', function (sender) {
  3399. // 记录句柄
  3400. if (sender && !that._handle) {
  3401. that._handle = sender;
  3402. }
  3403. });
  3404. handle.addListener('afterrender', function (sender) {
  3405. // 调用onLoad回调
  3406. try {
  3407. that._onLoad();
  3408. }
  3409. catch (e) {
  3410. console.error('errorAt onLoad', e);
  3411. }
  3412. });
  3413. handle.addListener('destroy', _this._destroy.bind(_this));
  3414. });
  3415. return handle;
  3416. };
  3417. /**
  3418. * 直接渲染到元素
  3419. * @param element 渲染目标
  3420. * @param vjsonOption 界面覆盖选项(可以为空)
  3421. * @param dataOption 数据覆盖选项(可以为空)
  3422. */
  3423. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3424. var that = this;
  3425. this._vjsonOption = vjsonOption;
  3426. this._dataOption = dataOption;
  3427. var vmodel = _$2.defaultsDeep({
  3428. data: {}
  3429. }, that.model, dataOption);
  3430. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3431. this.viewModel = new Ext.app.ViewModel(vmodel);
  3432. this.viewModel.yvanScope = this;
  3433. this._applyWatchList();
  3434. var config = _$2.defaultsDeep({
  3435. viewModel: this.viewModel,
  3436. yvanScope: this,
  3437. referenceHolder: true,
  3438. renderTo: element,
  3439. listeners: {
  3440. afterrender: function (sender) {
  3441. var _a;
  3442. // 记录句柄
  3443. if (sender && !that._handle) {
  3444. that._handle = sender;
  3445. }
  3446. // 调用onLoad回调
  3447. that._onLoad();
  3448. // 如果vjson中配置了 afterrender ,需要恢复状态
  3449. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3450. },
  3451. },
  3452. }, vjsonOption, that.vjson);
  3453. new Ext.container.Viewport(config);
  3454. };
  3455. Scope.prototype.showDesigner = function (designer, option) {
  3456. var that = this;
  3457. var vmodel = _$2.defaultsDeep({
  3458. data: {
  3459. IS_DESIGN_MODE: true,
  3460. }
  3461. }, that.model);
  3462. this.IS_DESIGN_MODE = true;
  3463. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3464. this.viewModel = new Ext.app.ViewModel(vmodel);
  3465. this.viewModel.yvanScope = this;
  3466. this._applyWatchList();
  3467. var config = _$2.defaultsDeep({
  3468. viewModel: this.viewModel,
  3469. yvanScope: this,
  3470. referenceHolder: true,
  3471. listeners: {
  3472. afterrender: function (sender) {
  3473. var _a;
  3474. // 记录句柄
  3475. if (sender && !that._handle) {
  3476. that._handle = sender;
  3477. }
  3478. // 调用onLoad回调
  3479. that._onLoad();
  3480. // 如果vjson中配置了 afterrender ,需要恢复状态
  3481. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3482. },
  3483. },
  3484. }, that.vjson);
  3485. designer.removeAll(true);
  3486. designer.add(config);
  3487. };
  3488. /**
  3489. * 关闭对话框(或标签页)
  3490. */
  3491. Scope.prototype.close = function () {
  3492. this._handle.close();
  3493. };
  3494. Object.defineProperty(Scope.prototype, "data", {
  3495. /**
  3496. * 获取 viewModel 里包含的数据(只读)
  3497. */
  3498. get: function () {
  3499. return this.viewModel.getData();
  3500. },
  3501. enumerable: true,
  3502. configurable: true
  3503. });
  3504. /**
  3505. * 设置 viewModel 中的数据
  3506. * 可以是 key, value 模式
  3507. * 也可以是 {key:value} 模式
  3508. */
  3509. Scope.prototype.set = function (path, value) {
  3510. return this.viewModel.set(path, value);
  3511. };
  3512. /**
  3513. * 寻找模块内所有的 xtype 对应的对象
  3514. * @param xtypeKey
  3515. */
  3516. Scope.prototype.down = function (xtypeKey) {
  3517. return this._handle.down(xtypeKey);
  3518. };
  3519. Object.defineProperty(Scope.prototype, "refs", {
  3520. /**
  3521. * 获取所有设置过 Reference 名称的组件
  3522. */
  3523. get: function () {
  3524. var _a, _b;
  3525. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3526. },
  3527. enumerable: true,
  3528. configurable: true
  3529. });
  3530. Scope.prototype._destroy = function () {
  3531. var that = this;
  3532. that.onDestroy();
  3533. delete that._watchList;
  3534. delete that._handle;
  3535. this.isLoadFinish = false;
  3536. };
  3537. /**
  3538. * 私有渲染完成后的回调
  3539. */
  3540. Scope.prototype._onLoad = function () {
  3541. var _this = this;
  3542. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3543. exports.scopeOnLoad(this);
  3544. }
  3545. this.onLoad();
  3546. _$2.defer(function () {
  3547. _this.isLoadFinish = true;
  3548. });
  3549. };
  3550. /**
  3551. * 默认 渲染完成之后调用的函数
  3552. */
  3553. Scope.prototype.onLoad = function () {
  3554. };
  3555. /**
  3556. * 组件卸载之后的回调
  3557. */
  3558. Scope.prototype.onDestroy = function () {
  3559. };
  3560. return Scope;
  3561. }());
  3562. /**
  3563. * 观察装饰器,viewModel 属性更改时触发成员方法
  3564. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3565. */
  3566. function watch(tplExpress, deep) {
  3567. if (deep === void 0) { deep = false; }
  3568. return function (target, propertyKey, pd) {
  3569. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3570. return target[propertyKey];
  3571. };
  3572. }
  3573. // 获取vjson的hash值
  3574. function getVjsonHash(str) {
  3575. var hash = 3465217896, i, ch;
  3576. for (i = str.length - 1; i >= 0; i--) {
  3577. ch = str.charCodeAt(i);
  3578. hash ^= ((hash << 5) + ch + (hash >> 2));
  3579. }
  3580. return (hash & 0x7FFFFFFF) + "";
  3581. }
  3582. function buildPlus(_a) {
  3583. var model = _a.model, vjson = _a.vjson;
  3584. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3585. {
  3586. layout: 'border',
  3587. // tbar: vjson.action,
  3588. items: vjson.items,
  3589. },
  3590. ] });
  3591. if (_$2.isArray(vjson.action)) {
  3592. vjsonNew.items[0].tbar = vjson.action;
  3593. }
  3594. return { model: model, vjson: vjsonNew };
  3595. }
  3596. //# sourceMappingURL=Scope.js.map
  3597. var model = {
  3598. data: {
  3599. leftTabTitle: ''
  3600. }
  3601. };
  3602. //# sourceMappingURL=Workbench.model.js.map
  3603. var vjson = {
  3604. frame: false,
  3605. layout: 'border',
  3606. width: '100%',
  3607. height: '100%',
  3608. border: false,
  3609. defaults: {
  3610. border: false
  3611. },
  3612. items: [
  3613. {
  3614. region: 'north',
  3615. height: 60,
  3616. cls: 'main-header',
  3617. reference: 'mainTop',
  3618. layout: 'hbox',
  3619. items: [
  3620. {
  3621. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3622. flex: 1,
  3623. border: false
  3624. },
  3625. {
  3626. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3627. menu: [
  3628. {
  3629. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3630. reference: 'commonSetting'
  3631. },
  3632. {
  3633. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3634. listeners: {
  3635. // click: 'scope.ready_api_click'
  3636. }
  3637. },
  3638. ]
  3639. },
  3640. {
  3641. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3642. cls: 'header-menu',
  3643. menu: [
  3644. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3645. ]
  3646. },
  3647. ]
  3648. },
  3649. {
  3650. region: 'west',
  3651. bind: {
  3652. title: '{leftTabTitle}',
  3653. },
  3654. titleAlign: 'center',
  3655. border: true, split: true, width: 340, collapsible: true,
  3656. reference: 'leftTab',
  3657. xtype: 'tabpanel',
  3658. tabPosition: 'left',
  3659. tabRotation: 0,
  3660. tabBar: {
  3661. border: false
  3662. },
  3663. listeners: {
  3664. tabchange: 'scope.leftTabChange',
  3665. },
  3666. items: [
  3667. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3668. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3669. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3670. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3671. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3672. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3673. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3674. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3675. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3676. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3677. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3678. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3679. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3680. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3681. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3682. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3683. ]
  3684. },
  3685. {
  3686. region: 'east',
  3687. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3688. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3689. },
  3690. {
  3691. region: 'center',
  3692. split: true, border: true,
  3693. xtype: 'maintab', reference: 'tt', id: 'TT',
  3694. plain: true,
  3695. listeners: {
  3696. restorypage: 'scope.openScope',
  3697. tabchange: 'scope.tabchange'
  3698. },
  3699. items: []
  3700. },
  3701. ],
  3702. };
  3703. //# sourceMappingURL=Workbench.view.js.map
  3704. /**
  3705. * 获取当前打开的项目资料
  3706. */
  3707. function getCurrentProject() {
  3708. // const value = sessionStorage.getItem('CurrentProject');
  3709. // if (value) {
  3710. // project = JSON.parse(value)
  3711. // if (!project.url) {
  3712. // project = undefined
  3713. // }
  3714. // }
  3715. // return project
  3716. return {
  3717. uuid: '00000000',
  3718. name: '本服项目',
  3719. url: '',
  3720. };
  3721. }
  3722. /**
  3723. * 设置当前打开的项目资料(全局)
  3724. */
  3725. function setCurrentProject(value) {
  3726. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3727. }
  3728. //# sourceMappingURL=Project.js.map
  3729. // ------------------------------------------------------------------------------------------ types
  3730. /** 订阅消息key类型 */
  3731. var EventType;
  3732. (function (EventType) {
  3733. /** FileTree打开Module */
  3734. EventType["ModuleOpen"] = "ModuleOpen";
  3735. /** ModulePage 创建 */
  3736. EventType["ModulePageCreate"] = "ModulePageCreate";
  3737. /** ModuleItem内容变化 */
  3738. EventType["ModuleItemChange"] = "ModuleItemChange";
  3739. /** ModuleItem的 jsView 内容变化 */
  3740. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3741. /** 设置 vjson */
  3742. EventType["SetVjson"] = "SetVjson";
  3743. /** 更新 vjson */
  3744. EventType["UpdateVjson"] = "UpdateVjson";
  3745. /** 更新 组件vjson */
  3746. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3747. /** Component 选中内容变化 */
  3748. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3749. /** Component 选中内容变化 */
  3750. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3751. /** Component 删除事件 */
  3752. EventType["ComponentDelete"] = "ComponentDelete";
  3753. /** MainTab 选中改变事件 */
  3754. EventType["MainTabChange"] = "MainTabChange";
  3755. /** ModuleTab 选中改变事件 */
  3756. EventType["ModuleTabChange"] = "ModuleTabChange";
  3757. /** 保存事件 */
  3758. EventType["SaveCall"] = "SaveCall";
  3759. /** 撤销 */
  3760. EventType["Undo"] = "Undo";
  3761. /** 还原 */
  3762. EventType["Redo"] = "Redo";
  3763. /** 剪切 */
  3764. EventType["Cut"] = "Cut";
  3765. /** 复制 */
  3766. EventType["Copy"] = "Copy";
  3767. /** 粘贴 */
  3768. EventType["Paste"] = "Paste";
  3769. /** 全选 */
  3770. EventType["SelectAll"] = "SelectAll";
  3771. /** 读取剪切板 */
  3772. EventType["ClipboardRead"] = "ClipboardRead";
  3773. /** 检查模块更新 */
  3774. EventType["RunCheckModule"] = "RunCheckModule";
  3775. /** 停止检查模块更新 */
  3776. EventType["StopCheckModule"] = "StopCheckModule";
  3777. })(EventType || (EventType = {}));
  3778. // ------------------------------------------------------------------------------------------ impls
  3779. var EventBus = /** @class */ (function () {
  3780. function EventBus() {
  3781. /** 事件数据 */
  3782. this.store = {};
  3783. /** 事件订阅者注册表 */
  3784. this.observeStoreTable = {};
  3785. this.init();
  3786. }
  3787. EventBus.prototype.init = function () {
  3788. var _this = this;
  3789. // 更改store值就会自动publish消息 - 实现
  3790. this.store = new Proxy({}, {
  3791. get: function (target, key) {
  3792. return target[key];
  3793. },
  3794. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3795. set: function (target, key, data) {
  3796. if (noValue(key))
  3797. return false;
  3798. target[key] = data;
  3799. // 消息通知订阅者
  3800. var observerArr = _this.observeStoreTable[key];
  3801. if (noValue(observerArr) || observerArr.length <= 0)
  3802. return true;
  3803. observerArr.forEach(function (handler) {
  3804. //try {
  3805. handler(data, key);
  3806. // } catch (err) {
  3807. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3808. // }
  3809. });
  3810. return true;
  3811. },
  3812. });
  3813. };
  3814. /** 取消注册订阅者 */
  3815. EventBus.prototype.unregisterObserver = function (key, handler) {
  3816. var _this = this;
  3817. var observerArr = this.observeStoreTable[key];
  3818. if (noValue(observerArr) || observerArr.length <= 0)
  3819. return;
  3820. if (noValue(handler)) {
  3821. this.observeStoreTable[key] = [];
  3822. }
  3823. else {
  3824. observerArr.forEach(function (obsHandler, index) {
  3825. if (obsHandler !== handler)
  3826. return;
  3827. _this.observeStoreTable[key].splice(index, 1);
  3828. });
  3829. }
  3830. };
  3831. /** 注册订阅者 */
  3832. EventBus.prototype.registerObserver = function (key, handler) {
  3833. var observerArr = this.observeStoreTable[key];
  3834. if (noValue(observerArr) || observerArr.length <= 0) {
  3835. observerArr = [];
  3836. this.observeStoreTable[key] = observerArr;
  3837. }
  3838. observerArr.push(handler);
  3839. // if (noValue(key)) return;
  3840. // const sourceValue = this.store[key];
  3841. // if (noValue(sourceValue)) return;
  3842. // handler(sourceValue, key);
  3843. };
  3844. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3845. EventBus.prototype.getStore = function () {
  3846. return this.store;
  3847. };
  3848. /**
  3849. * 取消订阅
  3850. * @param key 订阅的消息key
  3851. * @param handler 指定取消的监听函数
  3852. */
  3853. EventBus.prototype.unsubscribe = function (key, handler) {
  3854. var _this = this;
  3855. if (key instanceof Array) {
  3856. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3857. }
  3858. else {
  3859. this.unregisterObserver(key, handler);
  3860. }
  3861. };
  3862. /**
  3863. * 消息订阅
  3864. * @param key 订阅的消息key
  3865. * @param handler 监听函数
  3866. */
  3867. EventBus.prototype.subscribe = function (key, handler) {
  3868. var _this = this;
  3869. var cancelSubscribe = {
  3870. key: key,
  3871. cancel: function () {
  3872. },
  3873. };
  3874. if (key instanceof Array) {
  3875. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3876. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3877. }
  3878. else {
  3879. this.registerObserver(key, handler);
  3880. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3881. }
  3882. return cancelSubscribe;
  3883. };
  3884. /**
  3885. * 消息订阅(只订阅一次)
  3886. * @param key 订阅的消息key
  3887. * @param handler 监听函数
  3888. */
  3889. EventBus.prototype.subscribeOnce = function (key, handler) {
  3890. var cancelSubscribe = this.subscribe(key, function (data) {
  3891. // try {
  3892. handler(data, key);
  3893. // } catch (err) {
  3894. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3895. // }
  3896. cancelSubscribe.cancel();
  3897. });
  3898. };
  3899. /**
  3900. * 发送消息(触发订阅监听函数)
  3901. * @param key 消息key
  3902. * @param eventData 消息值
  3903. */
  3904. EventBus.prototype.publish = function (key, eventData) {
  3905. var _this = this;
  3906. if (key instanceof Array) {
  3907. key.forEach(function (k) { return _this.store[k] = eventData; });
  3908. }
  3909. else {
  3910. this.store[key] = eventData;
  3911. }
  3912. };
  3913. return EventBus;
  3914. }());
  3915. // ------------------------------------------------------------------------------------------ use
  3916. var eventBus = new EventBus();
  3917. //# sourceMappingURL=EventBus.js.map
  3918. var model$1 = {
  3919. data: {
  3920. dataSync_isStart: false,
  3921. dataSync: {
  3922. skipError: false,
  3923. clearData: false,
  3924. tables: []
  3925. },
  3926. dataSyncResult: {
  3927. jobId: ''
  3928. },
  3929. dataSource1: '',
  3930. dataSource2: '',
  3931. schema1: '',
  3932. schema2: '',
  3933. hasDiff: false,
  3934. }
  3935. };
  3936. //# sourceMappingURL=DbSync.model.js.map
  3937. var vjson$1 = {
  3938. title: '数据库同步',
  3939. layout: 'fit',
  3940. items: [
  3941. {
  3942. reference: 'wizard1',
  3943. layout: 'card',
  3944. items: [
  3945. {
  3946. reference: 'first',
  3947. layout: 'fit',
  3948. bbar: [
  3949. '->',
  3950. {
  3951. xtype: 'button',
  3952. iconCls: 'x-fa fa-road',
  3953. text: '结构同步 &raquo;',
  3954. bind: {
  3955. disabled: '{!hasDiff}'
  3956. },
  3957. listeners: {
  3958. click: 'scope.structCopyTo',
  3959. }
  3960. },
  3961. {
  3962. xtype: 'button',
  3963. iconCls: 'x-fa fa-files-o',
  3964. text: '数据同步 &raquo;',
  3965. bind: {
  3966. disabled: '{!hasDiff}'
  3967. },
  3968. listeners: {
  3969. click: 'scope.dataCopyTo',
  3970. }
  3971. },
  3972. {
  3973. xtype: 'button',
  3974. iconCls: 'x-fa fa-sort-alpha-desc',
  3975. text: '索引同步 &raquo;',
  3976. bind: {
  3977. disabled: '{!hasDiff}'
  3978. },
  3979. listeners: {
  3980. click: 'scope.indexCopyTo',
  3981. }
  3982. },
  3983. {
  3984. xtype: 'button',
  3985. iconCls: 'x-fa fa-product-hunt',
  3986. text: '存储过程同步 &raquo;',
  3987. bind: {
  3988. disabled: '{!hasDiff}'
  3989. },
  3990. listeners: {
  3991. click: 'scope.procedureCopyTo',
  3992. }
  3993. },
  3994. ],
  3995. items: [
  3996. {
  3997. title: '数据库对比',
  3998. reference: 'grid1',
  3999. xtype: 'yvgrid',
  4000. pagination: false,
  4001. border: false,
  4002. cellTip: true,
  4003. selModel: {
  4004. type: 'checkboxmodel',
  4005. mode: 'MULTI',
  4006. },
  4007. tbar: {
  4008. xtype: 'toolbar',
  4009. items: [
  4010. {
  4011. xtype: 'combo',
  4012. fieldLabel: '源数据库',
  4013. bind: {
  4014. value: '{dataSource1}'
  4015. },
  4016. dataSource: 'scope.getDataBaseName'
  4017. },
  4018. {
  4019. xtype: 'combo',
  4020. fieldLabel: '目标数据库',
  4021. bind: {
  4022. value: '{dataSource2}'
  4023. },
  4024. dataSource: 'scope.getDataBaseName'
  4025. },
  4026. {
  4027. xtype: 'button',
  4028. iconCls: 'x-fa fa-flash',
  4029. text: '对比',
  4030. bind: {
  4031. disabled: '{!dataSource1 || !dataSource2}'
  4032. },
  4033. listeners: {
  4034. click: 'scope.diff',
  4035. }
  4036. },
  4037. {
  4038. xtype: 'button',
  4039. iconCls: 'x-fa fa-cloud-download',
  4040. text: '重新拉取结构(耗时!)',
  4041. bind: {
  4042. disabled: '{!dataSource1 || !dataSource2}'
  4043. },
  4044. listeners: {
  4045. click: 'scope.dbToMeta',
  4046. }
  4047. },
  4048. ]
  4049. },
  4050. columns: [
  4051. {
  4052. dataIndex: 'table_name1',
  4053. header: '源表',
  4054. width: 300,
  4055. },
  4056. {
  4057. dataIndex: 'table_name2',
  4058. header: '目标表',
  4059. width: 300,
  4060. },
  4061. {
  4062. dataIndex: 'diff',
  4063. header: '对比结果',
  4064. width: 100,
  4065. },
  4066. {
  4067. xtype: 'actioncolumn',
  4068. width: 30,
  4069. sortable: false,
  4070. menuDisabled: true,
  4071. items: [
  4072. {
  4073. iconCls: 'x-fa fa-bars',
  4074. text: '打开',
  4075. handler: 'scope.showDetail',
  4076. }
  4077. ]
  4078. },
  4079. {
  4080. dataIndex: 'remark',
  4081. header: '详情',
  4082. width: 200,
  4083. sortable: true,
  4084. },
  4085. ],
  4086. },
  4087. ]
  4088. },
  4089. {
  4090. reference: 'ddl',
  4091. layout: {
  4092. type: 'vbox',
  4093. pack: 'start',
  4094. align: 'stretch'
  4095. },
  4096. items: [
  4097. {
  4098. xtype: 'sqleditor',
  4099. reference: 'ddleditor',
  4100. flex: 1,
  4101. },
  4102. {
  4103. xtype: 'toolbar',
  4104. items: [
  4105. '->',
  4106. {
  4107. xtype: 'button',
  4108. text: '&laquo; 上一步',
  4109. listeners: {
  4110. click: 'scope.back'
  4111. }
  4112. },
  4113. {
  4114. xtype: 'button',
  4115. iconCls: 'x-fa fa-flash',
  4116. text: '执行',
  4117. listeners: {
  4118. click: 'scope.executeDDL'
  4119. }
  4120. },
  4121. ]
  4122. }
  4123. ]
  4124. },
  4125. {
  4126. reference: 'ddl_idx',
  4127. layout: {
  4128. type: 'vbox',
  4129. pack: 'start',
  4130. align: 'stretch'
  4131. },
  4132. items: [
  4133. {
  4134. xtype: 'sqleditor',
  4135. reference: 'ddleditor_idx',
  4136. flex: 1,
  4137. },
  4138. {
  4139. xtype: 'toolbar',
  4140. items: [
  4141. '->',
  4142. {
  4143. xtype: 'button',
  4144. text: '&laquo; 上一步',
  4145. listeners: {
  4146. click: 'scope.back'
  4147. }
  4148. },
  4149. {
  4150. xtype: 'button',
  4151. iconCls: 'x-fa fa-flash',
  4152. text: '执行',
  4153. listeners: {
  4154. click: 'scope.executeDDLIdx'
  4155. }
  4156. },
  4157. ]
  4158. }
  4159. ]
  4160. },
  4161. {
  4162. reference: 'ddl_procedure',
  4163. layout: {
  4164. type: 'vbox',
  4165. pack: 'start',
  4166. align: 'stretch'
  4167. },
  4168. items: [
  4169. {
  4170. xtype: 'sqleditor',
  4171. reference: 'ddleditor_procedure',
  4172. flex: 1,
  4173. },
  4174. {
  4175. xtype: 'toolbar',
  4176. items: [
  4177. '->',
  4178. {
  4179. xtype: 'button',
  4180. text: '&laquo; 上一步',
  4181. listeners: {
  4182. click: 'scope.back'
  4183. }
  4184. },
  4185. {
  4186. xtype: 'button',
  4187. iconCls: 'x-fa fa-flash',
  4188. text: '执行',
  4189. listeners: {
  4190. click: 'scope.executeProcedureSQL'
  4191. }
  4192. },
  4193. ]
  4194. }
  4195. ]
  4196. },
  4197. {
  4198. reference: 'datacopy',
  4199. xtype: 'yvgrid',
  4200. pagination: false,
  4201. tbar: {
  4202. xtype: 'toolbar',
  4203. items: [
  4204. {
  4205. xtype: 'checkbox',
  4206. fieldLabel: '忽略错误',
  4207. bind: {
  4208. value: '{dataSync.skipError}'
  4209. },
  4210. },
  4211. {
  4212. xtype: 'checkbox',
  4213. fieldLabel: '清空数据',
  4214. bind: {
  4215. value: '{dataSync.clearData}'
  4216. },
  4217. },
  4218. {
  4219. xtype: 'button',
  4220. iconCls: 'x-fa fa-play-circle',
  4221. text: '开始',
  4222. bind: {
  4223. disabled: '{dataSync_isStart}'
  4224. },
  4225. listeners: { click: 'scope.dataSync_start' }
  4226. },
  4227. {
  4228. xtype: 'button',
  4229. iconCls: 'x-fa fa-stop-circle',
  4230. text: '停止',
  4231. bind: {
  4232. disabled: '{!dataSync_isStart}'
  4233. },
  4234. listeners: { click: 'scope.dataSync_stop' }
  4235. },
  4236. ]
  4237. },
  4238. columns: [
  4239. {
  4240. dataIndex: 'tableName', header: '表名',
  4241. width: 300,
  4242. },
  4243. {
  4244. dataIndex: 'dataCount', header: '总记录数',
  4245. width: 150,
  4246. },
  4247. {
  4248. dataIndex: 'currentIdx', header: '当前记录数',
  4249. width: 150,
  4250. },
  4251. {
  4252. dataIndex: 'syncCount', header: '同步数',
  4253. width: 150,
  4254. },
  4255. {
  4256. dataIndex: 'deleteCount', header: '删除',
  4257. width: 150,
  4258. },
  4259. {
  4260. dataIndex: 'syncProgress', header: '进度',
  4261. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4262. },
  4263. ]
  4264. }
  4265. ]
  4266. }
  4267. ]
  4268. };
  4269. //# sourceMappingURL=DbSync.view.js.map
  4270. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4271. function createEmptyModule(path, filename) {
  4272. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4273. }
  4274. function createFolder(parentPath, filename) {
  4275. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4276. }
  4277. function getModuleFileContent(module) {
  4278. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4279. }
  4280. function saveFile(fileFullPath, fileContent) {
  4281. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4282. // @ts-ignore
  4283. system.msg("保存成功");
  4284. return res;
  4285. });
  4286. }
  4287. function getQueryDslInfo(tableName) {
  4288. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4289. args: [
  4290. { tableName: tableName }
  4291. ]
  4292. }).catch(function (e) {
  4293. var _a, _b;
  4294. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4295. showErrorDialog(msg);
  4296. console.error(msg, e);
  4297. });
  4298. }
  4299. function invokeServer(url, param) {
  4300. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4301. return request.post(url, {
  4302. args: [
  4303. param
  4304. ]
  4305. }).catch(function (e) {
  4306. var _a, _b;
  4307. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4308. showErrorDialog(msg);
  4309. console.error(msg, e);
  4310. });
  4311. }
  4312. function parseSqlApi(sql) {
  4313. return request.post(getBaseUrl() + "@parseSqlApi", {
  4314. args: [sql]
  4315. }).catch(function (e) {
  4316. var _a, _b;
  4317. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4318. showErrorDialog(msg);
  4319. console.error(msg, e);
  4320. });
  4321. }
  4322. function saveModuleFiles(param) {
  4323. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4324. args: [
  4325. param
  4326. ]
  4327. }).catch(function (e) {
  4328. var _a, _b;
  4329. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4330. showErrorDialog(msg);
  4331. console.error(msg, e);
  4332. });
  4333. }
  4334. function createQueryDSLFile(_a) {
  4335. var schema_name = _a.schema_name, table_name = _a.table_name;
  4336. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4337. args: [{ schema_name: schema_name, table_name: table_name }]
  4338. }).catch(function (e) {
  4339. var _a, _b;
  4340. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4341. showErrorDialog(msg);
  4342. console.error(msg, e);
  4343. });
  4344. }
  4345. function dbToMeta(param) {
  4346. if (typeof param === 'undefined') {
  4347. param = { datasource: 'master' };
  4348. }
  4349. else if (typeof param.datasource === 'undefined') {
  4350. param.datasource = 'master';
  4351. }
  4352. return request.post(getBaseUrl() + "@dbToMeta", {
  4353. args: [
  4354. param
  4355. ]
  4356. }).catch(function (e) {
  4357. var _a, _b;
  4358. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4359. showErrorDialog(msg);
  4360. console.error(msg, e);
  4361. });
  4362. }
  4363. function getColumnDomainApi(param) {
  4364. if (typeof param === 'undefined') {
  4365. param = { datasource: 'master' };
  4366. }
  4367. else if (typeof param.datasource === 'undefined') {
  4368. param.datasource = 'master';
  4369. }
  4370. return request.post(getBaseUrl() + "@getColumnDomain", {
  4371. args: [
  4372. param
  4373. ]
  4374. }).catch(function (e) {
  4375. var _a, _b;
  4376. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4377. showErrorDialog(msg);
  4378. console.error(msg, e);
  4379. });
  4380. }
  4381. function getMateData(param) {
  4382. if (typeof param === 'undefined') {
  4383. param = { datasource: 'master' };
  4384. }
  4385. else if (typeof param.datasource === 'undefined') {
  4386. param.datasource = 'master';
  4387. }
  4388. return request.post(getBaseUrl() + "@getMateData", {
  4389. args: [
  4390. param
  4391. ]
  4392. }).catch(function (e) {
  4393. var _a, _b;
  4394. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4395. showErrorDialog(msg);
  4396. console.error(msg, e);
  4397. });
  4398. }
  4399. function getMateDataByTableName(param) {
  4400. if (typeof param === 'undefined') {
  4401. param = { datasource: 'master' };
  4402. }
  4403. else if (typeof param.datasource === 'undefined') {
  4404. param.datasource = 'master';
  4405. }
  4406. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4407. args: [
  4408. param
  4409. ]
  4410. }).catch(function (e) {
  4411. var _a, _b;
  4412. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4413. showErrorDialog(msg);
  4414. console.error(msg, e);
  4415. });
  4416. }
  4417. function saveMetaTableChanges(param) {
  4418. if (typeof param === 'undefined') {
  4419. param = { datasource: 'master' };
  4420. }
  4421. else if (typeof param.datasource === 'undefined') {
  4422. param.datasource = 'master';
  4423. }
  4424. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4425. args: [
  4426. param
  4427. ]
  4428. }).catch(function (e) {
  4429. var _a, _b;
  4430. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4431. showErrorDialog(msg);
  4432. console.error(msg, e);
  4433. });
  4434. }
  4435. function getModifyTableDDL(param) {
  4436. if (typeof param === 'undefined') {
  4437. param = { datasource: 'master' };
  4438. }
  4439. else if (typeof param.datasource === 'undefined') {
  4440. param.datasource = 'master';
  4441. }
  4442. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4443. args: [
  4444. param
  4445. ]
  4446. }).catch(function (e) {
  4447. var _a, _b;
  4448. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4449. showErrorDialog(msg);
  4450. console.error(msg, e);
  4451. });
  4452. }
  4453. function pushToDbCommitApi(param) {
  4454. if (typeof param === 'undefined') {
  4455. param = { datasource: 'master' };
  4456. }
  4457. else if (typeof param.datasource === 'undefined') {
  4458. param.datasource = 'master';
  4459. }
  4460. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4461. args: [
  4462. param
  4463. ]
  4464. }).catch(function (e) {
  4465. var _a, _b;
  4466. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4467. showErrorDialog(msg);
  4468. console.error(msg, e);
  4469. });
  4470. }
  4471. /**
  4472. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4473. */
  4474. function saveMetaExBuildDDL(param) {
  4475. if (typeof param === 'undefined') {
  4476. param = { datasource: 'master' };
  4477. }
  4478. else if (typeof param.datasource === 'undefined') {
  4479. param.datasource = 'master';
  4480. }
  4481. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4482. args: [
  4483. param
  4484. ]
  4485. }).catch(function (e) {
  4486. var _a, _b;
  4487. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4488. showErrorDialog(msg);
  4489. console.error(msg, e);
  4490. });
  4491. }
  4492. function registerResource(params) {
  4493. return request.post(getBaseUrl() + "@registerResource", {
  4494. args: [params]
  4495. }).catch(function (e) {
  4496. var _a, _b;
  4497. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4498. showErrorDialog(msg);
  4499. console.error(msg, e);
  4500. });
  4501. }
  4502. function getMenuTree(params) {
  4503. return request.post(getBaseUrl() + "@getMenuTree", {
  4504. args: [params]
  4505. }).catch(function (e) {
  4506. var _a, _b;
  4507. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4508. showErrorDialog(msg);
  4509. console.error(msg, e);
  4510. });
  4511. }
  4512. function moduleTree() {
  4513. return request.post(getBaseUrl() + "@moduleTree")
  4514. .catch(function (e) {
  4515. var _a, _b;
  4516. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4517. showErrorDialog(msg);
  4518. console.error(msg, e);
  4519. });
  4520. }
  4521. function dropTableDDL(schemaName, tableName) {
  4522. return request.post(getBaseUrl() + "@dropTableDDL", {
  4523. args: [
  4524. { schemaName: schemaName, tableName: tableName },
  4525. ]
  4526. }).catch(function (e) {
  4527. var _a, _b;
  4528. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4529. showErrorDialog(msg);
  4530. console.error(msg, e);
  4531. });
  4532. }
  4533. function renameTableDDL(schemaName, tableName, reTableName) {
  4534. return request.post(getBaseUrl() + "@renameTableDDL", {
  4535. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4536. }).catch(function (e) {
  4537. var _a, _b;
  4538. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4539. showErrorDialog(msg);
  4540. console.error(msg, e);
  4541. });
  4542. }
  4543. function executeModifyProcedureSQL(param) {
  4544. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4545. args: [
  4546. param,
  4547. ]
  4548. }).catch(function (e) {
  4549. var _a, _b;
  4550. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4551. showErrorDialog(msg);
  4552. console.error(msg, e);
  4553. });
  4554. }
  4555. function parseDynamicSqlApi(sql, dataSource) {
  4556. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4557. args: [
  4558. { sql: sql, dataSource: dataSource },
  4559. ]
  4560. }).catch(function (e) {
  4561. var _a, _b;
  4562. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4563. showErrorDialog(msg);
  4564. console.error(msg, e);
  4565. });
  4566. }
  4567. function exporerList() {
  4568. return request.post(getBaseUrl() + "@exporerList", {
  4569. args: [{}]
  4570. }).catch(function (e) {
  4571. var _a, _b;
  4572. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4573. showErrorDialog(msg);
  4574. console.error(msg, e);
  4575. });
  4576. }
  4577. function reportListApi() {
  4578. return request.post(getBaseUrl() + "@reportList", {
  4579. args: []
  4580. }).catch(function (e) {
  4581. var _a, _b;
  4582. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4583. showErrorDialog(msg);
  4584. console.error(msg, e);
  4585. });
  4586. }
  4587. function reportByIdApi(reportId) {
  4588. return request.post(getBaseUrl() + "@reportById", {
  4589. args: [
  4590. { reportId: reportId },
  4591. ]
  4592. }).catch(function (e) {
  4593. var _a, _b;
  4594. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4595. showErrorDialog(msg);
  4596. console.error(msg, e);
  4597. });
  4598. }
  4599. function createReportApi(reportName) {
  4600. return request.post(getBaseUrl() + "@createReport", {
  4601. args: [
  4602. { reportName: reportName },
  4603. ]
  4604. }).catch(function (e) {
  4605. var _a, _b;
  4606. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4607. showErrorDialog(msg);
  4608. console.error(msg, e);
  4609. });
  4610. }
  4611. function saveReportApi(param) {
  4612. return request.post(getBaseUrl() + "@saveReport", {
  4613. args: [
  4614. param,
  4615. ]
  4616. }).catch(function (e) {
  4617. var _a, _b;
  4618. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4619. showErrorDialog(msg);
  4620. console.error(msg, e);
  4621. });
  4622. }
  4623. function delReportApi(report_id) {
  4624. return request.post(getBaseUrl() + "@delReport", {
  4625. args: [{ report_id: report_id },]
  4626. }).catch(function (e) {
  4627. var _a, _b;
  4628. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4629. showErrorDialog(msg);
  4630. console.error(msg, e);
  4631. });
  4632. }
  4633. function getDict(param) {
  4634. if (typeof param === 'undefined') {
  4635. param = { datasource: 'master' };
  4636. }
  4637. else if (typeof param.datasource === 'undefined') {
  4638. param.datasource = 'master';
  4639. }
  4640. return request.post(getBaseUrl() + "@getDict", {
  4641. args: [
  4642. param
  4643. ]
  4644. });
  4645. }
  4646. function saveDictApi(param) {
  4647. if (typeof param === 'undefined') {
  4648. param = { datasource: 'master' };
  4649. }
  4650. else if (typeof param.datasource === 'undefined') {
  4651. param.datasource = 'master';
  4652. }
  4653. return request.post(getBaseUrl() + "@saveDict", {
  4654. args: [
  4655. param
  4656. ]
  4657. }).catch(function (e) {
  4658. var _a, _b;
  4659. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4660. showErrorDialog(msg);
  4661. console.error(msg, e);
  4662. });
  4663. }
  4664. function saveDictItemsApi(param) {
  4665. if (typeof param === 'undefined') {
  4666. param = { datasource: 'master' };
  4667. }
  4668. else if (typeof param.datasource === 'undefined') {
  4669. param.datasource = 'master';
  4670. }
  4671. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4672. args: [
  4673. param
  4674. ]
  4675. }).catch(function (e) {
  4676. var _a, _b;
  4677. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4678. showErrorDialog(msg);
  4679. console.error(msg, e);
  4680. });
  4681. }
  4682. function createDictEnum(param) {
  4683. return request.post(getBaseUrl() + "@createDictEnum", {
  4684. args: [
  4685. param
  4686. ]
  4687. }).catch(function (e) {
  4688. var _a, _b;
  4689. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4690. showErrorDialog(msg);
  4691. console.error(msg, e);
  4692. });
  4693. }
  4694. function loadSqlContentApi(url) {
  4695. return request.post(getBaseUrl() + "@loadSqlContent", {
  4696. args: [
  4697. {
  4698. url: GLOBAL_NAMESPACE_PREFIX + url,
  4699. }
  4700. ]
  4701. }).catch(function (e) {
  4702. var _a, _b;
  4703. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4704. showErrorDialog(msg);
  4705. console.error(msg, e);
  4706. });
  4707. }
  4708. function saveSqlContentApi(url, content) {
  4709. return request.post(getBaseUrl() + "@saveSqlContent", {
  4710. args: [
  4711. {
  4712. url: GLOBAL_NAMESPACE_PREFIX + url,
  4713. content: content,
  4714. }
  4715. ]
  4716. }).catch(function (e) {
  4717. var _a, _b;
  4718. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4719. showErrorDialog(msg);
  4720. console.error(msg, e);
  4721. });
  4722. }
  4723. function readBpmn(param) {
  4724. return request.post(getBaseUrl() + "@readBpmn", {
  4725. args: [param]
  4726. }).catch(function (e) {
  4727. var _a, _b;
  4728. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4729. showErrorDialog(msg);
  4730. console.error(msg, e);
  4731. });
  4732. }
  4733. function createBpmn(path, filename) {
  4734. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4735. var _a, _b;
  4736. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4737. showErrorDialog(msg);
  4738. console.error(msg, e);
  4739. });
  4740. }
  4741. function saveBpmn(fileFullPath, fileContent) {
  4742. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4743. // @ts-ignore
  4744. system.msg("保存成功");
  4745. return res;
  4746. });
  4747. }
  4748. function deleteBpmn(path, filename) {
  4749. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4750. var _a, _b;
  4751. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4752. showErrorDialog(msg);
  4753. console.error(msg, e);
  4754. });
  4755. }
  4756. function createDevForm(param) {
  4757. return request.post(getBaseUrl() + "@createDevForm", {
  4758. args: [param]
  4759. }).catch(function (e) {
  4760. var _a, _b;
  4761. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4762. showErrorDialog(msg);
  4763. console.error(msg, e);
  4764. });
  4765. }
  4766. function readDevForm(param) {
  4767. return request.post(getBaseUrl() + "@readDevForm", {
  4768. args: [param]
  4769. }).catch(function (e) {
  4770. var _a, _b;
  4771. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4772. showErrorDialog(msg);
  4773. console.error(msg, e);
  4774. });
  4775. }
  4776. function calcColumnForm(param) {
  4777. return request.post(getBaseUrl() + "@calcColumnForm", {
  4778. args: [param]
  4779. }).catch(function (e) {
  4780. var _a, _b;
  4781. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4782. showErrorDialog(msg);
  4783. console.error(msg, e);
  4784. });
  4785. }
  4786. function widgetListApi(param) {
  4787. return request.post(getBaseUrl() + "@widgetListApi", {
  4788. args: [param]
  4789. }).catch(function (e) {
  4790. var _a, _b;
  4791. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4792. showErrorDialog(msg);
  4793. console.error(msg, e);
  4794. });
  4795. }
  4796. function readWidget(param) {
  4797. return request.post(getBaseUrl() + "@readWidget", {
  4798. args: [param]
  4799. }).catch(function (e) {
  4800. var _a, _b;
  4801. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4802. showErrorDialog(msg);
  4803. console.error(msg, e);
  4804. });
  4805. }
  4806. function saveWidget(param) {
  4807. return request.post(getBaseUrl() + "@saveWidget", {
  4808. args: [param]
  4809. }).catch(function (e) {
  4810. var _a, _b;
  4811. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4812. showErrorDialog(msg);
  4813. console.error(msg, e);
  4814. });
  4815. }
  4816. function deleteWidget(param) {
  4817. return request.post(getBaseUrl() + "@deleteWidget", {
  4818. args: [param]
  4819. }).catch(function (e) {
  4820. var _a, _b;
  4821. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4822. showErrorDialog(msg);
  4823. console.error(msg, e);
  4824. });
  4825. }
  4826. function getDataBaseNameApi() {
  4827. return request.post(getBaseUrl() + "@getDataBaseName", {
  4828. args: []
  4829. }).catch(function (e) {
  4830. var _a, _b;
  4831. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4832. showErrorDialog(msg);
  4833. console.error(msg, e);
  4834. });
  4835. }
  4836. function getDiffDDLApi(param) {
  4837. return request.post(getBaseUrl() + "@getDiffDDL", {
  4838. args: [
  4839. param
  4840. ]
  4841. }).catch(function (e) {
  4842. var _a, _b;
  4843. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4844. showErrorDialog(msg);
  4845. console.error(msg, e);
  4846. });
  4847. }
  4848. function dataSyncApi(param) {
  4849. return request.post(getBaseUrl() + "@dataSync", {
  4850. args: [
  4851. param
  4852. ]
  4853. }).catch(function (e) {
  4854. var _a, _b;
  4855. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4856. showErrorDialog(msg);
  4857. console.error(msg, e);
  4858. });
  4859. }
  4860. function dataSyncInfoApi(param) {
  4861. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4862. args: [
  4863. param
  4864. ]
  4865. }).catch(function (e) {
  4866. var _a, _b;
  4867. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4868. showErrorDialog(msg);
  4869. console.error(msg, e);
  4870. });
  4871. }
  4872. function saveColumnDomain(param) {
  4873. if (typeof param === 'undefined') {
  4874. param = { datasource: 'master' };
  4875. }
  4876. else if (typeof param.datasource === 'undefined') {
  4877. param.datasource = 'master';
  4878. }
  4879. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4880. args: [
  4881. param
  4882. ]
  4883. }).catch(function (e) {
  4884. var _a, _b;
  4885. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4886. showErrorDialog('发生错误:' + msg);
  4887. console.error(msg, e);
  4888. });
  4889. }
  4890. function devOpsList() {
  4891. return request.post(getBaseUrl() + "@devOpsList", {
  4892. args: [{}]
  4893. }).catch(function (e) {
  4894. var _a, _b;
  4895. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4896. showErrorDialog('发生错误:' + msg);
  4897. console.error(msg, e);
  4898. });
  4899. }
  4900. function devOpsById(opsId) {
  4901. return request.post(getBaseUrl() + "@devOpsById", {
  4902. args: [{ opsId: opsId }]
  4903. }).catch(function (e) {
  4904. var _a, _b;
  4905. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4906. showErrorDialog('发生错误:' + msg);
  4907. console.error(msg, e);
  4908. });
  4909. }
  4910. function metricsRequestApi() {
  4911. return request.get("/api/metrics/request")
  4912. .catch(function (e) {
  4913. var _a, _b;
  4914. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4915. showErrorDialog('发生错误:' + msg);
  4916. console.error(msg, e);
  4917. });
  4918. }
  4919. function metricsJdbcApi() {
  4920. return request.get("/api/metrics/jdbc")
  4921. .catch(function (e) {
  4922. var _a, _b;
  4923. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4924. showErrorDialog('发生错误:' + msg);
  4925. console.error(msg, e);
  4926. });
  4927. }
  4928. function executeDDL(param) {
  4929. return request.post(getBaseUrl() + "@executeDDL", {
  4930. args: [
  4931. param,
  4932. ]
  4933. }).catch(function (e) {
  4934. var _a, _b;
  4935. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4936. showErrorDialog('发生错误:' + msg);
  4937. console.error(msg, e);
  4938. });
  4939. }
  4940. function getModifyIdxDDL(param) {
  4941. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4942. args: [
  4943. param,
  4944. ]
  4945. }).catch(function (e) {
  4946. var _a, _b;
  4947. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4948. showErrorDialog('发生错误:' + msg);
  4949. console.error(msg, e);
  4950. });
  4951. }
  4952. function getModifyProcedureSQL(param) {
  4953. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4954. args: [
  4955. param,
  4956. ]
  4957. }).catch(function (e) {
  4958. var _a, _b;
  4959. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4960. showErrorDialog('发生错误:' + msg);
  4961. console.error(msg, e);
  4962. });
  4963. }
  4964. function saveWhLayout(param) {
  4965. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4966. args: [
  4967. param,
  4968. ]
  4969. }).catch(function (e) {
  4970. var _a, _b;
  4971. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4972. showErrorDialog('发生错误:' + msg);
  4973. console.error(msg, e);
  4974. });
  4975. }
  4976. function deleteWhLayout(param) {
  4977. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4978. args: [
  4979. param,
  4980. ]
  4981. }).catch(function (e) {
  4982. var _a, _b;
  4983. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4984. showErrorDialog('发生错误:' + msg);
  4985. console.error(msg, e);
  4986. });
  4987. }
  4988. function loadWhLayoutAll() {
  4989. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4990. args: []
  4991. }).catch(function (e) {
  4992. var _a, _b;
  4993. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4994. showErrorDialog('发生错误:' + msg);
  4995. console.error(msg, e);
  4996. });
  4997. }
  4998. function loadWhLayout(param) {
  4999. return request.post(getLayoutUrl() + "@loadWhLayout", {
  5000. args: [
  5001. param,
  5002. ]
  5003. }).catch(function (e) {
  5004. var _a, _b;
  5005. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  5006. showErrorDialog('发生错误:' + msg);
  5007. console.error(msg, e);
  5008. });
  5009. }
  5010. var baseUrl = "/api/com/yvan/studio/FileManager";
  5011. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  5012. function getBaseUrl() {
  5013. // return getCurrentProject().url + baseUrl
  5014. return baseUrl;
  5015. }
  5016. function getLayoutUrl() {
  5017. // return getCurrentProject().url + baseUrl
  5018. return layoutUrl;
  5019. }
  5020. var Request = /** @class */ (function () {
  5021. function Request(axiosInstance) {
  5022. this.axiosInstance = axiosInstance;
  5023. }
  5024. // 全局响应数据转换处理
  5025. Request.transformResponse = function (response) {
  5026. var _a;
  5027. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5028. };
  5029. Request.prototype.get = function (url, config) {
  5030. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5031. };
  5032. Request.prototype.delete = function (url, config) {
  5033. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5034. };
  5035. Request.prototype.head = function (url, config) {
  5036. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5037. };
  5038. Request.prototype.options = function (url, config) {
  5039. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5040. };
  5041. Request.prototype.post = function (url, data, config) {
  5042. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5043. };
  5044. Request.prototype.put = function (url, data, config) {
  5045. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5046. };
  5047. Request.prototype.patch = function (url, data, config) {
  5048. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5049. };
  5050. Request.prototype.request = function (config) {
  5051. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5052. };
  5053. return Request;
  5054. }());
  5055. /** 创建一个axios实例对象 */
  5056. function axiosCreate(config) {
  5057. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5058. }
  5059. var axiosInstance;
  5060. function init() {
  5061. axiosInstance = axiosCreate({
  5062. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5063. });
  5064. request = new Request(axiosInstance);
  5065. }
  5066. var request;
  5067. //# sourceMappingURL=Api.js.map
  5068. /**
  5069. * 对比两个列 是否存在不一致
  5070. */
  5071. function compareColumn(t1, c1, t2, c2) {
  5072. if (typeof c2 === 'undefined') {
  5073. return 'column_name';
  5074. }
  5075. if (c1.column_name !== c2.column_name) {
  5076. return 'column_name';
  5077. }
  5078. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5079. return 'default_value';
  5080. }
  5081. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5082. return 'column_comment';
  5083. }
  5084. if (c1.is_primary_key !== c2.is_primary_key) {
  5085. return 'is_primary_key';
  5086. }
  5087. if (c1.not_null !== c2.not_null) {
  5088. return 'not_null';
  5089. }
  5090. var symbol1 = getDataTypeSymbol(t1, c1);
  5091. var symbol2 = getDataTypeSymbol(t2, c2);
  5092. if (symbol1 !== symbol2) {
  5093. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5094. return 'data_type';
  5095. }
  5096. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5097. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5098. // 只关注长度
  5099. if (c1.column_size != c2.column_size) {
  5100. return 'column_size';
  5101. }
  5102. }
  5103. else {
  5104. // 其他情况,长度和精度都要关注
  5105. if (c1.column_size != c2.column_size) {
  5106. return 'column_size';
  5107. }
  5108. if (c1.decimal_digits !== c2.decimal_digits) {
  5109. return 'decimal_digits';
  5110. }
  5111. }
  5112. }
  5113. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5114. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5115. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5116. if (symbol1 !== symbol2) {
  5117. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5118. return 'data_type';
  5119. }
  5120. if (is_fix_size) {
  5121. // 字段域吧大小限制住了
  5122. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5123. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5124. // 只关注长度
  5125. if (column.column_size != domain.column_size) {
  5126. return 'column_size';
  5127. }
  5128. }
  5129. else {
  5130. // 其他情况,长度和精度都要关注
  5131. if (column.column_size != domain.column_size) {
  5132. return 'column_size';
  5133. }
  5134. if (column.decimal_digits !== domain.decimal_digits) {
  5135. return 'decimal_digits';
  5136. }
  5137. }
  5138. }
  5139. }
  5140. function checkColumn(table, col) {
  5141. if (isEmpty(col.column_name)) {
  5142. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5143. }
  5144. if (isKeyword(col.column_name)) {
  5145. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5146. }
  5147. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5148. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5149. }
  5150. return undefined;
  5151. }
  5152. function applyDomain(dbType, domain) {
  5153. var editRow = {
  5154. data_type: domain[dbType + '_datatype'],
  5155. };
  5156. domain = _$2.cloneDeep(domain);
  5157. if (!editRow.data_type) {
  5158. throw Error('字段域没有定义数据类型!');
  5159. }
  5160. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5161. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5162. if (match) {
  5163. // 类型里面包含括号
  5164. var sz = parseInt(match[2]);
  5165. if (isNaN(sz)) {
  5166. throw Error('字段域的定义错误:' + editRow.data_type);
  5167. }
  5168. domain.is_fix_size = true;
  5169. editRow.data_type = match[1];
  5170. domain.column_size = sz;
  5171. domain.decimal_digits = 0;
  5172. }
  5173. else {
  5174. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5175. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5176. if (match2) {
  5177. // 类型里面包含括号
  5178. var sz = parseInt(match2[2]);
  5179. if (isNaN(sz)) {
  5180. throw Error('字段域的定义错误:' + editRow.data_type);
  5181. }
  5182. var dg = parseInt(match2[3]);
  5183. if (isNaN(dg)) {
  5184. throw Error('字段域的定义错误:' + editRow.data_type);
  5185. }
  5186. domain.is_fix_size = true;
  5187. editRow.data_type = match[1];
  5188. domain.column_size = sz;
  5189. domain.decimal_digits = dg;
  5190. }
  5191. }
  5192. if (domain.domain_column_ui) {
  5193. _$2.extend(editRow, {
  5194. column_ui: domain.domain_column_ui,
  5195. });
  5196. }
  5197. if (domain.domain_column_dict) {
  5198. _$2.extend(editRow, {
  5199. column_dict: domain.domain_column_dict,
  5200. });
  5201. }
  5202. if (domain.is_fix_size) {
  5203. _$2.extend(editRow, {
  5204. column_size: domain.column_size,
  5205. decimal_digits: domain.decimal_digits
  5206. });
  5207. }
  5208. if (domain.is_fix_default_value) {
  5209. _$2.extend(editRow, {
  5210. default_value: domain.default_value,
  5211. });
  5212. }
  5213. return editRow;
  5214. }
  5215. /**
  5216. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5217. */
  5218. function getDataTypeSymbol(table, col) {
  5219. if (table.db_type === 'oracle') {
  5220. switch (col.data_type) {
  5221. case 'number':
  5222. if (col.column_size <= 10 && !col.decimal_digits) {
  5223. return 'integer';
  5224. }
  5225. else if (col.column_size <= 19 && !col.decimal_digits) {
  5226. return 'long';
  5227. }
  5228. return 'bigdecimal';
  5229. case 'char':
  5230. if (col.column_size > 3000) {
  5231. return 'clob';
  5232. }
  5233. return 'char';
  5234. case 'integer':
  5235. return 'integer';
  5236. case 'varchar':
  5237. case 'varchar2':
  5238. if (col.column_size > 3000) {
  5239. return 'clob';
  5240. }
  5241. return 'varchar';
  5242. case 'clob':
  5243. return 'clob';
  5244. case 'blob':
  5245. return 'blob';
  5246. case 'date':
  5247. case 'timestamp':
  5248. case 'timestamp(6)':
  5249. case 'timestamp with local time zone':
  5250. case 'timestamp(6) with local time zone':
  5251. case 'timestamp(6) with time zone':
  5252. return 'timestamp';
  5253. }
  5254. return "undefined";
  5255. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5256. }
  5257. if (table.db_type === 'pgsql') {
  5258. switch (col.data_type) {
  5259. case 'int4':
  5260. return 'integer';
  5261. case 'int8':
  5262. return 'long';
  5263. case 'char':
  5264. return 'char';
  5265. case 'varchar':
  5266. case 'varchar2':
  5267. if (col.column_size > 3000) {
  5268. return 'clob';
  5269. }
  5270. return 'varchar';
  5271. case 'numeric':
  5272. if (col.column_size <= 10 && !col.decimal_digits) {
  5273. return 'integer';
  5274. }
  5275. else if (col.column_size <= 19 && !col.decimal_digits) {
  5276. return 'long';
  5277. }
  5278. return 'bigdecimal';
  5279. case 'timestamp':
  5280. case 'timestamptz':
  5281. return 'timestamp';
  5282. case 'bytea':
  5283. return 'blob';
  5284. }
  5285. return "undefined";
  5286. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5287. }
  5288. throw Error('未知数据库类型:' + table.db_type);
  5289. }
  5290. /**
  5291. * 判断对象名称是不是数据库关键字(保留字)
  5292. */
  5293. function isKeyword(word) {
  5294. if (!word || typeof word !== 'string') {
  5295. return false;
  5296. }
  5297. var kk = ['access',
  5298. 'add',
  5299. 'all',
  5300. 'alter',
  5301. 'and',
  5302. 'any',
  5303. 'as',
  5304. 'asc',
  5305. 'audit',
  5306. 'between',
  5307. 'by',
  5308. 'char',
  5309. 'check',
  5310. 'cluster',
  5311. 'column',
  5312. 'comment',
  5313. 'compress',
  5314. 'connect',
  5315. 'create',
  5316. 'current',
  5317. 'date',
  5318. 'decimal',
  5319. 'default',
  5320. 'delete',
  5321. 'desc',
  5322. 'distinct',
  5323. 'drop',
  5324. 'else',
  5325. 'exclusive',
  5326. 'exists',
  5327. 'file',
  5328. 'float',
  5329. 'for',
  5330. 'from',
  5331. 'grant',
  5332. 'group',
  5333. 'having',
  5334. 'identified',
  5335. 'immediate',
  5336. 'in',
  5337. 'increment',
  5338. 'index',
  5339. 'initial',
  5340. 'insert',
  5341. 'integer',
  5342. 'intersect',
  5343. 'into',
  5344. 'is',
  5345. 'level',
  5346. 'like',
  5347. 'lock',
  5348. 'long',
  5349. 'maxextents',
  5350. 'minus',
  5351. 'mlslabel',
  5352. 'mode',
  5353. 'modify',
  5354. 'noaudit',
  5355. 'nocompress',
  5356. 'not',
  5357. 'nowait',
  5358. 'null',
  5359. 'number',
  5360. 'of',
  5361. 'offline',
  5362. 'on',
  5363. 'online',
  5364. 'option',
  5365. 'or',
  5366. 'order',
  5367. 'p',
  5368. 'ctfree',
  5369. 'prior',
  5370. 'privileges',
  5371. 'public',
  5372. 'raw',
  5373. 'rename',
  5374. 'resource',
  5375. 'revoke',
  5376. 'row',
  5377. 'rowid',
  5378. 'rownum',
  5379. 'rows',
  5380. 'select',
  5381. 'session',
  5382. 'set',
  5383. 'share',
  5384. 'size',
  5385. 'smallint',
  5386. 'start',
  5387. 'successful',
  5388. 'synonym',
  5389. 'sysdate',
  5390. 'table',
  5391. 'then',
  5392. 'to',
  5393. 'trigger',
  5394. 'uid',
  5395. 'union',
  5396. 'unique',
  5397. 'update',
  5398. 'user',
  5399. 'validate',
  5400. 'values',
  5401. 'varchar',
  5402. 'varchar2',
  5403. 'view',
  5404. 'whenever',
  5405. 'where',
  5406. 'with'];
  5407. return _$2.includes(kk, word.toLowerCase());
  5408. }
  5409. //# sourceMappingURL=DbUtils.js.map
  5410. var DbSync = /** @class */ (function (_super) {
  5411. __extends(DbSync, _super);
  5412. function DbSync() {
  5413. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5414. }
  5415. DbSync.prototype.onLoad = function () {
  5416. };
  5417. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5418. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5419. getDataBaseNameApi().then(function (res) {
  5420. successCallback(res.data.map(function (name) {
  5421. return {
  5422. id: name, text: name
  5423. };
  5424. }));
  5425. });
  5426. };
  5427. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5428. showInfoDialog(record.get('remark'));
  5429. };
  5430. DbSync.prototype.diff = function () {
  5431. var _this = this;
  5432. var promise1 = getMateData({
  5433. datasource: this.viewModel.get('dataSource1')
  5434. });
  5435. var promise2 = getMateData({
  5436. datasource: this.viewModel.get('dataSource2')
  5437. });
  5438. this.viewModel.set('schema1', '');
  5439. this.viewModel.set('schema2', '');
  5440. this.refs.grid1.setLoading(true);
  5441. Promise.all([promise1, promise2]).then(function (_a) {
  5442. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5443. var rows = [];
  5444. if (_$2.size(res1) > 0) {
  5445. // res1 起码有一个 schema
  5446. _this.viewModel.set('schema1', res1[0].schema_name);
  5447. _this.viewModel.set('schema2', res2[0].schema_name);
  5448. if (!_this.viewModel.get('schema1')) {
  5449. msg$1('datasource1 最起码需要一张表');
  5450. return;
  5451. }
  5452. if (!_this.viewModel.get('schema2')) {
  5453. msg$1('datasource2 最起码需要一张表');
  5454. return;
  5455. }
  5456. _$2.forEach(res1[0].table_list, function (table1) {
  5457. var _a;
  5458. 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; });
  5459. if (table1.schema_name) {
  5460. _this.viewModel.set('schema1', table1.schema_name);
  5461. }
  5462. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5463. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5464. }
  5465. var row = {
  5466. table_name1: table1.table_name,
  5467. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5468. table_info: table1
  5469. };
  5470. if (!table2) {
  5471. row.diff = '不一致';
  5472. row.remark = '目标表缺失';
  5473. }
  5474. else if (table1.column_list.length !== table2.column_list.length) {
  5475. row.diff = '不一致';
  5476. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5477. }
  5478. else {
  5479. row.diff = '一致';
  5480. var remark_1 = [];
  5481. _$2.forEach(table1.column_list, function (col1) {
  5482. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5483. if (!col2) {
  5484. row.diff = '不一致';
  5485. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5486. }
  5487. else {
  5488. var colDiff = compareColumn(table1, col1, table2, col2);
  5489. if (colDiff) {
  5490. row.diff = '不一致';
  5491. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5492. }
  5493. }
  5494. });
  5495. row.remark = remark_1.join('\n');
  5496. }
  5497. rows.push(row);
  5498. });
  5499. }
  5500. _this.refs.grid1.setData(rows);
  5501. _this.viewModel.set('hasDiff', true);
  5502. }).finally(function () {
  5503. _this.refs.grid1.setLoading(false);
  5504. });
  5505. };
  5506. DbSync.prototype.structCopyTo = function () {
  5507. var _this = this;
  5508. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5509. msg$1('选择数据源!');
  5510. return;
  5511. }
  5512. var recordList = this.refs.grid1.getSelection();
  5513. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5514. if (_$2.size(tableNameList) <= 0) {
  5515. msg$1('请选择要同步的表');
  5516. return;
  5517. }
  5518. var error = undefined;
  5519. _$2.forEach(tableNameList, function (tableInfo) {
  5520. _$2.forEach(tableInfo.column_list, function (col) {
  5521. error = checkColumn(tableInfo, col);
  5522. return false;
  5523. });
  5524. if (error) {
  5525. return false;
  5526. }
  5527. });
  5528. if (error) {
  5529. msg$1(error);
  5530. return;
  5531. }
  5532. var schema1 = this.viewModel.get('schema1');
  5533. var schema2 = this.viewModel.get('schema2');
  5534. if (!schema1 || !schema2) {
  5535. msg$1('无法识别 schema 名称');
  5536. return;
  5537. }
  5538. this.refs.grid1.setLoading(true);
  5539. getDiffDDLApi({
  5540. datasource1: this.viewModel.get('dataSource1'),
  5541. datasource2: this.viewModel.get('dataSource2'),
  5542. schema1: this.viewModel.get('schema1'),
  5543. schema2: this.viewModel.get('schema2'),
  5544. tables: tableNameList,
  5545. }).then(function (res) {
  5546. if (res.success) {
  5547. _this.refs.ddleditor.setCode(res.data);
  5548. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5549. }
  5550. }).finally(function () {
  5551. _this.refs.grid1.setLoading(false);
  5552. });
  5553. };
  5554. DbSync.prototype.indexCopyTo = function () {
  5555. var _this = this;
  5556. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5557. msg$1('选择数据源!');
  5558. return;
  5559. }
  5560. var recordList = this.refs.grid1.getSelection();
  5561. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5562. if (_$2.size(tableNameList) <= 0) {
  5563. msg$1('请选择要同步的表');
  5564. return;
  5565. }
  5566. var schema1 = this.viewModel.get('schema1');
  5567. var schema2 = this.viewModel.get('schema2');
  5568. if (!schema1 || !schema2) {
  5569. msg$1('无法识别 schema 名称');
  5570. return;
  5571. }
  5572. this.refs.grid1.setLoading(true);
  5573. getModifyIdxDDL({
  5574. datasource1: this.viewModel.get('dataSource1'),
  5575. datasource2: this.viewModel.get('dataSource2'),
  5576. schema1: this.viewModel.get('schema1'),
  5577. schema2: this.viewModel.get('schema2'),
  5578. tables: tableNameList,
  5579. }).then(function (res) {
  5580. if (res.success) {
  5581. _this.refs.ddleditor_idx.setCode(res.data);
  5582. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5583. }
  5584. }).finally(function () {
  5585. _this.refs.grid1.setLoading(false);
  5586. });
  5587. };
  5588. DbSync.prototype.procedureCopyTo = function () {
  5589. var _this = this;
  5590. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5591. msg$1('选择数据源!');
  5592. return;
  5593. }
  5594. var schema1 = this.viewModel.get('schema1');
  5595. var schema2 = this.viewModel.get('schema2');
  5596. if (!schema1 || !schema2) {
  5597. msg$1('无法识别 schema 名称');
  5598. return;
  5599. }
  5600. this.refs.grid1.setLoading(true);
  5601. getModifyProcedureSQL({
  5602. datasource1: this.viewModel.get('dataSource1'),
  5603. datasource2: this.viewModel.get('dataSource2'),
  5604. schema1: this.viewModel.get('schema1'),
  5605. schema2: this.viewModel.get('schema2'),
  5606. }).then(function (res) {
  5607. if (res.success) {
  5608. _this.refs.ddleditor_procedure.setCode(res.data);
  5609. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5610. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5611. }
  5612. }).finally(function () {
  5613. _this.refs.grid1.setLoading(false);
  5614. });
  5615. };
  5616. DbSync.prototype.dataSync_start = function () {
  5617. var _this = this;
  5618. this.viewModel.set('dataSync_isStart', true);
  5619. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5620. this.refs.datacopy.setLoading(true);
  5621. dataSyncApi(dataSync)
  5622. .then(function (res) {
  5623. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5624. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5625. })
  5626. .finally(function () {
  5627. _this.refs.datacopy.setLoading(false);
  5628. });
  5629. };
  5630. DbSync.prototype.dataSync_process = function () {
  5631. var _this = this;
  5632. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5633. dataSyncInfoApi({ jobId: jobId })
  5634. .then(function (res) {
  5635. if (_$2.isArray(res.tableSyncInfos)) {
  5636. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5637. _this.refs.datacopy.setData(res.tableSyncInfos);
  5638. try {
  5639. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5640. }
  5641. catch (e) {
  5642. }
  5643. }
  5644. if (res.endTime) {
  5645. // 已经结束
  5646. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5647. if (res.success) {
  5648. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5649. }
  5650. else {
  5651. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5652. }
  5653. _this.dataSync_stop();
  5654. }
  5655. })
  5656. .catch(function (e) {
  5657. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5658. console.error(e);
  5659. // this.dataSync_stop()
  5660. })
  5661. .finally(function () {
  5662. _this.refs.datacopy.setLoading(false);
  5663. });
  5664. };
  5665. DbSync.prototype.dataSync_stop = function () {
  5666. this.viewModel.set('dataSync_isStart', false);
  5667. clearInterval(this.dataSyncInterval);
  5668. delete this.dataSyncInterval;
  5669. };
  5670. DbSync.prototype.dataCopyTo = function () {
  5671. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5672. msg$1('选择数据源!');
  5673. return;
  5674. }
  5675. var recordList = this.refs.grid1.getSelection();
  5676. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5677. if (_$2.size(tableNameList) <= 0) {
  5678. msg$1('请选择要同步的表');
  5679. return;
  5680. }
  5681. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5682. this.viewModel.set('dataSync.tables', tableNameList);
  5683. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5684. };
  5685. DbSync.prototype.next = function () {
  5686. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5687. };
  5688. DbSync.prototype.back = function () {
  5689. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5690. };
  5691. DbSync.prototype.dbToMeta = function () {
  5692. var _this = this;
  5693. var dataSource1 = this.viewModel.get('dataSource1');
  5694. var dataSource2 = this.viewModel.get('dataSource2');
  5695. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5696. var promise1 = dbToMeta({ datasource: dataSource1 });
  5697. var promise2 = dbToMeta({ datasource: dataSource2 });
  5698. _this.refs.grid1.setLoading(true);
  5699. Promise.all([promise1, promise2]).then(function (_a) {
  5700. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5701. _this.diff();
  5702. }).catch(function (res) {
  5703. _this.refs.grid1.setLoading(false);
  5704. showErrorDialog$1(res);
  5705. });
  5706. });
  5707. };
  5708. DbSync.prototype.executeDDL = function () {
  5709. var _this = this;
  5710. var code = this.refs.ddleditor.getValue();
  5711. var dataSource2 = this.viewModel.get('dataSource2');
  5712. var target_schema_name = this.viewModel.get('schema2');
  5713. var recordList = this.refs.grid1.getSelection();
  5714. var table_infos = _$2.map(recordList, function (r) {
  5715. return r.get('table_info');
  5716. });
  5717. this.setLoading(true);
  5718. pushToDbCommitApi({
  5719. datasource: dataSource2,
  5720. ddl: code,
  5721. table_infos: table_infos,
  5722. target_schema_name: target_schema_name,
  5723. }).then(function (res) {
  5724. if (res === null || res === void 0 ? void 0 : res.success) {
  5725. msg$1('执行成功');
  5726. _this.back();
  5727. _this.diff();
  5728. return;
  5729. }
  5730. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5731. }).finally(function () {
  5732. _this.setLoading(false);
  5733. });
  5734. };
  5735. DbSync.prototype.executeDDLIdx = function () {
  5736. var _this = this;
  5737. var code = this.refs.ddleditor_idx.getValue();
  5738. var dataSource2 = this.viewModel.get('dataSource2');
  5739. this.setLoading(true);
  5740. executeDDL({
  5741. datasource: dataSource2,
  5742. ddl: code,
  5743. }).then(function (res) {
  5744. if (res === null || res === void 0 ? void 0 : res.success) {
  5745. msg$1('执行成功');
  5746. _this.back();
  5747. return;
  5748. }
  5749. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5750. }).finally(function () {
  5751. _this.setLoading(false);
  5752. });
  5753. };
  5754. DbSync.prototype.executeProcedureSQL = function () {
  5755. var _this = this;
  5756. this.setLoading(true);
  5757. executeModifyProcedureSQL({
  5758. datasource1: this.viewModel.get('dataSource1'),
  5759. datasource2: this.viewModel.get('dataSource2'),
  5760. schema1: this.viewModel.get('schema1'),
  5761. schema2: this.viewModel.get('schema2'),
  5762. }).then(function (res) {
  5763. if (res === null || res === void 0 ? void 0 : res.success) {
  5764. msg$1('执行成功');
  5765. _this.back();
  5766. return;
  5767. }
  5768. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5769. }).finally(function () {
  5770. _this.setLoading(false);
  5771. });
  5772. };
  5773. return DbSync;
  5774. }(Scope));
  5775. //# sourceMappingURL=DbSync.js.map
  5776. var model$2 = {
  5777. data: {}
  5778. };
  5779. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5780. var vjson$2 = {
  5781. title: '示例代码',
  5782. layout: 'fit',
  5783. items: [
  5784. {
  5785. layout: 'border',
  5786. items: [
  5787. {
  5788. region: 'north',
  5789. split: true,
  5790. height: 200,
  5791. title: '表格数据',
  5792. reference: 'dataeditor',
  5793. xtype: 'jsoneditor',
  5794. listeners: {
  5795. change: 'scope.dataChanged'
  5796. },
  5797. },
  5798. {
  5799. region: 'west',
  5800. split: true,
  5801. width: 230,
  5802. title: '模板',
  5803. reference: 'tree1',
  5804. xtype: 'treepanel',
  5805. rootVisible: false,
  5806. useArrows: true,
  5807. colspan: 2,
  5808. lines: true,
  5809. multiSelect: false,
  5810. listeners: {
  5811. itemclick: 'scope.templateChange',
  5812. },
  5813. },
  5814. {
  5815. region: 'center',
  5816. title: '参考代码',
  5817. reference: 'preview',
  5818. xtype: 'jsoneditor',
  5819. },
  5820. ]
  5821. }
  5822. ]
  5823. };
  5824. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5825. var rootNode = {
  5826. id: 'ROOT',
  5827. type: "ROOT",
  5828. path: "",
  5829. expanded: true,
  5830. leaf: false,
  5831. children: [
  5832. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5833. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5834. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5835. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5836. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5837. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5838. ],
  5839. };
  5840. var TemplateDev = /** @class */ (function (_super) {
  5841. __extends(TemplateDev, _super);
  5842. function TemplateDev() {
  5843. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5844. _this.dataChanged = _$2.debounce(function () {
  5845. var me = _this;
  5846. if (me.refs.tree1.selection) {
  5847. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5848. }
  5849. }, 50);
  5850. return _this;
  5851. }
  5852. TemplateDev.prototype.onDestroy = function () {
  5853. setDbCode(undefined);
  5854. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5855. };
  5856. TemplateDev.prototype.onLoad = function () {
  5857. setDbCode(this);
  5858. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5859. this.refs.tree1.setRootNode(rootNode);
  5860. getColumnDomainApi({}).then(function (_a) {
  5861. var data = _a.data;
  5862. return window['dev_column_domain'] = data;
  5863. });
  5864. };
  5865. TemplateDev.prototype.dbTreeNodeChange = function () {
  5866. var me = handles$1.dbcode;
  5867. var tables = [];
  5868. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5869. var raw = _$2.cloneDeep(r.get('raw'));
  5870. raw.id = r.get('id');
  5871. if (r.get('type') === 'table') {
  5872. tables.push(raw);
  5873. return;
  5874. }
  5875. if (r.get('type') === 'column') {
  5876. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5877. if (!tableInfo) {
  5878. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5879. tables.push(tableInfo);
  5880. }
  5881. if (!tableInfo.column_list) {
  5882. tableInfo.column_list = [raw];
  5883. }
  5884. else {
  5885. tableInfo.column_list.push(raw);
  5886. }
  5887. }
  5888. });
  5889. // 对于没有选择列的表格,默认加上所有列
  5890. _$2.forEach(tables, function (tableInfo) {
  5891. if (typeof tableInfo.column_list === 'undefined') {
  5892. tableInfo.column_list = [];
  5893. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5894. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5895. });
  5896. }
  5897. });
  5898. var code = JSON.stringify(tables, null, ' ');
  5899. me.refs.dataeditor.setCode(code);
  5900. };
  5901. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5902. var url = record.data.url;
  5903. var rd = _$2.uniqueId('db_code_request');
  5904. if (url) {
  5905. var data = void 0;
  5906. try {
  5907. data = JSON.parse(this.refs.dataeditor.getCode());
  5908. }
  5909. catch (e) {
  5910. return;
  5911. }
  5912. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5913. // if (typeof node.default === "function") {
  5914. // const v = toString(node.default(data))
  5915. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5916. // this.refs.preview.setLanguage("plaintext")
  5917. // this.refs.preview.setCode(v)
  5918. // }
  5919. // })
  5920. showErrorDialog$1('没做这里');
  5921. }
  5922. };
  5923. return TemplateDev;
  5924. }(Scope));
  5925. //# sourceMappingURL=DbCodeTemplate.js.map
  5926. var model$3 = {
  5927. data: {
  5928. hasChanged: false,
  5929. }
  5930. };
  5931. //# sourceMappingURL=DbDomain.model.js.map
  5932. var vjson$3 = {
  5933. bind: {
  5934. title: '字段域{grid1.ischanged?" *":""}',
  5935. },
  5936. layout: 'fit',
  5937. items: [
  5938. {
  5939. layout: 'border',
  5940. items: [
  5941. {
  5942. region: 'center',
  5943. xtype: 'yvgrid',
  5944. selModel: {
  5945. type: 'spreadsheet',
  5946. columnSelect: true,
  5947. pruneRemoved: false,
  5948. extensible: 'y'
  5949. },
  5950. plugins: {
  5951. clipboard: true,
  5952. selectionreplicator: true
  5953. },
  5954. reference: 'grid1',
  5955. pagination: false,
  5956. tbar: {
  5957. xtype: 'toolbar',
  5958. items: [
  5959. {
  5960. xtype: 'button',
  5961. text: '添加',
  5962. iconCls: 'x-fa fa-plus-circle',
  5963. listeners: {
  5964. click: 'scope.addField'
  5965. }
  5966. },
  5967. {
  5968. xtype: 'button',
  5969. text: '删除',
  5970. iconCls: 'x-fa fa-minus-circle',
  5971. listeners: {
  5972. click: 'scope.removeField'
  5973. }
  5974. },
  5975. {
  5976. xtype: 'button',
  5977. text: '保存',
  5978. iconCls: 'x-fa fa-save',
  5979. bind: {
  5980. disabled: '{!grid1.ischanged}'
  5981. },
  5982. listeners: {
  5983. click: 'scope.save'
  5984. }
  5985. },
  5986. ]
  5987. },
  5988. listeners: {
  5989. editfinish: 'scope.gridEditFinish',
  5990. },
  5991. columns: [
  5992. {
  5993. text: '字段域名称', dataIndex: 'domain_name',
  5994. sortable: false,
  5995. menuDisabled: true,
  5996. locked: true,
  5997. editor: {
  5998. selectOnFocus: true
  5999. }
  6000. },
  6001. {
  6002. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  6003. sortable: false, menuDisabled: true,
  6004. editor: {
  6005. selectOnFocus: true
  6006. }
  6007. },
  6008. {
  6009. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  6010. sortable: false, menuDisabled: true,
  6011. editor: {
  6012. selectOnFocus: true
  6013. }
  6014. },
  6015. {
  6016. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  6017. sortable: false, menuDisabled: true,
  6018. editor: {
  6019. selectOnFocus: true
  6020. }
  6021. },
  6022. {
  6023. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  6024. sortable: false, menuDisabled: true,
  6025. editor: {
  6026. selectOnFocus: true
  6027. }
  6028. },
  6029. {
  6030. text: 'Java类型', dataIndex: 'java_datatype',
  6031. sortable: false, menuDisabled: true,
  6032. editor: {
  6033. selectOnFocus: true
  6034. }
  6035. },
  6036. {
  6037. text: '固定长度', dataIndex: 'is_fix_size',
  6038. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6039. width: 88, resizable: false,
  6040. },
  6041. {
  6042. text: '长度', dataIndex: 'column_size',
  6043. sortable: false, menuDisabled: true, dataType: 'int',
  6044. xtype: 'numbercolumn', format: '0',
  6045. editor: { selectOnFocus: true }
  6046. },
  6047. {
  6048. text: '小数位', dataIndex: 'decimal_digits',
  6049. sortable: false, menuDisabled: true, dataType: 'int',
  6050. xtype: 'numbercolumn', format: '0',
  6051. editor: { selectOnFocus: true }
  6052. },
  6053. {
  6054. text: '字典', dataIndex: 'domain_column_dict',
  6055. sortable: false, menuDisabled: true,
  6056. // fix: ['system.getDict("DICT")'],
  6057. width: 200,
  6058. editor: {
  6059. xtype: 'combo',
  6060. listConfig: {
  6061. minWidth: 350
  6062. },
  6063. }
  6064. },
  6065. {
  6066. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6067. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6068. width: 88, resizable: false,
  6069. },
  6070. {
  6071. text: '默认值', dataIndex: 'default_value',
  6072. sortable: false, menuDisabled: true,
  6073. editor: {
  6074. selectOnFocus: true
  6075. }
  6076. },
  6077. {
  6078. text: 'UI建议', dataIndex: 'domain_column_ui',
  6079. sortable: false, menuDisabled: true,
  6080. // fix: ['system.getDict("column_ui")'],
  6081. editor: {
  6082. xtype: 'combo',
  6083. allowBlank: true,
  6084. listConfig: {
  6085. minWidth: 200
  6086. },
  6087. }
  6088. },
  6089. {
  6090. text: '详细描述', dataIndex: 'domain_note',
  6091. sortable: false, menuDisabled: true,
  6092. editor: {}
  6093. },
  6094. {
  6095. text: '责任人', dataIndex: 'domain_person',
  6096. sortable: false, menuDisabled: true,
  6097. editor: {
  6098. selectOnFocus: true
  6099. }
  6100. },
  6101. {
  6102. text: '版本', dataIndex: 'domain_version',
  6103. sortable: false, menuDisabled: true,
  6104. editor: {
  6105. selectOnFocus: true
  6106. }
  6107. },
  6108. ]
  6109. }
  6110. ]
  6111. },
  6112. ]
  6113. };
  6114. //# sourceMappingURL=DbDomain.view.js.map
  6115. var CacheStore = /** @class */ (function () {
  6116. function CacheStore() {
  6117. // 订阅
  6118. this.subscribeList = [];
  6119. this.apiResponse = undefined;
  6120. }
  6121. /**
  6122. * 订阅结果集
  6123. */
  6124. CacheStore.prototype.registe = function (fn) {
  6125. this.subscribeList.push(fn);
  6126. };
  6127. /**
  6128. * 取消订阅
  6129. */
  6130. CacheStore.prototype.unregiste = function (fn) {
  6131. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6132. };
  6133. /**
  6134. * 尝试取数据(先读缓存)
  6135. */
  6136. CacheStore.prototype.reloadIfNeed = function (param) {
  6137. var _this = this;
  6138. if (typeof this.apiResponse === 'undefined') {
  6139. // 从未有获取过值
  6140. var cacheKey = this.getCacheKey(param);
  6141. if (cacheKey) {
  6142. // 可以从缓存读
  6143. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6144. native.loadFile(fileName, function (res) {
  6145. if (res) {
  6146. // 缓存有值
  6147. _this.apiResponse = res;
  6148. _this.notifyRefresh();
  6149. }
  6150. else {
  6151. // 缓存没值
  6152. _this.reloadForce(param).then(function (res) {
  6153. });
  6154. }
  6155. });
  6156. }
  6157. else {
  6158. // 不能从缓存读
  6159. this.reloadForce(param).then(function (res) {
  6160. });
  6161. }
  6162. return true;
  6163. }
  6164. return false;
  6165. };
  6166. /**
  6167. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6168. */
  6169. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6170. var _this = this;
  6171. return new Promise(function (resolve, reject) {
  6172. if (typeof _this.apiResponse === 'undefined') {
  6173. // 从未有获取过值
  6174. var cacheKey = _this.getCacheKey(param);
  6175. if (cacheKey) {
  6176. // 可以从缓存读
  6177. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6178. native.loadFile(fileName, function (res) {
  6179. if (res) {
  6180. // 缓存有值
  6181. _this.apiResponse = res;
  6182. _this.notifyRefresh();
  6183. resolve(_this.apiResponse);
  6184. }
  6185. else {
  6186. // 缓存没值
  6187. _this.reloadForce(param).then(function (res) {
  6188. resolve(_this.apiResponse);
  6189. });
  6190. }
  6191. });
  6192. }
  6193. else {
  6194. // 不能从缓存读
  6195. _this.reloadForce(param).then(function (res) {
  6196. resolve(_this.apiResponse);
  6197. });
  6198. }
  6199. }
  6200. else {
  6201. // 有值,获取过
  6202. resolve(_this.apiResponse);
  6203. }
  6204. });
  6205. };
  6206. /**
  6207. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6208. */
  6209. CacheStore.prototype.reloadForce = function (param) {
  6210. var _this = this;
  6211. _$2.forEach(this.subscribeList, function (fn) {
  6212. fn(true);
  6213. });
  6214. return this.invokeApi(param)
  6215. .then(function (res) {
  6216. _this.apiResponse = res;
  6217. var cacheKey = _this.getCacheKey(param);
  6218. if (cacheKey) {
  6219. // 可以保存到缓存
  6220. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6221. native.saveFile(fileName, res);
  6222. }
  6223. // 通知订阅者刷新
  6224. _this.notifyRefresh();
  6225. })
  6226. .finally(function () {
  6227. _$2.forEach(_this.subscribeList, function (fn) {
  6228. fn(false);
  6229. });
  6230. });
  6231. };
  6232. /**
  6233. * 通知组件,isLoading状态被更改
  6234. */
  6235. CacheStore.prototype.notifyLoading = function (isLoading) {
  6236. var _this = this;
  6237. _$2.forEach(this.subscribeList, function (fn) {
  6238. fn(_this.apiResponse);
  6239. });
  6240. };
  6241. /**
  6242. * 通知数据更改,需要刷新
  6243. */
  6244. CacheStore.prototype.notifyRefresh = function () {
  6245. var _this = this;
  6246. _$2.forEach(this.subscribeList, function (fn) {
  6247. fn(_this.apiResponse);
  6248. });
  6249. };
  6250. return CacheStore;
  6251. }());
  6252. //# sourceMappingURL=CacheStore.js.map
  6253. // 字段域数据
  6254. var columnDomain = undefined;
  6255. var DomainStore = /** @class */ (function (_super) {
  6256. __extends(DomainStore, _super);
  6257. function DomainStore() {
  6258. return _super !== null && _super.apply(this, arguments) || this;
  6259. }
  6260. DomainStore.prototype.getCacheKey = function (param) {
  6261. return "domain_data.json";
  6262. };
  6263. DomainStore.prototype.invokeApi = function (param) {
  6264. return getColumnDomainApi();
  6265. };
  6266. /**
  6267. * 设置全局可访问的 字段域数据
  6268. */
  6269. DomainStore.prototype.getColumnDomainComboData = function () {
  6270. var _this = this;
  6271. return new Promise(function (resolve) {
  6272. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6273. resolve(_this.apiResponse.data.map(function (v) {
  6274. return { id: v.domain_id, text: v.domain_name };
  6275. }));
  6276. });
  6277. });
  6278. };
  6279. /**
  6280. * 设置全局可访问的 字段域数据
  6281. */
  6282. DomainStore.prototype.getColumnDomainById = function (value) {
  6283. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6284. };
  6285. DomainStore.prototype.getAllDomain = function () {
  6286. return new Promise(function (resolve, reject) {
  6287. getColumnDomainApi()
  6288. .then(function (res) {
  6289. if (res.success) {
  6290. if (res.success) {
  6291. var tt = _$2.map(res.data, function (row) {
  6292. return {
  6293. text: row.domain_name,
  6294. id: row.domain_id,
  6295. };
  6296. });
  6297. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  6298. }
  6299. columnDomain = res.data;
  6300. resolve(res.data);
  6301. }
  6302. else {
  6303. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6304. console.error('getColumnDomain', res.msg);
  6305. }
  6306. })
  6307. .catch(function (e) {
  6308. window['showErrorDialog']('getColumnDomain error!');
  6309. console.error('getColumnDomain', e);
  6310. reject(e);
  6311. });
  6312. });
  6313. };
  6314. return DomainStore;
  6315. }(CacheStore));
  6316. var instance = new DomainStore();
  6317. //# sourceMappingURL=DomainStore.js.map
  6318. var DbDomain = /** @class */ (function (_super) {
  6319. __extends(DbDomain, _super);
  6320. function DbDomain() {
  6321. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6322. }
  6323. DbDomain.prototype.onLoad = function () {
  6324. var _this = this;
  6325. instance.getAllDomain().then(function (data) {
  6326. _this.refs.grid1.setData(data);
  6327. });
  6328. };
  6329. DbDomain.prototype.gridEditFinish = function () {
  6330. this.viewModel.set('hasChanged', true);
  6331. };
  6332. DbDomain.prototype.addField = function () {
  6333. this.refs.grid1.appendEditRow({
  6334. domainName: '',
  6335. pgSqlDataType: '',
  6336. mysqlDataType: '',
  6337. oracleDataType: '',
  6338. sqlserverDataType: '',
  6339. javaDataType: '',
  6340. isFixSize: true,
  6341. size: '',
  6342. decimalDigits: '',
  6343. isFixDefaultValue: false,
  6344. defaultValue: null,
  6345. domainColumnDict: '',
  6346. domainColumnUI: '',
  6347. note: '',
  6348. domainPerson: '',
  6349. domainVersion: '',
  6350. }, 0);
  6351. };
  6352. DbDomain.prototype.removeField = function () {
  6353. var _this = this;
  6354. var rows = [];
  6355. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6356. rows.push(r);
  6357. });
  6358. _.forEach(rows, function (r) {
  6359. _this.refs.grid1.getStore().remove(r);
  6360. });
  6361. };
  6362. DbDomain.prototype.save = function () {
  6363. var _this = this;
  6364. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6365. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6366. if (err) {
  6367. // 如果有异常就不保存
  6368. return;
  6369. }
  6370. // 进行业务上的逻辑校验,比如说必填校验等等
  6371. var hasError = false;
  6372. _.forEach(rows, function (row, i) {
  6373. if (isEmpty(row.domain_name)) {
  6374. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6375. hasError = true;
  6376. return false;
  6377. }
  6378. if (isEmpty(row.pgsql_datatype) ||
  6379. isEmpty(row.mysql_datatype) ||
  6380. isEmpty(row.oracle_datatype) ||
  6381. isEmpty(row.sqlserver_datatype)) {
  6382. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6383. hasError = true;
  6384. return false;
  6385. }
  6386. });
  6387. if (hasError) {
  6388. return;
  6389. }
  6390. // 设置当前界面为 "保存中..." 状态
  6391. this.setLoading(true);
  6392. saveColumnDomain({
  6393. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6394. newRows: newRows,
  6395. modifyRows: modifyRows,
  6396. removeRecords: removeRecords,
  6397. }).then(function (res) {
  6398. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6399. system.msg(res.msg);
  6400. instance.reloadForce({}).then(function () {
  6401. instance.getAllDomain().then(function (data) {
  6402. _this.refs.grid1.setData(data);
  6403. });
  6404. }).finally(function () {
  6405. // 无论正常异常,关闭 "保存中..." 状态
  6406. _this.setLoading(false);
  6407. });
  6408. }).catch(function (e) {
  6409. // 无论正常异常,关闭 "保存中..." 状态
  6410. _this.setLoading(false);
  6411. });
  6412. };
  6413. return DbDomain;
  6414. }(Scope));
  6415. //# sourceMappingURL=DbDomain.js.map
  6416. var model$4 = {
  6417. data: {
  6418. report_id: '',
  6419. report_name: '',
  6420. report_enable: false,
  6421. report: {
  6422. dataSource: '',
  6423. grid: {
  6424. pagination: true,
  6425. },
  6426. query: [],
  6427. columns: [],
  6428. summary: [],
  6429. },
  6430. querySql: '',
  6431. summarySql: '',
  6432. createAt: '',
  6433. createBy: '',
  6434. updateAt: '',
  6435. updateBy: '',
  6436. }
  6437. };
  6438. //# sourceMappingURL=ReportDesign.model.js.map
  6439. var vjson$4 = {
  6440. bind: {
  6441. title: '报表-{report_name}',
  6442. },
  6443. layout: 'fit',
  6444. items: [
  6445. {
  6446. layout: 'border',
  6447. items: [
  6448. {
  6449. region: 'north',
  6450. items: [
  6451. {
  6452. xtype: 'toolbar',
  6453. border: false,
  6454. items: [
  6455. {
  6456. xtype: 'button',
  6457. text: '刷新',
  6458. iconCls: 'x-fa fa-refresh',
  6459. listeners: {
  6460. click: 'scope.load'
  6461. }
  6462. },
  6463. {
  6464. xtype: 'button',
  6465. text: '保存',
  6466. iconCls: 'x-fa fa-save',
  6467. listeners: {
  6468. click: 'scope.save'
  6469. }
  6470. },
  6471. {
  6472. xtype: 'button',
  6473. text: '预览',
  6474. iconCls: 'x-fa fa-play-circle-o',
  6475. listeners: {
  6476. click: 'scope.preview'
  6477. }
  6478. },
  6479. {
  6480. xtype: 'textfield',
  6481. fieldLabel: '报表名称',
  6482. flex: 1,
  6483. bind: {
  6484. value: '{report_name}'
  6485. }
  6486. },
  6487. {
  6488. xtype: 'checkbox',
  6489. fieldLabel: '启用报表',
  6490. checkedValue: 1,
  6491. uncheckedValue: 0,
  6492. bind: {
  6493. value: '{report_enable}'
  6494. }
  6495. },
  6496. {
  6497. xtype: 'checkbox',
  6498. fieldLabel: '启用分页',
  6499. bind: {
  6500. value: '{report.grid.pagination}'
  6501. }
  6502. },
  6503. {
  6504. xtype: 'textfield',
  6505. fieldLabel: '数据源',
  6506. flex: 1,
  6507. bind: {
  6508. value: '{report.dataSource}'
  6509. }
  6510. },
  6511. ]
  6512. }
  6513. ]
  6514. },
  6515. {
  6516. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6517. items: [
  6518. {
  6519. title: 'SQL和查询条件',
  6520. layout: 'border',
  6521. border: false,
  6522. items: [
  6523. {
  6524. region: 'north',
  6525. height: 200,
  6526. border: false,
  6527. split: true,
  6528. xtype: 'yvgrid',
  6529. reference: 'gridCondition',
  6530. pagination: false,
  6531. hideFootbar: true,
  6532. plugins: {
  6533. clipboard: true,
  6534. selectionreplicator: true
  6535. },
  6536. selModel: {
  6537. type: 'spreadsheet',
  6538. columnSelect: false,
  6539. pruneRemoved: false,
  6540. extensible: 'y'
  6541. },
  6542. tbar: {
  6543. xtype: 'toolbar',
  6544. border: false,
  6545. items: [
  6546. {
  6547. xtype: 'button',
  6548. text: '添加条件',
  6549. iconCls: 'x-fa fa-plus-circle',
  6550. listeners: {
  6551. click: 'scope.addCondition'
  6552. }
  6553. },
  6554. {
  6555. xtype: 'button',
  6556. text: '删除条件',
  6557. iconCls: 'x-fa fa-minus-circle',
  6558. listeners: {
  6559. click: 'scope.removeCondition'
  6560. }
  6561. },
  6562. '-',
  6563. {
  6564. xtype: 'button',
  6565. text: '自动分析条件变量',
  6566. iconCls: 'x-fa fa-code-fork',
  6567. listeners: {
  6568. click: 'scope.calcCondition'
  6569. }
  6570. },
  6571. {
  6572. xtype: 'button',
  6573. text: '上移',
  6574. iconCls: 'x-fa fa-arrow-up',
  6575. listeners: {
  6576. click: 'scope.moveUp'
  6577. }
  6578. },
  6579. {
  6580. xtype: 'button',
  6581. text: '下移',
  6582. iconCls: 'x-fa fa-arrow-down',
  6583. listeners: {
  6584. click: 'scope.moveDown'
  6585. }
  6586. },
  6587. ]
  6588. },
  6589. columns: [
  6590. {
  6591. text: '条件变量',
  6592. dataIndex: 'conditionFieldBind',
  6593. width: 140,
  6594. sortable: false,
  6595. menuDisabled: true,
  6596. editor: {
  6597. selectOnFocus: true
  6598. },
  6599. },
  6600. {
  6601. text: '中文标题',
  6602. dataIndex: 'conditionFieldLabel',
  6603. width: 120,
  6604. sortable: false,
  6605. menuDisabled: true,
  6606. editor: {
  6607. selectOnFocus: true
  6608. },
  6609. },
  6610. {
  6611. text: '编辑类型',
  6612. dataIndex: 'conditionFieldXtype',
  6613. width: 80,
  6614. sortable: false,
  6615. menuDisabled: true,
  6616. editor: {
  6617. xtype: 'combo',
  6618. typeAhead: true,
  6619. triggerAction: 'all',
  6620. selectOnFocus: true,
  6621. store: [
  6622. ['textfield', 'textfield'],
  6623. ['combo', 'combo'],
  6624. ['datefield', 'datefield'],
  6625. ['datetimefield', 'datetimefield'],
  6626. ['numberfield', 'numberfield'],
  6627. ['multiplesearch', 'multiplesearch'],
  6628. ]
  6629. }
  6630. },
  6631. {
  6632. text: '权重',
  6633. dataIndex: 'conditionFieldFlex',
  6634. align: 'right',
  6635. width: 60,
  6636. sortable: false,
  6637. menuDisabled: true,
  6638. editor: {
  6639. xtype: 'numberfield',
  6640. selectOnFocus: false,
  6641. minValue: 0,
  6642. maxValue: 10
  6643. },
  6644. },
  6645. {
  6646. text: '字典',
  6647. dataIndex: 'conditionFieldDict',
  6648. width: 160,
  6649. sortable: false,
  6650. menuDisabled: true,
  6651. editor: {
  6652. selectOnFocus: false
  6653. },
  6654. },
  6655. {
  6656. xtype: 'checkcolumn',
  6657. dataIndex: "conditionFieldWrap", header: "换行",
  6658. width: 65,
  6659. sortable: false,
  6660. menuDisabled: true,
  6661. },
  6662. {
  6663. text: '扩展参数',
  6664. dataIndex: 'conditionFieldExtend',
  6665. sortable: false,
  6666. menuDisabled: true,
  6667. editor: {
  6668. selectOnFocus: false
  6669. },
  6670. },
  6671. ]
  6672. },
  6673. {
  6674. region: 'center',
  6675. xtype: 'sqleditor',
  6676. layout: 'fit',
  6677. reference: 'sqlEditor',
  6678. split: true,
  6679. },
  6680. ]
  6681. },
  6682. {
  6683. title: '查询结果字段',
  6684. xtype: 'yvgrid',
  6685. reference: 'gridColumn',
  6686. pagination: false,
  6687. hideFootbar: true,
  6688. border: false,
  6689. plugins: {
  6690. clipboard: true,
  6691. selectionreplicator: true
  6692. },
  6693. selModel: {
  6694. type: 'spreadsheet',
  6695. columnSelect: false,
  6696. pruneRemoved: false,
  6697. extensible: 'y'
  6698. },
  6699. tbar: {
  6700. xtype: 'toolbar',
  6701. items: [
  6702. {
  6703. xtype: 'button',
  6704. text: '添加',
  6705. iconCls: 'x-fa fa-plus-circle',
  6706. listeners: {
  6707. click: 'scope.addColumn'
  6708. }
  6709. },
  6710. {
  6711. xtype: 'button',
  6712. text: '删除',
  6713. iconCls: 'x-fa fa-minus-circle',
  6714. listeners: {
  6715. click: 'scope.removeColumn'
  6716. }
  6717. },
  6718. '-',
  6719. {
  6720. xtype: 'button',
  6721. text: '自动分析',
  6722. iconCls: 'x-fa fa-code-fork',
  6723. listeners: {
  6724. click: 'scope.calcColumn'
  6725. }
  6726. },
  6727. {
  6728. xtype: 'button',
  6729. text: '上移',
  6730. iconCls: 'x-fa fa-arrow-up',
  6731. listeners: {
  6732. click: 'scope.moveUp'
  6733. }
  6734. },
  6735. {
  6736. xtype: 'button',
  6737. text: '下移',
  6738. iconCls: 'x-fa fa-arrow-down',
  6739. listeners: {
  6740. click: 'scope.moveDown'
  6741. }
  6742. },
  6743. ]
  6744. },
  6745. columns: [
  6746. { xtype: 'rownumberer' },
  6747. {
  6748. text: '字段',
  6749. dataIndex: 'dataIndex',
  6750. width: 140,
  6751. sortable: false,
  6752. menuDisabled: true,
  6753. editor: {
  6754. selectOnFocus: true
  6755. },
  6756. },
  6757. {
  6758. text: '标题',
  6759. dataIndex: 'header',
  6760. width: 120,
  6761. sortable: false,
  6762. menuDisabled: true,
  6763. editor: {
  6764. selectOnFocus: true
  6765. },
  6766. },
  6767. {
  6768. text: '显示类型',
  6769. dataIndex: 'xtype',
  6770. width: 90,
  6771. sortable: false,
  6772. menuDisabled: true,
  6773. editor: {
  6774. xtype: 'combo',
  6775. typeAhead: true,
  6776. triggerAction: 'all',
  6777. selectOnFocus: true,
  6778. store: [
  6779. ['', ''],
  6780. ['rownum', 'rownum'],
  6781. ['button', 'button'],
  6782. ['checkbox', 'checkbox'],
  6783. ['progres', 'progres'],
  6784. ]
  6785. }
  6786. },
  6787. {
  6788. text: '数据类型',
  6789. dataIndex: 'dataType',
  6790. width: 90,
  6791. sortable: false,
  6792. menuDisabled: true,
  6793. editor: {
  6794. xtype: 'combo',
  6795. typeAhead: true,
  6796. triggerAction: 'all',
  6797. selectOnFocus: true,
  6798. store: [
  6799. ['', ''],
  6800. ['string', 'string'],
  6801. ['number', 'number'],
  6802. ['date', 'date'],
  6803. ]
  6804. }
  6805. },
  6806. {
  6807. text: '宽度',
  6808. dataIndex: 'width',
  6809. align: 'right',
  6810. width: 60,
  6811. sortable: false,
  6812. menuDisabled: true,
  6813. editor: {
  6814. xtype: 'numberfield',
  6815. selectOnFocus: true,
  6816. minValue: 0,
  6817. maxValue: 1000
  6818. },
  6819. },
  6820. {
  6821. text: '权重',
  6822. dataIndex: 'flex',
  6823. align: 'right',
  6824. width: 60,
  6825. sortable: false,
  6826. menuDisabled: true,
  6827. editor: {
  6828. xtype: 'numberfield',
  6829. selectOnFocus: true,
  6830. minValue: 0,
  6831. maxValue: 10
  6832. },
  6833. },
  6834. {
  6835. text: '字典',
  6836. dataIndex: 'dict',
  6837. sortable: false,
  6838. menuDisabled: true,
  6839. width: 120,
  6840. editor: {
  6841. selectOnFocus: true,
  6842. },
  6843. },
  6844. {
  6845. text: '对齐',
  6846. dataIndex: 'align',
  6847. width: 60,
  6848. sortable: false,
  6849. menuDisabled: true,
  6850. editor: {
  6851. xtype: 'combo',
  6852. typeAhead: true,
  6853. triggerAction: 'all',
  6854. selectOnFocus: false,
  6855. store: [
  6856. ['', ''],
  6857. ['start', 'start'],
  6858. ['center', 'center'],
  6859. ['end', 'end'],
  6860. ]
  6861. },
  6862. },
  6863. {
  6864. text: '过滤',
  6865. dataIndex: 'filterable',
  6866. xtype: 'checkcolumn',
  6867. width: 50,
  6868. resizable: false,
  6869. sortable: false,
  6870. menuDisabled: true,
  6871. },
  6872. {
  6873. text: '隐藏',
  6874. dataIndex: 'hidden',
  6875. xtype: 'checkcolumn',
  6876. width: 50,
  6877. resizable: false,
  6878. sortable: false,
  6879. menuDisabled: true,
  6880. },
  6881. {
  6882. text: '排序',
  6883. dataIndex: 'sortable',
  6884. xtype: 'checkcolumn',
  6885. width: 50,
  6886. resizable: false,
  6887. sortable: false,
  6888. menuDisabled: true,
  6889. },
  6890. {
  6891. text: '扩展参数',
  6892. dataIndex: 'fieldExtend',
  6893. sortable: false,
  6894. menuDisabled: true,
  6895. editor: {
  6896. selectOnFocus: false
  6897. },
  6898. },
  6899. ],
  6900. },
  6901. {
  6902. title: '汇总和汇总逻辑',
  6903. layout: 'border',
  6904. border: false,
  6905. items: [
  6906. {
  6907. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6908. reference: 'gridSum',
  6909. pagination: false,
  6910. hideFootbar: true,
  6911. height: 200,
  6912. split: true,
  6913. border: false,
  6914. plugins: {
  6915. clipboard: true,
  6916. selectionreplicator: true
  6917. },
  6918. selModel: {
  6919. type: 'spreadsheet',
  6920. columnSelect: false,
  6921. pruneRemoved: false,
  6922. extensible: 'y'
  6923. },
  6924. tbar: {
  6925. xtype: 'toolbar',
  6926. border: false,
  6927. items: [
  6928. {
  6929. xtype: 'button',
  6930. text: '添加',
  6931. iconCls: 'x-fa fa-plus-circle',
  6932. listeners: {
  6933. click: 'scope.addSum'
  6934. }
  6935. },
  6936. {
  6937. xtype: 'button',
  6938. text: '删除',
  6939. iconCls: 'x-fa fa-minus-circle',
  6940. listeners: {
  6941. click: 'scope.removeSum'
  6942. }
  6943. },
  6944. '-',
  6945. {
  6946. xtype: 'button',
  6947. text: '自动分析',
  6948. iconCls: 'x-fa fa-code-fork',
  6949. listeners: {
  6950. click: 'scope.calcSum'
  6951. }
  6952. },
  6953. {
  6954. xtype: 'button',
  6955. text: '上移',
  6956. iconCls: 'x-fa fa-arrow-up',
  6957. listeners: {
  6958. click: 'scope.moveUp'
  6959. }
  6960. },
  6961. {
  6962. xtype: 'button',
  6963. text: '下移',
  6964. iconCls: 'x-fa fa-arrow-down',
  6965. listeners: {
  6966. click: 'scope.moveDown'
  6967. }
  6968. },
  6969. ]
  6970. },
  6971. columns: [
  6972. {
  6973. text: '字段名',
  6974. dataIndex: 'sumFieldBind',
  6975. width: 140,
  6976. sortable: false,
  6977. menuDisabled: true,
  6978. editor: {
  6979. selectOnFocus: true
  6980. },
  6981. },
  6982. {
  6983. text: '标题',
  6984. dataIndex: 'sumFieldLabel',
  6985. width: 120,
  6986. sortable: false,
  6987. menuDisabled: true,
  6988. editor: {
  6989. selectOnFocus: true
  6990. },
  6991. },
  6992. {
  6993. text: '权重',
  6994. dataIndex: 'sumFieldFlex',
  6995. align: 'right',
  6996. width: 60,
  6997. sortable: false,
  6998. menuDisabled: true,
  6999. editor: {
  7000. xtype: 'numberfield',
  7001. selectOnFocus: false,
  7002. allowBlank: true,
  7003. minValue: 0,
  7004. maxValue: 10
  7005. },
  7006. },
  7007. {
  7008. xtype: 'checkcolumn',
  7009. dataIndex: "sumFieldWrap", header: "换行",
  7010. sortable: false,
  7011. menuDisabled: true,
  7012. width: 65,
  7013. },
  7014. {
  7015. text: '扩展参数',
  7016. dataIndex: 'sumFieldExtend',
  7017. sortable: false,
  7018. menuDisabled: true,
  7019. editor: {
  7020. selectOnFocus: false
  7021. },
  7022. },
  7023. ]
  7024. },
  7025. {
  7026. region: 'center',
  7027. xtype: 'sqleditor',
  7028. layout: 'fit',
  7029. reference: 'sqlSumEditor',
  7030. },
  7031. ]
  7032. },
  7033. ]
  7034. }
  7035. ]
  7036. }
  7037. ]
  7038. }; //
  7039. //
  7040. //# sourceMappingURL=ReportDesign.view.js.map
  7041. var DbStore = /** @class */ (function (_super) {
  7042. __extends(DbStore, _super);
  7043. function DbStore() {
  7044. return _super !== null && _super.apply(this, arguments) || this;
  7045. }
  7046. DbStore.prototype.getCacheKey = function (param) {
  7047. return "db_data.json";
  7048. };
  7049. DbStore.prototype.invokeApi = function (param) {
  7050. return getMateData(param);
  7051. };
  7052. /**
  7053. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7054. */
  7055. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7056. return new Promise(function (resolve, reject) {
  7057. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7058. resolve(res1);
  7059. // TODO 好像不需要,先跳过
  7060. // reloadByTableName(schema_name, table_name).then(res2 => {
  7061. // resolve(res1)
  7062. // }).catch(e => {
  7063. // reject(e)
  7064. // })
  7065. }).catch(function (e) {
  7066. reject(e);
  7067. });
  7068. });
  7069. };
  7070. /**
  7071. * 保存元数据至表格
  7072. */
  7073. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7074. var _this = this;
  7075. return new Promise(function (resolve, reject) {
  7076. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7077. // 保存后重新刷新
  7078. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7079. resolve({
  7080. data: res2,
  7081. msg: res1.msg
  7082. });
  7083. }).catch(function (e) {
  7084. reject(e);
  7085. });
  7086. }).catch(function (e) {
  7087. reject(e);
  7088. });
  7089. });
  7090. };
  7091. /**
  7092. * 预览生成的 DDL 语句
  7093. */
  7094. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7095. return new Promise(function (resolve, reject) {
  7096. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7097. .then(function (res) {
  7098. resolve(res);
  7099. });
  7100. });
  7101. };
  7102. /**
  7103. * 执行 DDL
  7104. */
  7105. DbStore.prototype.pushToDbCommit = function (arg) {
  7106. return new Promise(function (resolve, reject) {
  7107. pushToDbCommitApi(arg).then(function (res) {
  7108. resolve(res);
  7109. }).catch(function (e) {
  7110. reject(e);
  7111. });
  7112. });
  7113. };
  7114. /**
  7115. * 重读某一个表格的 meta 元数据
  7116. */
  7117. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7118. var _this = this;
  7119. return new Promise(function (resolve, reject) {
  7120. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7121. if (!res[0] || !res[0].table_list[0]) {
  7122. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7123. return;
  7124. }
  7125. var tableRow = _this.getTableByName(schema_name, table_name);
  7126. if (!tableRow) {
  7127. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7128. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7129. if (!schemaRow) {
  7130. showErrorDialog$1('没有找到 schema:' + schema_name);
  7131. return;
  7132. }
  7133. schemaRow.table_list.push(res[0].table_list[0]);
  7134. }
  7135. else {
  7136. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7137. Object.assign(tableRow, res[0].table_list[0]);
  7138. }
  7139. // 所有界面通知一遍刷新
  7140. _this.notifyRefresh();
  7141. resolve(res);
  7142. }).catch(function (e) {
  7143. reject(e);
  7144. });
  7145. });
  7146. };
  7147. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7148. var result = undefined;
  7149. _$2.forEach(this.apiResponse, function (schemaRow) {
  7150. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7151. if (tableRow) {
  7152. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7153. if (columnRow) {
  7154. result = columnRow;
  7155. return false;
  7156. }
  7157. }
  7158. });
  7159. return result;
  7160. };
  7161. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7162. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7163. if (!schemaRow) {
  7164. showErrorDialog$1('没有找到 schema:' + schemaName);
  7165. return;
  7166. }
  7167. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7168. if (!schemaRow) {
  7169. showErrorDialog$1('没有找到 table:' + tableName);
  7170. return;
  7171. }
  7172. return tableRow;
  7173. };
  7174. /**
  7175. * 添加一个新表格
  7176. */
  7177. DbStore.prototype.appendNewTable = function (tableInfo) {
  7178. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7179. if (!schemaRow) {
  7180. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7181. return;
  7182. }
  7183. schemaRow.table_list.push(tableInfo);
  7184. };
  7185. /**
  7186. * 从数据库结构重新生成元数据
  7187. */
  7188. DbStore.prototype.dbToMetaAndReload = function () {
  7189. var _this = this;
  7190. this.notifyLoading(true);
  7191. dbToMeta().then(function () {
  7192. _this.reloadForce(undefined);
  7193. }).catch(function (e) {
  7194. _this.notifyLoading(false);
  7195. });
  7196. };
  7197. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7198. var dbType = undefined;
  7199. _$2.forEach(this.apiResponse, function (schemaRow) {
  7200. if (schemaRow.schema_name === schemaName) {
  7201. dbType = schemaRow.db_type;
  7202. return false;
  7203. }
  7204. });
  7205. return dbType;
  7206. };
  7207. return DbStore;
  7208. }(CacheStore));
  7209. function syncQueryDSL(_a) {
  7210. var schema_name = _a.schema_name, table_name = _a.table_name;
  7211. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7212. }
  7213. var instance$1 = new DbStore();
  7214. // // 字段域数据
  7215. // let columnDomain = undefined
  7216. // // 元数据
  7217. // let apiResponse = []
  7218. //
  7219. // // 订阅
  7220. // const subscribeList = []
  7221. // /**
  7222. // * 获取全部元数据
  7223. // */
  7224. // export function getApiResponse() {
  7225. // return apiResponse
  7226. // }
  7227. //
  7228. // export function getColumnDomain() {
  7229. // return columnDomain
  7230. // }
  7231. // window['getApiResponse'] = getApiResponse
  7232. // window['getColumnDomain'] = getColumnDomain
  7233. // window['getDbTreeStore'] = function () {
  7234. // return apiResponse
  7235. // }
  7236. //
  7237. // /**
  7238. // * 订阅结果集
  7239. // */
  7240. // export function subscribe(fn) {
  7241. // subscribeList.push(fn)
  7242. // }
  7243. //
  7244. // /**
  7245. // * 取消订阅
  7246. // */
  7247. // export function describe(fn) {
  7248. // _.remove(subscribeList, item => item === fn)
  7249. // }
  7250. //
  7251. // /**
  7252. // * 刷新,如果前端从来没有取到过结果的话
  7253. // * 如果强制刷新成功,就返回 true
  7254. // * 如果没有被强制刷新,返回 false
  7255. // */
  7256. // export function reloadIfNeed() {
  7257. // if (_.size(apiResponse) <= 0) {
  7258. // reloadForce()
  7259. // return true
  7260. // }
  7261. // return false
  7262. // }
  7263. //
  7264. // export function reloadIfNeedPromise() {
  7265. // return new Promise((resolve, reject) => {
  7266. // if (_.size(apiResponse) <= 0) {
  7267. // // 从未有获取过值
  7268. // reloadForce().then(res => {
  7269. // resolve(apiResponse)
  7270. // })
  7271. // return
  7272. // }
  7273. // resolve(apiResponse)
  7274. // return
  7275. // })
  7276. // }
  7277. //
  7278. // /**
  7279. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7280. // */
  7281. // export function reloadForce() {
  7282. // _.forEach(subscribeList, fn => {
  7283. // fn(true)
  7284. // })
  7285. //
  7286. // return getMateData().then((content) => {
  7287. // apiResponse = content
  7288. // _.forEach(subscribeList, fn => {
  7289. // fn(apiResponse)
  7290. // })
  7291. // }).finally(() => {
  7292. // _.forEach(subscribeList, fn => {
  7293. // fn(false)
  7294. // })
  7295. // })
  7296. // }
  7297. //
  7298. // /**
  7299. // * 通知刷新元数据
  7300. // */
  7301. // export function notifyRefresh() {
  7302. // _.forEach(subscribeList, fn => {
  7303. // fn(apiResponse)
  7304. // })
  7305. // }
  7306. // export function getAllDomain() {
  7307. // return new Promise((resolve, reject) => {
  7308. // getColumnDomainApi()
  7309. // .then(res => {
  7310. // if (res.success) {
  7311. // columnDomain = res.data
  7312. // resolve(res.data)
  7313. // } else {
  7314. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7315. // console.error('getColumnDomain', res.msg)
  7316. // }
  7317. //
  7318. // })
  7319. // .catch(e => {
  7320. // showErrorDialog('getColumnDomain error!')
  7321. // console.error('getColumnDomain', e)
  7322. // reject(e)
  7323. // })
  7324. // })
  7325. // }
  7326. //# sourceMappingURL=DbStore.js.map
  7327. var PROJECT_DICT_CACHE = {};
  7328. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7329. /**
  7330. *项目运行时构建
  7331. **/
  7332. function createRuntime() {
  7333. {
  7334. // 已经构建过了
  7335. return new Promise(function (resolve) {
  7336. resolve();
  7337. });
  7338. }
  7339. }
  7340. //# sourceMappingURL=ProjectRuntime.js.map
  7341. function ReportRunner(reportId, setLoadingFn) {
  7342. return new Promise(function (resolve) {
  7343. setLoadingFn(true);
  7344. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7345. // const {model, vjson, report} = buildVjson(res.data)
  7346. // const ret = new ReportScope({model, vjson})
  7347. // ret.report_id = reportId
  7348. // ret.report = report
  7349. // resolve(ret)
  7350. var _b = __read(_a, 1), res = _b[0];
  7351. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7352. resolve(ret);
  7353. }).finally(function () {
  7354. setLoadingFn(false);
  7355. });
  7356. });
  7357. }
  7358. //# sourceMappingURL=ReportRunner.js.map
  7359. //gridCondition
  7360. //gridColumn
  7361. //gridSum
  7362. //sqlSumEditor
  7363. //sqlEditor
  7364. var ReportDesign = /** @class */ (function (_super) {
  7365. __extends(ReportDesign, _super);
  7366. function ReportDesign() {
  7367. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7368. }
  7369. ReportDesign.prototype.onLoad = function () {
  7370. this.load();
  7371. };
  7372. ReportDesign.prototype.save = function (sender) {
  7373. var _this = this;
  7374. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7375. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7376. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7377. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7378. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7379. var report = this.viewModel.get('report');
  7380. var data = {
  7381. report_id: this.viewModel.get('report_id'),
  7382. report_name: this.viewModel.get('report_name'),
  7383. report_enable: this.viewModel.get('report_enable'),
  7384. query_sql: this.viewModel.get('querySql'),
  7385. summary_sql: this.viewModel.get('summarySql'),
  7386. report: json5.stringify(report, null, ' '),
  7387. };
  7388. sender.setLoading(true);
  7389. saveReportApi(data).then(function (res) {
  7390. if (res.success) {
  7391. msg$1('保存成功');
  7392. _this.dialogSuccess(data);
  7393. _this.load();
  7394. }
  7395. }).finally(function () {
  7396. sender.setLoading(false);
  7397. });
  7398. };
  7399. ReportDesign.prototype.preview = function (sender) {
  7400. var reportId = this.viewModel.get('report_id');
  7401. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7402. handles.mainWindow.showReportPreview(reportId, scope);
  7403. });
  7404. };
  7405. ReportDesign.prototype.load = function () {
  7406. var _this = this;
  7407. var reportId = this.viewModel.get('report_id');
  7408. this.setLoading(true);
  7409. reportByIdApi(reportId).then(function (res) {
  7410. 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;
  7411. if (report) {
  7412. report = json5.parse(report);
  7413. }
  7414. else {
  7415. report = {};
  7416. }
  7417. _this.viewModel.set('report_enable', report_enable);
  7418. _this.viewModel.set('report_name', report_name);
  7419. _this.viewModel.set('querySql', query_sql || '');
  7420. _this.viewModel.set('summarySql', summary_sql || '');
  7421. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7422. var query = _this.viewModel.get('report.query') || [];
  7423. var columns = _this.viewModel.get('report.columns') || [];
  7424. var summary = _this.viewModel.get('report.summary') || [];
  7425. var querySql = _this.viewModel.get('querySql');
  7426. var summarySql = _this.viewModel.get('summarySql');
  7427. _this.refs.gridCondition.setData(query);
  7428. _this.refs.gridColumn.setData(columns);
  7429. _this.refs.gridSum.setData(summary);
  7430. _this.refs.sqlEditor.setCode(querySql);
  7431. _this.refs.sqlSumEditor.setCode(summarySql);
  7432. }).finally(function () {
  7433. _this.setLoading(false);
  7434. });
  7435. };
  7436. ReportDesign.prototype.addCondition = function () {
  7437. this.refs.gridCondition.appendEditRow({
  7438. conditionFieldBind: '',
  7439. conditionFieldLabel: '',
  7440. conditionFieldXtype: 'textfield',
  7441. conditionFieldFlex: 1,
  7442. conditionFieldDict: '',
  7443. conditionFieldWrap: false,
  7444. conditionFieldExtend: '{}',
  7445. }, 'conditionFieldBind');
  7446. };
  7447. ReportDesign.prototype.removeCondition = function () {
  7448. var _this = this;
  7449. var rows = [];
  7450. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7451. rows.push(r);
  7452. });
  7453. _.forEach(rows, function (r) {
  7454. _this.refs.gridCondition.getStore().remove(r);
  7455. });
  7456. };
  7457. ReportDesign.prototype.moveUp = function (sender) {
  7458. var grid = sender.up('grid');
  7459. grid.rowMoveUp();
  7460. };
  7461. ReportDesign.prototype.moveDown = function (sender) {
  7462. var grid = sender.up('grid');
  7463. grid.rowMoveDown();
  7464. };
  7465. ReportDesign.prototype.calcCondition = function () {
  7466. var _this = this;
  7467. var sql = this.refs.sqlEditor.getCode();
  7468. var re = sql.matchAll(/#{(.+?)}/gi);
  7469. var rows = this.refs.gridCondition.getDataRows();
  7470. this.refs.gridCondition.setLoading(true);
  7471. Promise.all([
  7472. parseDynamicSqlApi(sql),
  7473. instance$1.reloadIfNeedPromise(),
  7474. ]).then(function (_a) {
  7475. var e_1, _b;
  7476. var _c = __read(_a, 1), res1 = _c[0];
  7477. if (res1.success) {
  7478. var tables_1 = [];
  7479. _.forEach(res1.data, function (parseItem) {
  7480. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7481. if (tableName && !_.includes(tables_1, tableName)) {
  7482. tables_1.push(tableName);
  7483. }
  7484. });
  7485. var _loop_1 = function (m) {
  7486. var e_2, _a;
  7487. var columnName = m[1];
  7488. // 没有这个列才添加
  7489. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7490. var meta = undefined;
  7491. try {
  7492. 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()) {
  7493. var tableName = tables_2_1.value;
  7494. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7495. if (meta) {
  7496. break;
  7497. }
  7498. }
  7499. }
  7500. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7501. finally {
  7502. try {
  7503. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7504. }
  7505. finally { if (e_2) throw e_2.error; }
  7506. }
  7507. if (meta) {
  7508. // 找到元数据
  7509. var r = {
  7510. conditionFieldBind: meta.column_name,
  7511. conditionFieldLabel: meta.column_comment,
  7512. conditionFieldXtype: 'textfield',
  7513. conditionFieldFlex: 1,
  7514. conditionFieldDict: '',
  7515. conditionFieldWrap: false,
  7516. conditionFieldExtend: '{}',
  7517. };
  7518. if (meta.column_ui === 'combo' && meta.column_dict) {
  7519. r.conditionFieldXtype = 'combo';
  7520. r.conditionFieldDict = meta.column_dict;
  7521. }
  7522. else if (meta.column_ui === "checkbox") {
  7523. r.conditionFieldXtype = 'checkbox';
  7524. }
  7525. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7526. r.conditionFieldXtype = 'numberfield';
  7527. }
  7528. _this.refs.gridCondition.appendEditRow(r);
  7529. }
  7530. else {
  7531. // 没找到元数据,直接添加
  7532. _this.refs.gridCondition.appendEditRow({
  7533. conditionFieldBind: columnName,
  7534. conditionFieldLabel: '',
  7535. conditionFieldXtype: 'textfield',
  7536. conditionFieldFlex: 1,
  7537. conditionFieldDict: '',
  7538. conditionFieldWrap: false,
  7539. conditionFieldExtend: '{}',
  7540. });
  7541. }
  7542. }
  7543. };
  7544. try {
  7545. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7546. var m = re_1_1.value;
  7547. _loop_1(m);
  7548. }
  7549. }
  7550. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7551. finally {
  7552. try {
  7553. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7554. }
  7555. finally { if (e_1) throw e_1.error; }
  7556. }
  7557. }
  7558. }).finally(function () {
  7559. _this.refs.gridCondition.setLoading(false);
  7560. });
  7561. };
  7562. ReportDesign.prototype.addColumn = function () {
  7563. this.refs.gridColumn.appendEditRow({
  7564. dataIndex: '',
  7565. header: '',
  7566. xtype: '',
  7567. dataType: '',
  7568. width: '',
  7569. dict: '',
  7570. align: '',
  7571. filterable: true,
  7572. hidden: false,
  7573. sortable: true,
  7574. fieldExtend: '{}',
  7575. }, 'header');
  7576. };
  7577. ReportDesign.prototype.removeColumn = function () {
  7578. var _this = this;
  7579. var rows = [];
  7580. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7581. rows.push(r);
  7582. });
  7583. _.forEach(rows, function (r) {
  7584. _this.refs.gridColumn.getStore().remove(r);
  7585. });
  7586. };
  7587. ReportDesign.prototype.calcColumn = function () {
  7588. var _this = this;
  7589. var sql = this.refs.sqlEditor.getCode();
  7590. this.refs.gridColumn.setLoading(true);
  7591. var rows = this.refs.gridColumn.getDataRows();
  7592. Promise.all([
  7593. parseDynamicSqlApi(sql),
  7594. instance$1.reloadIfNeedPromise(),
  7595. ]).then(function (_a) {
  7596. var _b = __read(_a, 1), res1 = _b[0];
  7597. if (res1.success) {
  7598. _.forEach(res1.data, function (parseItem) {
  7599. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7600. // 是否找到重复字段
  7601. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7602. if (exists) {
  7603. if ((columnTypeName || "").toLowerCase() === "number") {
  7604. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7605. if (record) {
  7606. record.set("dataType", "number");
  7607. record.set("align", "end");
  7608. }
  7609. }
  7610. return;
  7611. }
  7612. if (tableName) {
  7613. // 解出表格名和字段名
  7614. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7615. if (meta) {
  7616. // 找到了元数据
  7617. var r = {
  7618. dataIndex: meta.column_name,
  7619. header: meta.column_comment,
  7620. xtype: '',
  7621. dataType: '',
  7622. width: '',
  7623. dict: '',
  7624. align: '',
  7625. filterable: true,
  7626. hidden: false,
  7627. sortable: true,
  7628. fieldExtend: '{}',
  7629. };
  7630. if (meta.column_ui === 'combo' && meta.column_dict) {
  7631. r.dict = meta.column_dict;
  7632. }
  7633. else if (meta.column_ui === "checkbox") {
  7634. r.xtype = 'checkbox';
  7635. }
  7636. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7637. r.dataType = meta.data_type;
  7638. r.align = 'end';
  7639. }
  7640. if ((columnTypeName || "").toLowerCase() === "number") {
  7641. r.dataType = "number";
  7642. r.align = 'end';
  7643. }
  7644. _this.refs.gridColumn.appendEditRow(r);
  7645. return;
  7646. }
  7647. }
  7648. if (columnName) {
  7649. // 解出字段名
  7650. var r = {
  7651. dataIndex: columnName,
  7652. header: columnName,
  7653. xtype: '',
  7654. dataType: '',
  7655. width: '',
  7656. dict: '',
  7657. align: '',
  7658. filterable: true,
  7659. hidden: false,
  7660. sortable: true,
  7661. fieldExtend: '{}',
  7662. };
  7663. if ((columnTypeName || "").toLowerCase() === "number") {
  7664. r.dataType = "number";
  7665. r.align = 'end';
  7666. }
  7667. _this.refs.gridColumn.appendEditRow(r);
  7668. }
  7669. });
  7670. }
  7671. }).finally(function () {
  7672. _this.refs.gridColumn.setLoading(false);
  7673. });
  7674. };
  7675. ReportDesign.prototype.addSum = function () {
  7676. this.refs.gridSum.appendEditRow({
  7677. sumFieldBind: '',
  7678. sumFieldLabel: '',
  7679. sumFieldFlex: 1,
  7680. sumFieldWrap: false,
  7681. sumFieldExtend: '{}',
  7682. }, 'sumFieldBind');
  7683. };
  7684. ReportDesign.prototype.removeSum = function () {
  7685. var _this = this;
  7686. var rows = [];
  7687. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7688. rows.push(r);
  7689. });
  7690. _.forEach(rows, function (r) {
  7691. _this.refs.gridSum.getStore().remove(r);
  7692. });
  7693. };
  7694. ReportDesign.prototype.calcSum = function () {
  7695. var _this = this;
  7696. var sql = this.refs.sqlSumEditor.getCode();
  7697. var rows = this.refs.gridSum.getDataRows();
  7698. this.refs.gridSum.setLoading(true);
  7699. parseDynamicSqlApi(sql).then(function (res1) {
  7700. if (res1.success) {
  7701. _.forEach(res1.data, function (parseItem) {
  7702. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7703. // 是否找到重复字段
  7704. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7705. return;
  7706. }
  7707. if (columnName) {
  7708. // 解出字段名
  7709. _this.refs.gridSum.appendEditRow({
  7710. sumFieldBind: columnName,
  7711. sumFieldLabel: columnName,
  7712. sumFieldFlex: 1,
  7713. sumFieldWrap: false,
  7714. sumFieldExtend: '{}',
  7715. });
  7716. }
  7717. });
  7718. }
  7719. }).finally(function () {
  7720. _this.refs.gridSum.setLoading(false);
  7721. });
  7722. };
  7723. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7724. get: function () {
  7725. return this.viewModel.get('report_id');
  7726. },
  7727. enumerable: true,
  7728. configurable: true
  7729. });
  7730. return ReportDesign;
  7731. }(Scope));
  7732. //# sourceMappingURL=ReportDesign.js.map
  7733. var model$5 = {
  7734. data: {
  7735. originalTableInfo: {
  7736. table_name: '',
  7737. description: '',
  7738. },
  7739. hasChanged: false,
  7740. schema_name: undefined,
  7741. table_name: undefined,
  7742. column_name: undefined,
  7743. tableInfo: {
  7744. schema_name: '',
  7745. table_name: '',
  7746. description: '',
  7747. biz_category: '',
  7748. note: '',
  7749. archive_enable: false,
  7750. archive_cron: '',
  7751. archive_condition: '',
  7752. column_list: []
  7753. },
  7754. },
  7755. formulas: {
  7756. shouldSave: function (get) {
  7757. // console.log("-->", get('grid1.ischanged'))
  7758. return get('grid1.ischanged')
  7759. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7760. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7761. },
  7762. },
  7763. };
  7764. //# sourceMappingURL=DbColumn.model.js.map
  7765. var vjson$5 = {
  7766. bind: {
  7767. title: '{tableName}{shouldSave?" *":""}',
  7768. },
  7769. layout: 'fit',
  7770. items: [
  7771. {
  7772. layout: 'border',
  7773. tbar: {
  7774. xtype: 'toolbar',
  7775. items: [
  7776. // {
  7777. // xtype: 'button',
  7778. // text: '拉取库结构',
  7779. // iconCls: 'x-fa fa-cloud-download',
  7780. // listeners: {
  7781. // click: 'scope.pullFromDb'
  7782. // }
  7783. // },
  7784. {
  7785. xtype: 'button',
  7786. text: '保存至数据库',
  7787. iconCls: 'x-fa fa-save',
  7788. bind: {
  7789. disabled: '{!shouldSave}'
  7790. },
  7791. listeners: {
  7792. click: 'scope.pushToDb'
  7793. }
  7794. },
  7795. '-',
  7796. {
  7797. xtype: 'button',
  7798. text: '刷新 QueryDSL',
  7799. iconCls: 'x-fa fa-refresh',
  7800. listeners: {
  7801. click: 'scope.syncQueryDSL'
  7802. }
  7803. },
  7804. {
  7805. xtype: 'button',
  7806. text: '生成 DDL',
  7807. iconCls: 'x-fa fa-file-text',
  7808. listeners: {
  7809. click: 'scope.buildDDL'
  7810. }
  7811. }
  7812. ]
  7813. },
  7814. items: [
  7815. {
  7816. region: 'center',
  7817. xtype: 'tabpanel',
  7818. items: [
  7819. {
  7820. title: '字段',
  7821. xtype: 'yvgrid',
  7822. selModel: {
  7823. type: 'spreadsheet',
  7824. columnSelect: true,
  7825. pruneRemoved: false,
  7826. extensible: 'y'
  7827. },
  7828. enableLocking: false,
  7829. idField: 'column_name',
  7830. plugins: {
  7831. clipboard: true,
  7832. selectionreplicator: true
  7833. },
  7834. reference: 'grid1',
  7835. pagination: false,
  7836. // hideFootbar: true,
  7837. tbar: {
  7838. xtype: 'form',
  7839. items: [
  7840. {
  7841. xtype: 'cols',
  7842. items: [
  7843. {
  7844. xtype: 'textfield',
  7845. fieldLabel: '表格名',
  7846. reference: 'text_table_name',
  7847. readOnly: true,
  7848. bind: {
  7849. value: '{tableInfo.table_name}'
  7850. }
  7851. },
  7852. {
  7853. xtype: 'textfield',
  7854. fieldLabel: '描述',
  7855. // readOnly: true,
  7856. bind: {
  7857. value: '{tableInfo.description}'
  7858. }
  7859. },
  7860. ]
  7861. },
  7862. {
  7863. xtype: 'toolbar',
  7864. items: [
  7865. {
  7866. xtype: 'button',
  7867. text: '添加',
  7868. iconCls: 'x-fa fa-plus-circle',
  7869. listeners: {
  7870. click: 'scope.addField'
  7871. }
  7872. },
  7873. {
  7874. xtype: 'button',
  7875. text: '删除',
  7876. iconCls: 'x-fa fa-minus-circle',
  7877. listeners: {
  7878. click: 'scope.removeField'
  7879. }
  7880. },
  7881. ]
  7882. },
  7883. ]
  7884. },
  7885. listeners: {
  7886. editbefore: 'scope.gridEditBefore'
  7887. },
  7888. columns: [
  7889. {
  7890. text: '字段名', dataIndex: 'column_name',
  7891. sortable: false,
  7892. menuDisabled: true,
  7893. width: 120,
  7894. editor: {
  7895. allowBlank: true,
  7896. selectOnFocus: false
  7897. }
  7898. },
  7899. {
  7900. text: '字段中文', dataIndex: 'column_comment',
  7901. width: 130,
  7902. sortable: false,
  7903. menuDisabled: true,
  7904. editor: {
  7905. allowBlank: true,
  7906. selectOnFocus: false
  7907. }
  7908. },
  7909. {
  7910. text: '主键', dataIndex: 'is_primary_key',
  7911. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7912. width: 48, resizable: false,
  7913. },
  7914. {
  7915. text: '必填', dataIndex: 'not_null',
  7916. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7917. width: 48, resizable: false,
  7918. },
  7919. {
  7920. text: '字段域', dataIndex: 'column_domain',
  7921. sortable: false, menuDisabled: true,
  7922. width: 148,
  7923. dict: 'column_domain',
  7924. editor: {
  7925. xtype: 'combo',
  7926. allowBlank: true,
  7927. selectOnFocus: true,
  7928. // fix: ['system.getDict("column_domain")'],
  7929. dict: 'column_domain',
  7930. listConfig: {
  7931. minWidth: 200
  7932. },
  7933. listeners: {
  7934. change: 'scope.columnDomainChange',
  7935. }
  7936. }
  7937. },
  7938. {
  7939. text: '数据类型', dataIndex: 'data_type',
  7940. sortable: false, menuDisabled: true,
  7941. editor: { allowBlank: true, selectOnFocus: true }
  7942. },
  7943. {
  7944. text: '长度', dataIndex: 'column_size',
  7945. sortable: false, menuDisabled: true,
  7946. xtype: 'numbercolumn', format: '0',
  7947. editor: { allowBlank: true, selectOnFocus: true }
  7948. },
  7949. {
  7950. text: '小数位', dataIndex: 'decimal_digits',
  7951. sortable: false, menuDisabled: true,
  7952. xtype: 'numbercolumn', format: '0',
  7953. editor: { allowBlank: true, selectOnFocus: true }
  7954. },
  7955. {
  7956. text: '默认值', dataIndex: 'default_value',
  7957. sortable: false, menuDisabled: true,
  7958. editor: { allowBlank: true, selectOnFocus: true }
  7959. },
  7960. {
  7961. text: '字典', dataIndex: 'column_dict',
  7962. sortable: false, menuDisabled: true,
  7963. // fix: ['system.getDict("DICT")'],
  7964. width: 200,
  7965. editor: {
  7966. xtype: 'combo',
  7967. allowBlank: true,
  7968. listConfig: {
  7969. minWidth: 350
  7970. },
  7971. }
  7972. },
  7973. {
  7974. text: 'UI建议', dataIndex: 'column_ui',
  7975. sortable: false, menuDisabled: true,
  7976. // fix: ['system.getDict("column_ui")'],
  7977. editor: {
  7978. xtype: 'combo',
  7979. allowBlank: true,
  7980. listConfig: {
  7981. minWidth: 200
  7982. },
  7983. }
  7984. },
  7985. {
  7986. text: '详细描述', dataIndex: 'column_note',
  7987. sortable: false, menuDisabled: true,
  7988. editor: { allowBlank: true, }
  7989. },
  7990. ]
  7991. },
  7992. {
  7993. title: '高级属性',
  7994. xtype: 'form',
  7995. items: [
  7996. // {
  7997. // xtype: 'textfield',
  7998. // fieldLabel: '表格名',
  7999. // bind: {
  8000. // value: '{tableName}'
  8001. // }
  8002. // },
  8003. // {
  8004. // xtype: 'textfield',
  8005. // fieldLabel: '中文含义',
  8006. // bind: {
  8007. // value: '{tableInfo.description}'
  8008. // }
  8009. // },
  8010. {
  8011. xtype: 'combo',
  8012. fieldLabel: '业务类型',
  8013. bind: {
  8014. value: '{tableInfo.biz_category}'
  8015. },
  8016. store: [
  8017. '基础资料',
  8018. '系统',
  8019. '账目与库存',
  8020. '单据',
  8021. '指令',
  8022. '规则与流程',
  8023. '开发辅助',
  8024. ]
  8025. },
  8026. {
  8027. xtype: 'textfield',
  8028. fieldLabel: '详细描述',
  8029. bind: {
  8030. value: '{tableInfo.note}'
  8031. },
  8032. },
  8033. {
  8034. xtype: 'checkbox',
  8035. fieldLabel: '允许归档',
  8036. bind: "{tableInfo.archive_enable}",
  8037. },
  8038. {
  8039. xtype: 'textfield',
  8040. fieldLabel: '归档周期',
  8041. bind: {
  8042. value: '{tableInfo.archive_cron}',
  8043. hidden: '{!tableInfo.archive_enable}',
  8044. }
  8045. },
  8046. {
  8047. xtype: 'textfield',
  8048. fieldLabel: '归档条件',
  8049. bind: {
  8050. value: '{tableInfo.archive_condition}',
  8051. hidden: '{!tableInfo.archive_enable}',
  8052. }
  8053. },
  8054. ]
  8055. },
  8056. ]
  8057. }
  8058. ]
  8059. },
  8060. ]
  8061. };
  8062. //# sourceMappingURL=DbColumn.view.js.map
  8063. var DbColumn = /** @class */ (function (_super) {
  8064. __extends(DbColumn, _super);
  8065. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8066. var _this = _super.call(this, {
  8067. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8068. vjson: vjson$5
  8069. }) || this;
  8070. _this.isCreate = false;
  8071. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8072. return _this;
  8073. }
  8074. DbColumn.prototype.onLoad = function () {
  8075. var _this = this;
  8076. var _a, _b, _c, _d, _e, _f, _g, _h;
  8077. console.log('me', this);
  8078. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8079. this.refs.grid1.autoSizeColumns();
  8080. // this.refs.grid1.columns[0].hide()
  8081. // 自动定位到选定的列
  8082. if (this.viewModel.get('column_name')) {
  8083. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8084. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8085. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8086. return;
  8087. }
  8088. }
  8089. }
  8090. instance.getColumnDomainComboData().then(function () {
  8091. _this.checkDomain();
  8092. });
  8093. 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 : "");
  8094. 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 : "");
  8095. if (this.isCreate)
  8096. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8097. };
  8098. DbColumn.prototype.checkDomain = function () {
  8099. // 走查一遍 domain
  8100. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8101. var dbType = this.viewModel.get('tableInfo.db_type');
  8102. var diffColumnName = [];
  8103. var tableInfo = this.viewModel.get('tableInfo');
  8104. this.refs.grid1.store.data.items.forEach(function (record) {
  8105. var data = record.data;
  8106. var column_domain = data.column_domain;
  8107. var domain = instance.getColumnDomainById(column_domain);
  8108. if (!domain) {
  8109. // 没有找到 domain
  8110. return;
  8111. }
  8112. var editRow = applyDomain(dbType, domain);
  8113. // 字段跟领域做对比
  8114. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8115. if (typeof compareResult === 'string') {
  8116. // 不一样的情况下,要改成一致
  8117. _$2.forOwn(editRow, function (value, key) {
  8118. // 改成与 domain 一致
  8119. record.set(key, value);
  8120. });
  8121. diffColumnName.push(data.column_name + '.' + compareResult);
  8122. }
  8123. });
  8124. if (diffColumnName.length > 0) {
  8125. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8126. }
  8127. };
  8128. DbColumn.prototype.addField = function () {
  8129. this.refs.grid1.appendEditRow({
  8130. column_name: '',
  8131. column_comment: '',
  8132. is_primary_key: false,
  8133. not_null: true,
  8134. column_domain: '',
  8135. data_type: '',
  8136. column_size: 0,
  8137. decimal_digits: 0,
  8138. default_value: '',
  8139. column_dict: '',
  8140. column_ui: '',
  8141. column_note: '',
  8142. }, 'column_name');
  8143. };
  8144. DbColumn.prototype.removeField = function () {
  8145. var _this = this;
  8146. var rows = [];
  8147. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8148. rows.push(r);
  8149. });
  8150. _$2.forEach(rows, function (r) {
  8151. _this.refs.grid1.getStore().remove(r);
  8152. });
  8153. };
  8154. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8155. instance.getColumnDomainComboData().then(function (data) {
  8156. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8157. });
  8158. // 被字段域锁定的内容,不允许修改
  8159. var record = context.record, field = context.field;
  8160. var domainId = record.get('column_domain');
  8161. if (!domainId) {
  8162. return;
  8163. }
  8164. var domain = instance.getColumnDomainById(domainId);
  8165. if (!domain) {
  8166. msg$1('没有找到字段域' + domainId);
  8167. return;
  8168. }
  8169. if (field === "data_type") {
  8170. // 字段类型不允许修改
  8171. context.cancel = true;
  8172. return;
  8173. }
  8174. if (domain.is_fix_size &&
  8175. (field === "column_size" ||
  8176. field === "decimal_digits")) {
  8177. // 锁定长度的情况下,大小不允许修改
  8178. context.cancel = true;
  8179. return;
  8180. }
  8181. if (domain.is_fix_default_value && field === "default_value") {
  8182. // 锁定默认值的情况下,默认值不允许修改
  8183. context.cancel = true;
  8184. return;
  8185. }
  8186. };
  8187. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8188. if (!newValue) {
  8189. return;
  8190. }
  8191. var grid = editor.up('grid').ownerGrid;
  8192. var domain = instance.getColumnDomainById(newValue);
  8193. if (!domain) {
  8194. msg$1('没有找到 domain:' + newValue);
  8195. return;
  8196. }
  8197. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8198. var dbType = this.viewModel.get('tableInfo.db_type');
  8199. var editRow = applyDomain(dbType, domain);
  8200. grid.setEditRow(editRow);
  8201. };
  8202. DbColumn.prototype.pullFromDb = function () {
  8203. };
  8204. DbColumn.prototype.pushToDb = function (sender) {
  8205. var _this = this;
  8206. // 设置当前界面为 "保存中..." 状态
  8207. var me = this;
  8208. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8209. this.viewModel.set('tableInfo.table_name', table_name);
  8210. this.viewModel.set('tableInfo.schema_name', schema_name);
  8211. var tableInfo = this.viewModel.get('tableInfo');
  8212. var column_list = this.refs.grid1.getDataRows();
  8213. var hasError = false;
  8214. if (column_list.length <= 0) {
  8215. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8216. hasError = true;
  8217. }
  8218. var columnNameExistsCheck = {};
  8219. _$2.forEach(column_list, function (row, i) {
  8220. var checkResult = checkColumn(tableInfo, row);
  8221. if (typeof checkResult !== 'undefined') {
  8222. msg$1(checkResult);
  8223. hasError = true;
  8224. _this.refs.grid1.beginEdit(i, 'column_name');
  8225. return false;
  8226. }
  8227. if (!row.column_domain || row.column_domain === '0') {
  8228. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8229. hasError = true;
  8230. _this.refs.grid1.beginEdit(i, 'column_domain');
  8231. return false;
  8232. }
  8233. if (isEmpty(row.data_type)) {
  8234. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8235. hasError = true;
  8236. _this.refs.grid1.beginEdit(i, 'data_type');
  8237. return false;
  8238. }
  8239. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8240. // 列名已存在
  8241. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8242. hasError = true;
  8243. _this.refs.grid1.beginEdit(i, 'column_name');
  8244. return false;
  8245. }
  8246. columnNameExistsCheck[row.column_name] = true;
  8247. });
  8248. if (hasError)
  8249. return;
  8250. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8251. me.setLoading(true);
  8252. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8253. .then(function (res) {
  8254. var _a;
  8255. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8256. // 返回 DDL 就要显示出来
  8257. var window_1 = Ext.create('Ext.window.Window', {
  8258. title: 'SQL 预览',
  8259. height: 400,
  8260. width: 600,
  8261. modal: true,
  8262. animateTarget: sender,
  8263. maximizable: true,
  8264. layout: 'fit',
  8265. items: {
  8266. xtype: 'sqleditor',
  8267. value: res.data.ddl
  8268. },
  8269. buttons: [
  8270. {
  8271. xtype: 'button',
  8272. text: '执行',
  8273. iconCls: 'x-fa fa-save',
  8274. handler: function (sender) {
  8275. var editor = sender.up('window').down('sqleditor');
  8276. var ddl = editor.getValue();
  8277. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8278. }
  8279. },
  8280. {
  8281. xtype: 'button',
  8282. text: '取消',
  8283. iconCls: 'x-fa fa-times',
  8284. handler: function () {
  8285. window_1.close();
  8286. }
  8287. }
  8288. ]
  8289. }).show();
  8290. return;
  8291. }
  8292. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8293. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8294. if (!tableRow) {
  8295. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8296. console.log('这是一个新 table');
  8297. instance$1.appendNewTable(tableInfo);
  8298. }
  8299. _this.viewModel.set('schema_name', schema_name);
  8300. _this.viewModel.set('table_name', table_name);
  8301. _this.viewModel.set('tableInfo', tableInfo);
  8302. _this.refs.grid1.setData(tableInfo.column_list);
  8303. if (tableRow)
  8304. Object.assign(tableRow, tableInfo);
  8305. msg$1('保存成功');
  8306. _this.viewModel.set('hasChanged', false);
  8307. })
  8308. .finally(function () {
  8309. me.setLoading(false);
  8310. });
  8311. };
  8312. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8313. var _this = this;
  8314. window.setLoading(true);
  8315. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8316. .then(function (res) {
  8317. var _a, _b, _c, _d;
  8318. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8319. // 保存成功就提示一下,并重新载入数据
  8320. msg$1(res.msg);
  8321. instance$1.reloadForce(undefined);
  8322. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8323. if (!tableRow) {
  8324. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8325. console.log('这是一个新 table');
  8326. instance$1.appendNewTable(tableInfo);
  8327. }
  8328. _this.viewModel.set('schema_name', schema_name);
  8329. _this.viewModel.set('table_name', table_name);
  8330. _this.viewModel.set('tableInfo', tableInfo);
  8331. _this.refs.grid1.setData(tableInfo.column_list);
  8332. if (tableRow)
  8333. Object.assign(tableRow, tableInfo);
  8334. instance$1.notifyRefresh();
  8335. window.close();
  8336. _this.viewModel.set('hasChanged', false);
  8337. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8338. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8339. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8340. })
  8341. .finally(function () {
  8342. // 无论正常异常,关闭 "保存中..." 状态
  8343. window.setLoading(false);
  8344. });
  8345. };
  8346. DbColumn.prototype.syncQueryDSL = function () {
  8347. var _this = this;
  8348. var tableInfo = this.viewModel.get("tableInfo");
  8349. this.setLoading(true);
  8350. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8351. .then(function () {
  8352. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8353. })
  8354. .finally(function () {
  8355. _this.setLoading(false);
  8356. });
  8357. };
  8358. DbColumn.prototype.buildDDL = function () {
  8359. };
  8360. return DbColumn;
  8361. }(Scope));
  8362. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8363. model.data.schema_name = schemaName;
  8364. model.data.table_name = tableName;
  8365. model.data.column_name = columnName;
  8366. if (isCreateTable) {
  8367. var dbType = instance$1.getSchemaDbType(schemaName);
  8368. if (!dbType) {
  8369. throw Error('无法识别数据库类型' + schemaName);
  8370. }
  8371. model.data.tableInfo.schema_name = model.data.schema_name;
  8372. model.data.tableInfo.table_name = model.data.table_name;
  8373. model.data.tableInfo.db_type = dbType;
  8374. model.data.tableInfo.column_list = [];
  8375. model.data.tableInfo.is_create = true;
  8376. return model;
  8377. }
  8378. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8379. if (!tableRow) {
  8380. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8381. }
  8382. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8383. model.data.tableInfo.is_create = false;
  8384. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8385. return model;
  8386. }
  8387. //# sourceMappingURL=DbColumn.js.map
  8388. var model$6 = {
  8389. data: {
  8390. id: '',
  8391. path: '',
  8392. form: {
  8393. title: '',
  8394. sqlId: '',
  8395. }
  8396. }
  8397. };
  8398. //# sourceMappingURL=WidgetDesign.model.js.map
  8399. var vjson$6 = {
  8400. bind: {
  8401. title: '{title}',
  8402. },
  8403. layout: 'fit',
  8404. items: [
  8405. {
  8406. layout: 'border',
  8407. items: [
  8408. {
  8409. region: 'center',
  8410. layout: 'border',
  8411. items: [
  8412. {
  8413. region: 'north',
  8414. items: [
  8415. {
  8416. xtype: 'toolbar',
  8417. border: false,
  8418. items: [
  8419. {
  8420. xtype: 'button',
  8421. text: '刷新',
  8422. iconCls: 'x-fa fa-refresh',
  8423. listeners: {
  8424. click: 'scope.load'
  8425. }
  8426. },
  8427. {
  8428. xtype: 'button',
  8429. text: '保存',
  8430. iconCls: 'x-fa fa-save',
  8431. listeners: {
  8432. click: 'scope.widgetSave'
  8433. }
  8434. },
  8435. {
  8436. xtype: 'button',
  8437. text: '预览',
  8438. iconCls: 'x-fa fa-play-circle-o',
  8439. listeners: {
  8440. //click: 'scope.preview'
  8441. }
  8442. },
  8443. {
  8444. xtype: 'textfield',
  8445. fieldLabel: '弹窗文件',
  8446. reference: "wPath",
  8447. labelWidth: 80,
  8448. //width: 200,
  8449. bind: {
  8450. value: '{widgetPath}',
  8451. },
  8452. readOnly: true,
  8453. },
  8454. {
  8455. xtype: 'textfield',
  8456. fieldLabel: '弹窗名称',
  8457. reference: "wTitle",
  8458. labelWidth: 80,
  8459. //width: 200,
  8460. bind: {
  8461. value: '{form.title}',
  8462. },
  8463. readOnly: true,
  8464. },
  8465. {
  8466. xtype: 'textfield',
  8467. fieldLabel: 'sqlId',
  8468. bind: {
  8469. value: '{form.sqlId}',
  8470. },
  8471. readOnly: true,
  8472. },
  8473. ]
  8474. },
  8475. ]
  8476. },
  8477. {
  8478. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8479. items: [
  8480. {
  8481. title: "SQL和条件",
  8482. layout: 'border',
  8483. border: false,
  8484. items: [
  8485. {
  8486. region: 'north',
  8487. height: 200,
  8488. xtype: 'yvgrid',
  8489. reference: "grid2",
  8490. split: true,
  8491. selModel: {
  8492. selType: 'rowmodel',
  8493. mode: 'SINGLE',
  8494. },
  8495. store: {},
  8496. pagination: false,
  8497. hideFootbar: true,
  8498. tbar: {
  8499. xtype: 'toolbar',
  8500. items: [
  8501. {
  8502. xtype: 'button',
  8503. text: '添加',
  8504. iconCls: 'x-fa fa-plus-circle',
  8505. listeners: {}
  8506. },
  8507. {
  8508. xtype: 'button',
  8509. text: '删除',
  8510. iconCls: 'x-fa fa-minus-circle',
  8511. listeners: {
  8512. click: 'scope.delCondition'
  8513. }
  8514. },
  8515. '-',
  8516. {
  8517. xtype: 'button',
  8518. text: '上移',
  8519. iconCls: 'x-fa fa-refresh',
  8520. listeners: {
  8521. //click: 'scope.saveAll'
  8522. }
  8523. },
  8524. {
  8525. xtype: 'button',
  8526. text: '下移',
  8527. iconCls: 'x-fa fa-refresh',
  8528. listeners: {
  8529. //click: 'scope.saveAll'
  8530. }
  8531. },
  8532. '-',
  8533. {
  8534. xtype: 'button',
  8535. text: '自动分析',
  8536. iconCls: 'x-fa fa-refresh',
  8537. listeners: {
  8538. click: 'scope.calcCondition'
  8539. }
  8540. },
  8541. ]
  8542. },
  8543. columns: [
  8544. {
  8545. text: '条件变量',
  8546. dataIndex: 'conditionFieldBind',
  8547. width: 140,
  8548. sortable: false,
  8549. menuDisabled: true,
  8550. editor: {
  8551. selectOnFocus: true
  8552. },
  8553. },
  8554. {
  8555. text: '中文标题',
  8556. dataIndex: 'conditionFieldLabel',
  8557. width: 120,
  8558. sortable: false,
  8559. menuDisabled: true,
  8560. editor: {
  8561. selectOnFocus: true
  8562. },
  8563. },
  8564. {
  8565. text: '编辑类型',
  8566. dataIndex: 'xtype',
  8567. sortable: false,
  8568. menuDisabled: true,
  8569. editor: {
  8570. xtype: 'combo',
  8571. typeAhead: true,
  8572. triggerAction: 'all',
  8573. selectOnFocus: true,
  8574. store: [
  8575. ['textfield', 'textfield'],
  8576. ['combo', 'combo'],
  8577. ['datefield', 'datefield'],
  8578. ['datetimefield', 'datetimefield'],
  8579. ['numberfield', 'numberfield'],
  8580. ['multiplesearch', 'multiplesearch'],
  8581. ]
  8582. }
  8583. },
  8584. {
  8585. text: '权重',
  8586. dataIndex: 'conditionFieldFlex',
  8587. align: 'right',
  8588. sortable: false,
  8589. menuDisabled: true,
  8590. editor: {
  8591. xtype: 'numberfield',
  8592. selectOnFocus: false,
  8593. minValue: 0,
  8594. maxValue: 10
  8595. },
  8596. },
  8597. {
  8598. text: '字典',
  8599. dataIndex: 'conditionFieldDict',
  8600. width: 160,
  8601. sortable: false,
  8602. menuDisabled: true,
  8603. editor: {
  8604. selectOnFocus: false
  8605. },
  8606. },
  8607. {
  8608. xtype: 'checkcolumn',
  8609. dataIndex: "conditionFieldWrap", header: "换行",
  8610. width: 65,
  8611. sortable: false,
  8612. menuDisabled: true,
  8613. },
  8614. ]
  8615. },
  8616. {
  8617. region: 'center',
  8618. xtype: 'sqleditor',
  8619. layout: 'fit',
  8620. reference: 'sqlEditor',
  8621. split: true,
  8622. bind: {
  8623. value: "{form.sql}"
  8624. },
  8625. },
  8626. ]
  8627. },
  8628. {
  8629. title: "结果字段定义",
  8630. border: false,
  8631. xtype: 'yvgrid',
  8632. reference: "grid3",
  8633. selModel: {
  8634. selType: 'rowmodel',
  8635. mode: 'SINGLE',
  8636. },
  8637. store: {},
  8638. pagination: false,
  8639. hideFootbar: true,
  8640. tbar: {
  8641. xtype: 'toolbar',
  8642. items: [
  8643. {
  8644. xtype: 'button',
  8645. text: '添加',
  8646. iconCls: 'x-fa fa-plus-circle',
  8647. listeners: {}
  8648. },
  8649. {
  8650. xtype: 'button',
  8651. text: '删除',
  8652. iconCls: 'x-fa fa-minus-circle',
  8653. listeners: {
  8654. click: 'scope.delColumn'
  8655. }
  8656. },
  8657. '-',
  8658. {
  8659. xtype: 'button',
  8660. text: '上移',
  8661. iconCls: 'x-fa fa-refresh',
  8662. listeners: {
  8663. //click: 'scope.saveAll'
  8664. }
  8665. },
  8666. {
  8667. xtype: 'button',
  8668. text: '下移',
  8669. iconCls: 'x-fa fa-refresh',
  8670. listeners: {
  8671. //click: 'scope.saveAll'
  8672. }
  8673. },
  8674. '-',
  8675. {
  8676. xtype: 'button',
  8677. text: '自动分析',
  8678. iconCls: 'x-fa fa-refresh',
  8679. listeners: {
  8680. click: 'scope.calcColumn'
  8681. }
  8682. },
  8683. ]
  8684. },
  8685. columns: [
  8686. { xtype: 'rownumberer' },
  8687. {
  8688. text: '字段',
  8689. dataIndex: 'dataIndex',
  8690. width: 140,
  8691. sortable: false,
  8692. menuDisabled: true,
  8693. editor: {
  8694. selectOnFocus: true
  8695. },
  8696. },
  8697. {
  8698. text: '标题',
  8699. dataIndex: 'header',
  8700. width: 120,
  8701. sortable: false,
  8702. menuDisabled: true,
  8703. editor: {
  8704. selectOnFocus: true
  8705. },
  8706. },
  8707. {
  8708. text: '显示类型',
  8709. dataIndex: 'xtype',
  8710. width: 90,
  8711. sortable: false,
  8712. menuDisabled: true,
  8713. editor: {
  8714. xtype: 'combo',
  8715. typeAhead: true,
  8716. triggerAction: 'all',
  8717. selectOnFocus: true,
  8718. store: [
  8719. ['', ''],
  8720. ['rownum', 'rownum'],
  8721. ['button', 'button'],
  8722. ['checkbox', 'checkbox'],
  8723. ['progres', 'progres'],
  8724. ]
  8725. }
  8726. },
  8727. {
  8728. text: '数据类型',
  8729. dataIndex: 'dataType',
  8730. width: 90,
  8731. sortable: false,
  8732. menuDisabled: true,
  8733. editor: {
  8734. xtype: 'combo',
  8735. typeAhead: true,
  8736. triggerAction: 'all',
  8737. selectOnFocus: true,
  8738. store: [
  8739. ['', ''],
  8740. ['string', 'string'],
  8741. ['number', 'number'],
  8742. ['date', 'date'],
  8743. ]
  8744. }
  8745. },
  8746. {
  8747. text: '数据字典',
  8748. dataIndex: 'dict',
  8749. sortable: false,
  8750. menuDisabled: true,
  8751. width: 120,
  8752. editor: {
  8753. selectOnFocus: true,
  8754. },
  8755. },
  8756. ],
  8757. },
  8758. ]
  8759. },
  8760. ]
  8761. },
  8762. ]
  8763. }
  8764. ]
  8765. }; //
  8766. //
  8767. //# sourceMappingURL=WidgetDesign.view.js.map
  8768. var WidgetDesign = /** @class */ (function (_super) {
  8769. __extends(WidgetDesign, _super);
  8770. function WidgetDesign(widgetPath, widgetName) {
  8771. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8772. _this.widgetPath = widgetPath;
  8773. _this.widgetName = widgetName;
  8774. return _this;
  8775. }
  8776. WidgetDesign.prototype.onLoad = function () {
  8777. if (this.widgetPath) {
  8778. this.loadForm(this.widgetPath);
  8779. this.viewModel.set("widgetPath", this.widgetPath);
  8780. this.refs.wTitle.setReadOnly(true);
  8781. this.refs.wPath.setReadOnly(true);
  8782. }
  8783. else {
  8784. this.refs.wTitle.setReadOnly(false);
  8785. this.refs.wPath.setReadOnly(false);
  8786. }
  8787. };
  8788. WidgetDesign.prototype.load = function () {
  8789. var widgetPath = this.viewModel.get("widgetPath");
  8790. if (widgetPath) {
  8791. this.loadForm(widgetPath);
  8792. }
  8793. };
  8794. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8795. var _this = this;
  8796. var me = this;
  8797. me.setLoading(true);
  8798. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8799. msg$1(res.msg);
  8800. if (res.success) {
  8801. _this.viewModel.set("widgetPath", widgetPath);
  8802. me.refs.grid3.getStore().removeAll();
  8803. if (res.data.form.columns) {
  8804. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8805. }
  8806. _this.viewModel.set("form.title", res.data.form.title);
  8807. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8808. // set sql
  8809. _this.refs.sqlEditor.setCode(res.data.sql);
  8810. }
  8811. }).finally(function () {
  8812. me.setLoading(false);
  8813. });
  8814. };
  8815. WidgetDesign.prototype.widgetAdd = function (sender) {
  8816. var _this = this;
  8817. var title = this.viewModel.get("form.title");
  8818. if (title) {
  8819. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8820. if (btn == 'yes') {
  8821. alert(1);
  8822. }
  8823. else {
  8824. alert(2);
  8825. }
  8826. });
  8827. }
  8828. else {
  8829. var me_1 = this;
  8830. var win_1 = new Ext.Window({
  8831. autoDestroy: true,
  8832. title: "新建弹框",
  8833. width: 400,
  8834. height: 220,
  8835. resizable: true,
  8836. closable: true,
  8837. maximizable: true,
  8838. minimizable: true,
  8839. plain: true,
  8840. // constrainHeader: true,
  8841. constrain: true,
  8842. layout: 'fit',
  8843. animateTarget: sender,
  8844. buttonAlign: 'center',
  8845. items: [
  8846. {
  8847. xtype: "form",
  8848. layout: "hbox",
  8849. margin: '10px 20px',
  8850. border: 0,
  8851. items: [
  8852. {
  8853. flex: 1,
  8854. layout: 'vbox',
  8855. items: [
  8856. {
  8857. xtype: "textfield",
  8858. name: "widgetcode",
  8859. fieldLabel: "弹框编号",
  8860. flex: 1,
  8861. allowBlank: false,
  8862. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8863. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8864. labelWidth: 50,
  8865. width: "100%",
  8866. },
  8867. {
  8868. xtype: "textfield",
  8869. name: "widgetname",
  8870. fieldLabel: "弹框名称",
  8871. flex: 1,
  8872. allowBlank: false,
  8873. labelWidth: 50,
  8874. width: "100%",
  8875. },
  8876. ]
  8877. },
  8878. ]
  8879. }
  8880. ],
  8881. //窗口按钮
  8882. buttons: [
  8883. {
  8884. xtype: 'button', text: '保存', handler: function (btn) {
  8885. //窗口获取表单
  8886. var form = win_1.down('form');
  8887. var vaildSuccess = form.isValid();
  8888. if (!vaildSuccess) {
  8889. return;
  8890. }
  8891. var title = form.down('textfield[name="widgetname"]').getValue();
  8892. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8893. me_1.viewModel.set("form.title", title);
  8894. me_1.viewModel.set("widgetPath", widgetPath);
  8895. var formdata = _this.viewModel.get("form");
  8896. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8897. if (res.success) {
  8898. msg$1('添加成功');
  8899. }
  8900. me_1.loadForm(widgetPath);
  8901. win_1.close();
  8902. });
  8903. }
  8904. },
  8905. {
  8906. xtype: 'button', text: '取消', handler: function (btn) {
  8907. //窗口关闭
  8908. win_1.close();
  8909. }
  8910. }
  8911. ]
  8912. });
  8913. win_1.show();
  8914. }
  8915. };
  8916. WidgetDesign.prototype.widgetSave = function () {
  8917. var _this = this;
  8918. var _a, _b;
  8919. var widgetPath = this.viewModel.get("widgetPath");
  8920. if (!widgetPath) {
  8921. msg$1("请选择或添加弹框后再保存!");
  8922. return;
  8923. }
  8924. var title = this.viewModel.get("form.title");
  8925. if (!title) {
  8926. msg$1("请选择或添加弹框后再保存!");
  8927. return;
  8928. }
  8929. // 获取条件
  8930. 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) {
  8931. delete r.id;
  8932. return r;
  8933. });
  8934. this.viewModel.set("form.conditions", conditions);
  8935. // 获取查询列
  8936. 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) {
  8937. delete r.id;
  8938. if (r.dict) {
  8939. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8940. }
  8941. return r;
  8942. });
  8943. this.viewModel.set("form.columns", columns);
  8944. // sql
  8945. var sql = this.refs.sqlEditor.getCode();
  8946. this.viewModel.set("form.sql", sql);
  8947. var form = this.viewModel.get("form");
  8948. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8949. msg$1(res.msg);
  8950. if (res.success) {
  8951. msg$1('保存成功');
  8952. _this.loadForm(widgetPath);
  8953. }
  8954. }).catch(function (res) {
  8955. });
  8956. };
  8957. WidgetDesign.prototype.delCondition = function () {
  8958. var _a;
  8959. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8960. };
  8961. WidgetDesign.prototype.delColumn = function () {
  8962. var _a;
  8963. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8964. };
  8965. WidgetDesign.prototype.calcCondition = function () {
  8966. var _this = this;
  8967. var sql = this.refs.sqlEditor.getCode();
  8968. var re = sql.matchAll(/#{(.+?)}/gi);
  8969. var rows = this.refs.grid2.getDataRows();
  8970. this.refs.grid2.setLoading(true);
  8971. parseDynamicSqlApi(sql).then(function (res) {
  8972. var e_1, _a;
  8973. if (res.success) {
  8974. var tables_1 = [];
  8975. _.forEach(res.data, function (parseItem) {
  8976. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8977. if (tableName && !_.includes(tables_1, tableName)) {
  8978. tables_1.push(tableName);
  8979. }
  8980. });
  8981. var _loop_1 = function (m) {
  8982. var e_2, _a;
  8983. var columnName = m[1];
  8984. // 没有这个列才添加
  8985. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8986. var meta = undefined;
  8987. try {
  8988. 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()) {
  8989. var tableName = tables_2_1.value;
  8990. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8991. if (meta) {
  8992. break;
  8993. }
  8994. }
  8995. }
  8996. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8997. finally {
  8998. try {
  8999. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  9000. }
  9001. finally { if (e_2) throw e_2.error; }
  9002. }
  9003. if (meta) {
  9004. // 没找到元数据,直接添加
  9005. _this.refs.grid2.appendEditRow({
  9006. conditionFieldBind: columnName,
  9007. conditionFieldLabel: meta.column_comment,
  9008. conditionFieldXtype: 'textfield',
  9009. conditionFieldFlex: 1,
  9010. conditionFieldDict: '',
  9011. conditionFieldWrap: false,
  9012. });
  9013. }
  9014. else {
  9015. _this.refs.grid2.appendEditRow({
  9016. conditionFieldBind: columnName,
  9017. conditionFieldLabel: '',
  9018. conditionFieldXtype: 'textfield',
  9019. conditionFieldFlex: 1,
  9020. conditionFieldDict: '',
  9021. conditionFieldWrap: false,
  9022. });
  9023. }
  9024. }
  9025. };
  9026. try {
  9027. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  9028. var m = re_1_1.value;
  9029. _loop_1(m);
  9030. }
  9031. }
  9032. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  9033. finally {
  9034. try {
  9035. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  9036. }
  9037. finally { if (e_1) throw e_1.error; }
  9038. }
  9039. }
  9040. }).finally(function () {
  9041. _this.refs.grid2.setLoading(false);
  9042. });
  9043. };
  9044. WidgetDesign.prototype.calcColumn = function () {
  9045. var _this = this;
  9046. var sql = this.refs.sqlEditor.getCode();
  9047. var rows = this.refs.grid3.getDataRows();
  9048. this.refs.grid3.setLoading(true);
  9049. parseDynamicSqlApi(sql).then(function (res) {
  9050. _.forEach(res.data, function (parseItem) {
  9051. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9052. // 是否找到重复字段
  9053. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9054. if (exists) {
  9055. return;
  9056. }
  9057. if (tableName) {
  9058. // 解出表格名和字段名
  9059. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9060. if (meta) {
  9061. // 找到了元数据
  9062. var r = {
  9063. dataIndex: meta.column_name,
  9064. header: meta.column_comment,
  9065. xtype: '',
  9066. dataType: 'string',
  9067. dict: '',
  9068. };
  9069. if (meta.column_ui === 'combo' && meta.column_dict) {
  9070. r.dict = meta.column_dict;
  9071. }
  9072. else if (meta.column_ui === "checkbox") {
  9073. r.xtype = 'checkbox';
  9074. }
  9075. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9076. r.dataType = meta.data_type;
  9077. }
  9078. _this.refs.grid3.appendEditRow(r);
  9079. return;
  9080. }
  9081. }
  9082. if (columnName) {
  9083. // 解出字段名
  9084. var r = {
  9085. dataIndex: columnName,
  9086. header: columnName,
  9087. xtype: '',
  9088. dataType: 'string',
  9089. dict: '',
  9090. };
  9091. _this.refs.grid3.appendEditRow(r);
  9092. }
  9093. });
  9094. }).finally(function () {
  9095. _this.refs.grid3.setLoading(false);
  9096. });
  9097. };
  9098. return WidgetDesign;
  9099. }(Scope));
  9100. //# sourceMappingURL=WidgetDesign.js.map
  9101. var model$7 = {
  9102. data: {
  9103. // spreadsheet: false,
  9104. // multSelect: false,
  9105. // showCheckColumn: false,
  9106. // checkColumncheckOnly: false,
  9107. // disableSelection: false,
  9108. vjson: {
  9109. reference: '',
  9110. pagination: false,
  9111. pageSize: false,
  9112. pageSizeOption: false,
  9113. hideFootbar: false,
  9114. hideRefresh: false,
  9115. hideExport: false,
  9116. hideAutoSize: false,
  9117. hideClearFilter: false,
  9118. hideSaveGridUIConfig: false,
  9119. hideClearGridUIConfig: false,
  9120. selectMode: '',
  9121. cellediting_clicksToEdit: 1,
  9122. columnLines: false,
  9123. rowLines: false,
  9124. border: false,
  9125. autoLoad: false,
  9126. remoteSort: false,
  9127. remoteFilter: false,
  9128. enableLocking: false,
  9129. enableColumnHide: false,
  9130. enableColumnMove: false,
  9131. gridfilters: false,
  9132. enableColumnResize: false,
  9133. sortOnClick: false,
  9134. hidden: false,
  9135. cls: '',
  9136. dataSource: {
  9137. url: '',
  9138. params: {
  9139. formData: '{form}',
  9140. },
  9141. },
  9142. listeners: {
  9143. beforeselect: '',
  9144. selectionchange: '',
  9145. itemclick: '',
  9146. itemdblclick: '',
  9147. cellClick: '',
  9148. celldblclick: '',
  9149. afterrender: '',
  9150. destory: '',
  9151. }
  9152. },
  9153. }
  9154. };
  9155. //# sourceMappingURL=YvgridDesign.model.js.map
  9156. var vjson$7 = {
  9157. title: '表格-高级',
  9158. height: 450,
  9159. width: 970,
  9160. layout: 'fit',
  9161. modal: true,
  9162. items: [
  9163. {
  9164. xtype: 'tabpanel',
  9165. items: [
  9166. {
  9167. title: '属性',
  9168. xtype: 'form',
  9169. scrollable: true,
  9170. items: [
  9171. {
  9172. xtype: 'cols',
  9173. items: [
  9174. {
  9175. xtype: 'textfield',
  9176. fieldLabel: '引用名',
  9177. tooltip: 'reference',
  9178. bind: '{vjson.reference}',
  9179. },
  9180. ]
  9181. },
  9182. {
  9183. xtype: 'cols',
  9184. border: false,
  9185. items: [
  9186. // 允许分页、页大小、页大小选项
  9187. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9188. // 多选、显示勾选、自动勾选、
  9189. // 单击编辑、列分割线、行分割线、边框
  9190. // 数据源自动加载、后端排序、后端过滤
  9191. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9192. {
  9193. xtype: 'checkbox',
  9194. fieldLabel: '允许分页',
  9195. bind: {
  9196. value: "{vjson.pagination}"
  9197. }
  9198. },
  9199. {
  9200. xtype: 'numberfield',
  9201. fieldLabel: '页大小',
  9202. bind: '{vjson.pageSize}',
  9203. },
  9204. {
  9205. xtype: 'textfield',
  9206. fieldLabel: '页大小选项',
  9207. flex: 2,
  9208. bind: '{vjson.pageSizeOption}',
  9209. },
  9210. ]
  9211. },
  9212. {
  9213. layout: 'hbox',
  9214. border: false,
  9215. items: [
  9216. {
  9217. xtype: 'combo',
  9218. fieldLabel: '选择模式',
  9219. flex: 4,
  9220. data: [
  9221. { id: 'spreadsheet', text: 'Excel模式' },
  9222. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9223. { id: 'checkColumn', text: '勾选框' },
  9224. { id: 'row_mulity', text: '行选择-允许多选' },
  9225. { id: 'row_single', text: '行选择-单选' },
  9226. { id: 'disableSelection', text: '禁用' },
  9227. ],
  9228. bind: {
  9229. value: '{vjson.selectMode}'
  9230. }
  9231. }
  9232. ]
  9233. },
  9234. {
  9235. layout: 'hbox',
  9236. border: false,
  9237. defaults: {
  9238. xtype: 'checkbox',
  9239. margin: '0 15 0 0',
  9240. },
  9241. items: [
  9242. {
  9243. xtype: 'container',
  9244. margin: '3',
  9245. border: false,
  9246. width: 80,
  9247. },
  9248. {
  9249. boxLabel: '隐藏底部',
  9250. bind: {
  9251. value: "{vjson.hideFootbar}"
  9252. }
  9253. },
  9254. {
  9255. boxLabel: '隐藏刷新',
  9256. bind: {
  9257. value: "{vjson.hideRefresh}"
  9258. }
  9259. },
  9260. {
  9261. boxLabel: '隐藏导出',
  9262. bind: {
  9263. value: "{vjson.hideExport}"
  9264. }
  9265. },
  9266. {
  9267. boxLabel: '隐藏自动调宽',
  9268. bind: {
  9269. value: "{vjson.hideAutoSize}"
  9270. }
  9271. },
  9272. {
  9273. boxLabel: '隐藏清空筛选',
  9274. bind: {
  9275. value: "{vjson.hideClearFilter}"
  9276. }
  9277. },
  9278. {
  9279. boxLabel: '隐藏保存布局',
  9280. bind: {
  9281. value: "{vjson.hideSaveGridUIConfig}"
  9282. }
  9283. },
  9284. {
  9285. boxLabel: '隐藏重置布局',
  9286. bind: {
  9287. value: "{vjson.hideClearGridUIConfig}"
  9288. }
  9289. },
  9290. ]
  9291. },
  9292. {
  9293. layout: 'hbox',
  9294. border: false,
  9295. defaults: {
  9296. xtype: 'checkbox',
  9297. margin: '0 15 0 0',
  9298. },
  9299. items: [
  9300. {
  9301. xtype: 'container',
  9302. margin: '3',
  9303. border: false,
  9304. width: 80
  9305. },
  9306. {
  9307. boxLabel: '单击编辑',
  9308. bind: {
  9309. value: "{vjson.cellediting_clicksToEdit}"
  9310. }
  9311. },
  9312. {
  9313. boxLabel: '列分隔线',
  9314. bind: {
  9315. value: "{vjson.columnLines}"
  9316. }
  9317. },
  9318. {
  9319. boxLabel: '行分隔线',
  9320. bind: {
  9321. value: "{vjson.rowLines}"
  9322. }
  9323. },
  9324. {
  9325. boxLabel: '边框',
  9326. bind: {
  9327. value: "{vjson.border}"
  9328. }
  9329. },
  9330. ]
  9331. },
  9332. {
  9333. layout: 'hbox',
  9334. border: false,
  9335. defaults: {
  9336. xtype: 'checkbox',
  9337. margin: '0 15 0 0',
  9338. },
  9339. items: [
  9340. {
  9341. xtype: 'container',
  9342. margin: '3',
  9343. border: false,
  9344. width: 80
  9345. },
  9346. {
  9347. boxLabel: '数据源自动加载',
  9348. bind: {
  9349. value: "{vjson.autoLoad}"
  9350. }
  9351. },
  9352. {
  9353. boxLabel: '后端排序',
  9354. bind: {
  9355. value: "{vjson.remoteSort}"
  9356. }
  9357. },
  9358. {
  9359. boxLabel: '后端过滤',
  9360. bind: {
  9361. value: "{vjson.remoteFilter}"
  9362. }
  9363. },
  9364. ]
  9365. },
  9366. {
  9367. layout: 'hbox',
  9368. border: false,
  9369. defaults: {
  9370. xtype: 'checkbox',
  9371. margin: '0 15 0 0',
  9372. },
  9373. items: [
  9374. {
  9375. xtype: 'container',
  9376. margin: '3',
  9377. border: false,
  9378. width: 80
  9379. },
  9380. {
  9381. boxLabel: '自定义锁定',
  9382. bind: {
  9383. value: "{vjson.enableLocking}"
  9384. }
  9385. },
  9386. {
  9387. boxLabel: '自定义隐藏',
  9388. bind: {
  9389. value: "{vjson.enableColumnHide}"
  9390. }
  9391. },
  9392. {
  9393. boxLabel: '用户拖拽字段',
  9394. bind: {
  9395. value: "{vjson.enableColumnMove}"
  9396. }
  9397. },
  9398. {
  9399. boxLabel: '自定义筛选',
  9400. bind: {
  9401. value: "{vjson.gridfilters}"
  9402. }
  9403. },
  9404. {
  9405. boxLabel: '用户拖拽字段宽度',
  9406. bind: {
  9407. value: "{vjson.enableColumnResize}"
  9408. }
  9409. },
  9410. {
  9411. boxLabel: '点击列头排序',
  9412. bind: {
  9413. value: "{vjson.sortOnClick}"
  9414. }
  9415. },
  9416. {
  9417. xtype: 'checkbox',
  9418. boxLabel: '隐藏',
  9419. bind: {
  9420. value: "{vjson.hidden}"
  9421. }
  9422. },
  9423. ]
  9424. },
  9425. {
  9426. xtype: 'cols',
  9427. items: [
  9428. {
  9429. xtype: 'textfield',
  9430. fieldLabel: '样式',
  9431. bind: '{vjson.cls}',
  9432. flex: 4
  9433. },
  9434. ]
  9435. },
  9436. ]
  9437. },
  9438. {
  9439. title: '字段',
  9440. xtype: 'yvgrid',
  9441. reference: 'grid1',
  9442. pagination: false,
  9443. hideFootbar: true,
  9444. plugins: {
  9445. clipboard: true,
  9446. selectionreplicator: true
  9447. },
  9448. selModel: {
  9449. type: 'spreadsheet',
  9450. columnSelect: true,
  9451. pruneRemoved: false,
  9452. extensible: 'y'
  9453. },
  9454. listeners: {
  9455. editfinish: 'scope.gridEditFinish',
  9456. },
  9457. tbar: {
  9458. xtype: 'toolbar',
  9459. items: [
  9460. {
  9461. xtype: 'button',
  9462. text: '添加',
  9463. iconCls: 'x-fa fa-plus-circle',
  9464. listeners: {
  9465. click: 'scope.addColumn'
  9466. }
  9467. },
  9468. {
  9469. xtype: 'button',
  9470. text: '删除',
  9471. iconCls: 'x-fa fa-minus-circle',
  9472. listeners: {
  9473. click: 'scope.removeColumn'
  9474. }
  9475. },
  9476. '-',
  9477. {
  9478. xtype: 'button',
  9479. text: '自动分析',
  9480. iconCls: 'x-fa fa-code-fork',
  9481. listeners: {
  9482. click: 'scope.calcColumn'
  9483. }
  9484. },
  9485. {
  9486. xtype: 'button',
  9487. text: '上移',
  9488. iconCls: 'x-fa fa-arrow-up',
  9489. listeners: {
  9490. click: 'scope.moveUp'
  9491. }
  9492. },
  9493. {
  9494. xtype: 'button',
  9495. text: '下移',
  9496. iconCls: 'x-fa fa-arrow-down',
  9497. listeners: {
  9498. click: 'scope.moveDown'
  9499. }
  9500. },
  9501. ]
  9502. },
  9503. columns: [
  9504. { xtype: 'rownumberer' },
  9505. {
  9506. text: '字段',
  9507. dataIndex: 'dataIndex',
  9508. width: 140,
  9509. sortable: false,
  9510. menuDisabled: true,
  9511. editor: {
  9512. selectOnFocus: true,
  9513. },
  9514. },
  9515. {
  9516. text: '标题',
  9517. dataIndex: 'header',
  9518. width: 120,
  9519. sortable: false,
  9520. menuDisabled: true,
  9521. editor: {
  9522. selectOnFocus: true,
  9523. },
  9524. },
  9525. {
  9526. text: '类型',
  9527. dataIndex: 'xtype',
  9528. width: 100,
  9529. sortable: false,
  9530. menuDisabled: true,
  9531. editor: {
  9532. xtype: 'combo',
  9533. typeAhead: true,
  9534. triggerAction: 'all',
  9535. selectOnFocus: false,
  9536. listConfig: {
  9537. minWidth: 200
  9538. },
  9539. store: [
  9540. ['', '默认'],
  9541. ['rownum', 'rownum'],
  9542. ['checkcolumn', 'checkcolumn'],
  9543. ]
  9544. },
  9545. },
  9546. {
  9547. text: '数据类型',
  9548. dataIndex: 'dataType',
  9549. width: 100,
  9550. sortable: false,
  9551. menuDisabled: true,
  9552. editor: {
  9553. xtype: 'combo',
  9554. selectOnFocus: true,
  9555. listConfig: {
  9556. minWidth: 200
  9557. },
  9558. store: [
  9559. ['', '默认'],
  9560. ['string', 'string'],
  9561. ['number', 'number'],
  9562. ['date', 'date'],
  9563. ]
  9564. },
  9565. },
  9566. {
  9567. text: '编辑模式',
  9568. dataIndex: 'editor',
  9569. width: 100,
  9570. sortable: false,
  9571. menuDisabled: true,
  9572. editor: {
  9573. xtype: 'combo',
  9574. selectOnFocus: true,
  9575. listConfig: {
  9576. minWidth: 200
  9577. },
  9578. store: [
  9579. ['', ''],
  9580. ['textfield', 'textfield'],
  9581. ['numberfield', 'numberfield'],
  9582. ['combo', 'combo'],
  9583. ['combogrid', 'combogrid'],
  9584. ['datefield', 'datefield'],
  9585. ]
  9586. },
  9587. },
  9588. {
  9589. text: '宽度',
  9590. dataIndex: 'width',
  9591. align: 'right',
  9592. width: 100,
  9593. sortable: false,
  9594. menuDisabled: true,
  9595. editor: {
  9596. xtype: 'numberfield',
  9597. selectOnFocus: true,
  9598. minValue: 0,
  9599. maxValue: 1000
  9600. },
  9601. },
  9602. {
  9603. text: '权重',
  9604. dataIndex: 'flex',
  9605. align: 'right',
  9606. width: 90,
  9607. sortable: false,
  9608. menuDisabled: true,
  9609. editor: {
  9610. xtype: 'numberfield',
  9611. selectOnFocus: true,
  9612. minValue: 0,
  9613. maxValue: 10
  9614. },
  9615. },
  9616. {
  9617. text: '字典',
  9618. dataIndex: 'dict',
  9619. sortable: false,
  9620. menuDisabled: true,
  9621. width: 210,
  9622. editor: {
  9623. selectOnFocus: true,
  9624. },
  9625. },
  9626. {
  9627. text: '对齐',
  9628. dataIndex: 'align',
  9629. width: 90,
  9630. sortable: false,
  9631. menuDisabled: true,
  9632. editor: {
  9633. xtype: 'combo',
  9634. selectOnFocus: true,
  9635. listConfig: {
  9636. minWidth: 120
  9637. },
  9638. store: [
  9639. ['start', 'start'],
  9640. ['center', 'center'],
  9641. ['end', 'end'],
  9642. ]
  9643. },
  9644. },
  9645. {
  9646. text: '必填',
  9647. dataIndex: 'notAllowBlank',
  9648. width: 50,
  9649. resizable: false,
  9650. sortable: false,
  9651. menuDisabled: true,
  9652. xtype: 'checkcolumn',
  9653. },
  9654. {
  9655. text: '禁用',
  9656. dataIndex: 'disabled',
  9657. width: 50,
  9658. resizable: false,
  9659. sortable: false,
  9660. menuDisabled: true,
  9661. xtype: 'checkcolumn',
  9662. },
  9663. {
  9664. text: '禁菜',
  9665. dataIndex: 'menuDisabled',
  9666. width: 50,
  9667. resizable: false,
  9668. sortable: false,
  9669. menuDisabled: true,
  9670. xtype: 'checkcolumn',
  9671. },
  9672. {
  9673. text: '过滤',
  9674. dataIndex: 'filterable',
  9675. xtype: 'checkcolumn',
  9676. width: 50,
  9677. resizable: false,
  9678. sortable: false,
  9679. menuDisabled: true,
  9680. },
  9681. {
  9682. text: '隐藏',
  9683. dataIndex: 'hidden',
  9684. xtype: 'checkcolumn',
  9685. width: 50,
  9686. resizable: false,
  9687. sortable: false,
  9688. menuDisabled: true,
  9689. },
  9690. {
  9691. text: '可隐',
  9692. dataIndex: 'hideable',
  9693. xtype: 'checkcolumn',
  9694. width: 50,
  9695. resizable: false,
  9696. sortable: false,
  9697. menuDisabled: true,
  9698. },
  9699. {
  9700. text: '调宽',
  9701. dataIndex: 'resizable',
  9702. xtype: 'checkcolumn',
  9703. width: 50,
  9704. resizable: false,
  9705. sortable: false,
  9706. menuDisabled: true,
  9707. },
  9708. {
  9709. text: '排序',
  9710. dataIndex: 'sortable',
  9711. xtype: 'checkcolumn',
  9712. width: 50,
  9713. resizable: false,
  9714. sortable: false,
  9715. menuDisabled: true,
  9716. },
  9717. {
  9718. text: '适宽',
  9719. dataIndex: 'autoSize',
  9720. xtype: 'checkcolumn',
  9721. width: 50,
  9722. resizable: false,
  9723. sortable: false,
  9724. menuDisabled: true,
  9725. },
  9726. ],
  9727. },
  9728. {
  9729. title: '数据源',
  9730. layout: 'border',
  9731. listeners: {
  9732. activate: 'scope.dataSourceActivate'
  9733. },
  9734. items: [
  9735. {
  9736. region: 'north',
  9737. xtype: 'toolbar',
  9738. border: false,
  9739. items: [
  9740. {
  9741. xtype: 'textfield',
  9742. fieldLabel: '数据源',
  9743. flex: 1,
  9744. bind: {
  9745. value: '{vjson.dataSource.url}'
  9746. }
  9747. },
  9748. {
  9749. xtype: 'button',
  9750. text: '保存',
  9751. iconCls: 'x-fa fa-save',
  9752. listeners: {
  9753. click: 'scope.dataSourceSave'
  9754. }
  9755. },
  9756. {
  9757. xtype: 'button',
  9758. text: '读取',
  9759. iconCls: 'x-fa fa-folder-open',
  9760. listeners: {
  9761. click: 'scope.reloadSqlContent'
  9762. }
  9763. },
  9764. ]
  9765. },
  9766. {
  9767. region: 'center',
  9768. xtype: 'sqleditor',
  9769. layout: 'fit',
  9770. reference: 'sqlEditor',
  9771. },
  9772. {
  9773. region: 'south',
  9774. xtype: 'jsoneditor',
  9775. height: 200,
  9776. split: true,
  9777. collapsible: true,
  9778. title: '参数',
  9779. reference: 'sqlParams',
  9780. }
  9781. ]
  9782. },
  9783. {
  9784. title: '事件',
  9785. xtype: 'form',
  9786. scrollable: true,
  9787. margin: '10',
  9788. defaults: {
  9789. width: '100%',
  9790. labelAlign: 'top',
  9791. },
  9792. items: [
  9793. {
  9794. xtype: 'textfield',
  9795. fieldLabel: '选中前触发 beforeSelect',
  9796. bind: {
  9797. value: '{vjson.listeners.beforeselect}'
  9798. },
  9799. },
  9800. {
  9801. xtype: 'textfield',
  9802. fieldLabel: '选择范围改变 selectionChange',
  9803. bind: {
  9804. value: '{vjson.listeners.selectionchange}'
  9805. },
  9806. },
  9807. {
  9808. xtype: 'textfield',
  9809. fieldLabel: '行点击 itemClick',
  9810. bind: {
  9811. value: '{vjson.listeners.itemclick}'
  9812. },
  9813. },
  9814. {
  9815. xtype: 'textfield',
  9816. fieldLabel: '行双击 itemDblClick',
  9817. bind: {
  9818. value: '{vjson.listeners.itemdblclick}'
  9819. },
  9820. },
  9821. {
  9822. xtype: 'textfield',
  9823. fieldLabel: '单元格点击 cellClick',
  9824. bind: {
  9825. value: '{vjson.listeners.cellClick}'
  9826. },
  9827. },
  9828. {
  9829. xtype: 'textfield',
  9830. fieldLabel: '单元格双击 cellDblClick',
  9831. bind: {
  9832. value: '{vjson.listeners.celldblclick}'
  9833. },
  9834. },
  9835. {
  9836. xtype: 'textfield',
  9837. fieldLabel: '渲染后触发 afterrender',
  9838. bind: {
  9839. value: '{vjson.listeners.afterrender}'
  9840. },
  9841. },
  9842. {
  9843. xtype: 'textfield',
  9844. fieldLabel: '销毁后触发 destory',
  9845. bind: {
  9846. value: '{vjson.listeners.destory}'
  9847. },
  9848. },
  9849. ]
  9850. },
  9851. ],
  9852. }
  9853. ],
  9854. fbar: [
  9855. {
  9856. text: '应用', iconCls: 'x-fa fa-save',
  9857. listeners: {
  9858. click: 'scope.save'
  9859. }
  9860. },
  9861. '-',
  9862. {
  9863. text: '确定', iconCls: 'x-fa fa-check-circle',
  9864. listeners: {
  9865. click: 'scope.saveClose'
  9866. }
  9867. },
  9868. {
  9869. text: '取消', iconCls: 'x-fa fa-times-circle',
  9870. listeners: {
  9871. click: 'system.closeMe()'
  9872. }
  9873. },
  9874. ]
  9875. };
  9876. //# sourceMappingURL=YvgridDesign.view.js.map
  9877. var checkFlags = {};
  9878. // ------------------------------------------------------------------------------------------ impls
  9879. function jsViewToVJson(modulePage, jsView) {
  9880. if (!jsView)
  9881. return {};
  9882. jsView = jsView.replace(/^\s*export\s+default/, "");
  9883. jsView = _$2.trim(jsView) || "{}";
  9884. try {
  9885. var json = dist.parse(jsView);
  9886. return modulePage.addViewId(json);
  9887. }
  9888. catch (e) {
  9889. //@ts-ignore
  9890. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9891. }
  9892. }
  9893. function stringToJsonObj(jsonStr) {
  9894. if (!jsonStr)
  9895. return {};
  9896. try {
  9897. return dist.parse(jsonStr);
  9898. }
  9899. catch (e) {
  9900. return {};
  9901. }
  9902. }
  9903. /**
  9904. * 获取view.js 文件 string
  9905. */
  9906. function vjsonTojsView(vjson) {
  9907. var reVjson = _$2.cloneDeep(vjson);
  9908. removeDesignProp(reVjson);
  9909. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9910. }
  9911. var ModuleStore = /** @class */ (function (_super) {
  9912. __extends(ModuleStore, _super);
  9913. function ModuleStore() {
  9914. var _this = _super.call(this) || this;
  9915. _this.store = {};
  9916. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9917. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9918. _this.addModule(id, module, modulePage);
  9919. });
  9920. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9921. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9922. _this.onMainTabChange(moduleId, oldModuleId, from);
  9923. });
  9924. return _this;
  9925. }
  9926. ModuleStore.prototype.getCacheKey = function (param) {
  9927. return "filetree_data.json";
  9928. };
  9929. ModuleStore.prototype.invokeApi = function (param) {
  9930. return moduleTree();
  9931. };
  9932. ModuleStore.prototype.reloadModule = function (id) {
  9933. var moduleObject = this.store[id];
  9934. if (!moduleObject)
  9935. return;
  9936. var module = moduleObject.module;
  9937. getModuleFileContent(module).then(function (_a) {
  9938. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9939. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9940. moduleObject.lastModifyTime = lastModifyTime;
  9941. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9942. // 触发事件 ModuleItemChange
  9943. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9944. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9945. vjson: moduleObject.moduleObj.vjson,
  9946. from: "reloadModule"
  9947. });
  9948. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9949. });
  9950. };
  9951. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9952. var _this = this;
  9953. window['mainWindow'].setLoading(true);
  9954. getModuleFileContent(module)
  9955. .then(function (_a) {
  9956. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9957. var moduleObject = {
  9958. id: id, module: module,
  9959. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9960. lastModifyTime: lastModifyTime,
  9961. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9962. modulePage: modulePage,
  9963. moduleEventBus: modulePage.moduleEventBus
  9964. };
  9965. _this.store[id] = moduleObject;
  9966. // 触发事件 ModuleItemChange
  9967. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9968. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9969. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9970. })
  9971. .finally(function () {
  9972. window['mainWindow'].setLoading(false);
  9973. });
  9974. };
  9975. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9976. if (this.store[moduleId]) {
  9977. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9978. }
  9979. };
  9980. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9981. var moduleObject = this.store[id];
  9982. moduleObject.fileContent.jsController = codeValue;
  9983. };
  9984. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9985. var moduleObject = this.store[id];
  9986. moduleObject.fileContent.jsView = codeValue;
  9987. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9988. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9989. vjson: moduleObject.moduleObj.vjson,
  9990. from: from
  9991. });
  9992. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9993. };
  9994. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9995. var moduleObject = this.store[id];
  9996. moduleObject.fileContent.jsModel = codeValue;
  9997. };
  9998. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9999. var moduleObject = this.store[id];
  10000. moduleObject.fileContent.groovy = codeValue;
  10001. };
  10002. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  10003. var moduleObject = this.store[id];
  10004. moduleObject.fileContent.mybatis = codeValue;
  10005. };
  10006. ModuleStore.prototype.getModuleObject = function (id) {
  10007. return this.store[id];
  10008. };
  10009. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  10010. if (checkFlags[moduleId] === 1) {
  10011. // @ts-ignore
  10012. system.msg("正在检测文件是否有外部修改,请稍后操作");
  10013. }
  10014. eventBus.publish(EventType.StopCheckModule, {});
  10015. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  10016. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  10017. saveFile(fileFullPath, fileContent).then(function (res) {
  10018. if (res.data && res.data.lastModified) {
  10019. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  10020. }
  10021. }).finally(function () {
  10022. eventBus.publish(EventType.RunCheckModule, {});
  10023. });
  10024. };
  10025. ModuleStore.prototype.check = function (moduleId) {
  10026. {
  10027. return;
  10028. }
  10029. };
  10030. return ModuleStore;
  10031. }(CacheStore));
  10032. // ------------------------------------------------------------------------------------------ use
  10033. var moduleStore = new ModuleStore();
  10034. //# sourceMappingURL=ModuleStore.js.map
  10035. var VjsonExchange = /** @class */ (function () {
  10036. function VjsonExchange(vjson) {
  10037. this.pendingSet = true;
  10038. this.vjsonOrigin = _$2.cloneDeep(vjson);
  10039. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  10040. }
  10041. /**
  10042. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  10043. * @param propName
  10044. * @param value
  10045. */
  10046. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10047. if (this.pendingSet) {
  10048. return;
  10049. }
  10050. // selectMode
  10051. // pageSizeOption
  10052. // cellediting_clicksToEdit
  10053. msg$1('' + propName + '=' + value);
  10054. _$2.set(this.vjson, propName, value);
  10055. };
  10056. /**
  10057. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10058. */
  10059. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10060. var _a, _b, _c;
  10061. if (this.pendingSet) {
  10062. return;
  10063. }
  10064. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10065. // 如果不使用默认属性,就直接设定 undefined
  10066. var vs = {
  10067. dataIndex: undefined,
  10068. header: undefined,
  10069. xtype: '',
  10070. width: undefined,
  10071. flex: undefined,
  10072. align: 'start',
  10073. editor: undefined,
  10074. dataType: 'string',
  10075. dict: undefined,
  10076. disabled: false,
  10077. menuDisabled: false,
  10078. notAllowBlank: false,
  10079. filterable: true,
  10080. hidden: false,
  10081. hideable: true,
  10082. resizable: true,
  10083. sortable: true,
  10084. autoSize: true,
  10085. };
  10086. var raw = record.get('raw');
  10087. if (raw === undefined || raw == null) {
  10088. raw = {};
  10089. record.set('raw', raw);
  10090. }
  10091. var setRaw = function (propName, value) {
  10092. if (typeof value === 'undefined' || value == null) {
  10093. msg$1("delete columns[" + rowIdx + "]." + propName);
  10094. delete raw[propName];
  10095. return;
  10096. }
  10097. var defaultValue = vs[propName];
  10098. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10099. // 要设的值,与默认值相同,就直接删除这个属性
  10100. msg$1("delete columns[" + rowIdx + "]." + propName);
  10101. delete raw[propName];
  10102. return;
  10103. }
  10104. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10105. _$2.set(raw, propName, value);
  10106. };
  10107. if (!vs.hasOwnProperty(propName)) {
  10108. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10109. return;
  10110. }
  10111. else if (propName === 'dict') {
  10112. if (value) {
  10113. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10114. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10115. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10116. }
  10117. }
  10118. else {
  10119. setRaw('fix', undefined);
  10120. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10121. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10122. delete raw.editor.fix;
  10123. }
  10124. }
  10125. }
  10126. else if (propName === 'xtype') {
  10127. if (!value) {
  10128. setRaw('xtype', undefined);
  10129. }
  10130. else {
  10131. setRaw('xtype', value);
  10132. }
  10133. }
  10134. else if (propName === 'notAllowBlank') {
  10135. setRaw('editor.allowBlank', !value);
  10136. }
  10137. else if (propName === 'editor') {
  10138. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10139. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10140. value = undefined;
  10141. }
  10142. // editor.xtype
  10143. if (!value) {
  10144. // 不需要编辑器
  10145. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10146. msg$1("delete columns[" + rowIdx + "].editor");
  10147. delete raw.editor;
  10148. record.set('notAllowBlank', false);
  10149. }
  10150. }
  10151. else {
  10152. setRaw('editor.xtype', value);
  10153. var dict = record.get('dict');
  10154. if (value === 'combo' && dict) {
  10155. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10156. }
  10157. }
  10158. }
  10159. else if (propName === 'width') {
  10160. var width = value;
  10161. var flex = record.get('flex');
  10162. if (!width && !flex) {
  10163. setRaw('width', undefined);
  10164. setRaw('flex', undefined);
  10165. record.set('flex', undefined);
  10166. record.set('width', undefined);
  10167. return;
  10168. }
  10169. else if (!!width) {
  10170. setRaw('flex', undefined);
  10171. record.set('flex', undefined);
  10172. setRaw('width', width);
  10173. return;
  10174. }
  10175. }
  10176. else if (propName === 'flex') {
  10177. var width = record.get('width');
  10178. var flex = value;
  10179. if (!width && !flex) {
  10180. setRaw('width', undefined);
  10181. setRaw('flex', undefined);
  10182. record.set('flex', undefined);
  10183. record.set('width', undefined);
  10184. return;
  10185. }
  10186. else if (!!flex) {
  10187. setRaw('width', undefined);
  10188. record.set('width', undefined);
  10189. setRaw('flex', flex);
  10190. return;
  10191. }
  10192. }
  10193. else {
  10194. // 其他属性,作为同名属性,与 raw 同步
  10195. setRaw(propName, value);
  10196. }
  10197. };
  10198. /**
  10199. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10200. */
  10201. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10202. var _this = this;
  10203. var vs = [
  10204. 'reference', 'pagination', 'pageSize',
  10205. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10206. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10207. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10208. 'listeners.beforeselect',
  10209. 'listeners.selectionchange',
  10210. 'listeners.itemclick',
  10211. 'listeners.itemdblclick',
  10212. 'listeners.cellClick',
  10213. 'listeners.celldblclick',
  10214. 'listeners.afterrender',
  10215. 'listeners.destory',
  10216. ];
  10217. _$2.forEach(vs, function (v) {
  10218. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10219. });
  10220. };
  10221. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10222. var me = this;
  10223. return function (value) {
  10224. me.setPropValue(propName, value);
  10225. };
  10226. };
  10227. VjsonExchange.prototype.parseModel = function () {
  10228. var _this = this;
  10229. 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;
  10230. //@ts-ignore
  10231. var df = YvanUI.Defaults.grid;
  10232. var vjson = _$2.assign({}, df, this.vjson);
  10233. var model = {
  10234. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10235. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10236. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10237. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10238. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10239. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10240. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10241. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10242. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10243. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10244. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10245. selectMode: 'spreadsheet',
  10246. cellediting_clicksToEdit: true,
  10247. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10248. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10249. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10250. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10251. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10252. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10253. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10254. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10255. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10256. gridfilters: true,
  10257. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10258. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10259. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10260. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10261. columns: [],
  10262. listeners: {
  10263. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10264. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10265. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10266. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10267. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10268. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10269. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10270. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10271. }
  10272. };
  10273. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10274. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10275. }
  10276. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10277. if (_$2.get(vjson, 'disableSelection') == true) {
  10278. model.selectMode = 'disableSelection';
  10279. }
  10280. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10281. model.selectMode = 'spreadsheet';
  10282. }
  10283. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10284. model.selectMode = 'onlyCheckColumn';
  10285. }
  10286. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10287. model.selectMode = 'checkColumn';
  10288. }
  10289. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10290. model.selectMode = 'row_mulity';
  10291. }
  10292. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10293. model.selectMode = 'row_single';
  10294. }
  10295. else {
  10296. model.selectMode = 'row_single';
  10297. }
  10298. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10299. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10300. model.dataSource = {
  10301. url: _$2.get(vjson, 'dataSource.url'),
  10302. //@ts-ignore
  10303. params: _$2.get(vjson, 'dataSource.params')
  10304. };
  10305. }
  10306. _$2.forEach(vjson.columns, function (column) {
  10307. model.columns.push(_this.parseColumn(column));
  10308. });
  10309. return model;
  10310. };
  10311. VjsonExchange.prototype.parseColumn = function (column) {
  10312. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10313. var model = {
  10314. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10315. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10316. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10317. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10318. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10319. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10320. editor: '',
  10321. editParam: '',
  10322. dict: '',
  10323. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10324. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10325. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10326. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10327. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10328. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10329. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10330. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10331. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10332. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10333. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10334. raw: _$2.cloneDeep(column),
  10335. };
  10336. // width / flex 只能留一个属性, 或者全不留
  10337. if (model.width <= 0 && model.flex <= 0) {
  10338. delete model.width;
  10339. delete model.flex;
  10340. }
  10341. else if (model.width > 0) {
  10342. delete model.flex;
  10343. }
  10344. else {
  10345. delete model.width;
  10346. }
  10347. // editor
  10348. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10349. model.editor = _$2.get(column, 'editor.xtype');
  10350. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10351. if (!model.editor) {
  10352. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10353. model.editor = 'textfield';
  10354. }
  10355. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10356. msg$1('不可识别的 editor.xtype=' + model.editor);
  10357. console.error('不可识别的 editor.xtype', column);
  10358. }
  10359. if (_$2.get(column, 'editor.allowBlank') === false) {
  10360. model.notAllowBlank = true;
  10361. }
  10362. }
  10363. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10364. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10365. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10366. if (match && match[1]) {
  10367. model.dict = match[1];
  10368. }
  10369. }
  10370. return model;
  10371. };
  10372. return VjsonExchange;
  10373. }());
  10374. //
  10375. //# sourceMappingURL=YvgridExchange.js.map
  10376. var YvgridDesign = /** @class */ (function (_super) {
  10377. __extends(YvgridDesign, _super);
  10378. function YvgridDesign(moduleId) {
  10379. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10380. _this.moduleId = '';
  10381. _this.name = 'YvgridDesign';
  10382. _this.dataSourceIsActived = false;
  10383. _this.setModuleId(moduleId);
  10384. return _this;
  10385. }
  10386. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10387. var _this = this;
  10388. this.moduleId = moduleId;
  10389. if (this.componentSelectionChangeSubscribe) {
  10390. this.componentSelectionChangeSubscribe.cancel();
  10391. this.componentSelectionChangeSubscribe = null;
  10392. }
  10393. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10394. var id = _a.id, from = _a.from;
  10395. _this.onComponentSelectionChange(id, from);
  10396. });
  10397. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10398. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10399. if (vj.xtype !== 'yvgrid') {
  10400. throw Error('非 yvgrid 组件');
  10401. }
  10402. this.vjsonExchange = new VjsonExchange(vj);
  10403. };
  10404. YvgridDesign.prototype.onLoad = function () {
  10405. var _this = this;
  10406. var model = this.vjsonExchange.parseModel();
  10407. this.vjsonExchange.pendingSet = true;
  10408. mergeViewModel(this.viewModel, "vjson", model, false);
  10409. this.refs.grid1.setData(model.columns);
  10410. this.vjsonExchange.attachViewModel(this.viewModel);
  10411. _$2.defer(function () {
  10412. _this.vjsonExchange.pendingSet = false;
  10413. });
  10414. };
  10415. YvgridDesign.prototype.moveUp = function (sender) {
  10416. var grid = sender.up('grid');
  10417. grid.rowMoveUp();
  10418. };
  10419. YvgridDesign.prototype.moveDown = function (sender) {
  10420. var grid = sender.up('grid');
  10421. grid.rowMoveDown();
  10422. };
  10423. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10424. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10425. };
  10426. YvgridDesign.prototype.reloadSqlContent = function () {
  10427. var _this = this;
  10428. var url = this.viewModel.get('vjson.dataSource.url');
  10429. if (url) {
  10430. loadSqlContentApi(url).then(function (res) {
  10431. _this.refs.sqlEditor.setCode('');
  10432. if (res.success) {
  10433. _this.refs.sqlEditor.setCode(res.data.content);
  10434. }
  10435. }).catch(function () {
  10436. _this.refs.sqlEditor.setCode('');
  10437. });
  10438. }
  10439. };
  10440. YvgridDesign.prototype.dataSourceSave = function () {
  10441. var url = this.viewModel.get('vjson.dataSource.url');
  10442. if (!url) {
  10443. msg$1('必须填写 groovy/SQL 模块路径');
  10444. return;
  10445. }
  10446. var content = this.refs.sqlEditor.getCode();
  10447. saveSqlContentApi(url, content).then(function (res) {
  10448. if (res.success) {
  10449. msg$1('保存成功');
  10450. }
  10451. else {
  10452. msg$1(res.msg);
  10453. }
  10454. });
  10455. };
  10456. YvgridDesign.prototype.dataSourceActivate = function () {
  10457. if (!this.dataSourceIsActived) {
  10458. // 激活
  10459. this.reloadSqlContent();
  10460. var params = this.viewModel.get('vjson.dataSource.params');
  10461. if (_$2.isObject(params)) {
  10462. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10463. }
  10464. this.dataSourceIsActived = true;
  10465. }
  10466. };
  10467. // 外部控件选择发生改变
  10468. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10469. if (!id || from === this.name) {
  10470. return;
  10471. }
  10472. this.setVjson(id);
  10473. };
  10474. YvgridDesign.prototype.setVjson = function (id) {
  10475. // 找到对应的组件 判断是不是表格
  10476. };
  10477. YvgridDesign.prototype.save = function () {
  10478. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10479. if (this.dataSourceIsActived) {
  10480. var url = this.viewModel.get('vjson.dataSource.url');
  10481. // 解析 params
  10482. var paramsString = this.refs.sqlParams.getCode('');
  10483. var params = undefined;
  10484. if (paramsString) {
  10485. try {
  10486. params = window['YvanUI'].json5.parse(paramsString);
  10487. }
  10488. catch (e) {
  10489. msg$1('dataSource.params 格式非法,请检查');
  10490. return;
  10491. }
  10492. }
  10493. if (typeof params === 'undefined') {
  10494. params = this.viewModel.get('vjson.dataSource.params');
  10495. }
  10496. if (url) {
  10497. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10498. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10499. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10500. }
  10501. else {
  10502. delete this.vjsonExchange.vjson['dataSource'];
  10503. }
  10504. }
  10505. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10506. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10507. from: this.name,
  10508. ignoreRenderUI: false
  10509. });
  10510. };
  10511. YvgridDesign.prototype.saveClose = function () {
  10512. this.save();
  10513. this.close();
  10514. };
  10515. YvgridDesign.prototype.addColumn = function () {
  10516. this.refs.grid1.appendEditRow({
  10517. dataIndex: '',
  10518. header: '',
  10519. xtype: '',
  10520. width: 80,
  10521. align: '',
  10522. editor: '',
  10523. editParam: '',
  10524. dict: '',
  10525. disabled: false,
  10526. notAllowBlank: false,
  10527. menuDisabled: false,
  10528. filterable: false,
  10529. hidden: false,
  10530. hideable: true,
  10531. resizable: true,
  10532. sortable: true,
  10533. locked: false,
  10534. lockable: false,
  10535. autoSize: true,
  10536. raw: undefined,
  10537. }, 'header');
  10538. };
  10539. YvgridDesign.prototype.removeColumn = function () {
  10540. var _this = this;
  10541. var rows = [];
  10542. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10543. rows.push(r);
  10544. });
  10545. _$2.forEach(rows, function (r) {
  10546. _this.refs.grid1.getStore().remove(r);
  10547. });
  10548. };
  10549. YvgridDesign.prototype.calcColumn = function () {
  10550. msg$1('暂未实现');
  10551. };
  10552. YvgridDesign.prototype.onDestroy = function () {
  10553. if (this.componentSelectionChangeSubscribe) {
  10554. this.componentSelectionChangeSubscribe.cancel();
  10555. this.componentSelectionChangeSubscribe = null;
  10556. }
  10557. };
  10558. return YvgridDesign;
  10559. }(Scope));
  10560. //# sourceMappingURL=YvgridDesign.js.map
  10561. // export const idPrefix = "_ds_"
  10562. var _designInstance;
  10563. function setDesignInstance(instance) {
  10564. _designInstance = instance;
  10565. }
  10566. function getDesignInstance() {
  10567. return _designInstance;
  10568. }
  10569. function delegateDragmove(node, source, info) {
  10570. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10571. //@ts-ignore
  10572. _designInstance.dragmove(node, source, info);
  10573. }
  10574. }
  10575. function delegateDragend(node, source, info) {
  10576. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10577. //@ts-ignore
  10578. _designInstance.dragend(node, source, info);
  10579. }
  10580. }
  10581. //# sourceMappingURL=DropHelper.js.map
  10582. var YvanUI$1 = window['YvanUI'];
  10583. var _$1 = window["_"];
  10584. var Ext$1 = window['Ext'];
  10585. var $$1 = window["$"];
  10586. var historySize = 100;
  10587. var ViewDesign = /** @class */ (function () {
  10588. function ViewDesign(moduleId, reference) {
  10589. var _this = this;
  10590. this.name = "ViewDesign";
  10591. this.expandedVjsonObjArray = [];
  10592. // 编辑历史
  10593. this.undoVjsonList = [];
  10594. // 撤销历史
  10595. this.redoVjsonList = [];
  10596. // 订阅事件列表
  10597. this.subscribeList = [];
  10598. // private getOuterCopyValueTimer: any = null
  10599. /**
  10600. * 唯一编号
  10601. */
  10602. this.id = _$1.uniqueId("_dv");
  10603. this.moduleId = moduleId;
  10604. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10605. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10606. this.designReference = reference;
  10607. this.designElement = reference.ariaEl.dom;
  10608. this.$overlay.appendTo(this.designElement);
  10609. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10610. // 添加到撤销
  10611. this.lastVjson = _$1.cloneDeep(this.vjson);
  10612. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10613. event.stopPropagation();
  10614. event.preventDefault();
  10615. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10616. });
  10617. this.$overlay.on('click', '.studio_mask', function (event) {
  10618. event.stopPropagation();
  10619. event.preventDefault();
  10620. _this.clearSelection();
  10621. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10622. _$1.defer(function () {
  10623. _this.$overlay.focus();
  10624. });
  10625. });
  10626. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10627. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10628. this.$overlay.on('copy', this.onCopy.bind(this));
  10629. this.$overlay.on('paste', this.onPaste.bind(this));
  10630. this.$overlay.on('focus', this.onfocus.bind(this));
  10631. // this.$overlay.on('mouseenter', ()=>{
  10632. // clearTimeout(this.getOuterCopyValueTimer);
  10633. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10634. // })
  10635. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10636. _this.onMousemove(event);
  10637. }, 300, { maxWait: 500 }).bind(this));
  10638. window.addEventListener('message', this.onMessageEvent.bind(this));
  10639. this.subscribe();
  10640. setDesignInstance(this);
  10641. }
  10642. // todo ======== 方法 ==========
  10643. ViewDesign.prototype.subscribe = function () {
  10644. var _this = this;
  10645. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10646. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10647. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10648. _this.setVjson(vjson, from, ignoreRenderUI);
  10649. }));
  10650. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10651. var id = _a.id, from = _a.from;
  10652. _this.onComponentSelectionChange(id, from);
  10653. }));
  10654. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10655. var id = _a.id, from = _a.from;
  10656. _this.onComponentDelete(id, from);
  10657. }));
  10658. };
  10659. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10660. if (vjson === void 0) { vjson = this.vjson; }
  10661. if (from === void 0) { from = this.name; }
  10662. this.vjson = vjson;
  10663. if (from !== "undo" && from !== "redo") {
  10664. if (this.undoVjsonList.length >= 100) {
  10665. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10666. }
  10667. this.undoVjsonList.push(this.lastVjson);
  10668. }
  10669. this.lastVjson = _$1.cloneDeep(vjson);
  10670. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10671. };
  10672. /**
  10673. * 覆盖层点击事件
  10674. */
  10675. ViewDesign.prototype.overlayClickFunction = function (event) {
  10676. if (!event.altKey && !event.shiftKey) {
  10677. var target = this.findElByXY(event.clientX, event.clientY);
  10678. if (target) {
  10679. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10680. var extHandle = Ext$1.get(target).component;
  10681. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10682. rect.x = position.x;
  10683. rect.y = position.y;
  10684. this.clearSelection();
  10685. this.appendMaskbox(rect, extHandle.id);
  10686. }
  10687. }
  10688. };
  10689. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10690. if (dragType === void 0) { dragType = ""; }
  10691. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10692. var ele = document.elementsFromPoint(x, y);
  10693. if (ele.length <= 1) {
  10694. return;
  10695. }
  10696. var target = null;
  10697. for (var i = 0; i < ele.length; i++) {
  10698. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10699. 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) {
  10700. switch (dragType) {
  10701. case "cols-container":
  10702. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10703. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10704. target = ele[i];
  10705. }
  10706. break;
  10707. case "col-item":
  10708. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10709. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10710. target = ele[i];
  10711. }
  10712. break;
  10713. case "rows-container":
  10714. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10715. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10716. target = ele[i];
  10717. }
  10718. break;
  10719. case "row-item":
  10720. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10721. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10722. target = ele[i];
  10723. }
  10724. break;
  10725. default:
  10726. target = ele[i];
  10727. break;
  10728. }
  10729. if (target) {
  10730. break;
  10731. }
  10732. }
  10733. }
  10734. return target;
  10735. };
  10736. /**
  10737. * 清空选择项
  10738. */
  10739. ViewDesign.prototype.clearSelection = function () {
  10740. // $(this.designElement).removeClass('selected');
  10741. // // $(this.designElement).find('.selected').removeClass('selected')
  10742. // $(this.designElement).find('.ds_mask')
  10743. // .not('.mask_not_hide')
  10744. // .remove();
  10745. $$1('.studio_mask').remove();
  10746. // $(this.designElement).find('.selected').each(function () {
  10747. // $(this).removeClass('selected');
  10748. // // const extHandle = Ext.get(this).component
  10749. // // if (extHandle) {
  10750. // // extHandle.removeCls('selected')
  10751. // // }
  10752. // })
  10753. };
  10754. /**
  10755. * 添加遮罩层
  10756. */
  10757. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10758. var that = this;
  10759. if (vjsonId) {
  10760. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10761. }
  10762. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10763. // return item === cj.xtype
  10764. // }) >= 0
  10765. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10766. 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>");
  10767. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10768. this.$mask.css({
  10769. position: 'absolute',
  10770. top: top, left: left, width: width, height: height,
  10771. border: '2px dashed #1890ff',
  10772. zIndex: 100,
  10773. });
  10774. this.$mask.appendTo(this.$overlay);
  10775. this.$mask.on("click", ".ds_del", function (e) {
  10776. e.stopPropagation();
  10777. e.preventDefault();
  10778. that.deleteComponent(vjsonId);
  10779. });
  10780. // 点击选中父级
  10781. this.$mask.on('click', '.ds_parent', function (e) {
  10782. e.stopPropagation();
  10783. e.preventDefault();
  10784. that.selectParent(vjsonId);
  10785. });
  10786. var sel = document.getElementById(vjsonId);
  10787. var sVjosn = findInCode(this.vjson, vjsonId);
  10788. // 限制可以拖动的组件
  10789. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10790. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10791. this.dragSource = new Ext$1.drag.Source({
  10792. element: this.$mask[0],
  10793. constrain: this.$overlay[0],
  10794. listeners: {
  10795. dragmove: this.dragmove.bind(that, this.vjson),
  10796. dragend: this.dragend.bind(that, this.vjson)
  10797. },
  10798. startRect: rect,
  10799. sourceVjson: findInCode(this.vjson, vjsonId),
  10800. sourceVjsonId: vjsonId,
  10801. dragType: dragType
  10802. });
  10803. }
  10804. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10805. };
  10806. /**
  10807. * 选中某个选项
  10808. */
  10809. ViewDesign.prototype.setSelection = function (id) {
  10810. var _a, _b;
  10811. if (!this.designElement) {
  10812. return;
  10813. }
  10814. // 清空选中内容
  10815. this.clearSelection();
  10816. if (!id) {
  10817. return;
  10818. }
  10819. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10820. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10821. rect.x = position.x;
  10822. rect.y = position.y;
  10823. this.appendMaskbox(rect, id);
  10824. };
  10825. /**
  10826. * 删除组件
  10827. * @param id
  10828. */
  10829. ViewDesign.prototype.deleteComponent = function (id) {
  10830. deletVjsonById(this.vjson, id);
  10831. this.moduleObject.modulePage.currentComponentSelectId = null;
  10832. this.setVjson();
  10833. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10834. this.clearSelection();
  10835. };
  10836. ViewDesign.prototype.selectParent = function (id) {
  10837. var pid = getSuperVjsonId(this.vjson, id);
  10838. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10839. this.setSelection(pid);
  10840. };
  10841. // todo ====== 拖拽事件 ======
  10842. ViewDesign.prototype.dragmove = function (node, source, info) {
  10843. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10844. if (!target) {
  10845. return;
  10846. }
  10847. var rect = target.getBoundingClientRect();
  10848. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10849. var extHandle = Ext$1.get(target).component;
  10850. if (!extHandle) {
  10851. return;
  10852. }
  10853. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10854. rect.x = position.x;
  10855. rect.y = position.y;
  10856. this.appendDirection(rect, extHandle.id, direction);
  10857. };
  10858. ViewDesign.prototype.dragend = function (node, source, info) {
  10859. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10860. if (!target) {
  10861. return;
  10862. }
  10863. var rect = target.getBoundingClientRect();
  10864. var extHandle = Ext$1.get(target).component;
  10865. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10866. if (!extHandle) {
  10867. return;
  10868. }
  10869. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10870. this.removeDirection();
  10871. };
  10872. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10873. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10874. var cv = findInCode(this.vjson, vjsonId);
  10875. if (this.$direction) {
  10876. $$1('#direction' + this.id).remove();
  10877. }
  10878. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10879. //
  10880. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10881. if (direction) {
  10882. if (direction === "top") {
  10883. // direction = 'center'
  10884. height = height / 4;
  10885. }
  10886. else if (direction === "bottom") {
  10887. // direction = 'center'
  10888. top = top + height / 4 * 3;
  10889. height = height / 4;
  10890. }
  10891. else if (direction === "left") {
  10892. width = width / 4;
  10893. }
  10894. else if (direction === "right") {
  10895. left = left + width / 4 * 3;
  10896. width = width / 4;
  10897. }
  10898. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10899. this.$direction.css({
  10900. position: 'absolute',
  10901. top: top, left: left, width: width, height: height,
  10902. // border: '2px dashed #1890ff',
  10903. background: 'rgba(40,224,218,0.75)',
  10904. zIndex: 100,
  10905. });
  10906. this.$direction.appendTo(this.$overlay);
  10907. // }
  10908. }
  10909. };
  10910. ViewDesign.prototype.removeDirection = function () {
  10911. if (this.$direction) {
  10912. this.$direction.remove();
  10913. this.$direction = null;
  10914. }
  10915. };
  10916. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10917. var arrS;
  10918. if (sourceVjId) {
  10919. arrS = findArrayContainer(this.vjson, sourceVjId);
  10920. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10921. var indexS = _$1.findIndex(arrS, function (v) {
  10922. return v.id === sourceVjId;
  10923. });
  10924. if (indexS < 0) {
  10925. return;
  10926. }
  10927. }
  10928. delete sourceVjson.id;
  10929. var vjsonT = findInCode(this.vjson, targetVjId);
  10930. var arrT = findArrayContainer(this.vjson, targetVjId);
  10931. var indexT = _$1.findIndex(arrT, function (v) {
  10932. return v.id === targetVjId;
  10933. });
  10934. if (indexT < 0) {
  10935. return;
  10936. }
  10937. switch (direction) {
  10938. case 'top':
  10939. case 'left':
  10940. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10941. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10942. vjsonT.items.splice(0, 0, sourceVjson);
  10943. }
  10944. else {
  10945. arrT.splice(indexT, 0, sourceVjson);
  10946. }
  10947. break;
  10948. case 'bottom':
  10949. case 'right':
  10950. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10951. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10952. vjsonT.items.push(sourceVjson);
  10953. }
  10954. else {
  10955. arrT.splice(indexT + 1, 0, sourceVjson);
  10956. }
  10957. break;
  10958. case 'center':
  10959. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10960. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10961. vjsonT.items.push(sourceVjson);
  10962. }
  10963. else {
  10964. arrT.splice(indexT, 1, sourceVjson);
  10965. }
  10966. break;
  10967. }
  10968. if (sourceVjId) {
  10969. deletVjsonById(this.vjson, sourceVjId);
  10970. sourceVjson.id = sourceVjId;
  10971. }
  10972. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10973. };
  10974. // todo ======== 事件 ==========
  10975. // 接收 postMessage 事件分发
  10976. ViewDesign.prototype.onMessageEvent = function (event) {
  10977. var _a, _b;
  10978. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10979. if (fucName && typeof this[fucName] === 'function') {
  10980. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10981. }
  10982. };
  10983. // 接收外部选中组件事件
  10984. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10985. if (from !== this.name) {
  10986. this.setSelection(id);
  10987. }
  10988. };
  10989. // 接收外部组件删除事件
  10990. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10991. if (from !== this.name) {
  10992. this.deleteComponent(id);
  10993. }
  10994. };
  10995. // 组件被选中
  10996. ViewDesign.prototype.onComponentSelect = function (args) {
  10997. if (args[2] != this.moduleId) {
  10998. return;
  10999. }
  11000. if (args[0]) {
  11001. var rect = args[0];
  11002. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11003. rect.x = position.x;
  11004. rect.y = position.y;
  11005. this.clearSelection();
  11006. this.appendMaskbox(rect, args[1]);
  11007. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  11008. }
  11009. };
  11010. ViewDesign.prototype.onComponentInfo = function (_a) {
  11011. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  11012. if (moduleId != this.moduleId) {
  11013. return;
  11014. }
  11015. if (rect) {
  11016. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11017. rect.x = position.x;
  11018. rect.y = position.y;
  11019. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  11020. var cv_1 = findInCode(this.vjson, vjsonId);
  11021. if (this.$direction) {
  11022. $$1('#direction' + this.id).remove();
  11023. }
  11024. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  11025. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  11026. if (direction) {
  11027. if (direction === "top") {
  11028. direction = 'center';
  11029. //height = height/3
  11030. }
  11031. else if (direction === "bottom") {
  11032. direction = 'center';
  11033. // top=top+height/3*2
  11034. // height = height/3
  11035. }
  11036. else if (direction === "left") {
  11037. width = width / 3;
  11038. }
  11039. else if (direction === "right") {
  11040. left = left + width / 3 * 2;
  11041. width = width / 3;
  11042. }
  11043. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11044. this.$direction.css({
  11045. position: 'absolute',
  11046. top: top, left: left, width: width, height: height,
  11047. // border: '2px dashed #1890ff',
  11048. background: 'rgba(74,106,201,0.42)',
  11049. zIndex: 100,
  11050. });
  11051. this.$direction.appendTo(this.$overlay);
  11052. }
  11053. }
  11054. console.log("direction", direction);
  11055. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11056. // rect.x = position.x
  11057. // rect.y = position.y
  11058. // this.clearSelection()
  11059. // this.appendMaskbox(rect, args[1])
  11060. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11061. }
  11062. };
  11063. ViewDesign.prototype.onUndo = function () {
  11064. if (this.undoVjsonList.length > 0) {
  11065. if (this.redoVjsonList.length >= 100) {
  11066. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11067. }
  11068. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11069. this.vjson = this.undoVjsonList.pop();
  11070. // this.setVjson(this.vjson, "", false, "undo")
  11071. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11072. }
  11073. };
  11074. ViewDesign.prototype.onRedo = function () {
  11075. if (this.redoVjsonList.length > 0) {
  11076. if (this.undoVjsonList.length >= 100) {
  11077. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11078. }
  11079. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11080. this.vjson = this.redoVjsonList.pop();
  11081. // this.setVjson(this.vjson, "", false, "redo")
  11082. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11083. }
  11084. };
  11085. ViewDesign.prototype.onKeyPress = function (event) {
  11086. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11087. // if (this.backStep()) {
  11088. // event.stopPropagation()
  11089. // event.preventDefault()
  11090. // return
  11091. // }
  11092. // }
  11093. //
  11094. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11095. // if (this.recoverStep()) {
  11096. // event.stopPropagation()
  11097. // event.preventDefault()
  11098. // return
  11099. // }
  11100. // }
  11101. // if (event.key === 'ArrowUp') {
  11102. // if (this.selectParent()) {
  11103. // event.stopPropagation()
  11104. // event.preventDefault()
  11105. // return;
  11106. // }
  11107. // }
  11108. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11109. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11110. event.stopPropagation();
  11111. event.preventDefault();
  11112. return;
  11113. }
  11114. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11115. // if (this.copyView()) {
  11116. // event.stopPropagation()
  11117. // event.preventDefault()
  11118. // return;
  11119. // }
  11120. // }
  11121. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11122. // if (this.copyView(true)) {
  11123. // event.stopPropagation()
  11124. // event.preventDefault()
  11125. // return;
  11126. // }
  11127. // }
  11128. //
  11129. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11130. // if (this.selectRoot()) {
  11131. // event.stopPropagation()
  11132. // event.preventDefault()
  11133. // return;
  11134. // }
  11135. //
  11136. };
  11137. ViewDesign.prototype.onCopy = function (event) {
  11138. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11139. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11140. if (copyVjson) {
  11141. removeDesignProp(copyVjson);
  11142. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11143. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11144. }
  11145. }
  11146. };
  11147. ViewDesign.prototype.onPaste = function (event) {
  11148. debugger;
  11149. };
  11150. ViewDesign.prototype.onfocus = function () {
  11151. console.log("getCopy");
  11152. console.log("document.activeElement", document.activeElement.id);
  11153. // clearTimeout(this.getOuterCopyValueTimer);
  11154. // native.clipboardRead()
  11155. };
  11156. ViewDesign.prototype.onMousemove = function (event) {
  11157. var _a;
  11158. if (document.activeElement.id === this.$overlay[0].id) {
  11159. // console.log(event.clientX, event.clientY)
  11160. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11161. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11162. // this.iframeWindow.postMessage({
  11163. // method: 'overlayGetInfo',
  11164. // args: [position, this.moduleId]
  11165. // }, '*')
  11166. }
  11167. }
  11168. };
  11169. ViewDesign.prototype.onDestroy = function () {
  11170. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11171. for (var i = 0; i < this.subscribeList.length; i++) {
  11172. this.subscribeList[i].cancel();
  11173. }
  11174. };
  11175. // todo ======== 工具方法 ==========
  11176. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11177. if (relative === void 0) { relative = null; }
  11178. if (from === "main" && to === "overlay") {
  11179. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11180. var x = overlayRect.x;
  11181. var y = overlayRect.y;
  11182. if (relative) {
  11183. var relativeRect = relative.getBoundingClientRect();
  11184. console.log("main->", relativeRect.x, relativeRect.y);
  11185. x = x - relativeRect.x;
  11186. y = y - relativeRect.y;
  11187. }
  11188. pos.x = pos.x - x;
  11189. pos.y = pos.y - y;
  11190. }
  11191. else if (from === "overlay" && to === "main") {
  11192. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11193. var x = overlayRect.x;
  11194. var y = overlayRect.y;
  11195. if (relative) {
  11196. var relativeRect = relative.getBoundingClientRect();
  11197. console.log("iframe->", relativeRect.x, relativeRect.y);
  11198. x = x - relativeRect.x;
  11199. y = y - relativeRect.y;
  11200. }
  11201. pos.x = pos.x + x;
  11202. pos.y = pos.y + y;
  11203. }
  11204. return pos;
  11205. };
  11206. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11207. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11208. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11209. return "center";
  11210. }
  11211. // col-item 只能放左右
  11212. if (dragType === "col-item" || dragType === "") {
  11213. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11214. if (x > rect.x && x < rect.x + rect.width / 3) {
  11215. return "left";
  11216. }
  11217. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11218. return "right";
  11219. }
  11220. }
  11221. }
  11222. // cols-container 只能放上下
  11223. if (dragType === "cols-container" || dragType === "") {
  11224. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11225. if (y > rect.y && y < rect.y + rect.height / 3) {
  11226. return "top";
  11227. }
  11228. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11229. return "bottom";
  11230. }
  11231. }
  11232. }
  11233. return "";
  11234. };
  11235. return ViewDesign;
  11236. }());
  11237. //
  11238. //# sourceMappingURL=ViewDesign.js.map
  11239. var model$8 = {
  11240. data: {
  11241. iframeSrc: ''
  11242. }
  11243. };
  11244. //# sourceMappingURL=ModulePage.model.js.map
  11245. var vjson$8 = {
  11246. layout: 'fit',
  11247. border: false,
  11248. iconCls: 'x-fa fa-newspaper-o',
  11249. referenceHolder: true,
  11250. items: [
  11251. {
  11252. layout: 'border',
  11253. border: false,
  11254. items: [
  11255. {
  11256. region: 'center',
  11257. xtype: 'tabpanel',
  11258. border: false,
  11259. tabPosition: 'bottom',
  11260. reference: 'tabPanel',
  11261. listeners: {
  11262. tabchange: 'scope.tabchange'
  11263. },
  11264. defaults: {
  11265. border: false,
  11266. },
  11267. items: [
  11268. {
  11269. title: 'controller.js',
  11270. xtype: 'jseditor',
  11271. reference: 'controllerEditor',
  11272. },
  11273. {
  11274. title: 'view.design',
  11275. xtype: 'designer',
  11276. reference: 'designer',
  11277. listeners: {
  11278. afterrender: 'scope.previewRender'
  11279. },
  11280. },
  11281. {
  11282. title: 'view.js',
  11283. xtype: 'jseditor',
  11284. reference: 'viewEditor',
  11285. },
  11286. {
  11287. title: 'model.js',
  11288. xtype: 'jseditor',
  11289. reference: 'modelEditor',
  11290. },
  11291. {
  11292. title: 'groovy',
  11293. xtype: 'groovyeditor',
  11294. reference: 'groovyEditor',
  11295. },
  11296. {
  11297. title: 'SQL',
  11298. xtype: 'sqleditor',
  11299. reference: 'sqlEditor',
  11300. }
  11301. ]
  11302. }
  11303. ]
  11304. }
  11305. ]
  11306. };
  11307. //# sourceMappingURL=ModulePage.view.js.map
  11308. var ModulePage = /** @class */ (function (_super) {
  11309. __extends(ModulePage, _super);
  11310. function ModulePage(moduleId, module) {
  11311. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11312. _this.name = "ModulePage";
  11313. _this.viewDesign = null;
  11314. _this.maxViewId = 0;
  11315. _this.moduleEventBus = new EventBus();
  11316. _this.codeChange = _$2.debounce(function (code, from, e) {
  11317. try {
  11318. switch (from) {
  11319. case _this.refs.controllerEditor.name:
  11320. moduleStore.updateJsController(_this.moduleId, code, from);
  11321. break;
  11322. case _this.refs.viewEditor.name:
  11323. moduleStore.updateJsView(_this.moduleId, code, from);
  11324. break;
  11325. case _this.refs.modelEditor.name:
  11326. moduleStore.updateJsModel(_this.moduleId, code, from);
  11327. break;
  11328. case _this.refs.groovyEditor.name:
  11329. moduleStore.updateGroovy(_this.moduleId, code, from);
  11330. break;
  11331. case _this.refs.sqlEditor.name:
  11332. moduleStore.updateMybatis(_this.moduleId, code, from);
  11333. break;
  11334. }
  11335. }
  11336. catch (e) {
  11337. }
  11338. }, 500, { maxWait: 10000 });
  11339. _this.moduleId = moduleId;
  11340. _this.module = module;
  11341. _this.cancelSubscribe = [];
  11342. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11343. _this.initEditor(moduleItem);
  11344. }));
  11345. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11346. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11347. _this.previewReRender();
  11348. }));
  11349. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11350. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11351. _this.updateVjson(vjson, from, ignoreRenderUI);
  11352. }));
  11353. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11354. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11355. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11356. }));
  11357. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11358. var id = _a.id, from = _a.from;
  11359. _this.onComponentSelectionChange(id, from);
  11360. }));
  11361. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11362. _this.onUndo();
  11363. }));
  11364. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11365. _this.onRedo();
  11366. }));
  11367. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11368. _this.currentCopyVjson = stringToJsonObj(value);
  11369. }));
  11370. return _this;
  11371. }
  11372. ModulePage.prototype.onLoad = function () {
  11373. var _this = this;
  11374. // this.refs.preview.src = href
  11375. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11376. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11377. _this.saveCall();
  11378. }));
  11379. this.activeEditor = this.refs.controllerEditor;
  11380. this.refs.controllerEditor.modulePage = this;
  11381. this.refs.viewEditor.modulePage = this;
  11382. this.refs.modelEditor.modulePage = this;
  11383. this.refs.groovyEditor.modulePage = this;
  11384. this.refs.sqlEditor.modulePage = this;
  11385. this.refs.controllerEditor.name = "controllerEditor";
  11386. this.refs.viewEditor.name = "viewEditor";
  11387. this.refs.modelEditor.name = "modelEditor";
  11388. this.refs.groovyEditor.name = "groovyEditor";
  11389. this.refs.sqlEditor.name = "sqlEditor";
  11390. this.refs.controllerEditor.codeChange = this.codeChange;
  11391. this.refs.viewEditor.codeChange = this.codeChange;
  11392. this.refs.modelEditor.codeChange = this.codeChange;
  11393. this.refs.groovyEditor.codeChange = this.codeChange;
  11394. this.refs.sqlEditor.codeChange = this.codeChange;
  11395. };
  11396. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11397. if (!cmpVjson || from === this.name) {
  11398. return;
  11399. }
  11400. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11401. replaceVjsonById(vj, cmpVjson);
  11402. this.updateVjson(vj, from, ignoreRenderUI);
  11403. };
  11404. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11405. var _this = this;
  11406. var _a, _b;
  11407. if (!vjson || from === this.name) {
  11408. return;
  11409. }
  11410. this.addViewId(vjson);
  11411. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11412. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11413. (_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);
  11414. this.previewReRender();
  11415. _$2.defer(function () {
  11416. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11417. });
  11418. };
  11419. ModulePage.prototype.previewRender = function (sender) {
  11420. var _this = this;
  11421. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11422. if (!this.designScope) {
  11423. this.designScope = new Scope({
  11424. vjson: vjson,
  11425. model: {
  11426. data: {}
  11427. }
  11428. });
  11429. }
  11430. else {
  11431. this.designScope.vjson = vjson;
  11432. }
  11433. this.designScope.showDesigner(sender, {
  11434. moduleId: this.moduleId,
  11435. });
  11436. if (this.viewDesign) {
  11437. return;
  11438. }
  11439. _$2.defer(function () {
  11440. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11441. handles$1.mainWindow.setLoading(false);
  11442. });
  11443. };
  11444. ModulePage.prototype.previewReRender = function () {
  11445. var designer = this.refs.designer;
  11446. this.previewRender(designer);
  11447. };
  11448. ModulePage.prototype.initEditor = function (moduleItem) {
  11449. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11450. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11451. return;
  11452. (_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);
  11453. (_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);
  11454. (_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);
  11455. (_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);
  11456. (_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);
  11457. };
  11458. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11459. this.currentComponentSelectId = id;
  11460. };
  11461. ModulePage.prototype.onUndo = function () {
  11462. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11463. this.viewDesign.onUndo();
  11464. }
  11465. };
  11466. ModulePage.prototype.onRedo = function () {
  11467. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11468. this.viewDesign.onRedo();
  11469. }
  11470. };
  11471. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11472. this.activeEditor = newCard;
  11473. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11474. };
  11475. ModulePage.prototype.saveCall = function () {
  11476. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11477. moduleStore.saveFile(this.moduleId, "jsView");
  11478. }
  11479. else if (this.activeEditor === this.refs.controllerEditor) {
  11480. moduleStore.saveFile(this.moduleId, "jsController");
  11481. }
  11482. else if (this.activeEditor === this.refs.modelEditor) {
  11483. moduleStore.saveFile(this.moduleId, "jsModel");
  11484. }
  11485. else if (this.activeEditor === this.refs.groovyEditor) {
  11486. moduleStore.saveFile(this.moduleId, "groovy");
  11487. }
  11488. else if (this.activeEditor === this.refs.sqlEditor) {
  11489. moduleStore.saveFile(this.moduleId, "mybatis");
  11490. }
  11491. };
  11492. ModulePage.prototype.check = function () {
  11493. moduleStore.check(this.moduleId);
  11494. };
  11495. /**
  11496. * 为vjson添加id
  11497. * @param vjson
  11498. * @param isAll
  11499. */
  11500. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11501. var _this = this;
  11502. if (isAll === void 0) { isAll = false; }
  11503. var maxIdTag = 0;
  11504. // 先提取当前的最大id
  11505. deepTravVJson(vjson, function (obj) {
  11506. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11507. return;
  11508. }
  11509. if (obj.id && obj.id.indexOf(idPrefix)) {
  11510. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11511. if (sutr.length > 0) {
  11512. var tid = sutr.replace(idPrefix, "");
  11513. var idNum = parseInt(tid);
  11514. if (idNum && maxIdTag < idNum) {
  11515. maxIdTag = idNum;
  11516. }
  11517. }
  11518. }
  11519. });
  11520. // 标记最大的id号,避免重复
  11521. this.maxViewId = maxIdTag;
  11522. deepTravVJson(vjson, function (obj) {
  11523. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11524. return;
  11525. }
  11526. if (!obj.hasOwnProperty('id')) {
  11527. obj.id = _this.createViewId();
  11528. }
  11529. if (!obj.hasOwnProperty('designMode')) {
  11530. obj.designMode = true;
  11531. }
  11532. // if (obj.xtype == "tabview" && obj.activeTab) {
  11533. // // 设置默认的选项
  11534. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11535. // if (typeof obj.activeTab === 'number') {
  11536. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11537. // } else if (typeof obj.activeTab === 'string') {
  11538. // this._tabViewSelect[obj.id] = obj.activeTab
  11539. // }
  11540. //
  11541. // }
  11542. // }
  11543. if (isAll && obj.hasOwnProperty("view")) ;
  11544. });
  11545. return vjson;
  11546. };
  11547. /**
  11548. * 为组件创建 ID
  11549. */
  11550. ModulePage.prototype.createViewId = function () {
  11551. this.maxViewId++;
  11552. return this.id + idPrefix + this.maxViewId;
  11553. };
  11554. ModulePage.prototype.onDestroy = function () {
  11555. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11556. this.cancelSubscribe[i].cancel();
  11557. }
  11558. _super.prototype.onDestroy.call(this);
  11559. };
  11560. return ModulePage;
  11561. }(Scope));
  11562. //# sourceMappingURL=ModulePage.js.map
  11563. var camundaModdleDescriptor = {
  11564. "name": "Camunda",
  11565. "uri": "http://camunda.org/schema/1.0/bpmn",
  11566. "prefix": "camunda",
  11567. "xml": {
  11568. "tagAlias": "lowerCase"
  11569. },
  11570. "associations": [],
  11571. "types": [
  11572. {
  11573. "name": "Definitions",
  11574. "isAbstract": true,
  11575. "extends": [
  11576. "bpmn:Definitions"
  11577. ],
  11578. "properties": [
  11579. {
  11580. "name": "diagramRelationId",
  11581. "isAttr": true,
  11582. "type": "String"
  11583. }
  11584. ]
  11585. },
  11586. {
  11587. "name": "InOutBinding",
  11588. "superClass": [
  11589. "Element"
  11590. ],
  11591. "isAbstract": true,
  11592. "properties": [
  11593. {
  11594. "name": "source",
  11595. "isAttr": true,
  11596. "type": "String"
  11597. },
  11598. {
  11599. "name": "sourceExpression",
  11600. "isAttr": true,
  11601. "type": "String"
  11602. },
  11603. {
  11604. "name": "target",
  11605. "isAttr": true,
  11606. "type": "String"
  11607. },
  11608. {
  11609. "name": "businessKey",
  11610. "isAttr": true,
  11611. "type": "String"
  11612. },
  11613. {
  11614. "name": "local",
  11615. "isAttr": true,
  11616. "type": "Boolean",
  11617. "default": false
  11618. },
  11619. {
  11620. "name": "variables",
  11621. "isAttr": true,
  11622. "type": "String"
  11623. }
  11624. ]
  11625. },
  11626. {
  11627. "name": "In",
  11628. "superClass": [
  11629. "InOutBinding"
  11630. ],
  11631. "meta": {
  11632. "allowedIn": [
  11633. "bpmn:CallActivity",
  11634. "bpmn:SignalEventDefinition"
  11635. ]
  11636. }
  11637. },
  11638. {
  11639. "name": "Out",
  11640. "superClass": [
  11641. "InOutBinding"
  11642. ],
  11643. "meta": {
  11644. "allowedIn": [
  11645. "bpmn:CallActivity"
  11646. ]
  11647. }
  11648. },
  11649. {
  11650. "name": "AsyncCapable",
  11651. "isAbstract": true,
  11652. "extends": [
  11653. "bpmn:Activity",
  11654. "bpmn:Gateway",
  11655. "bpmn:Event"
  11656. ],
  11657. "properties": [
  11658. {
  11659. "name": "async",
  11660. "isAttr": true,
  11661. "type": "Boolean",
  11662. "default": false
  11663. },
  11664. {
  11665. "name": "asyncBefore",
  11666. "isAttr": true,
  11667. "type": "Boolean",
  11668. "default": false
  11669. },
  11670. {
  11671. "name": "asyncAfter",
  11672. "isAttr": true,
  11673. "type": "Boolean",
  11674. "default": false
  11675. },
  11676. {
  11677. "name": "exclusive",
  11678. "isAttr": true,
  11679. "type": "Boolean",
  11680. "default": true
  11681. }
  11682. ]
  11683. },
  11684. {
  11685. "name": "JobPriorized",
  11686. "isAbstract": true,
  11687. "extends": [
  11688. "bpmn:Process",
  11689. "camunda:AsyncCapable"
  11690. ],
  11691. "properties": [
  11692. {
  11693. "name": "jobPriority",
  11694. "isAttr": true,
  11695. "type": "String"
  11696. }
  11697. ]
  11698. },
  11699. {
  11700. "name": "SignalEventDefinitionExtension",
  11701. "isAbstract": true,
  11702. "extends": [
  11703. "bpmn:SignalEventDefinition"
  11704. ],
  11705. "properties": [
  11706. {
  11707. "name": "async",
  11708. "isAttr": true,
  11709. "type": "Boolean",
  11710. "default": false
  11711. }
  11712. ]
  11713. },
  11714. {
  11715. "name": "ErrorEventDefinitionExtension",
  11716. "isAbstract": true,
  11717. "extends": [
  11718. "bpmn:ErrorEventDefinition"
  11719. ],
  11720. "properties": [
  11721. {
  11722. "name": "errorCodeVariable",
  11723. "isAttr": true,
  11724. "type": "String"
  11725. },
  11726. {
  11727. "name": "errorMessageVariable",
  11728. "isAttr": true,
  11729. "type": "String"
  11730. }
  11731. ]
  11732. },
  11733. {
  11734. "name": "ErrorEventDefinition",
  11735. "superClass": [
  11736. "bpmn:ErrorEventDefinition",
  11737. "Element"
  11738. ],
  11739. "properties": [
  11740. {
  11741. "name": "expression",
  11742. "isAttr": true,
  11743. "type": "String"
  11744. }
  11745. ],
  11746. "meta": {
  11747. "allowedIn": ["bpmn:ServiceTask"]
  11748. }
  11749. },
  11750. {
  11751. "name": "Error",
  11752. "isAbstract": true,
  11753. "extends": [
  11754. "bpmn:Error"
  11755. ],
  11756. "properties": [
  11757. {
  11758. "name": "camunda:errorMessage",
  11759. "isAttr": true,
  11760. "type": "String"
  11761. }
  11762. ]
  11763. },
  11764. {
  11765. "name": "PotentialStarter",
  11766. "superClass": [
  11767. "Element"
  11768. ],
  11769. "properties": [
  11770. {
  11771. "name": "resourceAssignmentExpression",
  11772. "type": "bpmn:ResourceAssignmentExpression"
  11773. }
  11774. ]
  11775. },
  11776. {
  11777. "name": "FormSupported",
  11778. "isAbstract": true,
  11779. "extends": [
  11780. "bpmn:StartEvent",
  11781. "bpmn:UserTask"
  11782. ],
  11783. "properties": [
  11784. {
  11785. "name": "formHandlerClass",
  11786. "isAttr": true,
  11787. "type": "String"
  11788. },
  11789. {
  11790. "name": "formKey",
  11791. "isAttr": true,
  11792. "type": "String"
  11793. },
  11794. {
  11795. "name": "formRef",
  11796. "isAttr": true,
  11797. "type": "String"
  11798. },
  11799. {
  11800. "name": "formRefBinding",
  11801. "isAttr": true,
  11802. "type": "String"
  11803. },
  11804. {
  11805. "name": "formRefVersion",
  11806. "isAttr": true,
  11807. "type": "String"
  11808. }
  11809. ]
  11810. },
  11811. {
  11812. "name": "TemplateSupported",
  11813. "isAbstract": true,
  11814. "extends": [
  11815. "bpmn:Collaboration",
  11816. "bpmn:Process",
  11817. "bpmn:FlowElement"
  11818. ],
  11819. "properties": [
  11820. {
  11821. "name": "modelerTemplate",
  11822. "isAttr": true,
  11823. "type": "String"
  11824. },
  11825. {
  11826. "name": "modelerTemplateVersion",
  11827. "isAttr": true,
  11828. "type": "Integer"
  11829. }
  11830. ]
  11831. },
  11832. {
  11833. "name": "Initiator",
  11834. "isAbstract": true,
  11835. "extends": ["bpmn:StartEvent"],
  11836. "properties": [
  11837. {
  11838. "name": "initiator",
  11839. "isAttr": true,
  11840. "type": "String"
  11841. }
  11842. ]
  11843. },
  11844. {
  11845. "name": "ScriptTask",
  11846. "isAbstract": true,
  11847. "extends": [
  11848. "bpmn:ScriptTask"
  11849. ],
  11850. "properties": [
  11851. {
  11852. "name": "resultVariable",
  11853. "isAttr": true,
  11854. "type": "String"
  11855. },
  11856. {
  11857. "name": "resource",
  11858. "isAttr": true,
  11859. "type": "String"
  11860. }
  11861. ]
  11862. },
  11863. {
  11864. "name": "Process",
  11865. "isAbstract": true,
  11866. "extends": [
  11867. "bpmn:Process"
  11868. ],
  11869. "properties": [
  11870. {
  11871. "name": "candidateStarterGroups",
  11872. "isAttr": true,
  11873. "type": "String"
  11874. },
  11875. {
  11876. "name": "candidateStarterUsers",
  11877. "isAttr": true,
  11878. "type": "String"
  11879. },
  11880. {
  11881. "name": "versionTag",
  11882. "isAttr": true,
  11883. "type": "String"
  11884. },
  11885. {
  11886. "name": "historyTimeToLive",
  11887. "isAttr": true,
  11888. "type": "String"
  11889. },
  11890. {
  11891. "name": "isStartableInTasklist",
  11892. "isAttr": true,
  11893. "type": "Boolean",
  11894. "default": true
  11895. }
  11896. ]
  11897. },
  11898. {
  11899. "name": "EscalationEventDefinitionExtension",
  11900. "isAbstract": true,
  11901. "extends": [
  11902. "bpmn:EscalationEventDefinition"
  11903. ],
  11904. "properties": [
  11905. {
  11906. "name": "escalationCodeVariable",
  11907. "isAttr": true,
  11908. "type": "String"
  11909. }
  11910. ]
  11911. },
  11912. {
  11913. "name": "FormalExpression",
  11914. "isAbstract": true,
  11915. "extends": [
  11916. "bpmn:FormalExpression"
  11917. ],
  11918. "properties": [
  11919. {
  11920. "name": "resource",
  11921. "isAttr": true,
  11922. "type": "String"
  11923. }
  11924. ]
  11925. },
  11926. {
  11927. "name": "Assignable",
  11928. "extends": ["bpmn:UserTask"],
  11929. "properties": [
  11930. {
  11931. "name": "assignee",
  11932. "isAttr": true,
  11933. "type": "String"
  11934. },
  11935. {
  11936. "name": "candidateUsers",
  11937. "isAttr": true,
  11938. "type": "String"
  11939. },
  11940. {
  11941. "name": "candidateGroups",
  11942. "isAttr": true,
  11943. "type": "String"
  11944. },
  11945. {
  11946. "name": "dueDate",
  11947. "isAttr": true,
  11948. "type": "String"
  11949. },
  11950. {
  11951. "name": "followUpDate",
  11952. "isAttr": true,
  11953. "type": "String"
  11954. },
  11955. {
  11956. "name": "priority",
  11957. "isAttr": true,
  11958. "type": "String"
  11959. }
  11960. ]
  11961. },
  11962. {
  11963. "name": "CallActivity",
  11964. "extends": ["bpmn:CallActivity"],
  11965. "properties": [
  11966. {
  11967. "name": "calledElementBinding",
  11968. "isAttr": true,
  11969. "type": "String",
  11970. "default": "latest"
  11971. },
  11972. {
  11973. "name": "calledElementVersion",
  11974. "isAttr": true,
  11975. "type": "String"
  11976. },
  11977. {
  11978. "name": "calledElementVersionTag",
  11979. "isAttr": true,
  11980. "type": "String"
  11981. },
  11982. {
  11983. "name": "calledElementTenantId",
  11984. "isAttr": true,
  11985. "type": "String"
  11986. },
  11987. {
  11988. "name": "caseRef",
  11989. "isAttr": true,
  11990. "type": "String"
  11991. },
  11992. {
  11993. "name": "caseBinding",
  11994. "isAttr": true,
  11995. "type": "String",
  11996. "default": "latest"
  11997. },
  11998. {
  11999. "name": "caseVersion",
  12000. "isAttr": true,
  12001. "type": "String"
  12002. },
  12003. {
  12004. "name": "caseTenantId",
  12005. "isAttr": true,
  12006. "type": "String"
  12007. },
  12008. {
  12009. "name": "variableMappingClass",
  12010. "isAttr": true,
  12011. "type": "String"
  12012. },
  12013. {
  12014. "name": "variableMappingDelegateExpression",
  12015. "isAttr": true,
  12016. "type": "String"
  12017. }
  12018. ]
  12019. },
  12020. {
  12021. "name": "ServiceTaskLike",
  12022. "extends": [
  12023. "bpmn:ServiceTask",
  12024. "bpmn:BusinessRuleTask",
  12025. "bpmn:SendTask",
  12026. "bpmn:MessageEventDefinition"
  12027. ],
  12028. "properties": [
  12029. {
  12030. "name": "expression",
  12031. "isAttr": true,
  12032. "type": "String"
  12033. },
  12034. {
  12035. "name": "class",
  12036. "isAttr": true,
  12037. "type": "String"
  12038. },
  12039. {
  12040. "name": "delegateExpression",
  12041. "isAttr": true,
  12042. "type": "String"
  12043. },
  12044. {
  12045. "name": "resultVariable",
  12046. "isAttr": true,
  12047. "type": "String"
  12048. }
  12049. ]
  12050. },
  12051. {
  12052. "name": "DmnCapable",
  12053. "extends": [
  12054. "bpmn:BusinessRuleTask"
  12055. ],
  12056. "properties": [
  12057. {
  12058. "name": "decisionRef",
  12059. "isAttr": true,
  12060. "type": "String"
  12061. },
  12062. {
  12063. "name": "decisionRefBinding",
  12064. "isAttr": true,
  12065. "type": "String",
  12066. "default": "latest"
  12067. },
  12068. {
  12069. "name": "decisionRefVersion",
  12070. "isAttr": true,
  12071. "type": "String"
  12072. },
  12073. {
  12074. "name": "mapDecisionResult",
  12075. "isAttr": true,
  12076. "type": "String",
  12077. "default": "resultList"
  12078. },
  12079. {
  12080. "name": "decisionRefTenantId",
  12081. "isAttr": true,
  12082. "type": "String"
  12083. }
  12084. ]
  12085. },
  12086. {
  12087. "name": "ExternalCapable",
  12088. "extends": [
  12089. "camunda:ServiceTaskLike"
  12090. ],
  12091. "properties": [
  12092. {
  12093. "name": "type",
  12094. "isAttr": true,
  12095. "type": "String"
  12096. },
  12097. {
  12098. "name": "topic",
  12099. "isAttr": true,
  12100. "type": "String"
  12101. }
  12102. ]
  12103. },
  12104. {
  12105. "name": "TaskPriorized",
  12106. "extends": [
  12107. "bpmn:Process",
  12108. "camunda:ExternalCapable"
  12109. ],
  12110. "properties": [
  12111. {
  12112. "name": "taskPriority",
  12113. "isAttr": true,
  12114. "type": "String"
  12115. }
  12116. ]
  12117. },
  12118. {
  12119. "name": "Properties",
  12120. "superClass": [
  12121. "Element"
  12122. ],
  12123. "meta": {
  12124. "allowedIn": ["*"]
  12125. },
  12126. "properties": [
  12127. {
  12128. "name": "values",
  12129. "type": "Property",
  12130. "isMany": true
  12131. }
  12132. ]
  12133. },
  12134. {
  12135. "name": "Property",
  12136. "superClass": [
  12137. "Element"
  12138. ],
  12139. "properties": [
  12140. {
  12141. "name": "id",
  12142. "type": "String",
  12143. "isAttr": true
  12144. },
  12145. {
  12146. "name": "name",
  12147. "type": "String",
  12148. "isAttr": true
  12149. },
  12150. {
  12151. "name": "value",
  12152. "type": "String",
  12153. "isAttr": true
  12154. }
  12155. ]
  12156. },
  12157. {
  12158. "name": "Connector",
  12159. "superClass": [
  12160. "Element"
  12161. ],
  12162. "meta": {
  12163. "allowedIn": [
  12164. "camunda:ServiceTaskLike"
  12165. ]
  12166. },
  12167. "properties": [
  12168. {
  12169. "name": "inputOutput",
  12170. "type": "InputOutput"
  12171. },
  12172. {
  12173. "name": "connectorId",
  12174. "type": "String"
  12175. }
  12176. ]
  12177. },
  12178. {
  12179. "name": "InputOutput",
  12180. "superClass": [
  12181. "Element"
  12182. ],
  12183. "meta": {
  12184. "allowedIn": [
  12185. "bpmn:FlowNode",
  12186. "camunda:Connector"
  12187. ]
  12188. },
  12189. "properties": [
  12190. {
  12191. "name": "inputOutput",
  12192. "type": "InputOutput"
  12193. },
  12194. {
  12195. "name": "connectorId",
  12196. "type": "String"
  12197. },
  12198. {
  12199. "name": "inputParameters",
  12200. "isMany": true,
  12201. "type": "InputParameter"
  12202. },
  12203. {
  12204. "name": "outputParameters",
  12205. "isMany": true,
  12206. "type": "OutputParameter"
  12207. }
  12208. ]
  12209. },
  12210. {
  12211. "name": "InputOutputParameter",
  12212. "properties": [
  12213. {
  12214. "name": "name",
  12215. "isAttr": true,
  12216. "type": "String"
  12217. },
  12218. {
  12219. "name": "value",
  12220. "isBody": true,
  12221. "type": "String"
  12222. },
  12223. {
  12224. "name": "definition",
  12225. "type": "InputOutputParameterDefinition"
  12226. }
  12227. ]
  12228. },
  12229. {
  12230. "name": "InputOutputParameterDefinition",
  12231. "isAbstract": true
  12232. },
  12233. {
  12234. "name": "List",
  12235. "superClass": ["InputOutputParameterDefinition"],
  12236. "properties": [
  12237. {
  12238. "name": "items",
  12239. "isMany": true,
  12240. "type": "InputOutputParameterDefinition"
  12241. }
  12242. ]
  12243. },
  12244. {
  12245. "name": "Map",
  12246. "superClass": ["InputOutputParameterDefinition"],
  12247. "properties": [
  12248. {
  12249. "name": "entries",
  12250. "isMany": true,
  12251. "type": "Entry"
  12252. }
  12253. ]
  12254. },
  12255. {
  12256. "name": "Entry",
  12257. "properties": [
  12258. {
  12259. "name": "key",
  12260. "isAttr": true,
  12261. "type": "String"
  12262. },
  12263. {
  12264. "name": "value",
  12265. "isBody": true,
  12266. "type": "String"
  12267. },
  12268. {
  12269. "name": "definition",
  12270. "type": "InputOutputParameterDefinition"
  12271. }
  12272. ]
  12273. },
  12274. {
  12275. "name": "Value",
  12276. "superClass": [
  12277. "InputOutputParameterDefinition"
  12278. ],
  12279. "properties": [
  12280. {
  12281. "name": "id",
  12282. "isAttr": true,
  12283. "type": "String"
  12284. },
  12285. {
  12286. "name": "name",
  12287. "isAttr": true,
  12288. "type": "String"
  12289. },
  12290. {
  12291. "name": "value",
  12292. "isBody": true,
  12293. "type": "String"
  12294. }
  12295. ]
  12296. },
  12297. {
  12298. "name": "Script",
  12299. "superClass": ["InputOutputParameterDefinition"],
  12300. "properties": [
  12301. {
  12302. "name": "scriptFormat",
  12303. "isAttr": true,
  12304. "type": "String"
  12305. },
  12306. {
  12307. "name": "resource",
  12308. "isAttr": true,
  12309. "type": "String"
  12310. },
  12311. {
  12312. "name": "value",
  12313. "isBody": true,
  12314. "type": "String"
  12315. }
  12316. ]
  12317. },
  12318. {
  12319. "name": "Field",
  12320. "superClass": ["Element"],
  12321. "meta": {
  12322. "allowedIn": [
  12323. "camunda:ServiceTaskLike",
  12324. "camunda:ExecutionListener",
  12325. "camunda:TaskListener"
  12326. ]
  12327. },
  12328. "properties": [
  12329. {
  12330. "name": "name",
  12331. "isAttr": true,
  12332. "type": "String"
  12333. },
  12334. {
  12335. "name": "expression",
  12336. "type": "String"
  12337. },
  12338. {
  12339. "name": "stringValue",
  12340. "isAttr": true,
  12341. "type": "String"
  12342. },
  12343. {
  12344. "name": "string",
  12345. "type": "String"
  12346. }
  12347. ]
  12348. },
  12349. {
  12350. "name": "InputParameter",
  12351. "superClass": ["InputOutputParameter"]
  12352. },
  12353. {
  12354. "name": "OutputParameter",
  12355. "superClass": ["InputOutputParameter"]
  12356. },
  12357. {
  12358. "name": "Collectable",
  12359. "isAbstract": true,
  12360. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12361. "superClass": ["camunda:AsyncCapable"],
  12362. "properties": [
  12363. {
  12364. "name": "collection",
  12365. "isAttr": true,
  12366. "type": "String"
  12367. },
  12368. {
  12369. "name": "elementVariable",
  12370. "isAttr": true,
  12371. "type": "String"
  12372. }
  12373. ]
  12374. },
  12375. {
  12376. "name": "FailedJobRetryTimeCycle",
  12377. "superClass": ["Element"],
  12378. "meta": {
  12379. "allowedIn": [
  12380. "camunda:AsyncCapable",
  12381. "bpmn:MultiInstanceLoopCharacteristics"
  12382. ]
  12383. },
  12384. "properties": [
  12385. {
  12386. "name": "body",
  12387. "isBody": true,
  12388. "type": "String"
  12389. }
  12390. ]
  12391. },
  12392. {
  12393. "name": "ExecutionListener",
  12394. "superClass": ["Element"],
  12395. "meta": {
  12396. "allowedIn": [
  12397. "bpmn:Task",
  12398. "bpmn:ServiceTask",
  12399. "bpmn:UserTask",
  12400. "bpmn:BusinessRuleTask",
  12401. "bpmn:ScriptTask",
  12402. "bpmn:ReceiveTask",
  12403. "bpmn:ManualTask",
  12404. "bpmn:ExclusiveGateway",
  12405. "bpmn:SequenceFlow",
  12406. "bpmn:ParallelGateway",
  12407. "bpmn:InclusiveGateway",
  12408. "bpmn:EventBasedGateway",
  12409. "bpmn:StartEvent",
  12410. "bpmn:IntermediateCatchEvent",
  12411. "bpmn:IntermediateThrowEvent",
  12412. "bpmn:EndEvent",
  12413. "bpmn:BoundaryEvent",
  12414. "bpmn:CallActivity",
  12415. "bpmn:SubProcess",
  12416. "bpmn:Process"
  12417. ]
  12418. },
  12419. "properties": [
  12420. {
  12421. "name": "expression",
  12422. "isAttr": true,
  12423. "type": "String"
  12424. },
  12425. {
  12426. "name": "class",
  12427. "isAttr": true,
  12428. "type": "String"
  12429. },
  12430. {
  12431. "name": "delegateExpression",
  12432. "isAttr": true,
  12433. "type": "String"
  12434. },
  12435. {
  12436. "name": "event",
  12437. "isAttr": true,
  12438. "type": "String"
  12439. },
  12440. {
  12441. "name": "script",
  12442. "type": "Script"
  12443. },
  12444. {
  12445. "name": "fields",
  12446. "type": "Field",
  12447. "isMany": true
  12448. }
  12449. ]
  12450. },
  12451. {
  12452. "name": "TaskListener",
  12453. "superClass": ["Element"],
  12454. "meta": {
  12455. "allowedIn": [
  12456. "bpmn:UserTask"
  12457. ]
  12458. },
  12459. "properties": [
  12460. {
  12461. "name": "expression",
  12462. "isAttr": true,
  12463. "type": "String"
  12464. },
  12465. {
  12466. "name": "class",
  12467. "isAttr": true,
  12468. "type": "String"
  12469. },
  12470. {
  12471. "name": "delegateExpression",
  12472. "isAttr": true,
  12473. "type": "String"
  12474. },
  12475. {
  12476. "name": "event",
  12477. "isAttr": true,
  12478. "type": "String"
  12479. },
  12480. {
  12481. "name": "script",
  12482. "type": "Script"
  12483. },
  12484. {
  12485. "name": "fields",
  12486. "type": "Field",
  12487. "isMany": true
  12488. },
  12489. {
  12490. "name": "id",
  12491. "type": "String",
  12492. "isAttr": true
  12493. },
  12494. {
  12495. "name": "eventDefinitions",
  12496. "type": "bpmn:TimerEventDefinition",
  12497. "isMany": true
  12498. }
  12499. ]
  12500. },
  12501. {
  12502. "name": "FormProperty",
  12503. "superClass": ["Element"],
  12504. "meta": {
  12505. "allowedIn": [
  12506. "bpmn:StartEvent",
  12507. "bpmn:UserTask"
  12508. ]
  12509. },
  12510. "properties": [
  12511. {
  12512. "name": "id",
  12513. "type": "String",
  12514. "isAttr": true
  12515. },
  12516. {
  12517. "name": "name",
  12518. "type": "String",
  12519. "isAttr": true
  12520. },
  12521. {
  12522. "name": "type",
  12523. "type": "String",
  12524. "isAttr": true
  12525. },
  12526. {
  12527. "name": "required",
  12528. "type": "String",
  12529. "isAttr": true
  12530. },
  12531. {
  12532. "name": "readable",
  12533. "type": "String",
  12534. "isAttr": true
  12535. },
  12536. {
  12537. "name": "writable",
  12538. "type": "String",
  12539. "isAttr": true
  12540. },
  12541. {
  12542. "name": "variable",
  12543. "type": "String",
  12544. "isAttr": true
  12545. },
  12546. {
  12547. "name": "expression",
  12548. "type": "String",
  12549. "isAttr": true
  12550. },
  12551. {
  12552. "name": "datePattern",
  12553. "type": "String",
  12554. "isAttr": true
  12555. },
  12556. {
  12557. "name": "default",
  12558. "type": "String",
  12559. "isAttr": true
  12560. },
  12561. {
  12562. "name": "values",
  12563. "type": "Value",
  12564. "isMany": true
  12565. }
  12566. ]
  12567. },
  12568. {
  12569. "name": "FormData",
  12570. "superClass": ["Element"],
  12571. "meta": {
  12572. "allowedIn": [
  12573. "bpmn:StartEvent",
  12574. "bpmn:UserTask"
  12575. ]
  12576. },
  12577. "properties": [
  12578. {
  12579. "name": "fields",
  12580. "type": "FormField",
  12581. "isMany": true
  12582. },
  12583. {
  12584. "name": "businessKey",
  12585. "type": "String",
  12586. "isAttr": true
  12587. }
  12588. ]
  12589. },
  12590. {
  12591. "name": "FormField",
  12592. "superClass": ["Element"],
  12593. "properties": [
  12594. {
  12595. "name": "id",
  12596. "type": "String",
  12597. "isAttr": true
  12598. },
  12599. {
  12600. "name": "label",
  12601. "type": "String",
  12602. "isAttr": true
  12603. },
  12604. {
  12605. "name": "type",
  12606. "type": "String",
  12607. "isAttr": true
  12608. },
  12609. {
  12610. "name": "datePattern",
  12611. "type": "String",
  12612. "isAttr": true
  12613. },
  12614. {
  12615. "name": "defaultValue",
  12616. "type": "String",
  12617. "isAttr": true
  12618. },
  12619. {
  12620. "name": "properties",
  12621. "type": "Properties"
  12622. },
  12623. {
  12624. "name": "validation",
  12625. "type": "Validation"
  12626. },
  12627. {
  12628. "name": "values",
  12629. "type": "Value",
  12630. "isMany": true
  12631. }
  12632. ]
  12633. },
  12634. {
  12635. "name": "Validation",
  12636. "superClass": ["Element"],
  12637. "properties": [
  12638. {
  12639. "name": "constraints",
  12640. "type": "Constraint",
  12641. "isMany": true
  12642. }
  12643. ]
  12644. },
  12645. {
  12646. "name": "Constraint",
  12647. "superClass": ["Element"],
  12648. "properties": [
  12649. {
  12650. "name": "name",
  12651. "type": "String",
  12652. "isAttr": true
  12653. },
  12654. {
  12655. "name": "config",
  12656. "type": "String",
  12657. "isAttr": true
  12658. }
  12659. ]
  12660. },
  12661. {
  12662. "name": "ConditionalEventDefinitionExtension",
  12663. "isAbstract": true,
  12664. "extends": [
  12665. "bpmn:ConditionalEventDefinition"
  12666. ],
  12667. "properties": [
  12668. {
  12669. "name": "variableName",
  12670. "isAttr": true,
  12671. "type": "String"
  12672. },
  12673. {
  12674. "name": "variableEvents",
  12675. "isAttr": true,
  12676. "type": "String"
  12677. }
  12678. ]
  12679. }
  12680. ],
  12681. "emumerations": []
  12682. };
  12683. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12684. /**
  12685. * This is a sample file that should be replaced with the actual translation.
  12686. *
  12687. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12688. * translations and labels to translate.
  12689. */
  12690. var translations = {
  12691. // Labels
  12692. 'Activate the global connect tool': '激活全局连接工具',
  12693. 'Append {type}': '追加 {type}',
  12694. 'Append EndEvent': '追加 结束事件 ',
  12695. 'Append Task': '追加 任务',
  12696. 'Append Gateway': '追加 网关',
  12697. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12698. 'Add Lane above': '在上面添加道',
  12699. 'Divide into two Lanes': '分割成两个道',
  12700. 'Divide into three Lanes': '分割成三个道',
  12701. 'Add Lane below': '在下面添加道',
  12702. 'Append compensation activity': '追加补偿活动',
  12703. 'Change type': '修改类型',
  12704. 'Connect using Association': '使用关联连接',
  12705. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12706. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12707. 'Remove': '移除',
  12708. 'Activate the hand tool': '激活抓手工具',
  12709. 'Activate the lasso tool': '激活套索工具',
  12710. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12711. 'Create expanded SubProcess': '创建扩展子过程',
  12712. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12713. 'Create Pool/Participant': '创建池/参与者',
  12714. 'Parallel Multi Instance': '并行多重事件',
  12715. 'Sequential Multi Instance': '时序多重事件',
  12716. 'DataObjectReference': '数据对象参考',
  12717. 'DataStoreReference': '数据存储参考',
  12718. 'Loop': '循环',
  12719. 'Ad-hoc': '即席',
  12720. 'Create {type}': '创建 {type}',
  12721. 'Create Task': '创建任务',
  12722. 'Create StartEvent': '创建开始事件',
  12723. 'Create EndEvent': '创建结束事件',
  12724. 'Create Group': '创建组',
  12725. 'Task': '任务',
  12726. 'Send Task': '发送任务',
  12727. 'Receive Task': '接收任务',
  12728. 'User Task': '用户任务',
  12729. 'Manual Task': '手工任务',
  12730. 'Business Rule Task': '业务规则任务',
  12731. 'Service Task': '服务任务',
  12732. 'Script Task': '脚本任务',
  12733. 'Call Activity': '调用活动',
  12734. 'Sub Process (collapsed)': '子流程(折叠的)',
  12735. 'Sub Process (expanded)': '子流程(展开的)',
  12736. 'Start Event': '开始事件',
  12737. 'StartEvent': '开始事件',
  12738. 'Intermediate Throw Event': '中间事件',
  12739. 'End Event': '结束事件',
  12740. 'EndEvent': '结束事件',
  12741. 'Create Gateway': '创建网关',
  12742. 'GateWay': '网关',
  12743. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12744. 'Message Start Event': '消息开始事件',
  12745. 'Timer Start Event': '定时开始事件',
  12746. 'Conditional Start Event': '条件开始事件',
  12747. 'Signal Start Event': '信号开始事件',
  12748. 'Error Start Event': '错误开始事件',
  12749. 'Escalation Start Event': '升级开始事件',
  12750. 'Compensation Start Event': '补偿开始事件',
  12751. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12752. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12753. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12754. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12755. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12756. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12757. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12758. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12759. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12760. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12761. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12762. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12763. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12764. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12765. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12766. 'Message End Event': '消息结束事件',
  12767. 'Escalation End Event': '定时结束事件',
  12768. 'Error End Event': '错误结束事件',
  12769. 'Cancel End Event': '取消结束事件',
  12770. 'Compensation End Event': '补偿结束事件',
  12771. 'Signal End Event': '信号结束事件',
  12772. 'Terminate End Event': '终止结束事件',
  12773. 'Message Boundary Event': '消息边界事件',
  12774. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12775. 'Timer Boundary Event': '定时边界事件',
  12776. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12777. 'Escalation Boundary Event': '升级边界事件',
  12778. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12779. 'Conditional Boundary Event': '条件边界事件',
  12780. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12781. 'Error Boundary Event': '错误边界事件',
  12782. 'Cancel Boundary Event': '取消边界事件',
  12783. 'Signal Boundary Event': '信号边界事件',
  12784. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12785. 'Compensation Boundary Event': '补偿边界事件',
  12786. 'Exclusive Gateway': '互斥网关',
  12787. 'Parallel Gateway': '并行网关',
  12788. 'Inclusive Gateway': '相容网关',
  12789. 'Complex Gateway': '复杂网关',
  12790. 'Event based Gateway': '事件网关',
  12791. 'Transaction': '转运',
  12792. 'Sub Process': '子流程',
  12793. 'Event Sub Process': '事件子流程',
  12794. 'Collapsed Pool': '折叠池',
  12795. 'Expanded Pool': '展开池',
  12796. // Errors
  12797. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12798. 'no shape type specified': '没有指定的形状类型',
  12799. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12800. 'out of bounds release': 'out of bounds release',
  12801. 'more than {count} child lanes': '子道大于{count} ',
  12802. 'element required': '元素不能为空',
  12803. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12804. 'no diagram to display': '没有可展示的流程图',
  12805. 'no process or collaboration to display': '没有可展示的流程/协作',
  12806. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12807. 'already rendered {element}': '{element} 已被渲染',
  12808. 'failed to import {element}': '导入{element}失败',
  12809. // 属性面板的参数
  12810. 'Id': '编号',
  12811. 'Name': '名称',
  12812. 'General': '常规',
  12813. 'Details': '详情',
  12814. 'Message Name': '消息名称',
  12815. 'Message': '消息',
  12816. 'Initiator': '创建者',
  12817. 'Asynchronous Continuations': '持续异步',
  12818. 'Asynchronous Before': '异步前',
  12819. 'Asynchronous After': '异步后',
  12820. 'Job Configuration': '工作配置',
  12821. 'Exclusive': '排除',
  12822. 'Job Priority': '工作优先级',
  12823. 'Retry Time Cycle': '重试时间周期',
  12824. 'Documentation': '文档',
  12825. 'Element Documentation': '元素文档',
  12826. 'History Configuration': '历史配置',
  12827. 'History Time To Live': '历史的生存时间',
  12828. 'Forms': '表单',
  12829. 'Form Key': '表单key',
  12830. 'Form Fields': '表单字段',
  12831. 'Business Key': '业务key',
  12832. 'Form Field': '表单字段',
  12833. 'ID': '编号',
  12834. 'Type': '类型',
  12835. 'Label': '名称',
  12836. 'Default Value': '默认值',
  12837. 'Validation': '校验',
  12838. 'Add Constraint': '添加约束',
  12839. 'Config': '配置',
  12840. 'Properties': '属性',
  12841. 'Add Property': '添加属性',
  12842. 'Value': '值',
  12843. 'Add': '添加',
  12844. 'Values': '值',
  12845. 'Add Value': '添加值',
  12846. 'Listeners': '监听器',
  12847. 'Execution Listener': '执行监听',
  12848. 'Event Type': '事件类型',
  12849. 'Listener Type': '监听器类型',
  12850. 'Java Class': 'Java类',
  12851. 'Expression': '表达式',
  12852. 'Must provide a value': '必须提供一个值',
  12853. 'Delegate Expression': '代理表达式',
  12854. 'Script': '脚本',
  12855. 'Script Format': '脚本格式',
  12856. 'Script Type': '脚本类型',
  12857. 'Inline Script': '内联脚本',
  12858. 'External Script': '外部脚本',
  12859. 'Resource': '资源',
  12860. 'Field Injection': '字段注入',
  12861. 'Extensions': '扩展',
  12862. 'Input/Output': '输入/输出',
  12863. 'Input Parameters': '输入参数',
  12864. 'Output Parameters': '输出参数',
  12865. 'Parameters': '参数',
  12866. 'Output Parameter': '输出参数',
  12867. 'Timer Definition Type': '定时器定义类型',
  12868. 'Timer Definition': '定时器定义',
  12869. 'Date': '日期',
  12870. 'Duration': '持续',
  12871. 'Cycle': '循环',
  12872. 'Signal': '信号',
  12873. 'Signal Name': '信号名称',
  12874. 'Escalation': '升级',
  12875. 'Error': '错误',
  12876. 'Link Name': '链接名称',
  12877. 'Condition': '条件名称',
  12878. 'Variable Name': '变量名称',
  12879. 'Variable Event': '变量事件',
  12880. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12881. 'Wait for Completion': '等待完成',
  12882. 'Activity Ref': '活动参考',
  12883. 'Version Tag': '版本标签',
  12884. 'Executable': '可执行文件',
  12885. 'External Task Configuration': '扩展任务配置',
  12886. 'Task Priority': '任务优先级',
  12887. 'External': '外部',
  12888. 'Connector': '连接器',
  12889. 'Must configure Connector': '必须配置连接器',
  12890. 'Connector Id': '连接器编号',
  12891. 'Implementation': '实现方式',
  12892. 'Field Injections': '字段注入',
  12893. 'Fields': '字段',
  12894. 'Result Variable': '结果变量',
  12895. 'Topic': '主题',
  12896. 'Configure Connector': '配置连接器',
  12897. 'Input Parameter': '输入参数',
  12898. 'Assignee': '代理人',
  12899. 'Candidate Users': '候选用户',
  12900. 'Candidate Groups': '候选组',
  12901. 'Due Date': '到期时间',
  12902. 'Follow Up Date': '跟踪日期',
  12903. 'Priority': '优先级',
  12904. // eslint-disable-next-line no-template-curly-in-string
  12905. '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',
  12906. // eslint-disable-next-line no-template-curly-in-string
  12907. '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',
  12908. 'Variables': '变量',
  12909. 'Candidate Starter Configuration': '候选开始配置',
  12910. 'Task Listener': '任务监听器',
  12911. 'Candidate Starter Groups': '候选开始组',
  12912. 'Candidate Starter Users': '候选开始用户',
  12913. 'Tasklist Configuration': '任务列表配置',
  12914. 'Startable': '启动',
  12915. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12916. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12917. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12918. 'CallActivity Type': '调用活动类型',
  12919. 'Condition Type': '条件类型',
  12920. 'Create UserTask': '创建用户任务',
  12921. 'Create CallActivity': '创建调用活动',
  12922. 'Called Element': '调用元素',
  12923. 'Create DataObjectReference': '创建数据对象引用',
  12924. 'Create DataStoreReference': '创建数据存储引用',
  12925. 'Multi Instance': '多实例',
  12926. 'Loop Cardinality': '实例数量',
  12927. Collection: '任务参与人列表',
  12928. 'Element Variable': '元素变量',
  12929. 'Completion Condition': '完成条件'
  12930. };
  12931. //# sourceMappingURL=translations.js.map
  12932. function customTranslate(template, replacements) {
  12933. replacements = replacements || {};
  12934. // Translate
  12935. template = translations[template] || template;
  12936. // Replace
  12937. return template.replace(/{([^}]+)}/g, function (_, key) {
  12938. return replacements[key] || '{' + key + '}';
  12939. });
  12940. }
  12941. //# sourceMappingURL=customTranslate.js.map
  12942. var vjson$9 = {
  12943. title: '导入流程',
  12944. layout: 'fit',
  12945. width: 400,
  12946. height: 400,
  12947. items: [
  12948. {
  12949. layout: 'border',
  12950. items: [
  12951. {
  12952. xtype: 'form',
  12953. items: [
  12954. // {
  12955. // xtype: 'cols',
  12956. // items: [
  12957. // {
  12958. // xtype: 'textfield',
  12959. // allowBlank: false,
  12960. // fieldLabel: '流程名称',
  12961. // bind: '{name}'
  12962. // },
  12963. // ],
  12964. // },
  12965. {
  12966. xtype: 'cols',
  12967. items: [
  12968. {
  12969. xtype: 'filefield',
  12970. name: 'deployFile',
  12971. fieldLabel: '文件名称',
  12972. // labelWidth: '100%',
  12973. msgTarget: 'side',
  12974. reference: 'MOBANB_FILE',
  12975. fileUpload: true,
  12976. allowBlank: false,
  12977. // flex: 1,
  12978. // width: '100%',
  12979. buttonText: '请选择文件位置',
  12980. listeners: {
  12981. change: 'scope.fileChange'
  12982. }
  12983. // bind: '{FILE}'
  12984. },
  12985. ]
  12986. }
  12987. ],
  12988. region: 'center',
  12989. split: true,
  12990. },
  12991. ],
  12992. },
  12993. ],
  12994. fbar: {
  12995. xtype: 'toolbar',
  12996. items: [
  12997. {
  12998. xtype: 'button',
  12999. text: '保存',
  13000. iconCls: 'x-fa fa-save',
  13001. listeners: {
  13002. click: 'scope.save',
  13003. },
  13004. }
  13005. ],
  13006. },
  13007. };
  13008. //# sourceMappingURL=ImportBpmn.view.js.map
  13009. var model$9 = {
  13010. data: {
  13011. name: '',
  13012. file_content: ''
  13013. }
  13014. };
  13015. //# sourceMappingURL=ImportBpmn.model.js.map
  13016. var ImportBpmn = /** @class */ (function (_super) {
  13017. __extends(ImportBpmn, _super);
  13018. function ImportBpmn() {
  13019. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  13020. }
  13021. ImportBpmn.prototype.onLoad = function () {
  13022. };
  13023. ImportBpmn.prototype.save = function (sender) {
  13024. if (this.data.file_content) {
  13025. this.dialogSuccess(this.data);
  13026. }
  13027. else {
  13028. Ext.Msg.alert('提示', "请先上传文件");
  13029. }
  13030. };
  13031. ImportBpmn.prototype.fileChange = function (e) {
  13032. var _this = this;
  13033. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  13034. var file = e.fileInputEl.dom.files[0]; //获取文件
  13035. var reader = new FileReader();
  13036. reader.readAsText(file, "UTF-8");
  13037. reader.onload = function () {
  13038. _this.data.file_content = reader.result;
  13039. };
  13040. };
  13041. return ImportBpmn;
  13042. }(Scope));
  13043. //# sourceMappingURL=ImportBpmn.js.map
  13044. var model$a = {
  13045. data: {
  13046. form_id: '',
  13047. form_name: '',
  13048. save_dir_path: '',
  13049. absolute_path: '',
  13050. form: {
  13051. id: '',
  13052. code: '',
  13053. name: '',
  13054. table: '',
  13055. controller: '',
  13056. groovy: '',
  13057. fields: [],
  13058. buttons: [],
  13059. },
  13060. }
  13061. };
  13062. //# sourceMappingURL=ConfigStrategy.model.js.map
  13063. var vjson$a = {
  13064. title: '配置适配策略',
  13065. layout: 'fit',
  13066. items: [
  13067. {
  13068. layout: 'border',
  13069. items: [
  13070. {
  13071. region: 'center',
  13072. xtype: 'yvgrid',
  13073. pagination: false,
  13074. hideFootbar: true,
  13075. plugins: {
  13076. clipboard: true,
  13077. selectionreplicator: true
  13078. },
  13079. tbar: {
  13080. xtype: 'toolbar',
  13081. items: [
  13082. {
  13083. xtype: 'button',
  13084. text: '添加策略',
  13085. iconCls: 'x-fa fa-plus-circle',
  13086. listeners: {
  13087. click: 'scope.addStrategy'
  13088. }
  13089. },
  13090. {
  13091. xtype: 'button',
  13092. text: '删除',
  13093. iconCls: 'x-fa fa-minus-circle',
  13094. listeners: {}
  13095. },
  13096. '-',
  13097. {
  13098. xtype: 'button',
  13099. text: '上移',
  13100. iconCls: 'x-fa fa-arrow-up',
  13101. listeners: {}
  13102. },
  13103. {
  13104. xtype: 'button',
  13105. text: '下移',
  13106. iconCls: 'x-fa fa-arrow-down',
  13107. listeners: {}
  13108. },
  13109. ]
  13110. },
  13111. columns: [
  13112. { xtype: 'rownumberer' },
  13113. {
  13114. header: '优先级',
  13115. dataIndex: 'priority',
  13116. width: 140,
  13117. sortable: false,
  13118. menuDisabled: true,
  13119. editor: {
  13120. selectOnFocus: true
  13121. },
  13122. },
  13123. {
  13124. header: '策略编号',
  13125. dataIndex: 'strategy_code',
  13126. width: 140,
  13127. sortable: false,
  13128. menuDisabled: true,
  13129. editor: {
  13130. selectOnFocus: true
  13131. },
  13132. },
  13133. {
  13134. header: '策略名称',
  13135. dataIndex: 'strategy_name',
  13136. width: 140,
  13137. sortable: false,
  13138. menuDisabled: true,
  13139. editor: {
  13140. selectOnFocus: true
  13141. },
  13142. },
  13143. {
  13144. header: "条件表达式",
  13145. dataIndex: "strategy_exp",
  13146. },
  13147. ],
  13148. },
  13149. {
  13150. title: '适配条件',
  13151. region: 'south',
  13152. height: '50%',
  13153. xtype: 'form',
  13154. items: [
  13155. {
  13156. xtype: 'cols',
  13157. items: [
  13158. {
  13159. xtype: 'rows',
  13160. items: [
  13161. {
  13162. xtype: 'textfield',
  13163. fieldLabel: "仓库",
  13164. },
  13165. {
  13166. xtype: 'textfield',
  13167. fieldLabel: "货主",
  13168. },
  13169. {
  13170. xtype: 'textfield',
  13171. fieldLabel: "项目",
  13172. },
  13173. {
  13174. xtype: 'textfield',
  13175. fieldLabel: "行政区划",
  13176. },
  13177. {
  13178. xtype: 'textfield',
  13179. fieldLabel: "客户",
  13180. },
  13181. {
  13182. xtype: 'textfield',
  13183. fieldLabel: "商品",
  13184. }
  13185. ]
  13186. },
  13187. {
  13188. xtype: 'rows',
  13189. margin: '8 0 0 10',
  13190. items: [
  13191. {
  13192. xtype: 'label',
  13193. html: '自定义表达式',
  13194. },
  13195. {
  13196. xtype: 'textarea',
  13197. }
  13198. ]
  13199. }
  13200. ]
  13201. }
  13202. ]
  13203. }
  13204. ]
  13205. }
  13206. ]
  13207. };
  13208. //
  13209. //# sourceMappingURL=ConfigStrategy.view.js.map
  13210. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13211. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13212. // import ReportRunner from "./ReportRunner";
  13213. var ConfigStrategy = /** @class */ (function (_super) {
  13214. __extends(ConfigStrategy, _super);
  13215. function ConfigStrategy() {
  13216. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13217. }
  13218. ConfigStrategy.prototype.onLoad = function () {
  13219. this.load();
  13220. };
  13221. ConfigStrategy.prototype.load = function () {
  13222. var _this = this;
  13223. var form_id = this.viewModel.get("form_id");
  13224. var absolute_path = this.viewModel.get("absolute_path");
  13225. var save_dir_path = this.viewModel.get("save_dir_path");
  13226. if (absolute_path && form_id) {
  13227. this.setLoading(true);
  13228. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13229. if (res.success) {
  13230. // 基础属性
  13231. _this.viewModel.set('form', res.data.form);
  13232. // 字段定义
  13233. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13234. // 按钮
  13235. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13236. }
  13237. }).finally(function () {
  13238. _this.setLoading(false);
  13239. });
  13240. }
  13241. };
  13242. ConfigStrategy.prototype.saveAll = function () {
  13243. var _this = this;
  13244. var save_dir_path = this.viewModel.get("save_dir_path");
  13245. if (!save_dir_path) {
  13246. msg("save_dir_path error");
  13247. return;
  13248. }
  13249. var form_id = this.viewModel.get("form_id");
  13250. var absolute_path = this.viewModel.get("absolute_path");
  13251. // 表格校验
  13252. if (!this.refs.form1.isValid()) {
  13253. msg("请检查表单必填项!");
  13254. return;
  13255. }
  13256. // 字段数据
  13257. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13258. delete item.id;
  13259. if (item.hide) {
  13260. delete item.hide_text;
  13261. }
  13262. else {
  13263. item.hide = item.hide_text;
  13264. delete item.hide_text;
  13265. }
  13266. if (item.readonly) {
  13267. delete item.readonly_text;
  13268. }
  13269. else {
  13270. item.readonly = item.readonly_text;
  13271. delete item.readonly_text;
  13272. }
  13273. if (item.disabled) {
  13274. delete item.disabled_text;
  13275. }
  13276. else {
  13277. item.disabled = item.disabled_text;
  13278. delete item.disabled_text;
  13279. }
  13280. if (item.required) {
  13281. delete item.required_text;
  13282. }
  13283. else {
  13284. item.required = item.required_text;
  13285. delete item.required_text;
  13286. }
  13287. return item;
  13288. });
  13289. this.viewModel.set("form.fields", gridColumnRows);
  13290. // 按钮数据
  13291. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13292. delete item.id;
  13293. return item;
  13294. });
  13295. this.viewModel.set("form.buttons", gridBtnRows);
  13296. // 查询条件
  13297. // 策略
  13298. var form = this.viewModel.get("form");
  13299. this.setLoading(true);
  13300. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13301. if (res.success) {
  13302. msg('保存成功');
  13303. handles$1.mainWindow.refs['exporerTree'].reload();
  13304. }
  13305. }).finally(function () {
  13306. _this.setLoading(false);
  13307. });
  13308. };
  13309. ConfigStrategy.prototype.addColumn = function () {
  13310. this.refs.gridColumn.getStore().add({});
  13311. };
  13312. ConfigStrategy.prototype.removeColumn = function () {
  13313. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13314. };
  13315. ConfigStrategy.prototype.calcColumn = function (sender) {
  13316. var _this = this;
  13317. var table = this.viewModel.get("form.table");
  13318. if (!table) {
  13319. msg("表名不存在!");
  13320. return;
  13321. }
  13322. this.setLoading(true);
  13323. calcColumnForm({ table: table }).then(function (res) {
  13324. if (res.success) {
  13325. msg(res.msg);
  13326. if (res.data.columns.length > 0) {
  13327. _$2.forEach(res.data.columns, function (it) {
  13328. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13329. });
  13330. }
  13331. }
  13332. }).finally(function () {
  13333. _this.setLoading(false);
  13334. });
  13335. };
  13336. ConfigStrategy.prototype.addButton = function () {
  13337. this.refs.gridButton.getStore().add({});
  13338. };
  13339. ConfigStrategy.prototype.moveUp = function (sender) {
  13340. var grid = sender.up('grid');
  13341. grid.rowMoveUp();
  13342. };
  13343. ConfigStrategy.prototype.moveDown = function (sender) {
  13344. var grid = sender.up('grid');
  13345. grid.rowMoveDown();
  13346. };
  13347. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13348. var win = new Ext.Window({
  13349. autoDestroy: true,
  13350. title: "添加(编辑)策略",
  13351. width: 400,
  13352. height: 300,
  13353. resizable: true,
  13354. closable: true,
  13355. maximizable: true,
  13356. minimizable: true,
  13357. plain: true,
  13358. // constrainHeader: true,
  13359. constrain: true,
  13360. layout: 'fit',
  13361. animateTarget: sender,
  13362. buttonAlign: 'center',
  13363. items: [
  13364. {
  13365. xtype: "form",
  13366. layout: "hbox",
  13367. margin: '10px 20px',
  13368. border: 0,
  13369. items: [
  13370. {
  13371. flex: 1,
  13372. layout: 'vbox',
  13373. items: [
  13374. {
  13375. xtype: "numberfield",
  13376. fieldLabel: "优先级",
  13377. flex: 1,
  13378. allowBlank: false,
  13379. labelWidth: 50,
  13380. width: "100%",
  13381. },
  13382. {
  13383. xtype: "textfield",
  13384. fieldLabel: "策略名称",
  13385. flex: 1,
  13386. allowBlank: false,
  13387. labelWidth: 50,
  13388. width: "100%",
  13389. },
  13390. {
  13391. xtype: "textfield",
  13392. fieldLabel: "策略编号",
  13393. flex: 1,
  13394. allowBlank: false,
  13395. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13396. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13397. labelWidth: 50,
  13398. width: "100%",
  13399. },
  13400. {
  13401. xtype: "textfield",
  13402. fieldLabel: "仓库ID",
  13403. flex: 1,
  13404. allowBlank: false,
  13405. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13406. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13407. labelWidth: 50,
  13408. width: "100%",
  13409. },
  13410. ]
  13411. },
  13412. ]
  13413. }
  13414. ],
  13415. //窗口按钮
  13416. buttons: [
  13417. {
  13418. xtype: 'button', text: '保存', handler: function (btn) {
  13419. //窗口获取表单
  13420. var form = win.down('form');
  13421. var vaildSuccess = form.isValid();
  13422. if (!vaildSuccess) {
  13423. return;
  13424. }
  13425. var filename = form.down('textfield[name="filename"]').getValue();
  13426. }
  13427. },
  13428. {
  13429. xtype: 'button', text: '取消', handler: function (btn) {
  13430. //窗口关闭
  13431. win.close();
  13432. }
  13433. }
  13434. ]
  13435. });
  13436. win.show();
  13437. };
  13438. return ConfigStrategy;
  13439. }(Scope));
  13440. //# sourceMappingURL=ConfigStrategy.js.map
  13441. var buildVjson = function () {
  13442. return {
  13443. bind: {
  13444. title: '流程编辑-{text}',
  13445. },
  13446. layout: 'fit',
  13447. items: [{
  13448. layout: 'border',
  13449. tbar: {
  13450. xtype: 'toolbar',
  13451. items: [
  13452. {
  13453. xtype: 'button',
  13454. text: '撤销',
  13455. listeners: {
  13456. click: "scope.undo"
  13457. }
  13458. },
  13459. {
  13460. xtype: 'button',
  13461. text: '还原',
  13462. listeners: {
  13463. click: "scope.redo"
  13464. }
  13465. },
  13466. {
  13467. xtype: 'button',
  13468. text: '保存',
  13469. listeners: {
  13470. click: "scope.save"
  13471. }
  13472. },
  13473. {
  13474. xtype: 'button',
  13475. text: '导入BPM',
  13476. listeners: {
  13477. click: "scope.importBpm"
  13478. }
  13479. },
  13480. {
  13481. xtype: 'button',
  13482. text: '配置适配策略',
  13483. listeners: {
  13484. click: "scope.configStrategy"
  13485. }
  13486. },
  13487. {
  13488. fieldLabel: '选择配置分支',
  13489. xtype: 'combogrid',
  13490. },
  13491. ]
  13492. },
  13493. items: [
  13494. {
  13495. xtype: "panel",
  13496. region: 'center',
  13497. reference: "bpmn_view",
  13498. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13499. },
  13500. {
  13501. split: true,
  13502. xtype: "panel",
  13503. region: 'east',
  13504. width: '30%',
  13505. reference: "bpmn_properties",
  13506. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13507. }
  13508. ],
  13509. }],
  13510. listeners: {
  13511. afterrender: 'scope.onViewRender'
  13512. }
  13513. };
  13514. };
  13515. var BpmnDesign = /** @class */ (function (_super) {
  13516. __extends(BpmnDesign, _super);
  13517. function BpmnDesign() {
  13518. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13519. _this.bpmnModeler = null;
  13520. _this.bpmnModelerName = "";
  13521. return _this;
  13522. }
  13523. BpmnDesign.prototype.onLoad = function () {
  13524. var _this = this;
  13525. _super.prototype.onLoad.call(this);
  13526. this.setLoading(true);
  13527. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13528. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13529. if (res && res.success && res.data && res.data.bpmn) {
  13530. var diagramXML = res.data.bpmn;
  13531. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13532. var elements = _this.bpmnModeler._definitions.rootElements;
  13533. if (Array.isArray(elements) && elements.length > 0) {
  13534. elements[0].name = _this.bpmnModelerName;
  13535. }
  13536. }).catch(function (err) {
  13537. msgError(err);
  13538. });
  13539. }
  13540. else {
  13541. msgError(res.msg);
  13542. }
  13543. }).finally(function () {
  13544. _this.setLoading(false);
  13545. });
  13546. };
  13547. BpmnDesign.prototype.onViewRender = function (sender) {
  13548. var customTranslateModule = {
  13549. translate: ['value', customTranslate]
  13550. };
  13551. this.bpmnModeler = new BpmnModeler({
  13552. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13553. propertiesPanel: {
  13554. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13555. },
  13556. additionalModules: [
  13557. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13558. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13559. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13560. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13561. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13562. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13563. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13564. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13565. customTranslateModule,
  13566. ],
  13567. moddleExtensions: {
  13568. camunda: camundaModdleDescriptor
  13569. },
  13570. keyboard: { bindTo: document } // 使用键盘快捷键
  13571. });
  13572. };
  13573. //开启快捷键
  13574. //modeler.get('keyboard').bind(document);
  13575. //关闭快捷键
  13576. //modeler.get('keyboard').unbind();
  13577. BpmnDesign.prototype.undo = function (sender) {
  13578. this.bpmnModeler.get('commandStack').undo();
  13579. };
  13580. BpmnDesign.prototype.redo = function (sender) {
  13581. this.bpmnModeler.get('commandStack').redo();
  13582. };
  13583. BpmnDesign.prototype.save = function (sender) {
  13584. var _this = this;
  13585. this.setLoading(true);
  13586. this.bpmnModeler.saveXML().then(function (resBpm) {
  13587. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13588. if (res.success) {
  13589. msg$1("保存成功");
  13590. }
  13591. else {
  13592. msgError(res.msg);
  13593. }
  13594. }).catch(function (e) {
  13595. var _a, _b;
  13596. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13597. msgError(msg);
  13598. }).finally(function () {
  13599. _this.setLoading(false);
  13600. });
  13601. }).catch(function (e) {
  13602. msgError(e);
  13603. _this.setLoading(false);
  13604. });
  13605. };
  13606. BpmnDesign.prototype.importBpm = function (sender) {
  13607. var _this = this;
  13608. var dlg = new ImportBpmn();
  13609. //@ts-ignore
  13610. dlg.success = function (sen, data) {
  13611. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13612. var elements = _this.bpmnModeler._definitions.rootElements;
  13613. if (Array.isArray(elements) && elements.length > 0) {
  13614. elements[0].name = _this.bpmnModelerName;
  13615. }
  13616. }).catch(function (err) {
  13617. msgError(err);
  13618. });
  13619. };
  13620. dlg.showDialog(sender, {}, {});
  13621. // this.bpmnModeler.importXML()
  13622. };
  13623. BpmnDesign.prototype.configStrategy = function (sender) {
  13624. var configStrategy = new ConfigStrategy();
  13625. configStrategy.showDialog(sender, {}, {});
  13626. };
  13627. return BpmnDesign;
  13628. }(Scope));
  13629. //# sourceMappingURL=BpmnDesign.js.map
  13630. var model$b = {
  13631. data: {
  13632. id: '',
  13633. path: '',
  13634. form: {
  13635. title: '',
  13636. sqlId: '',
  13637. }
  13638. }
  13639. };
  13640. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13641. var vjson$b = {
  13642. bind: {
  13643. title: '{title}',
  13644. },
  13645. layout: 'fit',
  13646. items: [
  13647. {
  13648. layout: 'border',
  13649. items: [
  13650. {
  13651. region: 'center',
  13652. reference: 'editor',
  13653. border: true,
  13654. // html: '<div class="geEditor"></div>',
  13655. // listeners: {
  13656. // afterrender: 'scope.editorInit'
  13657. // }
  13658. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13659. listeners: {
  13660. afterrender: 'scope.iframeRender'
  13661. }
  13662. },
  13663. ]
  13664. }
  13665. ]
  13666. }; //
  13667. //
  13668. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13669. var WidgetDesign$1 = /** @class */ (function (_super) {
  13670. __extends(WidgetDesign, _super);
  13671. function WidgetDesign(layoutCode, layoutName) {
  13672. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13673. _this.layoutCode = layoutCode;
  13674. _this.layoutName = layoutName;
  13675. return _this;
  13676. }
  13677. WidgetDesign.prototype.onLoad = function () {
  13678. this.viewModel.set('layoutCode', this.layoutCode);
  13679. this.viewModel.set('layoutName', this.layoutName);
  13680. if (this.layoutCode) {
  13681. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13682. }
  13683. else {
  13684. this.viewModel.set('title', '新建图纸');
  13685. }
  13686. };
  13687. WidgetDesign.prototype.reload = function () {
  13688. var _this = this;
  13689. this.setLoading(true);
  13690. loadWhLayout({
  13691. layoutCode: this.layoutCode,
  13692. layoutName: this.layoutName,
  13693. }).then(function (res) {
  13694. if (res.success) {
  13695. var xml = res.data.layoutContent;
  13696. var doc = _this.mxUtils.parseXml(xml);
  13697. var graph = _this.editorUi.editor.graph;
  13698. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13699. }
  13700. }).finally(function () {
  13701. _this.setLoading(false);
  13702. });
  13703. };
  13704. WidgetDesign.prototype.editorInit = function (sender) {
  13705. var that = this;
  13706. var dom = $(sender.el.dom).find('.geEditor')[0];
  13707. //@ts-ignore
  13708. require(['mxgraph'], function () {
  13709. var editorUiInit = EditorUi.prototype.init;
  13710. EditorUi.prototype.init = function () {
  13711. editorUiInit.apply(this, arguments);
  13712. this.actions.get('save').funct = that.onFileSave.bind(that);
  13713. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13714. this.actions.get('open').visible = false;
  13715. this.actions.get('new').visible = false;
  13716. this.actions.get('preview').visible = false;
  13717. this.actions.get('print').visible = false;
  13718. this.actions.get('pageSetup').visible = false;
  13719. this.actions.get('help').visible = false;
  13720. this.actions.get('export').visible = false;
  13721. this.actions.get('about').visible = false;
  13722. this.menus.menus.help.setEnabled(false);
  13723. that.editorUi = this;
  13724. if (that.layoutCode) {
  13725. that.reload();
  13726. }
  13727. };
  13728. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13729. var mxLanguage = 'zh';
  13730. mxResources.loadDefaultBundle = false;
  13731. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13732. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13733. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13734. // Fixes possible asynchronous requests
  13735. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13736. // Adds bundle text to resources
  13737. mxResources.parse(xhr[0].getText());
  13738. // Configures the default graph theme
  13739. var themes = new Object();
  13740. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13741. // Main
  13742. new EditorUi(new Editor(false, themes), dom);
  13743. }, function () {
  13744. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13745. });
  13746. });
  13747. };
  13748. WidgetDesign.prototype.iframeRender = function (sender) {
  13749. var that = this;
  13750. var iframe = $(sender.el.dom).find('iframe')[0];
  13751. iframe.contentWindow['designer'] = that;
  13752. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13753. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13754. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13755. editorUi.actions.get('open').visible = false;
  13756. editorUi.actions.get('new').visible = false;
  13757. editorUi.actions.get('preview').visible = false;
  13758. editorUi.actions.get('print').visible = false;
  13759. editorUi.actions.get('pageSetup').visible = false;
  13760. editorUi.actions.get('help').visible = false;
  13761. editorUi.actions.get('export').visible = false;
  13762. editorUi.actions.get('about').visible = false;
  13763. editorUi.menus.menus.help.setEnabled(false);
  13764. that.editorUi = editorUi;
  13765. that.mxUtils = iframe.contentWindow['mxUtils'];
  13766. if (that.layoutCode) {
  13767. that.reload();
  13768. }
  13769. };
  13770. };
  13771. WidgetDesign.prototype.onDestroy = function () {
  13772. var _a;
  13773. try {
  13774. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13775. }
  13776. catch (e) {
  13777. }
  13778. };
  13779. WidgetDesign.prototype.onFileSaveAs = function () {
  13780. var _this = this;
  13781. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13782. .then(function (_a) {
  13783. var code = _a.code, name = _a.name;
  13784. _this.layoutCode = code;
  13785. _this.layoutName = name;
  13786. _this.onSave();
  13787. });
  13788. };
  13789. WidgetDesign.prototype.onSave = function () {
  13790. var _this = this;
  13791. var layoutContent = this.editorUi.getEditBlankXml();
  13792. var layoutCode = this.layoutCode;
  13793. var layoutName = this.layoutName;
  13794. if (!layoutCode || !layoutName) {
  13795. msg$1('图形编号和图形名称必填');
  13796. return;
  13797. }
  13798. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13799. this.setLoading(true);
  13800. saveWhLayout({
  13801. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13802. }).then(function (res) {
  13803. msg$1(res.msg);
  13804. handles$1.whLayout.reload();
  13805. }).finally(function () {
  13806. _this.setLoading(false);
  13807. });
  13808. };
  13809. WidgetDesign.prototype.onFileSave = function () {
  13810. if (!this.layoutCode || !this.layoutName) {
  13811. this.onFileSaveAs();
  13812. }
  13813. else {
  13814. this.onSave();
  13815. }
  13816. };
  13817. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13818. var code = _a.code, name = _a.name;
  13819. return new Promise(function (resolve, reject) {
  13820. var viewModel = new Ext.app.ViewModel({
  13821. data: {
  13822. code: code !== null && code !== void 0 ? code : '',
  13823. name: name !== null && name !== void 0 ? name : '',
  13824. }
  13825. });
  13826. var dlg = Ext.create('Ext.window.Window', {
  13827. title: '保存',
  13828. viewModel: viewModel,
  13829. layout: {
  13830. type: "vbox",
  13831. pack: "start",
  13832. align: "stretch"
  13833. },
  13834. items: [
  13835. {
  13836. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13837. bind: '{code}'
  13838. },
  13839. {
  13840. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13841. bind: '{name}'
  13842. }
  13843. ],
  13844. fbar: [
  13845. {
  13846. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13847. click: function () {
  13848. var code = viewModel.get('code');
  13849. var name = viewModel.get('name');
  13850. resolve({ code: code, name: name });
  13851. dlg.close();
  13852. }
  13853. }
  13854. },
  13855. {
  13856. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13857. click: function () {
  13858. dlg.close();
  13859. }
  13860. }
  13861. },
  13862. ]
  13863. });
  13864. dlg.show();
  13865. });
  13866. };
  13867. return WidgetDesign;
  13868. }(Scope));
  13869. //# sourceMappingURL=WhLayoutDesign.js.map
  13870. // init()
  13871. var Workbench = /** @class */ (function (_super) {
  13872. __extends(Workbench, _super);
  13873. // activeModulePage: ModulePage = null
  13874. function Workbench() {
  13875. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13876. _this.name = "MainWindow";
  13877. _this.modules = [];
  13878. _this.yvgridDesign = null;
  13879. return _this;
  13880. }
  13881. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13882. if (newCard) {
  13883. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13884. }
  13885. else {
  13886. this.viewModel.set('leftTabTitle', '未选中');
  13887. }
  13888. };
  13889. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13890. get: function () {
  13891. var _a;
  13892. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13893. },
  13894. enumerable: true,
  13895. configurable: true
  13896. });
  13897. Workbench.prototype.documentKeydown = function (event) {
  13898. if (event.ctrlKey || event.metaKey) {
  13899. if (event.key.toLowerCase() === 's') {
  13900. eventBus.publish(EventType.SaveCall, {});
  13901. event.stopPropagation();
  13902. event.preventDefault();
  13903. }
  13904. else if (event.key.toLowerCase() === 'z') {
  13905. if (event.shiftKey) {
  13906. eventBus.publish(EventType.Redo, {});
  13907. event.stopPropagation();
  13908. event.preventDefault();
  13909. }
  13910. else {
  13911. eventBus.publish(EventType.Undo, {});
  13912. event.stopPropagation();
  13913. event.preventDefault();
  13914. }
  13915. }
  13916. }
  13917. };
  13918. Workbench.prototype.onLoad = function () {
  13919. var _this = this;
  13920. window["tt"] = this.refs['tt'];
  13921. window["vm"] = this.viewModel;
  13922. $('#loading').remove();
  13923. setMainWindow(this);
  13924. setStatusbar(this.down('statusbar'));
  13925. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13926. var currentProject = getCurrentProject();
  13927. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13928. // handles.fileTree.reload()
  13929. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13930. _this.showModule(rawData);
  13931. });
  13932. eventBus.subscribe(EventType.Undo, function () {
  13933. _this.onUndo();
  13934. });
  13935. eventBus.subscribe(EventType.Redo, function () {
  13936. _this.onRedo();
  13937. });
  13938. eventBus.subscribe(EventType.Cut, function (_a) {
  13939. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13940. _this.onCut(a, b, c, d);
  13941. });
  13942. eventBus.subscribe(EventType.Copy, function (_a) {
  13943. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13944. _this.onCopy(a, b, c, d);
  13945. });
  13946. eventBus.subscribe(EventType.Paste, function (_a) {
  13947. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13948. _this.onPaste(a, b, c, d);
  13949. });
  13950. eventBus.subscribe(EventType.SelectAll, function () {
  13951. _this.onSelectAll();
  13952. });
  13953. eventBus.subscribe(EventType.SelectAll, function () {
  13954. _this.onSelectAll();
  13955. });
  13956. eventBus.subscribe(EventType.RunCheckModule, function () {
  13957. _this.runCheckModule();
  13958. });
  13959. eventBus.subscribe(EventType.StopCheckModule, function () {
  13960. _this.stopCheckModule();
  13961. });
  13962. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13963. _this.onCompoentContextMenu(args);
  13964. });
  13965. this.runCheckModule();
  13966. };
  13967. Workbench.prototype.onCompoentContextMenu = function (args) {
  13968. var _this = this;
  13969. if (!this.yvgridDesign) {
  13970. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13971. this.yvgridDesign.showDialog(null, {}, {});
  13972. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13973. this.yvgridDesign.onDestroy = function () {
  13974. fn_1();
  13975. _this.yvgridDesign = null;
  13976. };
  13977. }
  13978. };
  13979. Workbench.prototype.runCheckModule = function () {
  13980. var _this = this;
  13981. if (this.checkTimer) {
  13982. return;
  13983. }
  13984. this.checkTimer = setInterval(function () {
  13985. var _a;
  13986. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13987. _this.activeModulePage.check();
  13988. }
  13989. }, 5000);
  13990. };
  13991. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13992. var dlg = new WidgetDesign(widgetPath, widgetName);
  13993. dlg.showPage({
  13994. id: 'widget_' + widgetPath,
  13995. path: 'widget_' + widgetPath,
  13996. }, {
  13997. data: {
  13998. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13999. }
  14000. });
  14001. dlg.dialogSuccess = successCallback;
  14002. };
  14003. Workbench.prototype.stopCheckModule = function () {
  14004. clearInterval(this.checkTimer);
  14005. this.checkTimer = null;
  14006. };
  14007. Workbench.prototype.showDataSync = function () {
  14008. var ins = new DbSync();
  14009. ins.showPage({
  14010. id: 'db_sync__',
  14011. path: 'db_sync__',
  14012. }, {
  14013. data: {}
  14014. });
  14015. };
  14016. /**
  14017. * 打开一个项目
  14018. */
  14019. Workbench.prototype.openProject = function (project) {
  14020. setCurrentProject(project);
  14021. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  14022. handles$1.fileTree.reload();
  14023. };
  14024. /**
  14025. * 打开模板开发面板
  14026. */
  14027. Workbench.prototype.showTemplateDev = function () {
  14028. var ins = new TemplateDev();
  14029. ins.showPage({
  14030. id: 'template_dev__',
  14031. path: 'template_dev__',
  14032. }, {
  14033. data: {}
  14034. });
  14035. };
  14036. Workbench.prototype.openScope = function () {
  14037. };
  14038. /**
  14039. * 显示字段域管理器
  14040. */
  14041. Workbench.prototype.showColumnDomain = function () {
  14042. var instance = new DbDomain();
  14043. instance.showPage({
  14044. id: 'domain__',
  14045. path: 'domain__',
  14046. }, {
  14047. data: {}
  14048. });
  14049. };
  14050. /**
  14051. * 显示性能统计
  14052. */
  14053. Workbench.prototype.showPerform = function () {
  14054. // const instance = new PerformStats()
  14055. // instance.showPage({
  14056. // id: 'perform__',
  14057. // path: 'perform__',
  14058. //
  14059. // }, {
  14060. // data: {}
  14061. // })
  14062. };
  14063. /**
  14064. * 显示数据库代码模板库
  14065. */
  14066. Workbench.prototype.showDbCodeTemplate = function () {
  14067. // const instance = new DbCodeTemplate()
  14068. // instance.showPage({
  14069. // id: 'dbcode__',
  14070. // path: 'dbcode__',
  14071. //
  14072. // }, {
  14073. // data: {}
  14074. // })
  14075. };
  14076. /**
  14077. * 显示数据库代码模板库
  14078. */
  14079. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14080. var instance = new ReportDesign();
  14081. instance.showPage({
  14082. id: 'report_' + report_id,
  14083. path: 'report_' + report_id,
  14084. }, {
  14085. data: {
  14086. report_id: report_id,
  14087. report_name: report_name,
  14088. }
  14089. });
  14090. instance.dialogSuccess = success;
  14091. };
  14092. /**
  14093. * 显示报表
  14094. */
  14095. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14096. instance.showPage({
  14097. id: 'REPORT__' + report_id,
  14098. path: 'REPORT__' + report_id,
  14099. }, {
  14100. data: {
  14101. report_id: report_id,
  14102. }
  14103. });
  14104. var reportName = instance.viewModel.get('report_name');
  14105. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14106. };
  14107. /**
  14108. * 显示运维页面
  14109. */
  14110. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14111. // const instance = new DevOpsTerminal()
  14112. // instance.showPage({
  14113. // id: 'ops_' + opsId,
  14114. // path: 'ops_' + opsId,
  14115. //
  14116. // }, {
  14117. // data: {
  14118. // opsId: opsId,
  14119. // name: name,
  14120. // }
  14121. // })
  14122. // instance.dialogSuccess = success
  14123. };
  14124. /**
  14125. * 显示表结构
  14126. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14127. * columnName 可以为空
  14128. */
  14129. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14130. var id = 'tableColumn_' + tableName;
  14131. var isCreateTable = false;
  14132. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14133. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14134. if (!tableName) {
  14135. id = _$2.uniqueId('new_table');
  14136. tableName = id;
  14137. isCreateTable = true;
  14138. }
  14139. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14140. instance.showPage({
  14141. id: id,
  14142. path: id,
  14143. locatPath: locatPath
  14144. }, {
  14145. data: {
  14146. tableName: tableName,
  14147. columnName: columnName
  14148. }
  14149. });
  14150. };
  14151. /**
  14152. * 打开某个模块
  14153. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14154. */
  14155. Workbench.prototype.showModule = function (rawData) {
  14156. var id = rawData.id, path = rawData.path;
  14157. var separator = '/';
  14158. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14159. var module = this.modules[idx];
  14160. var pageId = path.replaceAll('/', '_');
  14161. console.log('open module', module);
  14162. var instance = new ModulePage(id, module);
  14163. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14164. instance.showPage({
  14165. id: 'module_' + pageId,
  14166. path: path,
  14167. title: module.name
  14168. }, {
  14169. data: {}
  14170. });
  14171. };
  14172. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14173. var bpmnDesign = new BpmnDesign();
  14174. bpmnDesign.showPage({}, {
  14175. data: {
  14176. absolutePath: absolutePath,
  14177. id: id,
  14178. text: text
  14179. }
  14180. });
  14181. };
  14182. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14183. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14184. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14185. layoutDesign.showPage({
  14186. id: id,
  14187. path: id,
  14188. }, {
  14189. data: {}
  14190. });
  14191. };
  14192. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14193. var _a;
  14194. // this.activeModulePage = newCard.yvanScope
  14195. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14196. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14197. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14198. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14199. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14200. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14201. eventBus.publish(EventType.MainTabChange, {
  14202. moduleId: newCard.yvanScope.moduleId,
  14203. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14204. from: this.name
  14205. });
  14206. };
  14207. Workbench.prototype.onUndo = function () {
  14208. var _a;
  14209. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14210. };
  14211. Workbench.prototype.onRedo = function () {
  14212. var _a;
  14213. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14214. };
  14215. Workbench.prototype.onCut = function (a, b, c, d) {
  14216. var _a;
  14217. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14218. };
  14219. Workbench.prototype.onCopy = function (a, b, c, d) {
  14220. var _a;
  14221. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14222. };
  14223. Workbench.prototype.onPaste = function (a, b, c, d) {
  14224. var _a;
  14225. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14226. };
  14227. Workbench.prototype.onSelectAll = function () {
  14228. var _a;
  14229. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14230. };
  14231. return Workbench;
  14232. }(Scope));
  14233. //# sourceMappingURL=Workbench.js.map
  14234. (function (FuncDomain) {
  14235. FuncDomain["SCOPE"] = "scope";
  14236. FuncDomain["SYSTEM"] = "system";
  14237. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14238. (function (BizMode) {
  14239. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14240. BizMode[BizMode["query"] = 1] = "query";
  14241. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14242. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14243. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14244. })(exports.BizMode || (exports.BizMode = {}));
  14245. (function (BizFormat) {
  14246. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14247. BizFormat[BizFormat["button"] = 1] = "button";
  14248. BizFormat[BizFormat["progress"] = 2] = "progress";
  14249. BizFormat[BizFormat["date"] = 3] = "date";
  14250. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14251. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14252. })(exports.BizFormat || (exports.BizFormat = {}));
  14253. (function (BizUnique) {
  14254. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14255. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14256. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14257. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14258. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14259. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14260. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14261. })(exports.BizUnique || (exports.BizUnique = {}));
  14262. var ScopeEngine = /** @class */ (function () {
  14263. function ScopeEngine() {
  14264. }
  14265. ScopeEngine.getBizFile = function (director) {
  14266. return new Promise(function (resolve, reject) {
  14267. debugger;
  14268. });
  14269. };
  14270. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14271. return new Promise(function (resolve, reject) {
  14272. var requireArr = [];
  14273. var requireKeyArr = [];
  14274. _$2.forOwn(billFile.domains, function (v, k) {
  14275. requireArr.push(v.domain);
  14276. requireKeyArr.push(k);
  14277. if (v.layout) {
  14278. requireArr.push(v.layout);
  14279. requireKeyArr.push(k + "_layout");
  14280. }
  14281. });
  14282. requireArr.push(billFile.layout);
  14283. requireKeyArr.push("layout");
  14284. requireArr.push(billFile.converter);
  14285. requireKeyArr.push("converter");
  14286. // @ts-ignore
  14287. require(requireArr, function () {
  14288. var requireReArr = [];
  14289. for (var _i = 0; _i < arguments.length; _i++) {
  14290. requireReArr[_i] = arguments[_i];
  14291. }
  14292. if (requireReArr.length <= 0) {
  14293. reject(new Error("没有加载到相关的文件!"));
  14294. }
  14295. var domains = {};
  14296. for (var i = 0; i < requireReArr.length - 2; i++) {
  14297. if (requireKeyArr[i].endsWith("_layout")) {
  14298. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14299. domains[key_d].layout = requireReArr[i].default;
  14300. }
  14301. else {
  14302. domains[requireKeyArr[i]] = requireReArr[i].default;
  14303. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14304. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14305. }
  14306. }
  14307. var bizFile = {
  14308. bill: billFile,
  14309. domains: domains,
  14310. layout: requireReArr[requireReArr.length - 2].default,
  14311. converter: requireReArr[requireReArr.length - 1].default,
  14312. };
  14313. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14314. scope.billSetting = bizFile;
  14315. resolve(scope);
  14316. });
  14317. });
  14318. };
  14319. ScopeEngine.buildScopeFromPath = function (path) {
  14320. return new Promise(function (resolve, reject) {
  14321. // @ts-ignore
  14322. require([path], function (bill) {
  14323. bill = bill.default;
  14324. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14325. resolve(scope);
  14326. }).catch(function (e) {
  14327. reject(e);
  14328. });
  14329. });
  14330. });
  14331. };
  14332. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14333. var controller = {};
  14334. var vjson = {
  14335. layout: 'fit',
  14336. title: bizFile.bill.name,
  14337. items: []
  14338. };
  14339. var model = {};
  14340. if (bizFile.layout.layout === "fit") {
  14341. vjson.items = bizFile.layout.items;
  14342. }
  14343. else if (bizFile.layout.layout === "border") {
  14344. vjson.items = [bizFile.layout];
  14345. }
  14346. var domainsVjson = {};
  14347. _$2.forOwn(bizFile.domains, function (v, k) {
  14348. var domainVjson = null;
  14349. var buttons = bizFile.domains[k].buttons;
  14350. if (bizFile.bill.domains[k].mode === "form") {
  14351. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14352. if (Array.isArray(buttons) && buttons.length > 0) {
  14353. if (bizFile.bill.domains[k].type === "header") {
  14354. vjson.tbar = {
  14355. xtype: 'toolbar',
  14356. items: ScopeEngine.buildButton(controller, buttons)
  14357. };
  14358. }
  14359. else {
  14360. domainVjson.items.push({
  14361. xtype: "cols",
  14362. items: ScopeEngine.buildButton(controller, buttons)
  14363. });
  14364. }
  14365. }
  14366. }
  14367. else if (bizFile.bill.domains[k].mode === "table") {
  14368. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14369. if (Array.isArray(buttons) && buttons.length > 0) {
  14370. if (bizFile.bill.domains[k].type === "header") {
  14371. vjson.tbar = {
  14372. xtype: 'toolbar',
  14373. items: ScopeEngine.buildButton(controller, buttons)
  14374. };
  14375. }
  14376. else {
  14377. domainVjson.tbar = {
  14378. xtype: 'toolbar',
  14379. items: ScopeEngine.buildButton(controller, buttons)
  14380. };
  14381. }
  14382. }
  14383. }
  14384. if (domainVjson) {
  14385. domainsVjson[k] = domainVjson;
  14386. }
  14387. });
  14388. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14389. var scope = new Scope({ model: model, vjson: vjson });
  14390. scope['bill_define'] = bizFile;
  14391. _$2.merge(scope, controller);
  14392. console.log('bill_define', vjson, scope, scope['bill_define']);
  14393. return scope;
  14394. };
  14395. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14396. var fieldGroups = {};
  14397. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14398. var field = bizFile.domains[domainKey].fields[i];
  14399. var item = { sort: field.form_sort };
  14400. item.xtype = field.xtype;
  14401. item.fieldLabel = field.column_desc;
  14402. item.bind = {
  14403. value: "{" + domainKey + "." + field.column_name + "}",
  14404. };
  14405. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14406. // if (field.disabled !== "true" && field.disabled !== "false") {
  14407. // item.bind.disabled = eval(field.disabled)
  14408. // } else {
  14409. // item.disabled = (field.disabled === "true")
  14410. // }
  14411. // if (field.readonly !== "true" && field.readonly !== "false") {
  14412. // item.bind.disabled = eval(field.readonly)
  14413. // } else {
  14414. // item.readonly = (field.readonly === "true")
  14415. // }
  14416. // if (field.required !== "true" && field.required !== "false") {
  14417. // item.bind.required = eval(field.required)
  14418. // } else {
  14419. // item.required = (field.required === "true")
  14420. // }
  14421. // if (field.hide !== "true" && field.hide !== "false") {
  14422. // item.bind.hidden = eval(field.hide)
  14423. // } else {
  14424. // item.hidden = (field.hide === "true")
  14425. // }
  14426. // item.flex = field.
  14427. if (field.dict) {
  14428. item.fix = eval(field.dict);
  14429. }
  14430. // _.set(formModel, "", "")
  14431. item.field = field;
  14432. if (field.form_group) {
  14433. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14434. fieldGroups[field.form_group] = [item];
  14435. }
  14436. else {
  14437. fieldGroups[field.form_group].push(item);
  14438. }
  14439. }
  14440. }
  14441. var formVjson = {
  14442. xtype: "form",
  14443. title: bizFile.domains[domainKey].name,
  14444. items: []
  14445. };
  14446. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14447. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14448. if (items) {
  14449. var fieldsetVjson = {
  14450. xtype: "fieldset",
  14451. title: k,
  14452. items: items
  14453. };
  14454. formVjson.items.push(fieldsetVjson);
  14455. }
  14456. });
  14457. return formVjson;
  14458. };
  14459. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14460. // const vjson = { xtype: "grid", items: []}
  14461. var gridVjson = {
  14462. xtype: "yvgrid",
  14463. columns: [],
  14464. split: true,
  14465. reference: domainKey,
  14466. listeners: {
  14467. itemdblclick: function () {
  14468. },
  14469. },
  14470. };
  14471. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14472. var field = bizFile.domains[domainKey].fields[i];
  14473. gridVjson.columns.push({
  14474. dataIndex: field.column_name,
  14475. header: field.column_desc,
  14476. });
  14477. }
  14478. return gridVjson;
  14479. };
  14480. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14481. var colGroups = [{
  14482. xtype: "cols",
  14483. items: []
  14484. }];
  14485. var colGroup = colGroups[0];
  14486. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14487. for (var i = 0; i < fieldGroup.length; i++) {
  14488. var field = fieldGroup[i];
  14489. if (field.field.form_newline === "true") {
  14490. if (colGroup.items.length > 0) {
  14491. colGroup = {
  14492. xtype: "cols",
  14493. items: [field]
  14494. };
  14495. colGroups.push(colGroup);
  14496. }
  14497. }
  14498. else {
  14499. colGroup.items.push(field);
  14500. }
  14501. delete field.field;
  14502. }
  14503. return colGroups;
  14504. };
  14505. ScopeEngine.buildButton = function (controller, buttons) {
  14506. var buttonsVjson = [];
  14507. var _loop_1 = function (i) {
  14508. var item = buttons[i];
  14509. var button = {
  14510. xtype: "button",
  14511. text: item.btn_name,
  14512. iconCls: item.icon
  14513. };
  14514. if (item.hidden === "true" || item.hidden === "false") {
  14515. button.hidden = (item.hidden === "true");
  14516. }
  14517. if (item.listeners) {
  14518. var listeners_1 = {};
  14519. _$2.forOwn(item.listeners, function (v, k) {
  14520. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14521. listeners_1[k] = v;
  14522. }
  14523. else {
  14524. try {
  14525. listeners_1[k] = eval(v);
  14526. }
  14527. catch (e) {
  14528. throw e;
  14529. }
  14530. }
  14531. });
  14532. button.listeners = listeners_1;
  14533. }
  14534. buttonsVjson.push(button);
  14535. };
  14536. for (var i = 0; i < buttons.length; i++) {
  14537. _loop_1(i);
  14538. }
  14539. return buttonsVjson;
  14540. };
  14541. ScopeEngine.buildListeners = function (controller, item) {
  14542. if (!item.hasOwnProperty("listeners")) {
  14543. return;
  14544. }
  14545. _$2.forOwn(item.listeners, function (v, k) {
  14546. if (v && typeof v === "string") {
  14547. if (v.indexOf(".") > -1) {
  14548. var strArr = v.split(".");
  14549. if (strArr.length != 2) {
  14550. console.error(item.listeners, "语法解析错误,请检查!");
  14551. }
  14552. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14553. switch (funcDomain) {
  14554. case exports.FuncDomain.SCOPE:
  14555. controller[k] = findCustFunc(item, k);
  14556. break;
  14557. case exports.FuncDomain.SYSTEM:
  14558. break;
  14559. default:
  14560. throw new Error("错误的函数域定义");
  14561. }
  14562. }
  14563. else {
  14564. var func = eval(v);
  14565. if (typeof func === 'function') {
  14566. controller[k] = func;
  14567. }
  14568. throw new Error("解析自定义函数出错");
  14569. }
  14570. }
  14571. });
  14572. var findCustFunc = function (item, funcName) {
  14573. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14574. throw new Error("没有找到相关的函数定义");
  14575. }
  14576. var func = eval(item[funcName]);
  14577. if (typeof func === 'function') {
  14578. return func;
  14579. }
  14580. throw new Error("解析自定义函数出错");
  14581. };
  14582. };
  14583. /**
  14584. * 只检索 items 的模式,深度遍历 vjson
  14585. */
  14586. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14587. if (Array.isArray(vjson)) {
  14588. for (var i = 0; i < vjson.length; i++) {
  14589. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14590. }
  14591. }
  14592. else {
  14593. _$2.forOwn(vjson, function (v, k) {
  14594. if (k !== "domain") {
  14595. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14596. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14597. }
  14598. }
  14599. else {
  14600. delete vjson.domain;
  14601. _$2.merge(vjson, domainsVjson[v]);
  14602. }
  14603. });
  14604. }
  14605. };
  14606. return ScopeEngine;
  14607. }());
  14608. //# sourceMappingURL=ScopeEngine.js.map
  14609. function initComponent () {
  14610. var ct = Ext.Component.prototype.constructor;
  14611. Ext.Component.override({
  14612. constructor: function (config) {
  14613. var _a, _b;
  14614. if (!isDesignMode(this, config)) {
  14615. var me_1 = this;
  14616. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14617. _$2.each(baseConfigProcessList, function (process) {
  14618. process.call(me_1, me_1, config);
  14619. });
  14620. }
  14621. if (config) {
  14622. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14623. config.i18nPath = config.$initParent.i18nPath;
  14624. }
  14625. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14626. var setTitle_1 = config.$initParent.setTitle;
  14627. var handel_1 = config.$initParent;
  14628. config.$initParent.setTitle = function (title) {
  14629. var t = { title: title };
  14630. var WMSTranslate = window["WMSTranslate"];
  14631. if (WMSTranslate) {
  14632. if (typeof window['viewTranslate'] === 'function') {
  14633. window['viewTranslate'](t, title, "title");
  14634. }
  14635. }
  14636. setTitle_1.call(handel_1, t.title);
  14637. }.bind(config.$initParent);
  14638. }
  14639. var WMSTranslate = window["WMSTranslate"];
  14640. if (WMSTranslate) {
  14641. if (typeof window['viewTranslate'] === 'function') {
  14642. window['viewTranslate'](config, config.text, "text");
  14643. window['viewTranslate'](config, config.title, "title");
  14644. window['viewTranslate'](config, config.header, "header");
  14645. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14646. window['viewTranslate'](config, config.emptyText, "emptyText");
  14647. }
  14648. }
  14649. }
  14650. ct.call(this, config);
  14651. }
  14652. });
  14653. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14654. Ext.picker.Date.override({
  14655. initComponent: function () {
  14656. var me = this;
  14657. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14658. _initComponent.call(me);
  14659. },
  14660. selectToday: function () {
  14661. var me = this, btn = me.todayBtn, handler = me.handler;
  14662. if (btn && !btn.disabled) {
  14663. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14664. me.fireEvent('select', me, me.value);
  14665. if (handler) {
  14666. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14667. }
  14668. me.onSelect();
  14669. }
  14670. return me;
  14671. },
  14672. });
  14673. }
  14674. //# sourceMappingURL=component.js.map
  14675. function initMainTab () {
  14676. Ext.define('Yvan.MainTab', {
  14677. extend: 'Ext.tab.Panel',
  14678. xtype: 'maintab',
  14679. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14680. closeTabText: '关闭',
  14681. closeOthersTabsText: '关闭其他',
  14682. closeAllTabsText: '关闭所有'
  14683. }),
  14684. constructor: function (config) {
  14685. var me = this;
  14686. var newConfig = _$2.defaultsDeep({
  14687. // 强制属性
  14688. }, config);
  14689. this.superclass.constructor.call(me, newConfig);
  14690. },
  14691. initComponent: function () {
  14692. var me = this;
  14693. this.on({
  14694. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14695. _$2.defer(function () {
  14696. me.changeHash(newCard.id);
  14697. window['cp'] = newCard.yvanScope;
  14698. });
  14699. $$2(window).trigger('tabChange', {
  14700. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14701. });
  14702. },
  14703. afterrender: function () {
  14704. _$2.defer(function () {
  14705. me.tryRestoryPage();
  14706. });
  14707. }
  14708. });
  14709. this.superclass.initComponent.call(me);
  14710. },
  14711. tryRestoryPage: function () {
  14712. var me = this;
  14713. var hash = '' + window.location.hash;
  14714. if (hash && hash.indexOf('page=') > 0) {
  14715. if (hash.startsWith('#')) {
  14716. hash = hash.substr(1);
  14717. }
  14718. if (hash) {
  14719. var page = Qs.parse(hash).page;
  14720. if (page) {
  14721. // this.openScope(page)
  14722. me.fireEvent('restorypage', page);
  14723. }
  14724. }
  14725. }
  14726. },
  14727. changeHash: function (id) {
  14728. window.location.hash = Qs.stringify({ page: id });
  14729. },
  14730. /**
  14731. * 添加一个业务模块实例到选项卡
  14732. * @param scopeInstance 业务对象实例
  14733. * @param config ExtJS配置对象
  14734. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14735. */
  14736. addScope: function (scopeInstance, config, panelInitCallback) {
  14737. scopeInstance.topScope = scopeInstance;
  14738. var me = this;
  14739. if (config.path) {
  14740. for (var i = 0; i < this.items.items.length; i++) {
  14741. // 找到当前 tabs 里有没有已经打开过
  14742. var tab = this.items.items[i];
  14743. if (_$2.isEqual(tab.path, config.path)) {
  14744. // 激活
  14745. this.setActiveTab(tab);
  14746. return tab;
  14747. }
  14748. }
  14749. }
  14750. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14751. if (typeof panelInitCallback === 'function') {
  14752. panelInitCallback(newPanel);
  14753. }
  14754. // 添加业务模块
  14755. var newTab = this.add(newPanel);
  14756. this.setActiveTab(newTab);
  14757. newTab.on({
  14758. destroy: function (sender) {
  14759. me.changeHash('');
  14760. delete window['cp'];
  14761. }
  14762. });
  14763. return newTab;
  14764. }
  14765. });
  14766. }
  14767. //# sourceMappingURL=MainTab.js.map
  14768. /**
  14769. * 构建所有组件的公共属性
  14770. * @param config 原始config
  14771. * @param dragType 组件模式
  14772. * 不填,代表不能在设计时被拖拽
  14773. * row-container 是一个rows容器
  14774. * col-container 是一个cols容器
  14775. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14776. * row-item rows中的一行,比如 tree / grid / panel 等等
  14777. */
  14778. function baseConfig(config, dragType) {
  14779. // if (isDesignMode(config, undefined) && dragType) {
  14780. if (typeof config === 'object') {
  14781. var cc = '';
  14782. switch (dragType) {
  14783. case "cols-container":
  14784. cc = 'design_cols_container';
  14785. break;
  14786. case "col-item":
  14787. cc = 'design_col_item';
  14788. break;
  14789. case "rows-container":
  14790. cc = 'design_rows_container';
  14791. break;
  14792. case "row-item":
  14793. cc = 'design_row_item';
  14794. break;
  14795. }
  14796. if (typeof config.cls === 'string') {
  14797. _$2.extend(config, {
  14798. cls: [config.cls, 'yvan_design', cc]
  14799. });
  14800. }
  14801. else if (_$2.isArray(config.cls)) {
  14802. _$2.extend(config, {
  14803. cls: __spread(config.cls, ['yvan_design', cc])
  14804. });
  14805. }
  14806. else {
  14807. _$2.extend(config, {
  14808. cls: ['yvan_design', cc]
  14809. });
  14810. }
  14811. }
  14812. return config;
  14813. }
  14814. //# sourceMappingURL=base.js.map
  14815. function initPanel () {
  14816. /**
  14817. *
  14818. */
  14819. var ct = Ext.panel.Panel.prototype.constructor;
  14820. Ext.panel.Panel.override({
  14821. constructor: function (config) {
  14822. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14823. ct.call(this, newConfig);
  14824. }
  14825. });
  14826. var ss = Ext.form.FieldContainer.prototype;
  14827. Ext.form.FieldContainer.override({
  14828. config: __assign({}, fieldContainer)
  14829. });
  14830. }
  14831. //# sourceMappingURL=panel.js.map
  14832. function initGridColumn () {
  14833. var ct = Ext.grid.column.Column.prototype.constructor;
  14834. Ext.grid.column.Column.override({
  14835. constructor: function (config) {
  14836. var scope = lookupScope(config.$initParent.$initParent);
  14837. var newConfig = _$2.defaults({}, config, column);
  14838. if (typeof newConfig.summaryRenderer === 'string') {
  14839. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14840. if (typeof newConfig.summaryRenderer === 'function') {
  14841. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14842. }
  14843. }
  14844. if (config.formatter === 'datetime') {
  14845. newConfig.fix = ['system.formatDate()'];
  14846. delete newConfig.formatter;
  14847. }
  14848. // 在 grid.constructor 已经转换过了
  14849. // if (typeof newConfig.renderer === 'string') {
  14850. // newConfig.renderer = lookupFn(scope, config.renderer)
  14851. // if (typeof newConfig.renderer === 'function') {
  14852. // newConfig.renderer = newConfig.renderer.bind(scope)
  14853. // }
  14854. // }
  14855. ct.call(this, newConfig);
  14856. }
  14857. });
  14858. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14859. Ext.grid.column.Action.override({
  14860. constructor: function (config) {
  14861. var scope = lookupScope(config.$initParent.$initParent);
  14862. _$2.forEach(config.items, function (item) {
  14863. if (typeof item.handler === 'string') {
  14864. item.handler = lookupFn(scope, item.handler);
  14865. if (typeof item.handler === 'function') {
  14866. item.handler = item.handler.bind(scope);
  14867. }
  14868. }
  14869. });
  14870. ctAction.call(this, config);
  14871. }
  14872. });
  14873. var ck = Ext.grid.column.Check.prototype.constructor;
  14874. Ext.grid.column.Check.override({
  14875. constructor: function (config) {
  14876. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14877. var grid = sender.view.grid.ownerGrid;
  14878. var column = grid.getColumns()[sender.fullColumnIndex];
  14879. var context = {
  14880. event: e,
  14881. column: column,
  14882. field: sender.dataIndex,
  14883. value: checked,
  14884. record: record,
  14885. rowIdx: rowIndex
  14886. };
  14887. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14888. });
  14889. ck.call(this, config);
  14890. }
  14891. });
  14892. // 227573
  14893. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14894. // Ext.define('Yvan.ColumnOverride', {
  14895. // override: 'Ext.grid.column.Column',
  14896. //
  14897. // config: {
  14898. // enableSortOnClick: false,
  14899. // },
  14900. //
  14901. // // /**@Overrides*/
  14902. // onTitleElClick: function (e, t, sortOnClick) {
  14903. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14904. // if (!$(e.target).is('.x-column-header-trigger')) {
  14905. // // 不是点击菜单的情况下,让列自适应宽度
  14906. // this.autoSize()
  14907. // }
  14908. // return onTitleElClick.call(this, e, t, false)
  14909. // }
  14910. // });
  14911. }
  14912. //# sourceMappingURL=gridcolumn.js.map
  14913. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14914. /**
  14915. * 判断目标字符串与关键字是否重叠
  14916. * @param target 目标字符串
  14917. * @param keyword 搜索关键字
  14918. */
  14919. function pinyinMatch(target, keyword) {
  14920. if (typeof target != 'string' || typeof keyword != 'string') {
  14921. return false;
  14922. }
  14923. if (!keyword || !target) {
  14924. return false;
  14925. }
  14926. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14927. keyword = _$2.toLower(keyword);
  14928. var pos1 = _$2.toLower(target).indexOf(keyword);
  14929. if (pos1 >= 0) {
  14930. return true;
  14931. }
  14932. var len = _$2.intersection(keyword.split('')).length;
  14933. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14934. return true;
  14935. }
  14936. return false;
  14937. }
  14938. /**
  14939. * 对某个表达式进行求值
  14940. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14941. *
  14942. * @example
  14943. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14944. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14945. *
  14946. * @param data 数据环境对象
  14947. * @param express 表达式对象
  14948. */
  14949. function calcExpress(data, express) {
  14950. var result = express;
  14951. if (SIMPLE_RE.test(express)) {
  14952. // '{foo}' 简单表达式
  14953. var path = express.substring(1, express.length - 1);
  14954. var ret = _$2.get(data, path);
  14955. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14956. }
  14957. while (true) {
  14958. var mlist = result.match(/{(.*?)}/);
  14959. if (!mlist) {
  14960. break;
  14961. }
  14962. var pathC = mlist[0]; // {query.a}
  14963. var path = mlist[1]; // query.a
  14964. var value = _$2.get(data, path);
  14965. result = result.replaceAll(pathC, value || '');
  14966. }
  14967. return result;
  14968. }
  14969. /**
  14970. * 对个对象进行表达式求值,不用回调
  14971. * @example
  14972. * 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}'] })
  14973. *
  14974. * {
  14975. * a: '{query.a}',
  14976. * b: {
  14977. * b1: '{query.b1}',
  14978. * b2: '{query.b2}',
  14979. * },
  14980. * c: 'aa',
  14981. * d: [
  14982. * '{query.d1}',
  14983. * '{query.d2}'
  14984. * ]
  14985. * }
  14986. *
  14987. * 计算结果为
  14988. * {
  14989. * a: 'aValue',
  14990. * b: {
  14991. * b1: 'b1Value',
  14992. * b2: 'b2Value'
  14993. * },
  14994. * c: 'aa'
  14995. * d: [
  14996. * '1',
  14997. * '2'
  14998. * ]
  14999. * }
  15000. *
  15001. * @param data
  15002. * @param paramObject
  15003. */
  15004. function calcObjectFlat(data, paramObject) {
  15005. var result = _$2.cloneDeep(paramObject);
  15006. if (typeof paramObject === 'string') {
  15007. return calcExpress(data, paramObject);
  15008. }
  15009. var trav = function (param) {
  15010. _$2.forOwn(param, function (value, key) {
  15011. if (_$2.isPlainObject(value)) {
  15012. // 深度递归,对子对象进行求解
  15013. trav(value);
  15014. }
  15015. else if (_$2.isString(value)) {
  15016. // 字符串直接用 calcExpress 表达式求解
  15017. param[key] = calcExpress(data, param[key]);
  15018. }
  15019. else if (_$2.isArray(value)) {
  15020. // 数组求解
  15021. _$2.each(value, function (v, idx) {
  15022. value[idx] = calcExpress(data, v);
  15023. });
  15024. }
  15025. });
  15026. };
  15027. trav(result);
  15028. return result;
  15029. }
  15030. /**
  15031. * 合併 data 到當前的 ViewModel 對象
  15032. */
  15033. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  15034. var newRow = {};
  15035. if (isFlat == false) {
  15036. newRow = data;
  15037. }
  15038. else {
  15039. flatObject(newRow, '', data);
  15040. }
  15041. if (!propertyName) {
  15042. _$2.forOwn(newRow, function (value, key) {
  15043. viewModel.set(key, value);
  15044. });
  15045. }
  15046. else {
  15047. _$2.forOwn(newRow, function (value, key) {
  15048. viewModel.set(propertyName + "." + key, value);
  15049. });
  15050. }
  15051. }
  15052. /**
  15053. * 转换内联结构的行,到平面结构
  15054. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  15055. *
  15056. * @param array
  15057. * @param flatOption
  15058. * @return {[]}
  15059. */
  15060. function flatRow(array) {
  15061. var ret = [];
  15062. _$2.forEach(array, function (row) {
  15063. var newRow = {};
  15064. flatObject(newRow, '', row);
  15065. ret.push(newRow);
  15066. });
  15067. return ret;
  15068. }
  15069. function flatObject(parentObj, parentProp, obj) {
  15070. _$2.forOwn(obj, function (value, key) {
  15071. var fullKey = parentProp ? parentProp + '_' + key : key;
  15072. if (_$2.isArray(value)) {
  15073. parentObj[fullKey] = _$2.map(value, function (row) {
  15074. var newRow = {};
  15075. flatObject(newRow, '', row);
  15076. return newRow;
  15077. });
  15078. }
  15079. else {
  15080. if (typeof value === 'object') {
  15081. flatObject(parentObj, fullKey, value);
  15082. }
  15083. else {
  15084. parentObj[fullKey] = value;
  15085. }
  15086. }
  15087. });
  15088. }
  15089. /**
  15090. * 替换内部结构中,所有 N/A
  15091. */
  15092. function replaceNA(obj) {
  15093. if (obj === 'N/A') {
  15094. return '';
  15095. }
  15096. if (_$2.isArray(obj)) {
  15097. _$2.forEach(obj, function (value, idx) {
  15098. if (value === 'N/A') {
  15099. obj[idx] = '';
  15100. }
  15101. else {
  15102. replaceNA(value);
  15103. }
  15104. });
  15105. }
  15106. else if (_$2.isPlainObject(obj)) {
  15107. _$2.forOwn(obj, function (value, key) {
  15108. if (value === 'N/A') {
  15109. obj[key] = '';
  15110. }
  15111. else {
  15112. replaceNA(value);
  15113. }
  15114. });
  15115. }
  15116. }
  15117. function deepTravJson(obj, resolver) {
  15118. if (_$2.isArray(obj)) {
  15119. _$2.forEach(obj, function (value, idx) {
  15120. if (typeof value === 'string') {
  15121. resolver(obj, value, idx);
  15122. }
  15123. else {
  15124. deepTravJson(value, resolver);
  15125. }
  15126. });
  15127. }
  15128. else if (_$2.isPlainObject(obj)) {
  15129. _$2.forOwn(obj, function (value, key) {
  15130. if (typeof value === 'string') {
  15131. resolver(obj, value, key);
  15132. }
  15133. else {
  15134. deepTravJson(value, resolver);
  15135. }
  15136. });
  15137. }
  15138. }
  15139. /**
  15140. * 根据表达式进入写值
  15141. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15142. * express="test-{query.a}" 写值就会失败
  15143. *
  15144. * @example
  15145. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15146. * 写值成功
  15147. *
  15148. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15149. * 写值失败
  15150. *
  15151. * @param viewModel VM对象
  15152. * @param express 表达式对象
  15153. * @param value 目标值
  15154. */
  15155. function tryWriteByExpress(viewModel, express, value) {
  15156. if (SIMPLE_RE.test(express)) {
  15157. // '{foo}' 简单表达式
  15158. express = express.substring(1, express.length - 1);
  15159. viewModel.set(express, value);
  15160. }
  15161. }
  15162. /**
  15163. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15164. * @example
  15165. * 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]})
  15166. *
  15167. * expressObject:
  15168. * {
  15169. * a: '{query.a}',
  15170. * b: {
  15171. * b1: '{query.b1}',
  15172. * b2: '{query.b2}',
  15173. * },
  15174. * c: 'aa',
  15175. * d: [
  15176. * '{query.a}',
  15177. * '{query.b2}'
  15178. * ]
  15179. * }
  15180. *
  15181. * valueObject:
  15182. * {
  15183. * a: 'aValue',
  15184. * b: {
  15185. * b1: 'b1Value',
  15186. * b2: 'b2Value'
  15187. * },
  15188. * c: 'aa'
  15189. * c: [
  15190. * 'aValue',
  15191. * 'b2Value'
  15192. * ]
  15193. * }
  15194. *
  15195. * 系统会尝试回写
  15196. * viewModel.set('query.a', 'aValue')
  15197. * viewModel.set('query.b1', 'b1Value')
  15198. * viewModel.set('query.b2', 'b2Value')
  15199. *
  15200. * @param expressObject 含表达式的对象
  15201. * @param valueObject 表达式计算完成之后的结果对象
  15202. * @param writeFn 写入的方法 (path, value)=>void
  15203. */
  15204. function tryWriteObject(expressObject, valueObject, writeFn) {
  15205. var trav = function (pathPrefix) {
  15206. var parent = expressObject;
  15207. if (_$2.size(pathPrefix) > 1) {
  15208. parent = _$2.get(parent, pathPrefix.substring(1));
  15209. }
  15210. _$2.forOwn(parent, function (value, key) {
  15211. if (_$2.isPlainObject(value)) {
  15212. // 深度递归,对子对象进行求解
  15213. trav(pathPrefix + "." + key);
  15214. }
  15215. else if (_$2.isString(value)) {
  15216. // 字符串直接用 calcExpress 表达式求解
  15217. if (SIMPLE_RE.test(value)) {
  15218. // If we have '{foo}' alone it is a literal 简单表达式
  15219. var targetPath = value.substring(1, value.length - 1);
  15220. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15221. if (!writeFn) {
  15222. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15223. }
  15224. else {
  15225. writeFn(targetPath, targetValue);
  15226. }
  15227. }
  15228. }
  15229. else if (_$2.isArray(value)) {
  15230. _$2.each(value, function (v, idx) {
  15231. if (SIMPLE_RE.test(v)) {
  15232. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15233. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15234. if (!writeFn) {
  15235. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15236. }
  15237. else {
  15238. writeFn(targetPath, targetValue);
  15239. }
  15240. }
  15241. });
  15242. }
  15243. });
  15244. };
  15245. trav("");
  15246. }
  15247. /**
  15248. * 尝试去掉变量两边括号
  15249. * {a} => a
  15250. * a => a
  15251. */
  15252. function tryVarSimple(value) {
  15253. if (SIMPLE_RE.test(value)) {
  15254. // If we have '{foo}' alone it is a literal 简单表达式
  15255. return value.substring(1, value.length - 1);
  15256. }
  15257. return value;
  15258. }
  15259. /**
  15260. * 对多个表达式进行求值. 异步回调的方式返回
  15261. * {
  15262. * a: 1,
  15263. * b: '{someBind}',
  15264. * c: ['a', 'b', 'c'],
  15265. * d: ['a', 'b', '{someBind}'],
  15266. * e: {
  15267. * y: 1,
  15268. * z: 2
  15269. * },
  15270. * f: {
  15271. * y: 1,
  15272. * z: '{someBind}'
  15273. * }
  15274. * }
  15275. *
  15276. * // Will produce
  15277. * {
  15278. * b: value,
  15279. * d: ['a', 'b', value],
  15280. * f: {
  15281. * y: 1,
  15282. * z: value
  15283. * }
  15284. * }
  15285. * @param viewModel scope.viewModel对象
  15286. * @param paramObject 求值对象
  15287. */
  15288. function calcObject(viewModel, paramObject) {
  15289. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15290. return new Promise(function (resolve) {
  15291. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15292. schedule.destroy();
  15293. // 从 Ext.data.Model 对象转换为 js-object 对象
  15294. ret = toPlainObject(ret);
  15295. resolve(ret);
  15296. }, viewModel, { single: true });
  15297. });
  15298. }
  15299. /**
  15300. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15301. * @param config 组件构造函数传入的 config 配置文件
  15302. */
  15303. function getParentGrid(config) {
  15304. var _a;
  15305. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15306. }
  15307. /**
  15308. * 解析
  15309. * {
  15310. * condition: "{skuId}",
  15311. * errorMsg: "无法编辑",
  15312. * notice: 'msg'
  15313. * }
  15314. */
  15315. function tryEnable(data, enableSetting) {
  15316. if (!enableSetting) {
  15317. // 没有这一段配置,可以编辑
  15318. return true;
  15319. }
  15320. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15321. if (!evalFunction(data, condition)) {
  15322. // 没有达成 condition 条件
  15323. // 计算 msg 消息内容
  15324. var msgContent = calcExpress(data, errorMsg);
  15325. if (msgContent) {
  15326. if (!notice || notice === 'msg') {
  15327. // 进行提示
  15328. msg$1(msgContent);
  15329. }
  15330. }
  15331. return false;
  15332. }
  15333. return true;
  15334. }
  15335. /**
  15336. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15337. * @param sender 目标对象
  15338. * @param config 目标对象的配置(在构造函数之前也可以)
  15339. * @param getDictFn 获取字典的方法
  15340. * @param bizKey 传入字典的参数
  15341. * @param multiValueSeparator 多个字典值的分割符号
  15342. */
  15343. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15344. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15345. // sender 和 config为空的时候获取值、
  15346. if (_$2.isArray(getDictFn)) {
  15347. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15348. var realArray_1 = getDictFn;
  15349. getDictFn = function () {
  15350. return realArray_1;
  15351. };
  15352. }
  15353. if (!sender) {
  15354. return new Promise(function (resolve, reject) {
  15355. getDictFn(bizKey, function (r) {
  15356. resolve({ config: config, r: r });
  15357. });
  15358. });
  15359. }
  15360. if (sender.xtype === 'combotree') {
  15361. getDictFn(bizKey, function (r) {
  15362. if (sender.store) {
  15363. // 异步回传
  15364. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15365. }
  15366. else {
  15367. // 同步回传
  15368. config.store = new Ext.data.TreeStore({ root: r });
  15369. }
  15370. });
  15371. return;
  15372. }
  15373. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15374. getDictFn(bizKey, function (r) {
  15375. var _a, _b;
  15376. if (sender.store) {
  15377. // 异步回传
  15378. sender.setStore(new Ext.data.Store(r));
  15379. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15380. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15381. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15382. if (typeof realValue !== 'undefined') {
  15383. sender.setValue(realValue);
  15384. }
  15385. }
  15386. else {
  15387. // 同步回传
  15388. config.store = new Ext.data.Store(r);
  15389. }
  15390. });
  15391. return;
  15392. }
  15393. else if (sender.xtype === 'gridcolumn') {
  15394. var grid = getParentGrid(config);
  15395. var editor_1 = config.editor, renderer = config.renderer;
  15396. getDictFn(bizKey, function (r) {
  15397. if (sender.store) {
  15398. // 已经渲染出来了, 用方法进行修改
  15399. var editor_2 = sender.getEditor();
  15400. if (editor_2 && editor_2.xtype === 'combo') {
  15401. var valueField_1 = r.field[0];
  15402. var displayField_1 = r.field[1];
  15403. editor_2.valueField = valueField_1;
  15404. editor_2.setDisplayField(displayField_1);
  15405. editor_2.setStore(new Ext.data.Store(r));
  15406. }
  15407. console.log('setFilter', sender, r.data);
  15408. if (!sender.disableListFilter) {
  15409. sender.setFilter({
  15410. type: 'list',
  15411. options: _$2.map(r.data, function (r) { return ({
  15412. id: '' + r.id,
  15413. text: r.text,
  15414. }); })
  15415. });
  15416. }
  15417. }
  15418. else {
  15419. // 没有渲染之前,修改 config 即可
  15420. if (editor_1 && editor_1.xtype === 'combo') {
  15421. // 带编辑模式
  15422. editor_1.store = new Ext.data.Store(r);
  15423. }
  15424. console.log('setFilter', sender, r.data);
  15425. if (!sender.disableListFilter) {
  15426. config.filter = {
  15427. type: 'list',
  15428. options: _$2.map(r.data, function (r) { return ({
  15429. id: '' + r.id,
  15430. text: r.text,
  15431. }); })
  15432. };
  15433. }
  15434. }
  15435. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15436. var renderer = function (value, metaData) {
  15437. if (metaData === void 0) { metaData = false; }
  15438. if (!value && value != 0) {
  15439. return '';
  15440. }
  15441. var valueField = r.field[metaData === true ? 1 : 0];
  15442. var displayField = r.field[metaData === true ? 0 : 1];
  15443. var separator = multiValueSeparator;
  15444. if (separator) {
  15445. var arr = value.split(separator);
  15446. var displayValue_1 = "";
  15447. var _loop_1 = function (i) {
  15448. var itv = arr[i];
  15449. if (i > 0) {
  15450. displayValue_1 += separator;
  15451. }
  15452. _$2.each(r.data, function (row) {
  15453. // 从 valueField 找到要显示的 displayField
  15454. if (row[valueField] == itv) {
  15455. displayValue_1 += row[displayField];
  15456. return false;
  15457. }
  15458. else {
  15459. if (i >= r.data.length - 1) {
  15460. displayValue_1 += itv;
  15461. }
  15462. }
  15463. });
  15464. };
  15465. for (var i = 0; i < arr.length; i++) {
  15466. _loop_1(i);
  15467. }
  15468. return displayValue_1;
  15469. }
  15470. _$2.each(r.data, function (row) {
  15471. // 从 valueField 找到要显示的 displayField
  15472. if (row[valueField] == value) {
  15473. value = row[displayField];
  15474. return false;
  15475. }
  15476. });
  15477. return value;
  15478. };
  15479. var dictForExcel = {};
  15480. var valueField = r.field[0];
  15481. var displayField = r.field[1];
  15482. _$2.each(r.data, function (row) {
  15483. // 从 valueField 找到要显示的 displayField
  15484. var key = row[valueField];
  15485. if (key != '' && typeof key != "undefined" && key != null) {
  15486. dictForExcel[key] = row[displayField];
  15487. }
  15488. });
  15489. if (sender.rendered) {
  15490. // 已经渲染出来了, 对列进行渲染
  15491. sender.renderer = renderer;
  15492. sender.dictForExcel = dictForExcel;
  15493. sender.getView().refresh();
  15494. }
  15495. else {
  15496. sender.renderer = renderer;
  15497. sender.dictForExcel = dictForExcel;
  15498. config.renderer = renderer;
  15499. config.dictForExcel = dictForExcel;
  15500. }
  15501. });
  15502. return;
  15503. }
  15504. throw new TypeError("无法识别的组件类型");
  15505. }
  15506. /**
  15507. * 调用服务器 Ajax
  15508. */
  15509. function invokeServer$1(url) {
  15510. var args = [];
  15511. for (var _i = 1; _i < arguments.length; _i++) {
  15512. args[_i - 1] = arguments[_i];
  15513. }
  15514. // @ts-ignore
  15515. return ajax.func({
  15516. url: url,
  15517. method: 'invoke',
  15518. args: args
  15519. });
  15520. }
  15521. function clearViewModelValues(viewModel, propertyName) {
  15522. if (!propertyName) {
  15523. var dd_1 = viewModel.getData();
  15524. _$2.forOwn(dd_1, function (value, key) {
  15525. viewModel.set(key, '');
  15526. });
  15527. return;
  15528. }
  15529. var dd = _$2.get(viewModel.getData(), propertyName);
  15530. _$2.forOwn(dd, function (value, key) {
  15531. viewModel.set(propertyName + '.' + key, '');
  15532. });
  15533. }
  15534. function reloadGrid(scope, gridRefName) {
  15535. var _a;
  15536. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15537. }
  15538. /**
  15539. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15540. */
  15541. function toPlainObject(obj) {
  15542. if (obj.isModel) {
  15543. obj = obj.data;
  15544. }
  15545. _$2.forOwn(obj, function (v, k) {
  15546. // Ext.data.Model.constructor
  15547. if (!v) {
  15548. return;
  15549. }
  15550. if (v.isModel) {
  15551. v = v.data;
  15552. }
  15553. if (typeof v === 'object') {
  15554. obj[k] = toPlainObject(v);
  15555. }
  15556. else {
  15557. obj[k] = v;
  15558. }
  15559. });
  15560. return obj;
  15561. }
  15562. function confirm(msg, sender) {
  15563. return new Promise(function (resolve) {
  15564. var _a, _b;
  15565. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15566. var t = { msg: msg };
  15567. var WMSTranslate = window["WMSTranslate"];
  15568. if (WMSTranslate) {
  15569. if (typeof window['viewTranslate'] === 'function') {
  15570. window['viewTranslate'](t, msg, "msg");
  15571. }
  15572. }
  15573. var config = {
  15574. title: '请确认',
  15575. modal: true,
  15576. animateTarget: sender,
  15577. // resizable: false,
  15578. // constrainHeader: true,
  15579. // constrain: true,
  15580. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15581. layout: {
  15582. type: 'hbox',
  15583. pack: 'start',
  15584. align: 'stretch'
  15585. },
  15586. items: [
  15587. {
  15588. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15589. border: false,
  15590. },
  15591. {
  15592. flex: 1,
  15593. border: false,
  15594. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15595. }
  15596. ],
  15597. buttons: [
  15598. {
  15599. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15600. handler: function () {
  15601. resolve();
  15602. win.close();
  15603. }
  15604. },
  15605. {
  15606. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15607. handler: function () {
  15608. win.close();
  15609. }
  15610. }
  15611. ],
  15612. keyMapEnabled: true,
  15613. keyMap: {
  15614. ENTER: function () {
  15615. resolve();
  15616. win.close();
  15617. }
  15618. }
  15619. };
  15620. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15621. config.constrain = true;
  15622. }
  15623. var win = new Ext.Window(config);
  15624. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15625. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15626. }
  15627. win.show();
  15628. });
  15629. }
  15630. /**
  15631. * 任何符号字符串都替换成下换线
  15632. */
  15633. function normId(value) {
  15634. return _$2.replace(value, /[^\w]/g, '_');
  15635. }
  15636. /**
  15637. *
  15638. * @param sender
  15639. * @param propertyName
  15640. * @param gridRefName
  15641. */
  15642. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15643. var _a, _b;
  15644. var scope = lookupScope(sender);
  15645. clearViewModelValues(scope.viewModel, propertyName);
  15646. if (!gridRefName) {
  15647. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15648. }
  15649. else {
  15650. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15651. }
  15652. }
  15653. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15654. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15655. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15656. var value = _$2.trim(sender.rawValue);
  15657. raiseClick(eOpts.handle);
  15658. }
  15659. }, 150);
  15660. function saveGridRow(grid1) {
  15661. var _a;
  15662. var config = grid1.config;
  15663. var scope = lookupScope(grid1);
  15664. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15665. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15666. // "表格保存"的相关配置
  15667. var dbSaveConfig = {
  15668. columns: [],
  15669. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15670. saveRowValues: saveRowValues,
  15671. path: scope.originalVjson.__custom_path,
  15672. };
  15673. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15674. if (err) {
  15675. // 如果有异常就不保存
  15676. return;
  15677. }
  15678. // 构建"表格保存"的相关配置
  15679. for (var i = 0; i < config.columns.length; i++) {
  15680. var c = config.columns[i];
  15681. var v = {
  15682. dataIndex: c.dataIndex,
  15683. header: c.header,
  15684. dbColumn: c.dbColumn,
  15685. serverCreateValue: c.serverCreateValue,
  15686. dbIsDeleteKey: c.dbIsDeleteKey,
  15687. dbIsUpdateKey: c.dbIsUpdateKey,
  15688. dbUpdateEnable: c.dbUpdateEnable,
  15689. serverValueConvert: c.dbUpdateEnable,
  15690. };
  15691. if (c.editor) {
  15692. v.editor = {
  15693. xtype: c.editor.xtype,
  15694. required: c.editor.required,
  15695. };
  15696. }
  15697. dbSaveConfig.columns.push(v);
  15698. }
  15699. // 进行业务上的逻辑校验
  15700. var hasError = false;
  15701. _$2.forEach(rows, function (row, i) {
  15702. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15703. var c = config.columns[i_1];
  15704. var value = row[c.dataIndex];
  15705. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15706. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15707. hasError = true;
  15708. return false;
  15709. }
  15710. if (c.xtype === 'checkcolumn') {
  15711. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15712. row[c.dataIndex] = c.uncheckedValue;
  15713. }
  15714. if (value === true && typeof c.checkedValue !== 'undefined') {
  15715. row[c.dataIndex] = c.checkedValue;
  15716. }
  15717. }
  15718. }
  15719. });
  15720. if (hasError) {
  15721. return;
  15722. }
  15723. // 设置当前界面为 "保存中..." 状态
  15724. grid1.setLoading(true);
  15725. invokeServer$1('/Dev@batchSave', {
  15726. newRows: newRows,
  15727. modifyRows: modifyRows,
  15728. removeRecords: removeRecords,
  15729. config: dbSaveConfig,
  15730. }).then(function (res) {
  15731. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15732. msg$1(res.msg);
  15733. grid1.reload();
  15734. }).catch(function (e) {
  15735. console.error(e);
  15736. showErrorDialog$1(_$2.toString(e));
  15737. }).finally(function () {
  15738. // 无论正常异常,关闭 "保存中..." 状态
  15739. grid1.setLoading(false);
  15740. });
  15741. }
  15742. function insertGridRow(grid1) {
  15743. var config = grid1.config;
  15744. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15745. var insertRow = {};
  15746. _$2.forEach(config.columns, function (c) {
  15747. var fn = c.createValue;
  15748. if (_$2.startsWith(fn, 'scope.') ||
  15749. _$2.startsWith(fn, 'system.')) {
  15750. var scope = lookupScope(grid1);
  15751. var fn2 = lookupFn(scope, fn, c);
  15752. if (_$2.isFunction(fn2)) {
  15753. var newValue = fn2();
  15754. if (!_$2.isUndefined(newValue)) {
  15755. insertRow[c.dataIndex] = newValue;
  15756. }
  15757. }
  15758. }
  15759. else if (_$2.isString(fn) && fn) {
  15760. insertRow[c.dataIndex] = fn;
  15761. }
  15762. });
  15763. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15764. }
  15765. function commitMe(sender) {
  15766. var window = sender.up('window');
  15767. var scope = lookupScope(sender);
  15768. if (typeof scope['commit'] === 'function') {
  15769. scope['commit']().then(function (res) {
  15770. window.close();
  15771. });
  15772. }
  15773. }
  15774. function removeGridRow(grid1) {
  15775. var _a;
  15776. var config = grid1.config;
  15777. var rows = [];
  15778. if (grid1.selModel.selType === "rowmodel") {
  15779. rows.push(grid1.selection);
  15780. }
  15781. else {
  15782. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15783. rows.push(r);
  15784. });
  15785. }
  15786. if (rows.length > 1) {
  15787. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15788. if (_$2.isUndefined(batchRemoveConfirm)) {
  15789. //不需要提示
  15790. _$2.forEach(rows, function (r) {
  15791. grid1.getStore().remove(r);
  15792. });
  15793. }
  15794. else {
  15795. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15796. confirm(tip).then(function () {
  15797. _$2.forEach(rows, function (r) {
  15798. grid1.getStore().remove(r);
  15799. });
  15800. });
  15801. }
  15802. }
  15803. else if (rows.length === 1) {
  15804. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15805. if (_$2.isUndefined(singleRemoveConfirm)) {
  15806. //不需要提示
  15807. grid1.getStore().remove(rows[0]);
  15808. }
  15809. else {
  15810. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15811. _$2.forEach(config.columns, function (c) {
  15812. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15813. });
  15814. confirm(tip_1).then(function () {
  15815. grid1.getStore().remove(rows[0]);
  15816. });
  15817. }
  15818. }
  15819. else {
  15820. msg$1('请选择要删除的数据!');
  15821. }
  15822. }
  15823. function moveUpGridRow(grid) {
  15824. grid.rowMoveUp();
  15825. }
  15826. function moveDownGridRow(grid) {
  15827. grid.rowMoveDown();
  15828. }
  15829. var SystemEventFu = /** @class */ (function () {
  15830. function SystemEventFu() {
  15831. }
  15832. SystemEventFu.prototype.moveUpGridRow = function () {
  15833. return function (sender) {
  15834. var grid1 = sender.up('yvgrid');
  15835. moveUpGridRow(grid1);
  15836. };
  15837. };
  15838. SystemEventFu.prototype.commitMe = function () {
  15839. return function (sender) {
  15840. commitMe(sender);
  15841. };
  15842. };
  15843. SystemEventFu.prototype.moveDownGridRow = function () {
  15844. return function (sender) {
  15845. var grid1 = sender.up('yvgrid');
  15846. moveDownGridRow(grid1);
  15847. };
  15848. };
  15849. SystemEventFu.prototype.saveGridRow = function () {
  15850. return function (sender) {
  15851. var grid1 = sender.up('yvgrid');
  15852. saveGridRow(grid1);
  15853. };
  15854. };
  15855. SystemEventFu.prototype.insertGridRow = function () {
  15856. return function (sender) {
  15857. var grid1 = sender.up('yvgrid');
  15858. insertGridRow(grid1);
  15859. };
  15860. };
  15861. SystemEventFu.prototype.removeGridRow = function () {
  15862. return function (sender) {
  15863. var grid1 = sender.up('yvgrid');
  15864. removeGridRow(grid1);
  15865. };
  15866. };
  15867. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15868. return function (sender, config) {
  15869. if (!config.listeners) {
  15870. config.listeners = {};
  15871. }
  15872. config.listeners.afterrender = function (sender) {
  15873. var scope = lookupScope(sender);
  15874. // $(sender.el.dom).on('keydown', (e) => {
  15875. // const xtype = Ext.fly(e.target).component.xtype
  15876. // if (xtype === 'textfield' && e.keyCode === 13) {
  15877. // Ext.defer(() => {
  15878. // raiseClick(scope.refs[btnReferenceName])
  15879. // })
  15880. // e.preventDefault()
  15881. // e.stopPropagation()
  15882. // return false
  15883. // }
  15884. // })
  15885. $(sender.el.dom).on('keyup', function (e) {
  15886. var tt = Ext.fly(e.target).component;
  15887. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15888. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15889. ![10, 13, 20, 40].includes(e.keyCode)) {
  15890. return;
  15891. }
  15892. e.preventDefault();
  15893. e.stopPropagation();
  15894. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15895. return;
  15896. });
  15897. };
  15898. };
  15899. };
  15900. SystemEventFu.prototype.confirm = function (text, fn) {
  15901. return function (sender) {
  15902. var scope = lookupScope(sender);
  15903. var msg = calcExpress(scope.viewModel.data, text);
  15904. confirm(msg, sender).then(function () {
  15905. fn.call(scope, sender);
  15906. });
  15907. };
  15908. };
  15909. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15910. return function (sender) {
  15911. var scope = lookupScope(sender);
  15912. var grid = scope.refs[gridRefName];
  15913. if (grid) {
  15914. var records = grid.getSelectionModel().getLastSelected();
  15915. grid.store.remove(records);
  15916. }
  15917. };
  15918. };
  15919. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15920. //可以是 scope.XX / system.XX / string / lookup表达式
  15921. writeTarget) {
  15922. return function (sender) {
  15923. if (!invokeUrl) {
  15924. return;
  15925. }
  15926. var scope = lookupScope(sender);
  15927. scope.setLoading(true);
  15928. var data = scope.viewModel.data;
  15929. if (invokeParam) {
  15930. data = calcObjectFlat(data, invokeParam);
  15931. }
  15932. invokeServer$1(invokeUrl, data).then(function (res) {
  15933. if (res.success) {
  15934. if (typeof writeTarget === "string") {
  15935. _$2.forOwn(res.data, function (v, k) {
  15936. scope.viewModel.set(writeTarget + "." + k, v);
  15937. });
  15938. }
  15939. else if (typeof writeTarget === 'function') {
  15940. writeTarget.call(scope, res.data);
  15941. }
  15942. else if (typeof writeTarget === 'object') {
  15943. var ret = calcObjectFlat(res.data, writeTarget);
  15944. _$2.forOwn(ret, function (v, k) {
  15945. scope.viewModel.set(k, v);
  15946. });
  15947. }
  15948. }
  15949. else {
  15950. showErrorDialog$1(res.msg || '未知错误', sender);
  15951. }
  15952. }).catch(function (e) {
  15953. var _a, _b;
  15954. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15955. showErrorDialog$1(msg || e.toString(), sender);
  15956. }).finally(function () {
  15957. scope.setLoading(false);
  15958. });
  15959. };
  15960. };
  15961. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15962. return function (sender) {
  15963. var scope = lookupScope(sender);
  15964. scope.setLoading(true);
  15965. var data = scope.viewModel.data;
  15966. if (arg0) {
  15967. data = calcObjectFlat(data, arg0);
  15968. }
  15969. invokeServer$1(groovyUrl, data).then(function (res) {
  15970. if (res.success) {
  15971. if (res.msg) {
  15972. msg(res.msg);
  15973. }
  15974. if (typeof successCallback === 'function') {
  15975. successCallback.call(scope, sender, res.data);
  15976. }
  15977. }
  15978. else {
  15979. showErrorDialog$1(res.msg || '未知错误', sender);
  15980. }
  15981. }).catch(function (e) {
  15982. var _a, _b;
  15983. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15984. showErrorDialog$1(msg || e.toString(), sender);
  15985. }).finally(function () {
  15986. scope.setLoading(false);
  15987. });
  15988. };
  15989. };
  15990. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15991. return function (sender) {
  15992. var scope = lookupScope(sender);
  15993. var form = scope.down('form');
  15994. if (form) {
  15995. // 如果下级有表单,就做表单校验
  15996. var valid = form.isValid();
  15997. if (!valid) {
  15998. return;
  15999. }
  16000. }
  16001. scope.setLoading(true);
  16002. var data = scope.viewModel.data;
  16003. if (arg0) {
  16004. data = calcObjectFlat(data, arg0);
  16005. }
  16006. invokeServer$1(groovyUrl, data).then(function (res) {
  16007. if (res.success) {
  16008. if (res.msg) {
  16009. msg(res.msg);
  16010. }
  16011. scope.dialogSuccess(res);
  16012. }
  16013. else {
  16014. showErrorDialog$1(res.msg || '未知错误', sender);
  16015. }
  16016. }).catch(function (e) {
  16017. var _a, _b;
  16018. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  16019. showErrorDialog$1(msg || e.toString(), sender);
  16020. }).finally(function () {
  16021. scope.setLoading(false);
  16022. });
  16023. };
  16024. };
  16025. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16026. return function (sender) {
  16027. var scope = lookupScope(sender);
  16028. if (lookupObject) {
  16029. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16030. }
  16031. else {
  16032. scope.dialogSuccess();
  16033. }
  16034. };
  16035. };
  16036. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16037. return function (sender) {
  16038. var scope = lookupScope(sender);
  16039. clearViewModelValues(scope.viewModel, propertyName);
  16040. };
  16041. };
  16042. SystemEventFu.prototype.getGrid = function (url) {
  16043. return function (sender, config) {
  16044. if (config.xtype == "combogridmulti") {
  16045. // @ts-ignore
  16046. require([url], function (grid) {
  16047. _$2.forOwn(grid.default, function (v, k) {
  16048. sender[k] = v;
  16049. sender.config[k] = v;
  16050. if (sender.rendered) {
  16051. // 已经渲染出来了,重新调用 reload 强制刷新
  16052. sender.reload();
  16053. }
  16054. });
  16055. });
  16056. }
  16057. else {
  16058. // @ts-ignore
  16059. require([url], function (grid) {
  16060. sender.grid = grid.default;
  16061. config.grid = grid.default;
  16062. });
  16063. }
  16064. };
  16065. };
  16066. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16067. return function (sender) {
  16068. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16069. };
  16070. };
  16071. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16072. return function (sender) {
  16073. var _a, _b;
  16074. var scope = lookupScope(sender);
  16075. if (!gridRefName) {
  16076. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16077. }
  16078. else {
  16079. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16080. }
  16081. };
  16082. };
  16083. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16084. return function (sender) {
  16085. var scope = lookupScope(sender);
  16086. var data = scope.viewModel.data;
  16087. var param = calcObjectFlat(data, lookupForData);
  16088. // @ts-ignore
  16089. require([url], function (module) {
  16090. var ScopeClass = module.default;
  16091. var scope = new ScopeClass();
  16092. scope.success = successCallback;
  16093. scope.showDialog(sender, {}, { data: param });
  16094. });
  16095. };
  16096. };
  16097. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16098. return function (sender, queryValue) {
  16099. showWidget(widgetUrl, lookup, sender, queryValue);
  16100. };
  16101. };
  16102. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16103. return function (sender) {
  16104. clearViewModelByLookup(sender, lookup);
  16105. };
  16106. };
  16107. SystemEventFu.prototype.closeMe = function (callBack) {
  16108. return function (sender) {
  16109. var scope = lookupScope(sender);
  16110. scope.close();
  16111. if (callBack) {
  16112. callBack.call(sender);
  16113. }
  16114. };
  16115. };
  16116. // 未完成
  16117. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16118. return function (sender) {
  16119. var scope = lookupScope(sender);
  16120. var data = scope.viewModel.data;
  16121. var billSetting = scope.billSetting;
  16122. var param = calcObjectFlat(data, lookupForData);
  16123. return new Promise(function (resolve, reject) {
  16124. var sf = function (scope) {
  16125. scope.success = function (dlgScope, dlgSender, reData) {
  16126. };
  16127. scope.showDialog(sender, {}, { data: param });
  16128. };
  16129. // @ts-ignore
  16130. require([url], function (module) {
  16131. // 业务描述文件
  16132. if (url.endsWith(".bill")) {
  16133. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16134. sf(scope);
  16135. });
  16136. }
  16137. else { //原生yvanui文件
  16138. var ScopeClass = module.default;
  16139. var scope_1 = new ScopeClass();
  16140. sf(scope_1);
  16141. }
  16142. });
  16143. });
  16144. };
  16145. };
  16146. __decorate([
  16147. Lib({
  16148. title: '为某个表格,上移行',
  16149. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16150. }),
  16151. __metadata("design:type", Function),
  16152. __metadata("design:paramtypes", []),
  16153. __metadata("design:returntype", void 0)
  16154. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16155. __decorate([
  16156. Lib({
  16157. title: '为某个表格,上移行',
  16158. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16159. }),
  16160. __metadata("design:type", Function),
  16161. __metadata("design:paramtypes", []),
  16162. __metadata("design:returntype", void 0)
  16163. ], SystemEventFu.prototype, "commitMe", null);
  16164. __decorate([
  16165. Lib({
  16166. title: '为某个表格,下移行',
  16167. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16168. }),
  16169. __metadata("design:type", Function),
  16170. __metadata("design:paramtypes", []),
  16171. __metadata("design:returntype", void 0)
  16172. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16173. __decorate([
  16174. Lib({
  16175. title: '为某个表格,批量保存至数据库',
  16176. author: '罗一帆',
  16177. createAt: '2022-07-19',
  16178. updateAt: '2022-07-19',
  16179. type: 'system',
  16180. category: '表格',
  16181. }),
  16182. __metadata("design:type", Function),
  16183. __metadata("design:paramtypes", []),
  16184. __metadata("design:returntype", void 0)
  16185. ], SystemEventFu.prototype, "saveGridRow", null);
  16186. __decorate([
  16187. Lib({
  16188. title: '为某个表格插入数据行',
  16189. author: '罗一帆',
  16190. createAt: '2022-07-19',
  16191. updateAt: '2022-07-19',
  16192. type: 'system',
  16193. category: '表格',
  16194. }),
  16195. __metadata("design:type", Function),
  16196. __metadata("design:paramtypes", []),
  16197. __metadata("design:returntype", void 0)
  16198. ], SystemEventFu.prototype, "insertGridRow", null);
  16199. __decorate([
  16200. Lib({
  16201. title: '为某个表格删除所选数据行',
  16202. author: '罗一帆',
  16203. createAt: '2022-07-19',
  16204. updateAt: '2022-07-19',
  16205. type: 'system',
  16206. category: '表格',
  16207. }),
  16208. __metadata("design:type", Function),
  16209. __metadata("design:paramtypes", []),
  16210. __metadata("design:returntype", void 0)
  16211. ], SystemEventFu.prototype, "removeGridRow", null);
  16212. __decorate([
  16213. Lib({
  16214. title: '按下回车键之后默认是否按下某个按钮',
  16215. author: '罗一帆',
  16216. createAt: '2021-07-02',
  16217. updateAt: '2021-07-02',
  16218. type: 'system',
  16219. category: '字典',
  16220. }),
  16221. __metadata("design:type", Function),
  16222. __metadata("design:paramtypes", [Object]),
  16223. __metadata("design:returntype", void 0)
  16224. ], SystemEventFu.prototype, "enterToClick", null);
  16225. __decorate([
  16226. Lib({
  16227. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16228. author: '罗一帆',
  16229. createAt: '2021-07-06',
  16230. updateAt: '2021-07-06',
  16231. type: 'system',
  16232. category: '对话框',
  16233. }),
  16234. __param(0, LibParam('对话框的确认文字', 'string')),
  16235. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16236. __metadata("design:type", Function),
  16237. __metadata("design:paramtypes", [Object, Object]),
  16238. __metadata("design:returntype", void 0)
  16239. ], SystemEventFu.prototype, "confirm", null);
  16240. __decorate([
  16241. Lib({
  16242. title: '删除表格当前的选中行(前端删除)',
  16243. author: '罗一帆',
  16244. createAt: '2021-07-08',
  16245. updateAt: '2021-07-08',
  16246. type: 'system',
  16247. category: '表格',
  16248. }),
  16249. __param(0, LibParam('表格引用名', 'refs')),
  16250. __metadata("design:type", Function),
  16251. __metadata("design:paramtypes", [Object]),
  16252. __metadata("design:returntype", void 0)
  16253. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16254. __decorate([
  16255. Lib({
  16256. title: '查询表单,如果 url 为空值,就取消查询',
  16257. author: '罗一帆',
  16258. createAt: '2021-07-06',
  16259. updateAt: '2021-07-06',
  16260. type: 'system',
  16261. category: '表单',
  16262. }),
  16263. __param(0, LibParam('后端服务路径', 'string')),
  16264. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16265. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16266. __metadata("design:type", Function),
  16267. __metadata("design:paramtypes", [String, Object, Object]),
  16268. __metadata("design:returntype", void 0)
  16269. ], SystemEventFu.prototype, "loadForm", null);
  16270. __decorate([
  16271. Lib({
  16272. title: '提交(不做校验、不关闭窗体)',
  16273. author: '罗一帆',
  16274. createAt: '2021-07-02',
  16275. updateAt: '2021-07-02',
  16276. type: 'system',
  16277. category: '表单',
  16278. }),
  16279. __param(0, LibParam('后端服务路径', 'string')),
  16280. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16281. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16282. __metadata("design:type", Function),
  16283. __metadata("design:paramtypes", [String, Object, Object]),
  16284. __metadata("design:returntype", void 0)
  16285. ], SystemEventFu.prototype, "commit", null);
  16286. __decorate([
  16287. Lib({
  16288. title: '提交表单',
  16289. author: '罗一帆',
  16290. createAt: '2021-07-02',
  16291. updateAt: '2021-07-02',
  16292. type: 'system',
  16293. category: '表单',
  16294. }),
  16295. __param(0, LibParam('后端服务路径', 'string')),
  16296. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16297. __metadata("design:type", Function),
  16298. __metadata("design:paramtypes", [String, Object]),
  16299. __metadata("design:returntype", void 0)
  16300. ], SystemEventFu.prototype, "formCommit", null);
  16301. __decorate([
  16302. Lib({
  16303. title: '对话框成功回调',
  16304. author: '罗一帆',
  16305. createAt: '2021-07-02',
  16306. updateAt: '2021-07-02',
  16307. type: 'system',
  16308. category: '对话框',
  16309. }),
  16310. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16311. __metadata("design:type", Function),
  16312. __metadata("design:paramtypes", [Object]),
  16313. __metadata("design:returntype", void 0)
  16314. ], SystemEventFu.prototype, "dialogSuccess", null);
  16315. __decorate([
  16316. Lib({
  16317. title: '清空 viewModel 某个属性',
  16318. author: '罗一帆',
  16319. createAt: '2021-07-02',
  16320. updateAt: '2021-07-02',
  16321. type: 'system',
  16322. category: '表单',
  16323. }),
  16324. __param(0, LibParam('属性路径', 'viewModel', true)),
  16325. __metadata("design:type", Function),
  16326. __metadata("design:paramtypes", [String]),
  16327. __metadata("design:returntype", void 0)
  16328. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16329. __decorate([
  16330. Lib({
  16331. title: '从其他资源获取表格设置',
  16332. author: '罗一帆',
  16333. createAt: '2021-07-02',
  16334. updateAt: '2021-07-02',
  16335. type: 'system',
  16336. category: '表单',
  16337. }),
  16338. __param(0, LibParam('定义文件', 'module')),
  16339. __metadata("design:type", Function),
  16340. __metadata("design:paramtypes", [Object]),
  16341. __metadata("design:returntype", void 0)
  16342. ], SystemEventFu.prototype, "getGrid", null);
  16343. __decorate([
  16344. Lib({
  16345. title: '清空 viewModel 某个属性,并刷新表格',
  16346. author: '罗一帆',
  16347. createAt: '2021-07-02',
  16348. updateAt: '2021-07-02',
  16349. type: 'system',
  16350. category: '表单',
  16351. }),
  16352. __param(0, LibParam('清空的属性', 'viewModel')),
  16353. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16354. __metadata("design:type", Function),
  16355. __metadata("design:paramtypes", [String, String]),
  16356. __metadata("design:returntype", void 0)
  16357. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16358. __decorate([
  16359. Lib({
  16360. title: '刷新表格',
  16361. author: '罗一帆',
  16362. createAt: '2021-07-02',
  16363. updateAt: '2021-07-02',
  16364. type: 'system',
  16365. category: '表单',
  16366. }),
  16367. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16368. __metadata("design:type", Function),
  16369. __metadata("design:paramtypes", [String]),
  16370. __metadata("design:returntype", void 0)
  16371. ], SystemEventFu.prototype, "reloadGrid", null);
  16372. __decorate([
  16373. Lib({
  16374. title: '显示对话框',
  16375. author: '罗一帆',
  16376. createAt: '2021-07-02',
  16377. updateAt: '2021-07-02',
  16378. type: 'system',
  16379. category: '对话框',
  16380. }),
  16381. __param(0, LibParam('业务模块名', 'module')),
  16382. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16383. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16384. __metadata("design:type", Function),
  16385. __metadata("design:paramtypes", [String, Object, Object]),
  16386. __metadata("design:returntype", void 0)
  16387. ], SystemEventFu.prototype, "showDialog", null);
  16388. __decorate([
  16389. Lib({
  16390. title: '弹出查找框(不借助 search)',
  16391. author: '罗一帆',
  16392. createAt: '2021-07-02',
  16393. updateAt: '2021-07-02',
  16394. type: 'system',
  16395. category: '对话框',
  16396. }),
  16397. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16398. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16399. __metadata("design:type", Function),
  16400. __metadata("design:paramtypes", [Object, Object]),
  16401. __metadata("design:returntype", void 0)
  16402. ], SystemEventFu.prototype, "showWidget", null);
  16403. __decorate([
  16404. Lib({
  16405. title: '根据 lookup 清空 viewModel',
  16406. author: '罗一帆',
  16407. createAt: '2021-07-05',
  16408. updateAt: '2021-07-05',
  16409. type: 'system',
  16410. category: '表单',
  16411. }),
  16412. __param(0, LibParam('设值表达式', 'lookup')),
  16413. __metadata("design:type", Function),
  16414. __metadata("design:paramtypes", [Object]),
  16415. __metadata("design:returntype", void 0)
  16416. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16417. __decorate([
  16418. Lib({
  16419. title: '关闭对话框',
  16420. author: '罗一帆',
  16421. createAt: '2021-07-05',
  16422. updateAt: '2021-07-05',
  16423. type: 'system',
  16424. category: '对话框',
  16425. }),
  16426. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16427. __metadata("design:type", Function),
  16428. __metadata("design:paramtypes", [Object]),
  16429. __metadata("design:returntype", void 0)
  16430. ], SystemEventFu.prototype, "closeMe", null);
  16431. __decorate([
  16432. Lib({
  16433. title: '打开对话框并返回数据',
  16434. author: '余亮',
  16435. createAt: '2022-07-07',
  16436. updateAt: '2022-07-07',
  16437. type: 'system',
  16438. category: '对话框',
  16439. }),
  16440. __param(0, LibParam('业务模块名', 'module')),
  16441. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16442. __param(2, LibParam('结果映射关系', 'string', true)),
  16443. __metadata("design:type", Function),
  16444. __metadata("design:paramtypes", [String, Object, Object]),
  16445. __metadata("design:returntype", void 0)
  16446. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16447. return SystemEventFu;
  16448. }());
  16449. /**
  16450. * 清空 viewmodel 里下属的所有属性
  16451. * @param viewModel VM对象
  16452. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16453. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16454. */
  16455. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16456. var data = viewModel.data;
  16457. if (propertyKey) {
  16458. data = _$2.get(data, propertyKey);
  16459. }
  16460. _$2.forOwn(data, function (value, key) {
  16461. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16462. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16463. return;
  16464. }
  16465. viewModel.set(targetKey, '');
  16466. });
  16467. }
  16468. function clearViewModelByLookup(sender, lookup) {
  16469. if (_$2.isPlainObject(lookup)) {
  16470. var parentScope_1 = lookupScope(sender);
  16471. _$2.forOwn(lookup, function (value, key) {
  16472. if (SIMPLE_RE.test(value)) {
  16473. // '{foo}' 简单表达式
  16474. var path = value.substring(1, value.length - 1);
  16475. if (path !== 'queryValue') {
  16476. parentScope_1.viewModel.set(path, '');
  16477. }
  16478. }
  16479. });
  16480. }
  16481. }
  16482. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16483. if (vjson === void 0) { vjson = {}; }
  16484. var parentScope = lookupScope(sender);
  16485. var me = sender;
  16486. // @ts-ignore
  16487. require([widgetUrl], function (widgetScope) {
  16488. var WidgetScopeClass = widgetScope.default;
  16489. widgetScope = new WidgetScopeClass();
  16490. // 传递进 widget.model 的数据
  16491. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16492. widgetScope.parentScope = parentScope;
  16493. widgetScope.searchWidgetSuccess = function (data) {
  16494. if (typeof lookup === 'string') {
  16495. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16496. me.setValue(data[lookup]);
  16497. return;
  16498. }
  16499. /**
  16500. * lookup: {
  16501. * // 扩展到 viewModel 的值做更改
  16502. * WH_CODE: "{queryValue}",
  16503. * WH_NAME: "{query.WH_NAME}",
  16504. * }
  16505. */
  16506. if (_$2.isPlainObject(lookup)) {
  16507. var parentScope_2 = lookupScope(sender);
  16508. tryWriteObject(lookup, data, function (path, value) {
  16509. if (path === 'queryValue') {
  16510. me.setValue(value);
  16511. }
  16512. else {
  16513. parentScope_2.viewModel.set(path, value);
  16514. }
  16515. });
  16516. }
  16517. return true;
  16518. };
  16519. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16520. });
  16521. }
  16522. /**
  16523. * 停止事件的默认行为
  16524. * @param e
  16525. */
  16526. function stopEvent(e) {
  16527. e.preventDefault();
  16528. e.stopPropagation();
  16529. // @ts-ignore
  16530. window.event.cancelBubble = true;
  16531. e.returnValue = false;
  16532. e.cancelBubble = true;
  16533. }
  16534. /**
  16535. * 屏幕中央显示一个黑框提示
  16536. */
  16537. function msg$1(content) {
  16538. msg(content);
  16539. }
  16540. /**
  16541. * 错误对话框的强提醒
  16542. */
  16543. function showErrorDialog$1(msg, sender) {
  16544. showErrorDialog(msg, sender);
  16545. }
  16546. /**
  16547. * 错误对话框的强提醒
  16548. */
  16549. function showInfoDialog(msg, sender) {
  16550. showInfoDialogSimple(msg, sender);
  16551. }
  16552. /**
  16553. * 错误对话框的强提醒
  16554. */
  16555. function prompt$2(message, defaultValue, multiLine) {
  16556. if (defaultValue === void 0) { defaultValue = ""; }
  16557. if (multiLine === void 0) { multiLine = false; }
  16558. return prompt$1(message, defaultValue, multiLine);
  16559. }
  16560. /**
  16561. * 用于计算 express 表达式
  16562. */
  16563. function evalFunction(data, express) {
  16564. var keys = [];
  16565. var values = [];
  16566. _$2.forOwn(data, function (value, key) {
  16567. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16568. if (match) {
  16569. key = key.substring(0, match.index);
  16570. }
  16571. keys.push(key);
  16572. values.push(value);
  16573. });
  16574. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16575. try {
  16576. return func.apply(void 0, __spread(values));
  16577. }
  16578. catch (e) {
  16579. return;
  16580. }
  16581. }
  16582. /**
  16583. * 获取表格编辑的行数据
  16584. */
  16585. function getGridEditRows(grid) {
  16586. return grid.getGridEditRows();
  16587. }
  16588. var SystemLib = /*#__PURE__*/Object.freeze({
  16589. __proto__: null,
  16590. SIMPLE_RE: SIMPLE_RE,
  16591. pinyinMatch: pinyinMatch,
  16592. calcExpress: calcExpress,
  16593. calcObjectFlat: calcObjectFlat,
  16594. mergeViewModel: mergeViewModel,
  16595. flatRow: flatRow,
  16596. replaceNA: replaceNA,
  16597. deepTravJson: deepTravJson,
  16598. tryWriteByExpress: tryWriteByExpress,
  16599. tryWriteObject: tryWriteObject,
  16600. tryVarSimple: tryVarSimple,
  16601. calcObject: calcObject,
  16602. getParentGrid: getParentGrid,
  16603. tryEnable: tryEnable,
  16604. setComboStore: setComboStore,
  16605. invokeServer: invokeServer$1,
  16606. clearViewModelValues: clearViewModelValues,
  16607. reloadGrid: reloadGrid,
  16608. toPlainObject: toPlainObject,
  16609. confirm: confirm,
  16610. normId: normId,
  16611. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16612. saveGridRow: saveGridRow,
  16613. insertGridRow: insertGridRow,
  16614. commitMe: commitMe,
  16615. removeGridRow: removeGridRow,
  16616. moveUpGridRow: moveUpGridRow,
  16617. moveDownGridRow: moveDownGridRow,
  16618. SystemEventFu: SystemEventFu,
  16619. clearViewModel: clearViewModel,
  16620. clearViewModelByLookup: clearViewModelByLookup,
  16621. showWidget: showWidget,
  16622. stopEvent: stopEvent,
  16623. msg: msg$1,
  16624. showErrorDialog: showErrorDialog$1,
  16625. showInfoDialog: showInfoDialog,
  16626. prompt: prompt$2,
  16627. evalFunction: evalFunction,
  16628. getGridEditRows: getGridEditRows
  16629. });
  16630. function initTree () {
  16631. Ext.define('Yvan.Tree', {
  16632. extend: 'Ext.tree.Panel',
  16633. alias: 'widget.yvtree',
  16634. xtype: 'yvtree',
  16635. constructor: function (config) {
  16636. var newConfig = _$2.defaultsDeep({
  16637. // 强制性属性
  16638. }, baseConfig(config, 'row-item'), config, tree);
  16639. _$2.assign(newConfig, {
  16640. tbar: [
  16641. {
  16642. xtype: 'textfield',
  16643. // triggerCls: 'x-form-clear-trigger',
  16644. flex: 1,
  16645. emptyText: '搜索过滤',
  16646. enableKeyEvents: true,
  16647. listeners: {
  16648. change: function (sender) {
  16649. var tree = sender.up("treepanel");
  16650. tree.filterByText(this.getRawValue());
  16651. },
  16652. keyup: function (sender, e) {
  16653. var tree = sender.up("treepanel");
  16654. if (e.ESC === e.getKey()) {
  16655. sender.setValue('');
  16656. tree.filterByText('');
  16657. }
  16658. }
  16659. }
  16660. },
  16661. ],
  16662. });
  16663. if (!newConfig.hideRefresh) {
  16664. newConfig.tbar.push({
  16665. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16666. listeners: {
  16667. click: function (sender) {
  16668. var scope = sender.up("yvtree");
  16669. scope.reload();
  16670. }
  16671. }
  16672. });
  16673. }
  16674. if (!newConfig.hideExpand) {
  16675. newConfig.tbar.push({
  16676. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16677. listeners: {
  16678. click: function (sender) {
  16679. var scope = sender.up("yvtree");
  16680. scope.expandAll();
  16681. }
  16682. }
  16683. });
  16684. }
  16685. if (!newConfig.hideCollapse) {
  16686. newConfig.tbar.push({
  16687. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16688. listeners: {
  16689. click: function (sender) {
  16690. var scope = sender.up("yvtree");
  16691. scope.collapseAll();
  16692. }
  16693. }
  16694. });
  16695. }
  16696. this.superclass.constructor.call(this, newConfig);
  16697. },
  16698. /**
  16699. * 在根节点上增加一个节点,会触发 addNode 事件
  16700. * @param props
  16701. */
  16702. addRoot: function (props) {
  16703. var me = this;
  16704. var tableNode = me.getRootNode();
  16705. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16706. if (_$2.isFunction(props)) {
  16707. props = props.call(this, parent);
  16708. }
  16709. _$2.forOwn(props, function (value, key) {
  16710. fieldNode.set(key, value);
  16711. });
  16712. var node = tableNode.appendChild(fieldNode);
  16713. me.ensureVisible(node);
  16714. me.setSelection(node);
  16715. me.fireEvent('addNode', me, {
  16716. parent: tableNode,
  16717. node: node,
  16718. });
  16719. },
  16720. addLast: function (props) {
  16721. var me = this;
  16722. var sel = me.selModel.getSelection();
  16723. if (!sel || sel.length <= 0) {
  16724. msg('请选择一个要添加的同级节点路径');
  16725. return;
  16726. }
  16727. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16728. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16729. if (_$2.isFunction(props)) {
  16730. props = props.call(this, parent);
  16731. }
  16732. _$2.forOwn(props, function (value, key) {
  16733. fieldNode.set(key, value);
  16734. });
  16735. var node = parent.appendChild(fieldNode);
  16736. me.ensureVisible(node);
  16737. me.setSelection(node);
  16738. me.fireEvent('addNode', me, {
  16739. parent: parent,
  16740. node: node,
  16741. });
  16742. },
  16743. addChildren: function (props) {
  16744. var me = this;
  16745. var sel = me.selModel.getSelection();
  16746. if (!sel || sel.length <= 0) {
  16747. msg('请选择一个要添加子节点的路径');
  16748. return;
  16749. }
  16750. var parent = sel[0];
  16751. if (_$2.isFunction(props)) {
  16752. props = props.call(this, parent);
  16753. }
  16754. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16755. _$2.forOwn(props, function (value, key) {
  16756. fieldNode.set(key, value);
  16757. });
  16758. var node = parent.appendChild(fieldNode);
  16759. parent.expand();
  16760. me.ensureVisible(node);
  16761. me.setSelection(node);
  16762. me.fireEvent('addNode', me, {
  16763. parent: parent,
  16764. node: node,
  16765. });
  16766. },
  16767. initComponent: function () {
  16768. var me = this;
  16769. var config = me.config;
  16770. var scope = lookupScope(this);
  16771. if (!isDesignMode(scope, config)) {
  16772. // 转换 dataSource 属性
  16773. convertDataSource(me, scope, config);
  16774. }
  16775. this.superclass.initComponent.call(this);
  16776. this.on({
  16777. afterrender: function (sender) {
  16778. var me = this;
  16779. var config = this.config;
  16780. var dataSource = config.dataSource;
  16781. if (config.autoLoad) {
  16782. if (config.dataSourceCallbackFn) {
  16783. me.reload();
  16784. }
  16785. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16786. me.reload();
  16787. }
  16788. }
  16789. }
  16790. });
  16791. },
  16792. _setDataReal: function (value) {
  16793. var me = this;
  16794. // me.setStore(new Ext.data.TreeStore({
  16795. // root: {
  16796. // expanded: true,
  16797. // // children: value
  16798. // children: [
  16799. // {
  16800. // id: '1', text: 'A',
  16801. // children: [
  16802. // {id: '1', text: 'A',},
  16803. // {id: '2', text: 'B'},
  16804. // ]
  16805. // },
  16806. // {id: '2', text: 'B'},
  16807. // ]
  16808. // }
  16809. // }))
  16810. me.store.setRoot({
  16811. expanded: true,
  16812. children: value
  16813. });
  16814. // me.store = new Ext.data.TreeStore({
  16815. // root: {
  16816. // expanded: true,
  16817. // // children: value
  16818. // children: [
  16819. // {
  16820. // id: '1', text: 'A',
  16821. // children: [
  16822. // {id: '1', text: 'A',},
  16823. // {id: '2', text: 'B'},
  16824. // ]
  16825. // },
  16826. // {id: '2', text: 'B'},
  16827. // ]
  16828. // }
  16829. // })
  16830. },
  16831. /**
  16832. * 重新载入数据(重新计算参数)
  16833. */
  16834. reload: function (reloadParams) {
  16835. if (reloadParams === void 0) { reloadParams = {}; }
  16836. var me = this;
  16837. var config = me.config;
  16838. if (config.dataSourceCallbackFn) {
  16839. // 函数请求刷新
  16840. var scope_1 = lookupScope(this);
  16841. // me.setLoading(true)
  16842. config.dataSourceCallbackFn.call(scope_1, me, {
  16843. successCallback: function (value) {
  16844. me._setDataReal(value);
  16845. // me.setLoading(false)
  16846. me.fireEvent('dataLoadComplete', me, true, value);
  16847. },
  16848. failCallback: function (error) {
  16849. // me.setLoading(false)
  16850. me.fireEvent('dataLoadComplete', me, false, error);
  16851. }
  16852. });
  16853. return;
  16854. }
  16855. var scope = lookupScope(me);
  16856. var dataSource = config.dataSource;
  16857. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16858. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16859. me.setLoading(true);
  16860. invokeServer$1(dataSource.url, params)
  16861. .then(function (res) {
  16862. me._setDataReal(res.data);
  16863. me.fireEvent('dataLoadComplete', me, res);
  16864. })
  16865. .finally(function () {
  16866. me.setLoading(false);
  16867. });
  16868. }
  16869. },
  16870. filterByText: function (text) {
  16871. this._filterText = text;
  16872. this._filterBy(this, text, 'text');
  16873. },
  16874. _filterBy: _$2.debounce(function (me, text, by) {
  16875. var view = me.getView();
  16876. me.store.clearFilter();
  16877. if (!me._filterText) {
  16878. // 没有筛选内容,还原状态
  16879. var selections = me.getSelection();
  16880. var selectionPaths_1 = [];
  16881. _$2.forEach(me.getSelection(), function (item) {
  16882. selectionPaths_1.push(item.getPath());
  16883. });
  16884. me.collapseAll();
  16885. _$2.forEach(selectionPaths_1, function (path) {
  16886. me.expandPath(path);
  16887. });
  16888. me.setSelection(selections);
  16889. return;
  16890. }
  16891. // 递归查找所有需要可见的节点 id 数组
  16892. var nodesAndParents = [];
  16893. var expandPaths = [];
  16894. me.getRootNode().cascadeBy(function (tree, view) {
  16895. var currNode = this;
  16896. currNode.collapse();
  16897. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16898. // 展开到匹配的路径
  16899. // me.expandPath(currNode.getPath());
  16900. expandPaths.push(currNode.getPath());
  16901. // 沿途父节点全部设定为可见
  16902. while (currNode.parentNode) {
  16903. nodesAndParents.push(currNode.id);
  16904. currNode = currNode.parentNode;
  16905. }
  16906. }
  16907. }, null, [me, view]);
  16908. me.store.filterBy(function (r) {
  16909. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16910. });
  16911. _$2.forEach(expandPaths, function (path) {
  16912. me.expandPath(path);
  16913. });
  16914. }, 1000),
  16915. });
  16916. }
  16917. function convertDataSource(sender, scope, newConfig) {
  16918. if (typeof newConfig.store !== 'undefined') {
  16919. // 有 store 属性的情况下,不做任何事
  16920. return;
  16921. }
  16922. if (typeof newConfig.dataSource === 'undefined') {
  16923. // 没有定义 dataSource 的情况下,不做任何事
  16924. return;
  16925. }
  16926. var dataSource = newConfig.dataSource;
  16927. if (typeof dataSource === 'string') {
  16928. // dataSource 是字符串的情况下,找到成员函数
  16929. dataSource = lookupFn(scope, dataSource);
  16930. }
  16931. if (typeof dataSource === 'function') {
  16932. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16933. newConfig.store = new Ext.data.TreeStore({
  16934. root: {
  16935. expanded: true,
  16936. children: []
  16937. }
  16938. });
  16939. newConfig.dataSourceCallbackFn = dataSource;
  16940. return;
  16941. }
  16942. // throw new TypeError('无法识别的调用方法')
  16943. }
  16944. //# sourceMappingURL=yvtree.js.map
  16945. /**
  16946. * 构建一个 grid 支持的 dataSource
  16947. */
  16948. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16949. if (reloadParams === void 0) { reloadParams = {}; }
  16950. if (isExcelExport === void 0) { isExcelExport = false; }
  16951. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16952. var _a;
  16953. var me = grid;
  16954. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16955. var storeOption = {};
  16956. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16957. if (dataSource.sqlId) {
  16958. dataSource.method = 'invoke';
  16959. dataSource.url = '/Dev@executeSQL';
  16960. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16961. // sqlId 是 @ 开头,代表直接带中文名
  16962. var scope_1 = lookupScope(grid);
  16963. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16964. params.sqlId = dataSource.sqlId.substring(1);
  16965. }
  16966. else {
  16967. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16968. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16969. params.path = path;
  16970. params.sqlId = sqlId;
  16971. }
  16972. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16973. }
  16974. var fields_1 = [];
  16975. _$2.forEach(grid.columns, function (col) {
  16976. var c = {};
  16977. if (col.dataIndex) {
  16978. c.name = col.dataIndex;
  16979. fields_1.push(c);
  16980. }
  16981. if (col.dataType) {
  16982. c.type = col.dataType;
  16983. }
  16984. });
  16985. // 默认支持 gridInvoke
  16986. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16987. //@ts-ignore
  16988. storeOption = {
  16989. fields: fields_1,
  16990. remoteSort: config.remoteSort,
  16991. remoteFilter: config.remoteFilter,
  16992. autoLoad: true,
  16993. pageSize: me.store.pageSize || config.pageSize,
  16994. proxy: {
  16995. type: 'jsonAjax',
  16996. $owner: me,
  16997. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16998. extraParams: extraParams,
  16999. reader: {
  17000. type: 'json',
  17001. rootProperty: 'data',
  17002. totalProperty: 'pagination.total',
  17003. successProperty: 'success',
  17004. messageProperty: 'msg',
  17005. transform: function (data) {
  17006. if (typeof window['ajaxProcess'] === 'function') {
  17007. window['ajaxProcess'](data);
  17008. }
  17009. if (typeof window['apiTranslate'] === 'function') {
  17010. window['apiTranslate'](data, dataSource.url);
  17011. }
  17012. if (typeof grid._transform === 'function') {
  17013. // 系统转换函数
  17014. grid._transform(data.data);
  17015. }
  17016. if (grid.dataTransform) {
  17017. if (typeof grid.dataTransform === 'string') {
  17018. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17019. }
  17020. return grid.dataTransform.call(scope, grid, data);
  17021. }
  17022. return data;
  17023. }
  17024. }
  17025. },
  17026. listeners: {
  17027. load: function (store, records, successful, operation) {
  17028. var _a, _b, _c;
  17029. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17030. if (rep.pagination) {
  17031. grid.dbInfo = rep.pagination.dbInfo;
  17032. grid.exportDataSql = rep.pagination.exportDataSql;
  17033. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17034. }
  17035. 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;
  17036. if (isExcelExport) {
  17037. if (typeof excelExportCallBack === 'function') {
  17038. excelExportCallBack(rep);
  17039. }
  17040. else if (excelExportCallBack) {
  17041. console.error("导出回调方法错误!");
  17042. }
  17043. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17044. }
  17045. else {
  17046. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17047. // 自动选中第一行
  17048. var data = grid.getStore().data;
  17049. if (data.length > 0) {
  17050. grid.setSelection(data.items[0]);
  17051. }
  17052. }
  17053. me.fireEvent('dataLoadComplete', me, successful, records);
  17054. }
  17055. }
  17056. }
  17057. };
  17058. }
  17059. else if (exports.apiConvert) {
  17060. // 外部扩展的 apiConvert
  17061. //@ts-ignore
  17062. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17063. }
  17064. else {
  17065. throw new TypeError("不支持的 API 请求方式");
  17066. }
  17067. if (isExcelExport) {
  17068. var excelStore = new Ext.data.Store(storeOption);
  17069. excelStore.load();
  17070. }
  17071. else {
  17072. if (me.groupField) {
  17073. console.log('groupField', storeOption.groupField);
  17074. storeOption.groupField = me.groupField;
  17075. }
  17076. me.setStore(new Ext.data.Store(storeOption));
  17077. }
  17078. }
  17079. function initStores () {
  17080. Ext.define('Yvan.JsonAjaxProxy', {
  17081. extend: 'Ext.data.proxy.Ajax',
  17082. alias: 'proxy.jsonAjax',
  17083. actionMethods: {
  17084. create: "POST",
  17085. read: "POST",
  17086. update: "POST",
  17087. destroy: "POST"
  17088. },
  17089. timeout: storeAjax.timeout,
  17090. buildRequest: function (operation) {
  17091. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17092. var me = this;
  17093. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17094. var scope = lookupScope($owner);
  17095. var gridParam = me.getParams(operation);
  17096. var customParam = {};
  17097. // 提取 srot 元素
  17098. if (gridParam.sort) {
  17099. var sort = JSON.parse(gridParam.sort);
  17100. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17101. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17102. customParam.sortModel = [];
  17103. _$2.forEach(sort, function (s) {
  17104. customParam.sortModel.push({
  17105. colId: s.property,
  17106. sort: _$2.toLower(s.direction)
  17107. });
  17108. });
  17109. delete gridParam.sort;
  17110. }
  17111. // 提取筛选元素
  17112. if (gridParam.filter) {
  17113. var filter = JSON.parse(gridParam.filter);
  17114. console.log('gridParam.filter', gridParam.filter);
  17115. // "[{"operator":"like","value":"1","property":"id"}]"
  17116. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17117. customParam.filterModel = {};
  17118. _$2.forEach(filter, function (s) {
  17119. var newFilterItem = {};
  17120. if (s.operator === 'like') {
  17121. newFilterItem.filterType = 'text';
  17122. newFilterItem.type = 'contains';
  17123. newFilterItem.filter = s.value;
  17124. }
  17125. else {
  17126. // 无法识别的筛选类型
  17127. newFilterItem.filterType = 'dict';
  17128. newFilterItem.type = 'in';
  17129. newFilterItem.filter = s.value;
  17130. }
  17131. customParam.filterModel[s.property] = newFilterItem;
  17132. });
  17133. delete gridParam.filter;
  17134. }
  17135. // 被 grid.constructor 作为方法存在
  17136. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17137. var params = _$2.defaultsDeep(gridParam, extraParams);
  17138. // var request = this.superclass.buildRequest.apply(this, arguments);
  17139. var request = new Ext.data.Request({
  17140. params: {},
  17141. action: operation.getAction(),
  17142. records: operation.getRecords(),
  17143. url: me.buildUrl(),
  17144. jsonData: __assign({ args: [
  17145. params
  17146. ] }, customParam),
  17147. proxy: me
  17148. });
  17149. operation.setRequest(request);
  17150. return request;
  17151. },
  17152. afterRequest: function (req, res) {
  17153. // Extend.afterExtRequest(req, res)
  17154. }
  17155. });
  17156. Ext.define('Ext.ux.data.MyReader', {
  17157. extend: 'Ext.data.reader.Json',
  17158. xtype: 'yvgridreader',
  17159. useSimpleAccessors: false,
  17160. });
  17161. }
  17162. //# sourceMappingURL=stores.js.map
  17163. function initBehaviorEdit(config) {
  17164. var _a, _b, _c;
  17165. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17166. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17167. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17168. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17169. if (dbTableName) {
  17170. // 生成增删查改
  17171. var tbar = [
  17172. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17173. click: 'system.saveGridRow()'
  17174. }, bind: {
  17175. disabled: '{!' + config.reference + '.ischanged}'
  17176. } }, saveButtonConfig),
  17177. '-',
  17178. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17179. click: 'system.insertGridRow()'
  17180. } }, addButtonConfig),
  17181. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17182. click: 'system.removeGridRow()'
  17183. } }, deleteButtonConfig),
  17184. ];
  17185. if (_$2.isArray(config.tbar)) {
  17186. config.tbar = __spread(tbar, [
  17187. '-'
  17188. ], config.tbar);
  17189. }
  17190. else if (_$2.isPlainObject(config.tbar)) {
  17191. config.tbar = {
  17192. border: false,
  17193. layout: {
  17194. type: 'vbox',
  17195. align: 'stretch'
  17196. },
  17197. items: [
  17198. {
  17199. xtype: 'toolbar',
  17200. border: false,
  17201. items: tbar
  17202. },
  17203. config.tbar,
  17204. ]
  17205. };
  17206. }
  17207. else if (_$2.isUndefined(config.tbar)) {
  17208. config.tbar = tbar;
  17209. }
  17210. else {
  17211. console.error("can't build tbar property!", config.tbar);
  17212. }
  17213. }
  17214. }
  17215. //# sourceMappingURL=grid_behavior.js.map
  17216. function initGridDialog(config) {
  17217. var detailDialog = _$2.get(config, 'detailDialog');
  17218. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17219. if (_$2.isPlainObject(detailDialog)) {
  17220. var tbar = [
  17221. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17222. click: 'system.showGridRowDetail()',
  17223. }, bind: {
  17224. disabled: '{!' + config.reference + '.selection}'
  17225. } }, detailButtonConfig)
  17226. ];
  17227. if (_$2.isArray(config.tbar)) {
  17228. config.tbar = __spread(config.tbar, [
  17229. '-'
  17230. ], tbar);
  17231. }
  17232. else if (_$2.isPlainObject(config.tbar)) {
  17233. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17234. config.tbar.items = __spread(config.tbar.items);
  17235. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17236. if (!toolbar) {
  17237. config.tbar.items = __spread(config.tbar.items, [
  17238. {
  17239. xtype: 'toolbar',
  17240. border: false,
  17241. items: tbar
  17242. },
  17243. ]);
  17244. }
  17245. else {
  17246. toolbar.items = __spread(toolbar.items, [
  17247. '-'
  17248. ], tbar);
  17249. }
  17250. }
  17251. else {
  17252. config.tbar = {
  17253. border: false,
  17254. layout: {
  17255. type: 'vbox',
  17256. align: 'stretch'
  17257. },
  17258. items: [
  17259. {
  17260. xtype: 'toolbar',
  17261. border: false,
  17262. items: tbar
  17263. },
  17264. config.tbar,
  17265. ]
  17266. };
  17267. }
  17268. }
  17269. else if (_$2.isUndefined(config.tbar)) {
  17270. config.tbar = tbar;
  17271. }
  17272. else {
  17273. console.error("can't build tbar property!", config.tbar);
  17274. }
  17275. }
  17276. }
  17277. var SystemEventFu$1 = /** @class */ (function () {
  17278. function SystemEventFu() {
  17279. }
  17280. SystemEventFu.prototype.showGridRowDetail = function () {
  17281. return function (sender) {
  17282. var grid1 = sender.up('yvgrid');
  17283. showGridRowDetail(grid1);
  17284. };
  17285. };
  17286. __decorate([
  17287. Lib({
  17288. title: '为某个表格所选数据行, 显示其对话框',
  17289. author: '罗一帆',
  17290. createAt: '2022-07-27',
  17291. updateAt: '2022-07-27',
  17292. type: 'system',
  17293. category: '表格',
  17294. }),
  17295. __metadata("design:type", Function),
  17296. __metadata("design:paramtypes", []),
  17297. __metadata("design:returntype", void 0)
  17298. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17299. return SystemEventFu;
  17300. }());
  17301. function showGridRowDetail(grid1, isEdit) {
  17302. if (isEdit === void 0) { isEdit = true; }
  17303. var _a, _b, _c;
  17304. if (!grid1.selection) {
  17305. msg$1('请选中要展示的数据行!');
  17306. return;
  17307. }
  17308. var record = grid1.selection;
  17309. if (_$2.isArray(record)) {
  17310. record = record[0];
  17311. }
  17312. if (!record) {
  17313. msg$1('请选中要展示的数据行!');
  17314. return;
  17315. }
  17316. var config = grid1._originVJson;
  17317. var detailDialog = config.detailDialog;
  17318. var vjson = {};
  17319. var parentScope = lookupScope(grid1);
  17320. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17321. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17322. _$2.defaultsDeep(vjson, {
  17323. // 强制属性
  17324. layout: 'fit',
  17325. __custom_path: __custom_path,
  17326. __custom_version: __custom_version,
  17327. fbar: __spread([
  17328. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17329. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17330. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17331. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17332. }, detailDialog, {
  17333. // 默认属性
  17334. width: 800,
  17335. height: 450,
  17336. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17337. });
  17338. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17339. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17340. vjson.items.push(tabpanel);
  17341. if (tabpanel) {
  17342. // 有多个选项卡,按每个选项卡进行过滤
  17343. _$2.forEach(tabpanel.items, function (tab) {
  17344. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17345. if (tabColumns.length > 0) {
  17346. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17347. _$2.extend(tab, tabVjson);
  17348. }
  17349. });
  17350. }
  17351. }
  17352. else {
  17353. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17354. }
  17355. var model = {
  17356. data: {
  17357. _edit: isEdit,
  17358. _editType: isEdit ? '编辑' : '添加',
  17359. }
  17360. };
  17361. _$2.forOwn(record.data, function (value, key) {
  17362. if (key === 'id') {
  17363. // 忽略 ID 属性
  17364. return;
  17365. }
  17366. if (_$2.startsWith(key, '_')) {
  17367. // 忽略 _ 开头的所有属性
  17368. return;
  17369. }
  17370. model.data[key] = value;
  17371. });
  17372. console.log(vjson);
  17373. var scope = new Scope({ vjson: vjson, model: model, });
  17374. //@ts-ignore
  17375. scope.commit = function () {
  17376. return new Promise(function (resolve) {
  17377. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17378. if (_$2.startsWith(key, '_')) {
  17379. // _origin 等属性可以被忽略
  17380. return;
  17381. }
  17382. if (key === 'id') {
  17383. // id 属性被忽略
  17384. return;
  17385. }
  17386. record.set(key, value);
  17387. });
  17388. resolve();
  17389. });
  17390. };
  17391. scope.showDialog(grid1, {}, {});
  17392. }
  17393. function buildForm(columns, tabpanel, detailDialog) {
  17394. var vjson = __assign({ border: false, layout: {
  17395. type: 'vbox',
  17396. pack: 'start',
  17397. align: 'stretch'
  17398. }, defaults: {
  17399. border: false,
  17400. anchor: '100%',
  17401. margin: '5',
  17402. }, scrollable: true, items: [] }, detailDialog.form);
  17403. var emptyFieldset = [];
  17404. var fieldsetList = [];
  17405. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17406. _$2.forEach(columns, function (c) {
  17407. var fieldset = _$2.get(c, 'form.fieldset');
  17408. if (fieldset) {
  17409. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17410. if (idx < 0) {
  17411. fieldsetList.push({
  17412. fieldset: fieldset,
  17413. columns: [c]
  17414. });
  17415. }
  17416. else {
  17417. fieldsetList[idx].columns.push(c);
  17418. }
  17419. }
  17420. else {
  17421. emptyFieldset.push(c);
  17422. }
  17423. });
  17424. _$2.forEach(fieldsetList, function (fs) {
  17425. var fieldSetVjson = {
  17426. xtype: 'fieldset',
  17427. title: fs.fieldset,
  17428. items: []
  17429. };
  17430. buildFieldItems(fieldSetVjson.items, fs.columns);
  17431. vjson.items.push(fieldSetVjson);
  17432. });
  17433. buildFieldItems(vjson.items, emptyFieldset);
  17434. return vjson;
  17435. }
  17436. // 构建字段组
  17437. function buildFieldItems(items, columns) {
  17438. var _a, _b, _c, _d, _e;
  17439. var row = {
  17440. xtype: 'cols',
  17441. items: []
  17442. };
  17443. for (var i = 0; i < columns.length; i++) {
  17444. var column = columns[i];
  17445. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17446. delete row.xtype;
  17447. row.layout = column.form.rowlayout;
  17448. }
  17449. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17450. row.items.push({ border: false, flex: column.form.prefix });
  17451. }
  17452. var fieldVjson = buildField(column, row.items.length);
  17453. if (!fieldVjson) {
  17454. continue;
  17455. }
  17456. row.items.push(fieldVjson);
  17457. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17458. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17459. }
  17460. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17461. items.push(row);
  17462. row = {
  17463. xtype: 'cols',
  17464. items: []
  17465. };
  17466. }
  17467. }
  17468. if (row.items.length > 0) {
  17469. items.push(row);
  17470. }
  17471. }
  17472. // 构建字段
  17473. function buildField(column, colIdx) {
  17474. var ret;
  17475. if (column.xtype === 'checkcolumn') {
  17476. ret = _$2.defaultsDeep({
  17477. xtype: 'checkbox',
  17478. uncheckedValue: column.uncheckedValue,
  17479. checkedValue: column.checkedValue,
  17480. boxLabel: column.header,
  17481. bind: {
  17482. value: '{' + column.dataIndex + '}'
  17483. }
  17484. }, column.form);
  17485. if (colIdx == 0) {
  17486. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17487. ret.margin = '0 0 0 85';
  17488. }
  17489. }
  17490. else {
  17491. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17492. fieldLabel: column.header,
  17493. bind: {
  17494. value: '{' + column.dataIndex + '}'
  17495. },
  17496. });
  17497. }
  17498. if (!ret.xtype) {
  17499. return;
  17500. }
  17501. if (!ret.dict && ret.xtype === 'combo') {
  17502. ret.dict = column.dict;
  17503. }
  17504. // 删除辅助属性
  17505. delete ret.order;
  17506. delete ret.wrap;
  17507. return ret;
  17508. }
  17509. //# sourceMappingURL=grid_dialog.js.map
  17510. var model$c = {
  17511. data: {}
  17512. };
  17513. //# sourceMappingURL=GridColumnCustom.model.js.map
  17514. var vjson$c = {
  17515. title: '自定义表格属性',
  17516. layout: 'fit',
  17517. width: 980,
  17518. height: 500,
  17519. fbar: [
  17520. {
  17521. xtype: "button",
  17522. text: "保存",
  17523. iconCls: 'x-fa fa-save',
  17524. listeners: {
  17525. click: 'scope.commit',
  17526. }
  17527. },
  17528. {
  17529. xtype: "button",
  17530. text: "关闭",
  17531. iconCls: 'x-fa fa-times',
  17532. listeners: {
  17533. click: 'system.closeMe()',
  17534. }
  17535. },
  17536. ],
  17537. items: [
  17538. {
  17539. region: 'center',
  17540. xtype: 'tabpanel',
  17541. items: [
  17542. {
  17543. title: '基本信息', reference: 'basic',
  17544. layout: {
  17545. type: 'vbox',
  17546. pack: 'start',
  17547. align: 'stretch'
  17548. },
  17549. defaults: {
  17550. border: false,
  17551. anchor: '100%',
  17552. margin: '5',
  17553. },
  17554. scrollable: true,
  17555. items: [
  17556. {
  17557. xtype: 'cols',
  17558. items: [
  17559. {
  17560. fieldLabel: '路径',
  17561. bind: { value: '{__custom_path}' },
  17562. xtype: 'textfield',
  17563. flex: 2,
  17564. },
  17565. {
  17566. fieldLabel: '版本',
  17567. bind: { value: '{__custom_version}' },
  17568. xtype: 'textfield',
  17569. },
  17570. ]
  17571. },
  17572. {
  17573. xtype: 'cols',
  17574. items: [
  17575. {
  17576. fieldLabel: '配置点',
  17577. bind: { value: '{__custom_point}' },
  17578. xtype: 'textfield',
  17579. },
  17580. {
  17581. fieldLabel: 'reference',
  17582. bind: { value: '{reference}' },
  17583. xtype: 'textfield',
  17584. },
  17585. {
  17586. fieldLabel: '编辑模式',
  17587. bind: { value: '{_mode}' },
  17588. xtype: 'combo',
  17589. dict: 'GRID_MODE',
  17590. },
  17591. ]
  17592. },
  17593. {
  17594. layout: 'hbox',
  17595. defaults: {
  17596. margin: '0 0 0 15',
  17597. },
  17598. items: [
  17599. {
  17600. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17601. bind: {
  17602. value: "{hideFootbar}"
  17603. }
  17604. },
  17605. {
  17606. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17607. bind: {
  17608. value: "{hideRefresh}"
  17609. }
  17610. },
  17611. {
  17612. boxLabel: '隐藏导出', xtype: 'checkbox',
  17613. bind: {
  17614. value: "{hideExport}"
  17615. }
  17616. },
  17617. {
  17618. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17619. bind: {
  17620. value: "{hideAutoSize}"
  17621. }
  17622. },
  17623. {
  17624. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17625. bind: {
  17626. value: "{hideClearFilter}"
  17627. }
  17628. },
  17629. {
  17630. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17631. bind: {
  17632. value: "{hideSaveGridUIConfig}"
  17633. }
  17634. },
  17635. {
  17636. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17637. bind: {
  17638. value: "{hideClearGridUIConfig}"
  17639. }
  17640. },
  17641. ]
  17642. },
  17643. {
  17644. layout: 'hbox',
  17645. defaults: {
  17646. margin: '0 0 0 15',
  17647. },
  17648. items: [
  17649. {
  17650. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17651. bind: { value: '{autoLoad}' },
  17652. margin: '0 0 0 85',
  17653. },
  17654. {
  17655. boxLabel: '分页模式', xtype: 'checkbox',
  17656. bind: { value: '{pagination}' },
  17657. },
  17658. {
  17659. boxLabel: '显示行序号', xtype: 'checkbox',
  17660. bind: { value: '{show_rownum}' },
  17661. },
  17662. {
  17663. boxLabel: '后端排序', xtype: 'checkbox',
  17664. bind: {
  17665. value: "{remoteSort}"
  17666. }
  17667. },
  17668. {
  17669. boxLabel: '后端过滤', xtype: 'checkbox',
  17670. bind: {
  17671. value: "{remoteFilter}"
  17672. }
  17673. },
  17674. {
  17675. boxLabel: '隐藏', xtype: 'checkbox',
  17676. bind: {
  17677. value: "{hidden}"
  17678. }
  17679. },
  17680. ]
  17681. },
  17682. {
  17683. layout: 'hbox',
  17684. defaults: {
  17685. margin: '0 0 0 15',
  17686. },
  17687. items: [
  17688. {
  17689. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17690. bind: {
  17691. value: "{enableColumnHide}"
  17692. }
  17693. },
  17694. {
  17695. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17696. bind: {
  17697. value: "{enableColumnMove}"
  17698. }
  17699. },
  17700. {
  17701. boxLabel: '自定义筛选', xtype: 'checkbox',
  17702. bind: {
  17703. value: "{gridfilters}"
  17704. }
  17705. },
  17706. {
  17707. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17708. bind: {
  17709. value: "{enableColumnResize}"
  17710. }
  17711. },
  17712. {
  17713. boxLabel: '点击列头排序', xtype: 'checkbox',
  17714. bind: {
  17715. value: "{sortOnClick}"
  17716. }
  17717. },
  17718. ]
  17719. },
  17720. {
  17721. xtype: 'cols',
  17722. items: [
  17723. {
  17724. fieldLabel: 'dbTableName',
  17725. labelWidth: 110,
  17726. bind: { value: '{behavior.dbTableName}' },
  17727. xtype: 'textfield',
  17728. },
  17729. {
  17730. fieldLabel: 'theid',
  17731. bind: { value: '{theid}' },
  17732. xtype: 'textfield',
  17733. },
  17734. {
  17735. fieldLabel: '添加行聚焦',
  17736. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17737. xtype: 'textfield',
  17738. },
  17739. ]
  17740. },
  17741. {
  17742. xtype: 'cols',
  17743. items: [
  17744. {
  17745. fieldLabel: '批量删除提示',
  17746. labelWidth: 110,
  17747. bind: { value: '{behavior.batchRemoveConfirm}' },
  17748. xtype: 'textfield',
  17749. },
  17750. {
  17751. fieldLabel: '删除提示',
  17752. bind: { value: '{behavior.singleRemoveConfirm}' },
  17753. xtype: 'textfield',
  17754. },
  17755. {
  17756. fieldLabel: '触发刷新',
  17757. labelWidth: 110,
  17758. bind: { value: '{behavior.selectToReload}' },
  17759. xtype: 'textfield',
  17760. },
  17761. ]
  17762. },
  17763. ]
  17764. },
  17765. {
  17766. title: '字段', reference: 'grid1',
  17767. xtype: 'yvgrid',
  17768. pagination: false,
  17769. _mode: 'edit',
  17770. listeners: {
  17771. buttonclick: 'scope.grid1Buttonclick',
  17772. },
  17773. hideFootbar: true,
  17774. tbar: [
  17775. {
  17776. xtype: 'button',
  17777. text: '添加',
  17778. iconCls: 'x-fa fa-plus-circle',
  17779. listeners: {
  17780. click: 'scope.addField'
  17781. }
  17782. },
  17783. {
  17784. xtype: 'button',
  17785. text: '删除',
  17786. iconCls: 'x-fa fa-minus-circle',
  17787. listeners: {
  17788. click: 'scope.removeField'
  17789. }
  17790. },
  17791. '-',
  17792. {
  17793. xtype: 'button',
  17794. text: '自动分析',
  17795. iconCls: 'x-fa fa-code-fork',
  17796. listeners: {
  17797. click: 'scope.calcField'
  17798. }
  17799. },
  17800. {
  17801. xtype: 'button',
  17802. text: '上移',
  17803. iconCls: 'x-fa fa-arrow-up',
  17804. listeners: {
  17805. click: 'scope.moveUp'
  17806. }
  17807. },
  17808. {
  17809. xtype: 'button',
  17810. text: '下移',
  17811. iconCls: 'x-fa fa-arrow-down',
  17812. listeners: {
  17813. click: 'scope.moveDown'
  17814. }
  17815. },
  17816. ],
  17817. store: {},
  17818. columns: [
  17819. {
  17820. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17821. editor: { xtype: 'textfield' }
  17822. },
  17823. {
  17824. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17825. editor: { xtype: 'textfield' }
  17826. },
  17827. {
  17828. dataIndex: 'header', header: '中文', width: 140,
  17829. editor: { xtype: 'textfield' }
  17830. },
  17831. {
  17832. dataIndex: 'dict', header: '字典', width: 110,
  17833. editor: { xtype: 'combogrid' }
  17834. },
  17835. {
  17836. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17837. editor: { xtype: 'combogrid' }, hidden: true,
  17838. },
  17839. {
  17840. dataIndex: 'width', header: '宽度', width: 80,
  17841. editor: { xtype: 'numberfield' }, hidden: true,
  17842. },
  17843. {
  17844. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17845. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17846. },
  17847. {
  17848. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17849. editor: { xtype: 'textfield' },
  17850. },
  17851. {
  17852. dataIndex: 'createValue', text: '客户端新创建值',
  17853. editor: { xtype: 'textfield' },
  17854. },
  17855. {
  17856. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17857. resizable: false, sortable: false, menuDisabled: true,
  17858. checkedValue: true, uncheckedValue: false,
  17859. },
  17860. {
  17861. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17862. resizable: false, sortable: false, menuDisabled: true,
  17863. checkedValue: true, uncheckedValue: false,
  17864. },
  17865. {
  17866. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17867. resizable: false, sortable: false, menuDisabled: true,
  17868. checkedValue: true, uncheckedValue: false,
  17869. },
  17870. {
  17871. dataIndex: 'formatter', header: '格式化', width: 110,
  17872. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17873. },
  17874. {
  17875. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17876. resizable: false, sortable: false, menuDisabled: true,
  17877. checkedValue: true, uncheckedValue: false, hidden: true,
  17878. },
  17879. {
  17880. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17881. resizable: false, sortable: false, menuDisabled: true,
  17882. hidden: true,
  17883. },
  17884. {
  17885. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17886. resizable: false, sortable: false, menuDisabled: true,
  17887. checkedValue: true, uncheckedValue: false, hidden: true,
  17888. },
  17889. {
  17890. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17891. resizable: false, sortable: false, menuDisabled: true,
  17892. },
  17893. {
  17894. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17895. resizable: false, sortable: false, menuDisabled: true,
  17896. checkedValue: true, uncheckedValue: false, hidden: true,
  17897. },
  17898. {
  17899. dataIndex: 'form_order', text: '对话框序号',
  17900. editor: { xtype: 'numberfield' },
  17901. },
  17902. {
  17903. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17904. resizable: false, sortable: false, menuDisabled: true,
  17905. checkedValue: true, uncheckedValue: false,
  17906. },
  17907. {
  17908. dataIndex: 'form_xtype', text: '对话框编辑器',
  17909. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17910. },
  17911. {
  17912. dataIndex: 'form_fieldset', text: '对话框字段组',
  17913. editor: { xtype: 'textfield' }, hidden: true,
  17914. },
  17915. {
  17916. dataIndex: 'form_tab', text: '对话框选项卡',
  17917. editor: { xtype: 'textfield' }, hidden: true,
  17918. },
  17919. {
  17920. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17921. resizable: false, sortable: false, menuDisabled: true,
  17922. checkedValue: true, uncheckedValue: false, hidden: true,
  17923. },
  17924. ],
  17925. },
  17926. {
  17927. title: 'SQL和查询条件', reference: 'sql',
  17928. layout: 'border',
  17929. border: false,
  17930. items: [
  17931. {
  17932. region: 'north',
  17933. height: 200,
  17934. border: false,
  17935. split: true,
  17936. xtype: 'yvgrid',
  17937. reference: 'gridCondition',
  17938. pagination: false,
  17939. hideFootbar: true,
  17940. _mode: 'edit',
  17941. listeners: {
  17942. buttonclick: 'scope.conditionButtonclick',
  17943. },
  17944. store: {},
  17945. tbar: {
  17946. xtype: 'toolbar',
  17947. border: false,
  17948. items: [
  17949. {
  17950. xtype: 'button',
  17951. text: '添加条件',
  17952. iconCls: 'x-fa fa-plus-circle',
  17953. listeners: {
  17954. click: 'scope.addCondition'
  17955. }
  17956. },
  17957. {
  17958. xtype: 'button',
  17959. text: '删除条件',
  17960. iconCls: 'x-fa fa-minus-circle',
  17961. listeners: {
  17962. click: 'scope.removeCondition'
  17963. }
  17964. },
  17965. '-',
  17966. {
  17967. xtype: 'button',
  17968. text: '自动分析条件变量',
  17969. iconCls: 'x-fa fa-code-fork',
  17970. listeners: {
  17971. click: 'scope.calcCondition'
  17972. }
  17973. },
  17974. {
  17975. xtype: 'button',
  17976. text: '上移',
  17977. iconCls: 'x-fa fa-arrow-up',
  17978. listeners: {
  17979. click: 'scope.moveUpCondition'
  17980. }
  17981. },
  17982. {
  17983. xtype: 'button',
  17984. text: '下移',
  17985. iconCls: 'x-fa fa-arrow-down',
  17986. listeners: {
  17987. click: 'scope.moveDownCondition'
  17988. }
  17989. },
  17990. ]
  17991. },
  17992. columns: [
  17993. {
  17994. text: '条件变量',
  17995. dataIndex: 'param_name',
  17996. width: 140,
  17997. sortable: false,
  17998. menuDisabled: true,
  17999. editor: {
  18000. selectOnFocus: true
  18001. },
  18002. },
  18003. {
  18004. text: '中文标题',
  18005. dataIndex: 'fieldLabel',
  18006. width: 120,
  18007. sortable: false,
  18008. menuDisabled: true,
  18009. editor: {
  18010. selectOnFocus: true
  18011. },
  18012. },
  18013. {
  18014. text: '编辑类型',
  18015. dataIndex: 'xtype',
  18016. width: 80,
  18017. sortable: false,
  18018. menuDisabled: true,
  18019. editor: {
  18020. xtype: 'combo',
  18021. typeAhead: true,
  18022. triggerAction: 'all',
  18023. selectOnFocus: true,
  18024. store: [
  18025. ['textfield', 'textfield'],
  18026. ['combo', 'combo'],
  18027. ['datefield', 'datefield'],
  18028. ['datetimefield', 'datetimefield'],
  18029. ['numberfield', 'numberfield'],
  18030. ['multiplesearch', 'multiplesearch'],
  18031. ]
  18032. }
  18033. },
  18034. {
  18035. text: '权重',
  18036. dataIndex: 'conditionFieldFlex',
  18037. align: 'right',
  18038. width: 60,
  18039. sortable: false,
  18040. menuDisabled: true,
  18041. editor: {
  18042. xtype: 'numberfield',
  18043. selectOnFocus: false,
  18044. minValue: 0,
  18045. maxValue: 10
  18046. },
  18047. },
  18048. {
  18049. text: '字典',
  18050. dataIndex: 'conditionFieldDict',
  18051. width: 160,
  18052. sortable: false,
  18053. menuDisabled: true,
  18054. editor: {
  18055. selectOnFocus: false
  18056. },
  18057. },
  18058. {
  18059. xtype: 'checkcolumn',
  18060. dataIndex: "conditionFieldWrap", header: "换行",
  18061. width: 65,
  18062. sortable: false,
  18063. menuDisabled: true,
  18064. },
  18065. {
  18066. text: '扩展参数',
  18067. dataIndex: 'conditionFieldExtend',
  18068. sortable: false,
  18069. menuDisabled: true,
  18070. editor: {
  18071. selectOnFocus: false
  18072. },
  18073. },
  18074. ]
  18075. },
  18076. {
  18077. region: 'center',
  18078. xtype: 'sqleditor',
  18079. layout: 'fit',
  18080. reference: 'sqlEditor',
  18081. split: true,
  18082. },
  18083. ]
  18084. },
  18085. {
  18086. title: '详情对话框',
  18087. layout: {
  18088. type: 'vbox',
  18089. pack: 'start',
  18090. align: 'stretch'
  18091. },
  18092. defaults: {
  18093. border: false,
  18094. anchor: '100%',
  18095. margin: '5',
  18096. },
  18097. scrollable: true,
  18098. items: [
  18099. {
  18100. xtype: 'cols',
  18101. items: [
  18102. {
  18103. fieldLabel: '对话框标题',
  18104. bind: { value: '{detailDialog.title}' },
  18105. xtype: 'textfield',
  18106. flex: 2,
  18107. },
  18108. {
  18109. fieldLabel: '宽度',
  18110. bind: { value: '{detailDialog.width}' },
  18111. xtype: 'numberfield',
  18112. },
  18113. {
  18114. fieldLabel: '高度',
  18115. bind: { value: '{detailDialog.height}' },
  18116. xtype: 'numberfield',
  18117. },
  18118. ]
  18119. },
  18120. ]
  18121. },
  18122. {
  18123. title: '界面源码',
  18124. xtype: 'jseditor',
  18125. reference: 'jseditor'
  18126. }
  18127. ]
  18128. }
  18129. ]
  18130. };
  18131. //# sourceMappingURL=GridColumnCustom.view.js.map
  18132. var GridColumnCustom = /** @class */ (function (_super) {
  18133. __extends(GridColumnCustom, _super);
  18134. function GridColumnCustom() {
  18135. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18136. }
  18137. GridColumnCustom.prototype.commit = function () {
  18138. };
  18139. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18140. };
  18141. GridColumnCustom.prototype.conditionButtonclick = function () {
  18142. };
  18143. GridColumnCustom.prototype.addField = function () {
  18144. };
  18145. GridColumnCustom.prototype.removeField = function () {
  18146. };
  18147. GridColumnCustom.prototype.calcField = function () {
  18148. };
  18149. GridColumnCustom.prototype.moveUp = function () {
  18150. };
  18151. GridColumnCustom.prototype.moveDown = function () {
  18152. };
  18153. GridColumnCustom.prototype.addCondition = function () {
  18154. };
  18155. GridColumnCustom.prototype.removeCondition = function () {
  18156. };
  18157. GridColumnCustom.prototype.calcCondition = function () {
  18158. };
  18159. GridColumnCustom.prototype.moveUpCondition = function () {
  18160. };
  18161. GridColumnCustom.prototype.moveDownCondition = function () {
  18162. };
  18163. return GridColumnCustom;
  18164. }(Scope));
  18165. //# sourceMappingURL=GridColumnCustom.js.map
  18166. function initGridCode(grid, newConfig, buttons) {
  18167. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18168. buttons.push({
  18169. xtype: 'button',
  18170. tooltip: '定义表格属性',
  18171. iconCls: 'x-fa fa-codepen',
  18172. handler: function (btn) {
  18173. var customWindow = new GridColumnCustom();
  18174. customWindow.showDialog(btn, {}, {});
  18175. }
  18176. });
  18177. buttons.push({
  18178. xtype: 'button',
  18179. tooltip: '定义表格数据源',
  18180. iconCls: 'x-fa fa-database',
  18181. handler: function () {
  18182. // showCustomGridDataSource(grid)
  18183. }
  18184. });
  18185. }
  18186. }
  18187. //# sourceMappingURL=grid_code.js.map
  18188. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18189. var hexToString = function (hex) {
  18190. var arr = hex.split("");
  18191. var out = "";
  18192. for (var i = 0; i < arr.length / 2; i++) {
  18193. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18194. // @ts-ignore
  18195. var charValue = String.fromCharCode(tmp);
  18196. out += charValue;
  18197. }
  18198. return out;
  18199. };
  18200. var defaultGrid = grid;
  18201. function initGrid () {
  18202. Ext.define('Yvan.Grid', {
  18203. extend: 'Ext.grid.Panel',
  18204. xtype: 'yvgrid',
  18205. __suspendReload: false,
  18206. _originVJson: {},
  18207. constructor: function (config) {
  18208. var _this = this;
  18209. var _a, _b, _c, _d, _e, _f;
  18210. var me = this;
  18211. var dataSource = config.dataSource;
  18212. 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);
  18213. me._originVJson = config;
  18214. if (!isDesignMode(scope, config)) {
  18215. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18216. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18217. var cacheData = this.getColumnConfigCache();
  18218. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18219. var newColumns = [];
  18220. for (var j = 0; j < cacheData.length; j++) {
  18221. var itData = cacheData[j];
  18222. for (var i = 0; i < config.columns.length; i++) {
  18223. var column = config.columns[i];
  18224. if (itData.dataIndex === column.dataIndex) {
  18225. if (itData.width) {
  18226. column.width = itData.width;
  18227. }
  18228. column.hidden = itData.hidden;
  18229. column.locked = itData.locked;
  18230. newColumns.push(column);
  18231. break;
  18232. }
  18233. }
  18234. }
  18235. config.columns = newColumns;
  18236. }
  18237. }
  18238. }
  18239. var newConfig = _$2.defaultsDeep({
  18240. // 强制性属性 bug.
  18241. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18242. // enableLocking: false,
  18243. // syncRowHeight: false,
  18244. }, baseConfig(config, 'row-item'), config, grid);
  18245. // 在面板上的组件
  18246. // const scope = newConfig.$initParent?.yvanScope ||
  18247. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18248. // config.$vmParent?.yvanScope ||
  18249. // newConfig.$vmParent?._parent?.yvanScope;
  18250. var buttons = [];
  18251. var getRowClass = newConfig.getRowClass;
  18252. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18253. _$2.startsWith(getRowClass, "system."))) {
  18254. var fn = lookupFn(scope, getRowClass);
  18255. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18256. }
  18257. if (!newConfig.hideExport) {
  18258. buttons.push({
  18259. xtype: 'button',
  18260. tooltip: '导出Excel',
  18261. iconCls: 'x-fa fa-download',
  18262. listeners: {
  18263. click: this.exportExcel
  18264. },
  18265. });
  18266. }
  18267. if (!newConfig.hideAutoSize) {
  18268. buttons.push({
  18269. xtype: 'button',
  18270. iconCls: 'x-fa fa-text-width',
  18271. tooltip: '自适应宽度',
  18272. listeners: {
  18273. click: this.autoSizeColumns
  18274. }
  18275. });
  18276. }
  18277. if (!newConfig.hideClearFilter) {
  18278. buttons.push({
  18279. xtype: 'button',
  18280. tooltip: '清空筛选',
  18281. iconCls: 'x-fa fa-filter',
  18282. handler: this.clearFilter
  18283. });
  18284. }
  18285. if (!newConfig.hideSaveGridUIConfig) {
  18286. buttons.push({
  18287. xtype: 'button',
  18288. tooltip: '保存布局',
  18289. iconCls: 'x-fa fa-cogs',
  18290. handler: this.saveGridUIConfig
  18291. });
  18292. }
  18293. if (!newConfig.hideClearGridUIConfig) {
  18294. buttons.push({
  18295. xtype: 'button',
  18296. tooltip: '还原布局',
  18297. iconCls: 'x-fa fa-reply-all',
  18298. handler: this.clearGridUIConfig
  18299. });
  18300. }
  18301. initGridCode(me, newConfig, buttons);
  18302. if (!newConfig.hideFootbar) {
  18303. if (newConfig.pagination) {
  18304. newConfig.bbar = new Ext.PagingToolbar({
  18305. // pageSize: newConfig.pageSize, 这个值是无效的
  18306. displayInfo: true,
  18307. store: this.store,
  18308. emptyMsg: '没有记录',
  18309. cls: 'grid-bbar',
  18310. items: __spread([
  18311. {
  18312. xtype: 'combobox',
  18313. tooltip: '分页',
  18314. queryMode: 'local',
  18315. editable: false,
  18316. allowBlank: true,
  18317. labelAlign: 'right',
  18318. width: 90,
  18319. // labelWidth: 30,
  18320. listConfig: {
  18321. minWidth: null
  18322. },
  18323. value: 50,
  18324. valueField: undefined,
  18325. displayField: undefined,
  18326. hideClear: true,
  18327. store: newConfig.pageSizeOption,
  18328. listeners: {
  18329. change: function (sender, nv, ov) {
  18330. _this.store.pageSize = nv;
  18331. _this.store.loadPage(1);
  18332. }
  18333. }
  18334. }
  18335. ], buttons),
  18336. doRefresh: function () {
  18337. me.reload();
  18338. }
  18339. });
  18340. }
  18341. else {
  18342. newConfig.bbar = {
  18343. xtype: 'toolbar', overflowHandler: 'menu',
  18344. cls: 'grid-bbar',
  18345. items: __spread([
  18346. {
  18347. xtype: 'button',
  18348. tooltip: '刷新',
  18349. iconCls: 'x-fa fa-refresh',
  18350. handler: function () {
  18351. _this.reload();
  18352. }
  18353. },
  18354. '-'
  18355. ], buttons)
  18356. };
  18357. if (newConfig.hideRefresh) {
  18358. newConfig.bbar.items.splice(0, 1);
  18359. }
  18360. }
  18361. }
  18362. if (_$2.isArray(newConfig.condition)) {
  18363. // 带查询条件
  18364. var conditionRows_1 = [];
  18365. var newRow_1 = false;
  18366. var currentRow_1 = { xtype: 'cols', items: [], };
  18367. conditionRows_1.push(currentRow_1);
  18368. _$2.forEach(newConfig.condition, function (item) {
  18369. var _a;
  18370. if (newRow_1) {
  18371. currentRow_1 = { xtype: 'cols', items: [], };
  18372. conditionRows_1.push(currentRow_1);
  18373. }
  18374. var vj = _$2.cloneDeep(item);
  18375. if (vj.xtype) {
  18376. if (item.xtype === 'combo' && item.dict) {
  18377. vj.fix = ['system.getDict("' + item.dict + '")'];
  18378. }
  18379. if (item.xtype === 'datetimefield') {
  18380. _$2.defer(function () {
  18381. //@ts-ignore
  18382. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18383. });
  18384. }
  18385. else if (item.xtype === 'datefield') {
  18386. _$2.defer(function () {
  18387. //@ts-ignore
  18388. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18389. });
  18390. }
  18391. else {
  18392. scope.viewModel.set(item.param_name, '');
  18393. }
  18394. }
  18395. else {
  18396. // 没有组件类型,是个空占位符
  18397. vj.border = false;
  18398. }
  18399. if (item.param_name) {
  18400. vj.bind = {
  18401. value: '{' + item.param_name + '}'
  18402. };
  18403. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18404. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18405. }
  18406. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18407. currentRow_1.items.push(vj);
  18408. });
  18409. newConfig.tbar = {
  18410. xtype: 'form',
  18411. border: false,
  18412. items: conditionRows_1,
  18413. defaults: {
  18414. margin: '8 0 8 0'
  18415. },
  18416. };
  18417. console.log('newConfig', newConfig);
  18418. }
  18419. _$2.each(newConfig.columns, function (c) {
  18420. var renderer = c.renderer, formatter = c.formatter;
  18421. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18422. _$2.startsWith(renderer, "system."))) {
  18423. if (newConfig.$initParent) {
  18424. if (scope) {
  18425. var rendererFn = lookupFn(scope, renderer);
  18426. c.renderer = rendererFn.bind(scope);
  18427. }
  18428. }
  18429. }
  18430. if (c.dict) {
  18431. c.fix = ['system.getDict("' + c.dict + '")'];
  18432. if (c.editor && c.editor.xtype === 'combo') {
  18433. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18434. c.editor.typeAhead = true;
  18435. c.editor.triggerAction = 'all';
  18436. c.editor.selectOnFocus = false;
  18437. c.editor.listConfig = {
  18438. minWidth: 200
  18439. };
  18440. }
  18441. }
  18442. if (formatter === 'button') {
  18443. c.tdCls = 'td-btn';
  18444. if (!c.listeners) {
  18445. c.listeners = {};
  18446. }
  18447. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18448. if ($(event.target).is('input')) {
  18449. me.fireEvent('buttonclick', me, this, record);
  18450. }
  18451. };
  18452. }
  18453. else if (formatter === 'percentRenderer') {
  18454. c.tdCls = 'td-percent';
  18455. }
  18456. });
  18457. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18458. // 强制为编辑模式
  18459. newConfig.selModel = {
  18460. type: 'spreadsheet',
  18461. columnSelect: true,
  18462. pruneRemoved: false,
  18463. extensible: 'y'
  18464. };
  18465. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18466. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18467. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18468. }
  18469. else {
  18470. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18471. }
  18472. }
  18473. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18474. // 强制为勾选模式
  18475. newConfig.selModel = {
  18476. type: 'checkboxmodel',
  18477. mode: 'MULTI',
  18478. };
  18479. }
  18480. else if (newConfig._mode === 'checkonly') {
  18481. newConfig.selModel = {
  18482. type: 'checkboxmodel',
  18483. mode: 'MULTI',
  18484. checkOnly: true,
  18485. };
  18486. }
  18487. else if (newConfig._mode === 'select') {
  18488. // 强制为选择模式
  18489. newConfig.selModel = {
  18490. selType: 'rowmodel',
  18491. mode: 'SINGLE',
  18492. };
  18493. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18494. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18495. }
  18496. }
  18497. initBehaviorEdit(newConfig);
  18498. initGridDialog(newConfig);
  18499. this.superclass.constructor.call(this, newConfig);
  18500. this.store.pageSize = newConfig.pageSize;
  18501. },
  18502. setData: function (value) {
  18503. var me = this;
  18504. me._setDataReal(value);
  18505. },
  18506. /**
  18507. * 添加行,并进入编辑状态
  18508. * @param record 新行的属性集
  18509. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18510. */
  18511. appendEditRow: function (record, editRowCol) {
  18512. var records = this.getStore().add(record);
  18513. var recNew = records[0];
  18514. this.setSelection(records);
  18515. if (typeof editRowCol === 'string' && editRowCol) {
  18516. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18517. }
  18518. if (typeof editRowCol === 'number') {
  18519. var ce = this.findPlugin('cellediting');
  18520. this.editingPlugin = ce;
  18521. ce.startEdit(recNew, editRowCol);
  18522. }
  18523. },
  18524. beginEdit: function (record, editRowCol) {
  18525. if (typeof record === 'number') {
  18526. record = this.store.data.getAt(record);
  18527. }
  18528. if (record.isEntity === true) {
  18529. this.setSelection([record]);
  18530. if (typeof editRowCol === 'string' && editRowCol) {
  18531. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18532. }
  18533. if (typeof editRowCol === 'number') {
  18534. var ce = this.findPlugin('cellediting');
  18535. this.editingPlugin = ce;
  18536. ce.startEdit(record, editRowCol);
  18537. }
  18538. }
  18539. },
  18540. /**
  18541. * 移除行
  18542. * @param record 如果记录传空,就是当前选中的行
  18543. */
  18544. removeEditRow: function (record) {
  18545. if (!record) {
  18546. record = this.selection;
  18547. }
  18548. if (!record) {
  18549. msg('请选中要删除的行');
  18550. return;
  18551. }
  18552. this.getStore().remove(record);
  18553. },
  18554. /**
  18555. * 获取全部原始数据
  18556. */
  18557. getDataRows: function () {
  18558. return this.getStore().data.items.map(function (r) { return r.data; });
  18559. },
  18560. /**
  18561. * 获取全部原始数据, 不带 id/ 不带 origin
  18562. */
  18563. getDataRowsOnlyData: function () {
  18564. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18565. delete r.id;
  18566. delete r._origin;
  18567. return r;
  18568. });
  18569. },
  18570. rowMoveUp: function () {
  18571. var grid = this;
  18572. if (!grid.selection) {
  18573. msg('无法对多行进行移动');
  18574. return;
  18575. }
  18576. var record = grid.selection;
  18577. if (_$2.isArray(record)) {
  18578. record = record[0];
  18579. }
  18580. if (!record) {
  18581. msg('无法对多行进行移动');
  18582. return;
  18583. }
  18584. // const records = grid.selModel.getSelection()
  18585. // if (records.length !== 1) {
  18586. // msg('无法对多行进行移动')
  18587. // return
  18588. // }
  18589. //
  18590. // const [record] = records
  18591. var index = grid.store.indexOf(record);
  18592. if (index > 0) {
  18593. grid.store.removeAt(index);
  18594. grid.store.insert(index - 1, record);
  18595. grid.getView().refresh();
  18596. grid.selModel.select([record]);
  18597. }
  18598. },
  18599. rowMoveDown: function () {
  18600. var grid = this;
  18601. // const records = grid.selModel.getSelection()
  18602. // if (records.length !== 1) {
  18603. // msg('无法对多行进行移动')
  18604. // return
  18605. // }
  18606. if (!grid.selection) {
  18607. msg('无法对多行进行移动');
  18608. return;
  18609. }
  18610. var record = grid.selection;
  18611. if (_$2.isArray(record)) {
  18612. record = record[0];
  18613. }
  18614. if (!record) {
  18615. msg('无法对多行进行移动');
  18616. return;
  18617. }
  18618. var index = grid.store.indexOf(record);
  18619. if (index < grid.store.getCount() - 1) {
  18620. grid.store.removeAt(index);
  18621. grid.store.insert(index + 1, record);
  18622. grid.getView().refresh();
  18623. grid.selModel.select([record]);
  18624. }
  18625. },
  18626. getEditRecord: function () {
  18627. var _a, _b;
  18628. var me = this;
  18629. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18630. 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;
  18631. var record;
  18632. if (typeof rowIdx === 'undefined') {
  18633. record = me.getSelectionModel().getLastSelected();
  18634. }
  18635. else {
  18636. record = me.store.getAt(rowIdx);
  18637. }
  18638. return record;
  18639. },
  18640. getEditRow: function () {
  18641. var _a;
  18642. var me = this;
  18643. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18644. },
  18645. setEditRow: function (rowValues) {
  18646. var me = this;
  18647. var record = me.getEditRecord();
  18648. if (record) {
  18649. _$2.forOwn(rowValues, function (v, k) {
  18650. record.set(k, v);
  18651. });
  18652. }
  18653. },
  18654. _transform: function (data) {
  18655. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18656. _$2.forEach(data, function (row) {
  18657. row._origin = _$2.clone(row);
  18658. });
  18659. },
  18660. _setDataReal: function (value) {
  18661. var me = this;
  18662. this._transform(value);
  18663. var storeOpt = {
  18664. fields: getFileds(this),
  18665. data: value,
  18666. };
  18667. if (this.groupField) {
  18668. storeOpt.groupField = this.groupField;
  18669. }
  18670. var store = new Ext.data.Store(storeOpt);
  18671. me.setStore(store);
  18672. },
  18673. setStore: function (store) {
  18674. var me = this;
  18675. if (_$2.isArray(store)) {
  18676. var value = store;
  18677. this._transform(value);
  18678. var storeOpt = {
  18679. fields: getFileds(this),
  18680. data: value,
  18681. };
  18682. if (this.groupField) {
  18683. storeOpt.groupField = this.groupField;
  18684. }
  18685. store = new Ext.data.Store(storeOpt);
  18686. }
  18687. me.superclass.setStore.call(this, store);
  18688. var reference = this.reference;
  18689. if (reference) {
  18690. var scope = lookupScope(this);
  18691. scope.viewModel.set(reference + '.ischanged', false);
  18692. scope.viewModel.set(reference + '.theid', null);
  18693. scope.viewModel.set(reference + '.theid2', null);
  18694. scope.viewModel.set(reference + '.theid3', null);
  18695. }
  18696. if (store) {
  18697. store.on({
  18698. add: function (store, records, index, eOpts) {
  18699. me._raiseChange(store, 'add');
  18700. },
  18701. remove: function (store, records, index, isMove, eOpts) {
  18702. me._raiseChange(store, 'remove');
  18703. },
  18704. datachanged: function (sender, opt) {
  18705. me._raiseChange(store, 'datachanged');
  18706. }
  18707. });
  18708. }
  18709. },
  18710. _raiseChange: function (store, type) {
  18711. var _a, _b;
  18712. var reference = this.reference;
  18713. if (reference && store) {
  18714. var ischanged = false;
  18715. if (store.getModifiedRecords().length > 0 ||
  18716. store.getNewRecords().length > 0 ||
  18717. store.getRemovedRecords().length > 0) {
  18718. ischanged = true;
  18719. }
  18720. else {
  18721. ischanged = false;
  18722. }
  18723. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18724. }
  18725. },
  18726. /**
  18727. * 轻量级刷新
  18728. */
  18729. refreshData: function () {
  18730. var store = this.getStore();
  18731. if (store) {
  18732. store.reload();
  18733. }
  18734. },
  18735. /**
  18736. * 为表格强制设置焦点
  18737. * @param seq 顺序号
  18738. */
  18739. focusRow: function (seq) {
  18740. this.setSelection(this.store.getAt(seq));
  18741. this.getView().focusRow(seq);
  18742. },
  18743. /**
  18744. * 重新载入数据(重新计算参数)
  18745. */
  18746. reload: function (reloadParams) {
  18747. if (reloadParams === void 0) { reloadParams = {}; }
  18748. var me = this;
  18749. var config = me.config;
  18750. if (config.dataSourceCallbackFn) {
  18751. // 函数请求刷新
  18752. var scope_1 = lookupScope(this);
  18753. _$2.defer(function () {
  18754. me.setLoading(true);
  18755. });
  18756. config.dataSourceCallbackFn.call(scope_1, me, {
  18757. successCallback: function (value) {
  18758. me._setDataReal(value);
  18759. _$2.defer(function () {
  18760. me.setLoading(false);
  18761. });
  18762. // 自动选中第一行
  18763. var data = me.getStore().data;
  18764. if (data.length > 0) {
  18765. me.setSelection(data.items[0]);
  18766. }
  18767. me.fireEvent('dataLoadComplete', me, true, value);
  18768. },
  18769. failCallback: function (error) {
  18770. _$2.defer(function () {
  18771. me.setLoading(false);
  18772. });
  18773. me.fireEvent('dataLoadComplete', me, false, error);
  18774. }
  18775. });
  18776. return;
  18777. }
  18778. // if (this.store) {
  18779. // this.store.reload({aaaa: 1, bbbb: 2})
  18780. // }
  18781. var dataSource = config.dataSource;
  18782. var scope = lookupScope(me);
  18783. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18784. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18785. }
  18786. },
  18787. exportCurrentExcelClick: function () {
  18788. var _a;
  18789. var me = this;
  18790. var config = me.config;
  18791. var scope = lookupScope(me);
  18792. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18793. if (excelFileName.endsWith(".xlsx")) {
  18794. excelFileName = excelFileName.split(".xlsx")[0];
  18795. }
  18796. excelFileName += ".xlsx";
  18797. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18798. var excelData = me.makeExcelData(rowsAll);
  18799. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18800. },
  18801. exportExcelClick: function (excelExportParams) {
  18802. var me = this;
  18803. var config = me.config;
  18804. excelExportParams.isExcelExport = true;
  18805. var scope = lookupScope(me);
  18806. var dataSource = config.dataSource;
  18807. scope.setLoading(true);
  18808. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18809. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18810. var _a, _b, _c, _d;
  18811. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18812. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18813. 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;
  18814. me.exportExcelCurrentPage = page;
  18815. me.exportExcelPageSize = size;
  18816. me.exportExcelTotal = total;
  18817. if (excelFileName.endsWith(".xlsx")) {
  18818. excelFileName = excelFileName.split(".xlsx")[0];
  18819. }
  18820. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18821. excelFileName += ".xlsx";
  18822. var excelData = me.makeExcelData(responseData.data);
  18823. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18824. if (page < total / size) {
  18825. page++;
  18826. me.exportExcelCurrentPage = page;
  18827. }
  18828. scope.setLoading(false);
  18829. });
  18830. },
  18831. exportBigExcelClick: function () {
  18832. var _a;
  18833. var me = this;
  18834. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18835. showErrorDialog('当前表格不支持大批量导出');
  18836. return;
  18837. }
  18838. var config = me.config;
  18839. var scope = lookupScope(me);
  18840. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18841. var head = [];
  18842. var dict = {};
  18843. _$2.forEach(me.columns, function (column) {
  18844. if (column.isHidden())
  18845. return;
  18846. if (!column.dataIndex)
  18847. return;
  18848. if (!column.text)
  18849. return;
  18850. head.push({ field: column.dataIndex, name: column.text });
  18851. if (column.dictForExcel) {
  18852. dict[column.dataIndex] = column.dictForExcel;
  18853. }
  18854. });
  18855. // 判断是否需要解密
  18856. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18857. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18858. me.dbInfo.password = hexToString(me.dbInfo.password);
  18859. me.dbInfo.username = hexToString(me.dbInfo.username);
  18860. }
  18861. scope.setLoading(true);
  18862. Ext.Ajax.request({
  18863. timeout: 15000,
  18864. url: window["EXPORT_DATA_HOST"],
  18865. method: "POST",
  18866. jsonData: {
  18867. file: excelFileName,
  18868. dbInfo: me.dbInfo,
  18869. exportDataSql: me.exportDataSql,
  18870. exportDataSqlParams: me.exportDataSqlParams,
  18871. head: head,
  18872. dict: dict,
  18873. },
  18874. }).then(function () {
  18875. scope.setLoading(false);
  18876. msg('请求成功');
  18877. }).catch(function () {
  18878. scope.setLoading(false);
  18879. showErrorDialog('请求失败,请确认是否已安装客户端');
  18880. });
  18881. },
  18882. makeExcelData: function (jsonData) {
  18883. var me = this;
  18884. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18885. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18886. return;
  18887. }
  18888. var data = [];
  18889. // 获取表格的列定义
  18890. var headerTextArr = [];
  18891. var headers = [];
  18892. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18893. var header = me.headerCt.getGridColumns()[i];
  18894. if (!header.isHidden()) {
  18895. var textStr = _$2.trim(header.text);
  18896. var dataIndexStr = _$2.trim(header.dataIndex);
  18897. if (dataIndexStr) {
  18898. if (textStr === '') {
  18899. headerTextArr.push(dataIndexStr);
  18900. }
  18901. else {
  18902. headerTextArr.push(textStr);
  18903. }
  18904. headers.push(header);
  18905. }
  18906. }
  18907. }
  18908. if (headers.length === 0) {
  18909. return;
  18910. }
  18911. data.push(headerTextArr);
  18912. for (var i = 0; i < jsonData.length; i++) {
  18913. var dataRow = jsonData[i];
  18914. var row = [];
  18915. for (var j = 0; j < headers.length; j++) {
  18916. var key = headers[j].dataIndex;
  18917. var value = dataRow[key];
  18918. if (!value && value !== 0) {
  18919. value = '';
  18920. }
  18921. var oValue = value;
  18922. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18923. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18924. try {
  18925. value = headers[j].renderer(value);
  18926. if (!value && value !== 0) {
  18927. value = oValue;
  18928. }
  18929. }
  18930. catch (e) {
  18931. value = oValue;
  18932. }
  18933. }
  18934. row.push(value);
  18935. }
  18936. data.push(row);
  18937. }
  18938. return data;
  18939. },
  18940. initComponent: function () {
  18941. var _this = this;
  18942. var _a;
  18943. var me = this;
  18944. var config = me.config;
  18945. var scope = lookupScope(this);
  18946. if (isDesignMode(scope, config)) {
  18947. this.superclass.initComponent.call(this);
  18948. return;
  18949. }
  18950. // 转换 dataSource 属性
  18951. convertDataSource$1(me, scope, config);
  18952. this.on({
  18953. afterrender: function (sender) {
  18954. var me = this;
  18955. var config = this.config;
  18956. var dataSource = config.dataSource;
  18957. if (config.autoLoad) {
  18958. if (config.dataSourceCallbackFn) {
  18959. me.reload();
  18960. }
  18961. else if (_$2.isPlainObject(dataSource)) {
  18962. me.reload();
  18963. }
  18964. }
  18965. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18966. var vm = this.lookupViewModel();
  18967. this.contextMenu = this.add(new Ext.menu.Menu({
  18968. viewModel: vm,
  18969. items: _$2.map(config.tbar, function (item) {
  18970. var menuItem = __assign({}, item);
  18971. if (menuItem.xtype === 'button') {
  18972. delete menuItem.xtype;
  18973. }
  18974. return menuItem;
  18975. })
  18976. }));
  18977. }
  18978. else if (_$2.isPlainObject(config.contextMenu)) {
  18979. this.contextMenu = this.add(config.contextMenu);
  18980. }
  18981. var $dom = $(sender.el.dom);
  18982. $dom.on('keydown', function (e) {
  18983. me.fireEvent('keydown', me, e);
  18984. }).on('keyup', function (e) {
  18985. me.fireEvent('keyup', me, e);
  18986. });
  18987. // 默认显示提示
  18988. if (this.cellTip) {
  18989. this.tip = Ext.create('Ext.tip.ToolTip', {
  18990. target: this.el,
  18991. delegate: '.x-grid-cell-inner',
  18992. trackMouse: true,
  18993. ancor: 'top',
  18994. style: 'background-color: #0D6EFD;',
  18995. listeners: {
  18996. beforeshow: function (tip) {
  18997. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18998. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18999. return false;
  19000. }
  19001. tip.update(tipText);
  19002. }
  19003. }
  19004. });
  19005. }
  19006. },
  19007. itemcontextmenu: function (view, rec, node, index, e) {
  19008. if (this.contextMenu) {
  19009. e.stopEvent();
  19010. this.contextMenu.show().setLocalXY(e.getXY());
  19011. return false;
  19012. }
  19013. },
  19014. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  19015. // this.setColumnConfigCache()
  19016. // },
  19017. // columnhide(sender, column, eOpts) {
  19018. // this.setColumnConfigCache()
  19019. // },
  19020. // columnshow(sender, column, eOpts) {
  19021. // this.setColumnConfigCache()
  19022. // },
  19023. // columnresize(sender, column, width, eOpts) {
  19024. // this.setColumnConfigCache()
  19025. // },
  19026. destory: function () {
  19027. },
  19028. selectionchange: function (sender, param) {
  19029. var record = undefined;
  19030. if (_$2.isArray(param)) {
  19031. record = param[0];
  19032. }
  19033. else if (_$2.isObject(param)) {
  19034. record = _$2.get(param, 'endCell.record');
  19035. }
  19036. itemselectFun(this, sender, record);
  19037. },
  19038. itemclick: function (sender, record) {
  19039. itemselectFun(this, sender, record);
  19040. },
  19041. show: function (sender) {
  19042. if (sender.__suspendReload) {
  19043. sender.__suspendReload = false;
  19044. sender.reload();
  19045. }
  19046. }
  19047. });
  19048. _$2.defer(function () {
  19049. var ce = _this.findPlugin('cellediting');
  19050. ce.on({
  19051. beforeedit: function (editor, context, eOpts) {
  19052. me.fireEvent('editbefore', me, editor, context, eOpts);
  19053. },
  19054. canceledit: function (editor, context, eOpts) {
  19055. me.fireEvent('editcancel', me, editor, context, eOpts);
  19056. },
  19057. edit: function (editor, context, eOpts) {
  19058. me.fireEvent('editfinish', me, editor, context, eOpts);
  19059. },
  19060. validateedit: function (editor, context, eOpts) {
  19061. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19062. },
  19063. });
  19064. });
  19065. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19066. var reference = me.reference;
  19067. var scope = lookupScope(me);
  19068. var theid = _$2.get(config, 'behavior.theid');
  19069. if (theid && reference) {
  19070. if (!record) {
  19071. scope.viewModel.set(reference + '.theid', null);
  19072. }
  19073. else {
  19074. scope.viewModel.set(reference + '.theid', record.get(theid));
  19075. }
  19076. }
  19077. var theid2 = _$2.get(config, 'behavior.theid2');
  19078. if (theid2 && reference) {
  19079. if (!record) {
  19080. scope.viewModel.set(reference + '.theid2', null);
  19081. }
  19082. else {
  19083. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19084. }
  19085. }
  19086. var theid3 = _$2.get(config, 'behavior.theid3');
  19087. if (theid3 && reference) {
  19088. if (!record) {
  19089. scope.viewModel.set(reference + '.theid3', null);
  19090. }
  19091. else {
  19092. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19093. }
  19094. }
  19095. me.fireEvent('itemselect', sender, record);
  19096. }, 50);
  19097. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19098. // 为 stores.proxy.buildRequest 做准备
  19099. this.store.proxy.$owner = this;
  19100. }
  19101. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19102. if (selectToReload) {
  19103. // 点击后触发某个目标表格刷新
  19104. this.on({
  19105. itemselect: function (sender) {
  19106. if (_$2.isArray(selectToReload)) {
  19107. _$2.forEach(selectToReload, function (ref) {
  19108. if (ref) {
  19109. var ctlTarget = scope.refs[ref];
  19110. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19111. if (ctlTarget.isVisible()) {
  19112. ctlTarget.reload();
  19113. }
  19114. else {
  19115. ctlTarget.__suspendReload = true;
  19116. }
  19117. }
  19118. }
  19119. });
  19120. }
  19121. else if (_$2.isString(selectToReload)) {
  19122. var ctlTarget = scope.refs[selectToReload];
  19123. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19124. ctlTarget.reload();
  19125. }
  19126. }
  19127. }
  19128. });
  19129. }
  19130. this.superclass.initComponent.call(this);
  19131. },
  19132. // 生成列自定义的缓存key
  19133. makeColumnConfigCacheKey: function (config) {
  19134. var _a, _b, _c, _d, _e, _f;
  19135. 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);
  19136. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19137. if (config.reference) {
  19138. key += config.reference;
  19139. }
  19140. else {
  19141. var subKey = "";
  19142. for (var i = 0; i < config.columns.length; i++) {
  19143. var column = config.columns[i];
  19144. if (column.dataIndex) {
  19145. subKey += column.dataIndex;
  19146. }
  19147. }
  19148. key += subKey;
  19149. }
  19150. return key;
  19151. },
  19152. getColumnConfigCache: function () {
  19153. var key = this.columnConfigCacheKey;
  19154. var dataStr = localStorage.getItem(key);
  19155. if (dataStr) {
  19156. return JSON.parse(dataStr);
  19157. }
  19158. return "";
  19159. },
  19160. setColumnConfigCache: function () {
  19161. var key = this.columnConfigCacheKey;
  19162. var cacheData = [];
  19163. var columns = this.headerCt.getGridColumns();
  19164. var index = 0;
  19165. for (var i = 0; i < columns.length; i++) {
  19166. var column = columns[i];
  19167. if (column.dataIndex) {
  19168. cacheData.push({
  19169. dataIndex: column.dataIndex,
  19170. width: column.width,
  19171. hidden: column.hidden,
  19172. locked: column.locked,
  19173. index: index
  19174. });
  19175. index++;
  19176. }
  19177. }
  19178. localStorage.setItem(key, JSON.stringify(cacheData));
  19179. },
  19180. autoSizeColumns: function (sender) {
  19181. var grid = sender ? sender.up('grid') : this;
  19182. // const columns = grid.columns;
  19183. // for (let i = 0; i < columns.length; i++) {
  19184. // const column = columns[i];
  19185. // grid.getView().autoSizeColumn(column);
  19186. // column.setWidth(column.getWidth() + 5);
  19187. // }
  19188. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19189. grid.headerCt.getGridColumns()[i].autoSize(i);
  19190. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19191. }
  19192. },
  19193. clearFilter: function (sender) {
  19194. var grid = sender.up('grid');
  19195. grid.filters.clearFilters();
  19196. grid.getStore().sorters.removeAll();
  19197. // grid.getStore().reload()
  19198. },
  19199. saveGridUIConfig: function (sender) {
  19200. var grid = sender.up('grid');
  19201. grid.setColumnConfigCache();
  19202. msg('保存设置成功!');
  19203. },
  19204. clearGridUIConfig: function (sender) {
  19205. var grid = sender.up('grid');
  19206. var key = grid.columnConfigCacheKey;
  19207. localStorage.setItem(key, "");
  19208. msg('清空设置成功,重新打开后生效!');
  19209. },
  19210. setLoading: function (value) {
  19211. if (value) {
  19212. this.mask('读取中');
  19213. }
  19214. else {
  19215. this.unmask();
  19216. }
  19217. },
  19218. exportExcel: function (sender) {
  19219. var rect = sender.btnEl.dom.getBoundingClientRect();
  19220. var scope = lookupScope(this);
  19221. var grid = sender.up('grid');
  19222. var menuItems = [];
  19223. if (grid.dataSource.method === 'invoke' || grid.dataSource.sqlId) {
  19224. menuItems.push({
  19225. text: '大批量导出 (需要客户端支持!)',
  19226. iconCls: 'x-fa fa-download',
  19227. listeners: {
  19228. click: function (sender, value) {
  19229. // @ts-ignore
  19230. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19231. .then(function (res) {
  19232. grid.exportBigExcelClick();
  19233. });
  19234. }
  19235. }
  19236. });
  19237. menuItems.push('-');
  19238. }
  19239. menuItems.push({
  19240. text: '导出当前数据',
  19241. iconCls: 'x-fa fa-download',
  19242. listeners: {
  19243. click: function (sender, value) {
  19244. grid.exportCurrentExcelClick();
  19245. }
  19246. }
  19247. }, {
  19248. xtype: "textfield",
  19249. fieldLabel: '当前导出页',
  19250. maskRe: /[0-9]/,
  19251. value: grid.exportExcelCurrentPage,
  19252. listeners: {
  19253. render: function (sender) {
  19254. grid.exportExcelCurrentPageCmp = sender;
  19255. },
  19256. change: function (sender, value) {
  19257. var v = parseInt(value);
  19258. if (isNaN(v) || v === 0) {
  19259. window['system'].msg("页码不能为0");
  19260. v = 1;
  19261. sender.setValue(v);
  19262. }
  19263. var size = parseInt(grid.exportExcelPageSize);
  19264. var total = parseInt(grid.exportExcelTotal);
  19265. if (v > total / size) {
  19266. v = parseInt(total / size + "");
  19267. }
  19268. grid.exportExcelCurrentPage = v + "";
  19269. }
  19270. }
  19271. }, {
  19272. xtype: "textfield",
  19273. fieldLabel: '导出页大小',
  19274. maskRe: /[0-9]/,
  19275. value: grid.exportExcelPageSize,
  19276. listeners: {
  19277. render: function (sender) {
  19278. grid.exportExcelPageSizeCmp = sender;
  19279. },
  19280. change: function (sender, value) {
  19281. var v = parseInt(value);
  19282. if (isNaN(v) || v === 0) {
  19283. window['system'].msg("导出页大小不能为0");
  19284. v = defaultGrid.exportExcelPageSize;
  19285. sender.setValue(v);
  19286. }
  19287. if (v > 10000) {
  19288. window['system'].msg("导出页大小不能大于10000");
  19289. v = 10000;
  19290. sender.setValue(v);
  19291. }
  19292. var page = parseInt(grid.exportExcelCurrentPage);
  19293. var total = parseInt(grid.exportExcelTotal);
  19294. if (page > total / v) {
  19295. page = parseInt(total / v + "") + 1;
  19296. grid.exportExcelCurrentPageCmp.setValue(page);
  19297. }
  19298. grid.exportExcelPageSize = v + "";
  19299. }
  19300. }
  19301. }, {
  19302. xtype: "textfield",
  19303. fieldLabel: '总条数',
  19304. value: grid.exportExcelTotal,
  19305. readOnly: true
  19306. }, {
  19307. text: '导出',
  19308. iconCls: 'x-fa fa-download',
  19309. listeners: {
  19310. click: function (sender, value) {
  19311. grid.exportExcelClick({
  19312. exportExcelPageSize: grid.exportExcelPageSize,
  19313. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19314. });
  19315. }
  19316. }
  19317. });
  19318. var treeMenu = new Ext.menu.Menu({
  19319. xtype: 'menu',
  19320. floated: false,
  19321. width: 300,
  19322. docked: 'left',
  19323. items: menuItems
  19324. });
  19325. treeMenu.showAt(rect.left, rect.top - 120);
  19326. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19327. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19328. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19329. // }
  19330. },
  19331. /**
  19332. * 获取表格编辑的行数据
  19333. */
  19334. getGridEditRows: function () {
  19335. var grid = this;
  19336. var store = grid.getStore();
  19337. var rows = [];
  19338. var modifyRows = [];
  19339. var newRows = [];
  19340. var err = "";
  19341. var records = store.getModifiedRecords();
  19342. var newRecords = store.getNewRecords();
  19343. var removeRecords = [];
  19344. _$2.forEach(store.getRemovedRecords(), function (row) {
  19345. removeRecords.push(row.data);
  19346. });
  19347. _$2.forEach(records, function (record) {
  19348. var colums = grid.columns;
  19349. var errFunc = undefined;
  19350. _$2.forEach(colums, function (col) {
  19351. var name = col.dataIndex;
  19352. var value = record.data[name];
  19353. var colIndex = col.getIndex(); //获得列号
  19354. var rowIndex = store.indexOfId(record.id); //获得行号
  19355. var editor = col.getEditor(); //使用的编辑器
  19356. var tmpErrFunc = function () {
  19357. var text = col.text || col.name;
  19358. msg(text + ' 校验失败, 请确保输入的数据正确');
  19359. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19360. };
  19361. if (editor && !editor.allowBlank && isEmpty(value)) {
  19362. errFunc = tmpErrFunc;
  19363. return false;
  19364. }
  19365. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19366. errFunc = tmpErrFunc;
  19367. return false;
  19368. }
  19369. });
  19370. if (typeof errFunc === 'function') {
  19371. err = "1";
  19372. _$2.remove(rows, function (n) {
  19373. return true;
  19374. });
  19375. //@ts-ignore
  19376. errFunc();
  19377. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19378. return false;
  19379. }
  19380. else {
  19381. if (_$2.findIndex(newRecords, function (item) {
  19382. return item === record;
  19383. }) >= 0) {
  19384. newRows.push(record.data);
  19385. }
  19386. else {
  19387. modifyRows.push(record.data);
  19388. }
  19389. rows.push(record.data);
  19390. }
  19391. });
  19392. return {
  19393. rows: rows,
  19394. newRows: newRows,
  19395. modifyRows: modifyRows,
  19396. removeRecords: removeRecords,
  19397. err: err
  19398. };
  19399. }
  19400. // reload() {
  19401. // dataSourceReload(this)
  19402. // },
  19403. });
  19404. }
  19405. /**
  19406. * 获取 columns 中所有的 dataIndex
  19407. */
  19408. function getFileds(newConfig) {
  19409. var fields = [];
  19410. _$2.forEach(newConfig.columns, function (c) {
  19411. if (c.dataIndex) {
  19412. fields.push(c.dataIndex);
  19413. }
  19414. });
  19415. return fields;
  19416. }
  19417. function convertDataSource$1(sender, scope, newConfig) {
  19418. if (typeof newConfig.store !== 'undefined') {
  19419. // 有 store 属性的情况下,不做任何事
  19420. return;
  19421. }
  19422. if (typeof newConfig.dataSource === 'undefined') {
  19423. // 没有定义 dataSource 的情况下,不做任何事
  19424. return;
  19425. }
  19426. if (_$2.isArray(newConfig.data)) {
  19427. // 有 data 属性赋值的情况下
  19428. newConfig.store = {
  19429. fields: getFileds(newConfig),
  19430. data: newConfig.data
  19431. };
  19432. delete newConfig.data;
  19433. return;
  19434. }
  19435. var dataSource = newConfig.dataSource;
  19436. if (typeof dataSource === 'string') {
  19437. // dataSource 是字符串的情况下,找到成员函数
  19438. dataSource = lookupFn(scope, dataSource);
  19439. }
  19440. if (typeof dataSource === 'function') {
  19441. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19442. newConfig.store = new Ext.data.Store({
  19443. fields: getFileds(newConfig),
  19444. // data: [],
  19445. autoLoad: true,
  19446. proxy: {
  19447. type: 'memory',
  19448. data: [],
  19449. }
  19450. });
  19451. newConfig.dataSourceCallbackFn = dataSource;
  19452. return;
  19453. }
  19454. // throw new TypeError('无法识别的调用方法')
  19455. }
  19456. //# sourceMappingURL=grid.js.map
  19457. function initTextfield () {
  19458. var cc = Ext.form.field.Text.prototype.constructor;
  19459. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19460. Ext.form.field.Text.override({
  19461. constructor: function (config) {
  19462. var newConfig = _$2.defaultsDeep({
  19463. // 强制属性
  19464. triggers: {
  19465. clear: {
  19466. weight: -1,
  19467. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19468. hidden: true,
  19469. handler: 'onClearClick',
  19470. },
  19471. }
  19472. }, baseConfig(config, 'col-item'), config, text);
  19473. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19474. newConfig.enableKeyEvents = true;
  19475. }
  19476. cc.call(this, newConfig);
  19477. },
  19478. /**
  19479. * 清空所有值
  19480. */
  19481. onClearClick: function (sender, e) {
  19482. var me = this;
  19483. me.setValue('');
  19484. },
  19485. /**
  19486. * 尝试获取下一个要获取焦点的控件
  19487. */
  19488. _raiseNextFocus: function (sender) {
  19489. var config = sender.config;
  19490. var scope = lookupScope(sender);
  19491. if (typeof config.nextFocus === 'function') {
  19492. config.nextFocus(sender);
  19493. }
  19494. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19495. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19496. var fn = lookupFn(scope, config.nextFocus);
  19497. if (typeof fn === 'function') {
  19498. var nextCtlReference = fn(sender);
  19499. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19500. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19501. if (ctl) {
  19502. if (typeof ctl.focus2 === 'function') {
  19503. ctl.focus2();
  19504. }
  19505. else {
  19506. ctl.focus();
  19507. }
  19508. }
  19509. }
  19510. }
  19511. }
  19512. else {
  19513. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19514. if (ctl) {
  19515. if (typeof ctl.focus2 === 'function') {
  19516. ctl.focus2();
  19517. }
  19518. else {
  19519. ctl.focus();
  19520. }
  19521. }
  19522. }
  19523. }
  19524. },
  19525. initComponent: function () {
  19526. /**
  19527. * 改变必填项之前加星号
  19528. */
  19529. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19530. // this.beforeLabelTextTpl = [
  19531. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19532. // ];
  19533. this.afterLabelTextTpl = [
  19534. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19535. ];
  19536. }
  19537. var me = this;
  19538. this.on({
  19539. change: function (sender, newVal) {
  19540. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19541. if (hideTrigger || disabled || readOnly || hideClear) {
  19542. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19543. return;
  19544. }
  19545. var value = newVal;
  19546. if (value) {
  19547. me.getTrigger('clear').show();
  19548. me.updateLayout();
  19549. }
  19550. else {
  19551. me.getTrigger('clear').hide();
  19552. me.updateLayout();
  19553. }
  19554. },
  19555. afterrender: function (sender) {
  19556. var _this = this;
  19557. var _a;
  19558. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19559. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19560. $$2(sender.inputEl.dom).on('click', function (e) {
  19561. sender.fireEvent('click', _this, e);
  19562. });
  19563. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19564. var _a, _b, _c, _d;
  19565. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19566. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19567. if (sender.isExpanded === true) {
  19568. // 弹开下拉框的基础上,不干预上下选择
  19569. return;
  19570. }
  19571. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19572. var grid = sender.ownerCt.up('grid');
  19573. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19574. if (editingPlugin) {
  19575. 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;
  19576. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19577. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19578. // editingPlugin
  19579. var targetRecord = void 0;
  19580. if (e.code === 'ArrowDown') {
  19581. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19582. }
  19583. else {
  19584. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19585. }
  19586. if (targetRecord) {
  19587. grid.setSelection([targetRecord]);
  19588. editingPlugin.startEdit(targetRecord, column);
  19589. }
  19590. e.stopPropagation();
  19591. e.preventDefault();
  19592. }
  19593. }
  19594. }
  19595. }
  19596. });
  19597. }
  19598. var config = sender.config;
  19599. if (config.ff && config.ff > 0) {
  19600. setTimeout(function () {
  19601. if (typeof sender.focus2 === 'function') {
  19602. sender.focus2();
  19603. }
  19604. else {
  19605. sender.focus();
  19606. }
  19607. }, config.ff);
  19608. }
  19609. }
  19610. });
  19611. var config = this.config;
  19612. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19613. this.on({
  19614. keyup: function (sender, e) {
  19615. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19616. sender._raiseNextFocus(sender);
  19617. }
  19618. }
  19619. });
  19620. }
  19621. var that = this;
  19622. this.on({
  19623. keyup: function (sender, e, eOpts) {
  19624. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19625. return;
  19626. }
  19627. that.keydown_fun_item(sender, e, eOpts);
  19628. }
  19629. });
  19630. initComponent.call(this);
  19631. },
  19632. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19633. var that = sender;
  19634. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19635. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19636. var value = _$2.trim(sender.rawValue);
  19637. var r = that.fireEvent('scancode', that, value, event);
  19638. if (r === 'OK') {
  19639. // 停止事件的默认处理程序,停止事件的冒泡
  19640. // event.stopEvent();
  19641. event.preventDefault();
  19642. event.stopPropagation();
  19643. }
  19644. }
  19645. }, 100)
  19646. });
  19647. }
  19648. //# sourceMappingURL=textfield.js.map
  19649. function initTbFill () {
  19650. /**
  19651. *
  19652. */
  19653. var ct = Ext.toolbar.Fill.prototype.constructor;
  19654. Ext.toolbar.Fill.override({
  19655. constructor: function (config) {
  19656. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19657. ct.call(this, newConfig);
  19658. }
  19659. });
  19660. }
  19661. //# sourceMappingURL=tbfill.js.map
  19662. function initTbSeparator () {
  19663. /**
  19664. *
  19665. */
  19666. var ct = Ext.toolbar.Separator.prototype.constructor;
  19667. Ext.toolbar.Separator.override({
  19668. constructor: function (config) {
  19669. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19670. ct.call(this, newConfig);
  19671. }
  19672. });
  19673. }
  19674. //# sourceMappingURL=tbseparator.js.map
  19675. function initToolbar () {
  19676. /**
  19677. *
  19678. */
  19679. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19680. Ext.toolbar.Toolbar.override({
  19681. constructor: function (config) {
  19682. var newConfig = _$2.defaultsDeep({
  19683. // 强制性属性
  19684. }, baseConfig(config, 'cols-container'), config, toolbar);
  19685. ct.call(this, newConfig);
  19686. }
  19687. });
  19688. initTbFill();
  19689. initTbSeparator();
  19690. }
  19691. //# sourceMappingURL=toolbar.js.map
  19692. function initSplitter () {
  19693. var ct = Ext.resizer.Splitter.prototype.constructor;
  19694. Ext.resizer.Splitter.override({
  19695. constructor: function (config) {
  19696. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19697. ct.call(this, newConfig);
  19698. }
  19699. });
  19700. }
  19701. //# sourceMappingURL=splitter.js.map
  19702. /**
  19703. * 通用 dataSource 解析,
  19704. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19705. */
  19706. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19707. var config = ctl.config;
  19708. return new Promise(function (resolve, reject) {
  19709. if (!config.dataSource) {
  19710. // 没有设置数据源,直接置空
  19711. return Promise.resolve();
  19712. }
  19713. var option = {
  19714. extraParam: extraParam,
  19715. _successCb: _successCb,
  19716. successCallback: function (value) {
  19717. if (typeof successCallback === "function") {
  19718. successCallback(value);
  19719. }
  19720. else {
  19721. ctl.setData(value);
  19722. }
  19723. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19724. ctl.setLoading(false);
  19725. resolve(value);
  19726. },
  19727. failCallback: function (error) {
  19728. if (typeof failCallback === "function") {
  19729. failCallback(error);
  19730. }
  19731. ctl.fireEvent('dataLoadComplete', ctl, false);
  19732. ctl.setLoading(false);
  19733. reject(error);
  19734. }
  19735. };
  19736. // 请求前要求确认一下
  19737. var isCanceled = false;
  19738. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19739. isCanceled = true;
  19740. } }, option));
  19741. if (!isCanceled) {
  19742. // 请求没有被取消
  19743. // 调用异步接口返回 Promise
  19744. return _innerReload(ctl, option);
  19745. }
  19746. return reject();
  19747. });
  19748. }
  19749. function _innerReload(ctl, option) {
  19750. var config = ctl.config;
  19751. ctl.setLoading(true);
  19752. var scope = lookupScope(ctl);
  19753. var dataSource = config.dataSource;
  19754. if (typeof dataSource == 'string') {
  19755. dataSource = lookupFn(scope, config.dataSource);
  19756. }
  19757. if (typeof dataSource === 'function') {
  19758. // @ts-ignore
  19759. dataSource.call(scope, ctl, option);
  19760. return;
  19761. }
  19762. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19763. if (!ajax.func) {
  19764. console.error("没有配置 ajax");
  19765. return;
  19766. }
  19767. var params_1 = {};
  19768. var sortModel = null;
  19769. var filterModel = null;
  19770. if (option.extraParam && option.extraParam.filterModel) {
  19771. filterModel = option.extraParam.filterModel;
  19772. }
  19773. if (option.extraParam && option.extraParam.sortModel) {
  19774. sortModel = option.extraParam.sortModel;
  19775. }
  19776. _$2.forOwn(option.extraParam, function (v, key) {
  19777. if (key != "filterModel" && key != "sortModel") {
  19778. if (typeof v === 'function') {
  19779. params_1[key] = v();
  19780. }
  19781. else {
  19782. params_1[key] = v;
  19783. }
  19784. }
  19785. });
  19786. var ds = dataSource;
  19787. _$2.forOwn(ds.params, function (v, key) {
  19788. if (typeof v === 'function') {
  19789. params_1[key] = v();
  19790. }
  19791. else {
  19792. params_1[key] = v;
  19793. }
  19794. });
  19795. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19796. // @ts-ignore
  19797. ajax.func({
  19798. method: dataSource.method,
  19799. url: ds.url,
  19800. data: params_1,
  19801. filterModel: filterModel,
  19802. sortModel: sortModel,
  19803. }).then(function (res) {
  19804. if (res.success) {
  19805. option.successCallback(res.data);
  19806. }
  19807. else {
  19808. option.failCallback(res.msg);
  19809. }
  19810. }).catch(function (e) {
  19811. option.failCallback(e);
  19812. });
  19813. }
  19814. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19815. var ds_1 = ctl.dataSource;
  19816. // @ts-ignore
  19817. Extend.ajax.func({
  19818. url: ds_1.sqlId,
  19819. data: params_1,
  19820. db: ds_1.db,
  19821. method: 'sql',
  19822. filterModel: filterModel,
  19823. sortModel: sortModel,
  19824. }).then(function (res) {
  19825. if (res.success) {
  19826. option.successCallback(res.data);
  19827. }
  19828. else {
  19829. option.failCallback(res.msg);
  19830. }
  19831. }).catch(function (e) {
  19832. option.failCallback(e);
  19833. }).finally(function () {
  19834. ctl.loading = false;
  19835. });
  19836. return;
  19837. }
  19838. else {
  19839. console.error("非法的 dataSource", ctl.dataSource);
  19840. debugger;
  19841. throw new Error("非法的 dataSource");
  19842. }
  19843. }
  19844. }
  19845. //# sourceMappingURL=DataSourceHelper.js.map
  19846. function initCombo () {
  19847. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19848. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19849. Ext.form.field.ComboBox.override({
  19850. constructor: function (config) {
  19851. var newConfig = _$2.defaultsDeep({
  19852. // 强制性属性
  19853. }, baseConfig(config, 'col-item'), config, combo);
  19854. if (typeof config.dict === 'string') {
  19855. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19856. }
  19857. else if (typeof newConfig.store == 'undefined') {
  19858. if (_$2.isArray(newConfig.data)) {
  19859. // ExtJS 无法直接接受数组模式
  19860. newConfig.store = {
  19861. fields: [newConfig.valueField, newConfig.displayField],
  19862. data: newConfig.data
  19863. };
  19864. delete newConfig.data;
  19865. }
  19866. else if (typeof newConfig.data !== 'object') {
  19867. newConfig.store = {
  19868. fields: [newConfig.valueField, newConfig.displayField],
  19869. data: []
  19870. };
  19871. delete newConfig.data;
  19872. }
  19873. }
  19874. cc.call(this, newConfig);
  19875. },
  19876. setDict: function (bizKey) {
  19877. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19878. this.dict = bizKey;
  19879. },
  19880. getDict: function () {
  19881. return this.dict;
  19882. },
  19883. setData: function (value) {
  19884. if (!value) {
  19885. return;
  19886. }
  19887. var config = value.config;
  19888. if (!this.store) {
  19889. this.store = new Ext.data.Store({
  19890. fields: [config.valueField, config.displayField],
  19891. data: value
  19892. });
  19893. }
  19894. else {
  19895. this.store.getProxy().setData(value);
  19896. this.store.load();
  19897. }
  19898. },
  19899. setLoading: function (value) {
  19900. if (value) {
  19901. if (!this.loadMask) {
  19902. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19903. }
  19904. }
  19905. else {
  19906. if (this.loadMask) {
  19907. this.loadMask.destroy();
  19908. delete this.loadMask;
  19909. }
  19910. }
  19911. },
  19912. reload: function () {
  19913. dataSourceReload(this);
  19914. },
  19915. initComponent: function () {
  19916. var that = this;
  19917. var toggle = function (e) {
  19918. var readOnly = that.readOnly, disabled = that.disabled;
  19919. if (readOnly || disabled) {
  19920. return;
  19921. }
  19922. if ($(e.target).is('.x-form-trigger')) {
  19923. return;
  19924. }
  19925. // 点击后下拉
  19926. if (that.isExpanded) {
  19927. that.collapse();
  19928. }
  19929. else {
  19930. that.expand();
  19931. that.doQuery(that.allQuery, true);
  19932. }
  19933. };
  19934. this.on({
  19935. afterrender: function (sender) {
  19936. var config = this.config;
  19937. if (config.dataSource && config.autoLoad) {
  19938. dataSourceReload(this);
  19939. }
  19940. // 点击后下拉
  19941. $(this.el.dom).on('click', toggle.bind(this));
  19942. },
  19943. focusenter: function (sender, event, opt) {
  19944. var _a;
  19945. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19946. // 表格内编辑框,获取焦点后自动弹开
  19947. toggle.call(this, event);
  19948. }
  19949. },
  19950. destory: function () {
  19951. $(this.el.dom).off('click', toggle.bind(this));
  19952. },
  19953. beforequery: function (context) {
  19954. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19955. // console.log('beforequery', query)
  19956. if (!forceAll && query) {
  19957. combo.store.clearFilter();
  19958. combo.store.filterBy(function (record, id) {
  19959. var text = record.get(combo.displayField);
  19960. // 用拼音筛选的方式
  19961. return keywordFilter(query, text, id);
  19962. });
  19963. combo.expand();
  19964. return false;
  19965. }
  19966. combo.store.clearFilter();
  19967. combo.expand();
  19968. return false;
  19969. },
  19970. });
  19971. initComponent.call(this);
  19972. },
  19973. focus2: function () {
  19974. this.focus();
  19975. var that = this;
  19976. _$2.defer(function () {
  19977. if (that.isExpanded) {
  19978. that.collapse();
  19979. }
  19980. else {
  19981. that.expand();
  19982. that.doQuery(that.allQuery, true);
  19983. }
  19984. });
  19985. }
  19986. });
  19987. }
  19988. //# sourceMappingURL=combo.js.map
  19989. /**
  19990. xtype: 'tagfield',
  19991. displayField: 'show',
  19992. valueField: 'id',
  19993. queryMode: 'local',
  19994. filterPickList: true,
  19995. store: {
  19996. fields: ['id', 'show'],
  19997. data: [
  19998. {id: 0, show: 'Battlestar Galactica'},
  19999. {id: 1, show: 'Doctor Who'},
  20000. {id: 2, show: 'Farscape'},
  20001. {id: 3, show: 'Firefly'},
  20002. {id: 4, show: 'Star Trek'},
  20003. {id: 5, show: 'Star Wars: Christmas Special'}
  20004. ]
  20005. }
  20006. */
  20007. function initTag () {
  20008. var cc = Ext.form.field.Tag.prototype.constructor;
  20009. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20010. Ext.form.field.Tag.override({
  20011. constructor: function (config) {
  20012. var newConfig = _$2.defaultsDeep({
  20013. // 强制性属性
  20014. }, baseConfig(config, 'col-item'), config, tagfield);
  20015. if (typeof config.dict === 'string') {
  20016. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20017. }
  20018. else if (typeof newConfig.store == 'undefined') {
  20019. if (_$2.isArray(newConfig.data)) {
  20020. // ExtJS 无法直接接受数组模式
  20021. newConfig.store = {
  20022. fields: [newConfig.valueField, newConfig.displayField],
  20023. data: newConfig.data
  20024. };
  20025. delete newConfig.data;
  20026. }
  20027. else if (typeof newConfig.data !== 'object') {
  20028. newConfig.store = {
  20029. fields: [newConfig.valueField, newConfig.displayField],
  20030. data: []
  20031. };
  20032. delete newConfig.data;
  20033. }
  20034. }
  20035. cc.call(this, newConfig);
  20036. },
  20037. setDict: function (bizKey) {
  20038. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20039. this.dict = bizKey;
  20040. },
  20041. getDict: function () {
  20042. return this.dict;
  20043. },
  20044. setData: function (value) {
  20045. if (!value) {
  20046. return;
  20047. }
  20048. var config = value.config;
  20049. if (!this.store) {
  20050. this.store = new Ext.data.Store({
  20051. fields: [config.valueField, config.displayField],
  20052. data: value
  20053. });
  20054. }
  20055. else {
  20056. this.store.getProxy().setData(value);
  20057. this.store.load();
  20058. }
  20059. },
  20060. setLoading: function (value) {
  20061. if (value) {
  20062. if (!this.loadMask) {
  20063. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20064. }
  20065. }
  20066. else {
  20067. if (this.loadMask) {
  20068. this.loadMask.destroy();
  20069. delete this.loadMask;
  20070. }
  20071. }
  20072. },
  20073. reload: function () {
  20074. dataSourceReload(this);
  20075. },
  20076. initComponent: function () {
  20077. var that = this;
  20078. var toggle = function (e) {
  20079. var readOnly = that.readOnly, disabled = that.disabled;
  20080. if (readOnly || disabled) {
  20081. return;
  20082. }
  20083. if ($(e.target).is('.x-form-trigger')) {
  20084. return;
  20085. }
  20086. // 点击后下拉
  20087. if (that.isExpanded) {
  20088. that.collapse();
  20089. }
  20090. else {
  20091. that.expand();
  20092. that.doQuery(that.allQuery, true);
  20093. }
  20094. };
  20095. this.on({
  20096. afterrender: function (sender) {
  20097. var config = this.config;
  20098. if (config.dataSource && config.autoLoad) {
  20099. dataSourceReload(this);
  20100. }
  20101. // 点击后下拉
  20102. $(this.el.dom).on('click', toggle.bind(this));
  20103. },
  20104. focusenter: function (sender, event, opt) {
  20105. var _a;
  20106. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20107. // 表格内编辑框,获取焦点后自动弹开
  20108. toggle.call(this, event);
  20109. }
  20110. },
  20111. destory: function () {
  20112. $(this.el.dom).off('click', toggle.bind(this));
  20113. },
  20114. });
  20115. initComponent.call(this);
  20116. },
  20117. focus2: function () {
  20118. this.focus();
  20119. var that = this;
  20120. _$2.defer(function () {
  20121. if (that.isExpanded) {
  20122. that.collapse();
  20123. }
  20124. else {
  20125. that.expand();
  20126. that.doQuery(that.allQuery, true);
  20127. }
  20128. });
  20129. }
  20130. });
  20131. }
  20132. //# sourceMappingURL=tagfield.js.map
  20133. function initComboGridMulti () {
  20134. Ext.define('Yvan.LocalComboGrid', {
  20135. extend: 'Ext.form.field.Picker',
  20136. // extend: 'Yvan.PickerAlignCenter',
  20137. xtype: 'combogridmulti',
  20138. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20139. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20140. editable: false,
  20141. initComponent: function () {
  20142. this.on({
  20143. afterrender: function () {
  20144. var config = this.config;
  20145. if (config.dataSource && config.autoLoad) {
  20146. dataSourceReload(this);
  20147. }
  20148. },
  20149. });
  20150. this.superclass.initComponent.apply(this, arguments);
  20151. },
  20152. setStore: function (store) {
  20153. this.store = store;
  20154. var me = this;
  20155. if (me.store) {
  20156. if (me.picker) {
  20157. me.picker.setStore(store);
  20158. if (me.isExpanded) {
  20159. me.collapse();
  20160. delete me.picker;
  20161. me.expand();
  20162. }
  20163. }
  20164. this.onLoad();
  20165. me.mon(me.store, {
  20166. scope: me,
  20167. load: me.onLoad,
  20168. update: me.onUpdate
  20169. });
  20170. }
  20171. },
  20172. reload: function () {
  20173. dataSourceReload(this);
  20174. },
  20175. setData: function (value) {
  20176. var me = this;
  20177. var config = me.config;
  20178. if (!value) {
  20179. return;
  20180. }
  20181. if (!this.store) {
  20182. this.store = new Ext.data.Store({
  20183. fields: [config.valueField, config.displayField],
  20184. data: value
  20185. });
  20186. }
  20187. else {
  20188. this.store.getProxy().setData(value);
  20189. this.store.load();
  20190. }
  20191. this.onLoad();
  20192. },
  20193. createPicker: function () {
  20194. var me = this;
  20195. 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: {
  20196. scope: me,
  20197. selectionchange: me.onSelectionChange,
  20198. itemkeydown: me.onPickerKeyDown
  20199. } })), view = picker.getView();
  20200. if (Ext.isIE9 && Ext.isStrict) {
  20201. view.on({
  20202. scope: me,
  20203. highlightitem: me.repaintPickerView,
  20204. unhighlightitem: me.repaintPickerView,
  20205. afteritemexpand: me.repaintPickerView,
  20206. afteritemcollapse: me.repaintPickerView
  20207. });
  20208. }
  20209. return picker;
  20210. },
  20211. repaintPickerView: function () {
  20212. var style = this.picker.getView().getEl().dom.style;
  20213. style.display = style.display;
  20214. },
  20215. onSelectionChange: function (view, record, node, rowIndex, e) {
  20216. this.selectItem(view, record);
  20217. },
  20218. onPickerKeyDown: function (treeView, record, item, index, e) {
  20219. var key = e.getKey();
  20220. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20221. this.selectItem(treeView, record);
  20222. }
  20223. },
  20224. selectItem: function (sender, record) {
  20225. var me = this;
  20226. var ids = [];
  20227. _$2.forEach(me.picker.getSelection(), function (record) {
  20228. ids.push(record.get(me.valueField));
  20229. });
  20230. me.fireEvent('select', me, record);
  20231. me.setValue(ids.join(me.splitChar));
  20232. // me.collapse();
  20233. },
  20234. onExpand: function () {
  20235. var me = this;
  20236. var picker = this.picker;
  20237. var value = this.value;
  20238. if (!me.store) {
  20239. msg('正在初始化数据,请稍后');
  20240. me.collapse();
  20241. return;
  20242. }
  20243. var vs = _$2.split(value, me.splitChar);
  20244. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20245. picker.setSelection(records);
  20246. },
  20247. setValue: function (value) {
  20248. var me = this;
  20249. console.log('setValue', value);
  20250. me.value = value;
  20251. if (!me.store || me.store.loading) {
  20252. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20253. return me.mixins.field.setValue.call(me, value);
  20254. // return me;
  20255. }
  20256. var vs = _$2.split(value, me.splitChar);
  20257. var displayValues = [];
  20258. _$2.forEach(vs, function (v) {
  20259. var _a;
  20260. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20261. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20262. if (dv) {
  20263. displayValues.push(dv);
  20264. }
  20265. else {
  20266. displayValues.push(v);
  20267. }
  20268. });
  20269. // set the raw value to the record's display field if a record was found
  20270. me.setRawValue(displayValues.join(me.splitChar));
  20271. return me.mixins.field.setValue.call(me, value);
  20272. },
  20273. getSubmitValue: function () {
  20274. return this.value;
  20275. },
  20276. getValue: function () {
  20277. return this.value;
  20278. },
  20279. onLoad: function () {
  20280. var value = this.value;
  20281. if (value) {
  20282. this.setValue(value);
  20283. }
  20284. },
  20285. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20286. var display = this.displayField;
  20287. var me = this;
  20288. if (type === 'edit' && modifiedFieldNames &&
  20289. Ext.Array.contains(modifiedFieldNames, display) &&
  20290. this.value === rec.getId()) {
  20291. me.mixins.field.setValue.call(me, this.value);
  20292. this.setRawValue(rec.get(display));
  20293. }
  20294. }
  20295. });
  20296. }
  20297. //# sourceMappingURL=combogridmulti.js.map
  20298. function initSearch () {
  20299. Ext.define('Yvan.Search', {
  20300. extend: 'Ext.form.field.Text',
  20301. alias: 'widget.searchfield',
  20302. xtype: 'searchfield',
  20303. constructor: function (config) {
  20304. var self = this;
  20305. var newConfig = _$2.defaultsDeep({
  20306. // 强制性属性
  20307. triggers: {
  20308. clear: {
  20309. weight: 0,
  20310. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20311. hidden: true,
  20312. handler: 'onClearClick',
  20313. },
  20314. search: {
  20315. weight: 1,
  20316. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20317. handler: 'onSearchClick'
  20318. },
  20319. },
  20320. listeners: {
  20321. blur: function (sender, e) {
  20322. this.revertOnblur();
  20323. },
  20324. specialkey: function (sender, e) {
  20325. var _a;
  20326. var me = this;
  20327. if (e.getKey() === e.ENTER) {
  20328. me.onSearchClick(sender, {}, e);
  20329. return;
  20330. }
  20331. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20332. },
  20333. afterrender: function (sender, e) {
  20334. var _a;
  20335. this.replaceRawInputEvent();
  20336. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20337. }
  20338. },
  20339. }, baseConfig(config, 'col-item'), config, search);
  20340. this.superclass.constructor.call(self, newConfig);
  20341. },
  20342. revertOnblur: function () {
  20343. this.setRawValue(this.lastValue);
  20344. },
  20345. onSearchClick: function (sender, vv, e) {
  20346. var me = this;
  20347. var config = me.config;
  20348. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20349. if (e) {
  20350. e.preventDefault();
  20351. e.stopPropagation();
  20352. }
  20353. this.fireEvent('search', sender, e);
  20354. if (!widget) {
  20355. return;
  20356. }
  20357. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20358. },
  20359. replaceRawInputEvent: function () {
  20360. var me = this;
  20361. var $dom = $(me.inputEl.dom);
  20362. $dom.on('input', function (e) {
  20363. stopEvent(e);
  20364. // console.log('has input', e)
  20365. });
  20366. $dom.on('keyup', function (e) {
  20367. if (e.key === "Enter") {
  20368. me.onSearchClick(me, {}, e);
  20369. return;
  20370. }
  20371. stopEvent(e);
  20372. });
  20373. $dom.on('change', function (e) {
  20374. stopEvent(e);
  20375. });
  20376. },
  20377. onChange: function (newVal, oldVal) {
  20378. var me = this;
  20379. var value = newVal;
  20380. if (value) {
  20381. me.getTrigger('clear').show();
  20382. me.updateLayout();
  20383. }
  20384. else {
  20385. me.getTrigger('clear').hide();
  20386. me.updateLayout();
  20387. }
  20388. },
  20389. /**
  20390. * 清空所有值
  20391. */
  20392. onClearClick: function (sender, e) {
  20393. var me = this;
  20394. var config = me.config;
  20395. var lookup = config.lookup;
  20396. me.setValue('');
  20397. clearViewModelByLookup(sender, lookup);
  20398. }
  20399. });
  20400. }
  20401. //# sourceMappingURL=search.js.map
  20402. function initMultipleSearch () {
  20403. Ext.define('Yvan.MultipleSearch', {
  20404. extend: 'Ext.form.field.Text',
  20405. xtype: 'multiplesearch',
  20406. bindTargert: '',
  20407. constructor: function (config) {
  20408. var _a, _b, _c, _d;
  20409. var self = this;
  20410. var newConfig = _$2.defaultsDeep({
  20411. // 强制性属性
  20412. triggers: {
  20413. clear: {
  20414. weight: 0,
  20415. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20416. hidden: true,
  20417. handler: 'onClearClick',
  20418. }
  20419. },
  20420. transformRawValue: function (o) {
  20421. return o;
  20422. },
  20423. listeners: {
  20424. specialkey: function (sender, e) {
  20425. var me = this;
  20426. if (e.getKey() === e.ENTER) {
  20427. me.fireEvent('search', me, e);
  20428. }
  20429. },
  20430. afterrender: function (sender, e) {
  20431. var _a;
  20432. this.replaceRawInputEvent();
  20433. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20434. }
  20435. },
  20436. }, baseConfig(config, 'col-item'), config, search);
  20437. this.superclass.constructor.call(self, newConfig);
  20438. 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 : '';
  20439. vv = _$2.replace(vv, "{", "");
  20440. vv = _$2.replace(vv, "}", "");
  20441. this.bindTargert = vv;
  20442. this.bindTargert = _$2.trim(this.bindTargert);
  20443. },
  20444. setBindValue: function (arrValue) {
  20445. if (this.bindTargert) {
  20446. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20447. }
  20448. },
  20449. replaceRawInputEvent: function () {
  20450. var me = this;
  20451. var $dom = $(me.inputEl.dom);
  20452. $dom.on('input', function (e) {
  20453. var _a, _b, _c, _d, _e, _f;
  20454. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20455. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20456. if (!a.endsWith(",") && a.length > 0) {
  20457. e.currentTarget.value = a + ",";
  20458. }
  20459. else {
  20460. e.currentTarget.value = a;
  20461. }
  20462. }
  20463. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20464. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20465. _$2.remove(arr, function (it) {
  20466. return !it;
  20467. });
  20468. me.setBindValue(arr);
  20469. stopEvent(e);
  20470. });
  20471. $dom.on('keyup', function (e) {
  20472. me.fireEvent('keyup', me, e);
  20473. // invokeMethod(me.config.listeners?.keyup, me, e)
  20474. stopEvent(e);
  20475. });
  20476. $dom.on('keydown', function (e) {
  20477. me.fireEvent('keydown', me, e);
  20478. // invokeMethod(me.config.listeners?.keydown, me, e)
  20479. //stopEvent(e)
  20480. });
  20481. $dom.on('change', function (e) {
  20482. stopEvent(e);
  20483. });
  20484. $dom.on('paste', function (e) {
  20485. var _a;
  20486. // @ts-ignore
  20487. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20488. var text = clipdata.getData("text/plain");
  20489. var spliter = ',';
  20490. text = text.replaceAll("\r", "");
  20491. text = text.replaceAll("\n", spliter);
  20492. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20493. var arr = text.split(spliter);
  20494. if (arr && Array.isArray(arr)) {
  20495. for (var i = 0; i < arr.length; i++) {
  20496. arr[i] = _$2.trim(arr[i]);
  20497. }
  20498. }
  20499. _$2.remove(arr, function (it) {
  20500. return !it;
  20501. });
  20502. me.setBindValue(arr);
  20503. stopEvent(e);
  20504. });
  20505. },
  20506. onChange: function (newVal, oldVal) {
  20507. var me = this;
  20508. var value = newVal;
  20509. if (value) {
  20510. me.getTrigger('clear').show();
  20511. me.updateLayout();
  20512. }
  20513. else {
  20514. me.getTrigger('clear').hide();
  20515. me.updateLayout();
  20516. }
  20517. },
  20518. /**
  20519. * 清空所有值
  20520. */
  20521. onClearClick: function (sender, e) {
  20522. var me = this;
  20523. var config = me.config;
  20524. var lookup = config.lookup;
  20525. me.setValue('');
  20526. clearViewModelByLookup(sender, lookup);
  20527. }
  20528. });
  20529. }
  20530. //# sourceMappingURL=multiplesearch.js.map
  20531. function initDate () {
  20532. var cc = Ext.form.field.Date.prototype.constructor;
  20533. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20534. Ext.form.field.Date.override({
  20535. format: 'Y-m-d',
  20536. altFormats: 'Y-m-d',
  20537. constructor: function (config) {
  20538. var newConfig = _$2.defaultsDeep({
  20539. // 强制属性
  20540. }, baseConfig(config, 'col-item'), config, date);
  20541. cc.call(this, newConfig);
  20542. },
  20543. getValue: function () {
  20544. var ov = getValue.call(this);
  20545. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20546. // console.log('cc:', nv, ov)
  20547. return nv;
  20548. },
  20549. // focus2() {
  20550. // const that = this
  20551. // if (that.isExpanded) {
  20552. // that.collapse()
  20553. //
  20554. // } else {
  20555. // that.expand();
  20556. // }
  20557. // _.defer(() => {
  20558. // that.focus()
  20559. // })
  20560. // },
  20561. initComponent: function () {
  20562. this.on({
  20563. afterrender: function () {
  20564. var config = this.config;
  20565. // 日期框,不要默认弹出
  20566. // $(this.el.dom).on('click', toggle.bind(this))
  20567. },
  20568. destory: function () {
  20569. // 日期框,不要默认弹出
  20570. // $(this.el.dom).off('click', toggle.bind(this))
  20571. },
  20572. change: {
  20573. fn: function (sender) {
  20574. if (sender.format === 'Y-m-d') {
  20575. // 年月日格式
  20576. var value = sender.getRawValue();
  20577. if (/^\d{8}$/.test(value)) {
  20578. // 8位数字,自动转换为 YYYY-MM-DD
  20579. var newValue = [
  20580. value.substr(0, 4),
  20581. value.substr(4, 2),
  20582. value.substr(6, 2)
  20583. ].join('-');
  20584. sender.setValue(newValue);
  20585. }
  20586. }
  20587. },
  20588. }
  20589. // focus: {
  20590. // // 获得焦点后自动下拉
  20591. // fn(sender) {
  20592. // sender.expand();
  20593. // this.doQuery(this.allQuery, true);
  20594. // },
  20595. // },
  20596. });
  20597. initComponent.call(this);
  20598. },
  20599. createInitialDate: function (value) {
  20600. var minValue = this.minValue, maxValue = this.maxValue;
  20601. value = value || syncDate(new Date());
  20602. if (minValue && minValue > value) {
  20603. value = minValue;
  20604. }
  20605. else if (maxValue && maxValue < value) {
  20606. value = maxValue;
  20607. }
  20608. return value;
  20609. },
  20610. });
  20611. }
  20612. //# sourceMappingURL=datefield.js.map
  20613. function initDateTimePicker () {
  20614. Ext.define('Yvan.DateTimePicker', {
  20615. extend: 'Ext.picker.Date',
  20616. alias: 'datetimepicker',
  20617. alternateClassName: 'Ext.DateTimePicker',
  20618. renderTpl: [
  20619. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20620. '<div class="{baseCls}-header">',
  20621. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20622. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20623. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20624. '</div>',
  20625. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20626. '<thead>',
  20627. '<tr role="row">',
  20628. '<tpl for="dayNames">',
  20629. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20630. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20631. '</th>',
  20632. '</tpl>',
  20633. '</tr>',
  20634. '</thead>',
  20635. '<tbody>',
  20636. '<tr role="row">',
  20637. '<tpl for="days">',
  20638. '{#:this.isEndOfWeek}',
  20639. '<td role="gridcell">',
  20640. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20641. '</td>',
  20642. '</tpl>',
  20643. '</tr>',
  20644. '</tbody>',
  20645. '</table>',
  20646. '<tpl if="showToday">',
  20647. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20648. '</tpl>',
  20649. // These elements are used with Assistive Technologies such as screen readers
  20650. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20651. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20652. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20653. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20654. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20655. '</div>',
  20656. {
  20657. firstInitial: function (value) {
  20658. return Ext.picker.Date.prototype.getDayInitial(value);
  20659. },
  20660. isEndOfWeek: function (value) {
  20661. // convert from 1 based index to 0 based
  20662. // by decrementing value once.
  20663. value--;
  20664. // eslint-disable-next-line vars-on-top
  20665. var end = value % 7 === 0 && value !== 0;
  20666. return end ? '</tr><tr role="row">' : '';
  20667. },
  20668. renderTodayBtn: function (values, out) {
  20669. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20670. },
  20671. renderMonthBtn: function (values, out) {
  20672. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20673. }
  20674. }
  20675. ],
  20676. beforeRender: function () {
  20677. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20678. this.superclass.beforeRender.call(this);
  20679. function handleInput(extHandle, $input) {
  20680. var $dom = $(extHandle.el.dom);
  20681. // const $up = $dom.find('.x-form-spinner-up')
  20682. // const $down = $dom.find('.x-form-spinner-down')
  20683. // debugger
  20684. // $up.on('mousedown', () => {
  20685. // debugger
  20686. // });
  20687. // $up.on('click', () => {
  20688. // debugger
  20689. // });
  20690. extHandle.on('click', function (sender) {
  20691. var hideBak = me.hide;
  20692. me.hide = Ext.emptyFn;
  20693. extHandle.focus();
  20694. me.hide = hideBak;
  20695. });
  20696. var changeValue = function (delta) {
  20697. if (_$2.trim(extHandle.getValue()) === '') {
  20698. extHandle.setValue(extHandle.minValue);
  20699. }
  20700. else {
  20701. var v = parseInt('' + extHandle.getValue());
  20702. if (v + delta > extHandle.maxValue) {
  20703. extHandle.setValue(extHandle.minValue);
  20704. }
  20705. else if (v + delta < extHandle.minValue) {
  20706. extHandle.setValue(extHandle.maxValue);
  20707. }
  20708. else {
  20709. extHandle.setValue(v + delta);
  20710. }
  20711. }
  20712. };
  20713. $input.on('mousewheel', function (e) {
  20714. e.stopPropagation();
  20715. var event = e.originalEvent;
  20716. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20717. // if (event.wheelDelta) {
  20718. // delta = event.wheelDelta / 120;
  20719. // } else if (event.detail) {
  20720. // delta = -event.detail / 3;
  20721. // }
  20722. var zoomSize = Math.ceil(eventDelta / 120);
  20723. changeValue(zoomSize);
  20724. // console.log('delta', delta)
  20725. // $input.focus()
  20726. });
  20727. }
  20728. me.input1 = Ext.create('Ext.form.field.Number', {
  20729. minValue: 0,
  20730. maxValue: 23,
  20731. flex: 1,
  20732. enableKeyEvents: true,
  20733. fieldLabel: '时',
  20734. labelWidth: 20,
  20735. hideLabel: true,
  20736. spinDownEnabled: false,
  20737. spinUpEnabled: false,
  20738. style: {
  20739. marginLeft: '5px',
  20740. },
  20741. listeners: {
  20742. afterrender: function (sender) {
  20743. var $input = $(sender.inputEl.dom);
  20744. handleInput(me.input1, $input);
  20745. },
  20746. change: function (sender, e) {
  20747. if (me.getValue()) {
  20748. me.value.setHours(sender.getValue());
  20749. }
  20750. },
  20751. }
  20752. });
  20753. me.input2 = Ext.create('Ext.form.field.Number', {
  20754. minValue: 0,
  20755. maxValue: 59,
  20756. flex: 1,
  20757. enableKeyEvents: true,
  20758. fieldLabel: ' ',
  20759. hideLabel: false,
  20760. labelWidth: 8,
  20761. spinDownEnabled: false,
  20762. spinUpEnabled: false,
  20763. listeners: {
  20764. afterrender: function (sender) {
  20765. var $input = $(sender.inputEl.dom);
  20766. handleInput(me.input2, $input);
  20767. },
  20768. change: function (sender, e) {
  20769. if (me.getValue()) {
  20770. me.value.setMinutes(sender.getValue());
  20771. }
  20772. },
  20773. }
  20774. });
  20775. me.input3 = Ext.create('Ext.form.field.Number', {
  20776. minValue: 0,
  20777. maxValue: 59,
  20778. flex: 1,
  20779. enableKeyEvents: true,
  20780. fieldLabel: ' ',
  20781. hideLabel: false,
  20782. labelWidth: 8,
  20783. spinDownEnabled: false,
  20784. spinUpEnabled: false,
  20785. style: {
  20786. marginRight: '5px',
  20787. },
  20788. listeners: {
  20789. afterrender: function (sender) {
  20790. var $input = $(sender.inputEl.dom);
  20791. handleInput(me.input3, $input);
  20792. },
  20793. change: function (sender, e) {
  20794. if (me.getValue()) {
  20795. me.value.setSeconds(sender.getValue());
  20796. }
  20797. },
  20798. }
  20799. });
  20800. me.confirmBtn = new Ext.button.Button({
  20801. text: '确认',
  20802. handler: me.confirmClick,
  20803. scope: me
  20804. });
  20805. me.tdBtn = new Ext.button.Button({
  20806. text: '现在',
  20807. handler: me.selectToday,
  20808. scope: me
  20809. });
  20810. me.todayBtn = Ext.create('Ext.container.Container', {
  20811. layout: 'anchor', border: false,
  20812. defaults: {
  20813. border: false, anchor: '100%',
  20814. margin: '0 0 5 0',
  20815. },
  20816. items: [
  20817. {
  20818. layout: 'hbox',
  20819. items: [
  20820. me.input1,
  20821. me.input2,
  20822. me.input3,
  20823. ]
  20824. },
  20825. {
  20826. layout: 'hbox',
  20827. items: [
  20828. me.confirmBtn,
  20829. me.tdBtn,
  20830. ]
  20831. }
  20832. ]
  20833. });
  20834. },
  20835. // finishRenderChildren() {
  20836. // var me = this;
  20837. //
  20838. // this.superclass.finishRenderChildren.call(this);
  20839. // //*
  20840. // me.input1.finishRender();
  20841. // me.input2.finishRender();
  20842. // me.input3.finishRender();
  20843. // //
  20844. // me.tdBtn.finishRender();
  20845. // me.confirmBtn.finishRender();
  20846. // },
  20847. setValue: function (value) {
  20848. //this.value = Ext.Date.clearTime(value, true);
  20849. this.value = value;
  20850. this.input1.setValue(this.value.getHours());
  20851. this.input2.setValue(this.value.getMinutes());
  20852. this.input3.setValue(this.value.getSeconds());
  20853. return this.update(this.value);
  20854. },
  20855. selectDate: function (value) {
  20856. if (this.showTime) {
  20857. value.setHours(this.input1.getValue());
  20858. value.setMinutes(this.input2.getValue());
  20859. value.setSeconds(this.input3.getValue());
  20860. }
  20861. this.value = value;
  20862. return this.update(this.value);
  20863. },
  20864. setDisabledStatus: function (disabled) {
  20865. var me = this;
  20866. debugger;
  20867. // me.callParent();
  20868. if (me.showTime) {
  20869. me.confirmBtn.setDisabled(disabled);
  20870. }
  20871. if (me.isShowFooter()) {
  20872. me.footerContainer.setDisabled(disabled);
  20873. }
  20874. },
  20875. handleDateClick: function (e, t) {
  20876. var me = this, handler = me.handler;
  20877. // e.stopEvent();
  20878. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20879. me.doCancelFocus = me.focusOnSelect === false;
  20880. me.selectDate(new Date(t.dateValue));
  20881. delete me.doCancelFocus;
  20882. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20883. if (me.showTime) {
  20884. return;
  20885. }
  20886. me.fireEvent('select', me, me.value);
  20887. if (handler) {
  20888. handler.call(me.scope || me, me, me.value);
  20889. }
  20890. me.onSelect();
  20891. }
  20892. },
  20893. selectToday: function () {
  20894. var me = this, btn = me.todayBtn, handler = me.handler;
  20895. if (btn && !btn.disabled) {
  20896. me.value = syncDate(new Date());
  20897. me.update(me.value);
  20898. me.fireEvent('select', me, me.value);
  20899. if (handler) {
  20900. handler.call(me.scope || me, me, me.value);
  20901. }
  20902. me.onSelect();
  20903. me.hide();
  20904. }
  20905. return me;
  20906. },
  20907. confirmClick: function () {
  20908. var me = this, btn = me.confirmBtn, handler = me.handler;
  20909. if (btn && !btn.disabled) {
  20910. me.fireEvent('select', me, me.value);
  20911. if (handler) {
  20912. handler.call(me.scope || me, me, me.value);
  20913. }
  20914. me.onSelect();
  20915. me.hide();
  20916. }
  20917. return me;
  20918. },
  20919. selectedUpdate: function (date) {
  20920. var me = this,
  20921. //t = date.getTime(),
  20922. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20923. cells.removeCls(cls);
  20924. for (c = 0; c < cLen; c++) {
  20925. cell = Ext.fly(cellItems[c]);
  20926. if (cell.dom.firstChild.dateValue == t) {
  20927. me.fireEvent('highlightitem', me, cell);
  20928. cell.addCls(cls);
  20929. if (me.isVisible() && !me.doCancelFocus) {
  20930. Ext.fly(cell.dom.firstChild).focus(50);
  20931. }
  20932. break;
  20933. }
  20934. }
  20935. },
  20936. // private, inherit docs
  20937. beforeDestroy: function () {
  20938. var me = this;
  20939. if (me.rendered) {
  20940. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20941. }
  20942. me.superclass.beforeDestroy.call(this);
  20943. }
  20944. });
  20945. }
  20946. //# sourceMappingURL=datetimepicker.js.map
  20947. function initDateTime () {
  20948. Ext.define('Yvan.DateTimeField', {
  20949. extend: 'Ext.form.field.Date',
  20950. xtype: 'datetimefield',
  20951. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20952. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20953. showTime: true,
  20954. format: "Y-m-d H:i:s",
  20955. constructor: function (config) {
  20956. var newConfig = _$2.defaultsDeep({
  20957. // 强制属性
  20958. }, baseConfig(config, 'col-item'), config, date);
  20959. this.superclass.constructor.call(this, newConfig);
  20960. },
  20961. initComponent: function () {
  20962. this.superclass.initComponent.call(this);
  20963. var setInitValue = function () {
  20964. var value = this.getRawValue();
  20965. if (!value) {
  20966. // 没填内容的时候,自动设置当前时间
  20967. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20968. }
  20969. };
  20970. this.on({
  20971. afterrender: function () {
  20972. var config = this.config;
  20973. // 日期框,不要默认弹出
  20974. $(this.el.dom).on('click', setInitValue.bind(this));
  20975. },
  20976. destory: function () {
  20977. // 日期框,不要默认弹出
  20978. $(this.el.dom).off('click', setInitValue.bind(this));
  20979. },
  20980. change: {
  20981. fn: function (sender) {
  20982. if (sender.format === "Y-m-d H:i:s") {
  20983. // 年月日格式
  20984. var value = sender.getRawValue();
  20985. if (/^\d{14}$/.test(value)) {
  20986. // 8位数字,自动转换为 YYYY-MM-DD
  20987. var newValue = [
  20988. value.substr(0, 4),
  20989. '-',
  20990. value.substr(4, 2),
  20991. '-',
  20992. value.substr(6, 2),
  20993. ' ',
  20994. value.substr(8, 2),
  20995. ':',
  20996. value.substr(10, 2),
  20997. ':',
  20998. value.substr(12, 2)
  20999. ].join('');
  21000. sender.setValue(newValue);
  21001. }
  21002. }
  21003. },
  21004. }
  21005. });
  21006. },
  21007. getValue: function () {
  21008. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  21009. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  21010. // console.log('cc:', nv, ov)
  21011. return nv;
  21012. },
  21013. onExpand: function () {
  21014. var strValue = this.getValue();
  21015. var value;
  21016. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21017. 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)));
  21018. }
  21019. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21020. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21021. }
  21022. else {
  21023. value = syncDate(new Date());
  21024. }
  21025. this.picker.setValue(value);
  21026. },
  21027. createPicker: function () {
  21028. var me = this, format = Ext.String.format;
  21029. //@ts-ignore
  21030. return new Yvan.DateTimePicker({
  21031. pickerField: me,
  21032. ownerCt: me.ownerCt,
  21033. renderTo: document.body,
  21034. floating: true,
  21035. hidden: true,
  21036. focusOnShow: true,
  21037. minDate: me.minValue,
  21038. maxDate: me.maxValue,
  21039. disabledDatesRE: me.disabledDatesRE,
  21040. disabledDatesText: me.disabledDatesText,
  21041. disabledDays: me.disabledDays,
  21042. disabledDaysText: me.disabledDaysText,
  21043. format: me.format,
  21044. showToday: me.showToday,
  21045. showTime: me.showTime,
  21046. startDay: me.startDay,
  21047. minText: format(me.minText, me.formatDate(me.minValue)),
  21048. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21049. listeners: {
  21050. scope: me,
  21051. select: me.onSelect
  21052. },
  21053. keyNavConfig: {
  21054. esc: function () {
  21055. me.collapse();
  21056. }
  21057. }
  21058. });
  21059. },
  21060. });
  21061. }
  21062. //# sourceMappingURL=datetimefield.js.map
  21063. function initNumber () {
  21064. var cc = Ext.form.field.Number.prototype.constructor;
  21065. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21066. Ext.form.field.Number.override({
  21067. constructor: function (config) {
  21068. var newConfig = _$2.defaultsDeep({
  21069. // 强制属性
  21070. }, baseConfig(config, 'col-item'), config, numberfield);
  21071. cc.call(this, newConfig);
  21072. },
  21073. initComponent: function () {
  21074. this.on({
  21075. afterrender: function (sender) {
  21076. var _this = this;
  21077. var _a;
  21078. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21079. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21080. $$2(sender.inputEl.dom).on('click', function (e) {
  21081. sender.fireEvent('click', _this, e);
  21082. });
  21083. }
  21084. }
  21085. });
  21086. initComponent.call(this);
  21087. },
  21088. });
  21089. }
  21090. //# sourceMappingURL=numberfield.js.map
  21091. function initCheckbox () {
  21092. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21093. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21094. Ext.form.field.Checkbox.override({
  21095. constructor: function (config) {
  21096. var newConfig = _$2.defaultsDeep({
  21097. // 强制属性
  21098. }, baseConfig(config, 'col-item'), config, checkbox);
  21099. cc.call(this, newConfig);
  21100. },
  21101. getValue: function () {
  21102. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21103. var ov = getValue.call(this);
  21104. // const ov = this.getRawValue()
  21105. return (ov ? checkedValue : uncheckedValue);
  21106. },
  21107. setValue: function (nv) {
  21108. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21109. var value;
  21110. if (nv === checkedValue) {
  21111. value = true;
  21112. }
  21113. else if (nv === uncheckedValue) {
  21114. value = false;
  21115. }
  21116. else {
  21117. value = !!nv;
  21118. }
  21119. // me.setRawValue(value)
  21120. // me.checked = value
  21121. // return me.mixins.field.setValue.call(me, value);
  21122. setValue.call(this, value);
  21123. },
  21124. updateCheckedCls: function (checked) {
  21125. var me = this;
  21126. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21127. checked = checked != null ? checked : me.getValue();
  21128. if (checked === uncheckedValue) {
  21129. checked = false;
  21130. }
  21131. else if (checked === checkedValue) {
  21132. checked = true;
  21133. }
  21134. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21135. },
  21136. initComponent: function () {
  21137. initComponent.call(this);
  21138. },
  21139. });
  21140. }
  21141. //# sourceMappingURL=checkbox.js.map
  21142. function initCheckboxGroup () {
  21143. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21144. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21145. Ext.form.CheckboxGroup.override({
  21146. constructor: function (config) {
  21147. var newConfig = _$2.defaultsDeep({
  21148. // 强制属性
  21149. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21150. cc.call(this, newConfig);
  21151. },
  21152. initComponent: function () {
  21153. initComponent.call(this);
  21154. },
  21155. });
  21156. }
  21157. //# sourceMappingURL=checkboxgroup.js.map
  21158. function initRadio () {
  21159. var cc = Ext.form.field.Radio.prototype.constructor;
  21160. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21161. Ext.form.field.Radio.override({
  21162. constructor: function (config) {
  21163. var newConfig = _$2.defaultsDeep({
  21164. // 强制属性
  21165. }, baseConfig(config, 'col-item'), config, radio);
  21166. cc.call(this, newConfig);
  21167. },
  21168. initComponent: function () {
  21169. initComponent.call(this);
  21170. },
  21171. });
  21172. }
  21173. //# sourceMappingURL=radio.js.map
  21174. function initRadioGroup () {
  21175. var cc = Ext.form.RadioGroup.prototype.constructor;
  21176. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21177. Ext.form.RadioGroup.override({
  21178. constructor: function (config) {
  21179. var newConfig = _$2.defaultsDeep({
  21180. // 强制属性
  21181. }, baseConfig(config, 'col-item'), config, radiogroup);
  21182. cc.call(this, newConfig);
  21183. },
  21184. initComponent: function () {
  21185. initComponent.call(this);
  21186. },
  21187. });
  21188. }
  21189. //# sourceMappingURL=radiogroup.js.map
  21190. function initFieldset () {
  21191. /**
  21192. *
  21193. */
  21194. var ct = Ext.form.FieldSet.prototype.constructor;
  21195. Ext.form.FieldSet.override({
  21196. constructor: function (config) {
  21197. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21198. ct.call(this, newConfig);
  21199. }
  21200. });
  21201. }
  21202. //# sourceMappingURL=fieldset.js.map
  21203. function initCombotree () {
  21204. Ext.define('Yvan.ComboTree', {
  21205. extend: 'Ext.form.field.Picker',
  21206. xtype: 'combotree',
  21207. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21208. config: {
  21209. store: null,
  21210. displayField: null,
  21211. columns: null,
  21212. selectOnTab: true,
  21213. maxPickerHeight: 300,
  21214. minPickerHeight: 100,
  21215. minPickerWidth: 350,
  21216. rootVisible: true,
  21217. },
  21218. editable: false,
  21219. setStore: function (store) {
  21220. this.store = store;
  21221. var me = this;
  21222. if (me.store) {
  21223. if (me.picker) {
  21224. me.picker.setStore(store);
  21225. if (me.isExpanded) {
  21226. me.collapse();
  21227. delete me.picker;
  21228. me.expand();
  21229. }
  21230. }
  21231. this.onLoad();
  21232. me.mon(me.store, {
  21233. scope: me,
  21234. load: me.onLoad,
  21235. update: me.onUpdate
  21236. });
  21237. }
  21238. },
  21239. createPicker: function () {
  21240. var me = this;
  21241. var picker = new Ext.tree.Panel({
  21242. border: false,
  21243. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21244. shrinkWrapDock: 2,
  21245. store: me.store,
  21246. floating: true,
  21247. rootVisible: me.rootVisible,
  21248. displayField: me.displayField,
  21249. columns: me.columns,
  21250. minHeight: me.minPickerHeight,
  21251. maxHeight: me.maxPickerHeight,
  21252. minWidth: me.minPickerWidth,
  21253. manageHeight: false,
  21254. shadow: false,
  21255. scrollable: true,
  21256. // modal: true,
  21257. // constrain: true,
  21258. // constrainTo: topScope._handle.el.dom,
  21259. // renderTo: topScope._handle.el.dom,
  21260. // alignTarget: topScope._handle,
  21261. listeners: {
  21262. scope: me,
  21263. itemclick: me.onItemClick,
  21264. itemkeydown: me.onPickerKeyDown
  21265. }
  21266. }), view = picker.getView();
  21267. if (Ext.isIE9 && Ext.isStrict) {
  21268. view.on({
  21269. scope: me,
  21270. highlightitem: me.repaintPickerView,
  21271. unhighlightitem: me.repaintPickerView,
  21272. afteritemexpand: me.repaintPickerView,
  21273. afteritemcollapse: me.repaintPickerView
  21274. });
  21275. }
  21276. return picker;
  21277. },
  21278. repaintPickerView: function () {
  21279. var style = this.picker.getView().getEl().dom.style;
  21280. style.display = style.display;
  21281. },
  21282. onItemClick: function (view, record, node, rowIndex, e) {
  21283. this.selectItem(view, record);
  21284. },
  21285. onPickerKeyDown: function (treeView, record, item, index, e) {
  21286. var key = e.getKey();
  21287. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21288. this.selectItem(treeView, record);
  21289. }
  21290. },
  21291. selectItem: function (sender, record) {
  21292. var me = this;
  21293. me.setValue(record.getId());
  21294. me.fireEvent('select', me, record);
  21295. me.collapse();
  21296. },
  21297. onExpand: function () {
  21298. var picker = this.picker;
  21299. var store = picker.store;
  21300. var value = this.value;
  21301. var node;
  21302. if (value) {
  21303. node = store.getNodeById(value);
  21304. }
  21305. if (!node) {
  21306. node = store.getRoot();
  21307. }
  21308. picker.ensureVisible(node, {
  21309. select: true,
  21310. focus: true
  21311. });
  21312. },
  21313. setValue: function (value) {
  21314. var me = this;
  21315. console.log('setValue', value);
  21316. me.value = value;
  21317. if (!me.store || me.store.loading) {
  21318. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21319. return me.mixins.field.setValue.call(me, value);
  21320. // return me;
  21321. }
  21322. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21323. if (value === undefined) {
  21324. record = me.store.getRoot();
  21325. console.log('setValue', record.getId());
  21326. me.value = record.getId();
  21327. return me.mixins.field.setValue.call(me, value);
  21328. }
  21329. else {
  21330. record = me.store.getNodeById(value);
  21331. }
  21332. // set the raw value to the record's display field if a record was found
  21333. me.setRawValue(record ? record.get(me.displayField) : '');
  21334. return me.mixins.field.setValue.call(me, value);
  21335. },
  21336. getSubmitValue: function () {
  21337. return this.value;
  21338. },
  21339. getValue: function () {
  21340. return this.value;
  21341. },
  21342. onLoad: function () {
  21343. var value = this.value;
  21344. if (value) {
  21345. this.setValue(value);
  21346. }
  21347. },
  21348. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21349. var display = this.displayField;
  21350. var me = this;
  21351. if (type === 'edit' && modifiedFieldNames &&
  21352. Ext.Array.contains(modifiedFieldNames, display) &&
  21353. this.value === rec.getId()) {
  21354. me.mixins.field.setValue.call(me, this.value);
  21355. this.setRawValue(rec.get(display));
  21356. }
  21357. }
  21358. });
  21359. }
  21360. //# sourceMappingURL=combotree.js.map
  21361. function initPickerPlus () {
  21362. Ext.define('Yvan.PickerAlignCenter', {
  21363. extend: 'Ext.form.field.Picker',
  21364. /**
  21365. * Performs the alignment on the picker using the class defaults
  21366. * @private
  21367. */
  21368. doAlign: function () {
  21369. // 不要挪动就好
  21370. },
  21371. });
  21372. }
  21373. //# sourceMappingURL=pickerplus.js.map
  21374. function initCombogrid () {
  21375. Ext.define('Yvan.ComboGrid', {
  21376. extend: 'Ext.form.field.Picker',
  21377. // extend: 'Yvan.PickerAlignCenter',
  21378. xtype: 'combogrid',
  21379. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21380. triggers: {
  21381. clear: {
  21382. weight: 0,
  21383. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21384. hidden: true,
  21385. handler: 'onClearClick',
  21386. },
  21387. },
  21388. config: __assign({}, comboGrid),
  21389. editable: true,
  21390. _superBlur: false,
  21391. allowCustomInput: false,
  21392. pressEnterPopup: true,
  21393. initComponent: function () {
  21394. var that = this;
  21395. var scope = lookupScope(that);
  21396. var config = that.config;
  21397. if (isDesignMode(scope, config)) {
  21398. this.superclass.initComponent.call(this, arguments);
  21399. return;
  21400. }
  21401. this.on({
  21402. blur: function (sender, e) {
  21403. if (this._superBlur) {
  21404. // 挂起时不恢复内容
  21405. return;
  21406. }
  21407. // 离开焦点时,恢复原来的值
  21408. sender.setRawValue(sender.value);
  21409. },
  21410. afterrender: function (sender) {
  21411. var $dom = $(sender.inputEl.dom);
  21412. that.scope = lookupScope(sender);
  21413. if (sender.column) {
  21414. // 列模式,拦截 keydown
  21415. $dom.on('keydown', function (e) {
  21416. if (isChartEvent(e) && !that.tryEnable()) {
  21417. // 没有达成 editEnable 条件,不用响应
  21418. stopEvent(e);
  21419. return;
  21420. }
  21421. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21422. stopEvent(e);
  21423. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21424. return;
  21425. }
  21426. });
  21427. }
  21428. else {
  21429. // 常规模式,拦截 keyup
  21430. $dom.on('keyup', function (e) {
  21431. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21432. return;
  21433. }
  21434. if (isChartEvent(e) && !that.tryEnable()) {
  21435. // 没有达成 editEnable 条件,不用响应
  21436. stopEvent(e);
  21437. return;
  21438. }
  21439. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21440. stopEvent(e);
  21441. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21442. return;
  21443. }
  21444. if (!that.allowCustomInput) {
  21445. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21446. stopEvent(e);
  21447. }
  21448. });
  21449. $dom.on('change', function (e) {
  21450. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21451. // if (that.isExpanded) {
  21452. // that.filterChange(that, e.target.value)
  21453. // }
  21454. stopEvent(e);
  21455. });
  21456. }
  21457. $dom.on('input', function (e) {
  21458. stopEvent(e);
  21459. });
  21460. },
  21461. });
  21462. this.superclass.initComponent.apply(this, arguments);
  21463. },
  21464. createPicker: function () {
  21465. var me = this;
  21466. var cfg = {
  21467. layout: 'fit',
  21468. border: 0,
  21469. // border: 5,
  21470. style: {
  21471. // borderColor: 'black',
  21472. // borderWidth: '5px',
  21473. // borderStyle: 'solid',
  21474. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21475. },
  21476. shadow: 'side',
  21477. shadowOffset: 100,
  21478. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21479. shrinkWrapDock: 2,
  21480. floating: true,
  21481. width: me.pickerWidth,
  21482. height: me.pickerHeight,
  21483. minWidth: me.pickerWidth,
  21484. minHeight: me.pickerHeight,
  21485. maxWidth: me.pickerWidth,
  21486. maxHeight: me.pickerHeight,
  21487. items: [
  21488. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21489. xtype: 'toolbar',
  21490. items: [
  21491. { xtype: 'textfield', fieldLabel: '筛选' },
  21492. {
  21493. xtype: 'button',
  21494. text: '查询',
  21495. iconCls: 'x-fa fa-search',
  21496. cssType: 'primary',
  21497. listeners: {
  21498. click: function () {
  21499. me.reloadGrid();
  21500. }
  21501. }
  21502. },
  21503. ]
  21504. }, autoLoad: false, listeners: {
  21505. afterrender: function (grid) {
  21506. me.grid = grid;
  21507. grid.focus();
  21508. grid.on({
  21509. rowdblclick: function (sender, row) {
  21510. me.selectItem(row);
  21511. },
  21512. dataLoadComplete: function (sender) {
  21513. _$2.defer(function () {
  21514. me.setFocus();
  21515. });
  21516. },
  21517. keydown: function (sender, e) {
  21518. if (me.column) {
  21519. // 列模式,拦截 keydown
  21520. me.processKey(e);
  21521. }
  21522. },
  21523. keyup: function (sender, e) {
  21524. if (!me.column) {
  21525. // 常规模式,拦截 keyup
  21526. me.processKey(e);
  21527. }
  21528. }
  21529. });
  21530. },
  21531. } })
  21532. ]
  21533. };
  21534. // @ts-ignore
  21535. var picker = new Ext.container.Container(cfg);
  21536. return picker;
  21537. },
  21538. setFocus: function () {
  21539. if (this.grid.store.getCount() > 0) {
  21540. this.grid.focusRow(0);
  21541. }
  21542. },
  21543. processKey: function (e) {
  21544. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21545. this.selectItem(this.grid.selection);
  21546. stopEvent(e);
  21547. }
  21548. else if (e.key === 'Escape') {
  21549. this.collapse();
  21550. }
  21551. },
  21552. repaintPickerView: function () {
  21553. var style = this.picker.getView().getEl().dom.style;
  21554. style.display = style.display;
  21555. },
  21556. onItemClick: function (view, record, node, rowIndex, e) {
  21557. this.selectItem(record);
  21558. },
  21559. onPickerKeyDown: function (treeView, record, item, index, e) {
  21560. var key = e.getKey();
  21561. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21562. this.selectItem(record);
  21563. }
  21564. },
  21565. filterChange: _$2.debounce(function (sender, value) {
  21566. sender.onExpand();
  21567. }, 1000),
  21568. selectItem: function (record) {
  21569. var me = this;
  21570. var lookup = this.lookup;
  21571. var scope = lookupScope(this);
  21572. me.fireEvent('select', me, record);
  21573. if (record.isModel) {
  21574. record = record.data;
  21575. }
  21576. tryWriteObject(lookup, record, function (path, value) {
  21577. me._lookupSet(path, value);
  21578. });
  21579. // lookup
  21580. // fromColumn: 'toTarget'
  21581. // fromColumn: 'toTarget'
  21582. // fromColumn: 'toTarget'
  21583. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21584. var value = _$2.get(record, fromColumn);
  21585. me._lookupSet(toTarget, value);
  21586. });
  21587. // 选定之后不能做清空
  21588. // const {lookupClearOnChange} = me
  21589. // if (_.isArray(lookupClearOnChange)) {
  21590. // _.each(lookupClearOnChange, item => {
  21591. // me._lookupSet(item, '')
  21592. // })
  21593. // }
  21594. me.collapse();
  21595. // 触发 _raiseNextFocus
  21596. me._raiseNextFocus(me);
  21597. },
  21598. onExpand: function () {
  21599. // 展开时,根据 lookup 带入查询参数
  21600. var expressData = this.getExpressData();
  21601. var txtField = this.grid.down('toolbar').down('textfield');
  21602. txtField.setValue(expressData.queryValue);
  21603. this.reloadGrid();
  21604. },
  21605. reloadGrid: function () {
  21606. // 展开时,根据 lookup 带入查询参数
  21607. var expressData = this.getExpressData();
  21608. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21609. var txtField = this.grid.down('toolbar').down('textfield');
  21610. // 每个 combogrid 默认带上 __queryValue 属性
  21611. reloadParam["__queryValue"] = txtField.getValue();
  21612. this.grid.reload(reloadParam);
  21613. },
  21614. onTriggerClick: function (sender) {
  21615. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21616. if (!grid) {
  21617. msg('正在初始化,请稍后');
  21618. return;
  21619. }
  21620. if (!this.tryEnable()) {
  21621. // 没有达成 editEnable 条件,不用弹出
  21622. return;
  21623. }
  21624. if (isExpanded || readOnly || disabled) {
  21625. // 已弹出、只读、禁用状态下,不允许弹出
  21626. return;
  21627. }
  21628. this._superBlur = true;
  21629. this.superclass.onTriggerClick.apply(this, arguments);
  21630. this._superBlur = false;
  21631. },
  21632. onCollapse: function () {
  21633. // 每次收回时,删除下拉组件
  21634. // delete this.picker
  21635. },
  21636. /**
  21637. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21638. */
  21639. setValue: function (value) {
  21640. var me = this;
  21641. // 设值用户看到的表面内容
  21642. this.setRawValue(value);
  21643. // 设值 setValue 调用链,正常触发 change 事件等
  21644. return me.mixins.field.setValue.call(me, value);
  21645. },
  21646. _lookupSet: function (path, value) {
  21647. var me = this;
  21648. path = tryVarSimple(path);
  21649. if (me.column) {
  21650. // 判断写入目标,是否与自己绑定的属性相等
  21651. if (path === 'queryValue' || me.column.dataIndex === path) {
  21652. me.setValue(value);
  21653. }
  21654. // 列模式下,写当前编辑行
  21655. var parentRecord = me._lookupEditorRecord();
  21656. if (parentRecord) {
  21657. // Ext.data.Record / Ext.data.Model
  21658. parentRecord.set(path, value);
  21659. }
  21660. else {
  21661. debugger;
  21662. }
  21663. }
  21664. else {
  21665. // 常规模式下,写 viewModel
  21666. me.scope.viewModel.set(path, value);
  21667. }
  21668. },
  21669. _lookupGrid: function () {
  21670. return this.column.up('grid');
  21671. },
  21672. _lookupEditorRecord: function () {
  21673. var _a, _b, _c, _d;
  21674. // parentGrid.getSelectionModel().getLastSelected()
  21675. var grid = this._lookupGrid();
  21676. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21677. if (!editingPlugin) {
  21678. return grid.getSelectionModel().getLastSelected();
  21679. }
  21680. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21681. if (_$2.isNumber(rowIdx)) {
  21682. return grid.store.getAt(rowIdx);
  21683. }
  21684. else {
  21685. return grid.getSelectionModel().getLastSelected();
  21686. }
  21687. },
  21688. onChange: function (newVal, oldVal) {
  21689. var me = this;
  21690. var value = newVal;
  21691. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21692. if (hideTrigger || disabled || readOnly || hideClear) {
  21693. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21694. return;
  21695. }
  21696. if (value) {
  21697. me.getTrigger('clear').show();
  21698. me.updateLayout();
  21699. }
  21700. else {
  21701. me.getTrigger('clear').hide();
  21702. me.updateLayout();
  21703. }
  21704. },
  21705. /**
  21706. * 得到能用于 express 表达式计算的上下文数据
  21707. */
  21708. getExpressData: function () {
  21709. var queryValue = this.getRawValue();
  21710. if (!queryValue) {
  21711. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21712. queryValue = this.getPicker().down('textfield').getRawValue();
  21713. }
  21714. if (this.column) {
  21715. // 列模式, 准备好判断 editEnable 表达式用的数据
  21716. var parentRecord = this._lookupEditorRecord();
  21717. if (!parentRecord) {
  21718. debugger;
  21719. }
  21720. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21721. }
  21722. else {
  21723. // 编辑模式,准备好判断用的数据
  21724. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21725. }
  21726. },
  21727. tryEnable: function () {
  21728. return tryEnable(this.getExpressData(), this.editEnable);
  21729. },
  21730. /**
  21731. * 清空所有值
  21732. */
  21733. onClearClick: function (sender, e) {
  21734. var me = this;
  21735. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21736. me.fireEvent('clear', sender, e);
  21737. me.setValue('');
  21738. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21739. me._lookupSet(toTarget, '');
  21740. });
  21741. _$2.each(lookupClearOnChange, function (item) {
  21742. me._lookupSet(item, '');
  21743. });
  21744. }
  21745. });
  21746. }
  21747. //# sourceMappingURL=combogrid.js.map
  21748. function initContainer () {
  21749. var cc = Ext.container.Container.prototype.constructor;
  21750. //const {initComponent} = Ext.container.Container.prototype
  21751. Ext.container.Container.override({
  21752. constructor: function (config) {
  21753. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21754. cc.call(this, newConfig);
  21755. },
  21756. });
  21757. }
  21758. //# sourceMappingURL=container.js.map
  21759. function initRows () {
  21760. Ext.define('Yvan.Rows', {
  21761. extend: 'Ext.container.Container',
  21762. xtype: 'rows',
  21763. constructor: function (config) {
  21764. var self = this;
  21765. var newConfig = _$2.defaultsDeep({
  21766. // 强制性属性
  21767. layout: 'anchor', border: false,
  21768. defaults: {
  21769. border: false, anchor: '100%',
  21770. margin: '0 0 5 0',
  21771. },
  21772. }, baseConfig(config, 'rows-container'), config, rows);
  21773. this.superclass.constructor.call(self, newConfig);
  21774. },
  21775. });
  21776. }
  21777. //# sourceMappingURL=rows.js.map
  21778. function initForm () {
  21779. var ct = Ext.form.Panel.prototype.constructor;
  21780. Ext.form.Panel.override({
  21781. constructor: function (config) {
  21782. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21783. ct.call(this, newConfig);
  21784. }
  21785. });
  21786. }
  21787. //# sourceMappingURL=form.js.map
  21788. function initCols () {
  21789. Ext.define('Yvan.Cols', {
  21790. extend: 'Ext.container.Container',
  21791. xtype: 'cols',
  21792. constructor: function (config) {
  21793. var self = this;
  21794. var newConfig = _$2.defaultsDeep({
  21795. // 强制性属性
  21796. layout: 'hbox',
  21797. minHeight: config.designMode ? 32 : 0
  21798. }, baseConfig(config, 'cols-container'), config, cols);
  21799. this.superclass.constructor.call(self, newConfig);
  21800. },
  21801. });
  21802. }
  21803. //# sourceMappingURL=cols.js.map
  21804. function initButton () {
  21805. /**
  21806. *
  21807. */
  21808. var ct = Ext.button.Button.prototype.constructor;
  21809. Ext.button.Button.override({
  21810. constructor: function (config) {
  21811. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21812. ct.call(this, newConfig);
  21813. },
  21814. setLoading: function (value) {
  21815. if (value) {
  21816. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21817. this._originIconCls = this.iconCls;
  21818. }
  21819. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21820. this.setDisabled(true);
  21821. }
  21822. else {
  21823. this.setIconCls(this._originIconCls);
  21824. this.setDisabled(false);
  21825. }
  21826. }
  21827. });
  21828. }
  21829. //# sourceMappingURL=button.js.map
  21830. function initIframe () {
  21831. Ext.define('Ext.ux.IFrame', {
  21832. extend: 'Ext.Component',
  21833. alias: 'widget.uxiframe',
  21834. loadMask: 'Loading...',
  21835. src: 'about:blank',
  21836. renderTpl: [
  21837. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21838. ],
  21839. childEls: ['iframeEl'],
  21840. initComponent: function () {
  21841. this.superclass.initComponent.call(this);
  21842. this.superclass.initEvents.call(this);
  21843. this.frameName = this.frameName || this.id + '-frame';
  21844. },
  21845. initEvents: function () {
  21846. var me = this;
  21847. this.superclass.initEvents.call(this);
  21848. me.iframeEl.on('load', me.onLoad, me);
  21849. },
  21850. initRenderData: function () {
  21851. return Ext.apply(this.superclass.initRenderData.call(this), {
  21852. src: this.src,
  21853. frameName: this.frameName
  21854. });
  21855. },
  21856. getBody: function () {
  21857. var doc = this.getDoc();
  21858. return doc.body || doc.documentElement;
  21859. },
  21860. getDoc: function () {
  21861. try {
  21862. return this.getWin().document;
  21863. }
  21864. catch (ex) {
  21865. return null;
  21866. }
  21867. },
  21868. getWin: function () {
  21869. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21870. return win;
  21871. },
  21872. getFrame: function () {
  21873. var me = this;
  21874. return me.iframeEl.dom;
  21875. },
  21876. onLoad: function () {
  21877. var me = this, doc = me.getDoc();
  21878. if (doc) {
  21879. this.el.unmask();
  21880. this.fireEvent('load', this);
  21881. }
  21882. else if (me.src) {
  21883. this.el.unmask();
  21884. this.fireEvent('error', this);
  21885. }
  21886. },
  21887. load: function (src) {
  21888. var me = this, text = me.loadMask, frame = me.getFrame();
  21889. if (me.fireEvent('beforeload', me, src) !== false) {
  21890. if (text && me.el) {
  21891. me.el.mask(text);
  21892. }
  21893. frame.src = me.src = (src || me.src);
  21894. }
  21895. }
  21896. });
  21897. }
  21898. //# sourceMappingURL=iframe.js.map
  21899. /**
  21900. * 属性:
  21901. * - autoLoad: true
  21902. * - dataSource: ''
  21903. * 方法:
  21904. * - handleZoomBig
  21905. * - handleZoomSmall
  21906. * - handleZoomReset
  21907. * - openDiagram
  21908. * - getBpmn
  21909. * - getBpmnCanvas
  21910. * - getBpmnOverlays
  21911. * - getBpmnZoomScroll
  21912. * 事件:
  21913. * - initFinish
  21914. * - failed
  21915. * - success
  21916. * - itemHover
  21917. * - itemOut
  21918. * - itemClick
  21919. * - itemDblclick
  21920. * - itemMousedown
  21921. * - itemMouseup
  21922. */
  21923. function initBpmn () {
  21924. Ext.define('Yvan.Bpmn', {
  21925. // extend: 'Ext.container.Container',
  21926. extend: 'Ext.panel.Panel',
  21927. alias: 'widget.bpmn',
  21928. xtype: 'bpmn',
  21929. constructor: function (config) {
  21930. var self = this;
  21931. var newConfig = _$2.defaultsDeep({
  21932. // 强制性属性
  21933. }, baseConfig(config, 'row-item'), config, bpmn);
  21934. if (!newConfig.hideToolbar) {
  21935. newConfig.tbar = [];
  21936. newConfig.tbar.push({
  21937. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21938. listeners: {
  21939. click: function (sender) {
  21940. self.reload();
  21941. }
  21942. }
  21943. });
  21944. newConfig.tbar.push({
  21945. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21946. listeners: {
  21947. click: function (sender) {
  21948. self.handleZoomBig();
  21949. }
  21950. },
  21951. });
  21952. newConfig.tbar.push({
  21953. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21954. listeners: {
  21955. click: function (sender) {
  21956. self.handleZoomSmall();
  21957. }
  21958. },
  21959. });
  21960. newConfig.tbar.push({
  21961. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21962. listeners: {
  21963. click: function (sender) {
  21964. self.handleZoomReset();
  21965. }
  21966. },
  21967. });
  21968. }
  21969. this.superclass.constructor.call(self, newConfig);
  21970. },
  21971. initComponent: function () {
  21972. var _this = this;
  21973. var me = this;
  21974. var config = me.config;
  21975. var scope = lookupScope(this);
  21976. if (!isDesignMode(scope, config)) {
  21977. //@ts-ignore
  21978. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21979. console.log('BpNavigated', me, BpNavigated);
  21980. var dom = me.el.dom;
  21981. var $dom = $(dom);
  21982. var $container = $dom.find('.x-autocontainer-innerCt');
  21983. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21984. _this._bpmn = bpmn;
  21985. if (_this.autoLoad) {
  21986. _this.reload();
  21987. }
  21988. _this.fireEvent('initFinish', _this);
  21989. var eventBus = bpmn.get('eventBus');
  21990. eventBus.on('element.hover', function (e) {
  21991. // this.fireEvent('itemHover', this, e);
  21992. });
  21993. eventBus.on('element.out', function (e) {
  21994. _this.fireEvent('itemOut', _this, e);
  21995. });
  21996. eventBus.on('element.click', function (e) {
  21997. _this.fireEvent('itemClick', _this, e);
  21998. });
  21999. eventBus.on('element.dblclick', function (e) {
  22000. _this.fireEvent('itemDblclick', _this, e);
  22001. });
  22002. eventBus.on('element.mousedown', function (e) {
  22003. _this.fireEvent('itemMousedown', _this, e);
  22004. });
  22005. eventBus.on('element.mouseup', function (e) {
  22006. _this.fireEvent('itemMouseup', _this, e);
  22007. });
  22008. });
  22009. }
  22010. this.superclass.initComponent.call(this);
  22011. this.on({
  22012. afterrender: function (sender) {
  22013. }
  22014. });
  22015. },
  22016. /**
  22017. * 重新载入
  22018. */
  22019. reload: function () {
  22020. var _this = this;
  22021. var _a;
  22022. if (typeof this.dataSource === 'string' && this.dataSource) {
  22023. var scope = lookupScope(this);
  22024. var fn = lookupFn(scope, this.dataSource);
  22025. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22026. _this.openDiagram(res.data);
  22027. });
  22028. }
  22029. },
  22030. /**
  22031. * 获取bpmn
  22032. */
  22033. getBpmn: function () {
  22034. return this._bpmn;
  22035. },
  22036. getBpmnCanvas: function () {
  22037. var _a;
  22038. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22039. },
  22040. getBpmnOverlays: function () {
  22041. var _a;
  22042. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22043. },
  22044. getBpmnZoomScroll: function () {
  22045. var _a;
  22046. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22047. },
  22048. handleZoomBig: function () {
  22049. var _a;
  22050. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22051. },
  22052. handleZoomSmall: function () {
  22053. var _a;
  22054. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22055. },
  22056. handleZoomReset: function () {
  22057. var _a;
  22058. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22059. },
  22060. openDiagram: function (diagram) {
  22061. var _this = this;
  22062. if (!this.getBpmn()) {
  22063. return;
  22064. }
  22065. this.getBpmn().importXML(diagram, function (err) {
  22066. if (err) {
  22067. // YvEventDispatch(this.onFailed, this, undefined);
  22068. _this.fireEvent('failed', _this, err);
  22069. return console.error('could not import BPMN 2.0 diagram', err);
  22070. }
  22071. // zoom to fit full viewport
  22072. _this.getBpmnCanvas().zoom('fit-viewport');
  22073. _this.fireEvent('success', _this);
  22074. });
  22075. },
  22076. });
  22077. }
  22078. //# sourceMappingURL=bpmn.js.map
  22079. function initSqlComplex () {
  22080. Ext.define('Yvan.SqlComplex', {
  22081. extend: 'Ext.panel.Panel',
  22082. xtype: 'sqlcomplex',
  22083. alias: 'widget.sqlcomplex',
  22084. getSqlExpress: function () {
  22085. },
  22086. constructor: function (config) {
  22087. var reference = config.reference;
  22088. var me = this;
  22089. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22090. {
  22091. region: 'west',
  22092. width: 280,
  22093. border: false,
  22094. split: true,
  22095. reference: reference + '_tree',
  22096. xtype: 'yvtree',
  22097. hideRefresh: true,
  22098. hideExpand: true,
  22099. hideCollapse: true,
  22100. listeners: {
  22101. itemdblclick: function (sender, record, item, index, e) {
  22102. var field = record.get('field');
  22103. var defaultValue = record.get('defaultValue');
  22104. if (!field) {
  22105. return;
  22106. }
  22107. var tabExpress = me.down('tabpanel');
  22108. var sqleditor = me.down('sqleditor');
  22109. var expressGrid = me.down('yvgrid');
  22110. if (tabExpress.getActiveTab().key !== 'grid') {
  22111. // SQL 模式
  22112. sqleditor.insertText(field + '=');
  22113. }
  22114. else {
  22115. // 表格模式
  22116. expressGrid.appendEditRow({
  22117. field: field,
  22118. operator: '=',
  22119. value: defaultValue,
  22120. remark: '',
  22121. });
  22122. _$2.defer(function () {
  22123. gridChanged(me, expressGrid);
  22124. });
  22125. }
  22126. }
  22127. },
  22128. },
  22129. {
  22130. region: 'center',
  22131. xtype: 'tabpanel',
  22132. reference: reference + '_tab',
  22133. tabPosition: 'bottom',
  22134. listeners: {
  22135. afterrender: function (sender) {
  22136. var scope = lookupScope(me);
  22137. var value = scope.viewModel.get(me.config.bindValue);
  22138. // sql 转换为 grid
  22139. try {
  22140. var list_1 = parseSqlToGrid(value);
  22141. _$2.defer(function () {
  22142. var grid = me.down('yvgrid');
  22143. grid.setData(list_1);
  22144. });
  22145. }
  22146. catch (e) {
  22147. console.error(e);
  22148. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22149. var tabSql = sender.down('sqleditor');
  22150. sender.setActiveTab(tabSql);
  22151. }
  22152. },
  22153. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22154. var scope = lookupScope(me);
  22155. var value = scope.viewModel.get(me.config.bindValue);
  22156. if (newCard.key === 'grid') {
  22157. // sql 转换为 grid
  22158. try {
  22159. var list_2 = parseSqlToGrid(value);
  22160. _$2.defer(function () {
  22161. var grid = me.down('yvgrid');
  22162. grid.setData(list_2);
  22163. });
  22164. return true;
  22165. }
  22166. catch (e) {
  22167. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22168. console.error(e);
  22169. return false;
  22170. }
  22171. }
  22172. else if (newCard.key === 'sql') {
  22173. // grid 转换为 sql
  22174. _$2.defer(function () {
  22175. var editor = me.down('sqleditor');
  22176. editor.setValue(value);
  22177. });
  22178. return true;
  22179. }
  22180. }
  22181. },
  22182. items: [
  22183. {
  22184. title: '表格模式',
  22185. key: 'grid',
  22186. xtype: 'yvgrid',
  22187. _mode: 'select',
  22188. reference: reference + '_grid',
  22189. hideFootbar: true,
  22190. pagination: false,
  22191. tbar: [
  22192. {
  22193. xtype: 'button',
  22194. text: '删除',
  22195. iconCls: 'x-fa fa-minus-circle',
  22196. cls: 'ext-btn-danger',
  22197. bind: {
  22198. disabled: '{!' + reference + '_grid.selection}',
  22199. },
  22200. listeners: {
  22201. click: function (sender) {
  22202. var grid = sender.up('yvgrid');
  22203. removeGridRow(grid);
  22204. gridChanged(me, grid);
  22205. }
  22206. },
  22207. },
  22208. ],
  22209. store: {},
  22210. listeners: {
  22211. editfinish: function (sender) {
  22212. gridChanged(me, sender);
  22213. },
  22214. },
  22215. columns: [
  22216. {
  22217. dataIndex: 'field',
  22218. header: '字段', sortable: false, menuDisabled: true,
  22219. width: 190,
  22220. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22221. var column = context.column;
  22222. var propertyConfig = me.config.propertyConfig;
  22223. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22224. var field = record.get('field');
  22225. if (field) {
  22226. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22227. if (idx >= 0) {
  22228. var meta = propertyConfig[idx];
  22229. return meta.text;
  22230. }
  22231. }
  22232. return value;
  22233. }
  22234. },
  22235. {
  22236. dataIndex: 'operator',
  22237. header: '运算符', sortable: false, menuDisabled: true,
  22238. dict: 'operator',
  22239. width: 65,
  22240. editor: { xtype: 'combo' },
  22241. },
  22242. {
  22243. dataIndex: 'value',
  22244. header: '值', sortable: false, menuDisabled: true,
  22245. flex: 1,
  22246. getEditor: function (record) {
  22247. var column = this;
  22248. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22249. var propertyConfig = me.config.propertyConfig;
  22250. var field = record.get('field');
  22251. if (!field) {
  22252. // 没有填 propertyName
  22253. return;
  22254. }
  22255. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22256. if (idx < 0) {
  22257. console.error('没有找到 field=' + field + ". propertyConfig");
  22258. return;
  22259. }
  22260. var meta = propertyConfig[idx];
  22261. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22262. return new Ext.grid.CellEditor({
  22263. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22264. });
  22265. }
  22266. return new Ext.grid.CellEditor({
  22267. field: __assign({ dict: meta.dict }, meta.editor)
  22268. });
  22269. },
  22270. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22271. var column = context.column;
  22272. var grid = _$2.get(view, 'ownerGrid');
  22273. var propertyConfig = me.config.propertyConfig;
  22274. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22275. var field = record.get('field');
  22276. if (field) {
  22277. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22278. if (idx >= 0) {
  22279. var meta = propertyConfig[idx];
  22280. var dictName = _$2.get(meta, 'dict');
  22281. if (dictName && window['DICT_CACHE'][dictName]) {
  22282. var dict_1 = window['DICT_CACHE'][dictName];
  22283. var valueText_1 = [];
  22284. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22285. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22286. if (idxKv >= 0) {
  22287. valueText_1.push(dict_1[idxKv].text);
  22288. }
  22289. else {
  22290. valueText_1.push(value);
  22291. }
  22292. });
  22293. return valueText_1.join(',');
  22294. }
  22295. }
  22296. }
  22297. return valueList;
  22298. },
  22299. },
  22300. ]
  22301. },
  22302. {
  22303. title: 'SQL模式',
  22304. key: 'sql',
  22305. xtype: 'sqleditor',
  22306. reference: reference + '_sql',
  22307. listeners: {
  22308. change: function (sender) {
  22309. var scope = lookupScope(me);
  22310. // 保存 editor 写入的值
  22311. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22312. }
  22313. }
  22314. },
  22315. ]
  22316. }
  22317. ] });
  22318. this.superclass.constructor.call(this, newConfig);
  22319. },
  22320. initComponent: function () {
  22321. // 货位条件树
  22322. var me = this;
  22323. me.superclass.initComponent.apply(this, arguments);
  22324. var tree = this.down('yvtree');
  22325. var config = me.config;
  22326. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22327. },
  22328. });
  22329. function gridChanged(me, grid) {
  22330. var data = grid.getDataRows();
  22331. var propertyConfig = me.config.propertyConfig;
  22332. var bindValue = me.config.bindValue;
  22333. var scope = lookupScope(me);
  22334. var sql = parseGridToSql(data);
  22335. scope.viewModel.set(bindValue, sql);
  22336. }
  22337. /**
  22338. * 用于从 propertyConfig 解析出树形结构
  22339. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22340. * ->
  22341. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22342. */
  22343. function buildConfigTree(propertyConfig) {
  22344. var root = {
  22345. expanded: true,
  22346. leaf: false,
  22347. children: []
  22348. };
  22349. var categoryObj = {};
  22350. var cfgList = propertyConfig;
  22351. _$2.forEach(cfgList, function (cfg) {
  22352. var cateNode = categoryObj[cfg.category];
  22353. if (!cateNode) {
  22354. cateNode = {
  22355. text: cfg.category, expanded: true, leaf: false,
  22356. children: []
  22357. };
  22358. categoryObj[cfg.category] = cateNode;
  22359. root.children.push(cateNode);
  22360. }
  22361. cateNode.children.push({
  22362. text: cfg.text,
  22363. field: cfg.field,
  22364. operator: cfg.operator,
  22365. defaultValue: cfg.defaultValue,
  22366. leaf: true,
  22367. });
  22368. });
  22369. return root;
  22370. }
  22371. /**
  22372. * 将表格变成 SQL where语句 [
  22373. * {field: 'f1', value: 1, operator: '='}
  22374. * {field: 'f2', value: 2, operator: '='}
  22375. * {field: 'f3', value: '3', operator: '>='}
  22376. * {field: 'f4', value: 4, operator: '='}
  22377. * ]
  22378. * ->
  22379. * f1=v1 and f2=v2
  22380. */
  22381. function parseGridToSql(list) {
  22382. var sqls = [];
  22383. _$2.forEach(list, function (i) {
  22384. var _a;
  22385. if (i.operator === 'in') {
  22386. sqls.push(i.field + ' in (' + (i.value) + ')');
  22387. }
  22388. else if (i.operator === 'notIn') {
  22389. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22390. }
  22391. else {
  22392. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22393. }
  22394. });
  22395. return sqls.join(' AND ');
  22396. }
  22397. /**
  22398. * 将 SQL 语句的 where 片段变成表格
  22399. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22400. * @return [
  22401. {field: 'f1', value: 1, operator: '='}
  22402. {field: 'f2', value: 2, operator: '='}
  22403. {field: 'f3', value: '3', operator: '>='}
  22404. {field: 'f4', value: 4, operator: '='}
  22405. ]
  22406. */
  22407. function parseSqlToGrid(sql) {
  22408. if (!sql || !_$2.trim(sql)) {
  22409. return [];
  22410. }
  22411. var parser = new window['NodeSQLParser'].Parser();
  22412. var ast = parser.astify('select * from dual where ' + sql);
  22413. var ret = [];
  22414. exp(ast.where, ret);
  22415. return ret;
  22416. }
  22417. function exp(ast, ret) {
  22418. if (ast.type === 'binary_expr') {
  22419. if (_$2.toUpper(ast.operator) === 'AND') {
  22420. if (ast.left.type === 'binary_expr') {
  22421. exp(ast.left, ret);
  22422. }
  22423. if (ast.right.type === 'binary_expr') {
  22424. exp(ast.right, ret);
  22425. }
  22426. }
  22427. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22428. if (ast.left.type === 'column_ref') {
  22429. if (ast.right.type === 'number' ||
  22430. ast.right.type === 'single_quote_string' ||
  22431. ast.right.type === 'double_quote_string') {
  22432. // 具体值相等
  22433. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22434. }
  22435. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22436. && ast.right.type === 'expr_list') {
  22437. // in / not in
  22438. var valueList_1 = [];
  22439. _$2.forEach(ast.right.value, function (item) {
  22440. valueList_1.push(item.value);
  22441. });
  22442. var operator = void 0;
  22443. if (_$2.toUpper(ast.operator) === 'IN') {
  22444. operator = 'in';
  22445. }
  22446. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22447. operator = 'notIn';
  22448. }
  22449. ret.push({
  22450. field: ast.left.column, value: valueList_1.join(','),
  22451. operator: operator
  22452. });
  22453. }
  22454. else {
  22455. throw new Error('ast.right must is value.');
  22456. }
  22457. }
  22458. else {
  22459. throw new Error('ast.left must is column_ref.');
  22460. }
  22461. }
  22462. else {
  22463. // 必须用 AND 条件符匹配
  22464. throw new Error('ast.operator must is "AND / =".');
  22465. }
  22466. }
  22467. else {
  22468. throw new Error('ast.type must is "binary_expr".');
  22469. }
  22470. }
  22471. /**
  22472. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22473. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22474. {
  22475. type: 'binary_expr',
  22476. operator: 'AND',
  22477. left: {
  22478. type: 'binary_expr',
  22479. operator: 'AND',
  22480. left: {
  22481. type: 'binary_expr',
  22482. operator: 'AND',
  22483. left: {
  22484. type: 'binary_expr',
  22485. operator: 'AND',
  22486. left: {
  22487. type: 'binary_expr',
  22488. operator: '=',
  22489. left: {
  22490. type: 'column_ref',
  22491. table: null,
  22492. column: 'f1'
  22493. },
  22494. right: {
  22495. type: 'number',
  22496. value: 1
  22497. }
  22498. },
  22499. right: {
  22500. type: 'binary_expr',
  22501. operator: '=',
  22502. left: {
  22503. type: 'column_ref',
  22504. table: null,
  22505. column: 'f2'
  22506. },
  22507. right: {
  22508. type: 'number',
  22509. value: 2
  22510. }
  22511. }
  22512. },
  22513. right: {
  22514. type: 'binary_expr',
  22515. operator: '=',
  22516. left: {
  22517. type: 'column_ref',
  22518. table: null,
  22519. column: 'f3'
  22520. },
  22521. right: {
  22522. type: 'single_quote_string',
  22523. value: '3'
  22524. }
  22525. }
  22526. },
  22527. right: {
  22528. type: 'binary_expr',
  22529. operator: '>=',
  22530. left: {
  22531. type: 'column_ref',
  22532. table: null,
  22533. column: 'f4'
  22534. },
  22535. right: {
  22536. type: 'number',
  22537. value: 4
  22538. }
  22539. }
  22540. },
  22541. right: {
  22542. type: 'binary_expr',
  22543. operator: '<',
  22544. left: {
  22545. type: 'column_ref',
  22546. table: null,
  22547. column: 'f4'
  22548. },
  22549. right: {
  22550. type: 'number',
  22551. value: 3
  22552. }
  22553. }
  22554. }
  22555. * */
  22556. }
  22557. //# sourceMappingURL=SqlComplex.js.map
  22558. function initParamComplex () {
  22559. Ext.define('Yvan.ParamComplex', {
  22560. extend: 'Ext.panel.Panel',
  22561. xtype: 'paramcomplex',
  22562. alias: 'widget.paramcomplex',
  22563. getSqlExpress: function () {
  22564. },
  22565. constructor: function (config) {
  22566. var reference = config.reference;
  22567. var me = this;
  22568. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22569. {
  22570. region: 'west',
  22571. width: 280,
  22572. border: false,
  22573. split: true,
  22574. reference: reference + '_tree',
  22575. xtype: 'yvtree',
  22576. hideRefresh: true,
  22577. hideExpand: true,
  22578. hideCollapse: true,
  22579. listeners: {
  22580. itemdblclick: function (sender, record, item, index, e) {
  22581. var field = record.get('field');
  22582. var defaultValue = record.get('defaultValue');
  22583. if (!field) {
  22584. return;
  22585. }
  22586. var tabExpress = me.down('tabpanel');
  22587. var sqleditor = me.down('sqleditor');
  22588. var expressGrid = me.down('yvgrid');
  22589. if (tabExpress.getActiveTab().key !== 'grid') {
  22590. // SQL 模式
  22591. sqleditor.insertText(field + '=');
  22592. }
  22593. else {
  22594. // 表格模式
  22595. expressGrid.appendEditRow({
  22596. field: field,
  22597. operator: '=',
  22598. value: defaultValue,
  22599. remark: '',
  22600. });
  22601. _$2.defer(function () {
  22602. gridChanged(me, expressGrid);
  22603. });
  22604. }
  22605. }
  22606. },
  22607. },
  22608. {
  22609. region: 'center',
  22610. xtype: 'tabpanel',
  22611. reference: reference + '_tab',
  22612. tabPosition: 'bottom',
  22613. listeners: {
  22614. afterrender: function (sender) {
  22615. var scope = lookupScope(me);
  22616. var value = scope.viewModel.get(me.config.bindValue);
  22617. // sql 转换为 grid
  22618. try {
  22619. var list_1 = parseParamToGrid(value);
  22620. _$2.defer(function () {
  22621. var grid = me.down('yvgrid');
  22622. grid.setData(list_1);
  22623. });
  22624. }
  22625. catch (e) {
  22626. console.error(e);
  22627. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22628. var tabSql = sender.down('sqleditor');
  22629. sender.setActiveTab(tabSql);
  22630. }
  22631. },
  22632. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22633. var scope = lookupScope(me);
  22634. var value = scope.viewModel.get(me.config.bindValue);
  22635. if (newCard.key === 'grid') {
  22636. // sql 转换为 grid
  22637. try {
  22638. var list_2 = parseParamToGrid(value);
  22639. _$2.defer(function () {
  22640. var grid = me.down('yvgrid');
  22641. grid.setData(list_2);
  22642. });
  22643. return true;
  22644. }
  22645. catch (e) {
  22646. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22647. console.error(e);
  22648. return false;
  22649. }
  22650. }
  22651. else if (newCard.key === 'sql') {
  22652. // grid 转换为 sql
  22653. _$2.defer(function () {
  22654. var editor = me.down('sqleditor');
  22655. editor.setValue(value);
  22656. });
  22657. return true;
  22658. }
  22659. }
  22660. },
  22661. items: [
  22662. {
  22663. title: '表格模式',
  22664. key: 'grid',
  22665. xtype: 'yvgrid',
  22666. _mode: 'select',
  22667. reference: reference + '_grid',
  22668. hideFootbar: true,
  22669. pagination: false,
  22670. tbar: [
  22671. {
  22672. xtype: 'button',
  22673. text: '删除',
  22674. iconCls: 'x-fa fa-minus-circle',
  22675. cls: 'ext-btn-danger',
  22676. bind: {
  22677. disabled: '{!' + reference + '_grid.selection}',
  22678. },
  22679. listeners: {
  22680. click: function (sender) {
  22681. var grid = sender.up('yvgrid');
  22682. removeGridRow(grid);
  22683. gridChanged(me, grid);
  22684. }
  22685. },
  22686. },
  22687. ],
  22688. store: {},
  22689. listeners: {
  22690. editfinish: function (sender) {
  22691. gridChanged(me, sender);
  22692. },
  22693. },
  22694. columns: [
  22695. {
  22696. dataIndex: 'field',
  22697. header: '字段', sortable: false, menuDisabled: true,
  22698. width: 190,
  22699. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22700. var column = context.column;
  22701. var propertyConfig = me.config.propertyConfig;
  22702. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22703. var field = record.get('field');
  22704. if (field) {
  22705. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22706. if (idx >= 0) {
  22707. var meta = propertyConfig[idx];
  22708. return meta.text;
  22709. }
  22710. }
  22711. return value;
  22712. }
  22713. },
  22714. {
  22715. dataIndex: 'value',
  22716. header: '值', sortable: false, menuDisabled: true,
  22717. flex: 1,
  22718. getEditor: function (record) {
  22719. var column = this;
  22720. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22721. var propertyConfig = me.config.propertyConfig;
  22722. var field = record.get('field');
  22723. if (!field) {
  22724. // 没有填 propertyName
  22725. return;
  22726. }
  22727. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22728. if (idx < 0) {
  22729. console.error('没有找到 field=' + field + ". propertyConfig");
  22730. return;
  22731. }
  22732. var meta = propertyConfig[idx];
  22733. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22734. return new Ext.grid.CellEditor({
  22735. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22736. });
  22737. }
  22738. return new Ext.grid.CellEditor({
  22739. field: __assign({ dict: meta.dict }, meta.editor)
  22740. });
  22741. },
  22742. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22743. var column = context.column;
  22744. var grid = _$2.get(view, 'ownerGrid');
  22745. var propertyConfig = me.config.propertyConfig;
  22746. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22747. var field = record.get('field');
  22748. if (field) {
  22749. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22750. if (idx >= 0) {
  22751. var meta = propertyConfig[idx];
  22752. var dictName = _$2.get(meta, 'dict');
  22753. if (dictName && window['DICT_CACHE'][dictName]) {
  22754. var dict_1 = window['DICT_CACHE'][dictName];
  22755. var valueText_1 = [];
  22756. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22757. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22758. if (idxKv >= 0) {
  22759. valueText_1.push(dict_1[idxKv].text);
  22760. }
  22761. else {
  22762. valueText_1.push(value);
  22763. }
  22764. });
  22765. return valueText_1.join(',');
  22766. }
  22767. }
  22768. }
  22769. return valueList;
  22770. },
  22771. },
  22772. ]
  22773. },
  22774. {
  22775. title: '文本模式',
  22776. key: 'sql',
  22777. xtype: 'sqleditor',
  22778. reference: reference + '_sql',
  22779. listeners: {
  22780. change: function (sender) {
  22781. var scope = lookupScope(me);
  22782. // 保存 editor 写入的值
  22783. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22784. }
  22785. }
  22786. },
  22787. ]
  22788. }
  22789. ] });
  22790. this.superclass.constructor.call(this, newConfig);
  22791. },
  22792. initComponent: function () {
  22793. // 货位条件树
  22794. var me = this;
  22795. me.superclass.initComponent.apply(this, arguments);
  22796. var tree = this.down('yvtree');
  22797. var config = me.config;
  22798. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22799. },
  22800. });
  22801. function gridChanged(me, grid) {
  22802. var data = grid.getDataRows();
  22803. var propertyConfig = me.config.propertyConfig;
  22804. var bindValue = me.config.bindValue;
  22805. var scope = lookupScope(me);
  22806. var sql = parseGridToParam(data);
  22807. scope.viewModel.set(bindValue, sql);
  22808. }
  22809. /**
  22810. * 用于从 propertyConfig 解析出树形结构
  22811. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22812. * ->
  22813. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22814. */
  22815. function buildConfigTree(propertyConfig) {
  22816. var root = {
  22817. expanded: true,
  22818. leaf: false,
  22819. children: []
  22820. };
  22821. var categoryObj = {};
  22822. var cfgList = propertyConfig;
  22823. _$2.forEach(cfgList, function (cfg) {
  22824. var cateNode = categoryObj[cfg.category];
  22825. if (!cateNode) {
  22826. cateNode = {
  22827. text: cfg.category, expanded: true, leaf: false,
  22828. children: []
  22829. };
  22830. categoryObj[cfg.category] = cateNode;
  22831. root.children.push(cateNode);
  22832. }
  22833. cateNode.children.push({
  22834. text: cfg.text,
  22835. field: cfg.field,
  22836. operator: cfg.operator,
  22837. defaultValue: cfg.defaultValue,
  22838. leaf: true,
  22839. });
  22840. });
  22841. return root;
  22842. }
  22843. /**
  22844. * 将表格变成参数语句 [
  22845. * {field: 'f1', value: 1}
  22846. * {field: 'f2', value: 2}
  22847. * {field: 'f3', value: '3'}
  22848. * {field: 'f4', value: 4}
  22849. * ]
  22850. * ->
  22851. * f1=v1, f2=v2
  22852. */
  22853. function parseGridToParam(list) {
  22854. var sqls = [];
  22855. _$2.forEach(list, function (i) {
  22856. sqls.push(i.field + '=' + (i.value));
  22857. });
  22858. return sqls.join('; ');
  22859. }
  22860. /**
  22861. * 将 分号分割的的参数设置 变成表格
  22862. * @param param a=1; b=2; c='3'
  22863. * @return [
  22864. {field: 'a', value: 1}
  22865. {field: 'b', value: 2}
  22866. {field: 'c', value: '3'}
  22867. ]
  22868. */
  22869. function parseParamToGrid(param) {
  22870. if (!param || !_$2.trim(param)) {
  22871. return [];
  22872. }
  22873. var ret = [];
  22874. var sp = _$2.split(param, ';');
  22875. _$2.forEach(sp, function (v) {
  22876. var vi = _$2.indexOf(v, '=');
  22877. var field = _$2.trim(v.substr(0, vi));
  22878. var value = eval(v.substr(vi + 1));
  22879. ret.push({ field: field, value: value });
  22880. });
  22881. return ret;
  22882. }
  22883. }
  22884. //# sourceMappingURL=ParamComplex.js.map
  22885. function initSqlEditor () {
  22886. Ext.define('com.yvan.studio.SqlEditor', {
  22887. extend: 'Ext.panel.Panel',
  22888. alias: 'widget.sqleditor',
  22889. xtype: 'sqleditor',
  22890. layout: 'fit',
  22891. border: false,
  22892. html: "<div class=\"editor\"/>",
  22893. config: {
  22894. value: ''
  22895. },
  22896. codeChange: undefined,
  22897. isChangeFromOuter: false,
  22898. setCode: function (value) {
  22899. var _this = this;
  22900. this.code = value;
  22901. this.value = value;
  22902. _$2.defer(function () {
  22903. _this.isChangeFromOuter = true;
  22904. if (_this.editor) {
  22905. _this.editor.setValue(value);
  22906. }
  22907. });
  22908. },
  22909. getCode: function () {
  22910. return this.getValue();
  22911. },
  22912. updateOptions: function (options) {
  22913. if (this.editor && options) {
  22914. this.editor.updateOptions(options);
  22915. }
  22916. },
  22917. getValue: function () {
  22918. if (!this.editor) {
  22919. return this.code;
  22920. }
  22921. return this.editor.getValue();
  22922. },
  22923. applyPosition: function () {
  22924. var _this = this;
  22925. if (this.autoFocusMethod) {
  22926. if (this.editor) {
  22927. _$2.defer(function () {
  22928. if (_this.autoFocusStartLine) {
  22929. _this.editor.setPosition({
  22930. lineNumber: _this.autoFocusStartLine,
  22931. column: _this.autoFocusStartColumn
  22932. });
  22933. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22934. }
  22935. _this.editor.focus();
  22936. });
  22937. delete this.autoFocusMethod;
  22938. }
  22939. }
  22940. this.editor.layout();
  22941. },
  22942. insertText: function (text) {
  22943. var editor = this.editor;
  22944. var position = editor.getPosition();
  22945. editor.executeEdits('', [
  22946. {
  22947. range: {
  22948. startLineNumber: position.lineNumber,
  22949. startColumn: position.column,
  22950. endLineNumber: position.lineNumber,
  22951. endColumn: position.column
  22952. },
  22953. text: text
  22954. }
  22955. ]);
  22956. },
  22957. setValue: function (value, fromEditor) {
  22958. this.setCode(value);
  22959. var me = this;
  22960. if (me.value === value) {
  22961. // 值相等,不需要变化
  22962. return;
  22963. }
  22964. if (fromEditor !== true && me.editor) {
  22965. // 不是来源于编辑器的变化,才设置编辑器的值
  22966. me.editor.setValue(value);
  22967. }
  22968. // 通知mixins setValue
  22969. me.value = value;
  22970. me.fireEvent('change', value);
  22971. },
  22972. initComponent: function () {
  22973. var that = this;
  22974. this.superclass.initComponent.call(this);
  22975. that.on({
  22976. resize: function () {
  22977. if (that.editor) {
  22978. that.editor.layout();
  22979. }
  22980. },
  22981. destory: function () {
  22982. if (that.editor) {
  22983. that.editor.dispose();
  22984. delete that.editor;
  22985. }
  22986. },
  22987. afterrender: function (sender) {
  22988. var $dom = $(that.el.dom).find('.editor');
  22989. attach_2($dom[0], {
  22990. value: that.code
  22991. }).then(function (editor) {
  22992. that.editor = editor;
  22993. that.applyPosition();
  22994. that.editor.onDidChangeModelContent(function (e) {
  22995. that.fireEvent('change', that.editor, e);
  22996. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22997. that.codeChange(that.editor.getValue(), that.name, e);
  22998. }
  22999. that.isChangeFromOuter = false;
  23000. });
  23001. });
  23002. }
  23003. });
  23004. }
  23005. });
  23006. function attach_2(element, opts) {
  23007. if (!window['monaco']) {
  23008. return;
  23009. }
  23010. var monaco = window['monaco'];
  23011. return new Promise(function (resolve) {
  23012. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  23013. enabled: false
  23014. } }));
  23015. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  23016. // const sql = editor.getValue()
  23017. // if (_.trim(sql).length > 0) {
  23018. // editor.setValue(format(sql, {
  23019. // indent: ' ',
  23020. // uppercase: true,
  23021. // }))
  23022. // }
  23023. // })
  23024. editor.onKeyUp(function (e) {
  23025. // console.log(e)
  23026. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23027. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23028. }
  23029. });
  23030. resolve(editor);
  23031. });
  23032. }
  23033. }
  23034. //# sourceMappingURL=SqlEditor.js.map
  23035. function initJsonEditor () {
  23036. Ext.define('com.yvan.studio.JsonEditor', {
  23037. extend: 'Ext.panel.Panel',
  23038. alias: 'widget.jsoneditor',
  23039. xtype: 'jsoneditor',
  23040. layout: 'fit',
  23041. border: false,
  23042. html: "<div class=\"editor\"/>",
  23043. autoFocusMethod: true,
  23044. autoFocusStartLine: 0,
  23045. autoFocusStartColumn: 0,
  23046. codeChange: undefined,
  23047. funcArr: [],
  23048. modulePage: null,
  23049. isChangeFromOuter: false,
  23050. name: "",
  23051. /**
  23052. * 设置代码
  23053. */
  23054. setCode: function (value) {
  23055. var _this = this;
  23056. this.code = value;
  23057. _$2.defer(function () {
  23058. _this.isChangeFromOuter = true;
  23059. if (_this.editor) {
  23060. _this.editor.setValue(value);
  23061. }
  23062. });
  23063. },
  23064. updateOptions: function (options) {
  23065. if (this.editor && options) {
  23066. this.editor.updateOptions(options);
  23067. }
  23068. },
  23069. setLanguage: function (lang) {
  23070. if (!window['monaco']) {
  23071. return;
  23072. }
  23073. var monaco = window['monaco'];
  23074. if (this.editor && lang) {
  23075. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23076. }
  23077. },
  23078. getCode: function () {
  23079. var _a;
  23080. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23081. },
  23082. applyPosition: function () {
  23083. var _this = this;
  23084. if (this.autoFocusMethod) {
  23085. if (this.editor) {
  23086. _$2.defer(function () {
  23087. if (_this.autoFocusStartLine) {
  23088. _this.editor.setPosition({
  23089. lineNumber: _this.autoFocusStartLine,
  23090. column: _this.autoFocusStartColumn
  23091. });
  23092. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23093. }
  23094. _this.editor.focus();
  23095. });
  23096. delete this.autoFocusMethod;
  23097. }
  23098. }
  23099. this.editor.layout();
  23100. },
  23101. initComponent: function () {
  23102. var that = this;
  23103. this.superclass.initComponent.apply(this, arguments);
  23104. this.on({
  23105. resize: function (sender, width, height) {
  23106. if (that.editor) {
  23107. that.editor.layout();
  23108. }
  23109. },
  23110. destory: function () {
  23111. if (that.editor) {
  23112. that.editor.dispose();
  23113. delete that.editor;
  23114. }
  23115. },
  23116. afterrender: function (sender) {
  23117. var $dom = $(that.el.dom).find('.editor');
  23118. attach_116($dom[0], {
  23119. value: that.code
  23120. }).then(function (editor) {
  23121. that.editor = editor;
  23122. that.applyPosition();
  23123. that.editor.onDidChangeModelContent(function (e) {
  23124. that.fireEvent('change', that.editor, e);
  23125. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23126. that.codeChange(that.editor.getValue(), that.name, e);
  23127. }
  23128. that.isChangeFromOuter = false;
  23129. });
  23130. });
  23131. }
  23132. });
  23133. },
  23134. });
  23135. function attach_116(element, opts) {
  23136. if (!window['monaco']) {
  23137. return;
  23138. }
  23139. var monaco = window['monaco'];
  23140. return new Promise(function (resolve) {
  23141. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23142. enabled: false
  23143. } }));
  23144. editor.onKeyUp(function (e) {
  23145. // console.log(e)
  23146. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23147. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23148. }
  23149. });
  23150. resolve(editor);
  23151. });
  23152. }
  23153. }
  23154. //# sourceMappingURL=JsonEditor.js.map
  23155. function initJsEditor () {
  23156. Ext.define('com.yvan.studio.JsEditor', {
  23157. extend: 'Ext.panel.Panel',
  23158. alias: 'widget.jseditor',
  23159. xtype: 'jseditor',
  23160. layout: 'fit',
  23161. border: false,
  23162. html: "<div class=\"editor\"/>",
  23163. autoFocusMethod: true,
  23164. autoFocusStartLine: 0,
  23165. autoFocusStartColumn: 0,
  23166. codeChange: undefined,
  23167. funcArr: [],
  23168. modulePage: null,
  23169. isChangeFromOuter: false,
  23170. name: "",
  23171. /**
  23172. * 设置代码
  23173. */
  23174. setCode: function (value) {
  23175. var _this = this;
  23176. this.code = value;
  23177. _$2.defer(function () {
  23178. _this.isChangeFromOuter = true;
  23179. if (_this.editor) {
  23180. _this.editor.setValue(value);
  23181. if (_this.name === "controllerEditor") {
  23182. _this.funcArr = _this.getAllFunction();
  23183. }
  23184. }
  23185. });
  23186. },
  23187. getCode: function () {
  23188. var _a;
  23189. if (!this.editor) {
  23190. return this.code;
  23191. }
  23192. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23193. },
  23194. applyPosition: function () {
  23195. var _this = this;
  23196. if (this.autoFocusMethod) {
  23197. if (this.editor) {
  23198. _$2.defer(function () {
  23199. if (_this.autoFocusStartLine) {
  23200. _this.editor.setPosition({
  23201. lineNumber: _this.autoFocusStartLine,
  23202. column: _this.autoFocusStartColumn
  23203. });
  23204. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23205. }
  23206. _this.editor.focus();
  23207. });
  23208. delete this.autoFocusMethod;
  23209. }
  23210. }
  23211. this.editor.layout();
  23212. },
  23213. initComponent: function () {
  23214. var that = this;
  23215. this.superclass.initComponent.apply(this, arguments);
  23216. this.on({
  23217. resize: function (sender, width, height) {
  23218. if (that.editor) {
  23219. that.editor.layout();
  23220. }
  23221. },
  23222. destory: function () {
  23223. if (that.editor) {
  23224. that.editor.dispose();
  23225. delete that.editor;
  23226. }
  23227. },
  23228. afterrender: function () {
  23229. var $dom = $(that.el.dom).find('.editor');
  23230. attach_1($dom[0], {
  23231. value: that.code
  23232. }).then(function (editor) {
  23233. that.editor = editor;
  23234. that.applyPosition();
  23235. that.editor.onDidChangeModelContent(function (e) {
  23236. that.fireEvent('change', that.editor, e);
  23237. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23238. that.codeChange(that.editor.getValue(), that.name, e);
  23239. }
  23240. that.isChangeFromOuter = false;
  23241. });
  23242. });
  23243. }
  23244. });
  23245. },
  23246. getAllFunction: function () {
  23247. var funcArr = [];
  23248. var ast = window['YvanUI'].recast.parse(this.code);
  23249. if (ast && ast.program && ast.program.body) {
  23250. if (Array.isArray(ast.program.body)) {
  23251. for (var i = 0; i < ast.program.body.length; i++) {
  23252. var m = ast.program.body[i];
  23253. if (m.type === "ExportDefaultDeclaration") {
  23254. if (m.declaration.type === "ClassDeclaration") {
  23255. if (m.declaration.body.type === "ClassBody") {
  23256. if (Array.isArray(m.declaration.body.body)) {
  23257. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23258. var ob = m.declaration.body.body[j];
  23259. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23260. var funcItem = { name: ob.key.name, args: [] };
  23261. if (Array.isArray(ob.value.params)) {
  23262. for (var k = 0; k < ob.value.params.length; k++) {
  23263. var p = ob.value.params[k];
  23264. funcItem.args.push(p.name);
  23265. }
  23266. }
  23267. funcArr.push(funcItem);
  23268. }
  23269. }
  23270. }
  23271. }
  23272. }
  23273. }
  23274. }
  23275. }
  23276. }
  23277. return funcArr;
  23278. }
  23279. });
  23280. var isInited = false;
  23281. function attach_1(element, opts) {
  23282. if (!window['monaco']) {
  23283. return;
  23284. }
  23285. var monaco = window['monaco'];
  23286. return new Promise(function (resolve) {
  23287. if (!isInited) {
  23288. isInited = true;
  23289. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23290. noSemanticValidation: true,
  23291. noSyntaxValidation: false
  23292. });
  23293. // compiler options
  23294. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23295. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23296. allowNonTsExtensions: true,
  23297. });
  23298. // extra libraries
  23299. var libSource = [
  23300. 'declare class Facts {',
  23301. ' /**',
  23302. ' * Returns the next fact',
  23303. ' */',
  23304. ' static next():string',
  23305. ' static next222():string',
  23306. '}',
  23307. "\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 ",
  23308. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23309. ].join('\n');
  23310. var libUri = 'file:///index.d.ts';
  23311. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23312. // When resolving definitions and references, the editor will try to use created models.
  23313. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23314. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23315. }
  23316. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23317. resolve(editor);
  23318. });
  23319. }
  23320. }
  23321. //# sourceMappingURL=JsEditor.js.map
  23322. function initClipboard () {
  23323. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23324. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23325. Ext.grid.plugin.Clipboard.override({
  23326. getCellData: function (format, erase) {
  23327. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23328. if (selection) {
  23329. selection.eachCell(function (cellContext) {
  23330. column = cellContext.column;
  23331. view = cellContext.column.getView();
  23332. record = cellContext.record;
  23333. // Do not copy the check column or row numberer column
  23334. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23335. return;
  23336. }
  23337. if (lastRecord !== record) {
  23338. lastRecord = record;
  23339. ret.push(row = []);
  23340. }
  23341. dataIndex = column.dataIndex;
  23342. // 记录原始数据
  23343. var rData = record.data[dataIndex];
  23344. if (isRaw) {
  23345. data = record.data[dataIndex];
  23346. }
  23347. else {
  23348. // Try to access the view node.
  23349. viewNode = view.all.item(cellContext.rowIdx);
  23350. // If we could not, it's because it's outside of the rendered block -
  23351. // recreate it.
  23352. if (!viewNode) {
  23353. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23354. }
  23355. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23356. data = cell.innerHTML;
  23357. if (isText) {
  23358. data = Ext.util.Format.stripTags(data);
  23359. }
  23360. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23361. data = data || rData;
  23362. }
  23363. row.push(data);
  23364. if (erase && dataIndex) {
  23365. record.set(dataIndex, null);
  23366. }
  23367. });
  23368. }
  23369. // See decode() comment below
  23370. return Ext.util.TSV.encode(ret, undefined, null);
  23371. },
  23372. getCells: function (format, erase) {
  23373. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23374. if (selection) {
  23375. selection.eachCell(function (cellContext) {
  23376. record = cellContext.record;
  23377. if (lastRecord !== record) {
  23378. lastRecord = record;
  23379. ret.push(row = {
  23380. model: record.self,
  23381. fields: []
  23382. });
  23383. }
  23384. dataIndex = cellContext.column.dataIndex;
  23385. row.fields.push({
  23386. name: dataIndex,
  23387. value: record.data[dataIndex]
  23388. });
  23389. if (erase && dataIndex) {
  23390. record.set(dataIndex, null);
  23391. }
  23392. });
  23393. }
  23394. return ret;
  23395. },
  23396. getTextData: function (format, erase) {
  23397. return this.getCellData(format, erase);
  23398. },
  23399. putCellData: function (data, format) {
  23400. var _a;
  23401. 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 = {};
  23402. // If the view is not focused, use the first cell of the selection as the destination.
  23403. if (!destination && selected) {
  23404. selected.eachCell(function (c) {
  23405. destination = c;
  23406. return false;
  23407. });
  23408. }
  23409. if (destination) {
  23410. // Create a new Context based upon the outermost View.
  23411. // NavigationModel works on local views.
  23412. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23413. // At that point, we can use navModel.getPosition()
  23414. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23415. }
  23416. else {
  23417. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23418. }
  23419. destinationStartColumn = destination.colIdx;
  23420. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23421. row = values[sourceRowIdx];
  23422. // Collect new values in dataObject
  23423. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23424. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23425. continue;
  23426. }
  23427. dataIndex = destination.column.dataIndex;
  23428. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23429. if (dataIndex) {
  23430. switch (format) {
  23431. // Raw field values
  23432. case 'raw':
  23433. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23434. break;
  23435. // Textual data with HTML tags stripped
  23436. case 'text':
  23437. {
  23438. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23439. // 获取字典原始的value
  23440. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23441. }
  23442. else {
  23443. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23444. }
  23445. break;
  23446. }
  23447. }
  23448. }
  23449. // If we are at the end of the destination row, break the column loop.
  23450. if (destination.colIdx === maxColIdx) {
  23451. break;
  23452. }
  23453. destination.setColumn(destination.colIdx + 1);
  23454. }
  23455. // Update the record in one go.
  23456. destination.record.set(dataObject);
  23457. // If we are at the end of the destination store, break the row loop.
  23458. if (destination.rowIdx === maxRowIdx) {
  23459. break;
  23460. }
  23461. // Jump to next row in destination
  23462. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23463. }
  23464. },
  23465. putTextData: function (data, format) {
  23466. var _a, _b, _c;
  23467. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23468. // 根据复制的行数自动添加新的行
  23469. 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;
  23470. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23471. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23472. this.cmp.getStore().add({});
  23473. }
  23474. }
  23475. this.putCellData(data, format);
  23476. },
  23477. });
  23478. }
  23479. //# sourceMappingURL=clipboard.js.map
  23480. function initDict () {
  23481. var DICT_CACHE = window['DICT_CACHE'];
  23482. if (!DICT_CACHE) {
  23483. DICT_CACHE = {};
  23484. window['DICT_CACHE'] = DICT_CACHE;
  23485. }
  23486. DICT_CACHE.XTYPE = [
  23487. { id: 'datefield', text: '日期' },
  23488. { id: 'datetimefield', text: '日期时间' },
  23489. { id: 'textfield', text: '文本' },
  23490. { id: 'numberfield', text: '数字' },
  23491. { id: 'combo', text: '下拉框' },
  23492. ];
  23493. DICT_CACHE.operator = [
  23494. { id: '=', text: '=' },
  23495. { id: '>', text: '>' },
  23496. { id: '<', text: '<' },
  23497. { id: '>=', text: '>=' },
  23498. { id: '<=', text: '<=' },
  23499. { id: 'in', text: 'in' },
  23500. { id: 'notIn', text: 'notIn' },
  23501. ];
  23502. DICT_CACHE.GRID_MODE = [
  23503. { id: 'edit1', text: '单机编辑模式' },
  23504. { id: 'edit2', text: '双击编辑模式' },
  23505. { id: 'checkbox', text: '勾选' },
  23506. { id: 'checkonly', text: '只勾选' },
  23507. { id: 'select', text: '行选择模式' },
  23508. ];
  23509. DICT_CACHE.BOTH_SELECT = [
  23510. { id: 'N/A', text: '<无>' },
  23511. { id: 'textfield', text: '文本' },
  23512. { id: 'numberfield', text: '数字框' },
  23513. { id: 'datefield', text: '日期' },
  23514. { id: 'datetimefield', text: '日期时间' },
  23515. { id: 'combo', text: '下拉框' },
  23516. { id: 'combogrid', text: '下拉表' },
  23517. { id: 'checkbox', text: '勾选' },
  23518. ];
  23519. DICT_CACHE.ROW_LAYOUT = [
  23520. { id: 'flex', text: '按权重摆放' },
  23521. { id: 'hbox', text: '按宽度摆放' },
  23522. ];
  23523. DICT_CACHE.GRID_XTYPE = [
  23524. { id: 'N/A', text: '<无>' },
  23525. { id: 'textfield', text: '文本-textfield' },
  23526. { id: 'numberfield', text: '数字框-numberfield' },
  23527. { id: 'datefield', text: '日期-datefield' },
  23528. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23529. { id: 'combo', text: '下拉框-combo' },
  23530. { id: 'combogrid', text: '下拉表-combogrid' },
  23531. { id: 'checkbox', text: '勾选-checkbox' },
  23532. ];
  23533. DICT_CACHE.FORM_XTYPE = [
  23534. { id: 'N/A', text: '<无>' },
  23535. { id: 'textfield', text: '文本-textfield' },
  23536. { id: 'numberfield', text: '数字框-numberfield' },
  23537. { id: 'datefield', text: '日期-datefield' },
  23538. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23539. { id: 'combo', text: '下拉框-combo' },
  23540. { id: 'combogrid', text: '下拉表-combogrid' },
  23541. { id: 'checkbox', text: '勾选-checkbox' },
  23542. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23543. ];
  23544. DICT_CACHE.GRID_FORMATTER = [
  23545. { id: 'N/A', text: '默认' },
  23546. { id: 'rownum', text: '序号-rownum' },
  23547. { id: 'button', text: '按钮-button' },
  23548. { id: 'checkbox', text: '勾选-checkbox' },
  23549. { id: 'progres', text: '进度条-progres' },
  23550. ];
  23551. }
  23552. //# sourceMappingURL=dict.js.map
  23553. function initDesigner () {
  23554. Ext.define('com.yvan.studio.designer', {
  23555. extend: 'Ext.panel.Panel',
  23556. alias: 'widget.designer',
  23557. xtype: 'designer',
  23558. layout: 'fit',
  23559. items: [],
  23560. constructor: function (config) {
  23561. var self = this;
  23562. var newConfig = _$2.defaultsDeep({
  23563. // 强制性属性
  23564. }, config);
  23565. this.superclass.constructor.call(self, newConfig);
  23566. },
  23567. initComponent: function () {
  23568. var me = this;
  23569. me.on({
  23570. afterrender: function () {
  23571. }
  23572. });
  23573. this.superclass.initComponent.call(me);
  23574. }
  23575. });
  23576. }
  23577. //# sourceMappingURL=designer.js.map
  23578. var FixClass = /** @class */ (function () {
  23579. function FixClass() {
  23580. }
  23581. FixClass.prototype.fix = function (me, config) {
  23582. var _this = this;
  23583. if (isDesignMode(me, config)) {
  23584. return;
  23585. }
  23586. if (!config) {
  23587. return;
  23588. }
  23589. var fix = config.fix;
  23590. if (!fix) {
  23591. return;
  23592. }
  23593. delete config.fix;
  23594. // 这里有个 bug
  23595. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23596. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23597. var scope;
  23598. if (config.$initParent) {
  23599. // 在面板上的组件
  23600. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23601. }
  23602. else if (config.column) {
  23603. // 在列上的组件
  23604. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23605. }
  23606. if (_$2.isArray(fix)) {
  23607. _$2.each(fix, function (f) {
  23608. var fn = lookupFn(scope, f);
  23609. fn.call(_this, me, config);
  23610. });
  23611. }
  23612. else if (_$2.isString(fix)) {
  23613. var fn = lookupFn(scope, fix);
  23614. fn.call(this, me, config);
  23615. }
  23616. };
  23617. __decorate([
  23618. baseConfigProcess(),
  23619. __metadata("design:type", Function),
  23620. __metadata("design:paramtypes", [Object, Object]),
  23621. __metadata("design:returntype", void 0)
  23622. ], FixClass.prototype, "fix", null);
  23623. return FixClass;
  23624. }());
  23625. //# sourceMappingURL=fix.js.map
  23626. function init$1() {
  23627. // 引入 filters 过滤插件
  23628. Ext.require([
  23629. 'Ext.grid.filters.Filters'
  23630. ]);
  23631. // 启用 tooltip 快捷提示
  23632. Ext.QuickTips.init();
  23633. // 定义日期格式化方法
  23634. if (Ext.util && Ext.util.Format) {
  23635. Ext.apply(Ext.util.Format, {
  23636. dateFormat: 'Y-m-d'
  23637. });
  23638. }
  23639. Ext.form.field.Display.override({
  23640. cls: 'yvan-display-field',
  23641. labelAlign: 'right'
  23642. });
  23643. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23644. override: "Ext.picker.Date",
  23645. format: "Y-m-d",
  23646. });
  23647. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23648. override: "Ext.form.field.Date",
  23649. format: "Y-m-d",
  23650. });
  23651. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23652. override: "Ext.grid.PropertyColumnModel",
  23653. format: "Y-m-d",
  23654. });
  23655. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23656. override: "Ext.view.AbstractView",
  23657. loadingText: "读取中..."
  23658. });
  23659. Ext.LoadMask.prototype.msg = '请稍后...';
  23660. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23661. override: "Ext.grid.header.Container",
  23662. sortClearText: '不排序',
  23663. sortAscText: "正序",
  23664. sortDescText: "倒序",
  23665. lockText: "锁定列",
  23666. unlockText: "解除锁定",
  23667. columnsText: "字段隐藏"
  23668. });
  23669. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23670. override: "Ext.grid.filters.filter.Date",
  23671. fields: {
  23672. lt: { text: '之前' },
  23673. gt: { text: '之后' },
  23674. eq: { text: '相等' },
  23675. },
  23676. // Defaults to Ext.Date.defaultFormat
  23677. dateFormat: null
  23678. });
  23679. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23680. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23681. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23682. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23683. override: "Ext.grid.locking.Lockable",
  23684. lockText: "锁定",
  23685. unlockText: '解锁',
  23686. });
  23687. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23688. override: "Ext.grid.filters.Filters",
  23689. menuFilterText: "过滤"
  23690. });
  23691. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23692. override: "Ext.grid.filters.filter.Boolean",
  23693. yesText: "已钩选",
  23694. noText: "未勾选"
  23695. });
  23696. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23697. override: "Ext.grid.filters.filter.String",
  23698. emptyText: "输入过滤文本..."
  23699. });
  23700. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23701. override: "Ext.grid.filters.filter.Number",
  23702. emptyText: "输入数字..."
  23703. });
  23704. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23705. override: "Ext.PagingToolbar",
  23706. beforePageText: "第",
  23707. // update
  23708. afterPageText: "/ {0} 页",
  23709. // update
  23710. firstText: "第一页",
  23711. prevText: "上一页",
  23712. // update
  23713. nextText: "下一页",
  23714. lastText: "最后页",
  23715. refreshText: "刷新",
  23716. displayMsg: "总共 {2} 条",
  23717. // update
  23718. emptyMsg: '没有数据'
  23719. });
  23720. /**
  23721. * 改变事件的获取方式.
  23722. * 具体见: ext-all-debug.js:23216 addListener
  23723. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23724. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23725. */
  23726. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23727. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23728. if (typeof fn === 'string' &&
  23729. (_$2.startsWith(fn, 'scope.') ||
  23730. _$2.startsWith(fn, 'system.') ||
  23731. _$2.startsWith(fn, 'format.'))) {
  23732. scope = lookupScope(this);
  23733. if (isDesignMode(scope, undefined)) {
  23734. fn = Ext.emptyFn;
  23735. }
  23736. else {
  23737. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23738. // const vm = this.lookupViewModel()
  23739. // if (vm && vm.yvanScope) {
  23740. // scope = vm.yvanScope
  23741. // fn = scope[fn.substr('scope.'.length)]
  23742. // }
  23743. fn = lookupFn(scope, fn, this);
  23744. }
  23745. }
  23746. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23747. };
  23748. // 将 SystemLib 扩展到 window.system 下
  23749. if (!window['system']) {
  23750. window['system'] = {};
  23751. }
  23752. _$2.extend(window['system'], SystemLib);
  23753. _$2.extend(window['system'], {
  23754. showGridRowDetail: showGridRowDetail
  23755. });
  23756. Ext.apply(Ext.util.Format, {
  23757. // 百分比
  23758. percentRenderer: function (v, rd, model) {
  23759. if (!v) {
  23760. v = 0;
  23761. }
  23762. if (typeof v === 'string') {
  23763. v = parseInt(v);
  23764. }
  23765. var valueString = v.toFixed(2);
  23766. var valueFixed = v > 100 ? 100 : v;
  23767. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23768. var cls = '';
  23769. if (v < 90) {
  23770. cls = 'danger';
  23771. }
  23772. else if (v < 100) {
  23773. cls = 'warning';
  23774. }
  23775. else {
  23776. cls = 'success';
  23777. }
  23778. return Ext.String
  23779. .format(
  23780. // '<div>'
  23781. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23782. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23783. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23784. // + '</div></div>', valueString, valueFixed, cls);
  23785. '<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(
  23786. // '<div>'
  23787. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23788. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23789. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23790. // + '</div></div>', v, valueFixed, valueString);
  23791. },
  23792. //button
  23793. button: function (v, rd, model) {
  23794. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23795. }
  23796. });
  23797. initComponent();
  23798. initPanel();
  23799. initGridColumn();
  23800. initTree();
  23801. initGrid();
  23802. initMainTab();
  23803. initTextfield();
  23804. initCombo();
  23805. initTag();
  23806. initContainer();
  23807. initRows();
  23808. initCols();
  23809. initForm();
  23810. initToolbar();
  23811. initSplitter();
  23812. initButton();
  23813. initStores();
  23814. initSearch();
  23815. initMultipleSearch();
  23816. initDate();
  23817. initDateTimePicker();
  23818. initDateTime();
  23819. initNumber();
  23820. initCheckbox();
  23821. initCheckboxGroup();
  23822. initRadio();
  23823. initRadioGroup();
  23824. initFieldset();
  23825. initCombotree();
  23826. initPickerPlus();
  23827. initCombogrid();
  23828. initComboGridMulti();
  23829. initIframe();
  23830. initBpmn();
  23831. initSqlEditor();
  23832. initJsonEditor();
  23833. initJsEditor();
  23834. initClipboard();
  23835. initSqlComplex();
  23836. initParamComplex();
  23837. initDict();
  23838. initDesigner();
  23839. }
  23840. //# sourceMappingURL=init.js.map
  23841. /**
  23842. * 创建一个 Ajax 客户端
  23843. */
  23844. function createAjax(createOption) {
  23845. if (createOption.baseUrl) {
  23846. axios__default.defaults.baseURL = createOption.baseUrl;
  23847. axios__default.defaults.timeout = createOption.timeout;
  23848. storeAjax.timeout = createOption.timeout;
  23849. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23850. }
  23851. return function (option) {
  23852. //@ts-ignore
  23853. option.method = (option.method || 'get').toLocaleLowerCase();
  23854. //@ts-ignore
  23855. var ax = __assign({}, option);
  23856. switch (option.method) {
  23857. case 'get':
  23858. ax.method = 'GET';
  23859. ax.params = option.param;
  23860. ax.headers = __assign({}, option.headers);
  23861. break;
  23862. case 'post':
  23863. ax.method = 'POST';
  23864. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23865. ax.params = option.param;
  23866. ax.data = Qs.stringify(option.data);
  23867. break;
  23868. case 'put':
  23869. case 'patch':
  23870. case 'delete':
  23871. ax.method = option.method;
  23872. ax.headers = option.headers;
  23873. ax.params = option.param;
  23874. ax.data = Qs.stringify(option.data);
  23875. break;
  23876. case 'download':
  23877. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23878. return new Promise(function (resolver, reject) {
  23879. });
  23880. case "invoke":
  23881. ax.url = serverInvokeUrlTransform(option.url, option);
  23882. ax.method = 'POST';
  23883. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23884. if (typeof option.args === 'object') {
  23885. ax.data = JSON.stringify({
  23886. args: option.args,
  23887. });
  23888. }
  23889. else {
  23890. ax.data = JSON.stringify({
  23891. args: [
  23892. __assign(__assign({}, option.data), option.param)
  23893. ],
  23894. filterModel: option.filterModel,
  23895. sortModel: option.sortModel
  23896. });
  23897. }
  23898. break;
  23899. case 'post-json':
  23900. ax.method = 'POST';
  23901. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23902. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23903. break;
  23904. case 'post-file':
  23905. //TODO 刘壮. 上传文件
  23906. var forms = new FormData();
  23907. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23908. _$2.forOwn(option.data, function (value, key) {
  23909. if (key === 'files') {
  23910. var i_1 = 0;
  23911. _$2.each(value, function (f) {
  23912. // @ts-ignore
  23913. forms.append('file' + (++i_1), f);
  23914. });
  23915. }
  23916. else {
  23917. forms.append(key, value);
  23918. }
  23919. });
  23920. ax.data = forms;
  23921. ax.method = 'POST';
  23922. break;
  23923. case "sql":
  23924. ax.url = sqlUrlTransform(option.url);
  23925. ax.method = 'POST';
  23926. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23927. ax.data = JSON.stringify({
  23928. args: [option.data],
  23929. db: option.db,
  23930. filterModel: option.filterModel,
  23931. sortModel: option.sortModel
  23932. });
  23933. break;
  23934. default:
  23935. throw new Error('not implements');
  23936. }
  23937. return new Promise(function (resolver, reject) {
  23938. axios__default(ax).then(function (resolverRaw) {
  23939. var apiResult = {
  23940. rawData: resolverRaw.data,
  23941. status: resolverRaw.status,
  23942. success: (resolverRaw.data && resolverRaw.data.success),
  23943. data: resolverRaw.data.data,
  23944. pagination: resolverRaw.data.pagination,
  23945. msg: (resolverRaw.data.msg),
  23946. errors: resolverRaw.data.errors,
  23947. headers: resolverRaw.headers
  23948. };
  23949. if (typeof window['apiTranslate'] === 'function') {
  23950. window['apiTranslate'](apiResult.rawData, option.url);
  23951. }
  23952. resolver(apiResult);
  23953. }).catch(function (reason) {
  23954. reject(reason);
  23955. });
  23956. });
  23957. };
  23958. }
  23959. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23960. if (isJson === void 0) { isJson = false; }
  23961. var YvanUI = _$2.get(window, 'YvanUI');
  23962. YvanUI.loading();
  23963. var createObjectURL = function (object) {
  23964. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23965. };
  23966. // const formData = new FormData();
  23967. // _.forOwn(data, (v, k) => {
  23968. // formData.append(k, v);
  23969. // });
  23970. var formData = '';
  23971. var xhr = new XMLHttpRequest();
  23972. xhr.open('POST', downLoadUrl);
  23973. xhr.responseType = 'blob';
  23974. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23975. if (isJson) {
  23976. formData = data ? JSON.stringify(data) : '';
  23977. xhr.setRequestHeader('Content-Type', 'application/json');
  23978. }
  23979. else {
  23980. formData = data ? Qs.stringify(data) : '';
  23981. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23982. }
  23983. //
  23984. if (header) {
  23985. _$2.forOwn(header, function (v, k) {
  23986. xhr.setRequestHeader(k, v);
  23987. });
  23988. }
  23989. xhr.onload = function (e) {
  23990. if (this.status === 200) {
  23991. var blob = this.response;
  23992. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23993. navigator.msSaveBlob(blob, filename);
  23994. YvanUI.clearLoading();
  23995. }
  23996. else {
  23997. var a = document.createElement('a');
  23998. var url = createObjectURL(blob);
  23999. a.href = url;
  24000. a.download = filename;
  24001. document.append(a);
  24002. a.click();
  24003. a.remove();
  24004. window.URL.revokeObjectURL(url);
  24005. YvanUI.clearLoading();
  24006. }
  24007. }
  24008. };
  24009. xhr.send(formData);
  24010. }
  24011. //# sourceMappingURL=ajax.js.map
  24012. function readExcel(file) {
  24013. return new Promise(function (resolve, reject) {
  24014. if (!file) {
  24015. reject("文件读取失败!!!");
  24016. return;
  24017. }
  24018. var reader = new FileReader();
  24019. reader.onload = function (e) {
  24020. if (e.target) {
  24021. var data = e.target.result;
  24022. var workbook = XLSX.read(data, { type: 'binary' });
  24023. resolve(workbook);
  24024. }
  24025. else {
  24026. reject("文件读取失败!!!");
  24027. }
  24028. };
  24029. try {
  24030. reader.readAsBinaryString(file);
  24031. }
  24032. catch (e) {
  24033. reject(e);
  24034. }
  24035. });
  24036. }
  24037. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24038. if (dataStartRow === void 0) { dataStartRow = 2; }
  24039. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24040. if (rowValidate === void 0) { rowValidate = undefined; }
  24041. if (otherValidate === void 0) { otherValidate = undefined; }
  24042. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24043. return new Promise(function (resolve, reject) {
  24044. var promiseArr = [];
  24045. for (var i = 0; i < columnsSet.length; i++) {
  24046. var fix = columnsSet[i].fix;
  24047. if (_$2.isArray(fix) && fix.length > 0) {
  24048. var ss = fix[0].toLowerCase();
  24049. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24050. columnsSet[i].importFormatter = function (vdata) {
  24051. // @ts-ignore
  24052. return window.moment(vdata.ov) - 0;
  24053. };
  24054. }
  24055. else {
  24056. var fn = lookupFn(topScope, fix[0]);
  24057. promiseArr.push(fn(null, columnsSet[i]));
  24058. delete columnsSet[i].fix;
  24059. }
  24060. }
  24061. else if (_$2.isString(fix)) {
  24062. var ss = fix.toLowerCase();
  24063. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24064. columnsSet[i].importFormatter = function (vdata) {
  24065. // @ts-ignore
  24066. return window.moment(vdata.ov) - 0;
  24067. };
  24068. }
  24069. else {
  24070. var fn = lookupFn(topScope, fix);
  24071. promiseArr.push(fn(null, columnsSet[i]));
  24072. delete columnsSet[i].fix;
  24073. }
  24074. }
  24075. }
  24076. var read = function () {
  24077. readExcel(file).then(function (workbook) {
  24078. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24079. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24080. var titleRowValue = [];
  24081. var titleRowKey = [];
  24082. var needLoop = false; // 是否需要迭代
  24083. var columns = [];
  24084. if (worksheet && worksheet["!ref"]) {
  24085. var t = worksheet["!ref"];
  24086. var tempArr = t.split(':');
  24087. if (tempArr.length >= 2) {
  24088. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24089. // 选取title的行,删除之前的行
  24090. if (titleRowNumber > firstRowNumber) {
  24091. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24092. for (var key in worksheet) {
  24093. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24094. delete worksheet[key];
  24095. }
  24096. }
  24097. }
  24098. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24099. firstRowNumber = titleRowNumber + '';
  24100. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24101. }
  24102. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24103. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24104. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24105. for (var key in worksheet) {
  24106. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24107. titleRowKey.push(key);
  24108. titleRowValue.push(worksheet[key].v);
  24109. }
  24110. }
  24111. if (columnsSet && columnsSet.length > 0) {
  24112. var length = columnsSet.length;
  24113. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24114. for (var i = 0; i < length; i++) {
  24115. var vk = titleRowKey[i];
  24116. var item = columnsSet[i];
  24117. var column = {};
  24118. if (typeof item === 'string') {
  24119. column.dataIndex = item;
  24120. column.header = worksheet[vk].v;
  24121. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24122. }
  24123. else if (typeof item.dataIndex === "string") {
  24124. column.dataIndex = item.dataIndex;
  24125. column.header = worksheet[vk].v;
  24126. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24127. if (typeof item.validate === "function") {
  24128. column.validate = item.validate;
  24129. needLoop = true;
  24130. }
  24131. if (typeof item.importFormatter === "function") {
  24132. column.importFormatter = item.importFormatter;
  24133. needLoop = true;
  24134. }
  24135. if ((item.data instanceof Array && item.data.length > 0)
  24136. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24137. column.data = item.data;
  24138. needLoop = true;
  24139. }
  24140. }
  24141. columns.push(column);
  24142. }
  24143. }
  24144. }
  24145. }
  24146. if (fieldValidate && typeof fieldValidate === "function") {
  24147. if (fieldValidate(columns, titleRowValue) !== true) {
  24148. reject("fields validate error");
  24149. return;
  24150. }
  24151. }
  24152. var allData = XLSX.utils.sheet_to_json(worksheet);
  24153. var okData = [], errorData = [], errorMsgData = [];
  24154. var needItemLoop = needLoop;
  24155. if (rowValidate && typeof rowValidate === "function") {
  24156. needLoop = true;
  24157. }
  24158. if (needLoop === true) {
  24159. for (var index = 0; index < allData.length; index++) {
  24160. var row = allData[index];
  24161. var rowNumber = dataStartRow + index;
  24162. row.__importID__ = rowNumber;
  24163. var isRowOk = true;
  24164. if (needItemLoop) {
  24165. var _loop_1 = function (num) {
  24166. var column = columns[num];
  24167. var ov = row[column.dataIndex];
  24168. var nv = ov;
  24169. var hasError = false;
  24170. var rowNumber_1 = dataStartRow + index;
  24171. var ei = {
  24172. errorId: rowNumber_1 + '_' + column.dataIndex,
  24173. importID: rowNumber_1,
  24174. dataIndex: column.dataIndex,
  24175. header: column.header,
  24176. value: ov,
  24177. errormessage: ""
  24178. };
  24179. // 格式化
  24180. if (column.data instanceof Array) {
  24181. nv = undefined;
  24182. ei.errormessage = "字典匹配失败";
  24183. _$2.forEach(column.data, function (v, index) {
  24184. if (v.text === ov) {
  24185. nv = v.id;
  24186. return;
  24187. }
  24188. });
  24189. }
  24190. else if (_$2.isPlainObject(column.data)) {
  24191. nv = undefined;
  24192. ei.errormessage = "字典匹配失败";
  24193. _$2.forEach(column.data, function (value, key) {
  24194. if (value === ov) {
  24195. nv = key;
  24196. return;
  24197. }
  24198. });
  24199. }
  24200. if (typeof column.importFormatter === 'function') {
  24201. var vdata = {
  24202. column: column,
  24203. ov: ov,
  24204. nv: nv,
  24205. rowIndex: index,
  24206. data: row,
  24207. rowDatas: allData
  24208. };
  24209. nv = undefined;
  24210. ei.errormessage = "格式化失败";
  24211. nv = column.importFormatter(vdata);
  24212. }
  24213. if (!nv && nv != 0) {
  24214. hasError = true;
  24215. }
  24216. else {
  24217. row[column.dataIndex] = nv;
  24218. ei.errormessage = "";
  24219. }
  24220. // 校验
  24221. if (typeof column.validate === 'function') {
  24222. var vdata = {
  24223. column: column,
  24224. ov: ov,
  24225. nv: nv,
  24226. rowIndex: index,
  24227. data: row,
  24228. rowDatas: allData
  24229. };
  24230. var errormessage = column.validate(vdata);
  24231. if (errormessage === true) ;
  24232. else {
  24233. hasError = true;
  24234. ei.errormessage = ei.errormessage + "/" + errormessage;
  24235. }
  24236. }
  24237. if (hasError === true) {
  24238. isRowOk = false;
  24239. errorMsgData.push(ei);
  24240. }
  24241. };
  24242. for (var num = 0; num < columns.length; num++) {
  24243. _loop_1(num);
  24244. }
  24245. }
  24246. if (rowValidate && typeof rowValidate === "function") {
  24247. var errormessage = rowValidate({
  24248. columns: columns,
  24249. data: row,
  24250. rowIndex: index,
  24251. rowDatas: allData
  24252. });
  24253. if (errormessage === true) ;
  24254. else {
  24255. isRowOk = false;
  24256. var ei = {
  24257. errorId: rowNumber + '',
  24258. dataIndex: "row",
  24259. header: "数据行",
  24260. value: "当前行的数据",
  24261. importID: rowNumber,
  24262. errormessage: errormessage
  24263. };
  24264. errorMsgData.push(ei);
  24265. }
  24266. }
  24267. row.__hasError__ = !isRowOk;
  24268. if (isRowOk === true) {
  24269. okData.push(row);
  24270. }
  24271. else {
  24272. errorData.push(row);
  24273. }
  24274. }
  24275. }
  24276. else {
  24277. // 添加数据的唯一标识
  24278. for (var index = 0; index < allData.length; index++) {
  24279. var row = allData[index];
  24280. var rowNumber = dataStartRow + index;
  24281. row.__importID__ = rowNumber;
  24282. row.__hasError__ = false;
  24283. }
  24284. okData = allData;
  24285. }
  24286. if (otherValidate && typeof otherValidate === "function") {
  24287. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24288. }
  24289. else {
  24290. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24291. }
  24292. // clearLoading()
  24293. }).catch(function (e) {
  24294. reject(e);
  24295. });
  24296. };
  24297. if (promiseArr.length > 0) {
  24298. Promise.all(promiseArr).then(function (resArr) {
  24299. for (var i = 0; i < resArr.length; i++) {
  24300. var tmp = resArr[i];
  24301. tmp.config.data = [];
  24302. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24303. if (tmp.r.field.length > 1) {
  24304. var keyKey = tmp.r.field[0];
  24305. var valueKey = tmp.r.field[1];
  24306. for (var j = 0; j < tmp.r.data.length; j++) {
  24307. var it = tmp.r.data[j];
  24308. var newIt = {};
  24309. newIt.id = it[keyKey];
  24310. newIt.text = it[valueKey];
  24311. tmp.config.data.push(newIt);
  24312. }
  24313. }
  24314. }
  24315. }
  24316. read();
  24317. });
  24318. }
  24319. else {
  24320. setTimeout(read, 50);
  24321. }
  24322. });
  24323. }
  24324. //# sourceMappingURL=xlsx.js.map
  24325. var ExcelImportDialog = /** @class */ (function (_super) {
  24326. __extends(ExcelImportDialog, _super);
  24327. function ExcelImportDialog(option) {
  24328. var _this = this;
  24329. var vjson = vjsonFunc(option);
  24330. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24331. _this.importExcelOption = option;
  24332. return _this;
  24333. }
  24334. ExcelImportDialog.prototype.onLoad = function () {
  24335. _super.prototype.onLoad.call(this);
  24336. };
  24337. ExcelImportDialog.prototype.fileChange = function (sender) {
  24338. var _this = this;
  24339. var file = sender.fileInputEl.dom.files[0];
  24340. // const senderScope = lookupScope(sender)
  24341. var topScope = this.topScope;
  24342. var rowValidate = this.importExcelOption.rowValidate;
  24343. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24344. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24345. }
  24346. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24347. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24348. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24349. }
  24350. var fieldValidate = this.importExcelOption.fieldValidate;
  24351. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24352. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24353. }
  24354. this.setLoading(true);
  24355. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24356. _this.importData = res;
  24357. _this.refs.dataGrid.setData(res.allData);
  24358. _this.viewModel.set("dataCount", res.allData.length);
  24359. _this.refs.errGrid.setData(res.errorMsgData);
  24360. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24361. }).catch(function (e) {
  24362. _this.importData = null;
  24363. _this.refs.dataGrid.setData();
  24364. _this.refs.errGrid.setData();
  24365. msg(e.toString());
  24366. }).finally(function () {
  24367. _this.setLoading(false);
  24368. });
  24369. };
  24370. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24371. if (record.get('__hasError__')) {
  24372. return "x-grid-record-bg-red";
  24373. }
  24374. };
  24375. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24376. return "x-grid-record-bg-red";
  24377. };
  24378. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24379. var _a;
  24380. var id = record.data.__importID__;
  24381. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24382. var selectRecord = null;
  24383. var dataIndex = -1;
  24384. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24385. for (var i = 0; i < rows.length; i++) {
  24386. if (rows[i].importID === id) {
  24387. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24388. dataIndex = i;
  24389. }
  24390. if (rows[i].errorId === id + "_" + subId) {
  24391. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24392. dataIndex = i;
  24393. break;
  24394. }
  24395. }
  24396. if (selectRecord) {
  24397. this.refs.errGrid.ensureVisible(selectRecord);
  24398. this.refs.errGrid.selModel.select(dataIndex);
  24399. // this.refs.errGrid.reload()
  24400. }
  24401. };
  24402. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24403. var _a;
  24404. var id = record.data.importID;
  24405. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24406. var selectRecord = null;
  24407. var dataIndex = -1;
  24408. for (var i = 0; i < rows.length; i++) {
  24409. if (rows[i].__importID__ === id) {
  24410. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24411. dataIndex = i;
  24412. break;
  24413. }
  24414. }
  24415. if (selectRecord) {
  24416. this.refs.dataGrid.ensureVisible(selectRecord);
  24417. this.refs.dataGrid.selModel.select(dataIndex);
  24418. // this.refs.dataGrid.reload()
  24419. }
  24420. };
  24421. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24422. this.viewModel.set("dataType", newValue);
  24423. if (this.importData) {
  24424. this.refs.dataGrid.setData(this.importData[newValue]);
  24425. this.viewModel.set("dataCount", this.importData[newValue].length);
  24426. }
  24427. };
  24428. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24429. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24430. window.location.href = this.importExcelOption.dowLoadUrl;
  24431. return;
  24432. }
  24433. var xt = [];
  24434. _$2.forEach(this.importExcelOption.columns, function (v) {
  24435. xt.push(v.header);
  24436. });
  24437. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24438. if (filename.endsWith(".xlsx")) {
  24439. filename = filename.split(".xlsx")[0];
  24440. }
  24441. filename = filename + ".xlsx";
  24442. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24443. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24444. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24445. XLSX.writeFile(wb, filename); //导出Excel
  24446. };
  24447. ExcelImportDialog.prototype.getData = function (sender) {
  24448. _$2.each(this.importData.okData, function (item) {
  24449. delete item.id;
  24450. delete item.__hasError__;
  24451. delete item.__importID__;
  24452. delete item._origin;
  24453. });
  24454. _$2.each(this.importData.allData, function (item) {
  24455. delete item.id;
  24456. delete item.__hasError__;
  24457. delete item.__importID__;
  24458. delete item._origin;
  24459. });
  24460. _$2.each(this.importData.errorData, function (item) {
  24461. delete item.id;
  24462. delete item.__hasError__;
  24463. delete item.__importID__;
  24464. delete item._origin;
  24465. });
  24466. this.dialogSuccess(this.importData);
  24467. };
  24468. return ExcelImportDialog;
  24469. }(Scope));
  24470. var model$d = {
  24471. data: {
  24472. dataType: "all",
  24473. errMsgCount: 0,
  24474. dataCount: 0
  24475. }
  24476. };
  24477. var vjsonFunc = function (option) {
  24478. return {
  24479. title: option.title || 'excel导入',
  24480. layout: 'fit',
  24481. items: [
  24482. {
  24483. layout: 'border',
  24484. tbar: {
  24485. xtype: "form",
  24486. items: [
  24487. {
  24488. xtype: "cols",
  24489. items: [
  24490. {
  24491. xtype: "filefield",
  24492. fieldLabel: 'excel文件',
  24493. buttonText: '请选择excel文件',
  24494. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24495. flex: 3,
  24496. listeners: {
  24497. change: "scope.fileChange"
  24498. }
  24499. }, {
  24500. xtype: "button",
  24501. iconCls: "x-fa fa-download",
  24502. text: "下载模版",
  24503. listeners: {
  24504. click: "scope.downloadTemplate"
  24505. }
  24506. }, {
  24507. xtype: 'container',
  24508. border: false,
  24509. layout: 'hbox',
  24510. }, {
  24511. xtype: "button",
  24512. iconCls: "x-fa fa-upload",
  24513. text: option.tQButtonText || "提取数据",
  24514. listeners: {
  24515. click: "scope.getData"
  24516. }
  24517. }
  24518. ]
  24519. },
  24520. ]
  24521. },
  24522. items: [
  24523. {
  24524. tbar: {
  24525. xtype: "toolbar",
  24526. title: "导入的数据",
  24527. items: [{
  24528. xtype: 'label',
  24529. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24530. }, {
  24531. xtype: 'radiogroup',
  24532. items: [
  24533. {
  24534. boxLabel: '所有数据',
  24535. checked: true,
  24536. inputValue: 'allData',
  24537. }, {
  24538. boxLabel: '正确数据',
  24539. inputValue: 'okData',
  24540. }, {
  24541. boxLabel: '错误数据',
  24542. inputValue: 'errorData',
  24543. }
  24544. ],
  24545. listeners: {
  24546. change: 'scope.filterData',
  24547. },
  24548. }, {
  24549. xtype: "textfield",
  24550. readOnly: true,
  24551. fieldLabel: "条目数",
  24552. bind: "{dataCount}"
  24553. }]
  24554. },
  24555. xtype: 'yvgrid',
  24556. reference: 'dataGrid',
  24557. layout: 'fit',
  24558. pagination: false,
  24559. // pageSize: 50,
  24560. getRowClass: 'scope.getDataGridRowRecord',
  24561. columns: option.columns,
  24562. region: 'center',
  24563. split: true,
  24564. listeners: {
  24565. cellclick: "scope.dataGridClick",
  24566. },
  24567. selModel: {
  24568. // type: 'rowmodel',
  24569. mode: 'SINGLE',
  24570. },
  24571. }, {
  24572. tbar: {
  24573. xtype: "toolbar", items: [
  24574. {
  24575. xtype: 'label',
  24576. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24577. }, {
  24578. xtype: "textfield",
  24579. readOnly: true,
  24580. fieldLabel: "条目数",
  24581. bind: "{errMsgCount}"
  24582. }
  24583. ]
  24584. },
  24585. xtype: 'yvgrid',
  24586. reference: 'errGrid',
  24587. layout: 'fit',
  24588. pagination: false,
  24589. getRowClass: 'scope.getErrGridRowRecord',
  24590. height: "40%",
  24591. columns: [
  24592. { dataIndex: "errorId", header: "ID", hidden: true },
  24593. { dataIndex: "importID", header: "行号", width: 80 },
  24594. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24595. { dataIndex: "value", header: "值", width: 120 },
  24596. { dataIndex: "header", header: "字段名", width: 120 },
  24597. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24598. ],
  24599. region: 'south',
  24600. split: true,
  24601. listeners: {
  24602. itemclick: "scope.errGridClick"
  24603. },
  24604. selModel: {
  24605. // type: 'rowmodel',
  24606. mode: 'SINGLE',
  24607. },
  24608. },
  24609. ],
  24610. },
  24611. ],
  24612. referenceHolder: true,
  24613. };
  24614. };
  24615. //# sourceMappingURL=ExcelImportDialog.js.map
  24616. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24617. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24618. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24619. ret.report_id = reportId;
  24620. ret.report = report;
  24621. return ret;
  24622. }
  24623. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24624. var e_1, _a, e_2, _b;
  24625. var model = {
  24626. data: {
  24627. report_name: config.report_name,
  24628. query: {},
  24629. sum: {},
  24630. }
  24631. };
  24632. var json5 = window['YvanUI'].json5;
  24633. var report = config.report ? json5.parse(config.report) : {};
  24634. var conditionRows = [];
  24635. var sumRows = [];
  24636. model.data.has_sum = _$2.size(report.summary) > 0;
  24637. // query 查询条件
  24638. var newRow = false;
  24639. var currentRow = { xtype: 'cols', items: [], };
  24640. conditionRows.push(currentRow);
  24641. _$2.forEach(report.query, function (item) {
  24642. if (newRow) {
  24643. currentRow = { xtype: 'cols', items: [], };
  24644. conditionRows.push(currentRow);
  24645. }
  24646. var vj = json5.parse(item.conditionFieldExtend);
  24647. if (item.conditionFieldXtype) {
  24648. vj.xtype = item.conditionFieldXtype;
  24649. if (item.conditionFieldXtype === 'combo') {
  24650. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24651. }
  24652. if (item.conditionFieldXtype === 'datetimefield') {
  24653. //@ts-ignore
  24654. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24655. }
  24656. else if (item.conditionFieldXtype === 'datefield') {
  24657. //@ts-ignore
  24658. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24659. }
  24660. else {
  24661. model.data.query[item.conditionFieldBind] = '';
  24662. }
  24663. }
  24664. else {
  24665. // 没有组件类型,是个空占位符
  24666. vj.border = false;
  24667. }
  24668. if (item.conditionFieldBind) {
  24669. vj.bind = {
  24670. value: '{query.' + item.conditionFieldBind + '}'
  24671. };
  24672. }
  24673. if (item.conditionFieldFlex) {
  24674. vj.flex = item.conditionFieldFlex;
  24675. }
  24676. if (item.conditionFieldXtype) {
  24677. vj.fieldLabel = item.conditionFieldLabel;
  24678. }
  24679. if (item.fieldLabel) {
  24680. vj.fieldLabel = item.fieldLabel;
  24681. }
  24682. newRow = item.conditionFieldWrap || false;
  24683. currentRow.items.push(vj);
  24684. });
  24685. if (currentRow) {
  24686. currentRow.margin = '10 0 10 0';
  24687. }
  24688. // sum 汇总条件
  24689. newRow = true;
  24690. try {
  24691. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24692. var item = _d.value;
  24693. if (newRow) {
  24694. currentRow = {
  24695. xtype: 'cols',
  24696. defaultType: 'displayfield',
  24697. defaults: {
  24698. labelWidth: 70,
  24699. },
  24700. items: []
  24701. };
  24702. sumRows.push(currentRow);
  24703. }
  24704. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24705. if (item.sumFieldBind) {
  24706. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24707. model.data.sum[item.sumFieldBind] = '';
  24708. }
  24709. else {
  24710. // 没有组件类型,是个空占位符
  24711. vj.border = false;
  24712. }
  24713. if (item.sumFieldFlex) {
  24714. vj.flex = item.sumFieldFlex;
  24715. }
  24716. if (item.sumFieldLabel) {
  24717. vj.fieldLabel = item.sumFieldLabel;
  24718. }
  24719. // sumFieldBind: "zs"
  24720. // sumFieldExtend: "{}"
  24721. // sumFieldFlex: 1
  24722. // sumFieldLabel: "总数"
  24723. // sumFieldWrap: false
  24724. newRow = item.sumFieldWrap || false;
  24725. currentRow.items.push(vj);
  24726. }
  24727. }
  24728. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24729. finally {
  24730. try {
  24731. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24732. }
  24733. finally { if (e_1) throw e_1.error; }
  24734. }
  24735. if (currentRow) {
  24736. currentRow.margin = '10 0 10 0';
  24737. }
  24738. // column 结果字段
  24739. var columns = [];
  24740. try {
  24741. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24742. var item = _f.value;
  24743. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24744. if (item.xtype) {
  24745. if (item.xtype == 'checkbox') {
  24746. vj.xtype = 'checkcolumn';
  24747. vj.disabled = true;
  24748. }
  24749. else {
  24750. vj.xtype = item.xtype;
  24751. }
  24752. }
  24753. if (item.dataType) {
  24754. vj.dataType = item.dataType;
  24755. }
  24756. if (item.align) {
  24757. vj.align = item.align;
  24758. }
  24759. if (item.width) {
  24760. vj.width = item.width;
  24761. }
  24762. if (item.dict) {
  24763. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24764. }
  24765. columns.push(vj);
  24766. }
  24767. }
  24768. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24769. finally {
  24770. try {
  24771. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24772. }
  24773. finally { if (e_2) throw e_2.error; }
  24774. }
  24775. var vjson = {
  24776. bind: {
  24777. title: '{report_name}',
  24778. },
  24779. layout: 'fit',
  24780. referenceHolder: true,
  24781. items: [
  24782. {
  24783. layout: 'border',
  24784. border: false,
  24785. items: [
  24786. {
  24787. region: 'north',
  24788. border: false,
  24789. tbar: {
  24790. xtype: 'toolbar',
  24791. border: false,
  24792. items: [
  24793. {
  24794. xtype: 'button',
  24795. text: '查询',
  24796. reference: 'btnSearch',
  24797. iconCls: 'x-fa fa-search',
  24798. listeners: {
  24799. click: 'scope.reload',
  24800. },
  24801. },
  24802. {
  24803. xtype: 'button',
  24804. text: '关闭',
  24805. iconCls: 'x-fa fa-times',
  24806. listeners: {
  24807. click: 'system.closeMe()',
  24808. },
  24809. },
  24810. ],
  24811. },
  24812. defaults: {
  24813. margin: '8 0 0 0'
  24814. },
  24815. items: __spread(conditionRows, sumRows),
  24816. fix: ['system.enterToClick("btnSearch")'],
  24817. },
  24818. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24819. method: 'invoke',
  24820. url: '/report/Report@execute',
  24821. params: {
  24822. dataSource: report.dataSource,
  24823. pagination: report.grid.pagination || true,
  24824. report_id: config.report_id,
  24825. query: '{query}',
  24826. },
  24827. }, columns: columns }, report.grid),
  24828. ],
  24829. },
  24830. ],
  24831. };
  24832. return { model: model, vjson: vjson, report: report };
  24833. }
  24834. var ReportScope = /** @class */ (function (_super) {
  24835. __extends(ReportScope, _super);
  24836. function ReportScope(_a, invokeServerFn) {
  24837. var model = _a.model, vjson = _a.vjson;
  24838. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24839. _this.invokeServerFn = invokeServerFn;
  24840. return _this;
  24841. }
  24842. ReportScope.prototype.onLoad = function () {
  24843. // this.reload()
  24844. };
  24845. ReportScope.prototype.reload = function () {
  24846. var _this = this;
  24847. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24848. if (this.viewModel.get('has_sum')) {
  24849. this.invokeServerFn('/report/Report@executeSum', {
  24850. dataSource: this.report.dataSource,
  24851. report_id: this.report_id,
  24852. query: this.viewModel.get('query'),
  24853. }).then(function (res) {
  24854. if (!res.success) {
  24855. showErrorDialog$1(res.msg);
  24856. }
  24857. else {
  24858. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24859. }
  24860. });
  24861. }
  24862. this.refs.grid1.reload();
  24863. };
  24864. return ReportScope;
  24865. }(Scope));
  24866. //# sourceMappingURL=Report.js.map
  24867. var model$e = {
  24868. data: {
  24869. form: {
  24870. resource_parent: '',
  24871. resource_name: '',
  24872. resource_icon: '',
  24873. scope_url: '',
  24874. scope_params: '',
  24875. resource_order: '',
  24876. permission_code: '',
  24877. },
  24878. }
  24879. };
  24880. //# sourceMappingURL=RegisterModule.model.js.map
  24881. var vjson$d = {
  24882. title: '注册模块',
  24883. layout: 'fit',
  24884. width: "40%",
  24885. height: "50%",
  24886. fbar: {
  24887. xtype: 'toolbar',
  24888. items: [
  24889. {
  24890. xtype: "button",
  24891. text: "确定",
  24892. iconCls: 'x-fa fa-check',
  24893. listeners: {
  24894. click: 'scope.saveNode',
  24895. }
  24896. },
  24897. {
  24898. xtype: "button",
  24899. text: "关闭",
  24900. iconCls: 'x-fa fa-times',
  24901. listeners: {
  24902. click: 'system.closeMe()',
  24903. }
  24904. },
  24905. ]
  24906. },
  24907. items: [
  24908. {
  24909. layout: 'border',
  24910. items: [
  24911. {
  24912. region: 'west',
  24913. layout: 'fit',
  24914. xtype: 'tabpanel',
  24915. reference: 'tabs',
  24916. width: "50%",
  24917. split: true,
  24918. listeners: {
  24919. tabchange: 'scope.tabchange',
  24920. },
  24921. items: [
  24922. {
  24923. region: 'center',
  24924. layout: 'fit',
  24925. title: 'PC菜单',
  24926. key: "1",
  24927. items: [
  24928. {
  24929. xtype: 'treepanel',
  24930. layout: 'fit',
  24931. region: 'west',
  24932. rootVisible: false,
  24933. useArrows: true,
  24934. reference: 'tree1',
  24935. listeners: {
  24936. itemclick: "scope.tree1NodeClick",
  24937. }
  24938. },
  24939. ]
  24940. },
  24941. {
  24942. region: 'center',
  24943. layout: 'fit',
  24944. title: 'PDA菜单',
  24945. key: "2",
  24946. items: [
  24947. {
  24948. xtype: 'treepanel',
  24949. layout: 'fit',
  24950. region: 'west',
  24951. reference: 'tree2',
  24952. rootVisible: false,
  24953. useArrows: true,
  24954. listeners: {
  24955. itemclick: "scope.tree1NodeClick",
  24956. }
  24957. },
  24958. ]
  24959. },
  24960. ]
  24961. },
  24962. {
  24963. region: 'center',
  24964. xtype: 'form',
  24965. margin: '0 0 0 0',
  24966. split: true,
  24967. width: '50%',
  24968. items: [
  24969. {
  24970. xtype: 'cols',
  24971. items: [
  24972. {
  24973. xtype: 'textfield',
  24974. fieldLabel: '上级资源ID',
  24975. bind: {
  24976. readOnly: true,
  24977. disabled: true,
  24978. value: '{form.resource_parent}'
  24979. },
  24980. },
  24981. ],
  24982. },
  24983. {
  24984. xtype: 'cols',
  24985. items: [
  24986. {
  24987. xtype: 'textfield',
  24988. fieldLabel: '资源名称',
  24989. bind: {
  24990. value: '{form.resource_name}'
  24991. },
  24992. allowBlank: false,
  24993. },
  24994. ],
  24995. },
  24996. {
  24997. xtype: 'cols',
  24998. items: [
  24999. {
  25000. xtype: 'numberfield',
  25001. fieldLabel: '资源排序',
  25002. bind: {
  25003. value: '{form.resource_order}'
  25004. },
  25005. allowBlank: false,
  25006. },
  25007. ],
  25008. },
  25009. {
  25010. xtype: 'cols',
  25011. items: [
  25012. {
  25013. xtype: 'textfield',
  25014. fieldLabel: '功能URL',
  25015. bind: {
  25016. disabled: true,
  25017. value: '{form.scope_url}'
  25018. },
  25019. },
  25020. ]
  25021. },
  25022. {
  25023. xtype: 'cols',
  25024. items: [
  25025. {
  25026. xtype: 'textfield',
  25027. fieldLabel: '权限编码',
  25028. bind: {
  25029. value: '{form.permission_code}'
  25030. }
  25031. },
  25032. ],
  25033. },
  25034. {
  25035. xtype: 'cols',
  25036. items: [
  25037. {
  25038. xtype: 'textfield',
  25039. fieldLabel: '功能参数',
  25040. bind: {
  25041. value: '{form.scope_params}'
  25042. }
  25043. },
  25044. ],
  25045. },
  25046. ],
  25047. },
  25048. ],
  25049. },
  25050. ],
  25051. referenceHolder: true,
  25052. };
  25053. //# sourceMappingURL=RegisterModule.view.js.map
  25054. var RegisterModule = /** @class */ (function (_super) {
  25055. __extends(RegisterModule, _super);
  25056. function RegisterModule() {
  25057. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25058. }
  25059. RegisterModule.prototype.onLoad = function () {
  25060. this.reloadTree("PC");
  25061. };
  25062. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25063. var currTabKey = b.key;
  25064. if (currTabKey === '1') {
  25065. this.viewModel.set('form', '');
  25066. this.reloadTree("PC");
  25067. }
  25068. else {
  25069. this.viewModel.set('form', '');
  25070. this.reloadTree("PDA");
  25071. }
  25072. };
  25073. RegisterModule.prototype.reloadTree = function (type) {
  25074. var _this = this;
  25075. if ("PC" === type) {
  25076. this.setLoading(true);
  25077. getMenuTree({ type: "PC" }).then(function (res) {
  25078. if (res.success) {
  25079. _this.refs.tree1.store.setRootNode({
  25080. expanded: true,
  25081. children: res.data
  25082. });
  25083. }
  25084. }).finally(function () {
  25085. _this.setLoading(false);
  25086. });
  25087. }
  25088. else {
  25089. this.setLoading(true);
  25090. getMenuTree({ type: "PDA" }).then(function (res) {
  25091. if (res.success) {
  25092. _this.refs.tree2.store.setRoot({
  25093. expanded: true,
  25094. children: res.data
  25095. });
  25096. }
  25097. }).finally(function () {
  25098. _this.setLoading(false);
  25099. });
  25100. }
  25101. };
  25102. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25103. var id = _$2.split(node.data.id, '_')[1];
  25104. if (!id) {
  25105. return;
  25106. }
  25107. this.viewModel.set('form.resource_parent', id);
  25108. };
  25109. RegisterModule.prototype.saveNode = function () {
  25110. var _this = this;
  25111. var tabKey = this.refs.tabs.activeTab.key;
  25112. // 检验菜单数据
  25113. var param = this.viewModel.get('form');
  25114. if (!param.resource_parent) {
  25115. msg('请选择一个父节点');
  25116. return;
  25117. }
  25118. if (!param.resource_name) {
  25119. msg('资源名称不能为空');
  25120. return;
  25121. }
  25122. if (!param.scope_url) {
  25123. msg('功能URL不能为空');
  25124. return;
  25125. }
  25126. var type;
  25127. if (tabKey === '1') {
  25128. type = 'PC';
  25129. }
  25130. else {
  25131. type = 'PDA';
  25132. }
  25133. this.setLoading(true);
  25134. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25135. if (res.success) {
  25136. msg("注册成功");
  25137. _this.close();
  25138. }
  25139. }).finally(function () {
  25140. _this.setLoading(false);
  25141. });
  25142. };
  25143. return RegisterModule;
  25144. }(Scope));
  25145. //# sourceMappingURL=RegisterModule.js.map
  25146. var model$f = {
  25147. data: {
  25148. title: "模板选择",
  25149. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25150. moduleType: 1,
  25151. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25152. packagePath: "",
  25153. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25154. fileSavePath: "",
  25155. // 模块名称 "Dict"
  25156. moduleName: "NewModule",
  25157. // 页面标题 "字典维护"
  25158. pageTitle: "新模块",
  25159. // 单表查询
  25160. singleTable: {
  25161. sql: "select * from bas_dict",
  25162. // 新增或者删除所用的表
  25163. tableName: "",
  25164. // 是否分页查询
  25165. pagination: true,
  25166. // 是否需要删除
  25167. delete: true,
  25168. // 删除条件字段
  25169. deleteWhereColumn: "",
  25170. // 删除提示语
  25171. deleteTips: "确定要删除?",
  25172. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25173. editType: 2,
  25174. },
  25175. singleTableView: {
  25176. tableNameList: [
  25177. // { value: "aaa"},
  25178. ],
  25179. columnList: [
  25180. // { value: "aaa"},
  25181. ],
  25182. }
  25183. }
  25184. };
  25185. //# sourceMappingURL=CreateModule.model.js.map
  25186. var vjson$e = {
  25187. bind: {
  25188. title: '新建模块-{title}',
  25189. },
  25190. width: "55%",
  25191. height: "60%",
  25192. minWidth: 500,
  25193. minHeight: 400,
  25194. modal: true,
  25195. frame: true,
  25196. layout: 'card',
  25197. bbar: [
  25198. '->',
  25199. {
  25200. itemId: 'card-prev',
  25201. text: '&laquo; 上一步',
  25202. disabled: true,
  25203. listeners: {
  25204. click: 'scope.showPrevious',
  25205. },
  25206. },
  25207. {
  25208. itemId: 'card-next',
  25209. text: '下一步 &raquo;',
  25210. listeners: {
  25211. click: 'scope.showNext',
  25212. },
  25213. },
  25214. {
  25215. itemId: 'card-finish',
  25216. text: '立刻执行',
  25217. iconCls: 'x-fa fa-flash',
  25218. hidden: true,
  25219. listeners: {
  25220. click: 'scope.finish',
  25221. },
  25222. },
  25223. ],
  25224. items: [
  25225. {
  25226. vtitle: '模板选择',
  25227. reference: 'templateSelection',
  25228. layout: {
  25229. type: 'hbox',
  25230. pack: 'start',
  25231. align: 'stretch'
  25232. },
  25233. listeners: {
  25234. cardEnter: 'scope.templateEnter',
  25235. cardLevel: 'scope.templateLevel'
  25236. },
  25237. items: [
  25238. {
  25239. width: 150,
  25240. xtype: 'form',
  25241. border: false,
  25242. layout: {
  25243. type: 'vbox',
  25244. align: 'stretch'
  25245. },
  25246. defaults: {
  25247. border: false,
  25248. anchor: '100%',
  25249. margin: '5',
  25250. },
  25251. items: [
  25252. {
  25253. xtype: 'radiogroup',
  25254. bind: {
  25255. value: '{moduleType}'
  25256. },
  25257. layout: 'vbox',
  25258. defaults: {
  25259. border: false,
  25260. anchor: '100%',
  25261. margin: '5',
  25262. },
  25263. items: [
  25264. { boxLabel: '单表查询', inputValue: 1 },
  25265. { boxLabel: '主/明细查询', inputValue: 2 },
  25266. { boxLabel: '树/明细查询', inputValue: 3 },
  25267. { boxLabel: '卡片表单', inputValue: 4 },
  25268. { boxLabel: '主/详情查询', inputValue: 5 },
  25269. ]
  25270. },
  25271. ]
  25272. },
  25273. {
  25274. flex: 1,
  25275. region: 'center',
  25276. xtype: "panel",
  25277. border: false,
  25278. frame: true,
  25279. padding: "4px 8px",
  25280. html: "描述...",
  25281. }
  25282. ]
  25283. },
  25284. {
  25285. vtitle: '模块名称',
  25286. reference: 'moduleName',
  25287. layout: 'fit',
  25288. listeners: {
  25289. cardEnter: 'scope.moduleEnter',
  25290. cardLevel: 'scope.moduleLevel'
  25291. },
  25292. items: [
  25293. {
  25294. xtype: 'form',
  25295. border: false,
  25296. layout: {
  25297. type: 'vbox',
  25298. align: 'stretch'
  25299. },
  25300. defaults: {
  25301. border: false,
  25302. anchor: '100%',
  25303. margin: '5',
  25304. },
  25305. items: [
  25306. {
  25307. xtype: 'textfield',
  25308. fieldLabel: '包路径',
  25309. allowBlank: false,
  25310. bind: { value: '{packagePath}' },
  25311. },
  25312. {
  25313. xtype: 'textfield',
  25314. fieldLabel: '文件路径',
  25315. allowBlank: false,
  25316. bind: { value: '{fileSavePath}' },
  25317. },
  25318. {
  25319. xtype: 'textfield',
  25320. fieldLabel: '模块名',
  25321. allowBlank: false,
  25322. bind: { value: '{moduleName}' },
  25323. },
  25324. {
  25325. xtype: 'textfield',
  25326. fieldLabel: '菜单名',
  25327. allowBlank: false,
  25328. bind: { value: '{pageTitle}' },
  25329. },
  25330. ]
  25331. },
  25332. ]
  25333. },
  25334. {
  25335. vtitle: '确认结果',
  25336. reference: 'confirmResult',
  25337. layout: 'fit',
  25338. listeners: {
  25339. cardEnter: 'scope.optionEnter',
  25340. cardLevel: 'scope.optionLevel',
  25341. },
  25342. items: [
  25343. {
  25344. xtype: 'jsoneditor',
  25345. reference: 'jsoneditor'
  25346. }
  25347. ]
  25348. },
  25349. // ---------------------------------------------------------------------------------- 单表查询
  25350. {
  25351. vtitle: '查询SQL',
  25352. reference: 'singleTable_1',
  25353. layout: 'fit',
  25354. listeners: {
  25355. cardEnter: 'scope.editorEnter',
  25356. cardLevel: 'scope.editorLevel'
  25357. },
  25358. items: [
  25359. {
  25360. xtype: 'sqleditor',
  25361. }
  25362. ],
  25363. },
  25364. {
  25365. vtitle: '字段选项',
  25366. reference: 'singleTable_2',
  25367. layout: 'fit',
  25368. listeners: {
  25369. cardEnter: 'scope.columnEnter',
  25370. cardLevel: 'scope.columnLevel',
  25371. },
  25372. items: [
  25373. {
  25374. xtype: 'yvgrid',
  25375. border: false,
  25376. selModel: {
  25377. type: 'spreadsheet',
  25378. columnSelect: true,
  25379. pruneRemoved: false,
  25380. extensible: 'y'
  25381. },
  25382. plugins: {
  25383. clipboard: true,
  25384. selectionreplicator: true
  25385. },
  25386. reference: 'grid1',
  25387. idField: 'column_name',
  25388. hideFootbar: true,
  25389. tbar: {
  25390. xtype: 'toolbar',
  25391. items: [
  25392. {
  25393. xtype: 'button',
  25394. text: '添加',
  25395. iconCls: 'x-fa fa-plus-circle',
  25396. listeners: {
  25397. click: 'scope.addField'
  25398. }
  25399. },
  25400. {
  25401. xtype: 'button',
  25402. text: '删除',
  25403. iconCls: 'x-fa fa-minus-circle',
  25404. listeners: {
  25405. click: 'scope.removeField'
  25406. }
  25407. },
  25408. {
  25409. xtype: 'button',
  25410. text: '分析SQL',
  25411. iconCls: 'x-fa fa-refresh',
  25412. listeners: {
  25413. click: 'scope.parseSQL'
  25414. }
  25415. },
  25416. ]
  25417. },
  25418. columns: [
  25419. {
  25420. text: '字段名', dataIndex: 'column_name',
  25421. sortable: false,
  25422. menuDisabled: true,
  25423. width: 150,
  25424. editor: {
  25425. allowBlank: true,
  25426. selectOnFocus: false,
  25427. }
  25428. },
  25429. {
  25430. text: '字段中文', dataIndex: 'column_comment',
  25431. width: 150,
  25432. sortable: false,
  25433. menuDisabled: true,
  25434. editor: {
  25435. allowBlank: true,
  25436. selectOnFocus: false,
  25437. }
  25438. },
  25439. {
  25440. dataIndex: "column_useto",
  25441. // fix: ['system.getDict("column_useto")'],
  25442. header: "用途",
  25443. editor: {
  25444. xtype: 'combo',
  25445. allowBlank: false,
  25446. },
  25447. },
  25448. {
  25449. text: '主键', dataIndex: 'is_primary_key',
  25450. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25451. width: 48, resizable: false,
  25452. },
  25453. {
  25454. text: '必填', dataIndex: 'not_null',
  25455. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25456. width: 48, resizable: false,
  25457. },
  25458. {
  25459. text: '长度', dataIndex: 'column_size',
  25460. sortable: false, menuDisabled: true,
  25461. xtype: 'numbercolumn', format: '0',
  25462. editor: { allowBlank: true, selectOnFocus: true }
  25463. },
  25464. {
  25465. text: '字典', dataIndex: 'column_dict',
  25466. sortable: false, menuDisabled: true,
  25467. width: 200,
  25468. editor: {
  25469. allowBlank: true,
  25470. }
  25471. },
  25472. {
  25473. text: 'UI组件', dataIndex: 'column_ui',
  25474. sortable: false, menuDisabled: true,
  25475. // fix: ['system.getDict("column_ui")'],
  25476. width: 150,
  25477. editor: {
  25478. xtype: 'combo',
  25479. allowBlank: true,
  25480. }
  25481. },
  25482. {
  25483. dataIndex: 'data_type',
  25484. hidden: true,
  25485. },
  25486. ]
  25487. }
  25488. ],
  25489. },
  25490. {
  25491. vtitle: '其他选项',
  25492. reference: 'singleTable_3',
  25493. isEnd: true,
  25494. listeners: {
  25495. cardEnter: 'scope.extendEnter',
  25496. cardLevel: 'scope.extendLevel',
  25497. },
  25498. layout: 'fit',
  25499. items: [
  25500. {
  25501. xtype: 'form',
  25502. border: false,
  25503. layout: {
  25504. type: 'vbox',
  25505. align: 'stretch'
  25506. },
  25507. defaults: {
  25508. border: false,
  25509. anchor: '100%',
  25510. margin: '5',
  25511. },
  25512. items: [
  25513. {
  25514. xtype: 'checkbox',
  25515. fieldLabel: '需要分页',
  25516. labelWidth: 100,
  25517. bind: {
  25518. value: '{singleTable.pagination}',
  25519. },
  25520. },
  25521. {
  25522. xtype: 'combobox',
  25523. fieldLabel: '操作数据库表',
  25524. labelWidth: 100,
  25525. publishes: 'singleTable.tableName',
  25526. displayField: 'value',
  25527. valueField: 'value',
  25528. bind: {
  25529. data: '{singleTableView.tableNameList}',
  25530. value: '{singleTable.tableName}',
  25531. },
  25532. },
  25533. {
  25534. xtype: 'checkboxfield',
  25535. fieldLabel: '需要删除',
  25536. labelWidth: 100,
  25537. bind: {
  25538. value: '{singleTable.delete}',
  25539. },
  25540. },
  25541. {
  25542. xtype: 'combobox',
  25543. fieldLabel: '删除条件字段',
  25544. labelWidth: 100,
  25545. publishes: 'singleTable.deleteWhereColumn',
  25546. displayField: 'value',
  25547. valueField: 'value',
  25548. bind: {
  25549. data: '{singleTableView.columnList}',
  25550. hidden: '{!singleTable.delete}',
  25551. value: '{singleTable.deleteWhereColumn}',
  25552. },
  25553. },
  25554. {
  25555. xtype: 'textfield',
  25556. fieldLabel: '删除提示语句',
  25557. labelWidth: 100,
  25558. bind: {
  25559. hidden: '{!singleTable.delete}',
  25560. value: '{singleTable.deleteTips}',
  25561. },
  25562. },
  25563. {
  25564. fieldLabel: '新增与编辑',
  25565. labelWidth: 100,
  25566. xtype: 'radiogroup',
  25567. bind: {
  25568. value: '{singleTable.editType}'
  25569. },
  25570. layout: 'vbox',
  25571. defaults: {
  25572. border: false,
  25573. anchor: '100%',
  25574. margin: '5',
  25575. },
  25576. items: [
  25577. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25578. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25579. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25580. ]
  25581. },
  25582. ]
  25583. }
  25584. ]
  25585. },
  25586. // ---------------------------------------------------------------------------------- 主/明细查询
  25587. {
  25588. vtitle: '主表查询SQL',
  25589. reference: 'mainDetailTable_1',
  25590. layout: 'fit',
  25591. listeners: {},
  25592. items: [],
  25593. },
  25594. {
  25595. vtitle: '主表字段选项',
  25596. reference: 'mainDetailTable_2',
  25597. layout: 'fit',
  25598. listeners: {},
  25599. items: [],
  25600. },
  25601. {
  25602. vtitle: '主表其他选项',
  25603. reference: 'mainDetailTable_3',
  25604. layout: 'fit',
  25605. listeners: {},
  25606. items: [],
  25607. },
  25608. {
  25609. vtitle: '子表查询SQL',
  25610. reference: 'mainDetailTable_4',
  25611. layout: 'fit',
  25612. listeners: {},
  25613. items: [],
  25614. },
  25615. {
  25616. vtitle: '子表字段选项',
  25617. reference: 'mainDetailTable_5',
  25618. layout: 'fit',
  25619. listeners: {},
  25620. items: [],
  25621. },
  25622. {
  25623. vtitle: '子表其他选项',
  25624. reference: 'mainDetailTable_6',
  25625. isEnd: true,
  25626. layout: 'fit',
  25627. listeners: {},
  25628. items: [],
  25629. },
  25630. // ---------------------------------------------------------------------------------- 树/明细查询
  25631. // ---------------------------------------------------------------------------------- 卡片表单
  25632. {
  25633. vtitle: '表单字段',
  25634. reference: 'cardForm_1',
  25635. layout: 'fit',
  25636. listeners: {},
  25637. items: [],
  25638. },
  25639. {
  25640. vtitle: '表单初始化',
  25641. reference: 'cardForm_2',
  25642. isEnd: true,
  25643. layout: 'fit',
  25644. listeners: {},
  25645. items: [],
  25646. },
  25647. ]
  25648. };
  25649. //# sourceMappingURL=CreateModule.view.js.map
  25650. // noinspection TypeScriptCheckImport
  25651. function getSingleTableData(origin) {
  25652. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25653. var _a, _b, _c;
  25654. var data = {
  25655. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25656. package: _$2.replace(origin.packagePath, /\//g, "."),
  25657. groovyClass: origin.moduleName,
  25658. qClass: queryDslInfo.qClass,
  25659. qClassTable: queryDslInfo.qClassTable,
  25660. queryColumns: [],
  25661. insertColumns: [],
  25662. updateColumns: [],
  25663. updateWheres: [],
  25664. deleteWheres: [],
  25665. gridColumns: [],
  25666. sql: origin.sql,
  25667. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25668. addButton: origin.editType !== 1,
  25669. saveButton: origin.editType === 2,
  25670. deleteButton: true,
  25671. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25672. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25673. fileSavePath: origin.fileSavePath,
  25674. };
  25675. origin.columnList.forEach(function (column) {
  25676. 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;
  25677. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25678. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25679. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25680. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25681. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25682. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25683. if (query) {
  25684. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25685. }
  25686. if (insert) {
  25687. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25688. }
  25689. if (update) {
  25690. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25691. }
  25692. if (grid) {
  25693. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25694. if (column_dict) {
  25695. gridColumn.fix = { dictName: column_dict };
  25696. }
  25697. if (origin.editType == 2 && (insert || update)) {
  25698. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25699. if (column_dict) {
  25700. gridColumn.editor.fix = { dictName: column_dict };
  25701. }
  25702. }
  25703. data.gridColumns.push(gridColumn);
  25704. }
  25705. if (is_primary_key) {
  25706. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25707. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25708. }
  25709. });
  25710. return data;
  25711. });
  25712. }
  25713. // noinspection HttpUrlsUsage
  25714. var urlPrefix = "/static/studio-template/single_table";
  25715. function generateCode(data) {
  25716. return Promise.all([
  25717. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25718. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25719. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25720. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25721. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25722. ]).then(function (values) {
  25723. var groovy = handlebars.compile(values[0]);
  25724. var mybatis = handlebars.compile(values[1]);
  25725. var controller = handlebars.compile(values[2]);
  25726. var view = handlebars.compile(values[3]);
  25727. var model = handlebars.compile(values[4]);
  25728. var code = {
  25729. groovy: groovy(data),
  25730. mybatis: mybatis(data),
  25731. controller: controller(data),
  25732. view: view(data),
  25733. model: model(data),
  25734. };
  25735. return code;
  25736. });
  25737. }
  25738. //# sourceMappingURL=SingleTableCodegen.js.map
  25739. var CreateModule = /** @class */ (function (_super) {
  25740. __extends(CreateModule, _super);
  25741. function CreateModule() {
  25742. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25743. _this.columns = [];
  25744. return _this;
  25745. }
  25746. CreateModule.prototype.onLoad = function () {
  25747. this.refs.grid1.setData([]);
  25748. };
  25749. CreateModule.prototype.addField = function () {
  25750. this.refs.grid1.appendEditRow({
  25751. column_name: '',
  25752. column_comment: '',
  25753. is_primary_key: false,
  25754. not_null: true,
  25755. column_domain: '',
  25756. data_type: '',
  25757. column_size: 0,
  25758. decimal_digits: 0,
  25759. default_value: '',
  25760. column_dict: '',
  25761. column_ui: '',
  25762. column_note: '',
  25763. }, 0);
  25764. };
  25765. CreateModule.prototype.removeField = function () {
  25766. var _this = this;
  25767. var rows = [];
  25768. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25769. rows.push(r);
  25770. });
  25771. _$2.forEach(rows, function (r) {
  25772. _this.refs.grid1.getStore().remove(r);
  25773. });
  25774. };
  25775. CreateModule.prototype.parseSQL = function (sender) {
  25776. var _this = this;
  25777. var sql = this.viewModel.get('singleTable.sql');
  25778. sender.up('window').setLoading(true);
  25779. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25780. parseSqlApi(sql).then(function (parseResult) {
  25781. if (!parseResult.success) {
  25782. msg(parseResult.msg);
  25783. return;
  25784. }
  25785. var tableNameList = [];
  25786. var columnList = [];
  25787. var singleTableTableName;
  25788. var singleTableDeleteWhereColumn;
  25789. _this.refs.grid1.setData([]);
  25790. var rows = _this.refs.grid1.getDataRows();
  25791. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25792. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25793. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25794. return;
  25795. }
  25796. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25797. tableNameList.push({ value: tableName });
  25798. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25799. columnList.push({ value: columnName });
  25800. if (!singleTableTableName)
  25801. singleTableTableName = tableName;
  25802. if (!singleTableDeleteWhereColumn)
  25803. singleTableDeleteWhereColumn = columnName;
  25804. // 已经加过这个列了
  25805. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25806. if (rowExists) {
  25807. return;
  25808. }
  25809. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25810. if (columnRow) {
  25811. _this.refs.grid1.appendEditRow({
  25812. table_name: tableName,
  25813. column_name: columnRow.column_name,
  25814. column_comment: columnRow.column_comment,
  25815. column_useto: 2,
  25816. is_primary_key: columnRow.is_primary_key,
  25817. not_null: columnRow.not_null,
  25818. column_size: columnRow.column_size,
  25819. column_dict: columnRow.column_dict,
  25820. column_ui: columnRow.column_ui,
  25821. data_type: columnRow.data_type,
  25822. });
  25823. if (columnRow.is_primary_key)
  25824. singleTableDeleteWhereColumn = columnName;
  25825. }
  25826. else {
  25827. _this.refs.grid1.appendEditRow({
  25828. table_name: tableName,
  25829. column_name: columnName,
  25830. column_useto: 2,
  25831. });
  25832. }
  25833. });
  25834. _this.viewModel.set("singleTableView.columnList", columnList);
  25835. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25836. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25837. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25838. }).finally(function () {
  25839. sender.up('window').setLoading(false);
  25840. });
  25841. }).catch(function () {
  25842. sender.up('window').setLoading(false);
  25843. });
  25844. };
  25845. CreateModule.prototype.templateEnter = function (sender) {
  25846. };
  25847. CreateModule.prototype.templateLevel = function (sender, opt) {
  25848. if (!this.viewModel.get('moduleType')) {
  25849. msg('请选择模板类型');
  25850. opt.cancel = true;
  25851. return;
  25852. }
  25853. };
  25854. CreateModule.prototype.moduleEnter = function (sender) {
  25855. };
  25856. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25857. if (!sender.down('form').isValid()) {
  25858. opt.cancel = true;
  25859. return;
  25860. }
  25861. };
  25862. CreateModule.prototype.editorEnter = function (sender) {
  25863. var editor = sender.down('sqleditor');
  25864. editor.setValue(this.viewModel.get('singleTable.sql'));
  25865. };
  25866. CreateModule.prototype.editorLevel = function (sender, opt) {
  25867. var editor = sender.down('sqleditor');
  25868. var sql = editor.getValue();
  25869. if (!sql) {
  25870. msg('查询SQL语句必填');
  25871. opt.cancel = true;
  25872. return;
  25873. }
  25874. this.viewModel.set('singleTable.sql', sql);
  25875. };
  25876. CreateModule.prototype.columnEnter = function (sender) {
  25877. };
  25878. CreateModule.prototype.columnLevel = function (sender, opt) {
  25879. };
  25880. CreateModule.prototype.extendEnter = function (sender) {
  25881. };
  25882. CreateModule.prototype.extendLevel = function (sender, opt) {
  25883. };
  25884. // 确认结果 - Enter
  25885. CreateModule.prototype.optionEnter = function (sender) {
  25886. var _this = this;
  25887. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25888. var moduleType = this.viewModel.get("moduleType");
  25889. var data = this.viewModel.getData();
  25890. var code = "";
  25891. var origin = {};
  25892. if (moduleType === 1) {
  25893. var singleTable = data.singleTable;
  25894. var editColumns = this.refs.grid1.getDataRows();
  25895. origin.moduleType = data.moduleType;
  25896. origin.packagePath = data.packagePath;
  25897. origin.fileSavePath = data.fileSavePath;
  25898. origin.moduleName = data.moduleName;
  25899. origin.pageTitle = data.pageTitle;
  25900. if (singleTable) {
  25901. origin.sql = singleTable.sql;
  25902. origin.tableName = singleTable.tableName;
  25903. origin.pagination = singleTable.pagination;
  25904. origin.delete = singleTable.delete;
  25905. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25906. origin.deleteTips = singleTable.deleteTips;
  25907. origin.editType = singleTable.editType;
  25908. }
  25909. origin.columnList = [];
  25910. origin.queryColumns = [];
  25911. origin.insertColumns = [];
  25912. origin.updateColumns = [];
  25913. origin.gridColumns = [];
  25914. editColumns.forEach(function (column) {
  25915. var row = {
  25916. table_name: column.table_name,
  25917. column_name: column.column_name,
  25918. column_comment: column.column_comment,
  25919. is_primary_key: column.is_primary_key,
  25920. not_null: column.not_null,
  25921. column_size: column.column_size,
  25922. column_dict: column.column_dict,
  25923. column_ui: column.column_ui,
  25924. data_type: column.data_type,
  25925. column_type: column.column_type,
  25926. };
  25927. origin.columnList.push(row);
  25928. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25929. var column_name = column.column_name, column_useto = column.column_useto;
  25930. switch (column_useto) {
  25931. case 1:
  25932. origin.queryColumns.push(column_name);
  25933. break;
  25934. case 2:
  25935. origin.gridColumns.push(column_name);
  25936. break;
  25937. case 3:
  25938. origin.queryColumns.push(column_name);
  25939. origin.gridColumns.push(column_name);
  25940. break;
  25941. }
  25942. origin.insertColumns.push(column_name);
  25943. origin.updateColumns.push(column_name);
  25944. });
  25945. }
  25946. this.setLoading(true);
  25947. getSingleTableData(origin).then(function (data) {
  25948. code = JSON.stringify(data, null, 4);
  25949. window['lastTemplateData'] = code;
  25950. var editor = _this.refs.jsoneditor;
  25951. editor.setCode(code);
  25952. }).finally(function () { return _this.setLoading(false); });
  25953. };
  25954. // 确认结果 - Level
  25955. CreateModule.prototype.optionLevel = function (sender, opt) {
  25956. };
  25957. // 上一步
  25958. CreateModule.prototype.showPrevious = function () {
  25959. this.doCardNavigation(false);
  25960. };
  25961. // 下一步
  25962. CreateModule.prototype.showNext = function () {
  25963. this.doCardNavigation(true, true);
  25964. };
  25965. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25966. if (isNext === void 0) { isNext = true; }
  25967. if (isCancelable === void 0) { isCancelable = false; }
  25968. var layout = this._handle.getLayout();
  25969. var activeItem = layout.activeItem;
  25970. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25971. if (isNext)
  25972. this.prevCard = reference;
  25973. var activeCard;
  25974. if (reference === "templateSelection") {
  25975. if (isNext) {
  25976. activeCard = this.refs['moduleName'];
  25977. }
  25978. }
  25979. else if (reference === "moduleName") {
  25980. if (isNext) {
  25981. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25982. var moduleType = this.viewModel.get("moduleType");
  25983. switch (moduleType) {
  25984. case 1:
  25985. activeCard = this.refs['singleTable_1'];
  25986. break;
  25987. case 2:
  25988. activeCard = this.refs['mainDetailTable_1'];
  25989. break;
  25990. case 3:
  25991. // activeCard =
  25992. break;
  25993. case 4:
  25994. activeCard = this.refs['cardForm_1'];
  25995. break;
  25996. }
  25997. }
  25998. else {
  25999. activeCard = this.refs['templateSelection'];
  26000. }
  26001. }
  26002. else if (reference === "confirmResult") {
  26003. if (!isNext) {
  26004. activeCard = this.refs[this.prevCard];
  26005. }
  26006. }
  26007. else {
  26008. var name = reference.split('_')[0];
  26009. var idx = parseInt(reference.split('_')[1], 10);
  26010. if (isNext) {
  26011. if (isEnd) {
  26012. activeCard = this.refs['confirmResult'];
  26013. }
  26014. else {
  26015. idx += 1;
  26016. }
  26017. }
  26018. else {
  26019. idx -= 1;
  26020. }
  26021. if (idx <= 0) {
  26022. activeCard = this.refs['moduleName'];
  26023. }
  26024. else if (!activeCard) {
  26025. activeCard = this.refs[name + "_" + idx];
  26026. }
  26027. }
  26028. // 按钮状态
  26029. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26030. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26031. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26032. // 设置下一页显示
  26033. if (activeCard) {
  26034. var optCancel = { cancel: false };
  26035. // 发出 cardLevel 事件
  26036. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26037. if (isCancelable && optCancel.cancel) {
  26038. // 取消了
  26039. return;
  26040. }
  26041. layout.setActiveItem(activeCard);
  26042. this.viewModel.set('title', layout.activeItem.vtitle);
  26043. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26044. }
  26045. };
  26046. // 立刻执行
  26047. CreateModule.prototype.finish = function (sender) {
  26048. var _this = this;
  26049. var parent = sender.up('window');
  26050. var editor = this.refs.jsoneditor;
  26051. var data = JSON.parse(editor.getCode());
  26052. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26053. var moduleType = this.viewModel.get("moduleType");
  26054. if (moduleType === 1) {
  26055. this.setLoading(true);
  26056. generateCode(data).then(function (code) {
  26057. console.log("===> ", code);
  26058. _this.setLoading(true);
  26059. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26060. .then(function () {
  26061. msg("创建成功!");
  26062. parent.close();
  26063. handles$1.fileTree.reload();
  26064. }).finally(function () { return _this.setLoading(false); });
  26065. }).finally(function () { return _this.setLoading(false); });
  26066. }
  26067. };
  26068. return CreateModule;
  26069. }(Scope));
  26070. //# sourceMappingURL=CreateModule.js.map
  26071. function getModuleId(path) {
  26072. var separator = "/";
  26073. var sps = path.split(separator);
  26074. var joinSps = sps.join('$');
  26075. if (!joinSps) {
  26076. return "ROOT";
  26077. }
  26078. return joinSps;
  26079. }
  26080. /**
  26081. * Module数据转换成Tree数据
  26082. */
  26083. function modulesToTreeData(modules) {
  26084. var separator = "/";
  26085. var treeNodeMap = new Map();
  26086. var root = {
  26087. type: "Dir",
  26088. path: "",
  26089. expanded: true,
  26090. leaf: false,
  26091. children: [],
  26092. };
  26093. root.id = getModuleId(root.path);
  26094. treeNodeMap.set(root.path, root);
  26095. modules.forEach(function (module) {
  26096. var _a;
  26097. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26098. if (paths.length <= 0)
  26099. return;
  26100. var path = [];
  26101. var parent = root;
  26102. paths.forEach(function (dirName, idx) {
  26103. var parentPath = path.join(separator);
  26104. parent = treeNodeMap.get(parentPath);
  26105. path.push(dirName);
  26106. var currentPath = path.join(separator);
  26107. var child = treeNodeMap.get(currentPath);
  26108. if (child == null) {
  26109. // 获取当前path 绝对路径
  26110. var indexLength = module.absolutePath.indexOf(currentPath);
  26111. var currentAbsolutePath = "";
  26112. if (indexLength > 0) {
  26113. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26114. }
  26115. child = {
  26116. type: "Dir",
  26117. path: currentPath,
  26118. absolutePath: currentAbsolutePath,
  26119. leaf: false,
  26120. children: [],
  26121. text: dirName
  26122. };
  26123. child.id = getModuleId(child.path);
  26124. parent.children.push(child);
  26125. treeNodeMap.set(child.path, child);
  26126. }
  26127. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26128. var leaf = {
  26129. type: "Module",
  26130. path: module.path + separator + module.name,
  26131. absolutePath: module.absolutePath,
  26132. leaf: true,
  26133. text: module.name,
  26134. module: module,
  26135. };
  26136. leaf.id = getModuleId(leaf.path);
  26137. child.children.push(leaf);
  26138. treeNodeMap.set(leaf.path, leaf);
  26139. }
  26140. });
  26141. });
  26142. // 排序处理
  26143. treeNodeMap.forEach(function (module) {
  26144. if (module.children) {
  26145. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26146. module.children.length = 0;
  26147. children.forEach(function (item) { return module.children.push(item); });
  26148. }
  26149. });
  26150. return root;
  26151. }
  26152. function showDialog(sender, option) {
  26153. var _a, _b;
  26154. var win = new Ext.Window({
  26155. autoDestroy: true,
  26156. title: option.title,
  26157. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26158. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26159. resizable: false,
  26160. closable: true,
  26161. modal: true,
  26162. maximizable: false,
  26163. minimizable: false,
  26164. // constrainHeader: true,
  26165. constrain: true,
  26166. layout: 'fit',
  26167. animateTarget: sender,
  26168. buttonAlign: 'center',
  26169. items: [
  26170. {
  26171. xtype: "form",
  26172. layout: "hbox",
  26173. margin: '10px 20px',
  26174. border: 0,
  26175. items: option.items
  26176. }
  26177. ],
  26178. //窗口按钮
  26179. fbar: [
  26180. {
  26181. xtype: 'button', text: '保存', handler: function (btn) {
  26182. //窗口获取表单
  26183. var form = win.down('form');
  26184. var vaildSuccess = form.isValid();
  26185. if (!vaildSuccess) {
  26186. return;
  26187. }
  26188. option.submitFunc(form);
  26189. }
  26190. },
  26191. {
  26192. xtype: 'button', text: '取消', handler: function (btn) {
  26193. //窗口关闭
  26194. btn.up('window').close();
  26195. }
  26196. }
  26197. ],
  26198. });
  26199. win.show();
  26200. }
  26201. function showCreateFolderWin(sender, parentPath) {
  26202. showDialog(sender, {
  26203. title: '新建文件夹',
  26204. height: 150,
  26205. items: [
  26206. {
  26207. xtype: "textfield",
  26208. name: "filename",
  26209. fieldLabel: "文件夹名称",
  26210. allowBlank: false,
  26211. selectOnFocus: true,
  26212. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26213. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26214. labelWidth: 80,
  26215. width: "100%",
  26216. listeners: {
  26217. afterrender: function (sender) {
  26218. _$2.defer(function () {
  26219. sender.focus();
  26220. });
  26221. }
  26222. }
  26223. },
  26224. ],
  26225. submitFunc: function (form) {
  26226. var filename = form.down('textfield[name="filename"]').getValue();
  26227. createFolder(parentPath, filename).then(function (res) {
  26228. if (res.success) {
  26229. msg$1('创建成功');
  26230. handles$1.fileTree.reload();
  26231. form.up('window').close();
  26232. }
  26233. else {
  26234. showErrorDialog$1(res.msg);
  26235. }
  26236. }).catch(function (e) {
  26237. showErrorDialog$1(e.responseJSON.msg);
  26238. });
  26239. }
  26240. });
  26241. }
  26242. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26243. var dlg = new CreateModule();
  26244. dlg.showDialog(sender, {}, {
  26245. data: {
  26246. packagePath: path,
  26247. fileSavePath: absolutePath,
  26248. }
  26249. });
  26250. }
  26251. function registerModule$1(sender, path, name, icon) {
  26252. // 前缀 com/galaxis/wms 写死了
  26253. var dlg = new RegisterModule();
  26254. dlg.showDialog(sender, {}, {
  26255. data: {
  26256. form: {
  26257. scope_url: path.replace("com/galaxis/wms", "."),
  26258. resource_name: name,
  26259. resource_icon: icon,
  26260. }
  26261. }
  26262. });
  26263. }
  26264. function showCreateEmptyModule(sender, path) {
  26265. var win = new Ext.Window({
  26266. autoDestroy: true,
  26267. title: "新建空模块",
  26268. width: 400,
  26269. height: 150,
  26270. resizable: true,
  26271. closable: true,
  26272. maximizable: true,
  26273. minimizable: true,
  26274. plain: true,
  26275. // constrainHeader: true,
  26276. constrain: true,
  26277. layout: 'fit',
  26278. animateTarget: sender,
  26279. buttonAlign: 'center',
  26280. items: [
  26281. {
  26282. xtype: "form",
  26283. layout: "hbox",
  26284. margin: '10px 20px',
  26285. border: 0,
  26286. items: [
  26287. {
  26288. flex: 1,
  26289. layout: 'vbox',
  26290. items: [
  26291. {
  26292. xtype: "textfield",
  26293. name: "filename",
  26294. fieldLabel: "模块名",
  26295. flex: 1,
  26296. allowBlank: false,
  26297. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26298. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26299. labelWidth: 50,
  26300. width: "100%",
  26301. },
  26302. ]
  26303. },
  26304. ]
  26305. }
  26306. ],
  26307. //窗口按钮
  26308. buttons: [
  26309. {
  26310. xtype: 'button', text: '保存', handler: function (btn) {
  26311. //窗口获取表单
  26312. var form = win.down('form');
  26313. var vaildSuccess = form.isValid();
  26314. if (!vaildSuccess) {
  26315. return;
  26316. }
  26317. var filename = form.down('textfield[name="filename"]').getValue();
  26318. createEmptyModule(path, filename).then(function (res) {
  26319. if (res.success) {
  26320. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26321. handles$1.fileTree.reload();
  26322. win.close();
  26323. }
  26324. else {
  26325. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26326. }
  26327. }).catch(function (e) {
  26328. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26329. });
  26330. }
  26331. },
  26332. {
  26333. xtype: 'button', text: '取消', handler: function (btn) {
  26334. //窗口关闭
  26335. win.close();
  26336. }
  26337. }
  26338. ]
  26339. });
  26340. win.show();
  26341. }
  26342. //# sourceMappingURL=FileHelp.js.map
  26343. function initFileTree () {
  26344. Ext.define('com.yvan.studio.FileTree', {
  26345. extend: 'com.yvan.studio.StateTree',
  26346. xtype: 'filetree',
  26347. tooltip: '文件',
  26348. iconCls: 'x-fa fa-file',
  26349. rootVisible: false,
  26350. useArrows: true,
  26351. colspan: 2,
  26352. lines: true,
  26353. reference: 'filetree',
  26354. multiSelect: true,
  26355. getStateFilename: function () {
  26356. return getCurrentProject().uuid + "/filetree.json";
  26357. },
  26358. openNode: function () {
  26359. var selection = this.getSelection();
  26360. var _a = __read(selection, 1), record = _a[0];
  26361. if (!record) {
  26362. return;
  26363. }
  26364. var raw = record.raw;
  26365. if (raw.type === 'Dir') {
  26366. return;
  26367. }
  26368. if (raw.type === "Module" && raw.module) {
  26369. eventBus.publish(EventType.ModuleOpen, raw);
  26370. }
  26371. },
  26372. openInIdea: function () {
  26373. var _a = __read(this.getSelection(), 1), record = _a[0];
  26374. if (record) {
  26375. var data = record.data;
  26376. if (data.type === "Module") {
  26377. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26378. native.openInIdea(data.module.groovyFile.absolutePath);
  26379. }
  26380. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26381. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26382. }
  26383. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26384. native.openInIdea(data.module.jsViewFile.absolutePath);
  26385. }
  26386. return;
  26387. }
  26388. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26389. }
  26390. },
  26391. deleteSelection: function () {
  26392. var selection = this.getSelection();
  26393. var pathList = [];
  26394. _.forEach(selection, function (item) {
  26395. if (item.data.type === "Dir") {
  26396. pathList.push({ path: item.data.path, isFolder: true });
  26397. }
  26398. else {
  26399. pathList.push({ path: item.data.path, isFolder: false });
  26400. }
  26401. });
  26402. {
  26403. return;
  26404. }
  26405. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26406. //
  26407. // Ext.Msg.confirm('提示', title, (btn) => {
  26408. // if (btn === 'yes') {
  26409. // deleteFileOrFolder(raw.path, title, true)
  26410. // }
  26411. // })
  26412. // const title = '您确定要删除(' + raw.path + ')吗?'
  26413. // deleteFileOrFolder(raw.path, title, false)
  26414. },
  26415. listeners: {
  26416. itemverify: function () {
  26417. this.openNode();
  26418. },
  26419. afterrender: function (me) {
  26420. console.log('filetree_afterrender', 'reloadIfNeed');
  26421. moduleStore.registe(me.subscribeModule.bind(this));
  26422. moduleStore.reloadIfNeed("PC");
  26423. },
  26424. destroy: function (me) {
  26425. console.log('filetree_destroy');
  26426. moduleStore.unregiste(me.subscribeModule.bind(this));
  26427. },
  26428. itemcontextmenu: function (sender, node, element, idx, e) {
  26429. e.preventDefault();
  26430. var raw = node.raw;
  26431. var option = {};
  26432. if (raw.type === 'Dir') {
  26433. // 文件夹右键
  26434. option = {
  26435. shadow: 'frame', allowOtherMenus: true,
  26436. items: [
  26437. {
  26438. text: '新建空模块',
  26439. iconCls: 'x-fa fa-plus-circle',
  26440. handler: function (sender) {
  26441. showCreateEmptyModule(sender, raw.path);
  26442. }
  26443. },
  26444. {
  26445. text: '新建模块',
  26446. iconCls: 'x-fa fa-plus-circle',
  26447. handler: function (sender) {
  26448. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26449. }
  26450. },
  26451. '-',
  26452. {
  26453. text: '新建文件夹',
  26454. iconCls: 'x-fa fa-folder-o',
  26455. handler: function (sender) {
  26456. var parentPath = raw.path;
  26457. showCreateFolderWin(sender, parentPath);
  26458. }
  26459. },
  26460. {
  26461. text: '复制路径',
  26462. iconCls: 'x-fa fa-external-link',
  26463. handler: function (sender) {
  26464. native.clipboardSet(raw.path);
  26465. }
  26466. },
  26467. ]
  26468. };
  26469. }
  26470. else {
  26471. // 文件右键
  26472. option = {
  26473. shadow: 'frame', allowOtherMenus: true,
  26474. items: [
  26475. // {
  26476. // text: '重命名',
  26477. // iconCls: 'x-fa fa-terminal',
  26478. // handler(sender) {
  26479. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26480. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26481. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26482. // }
  26483. // },
  26484. // {
  26485. // text: '另存为',
  26486. // iconCls: 'x-fa fa-exchange',
  26487. // handler(sender) {
  26488. // console.error('没做')
  26489. // }
  26490. // },
  26491. {
  26492. text: '复制路径',
  26493. iconCls: 'x-fa fa-external-link',
  26494. handler: function (sender) {
  26495. native.clipboardSet(raw.path);
  26496. }
  26497. },
  26498. '-',
  26499. {
  26500. text: '注册模块',
  26501. iconCls: 'x-fa fa-sign-in',
  26502. handler: function (sender) {
  26503. registerModule$1(sender, raw.path);
  26504. }
  26505. },
  26506. ]
  26507. };
  26508. }
  26509. var treeMenu = new Ext.menu.Menu(option);
  26510. treeMenu.showAt(e.getXY());
  26511. },
  26512. },
  26513. tbar: [
  26514. {
  26515. xtype: 'button',
  26516. iconCls: 'x-fa fa-crosshairs',
  26517. tooltip: '选中当前打开的文件',
  26518. handler: function (sender) {
  26519. msg$1('没做');
  26520. }
  26521. },
  26522. {
  26523. xtype: 'button',
  26524. iconCls: 'x-fa fa-link',
  26525. tooltip: '在IDEA中打开',
  26526. handler: function (sender) {
  26527. var scope = sender.up("filetree");
  26528. scope.openInIdea();
  26529. }
  26530. },
  26531. {
  26532. xtype: 'button',
  26533. iconCls: 'x-fa fa-refresh',
  26534. tooltip: '刷新',
  26535. handler: function (sender) {
  26536. var scope = sender.up("filetree");
  26537. scope.reload();
  26538. }
  26539. },
  26540. {
  26541. xtype: 'button',
  26542. iconCls: 'x-fa fa-percent',
  26543. tooltip: '监控',
  26544. handler: function (sender) {
  26545. // handles.mainWindow.showPerform()
  26546. }
  26547. },
  26548. ],
  26549. initComponent: function () {
  26550. setFileTree(this);
  26551. this.superclass.initComponent.apply(this, arguments);
  26552. // super.initComponent.apply(this, arguments)
  26553. },
  26554. subscribeModule: function (res) {
  26555. if (typeof res === 'object') {
  26556. var rootNode = modulesToTreeData(res.data);
  26557. this.setRootNode(rootNode);
  26558. this.restoreState();
  26559. handles$1.mainWindow.modules = res.data;
  26560. }
  26561. else if (typeof res === 'boolean') {
  26562. this.setLoading(res);
  26563. }
  26564. },
  26565. reload: function () {
  26566. console.log('filetree_reloadForce');
  26567. moduleStore.reloadForce("PC").then(function (res) {
  26568. });
  26569. }
  26570. });
  26571. }
  26572. //# sourceMappingURL=FileTree.js.map
  26573. function initDbTree () {
  26574. var define = {
  26575. extend: 'com.yvan.studio.StateTree',
  26576. xtype: 'dbtree',
  26577. tooltip: '数据库',
  26578. iconCls: 'x-fa fa-database',
  26579. rootVisible: false,
  26580. useArrows: true,
  26581. reference: 'dbtree',
  26582. multiSelect: true,
  26583. getStateFilename: function () {
  26584. return getCurrentProject().uuid + "/dbtree.json";
  26585. },
  26586. tbar: [
  26587. {
  26588. xtype: 'button',
  26589. iconCls: 'x-fa fa-crosshairs',
  26590. tooltip: '选中当前打开的表',
  26591. handler: function (sender) {
  26592. var _a;
  26593. // 获取当前选中的活动标签 tableColumn_bas_car
  26594. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26595. if (!locatPath) {
  26596. return;
  26597. }
  26598. handles$1.dbTree.selectPath(locatPath);
  26599. }
  26600. },
  26601. {
  26602. xtype: 'button',
  26603. iconCls: 'x-fa fa-refresh',
  26604. tooltip: '刷新',
  26605. handler: function (sender) {
  26606. handles$1.dbTree.reload();
  26607. }
  26608. },
  26609. {
  26610. xtype: 'button',
  26611. iconCls: 'x-fa fa-cloud-download',
  26612. tooltip: '重新拉取生成元数据(耗时很长!)',
  26613. handler: function (sender) {
  26614. handles$1.dbTree.dbToMetaAndReload(sender);
  26615. }
  26616. },
  26617. // {
  26618. // xtype: 'button',
  26619. // iconCls: 'x-fa fa-files-o',
  26620. // tooltip: '数据同步',
  26621. // handler(sender) {
  26622. //
  26623. // }
  26624. // },
  26625. {
  26626. xtype: 'button',
  26627. iconCls: 'x-fa fa-exchange',
  26628. tooltip: '数据结构同步',
  26629. handler: function (sender) {
  26630. // handles.mainWindow.showDataSync(sender)
  26631. }
  26632. },
  26633. {
  26634. xtype: 'button',
  26635. iconCls: 'x-fa fa-window-maximize',
  26636. tooltip: 'SQL查询分析器',
  26637. handler: function (sender) {
  26638. // handles.mainWindow.showDbCodeTemplate(sender)
  26639. }
  26640. },
  26641. {
  26642. xtype: 'button',
  26643. iconCls: 'x-fa fa-cubes',
  26644. tooltip: '数据域管理',
  26645. handler: function (sender) {
  26646. // handles.mainWindow.showColumnDomain()
  26647. }
  26648. },
  26649. {
  26650. xtype: 'button',
  26651. iconCls: 'x-fa fa-edit',
  26652. tooltip: '修改结构',
  26653. handler: function (sender) {
  26654. var tree = sender.up("treepanel");
  26655. var selection = tree.getSelection();
  26656. var _a = __read(selection, 1), node = _a[0];
  26657. if (!node) {
  26658. msg$1('请选择一个表');
  26659. return;
  26660. }
  26661. var raw = node.data.raw;
  26662. if (node.get('type') === 'table') ;
  26663. else if (node.get('type') === 'column') ;
  26664. }
  26665. },
  26666. ],
  26667. listeners: {
  26668. afterrender: function (me) {
  26669. setDbTree(this);
  26670. // 找管理器订阅刷新的事件
  26671. instance$1.registe(this.refreshData.bind(this));
  26672. instance$1.reloadIfNeed(undefined);
  26673. },
  26674. destory: function (me) {
  26675. setDbTree(undefined);
  26676. instance$1.unregiste(this.refreshData.bind(this));
  26677. },
  26678. itemcontextmenu: function (sender, node, element, idx, e) {
  26679. var _this = this;
  26680. e.preventDefault();
  26681. var option = {};
  26682. var raw = node.raw.raw;
  26683. if (node.get('type') === 'column') {
  26684. option = {
  26685. shadow: 'frame', allowOtherMenus: true,
  26686. items: [
  26687. {
  26688. text: '设计结构',
  26689. iconCls: 'x-fa fa-edit',
  26690. handler: function (sender) {
  26691. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26692. }
  26693. },
  26694. ]
  26695. };
  26696. }
  26697. else if (node.get('type') === 'table') {
  26698. option = {
  26699. shadow: 'frame', allowOtherMenus: true,
  26700. items: [
  26701. {
  26702. text: '新建',
  26703. iconCls: 'x-fa fa-plus',
  26704. handler: function (sender) {
  26705. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26706. }
  26707. },
  26708. {
  26709. text: '设计结构',
  26710. iconCls: 'x-fa fa-edit',
  26711. handler: function (sender) {
  26712. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26713. }
  26714. },
  26715. {
  26716. text: '重命名',
  26717. iconCls: 'x-fa fa-pencil',
  26718. handler: function (sender) {
  26719. _this.renameTable(sender, node.data.raw);
  26720. }
  26721. },
  26722. '-',
  26723. {
  26724. text: '删除',
  26725. iconCls: 'x-fa fa-minus',
  26726. handler: function (sender) {
  26727. _this.removeTable(sender, node.data.raw);
  26728. }
  26729. },
  26730. ]
  26731. };
  26732. }
  26733. var treeMenu = new Ext.menu.Menu(option);
  26734. treeMenu.showAt(e.getXY());
  26735. }
  26736. },
  26737. // DbTreeStore 刷新时,会回调到这个方法
  26738. refreshData: function (isLoadingState) {
  26739. var me = this;
  26740. if (typeof isLoadingState === 'boolean') {
  26741. me.setLoading(isLoadingState);
  26742. return;
  26743. }
  26744. var rootNode = getDbTree(instance$1.apiResponse);
  26745. me.setRootNode(rootNode);
  26746. this.restoreState();
  26747. },
  26748. renameTable: function (sender, tableRow) {
  26749. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26750. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26751. if (!res.data)
  26752. return;
  26753. var window = Ext.create('Ext.window.Window', {
  26754. title: 'SQL 预览',
  26755. height: 400,
  26756. width: 600,
  26757. modal: true,
  26758. animateTarget: sender,
  26759. maximizable: true,
  26760. layout: 'fit',
  26761. items: {
  26762. xtype: 'sqleditor',
  26763. value: res.data,
  26764. },
  26765. buttons: [
  26766. {
  26767. xtype: 'button',
  26768. text: '执行',
  26769. iconCls: 'x-fa fa-save',
  26770. handler: function (sender) {
  26771. var editor = sender.up('window').down('sqleditor');
  26772. var ddl = editor.getValue();
  26773. window.setLoading(true);
  26774. instance$1.pushToDbCommit({
  26775. schema_name: tableRow.schema_name,
  26776. table_name: name,
  26777. old_table_name: tableRow.table_name,
  26778. ddl: ddl,
  26779. }).then(function () {
  26780. handles$1.dbTree.reload();
  26781. window.close();
  26782. }).finally(function () { return window.setLoading(false); });
  26783. },
  26784. },
  26785. {
  26786. xtype: 'button',
  26787. text: '取消',
  26788. iconCls: 'x-fa fa-times',
  26789. handler: function () {
  26790. window.close();
  26791. }
  26792. },
  26793. ]
  26794. }).show();
  26795. });
  26796. });
  26797. },
  26798. removeTable: function (sender, tableRow) {
  26799. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26800. if (!res.data)
  26801. return;
  26802. var window = Ext.create('Ext.window.Window', {
  26803. title: 'SQL 预览',
  26804. height: 400,
  26805. width: 600,
  26806. modal: true,
  26807. animateTarget: sender,
  26808. maximizable: true,
  26809. layout: 'fit',
  26810. items: {
  26811. xtype: 'sqleditor',
  26812. value: res.data,
  26813. },
  26814. buttons: [
  26815. {
  26816. xtype: 'button',
  26817. text: '执行',
  26818. iconCls: 'x-fa fa-save',
  26819. handler: function (sender) {
  26820. var editor = sender.up('window').down('sqleditor');
  26821. var ddl = editor.getValue();
  26822. window.setLoading(true);
  26823. instance$1.pushToDbCommit({
  26824. schema_name: tableRow.schema_name,
  26825. table_name: tableRow.table_name,
  26826. ddl: ddl
  26827. })
  26828. .then(function () {
  26829. handles$1.dbTree.reload();
  26830. window.close();
  26831. }).finally(function () { return window.setLoading(false); });
  26832. }
  26833. },
  26834. {
  26835. xtype: 'button',
  26836. text: '取消',
  26837. iconCls: 'x-fa fa-times',
  26838. handler: function () {
  26839. window.close();
  26840. }
  26841. }
  26842. ]
  26843. }).show();
  26844. });
  26845. },
  26846. // hideHeaders: true,
  26847. // columns: [
  26848. // {
  26849. // xtype: 'treecolumn',
  26850. // text: '名称',
  26851. // dataIndex: 'text',
  26852. // flex: 2,
  26853. // }, {
  26854. // text: '描述',
  26855. // dataIndex: 'comment',
  26856. // flex: 1,
  26857. // }
  26858. // ],
  26859. reload: function () {
  26860. // 强制刷新 DbManager
  26861. instance$1.reloadForce(undefined);
  26862. },
  26863. dbToMetaAndReload: function () {
  26864. // 从数据库结构重新生成元数据
  26865. instance$1.dbToMetaAndReload();
  26866. }
  26867. };
  26868. Ext.define('com.yvan.studio.DbTree', define);
  26869. }
  26870. /**
  26871. * 将数据构建成 dbTree 需要的格式
  26872. */
  26873. function getDbTree(apiResponse) {
  26874. var rootNode = {
  26875. children: [],
  26876. expanded: true,
  26877. id: "ROOT",
  26878. leaf: false,
  26879. };
  26880. _$2.forEach(apiResponse, function (schemaRow) {
  26881. var schemaNode = {
  26882. id: 'schema$' + schemaRow.schema_name,
  26883. type: "schema",
  26884. expanded: true,
  26885. leaf: false,
  26886. iconCls: 'x-fa fa-th-large ',
  26887. text: schemaRow.schema_name,
  26888. raw: __assign({}, schemaRow),
  26889. children: [],
  26890. };
  26891. delete schemaNode.raw.table_list;
  26892. rootNode.children.push(schemaNode);
  26893. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26894. var _a;
  26895. var tableNode = {
  26896. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26897. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26898. comment: tableRow.description,
  26899. type: "table",
  26900. iconCls: 'x-fa fa-table',
  26901. expanded: false,
  26902. leaf: false,
  26903. children: [],
  26904. raw: __assign({}, tableRow)
  26905. };
  26906. delete tableNode.raw.column_list;
  26907. schemaNode.children.push(tableNode);
  26908. _$2.forEach(tableRow.column_list, function (columnRow) {
  26909. var _a;
  26910. var iconCls = 'x-fa fa-square-o';
  26911. if (columnRow.is_primary_key) {
  26912. iconCls = 'x-fa fa-key';
  26913. }
  26914. else if (columnRow.not_null) {
  26915. iconCls = 'x-fa fa-check-square';
  26916. }
  26917. var columnNode = {
  26918. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26919. type: "column",
  26920. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26921. comment: columnRow.column_comment,
  26922. leaf: true,
  26923. iconCls: iconCls,
  26924. raw: __assign({}, columnRow)
  26925. };
  26926. tableNode.children.push(columnNode);
  26927. }); // column
  26928. }); // table
  26929. }); // schema
  26930. return rootNode;
  26931. }
  26932. //# sourceMappingURL=DbTree.js.map
  26933. var ReportGridController = /** @class */ (function () {
  26934. function ReportGridController() {
  26935. }
  26936. ReportGridController.prototype.onLoad = function (sender) {
  26937. this.reload();
  26938. setReport(this);
  26939. };
  26940. ReportGridController.prototype.showSingle = function (sender) {
  26941. var _this = this;
  26942. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26943. if (record) {
  26944. handles.mainWindow.showFormSingle(record.data, function () {
  26945. _this.reload();
  26946. });
  26947. }
  26948. };
  26949. ReportGridController.prototype.filterChanged = function (sender, value) {
  26950. console.log('filterChange', sender, value);
  26951. this.view.store.clearFilter();
  26952. if (value) {
  26953. this.view.store.filterBy(function (record) {
  26954. var code = _.lowerCase(record.get('report_name'));
  26955. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26956. return (code.includes(value) ||
  26957. dict_desc_py.includes(value));
  26958. });
  26959. }
  26960. };
  26961. ReportGridController.prototype.onClearClick = function () {
  26962. var _a, _b;
  26963. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26964. };
  26965. ReportGridController.prototype.reload = function () {
  26966. var me = this;
  26967. me.getView().setLoading(true);
  26968. reportListApi().then(function (res) {
  26969. _.forEach(res.data, function (r) {
  26970. r.report_enable = r.report_enable === 1;
  26971. });
  26972. me.getView().setStore(new Ext.data.Store({
  26973. fields: ['report_id', 'report_name', 'report_enable'],
  26974. data: res.data,
  26975. }));
  26976. }).finally(function () {
  26977. me.getView().setLoading(false);
  26978. });
  26979. };
  26980. ReportGridController.prototype.reportAdd = function () {
  26981. var _this = this;
  26982. prompt$2('请输入报表名称').then(function (name) {
  26983. createReportApi(name).then(function (res) {
  26984. if (res.success) {
  26985. msg$1('添加成功');
  26986. handles.mainWindow.showReport(res.data, name, function () {
  26987. _this.reload();
  26988. });
  26989. }
  26990. _this.reload();
  26991. });
  26992. });
  26993. };
  26994. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26995. e.preventDefault();
  26996. var me = sender.up('grid').ownerGrid.getController();
  26997. var option = {
  26998. shadow: 'frame', allowOtherMenus: true,
  26999. items: [
  27000. {
  27001. text: '添加',
  27002. iconCls: 'x-fa fa-plus-circle',
  27003. handler: function (sender) {
  27004. me.reportAdd();
  27005. }
  27006. },
  27007. {
  27008. text: '编辑',
  27009. iconCls: 'x-fa fa-edit',
  27010. handler: function (sender) {
  27011. me.reportEdit();
  27012. }
  27013. },
  27014. {
  27015. text: '删除',
  27016. iconCls: 'x-fa fa-minus-circle',
  27017. handler: function (sender) {
  27018. me.reportRemove();
  27019. }
  27020. },
  27021. '-',
  27022. {
  27023. text: '注册(至菜单)',
  27024. iconCls: 'x-fa fa-sign-in',
  27025. handler: function (sender) {
  27026. me.reportRegiste(sender);
  27027. }
  27028. },
  27029. {
  27030. text: '卸载',
  27031. iconCls: 'x-fa fa-sign-out',
  27032. handler: function (sender) {
  27033. console.error('没做');
  27034. }
  27035. },
  27036. ]
  27037. };
  27038. var treeMenu = new Ext.menu.Menu(option);
  27039. treeMenu.showAt(e.getXY());
  27040. };
  27041. ReportGridController.prototype.reportRegiste = function (sender) {
  27042. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27043. if (record) {
  27044. var reportName = record.get('report_name');
  27045. var reportId = record.get('report_id');
  27046. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27047. }
  27048. };
  27049. ReportGridController.prototype.reportRemove = function () {
  27050. var _this = this;
  27051. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27052. if (record) {
  27053. var reportName = record.get('report_name');
  27054. var reportId_1 = record.get('report_id');
  27055. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27056. delReportApi(reportId_1).then(function (res) {
  27057. if (res.success) {
  27058. msg$1('删除成功');
  27059. _this.reload();
  27060. }
  27061. });
  27062. });
  27063. }
  27064. };
  27065. ReportGridController.prototype.reportEdit = function () {
  27066. var _this = this;
  27067. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27068. if (record) {
  27069. var reportName = record.get('report_name');
  27070. var reportId = record.get('report_id');
  27071. handles.mainWindow.showReport(reportId, reportName, function () {
  27072. _this.reload();
  27073. });
  27074. }
  27075. };
  27076. ReportGridController.prototype.onDblClick = function (sender) {
  27077. this.reportEdit();
  27078. };
  27079. return ReportGridController;
  27080. }());
  27081. //# sourceMappingURL=ReportGridController.js.map
  27082. function initReportGrid () {
  27083. var controller = new ReportGridController();
  27084. Ext.define('com.yvan.studio.ReportGrid', {
  27085. extend: 'Ext.grid.Panel',
  27086. xtype: 'reportGrid',
  27087. controller: controller,
  27088. scope: controller,
  27089. referenceHolder: true,
  27090. tooltip: '查询报表',
  27091. iconCls: 'x-fa fa-bar-chart',
  27092. useArrows: true,
  27093. reference: 'reportgrid',
  27094. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27095. listeners: {
  27096. itemdblclick: 'onDblClick',
  27097. afterrender: 'onLoad',
  27098. },
  27099. viewConfig: {
  27100. enableTextSelection: true,
  27101. listeners: {
  27102. itemcontextmenu: 'onGridContextMenu',
  27103. },
  27104. },
  27105. tbar: {
  27106. xtype: 'toolbar',
  27107. items: [
  27108. {
  27109. xtype: 'button',
  27110. tooltip: '测试',
  27111. iconCls: 'x-fa fa-bars',
  27112. listeners: {
  27113. click: 'showSingle'
  27114. }
  27115. },
  27116. {
  27117. xtype: 'button',
  27118. tooltip: '刷新',
  27119. iconCls: 'x-fa fa-refresh',
  27120. listeners: {
  27121. click: 'reload'
  27122. }
  27123. },
  27124. {
  27125. xtype: 'button',
  27126. tooltip: '添加',
  27127. iconCls: 'x-fa fa-plus-circle',
  27128. listeners: {
  27129. click: 'reportAdd'
  27130. }
  27131. },
  27132. {
  27133. xtype: 'button',
  27134. tooltip: '删除',
  27135. iconCls: 'x-fa fa-minus-circle',
  27136. listeners: {
  27137. click: 'reportRemove'
  27138. }
  27139. },
  27140. {
  27141. xtype: 'textfield',
  27142. flex: 1,
  27143. reference: "txtFilter",
  27144. emptyText: '搜索过滤',
  27145. enableKeyEvents: true,
  27146. listeners: {
  27147. change: {
  27148. fn: 'filterChanged',
  27149. buffer: 50
  27150. }
  27151. }
  27152. },
  27153. ]
  27154. },
  27155. columns: [
  27156. {
  27157. text: 'ID', dataIndex: 'report_id',
  27158. hidden: true,
  27159. },
  27160. {
  27161. text: '报表名称', dataIndex: 'report_name',
  27162. flex: 1,
  27163. },
  27164. ]
  27165. });
  27166. }
  27167. //# sourceMappingURL=ReportGrid.js.map
  27168. /** 所有变量类型 */
  27169. var TypeEnum;
  27170. (function (TypeEnum) {
  27171. TypeEnum["string"] = "string";
  27172. TypeEnum["number"] = "number";
  27173. TypeEnum["object"] = "object";
  27174. TypeEnum["array"] = "array";
  27175. TypeEnum["function"] = "function";
  27176. TypeEnum["null"] = "null";
  27177. TypeEnum["boolean"] = "boolean";
  27178. TypeEnum["symbol"] = "symbol";
  27179. TypeEnum["json"] = "json";
  27180. TypeEnum["math"] = "math";
  27181. TypeEnum["regexp"] = "regexp";
  27182. TypeEnum["date"] = "date";
  27183. TypeEnum["undefined"] = "undefined";
  27184. TypeEnum["nan"] = "nan";
  27185. TypeEnum["reactNode"] = "react_node";
  27186. })(TypeEnum || (TypeEnum = {}));
  27187. /**
  27188. * 判断对象类型
  27189. * @param object 对象
  27190. */
  27191. var variableTypeOf = function (object) {
  27192. var typeStr = Object.prototype.toString.call(object);
  27193. var typeName;
  27194. switch (("" + typeStr).toLowerCase()) {
  27195. case '[object string]':
  27196. typeName = TypeEnum.string;
  27197. break;
  27198. case '[object number]':
  27199. if (Number.isNaN(object)) {
  27200. return TypeEnum.nan;
  27201. }
  27202. typeName = TypeEnum.number;
  27203. break;
  27204. case '[object object]':
  27205. if (object.$$typeof && object.props) {
  27206. var type = variableTypeOf(object.$$typeof);
  27207. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27208. return TypeEnum.reactNode;
  27209. }
  27210. }
  27211. typeName = TypeEnum.object;
  27212. break;
  27213. case '[object array]':
  27214. typeName = TypeEnum.array;
  27215. break;
  27216. case '[object function]':
  27217. typeName = TypeEnum.function;
  27218. break;
  27219. case '[object null]':
  27220. typeName = TypeEnum.null;
  27221. break;
  27222. case '[object boolean]':
  27223. typeName = TypeEnum.boolean;
  27224. break;
  27225. case '[object date]':
  27226. typeName = TypeEnum.date;
  27227. break;
  27228. // 不常用
  27229. case '[object symbol]':
  27230. typeName = TypeEnum.symbol;
  27231. break;
  27232. case '[object json]':
  27233. typeName = TypeEnum.json;
  27234. break;
  27235. case '[object math]':
  27236. typeName = TypeEnum.math;
  27237. break;
  27238. case '[object regexp]':
  27239. typeName = TypeEnum.regexp;
  27240. break;
  27241. // 貌似不会走的分支
  27242. case '[object undefined]':
  27243. typeName = TypeEnum.undefined;
  27244. break;
  27245. // 无法识别
  27246. default:
  27247. if (object === undefined) {
  27248. return TypeEnum.undefined;
  27249. }
  27250. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27251. typeName = TypeEnum.object;
  27252. }
  27253. return typeName;
  27254. };
  27255. //# sourceMappingURL=typeof.js.map
  27256. function initGroovyEditor () {
  27257. Ext.define('com.yvan.studio.GroovyEditor', {
  27258. extend: 'Ext.panel.Panel',
  27259. alias: 'widget.groovyeditor',
  27260. xtype: 'groovyeditor',
  27261. layout: 'fit',
  27262. border: false,
  27263. html: "<div class=\"editor\"/>",
  27264. config: {
  27265. value: ''
  27266. },
  27267. codeChange: undefined,
  27268. isChangeFromOuter: false,
  27269. getCode: function () {
  27270. if (this.editor) {
  27271. return this.editor.getValue();
  27272. }
  27273. else {
  27274. return this.code;
  27275. }
  27276. },
  27277. setCode: function (value) {
  27278. var _this = this;
  27279. this.code = value;
  27280. this.value = value;
  27281. _$2.defer(function () {
  27282. _this.isChangeFromOuter = true;
  27283. if (_this.editor) {
  27284. _this.editor.setValue(value);
  27285. }
  27286. });
  27287. },
  27288. applyPosition: function () {
  27289. var _this = this;
  27290. if (this.autoFocusMethod) {
  27291. if (this.editor) {
  27292. _$2.defer(function () {
  27293. if (_this.autoFocusStartLine) {
  27294. _this.editor.setPosition({
  27295. lineNumber: _this.autoFocusStartLine,
  27296. column: _this.autoFocusStartColumn
  27297. });
  27298. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27299. }
  27300. _this.editor.focus();
  27301. });
  27302. delete this.autoFocusMethod;
  27303. }
  27304. }
  27305. this.editor.layout();
  27306. },
  27307. getValue: function () {
  27308. return this.value;
  27309. },
  27310. setValue: function (value, fromEditor) {
  27311. var me = this;
  27312. if (me.value === value) {
  27313. // 值相等,不需要变化
  27314. return;
  27315. }
  27316. if (fromEditor !== true && me.editor) {
  27317. // 不是来源于编辑器的变化,才设置编辑器的值
  27318. me.editor.setValue(value);
  27319. }
  27320. // 通知mixins setValue
  27321. me.value = value;
  27322. me.fireEvent('change', value);
  27323. },
  27324. initComponent: function () {
  27325. var that = this;
  27326. this.superclass.initComponent.call(this, arguments);
  27327. that.on({
  27328. resize: function () {
  27329. if (that.editor) {
  27330. that.editor.layout();
  27331. }
  27332. },
  27333. destory: function () {
  27334. if (that.editor) {
  27335. that.editor.dispose();
  27336. delete that.editor;
  27337. }
  27338. },
  27339. afterrender: function (sender) {
  27340. var $dom = $(that.el.dom).find('.editor');
  27341. attach_3($dom[0], {
  27342. value: that.code
  27343. }).then(function (editor) {
  27344. that.editor = editor;
  27345. that.applyPosition();
  27346. that.editor.onDidChangeModelContent(function (e) {
  27347. that.fireEvent('change', that.editor, e);
  27348. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27349. that.codeChange(that.editor.getValue(), that.name, e);
  27350. }
  27351. that.isChangeFromOuter = false;
  27352. });
  27353. });
  27354. }
  27355. });
  27356. }
  27357. });
  27358. }
  27359. function attach_3(element, opts) {
  27360. return new Promise(function (resolve) {
  27361. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27362. enabled: false
  27363. } }));
  27364. editor.onKeyUp(function (e) {
  27365. // console.log(e)
  27366. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27367. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27368. }
  27369. });
  27370. resolve(editor);
  27371. });
  27372. }
  27373. //# sourceMappingURL=GroovyEditor.js.map
  27374. function initJsEditor$1 () {
  27375. Ext.define('com.yvan.studio.JsEditor', {
  27376. extend: 'Ext.panel.Panel',
  27377. alias: 'widget.jseditor',
  27378. xtype: 'jseditor',
  27379. layout: 'fit',
  27380. border: false,
  27381. html: "<div class=\"editor\"/>",
  27382. autoFocusMethod: true,
  27383. autoFocusStartLine: 0,
  27384. autoFocusStartColumn: 0,
  27385. codeChange: undefined,
  27386. funcArr: [],
  27387. modulePage: null,
  27388. isChangeFromOuter: false,
  27389. name: "",
  27390. /**
  27391. * 设置代码
  27392. */
  27393. setCode: function (value) {
  27394. var _this = this;
  27395. this.code = value;
  27396. _$2.defer(function () {
  27397. _this.isChangeFromOuter = true;
  27398. if (_this.editor) {
  27399. _this.editor.setValue(value);
  27400. if (_this.name === "controllerEditor") {
  27401. _this.funcArr = _this.getAllFunction();
  27402. }
  27403. }
  27404. });
  27405. },
  27406. getCode: function () {
  27407. var _a;
  27408. if (!this.editor) {
  27409. return this.code;
  27410. }
  27411. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27412. },
  27413. applyPosition: function () {
  27414. var _this = this;
  27415. if (this.autoFocusMethod) {
  27416. if (this.editor) {
  27417. _$2.defer(function () {
  27418. if (_this.autoFocusStartLine) {
  27419. _this.editor.setPosition({
  27420. lineNumber: _this.autoFocusStartLine,
  27421. column: _this.autoFocusStartColumn
  27422. });
  27423. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27424. }
  27425. _this.editor.focus();
  27426. });
  27427. delete this.autoFocusMethod;
  27428. }
  27429. }
  27430. this.editor.layout();
  27431. },
  27432. initComponent: function () {
  27433. var that = this;
  27434. this.superclass.initComponent.apply(this, arguments);
  27435. this.on({
  27436. resize: function (sender, width, height) {
  27437. if (that.editor) {
  27438. that.editor.layout();
  27439. }
  27440. },
  27441. destory: function () {
  27442. if (that.editor) {
  27443. that.editor.dispose();
  27444. delete that.editor;
  27445. }
  27446. },
  27447. afterrender: function () {
  27448. var $dom = $(that.el.dom).find('.editor');
  27449. attach_1($dom[0], {
  27450. value: that.code
  27451. }).then(function (editor) {
  27452. that.editor = editor;
  27453. that.applyPosition();
  27454. that.editor.onDidChangeModelContent(function (e) {
  27455. that.fireEvent('change', that.editor, e);
  27456. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27457. that.codeChange(that.editor.getValue(), that.name, e);
  27458. }
  27459. that.isChangeFromOuter = false;
  27460. });
  27461. });
  27462. }
  27463. });
  27464. },
  27465. getAllFunction: function () {
  27466. var funcArr = [];
  27467. var ast = window['YvanUI'].recast.parse(this.code);
  27468. if (ast && ast.program && ast.program.body) {
  27469. if (Array.isArray(ast.program.body)) {
  27470. for (var i = 0; i < ast.program.body.length; i++) {
  27471. var m = ast.program.body[i];
  27472. if (m.type === "ExportDefaultDeclaration") {
  27473. if (m.declaration.type === "ClassDeclaration") {
  27474. if (m.declaration.body.type === "ClassBody") {
  27475. if (Array.isArray(m.declaration.body.body)) {
  27476. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27477. var ob = m.declaration.body.body[j];
  27478. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27479. var funcItem = { name: ob.key.name, args: [] };
  27480. if (Array.isArray(ob.value.params)) {
  27481. for (var k = 0; k < ob.value.params.length; k++) {
  27482. var p = ob.value.params[k];
  27483. funcItem.args.push(p.name);
  27484. }
  27485. }
  27486. funcArr.push(funcItem);
  27487. }
  27488. }
  27489. }
  27490. }
  27491. }
  27492. }
  27493. }
  27494. }
  27495. }
  27496. return funcArr;
  27497. }
  27498. });
  27499. }
  27500. var isInited = false;
  27501. function attach_1(element, opts) {
  27502. return new Promise(function (resolve) {
  27503. var monaco = window['monaco'];
  27504. if (!isInited) {
  27505. isInited = true;
  27506. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27507. noSemanticValidation: true,
  27508. noSyntaxValidation: false
  27509. });
  27510. // compiler options
  27511. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27512. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27513. allowNonTsExtensions: true,
  27514. });
  27515. // extra libraries
  27516. var libSource = [
  27517. 'declare class Facts {',
  27518. ' /**',
  27519. ' * Returns the next fact',
  27520. ' */',
  27521. ' static next():string',
  27522. ' static next222():string',
  27523. '}',
  27524. "\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 ",
  27525. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27526. ].join('\n');
  27527. var libUri = 'file:///index.d.ts';
  27528. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27529. // When resolving definitions and references, the editor will try to use created models.
  27530. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27531. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27532. }
  27533. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27534. resolve(editor);
  27535. });
  27536. }
  27537. //# sourceMappingURL=JsEditor.js.map
  27538. function initJsonEditor$1 () {
  27539. Ext.define('com.yvan.studio.JsonEditor', {
  27540. extend: 'Ext.panel.Panel',
  27541. alias: 'widget.jsoneditor',
  27542. xtype: 'jsoneditor',
  27543. layout: 'fit',
  27544. border: false,
  27545. html: "<div class=\"editor\"/>",
  27546. autoFocusMethod: true,
  27547. autoFocusStartLine: 0,
  27548. autoFocusStartColumn: 0,
  27549. codeChange: undefined,
  27550. funcArr: [],
  27551. modulePage: null,
  27552. isChangeFromOuter: false,
  27553. name: "",
  27554. /**
  27555. * 设置代码
  27556. */
  27557. setCode: function (value) {
  27558. var _this = this;
  27559. this.code = value;
  27560. _$2.defer(function () {
  27561. _this.isChangeFromOuter = true;
  27562. if (_this.editor) {
  27563. _this.editor.setValue(value);
  27564. }
  27565. });
  27566. },
  27567. updateOptions: function (options) {
  27568. if (this.editor && options) {
  27569. this.editor.updateOptions(options);
  27570. }
  27571. },
  27572. setLanguage: function (lang) {
  27573. if (this.editor && lang) {
  27574. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27575. }
  27576. },
  27577. getCode: function () {
  27578. var _a;
  27579. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27580. },
  27581. applyPosition: function () {
  27582. var _this = this;
  27583. if (this.autoFocusMethod) {
  27584. if (this.editor) {
  27585. _$2.defer(function () {
  27586. if (_this.autoFocusStartLine) {
  27587. _this.editor.setPosition({
  27588. lineNumber: _this.autoFocusStartLine,
  27589. column: _this.autoFocusStartColumn
  27590. });
  27591. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27592. }
  27593. _this.editor.focus();
  27594. });
  27595. delete this.autoFocusMethod;
  27596. }
  27597. }
  27598. this.editor.layout();
  27599. },
  27600. initComponent: function () {
  27601. var that = this;
  27602. this.superclass.initComponent.apply(this, arguments);
  27603. this.on({
  27604. resize: function (sender, width, height) {
  27605. if (that.editor) {
  27606. that.editor.layout();
  27607. }
  27608. },
  27609. destory: function () {
  27610. if (that.editor) {
  27611. that.editor.dispose();
  27612. delete that.editor;
  27613. }
  27614. },
  27615. afterrender: function (sender) {
  27616. var $dom = $(that.el.dom).find('.editor');
  27617. attach_116($dom[0], {
  27618. value: that.code
  27619. }).then(function (editor) {
  27620. that.editor = editor;
  27621. that.applyPosition();
  27622. that.editor.onDidChangeModelContent(function (e) {
  27623. that.fireEvent('change', that.editor, e);
  27624. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27625. that.codeChange(that.editor.getValue(), that.name, e);
  27626. }
  27627. that.isChangeFromOuter = false;
  27628. });
  27629. });
  27630. }
  27631. });
  27632. },
  27633. });
  27634. }
  27635. function attach_116(element, opts) {
  27636. return new Promise(function (resolve) {
  27637. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27638. enabled: false
  27639. } }));
  27640. editor.onKeyUp(function (e) {
  27641. // console.log(e)
  27642. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27643. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27644. }
  27645. });
  27646. resolve(editor);
  27647. });
  27648. }
  27649. //# sourceMappingURL=JsonEditor.js.map
  27650. function initSqlEditor$1 () {
  27651. Ext.define('com.yvan.studio.SqlEditor', {
  27652. extend: 'Ext.panel.Panel',
  27653. alias: 'widget.sqleditor',
  27654. xtype: 'sqleditor',
  27655. layout: 'fit',
  27656. border: false,
  27657. html: "<div class=\"editor\"/>",
  27658. config: {
  27659. value: ''
  27660. },
  27661. codeChange: undefined,
  27662. isChangeFromOuter: false,
  27663. setCode: function (value) {
  27664. var _this = this;
  27665. this.code = value;
  27666. this.value = value;
  27667. _$2.defer(function () {
  27668. _this.isChangeFromOuter = true;
  27669. if (_this.editor) {
  27670. _this.editor.setValue(value);
  27671. }
  27672. });
  27673. },
  27674. getCode: function () {
  27675. return this.getValue();
  27676. },
  27677. updateOptions: function (options) {
  27678. if (this.editor && options) {
  27679. this.editor.updateOptions(options);
  27680. }
  27681. },
  27682. getValue: function () {
  27683. if (!this.editor) {
  27684. return this.code;
  27685. }
  27686. return this.editor.getValue();
  27687. },
  27688. applyPosition: function () {
  27689. var _this = this;
  27690. if (this.autoFocusMethod) {
  27691. if (this.editor) {
  27692. _$2.defer(function () {
  27693. if (_this.autoFocusStartLine) {
  27694. _this.editor.setPosition({
  27695. lineNumber: _this.autoFocusStartLine,
  27696. column: _this.autoFocusStartColumn
  27697. });
  27698. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27699. }
  27700. _this.editor.focus();
  27701. });
  27702. delete this.autoFocusMethod;
  27703. }
  27704. }
  27705. this.editor.layout();
  27706. },
  27707. setValue: function (value, fromEditor) {
  27708. this.setCode(value);
  27709. var me = this;
  27710. if (me.value === value) {
  27711. // 值相等,不需要变化
  27712. return;
  27713. }
  27714. if (fromEditor !== true && me.editor) {
  27715. // 不是来源于编辑器的变化,才设置编辑器的值
  27716. me.editor.setValue(value);
  27717. }
  27718. // 通知mixins setValue
  27719. me.value = value;
  27720. me.fireEvent('change', value);
  27721. },
  27722. initComponent: function () {
  27723. var that = this;
  27724. this.superclass.initComponent.call(this);
  27725. that.on({
  27726. resize: function () {
  27727. if (that.editor) {
  27728. that.editor.layout();
  27729. }
  27730. },
  27731. destory: function () {
  27732. if (that.editor) {
  27733. that.editor.dispose();
  27734. delete that.editor;
  27735. }
  27736. },
  27737. afterrender: function (sender) {
  27738. var $dom = $(that.el.dom).find('.editor');
  27739. attach_2($dom[0], {
  27740. value: that.code
  27741. }).then(function (editor) {
  27742. that.editor = editor;
  27743. that.applyPosition();
  27744. that.editor.onDidChangeModelContent(function (e) {
  27745. that.fireEvent('change', that.editor, e);
  27746. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27747. that.codeChange(that.editor.getValue(), that.name, e);
  27748. }
  27749. that.isChangeFromOuter = false;
  27750. });
  27751. });
  27752. }
  27753. });
  27754. }
  27755. });
  27756. }
  27757. function attach_2(element, opts) {
  27758. return new Promise(function (resolve) {
  27759. var monaco = window['monaco'];
  27760. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27761. enabled: false
  27762. } }));
  27763. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27764. // const sql = editor.getValue()
  27765. // if (_.trim(sql).length > 0) {
  27766. // editor.setValue(format(sql, {
  27767. // indent: ' ',
  27768. // uppercase: true,
  27769. // }))
  27770. // }
  27771. msg$1('没做');
  27772. });
  27773. editor.onKeyUp(function (e) {
  27774. // console.log(e)
  27775. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27776. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27777. }
  27778. });
  27779. resolve(editor);
  27780. });
  27781. }
  27782. //# sourceMappingURL=SqlEditor.js.map
  27783. function initTemplateEditor () {
  27784. Ext.define('com.yvan.studio.TemplateEditor', {
  27785. extend: 'Ext.panel.Panel',
  27786. alias: 'widget.templateeditor',
  27787. xtype: 'templateeditor',
  27788. layout: 'fit',
  27789. border: false,
  27790. html: "<div class=\"editor\"/>",
  27791. autoFocusMethod: true,
  27792. autoFocusStartLine: 0,
  27793. autoFocusStartColumn: 0,
  27794. codeChange: undefined,
  27795. funcArr: [],
  27796. modulePage: null,
  27797. isChangeFromOuter: false,
  27798. name: "",
  27799. /**
  27800. * 设置代码
  27801. */
  27802. setCode: function (value) {
  27803. var _this = this;
  27804. this.code = value;
  27805. _$2.defer(function () {
  27806. _this.isChangeFromOuter = true;
  27807. if (_this.editor) {
  27808. _this.editor.setValue(value);
  27809. }
  27810. });
  27811. },
  27812. getCode: function () {
  27813. var _a;
  27814. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27815. },
  27816. applyPosition: function () {
  27817. var _this = this;
  27818. if (this.autoFocusMethod) {
  27819. if (this.editor) {
  27820. _$2.defer(function () {
  27821. if (_this.autoFocusStartLine) {
  27822. _this.editor.setPosition({
  27823. lineNumber: _this.autoFocusStartLine,
  27824. column: _this.autoFocusStartColumn
  27825. });
  27826. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27827. }
  27828. _this.editor.focus();
  27829. });
  27830. delete this.autoFocusMethod;
  27831. }
  27832. }
  27833. this.editor.layout();
  27834. },
  27835. initComponent: function () {
  27836. var that = this;
  27837. this.superclass.initComponent.apply(this, arguments);
  27838. this.on({
  27839. resize: function (sender, width, height) {
  27840. if (that.editor) {
  27841. that.editor.layout();
  27842. }
  27843. },
  27844. destory: function () {
  27845. if (that.editor) {
  27846. that.editor.dispose();
  27847. delete that.editor;
  27848. }
  27849. },
  27850. afterrender: function (sender) {
  27851. var $dom = $(that.el.dom).find('.editor');
  27852. attach_117($dom[0], {
  27853. value: that.code
  27854. }).then(function (editor) {
  27855. that.editor = editor;
  27856. that.applyPosition();
  27857. that.editor.onDidChangeModelContent(function (e) {
  27858. that.fireEvent('change', that.editor, e);
  27859. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27860. that.codeChange(that.editor.getValue(), that.name, e);
  27861. }
  27862. that.isChangeFromOuter = false;
  27863. });
  27864. });
  27865. }
  27866. });
  27867. },
  27868. });
  27869. }
  27870. function attach_117(element, opts) {
  27871. return new Promise(function (resolve) {
  27872. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27873. enabled: false
  27874. } }));
  27875. editor.onKeyUp(function (e) {
  27876. // console.log(e)
  27877. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27878. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27879. }
  27880. });
  27881. resolve(editor);
  27882. });
  27883. }
  27884. //# sourceMappingURL=TemplateEditor.js.map
  27885. var DictStore = /** @class */ (function (_super) {
  27886. __extends(DictStore, _super);
  27887. function DictStore() {
  27888. return _super !== null && _super.apply(this, arguments) || this;
  27889. }
  27890. DictStore.prototype.getCacheKey = function (param) {
  27891. return "dict_data.json";
  27892. };
  27893. DictStore.prototype.invokeApi = function (param) {
  27894. return getDict(param);
  27895. };
  27896. DictStore.prototype.getDicts = function () {
  27897. return this.apiResponse.data.dict;
  27898. };
  27899. DictStore.prototype.getDictCodes = function () {
  27900. return new Promise(function (resolve) {
  27901. // reloadIfNeedPromise().then(() => {
  27902. // const result = []
  27903. // _.forEach(this.getDicts(), dictRow => {
  27904. // result.push({
  27905. // id: dictRow.dict_code,
  27906. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27907. // })
  27908. // })
  27909. // resolve(result)
  27910. // })
  27911. });
  27912. };
  27913. DictStore.prototype.saveDict = function (param) {
  27914. return saveDictApi(param);
  27915. };
  27916. DictStore.prototype.saveDictItems = function (param) {
  27917. return saveDictItemsApi(param);
  27918. };
  27919. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27920. var results = [];
  27921. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27922. if (dictItemRow.dict_code === dict_code) {
  27923. results.push(_$2.clone(dictItemRow));
  27924. }
  27925. });
  27926. return results;
  27927. };
  27928. return DictStore;
  27929. }(CacheStore));
  27930. var instance$2 = new DictStore();
  27931. //# sourceMappingURL=DictStore.js.map
  27932. var DictTreeController = /** @class */ (function () {
  27933. function DictTreeController() {
  27934. this._saveStateFlag = true;
  27935. }
  27936. DictTreeController.prototype.dictSave = function () {
  27937. var _this = this;
  27938. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27939. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27940. if (err) {
  27941. // 如果有异常就不保存
  27942. return;
  27943. }
  27944. // 进行业务上的逻辑校验,比如说必填校验等等
  27945. var hasError = false;
  27946. _$2.forEach(rows, function (row, i) {
  27947. if (isEmpty(row.dict_code)) {
  27948. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27949. hasError = true;
  27950. return false;
  27951. }
  27952. });
  27953. if (hasError) {
  27954. return;
  27955. }
  27956. // 设置当前界面为 "保存中..." 状态
  27957. this.view.setLoading(true);
  27958. instance$2.saveDict({
  27959. newRows: newRows,
  27960. modifyRows: modifyRows,
  27961. removeRecords: removeRecords,
  27962. }).then(function (res) {
  27963. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27964. msg$1(res.msg);
  27965. _this.reload();
  27966. }).finally(function () {
  27967. // 无论正常异常,关闭 "保存中..." 状态
  27968. _this.view.setLoading(false);
  27969. });
  27970. };
  27971. DictTreeController.prototype.dictItemSave = function () {
  27972. var _this = this;
  27973. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27974. var currentDictCode = undefined;
  27975. if (record) {
  27976. currentDictCode = record.get('dict_code');
  27977. }
  27978. if (!currentDictCode) {
  27979. msg$1('请选择一个字典');
  27980. return;
  27981. }
  27982. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27983. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27984. if (err) {
  27985. // 如果有异常就不保存
  27986. return;
  27987. }
  27988. // 进行业务上的逻辑校验,比如说必填校验等等
  27989. var hasError = false;
  27990. _$2.forEach(rows, function (row, i) {
  27991. if (!row.dict_value && row.dict_value !== 0) {
  27992. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27993. hasError = true;
  27994. return false;
  27995. }
  27996. });
  27997. if (hasError) {
  27998. return;
  27999. }
  28000. // 设置当前界面为 "保存中..." 状态
  28001. this.view.setLoading(true);
  28002. instance$2.saveDictItems({
  28003. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  28004. newRows: newRows,
  28005. modifyRows: modifyRows,
  28006. removeRecords: removeRecords,
  28007. dict_code: currentDictCode
  28008. }).then(function (res) {
  28009. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28010. msg$1(res.msg);
  28011. _this.reload();
  28012. }).finally(function () {
  28013. // 无论正常异常,关闭 "保存中..." 状态
  28014. _this.view.setLoading(false);
  28015. });
  28016. };
  28017. DictTreeController.prototype.createDictEnum = function () {
  28018. var _this = this;
  28019. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28020. var currentDictCode = undefined;
  28021. if (record) {
  28022. currentDictCode = record.get('dict_code');
  28023. }
  28024. if (!currentDictCode) {
  28025. msg$1('请选择一个字典');
  28026. return;
  28027. }
  28028. // 设置当前界面为 "保存中..." 状态
  28029. this.view.setLoading(true);
  28030. createDictEnum({ dictCode: currentDictCode })
  28031. .then(function () { return _this.reload(); })
  28032. .finally(function () { return _this.view.setLoading(false); });
  28033. };
  28034. DictTreeController.prototype.onLoad = function () {
  28035. setDictTree(this);
  28036. this.grid1 = this.view.lookupReference('grid1');
  28037. this.grid2 = this.view.lookupReference('grid2');
  28038. this.grid1.setData([]);
  28039. this.grid2.setData([]);
  28040. // this.grid1.columns[0].hide()
  28041. this.grid2.columns[0].hide();
  28042. // 找管理器订阅刷新的事件
  28043. instance$2.registe(this.refreshData.bind(this));
  28044. // 非强制性刷新 DbManager
  28045. instance$2.reloadIfNeed(undefined);
  28046. };
  28047. DictTreeController.prototype.onDestory = function () {
  28048. instance$2.unregiste(this.refreshData.bind(this));
  28049. };
  28050. // dictStore 刷新时,会回调到这个方法
  28051. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28052. var me = this;
  28053. if (typeof isLoadingState === 'boolean') {
  28054. me.view.setLoading(isLoadingState);
  28055. return;
  28056. }
  28057. this.grid1.setData(instance$2.getDicts());
  28058. this.restoreState();
  28059. };
  28060. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28061. var _this = this;
  28062. _$2.defer(function () {
  28063. _this.saveState();
  28064. });
  28065. if (!record) {
  28066. this.grid2.setData([]);
  28067. return;
  28068. }
  28069. var dict_code = record.get('dict_code');
  28070. var data = instance$2.getDictItemByDictcode(dict_code);
  28071. this.grid2.setData(data);
  28072. };
  28073. DictTreeController.prototype.reload = function () {
  28074. var _this = this;
  28075. // 强制刷新 DbManager
  28076. instance$2.reloadForce(undefined).then(function (res) {
  28077. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28078. });
  28079. };
  28080. DictTreeController.prototype.dictAdd = function () {
  28081. this.grid1.appendEditRow({
  28082. _createFlag: true,
  28083. dict_code: '',
  28084. dict_desc: '',
  28085. }, 0);
  28086. };
  28087. DictTreeController.prototype.dictRemove = function () {
  28088. this.grid1.removeEditRow();
  28089. };
  28090. DictTreeController.prototype.dictItemAdd = function () {
  28091. var _a, _b;
  28092. 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;
  28093. if (!dict_code) {
  28094. msg$1('请先保存字典');
  28095. return;
  28096. }
  28097. this.grid2.appendEditRow({
  28098. dict_code: dict_code,
  28099. dict_text: '',
  28100. dict_value: '',
  28101. }, 0);
  28102. };
  28103. DictTreeController.prototype.dictItemRemove = function () {
  28104. var _this = this;
  28105. var rows = [];
  28106. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28107. rows.push(r);
  28108. });
  28109. _$2.forEach(rows, function (r) {
  28110. _this.grid2.getStore().remove(r);
  28111. });
  28112. };
  28113. DictTreeController.prototype.clearSearch1 = function () {
  28114. this.grid1.store.clearFilter();
  28115. };
  28116. DictTreeController.prototype.search1 = function (sender) {
  28117. this.grid1.store.clearFilter();
  28118. this.getViewModel().set('grid1.selection', null);
  28119. this.grid1.fireEvent('itemselect');
  28120. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28121. if (!value) {
  28122. return;
  28123. }
  28124. this.grid1.store.filterBy(function (record) {
  28125. if (record.get('_createFlag')) {
  28126. return true;
  28127. }
  28128. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28129. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28130. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28131. return (dict_code.includes(value) ||
  28132. dict_desc.includes(value) ||
  28133. dict_desc_py.includes(value));
  28134. });
  28135. };
  28136. DictTreeController.prototype.clearSearch2 = function () {
  28137. this.grid2.store.clearFilter();
  28138. };
  28139. DictTreeController.prototype.search2 = function (sender) {
  28140. this.grid2.store.clearFilter();
  28141. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28142. if (!value) {
  28143. return;
  28144. }
  28145. this.grid2.store.filterBy(function (record) {
  28146. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28147. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28148. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28149. return (dict_text.includes(value) ||
  28150. dict_value === value ||
  28151. dict_text_py.includes(value));
  28152. });
  28153. };
  28154. DictTreeController.prototype.getStateFilename = function () {
  28155. return getCurrentProject().uuid + "/dicttree.json";
  28156. };
  28157. DictTreeController.prototype.restoreState = function () {
  28158. var _this = this;
  28159. var grid = this.grid1;
  28160. native.loadFile(this.getStateFilename(), function (content) {
  28161. if (!content)
  28162. return;
  28163. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28164. _this._saveStateFlag = false;
  28165. if (selection) {
  28166. var idx = grid.store.findExact('dict_code', selection);
  28167. if (idx >= 0) {
  28168. var record = grid.store.getAt(idx);
  28169. if (record) {
  28170. grid.setSelection([record]);
  28171. }
  28172. }
  28173. }
  28174. if (scrollPosition && scrollSize) {
  28175. var size = grid.scrollable.getSize();
  28176. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28177. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28178. }
  28179. }
  28180. setTimeout(function () {
  28181. _this._saveStateFlag = true;
  28182. }, 200);
  28183. });
  28184. };
  28185. DictTreeController.prototype.saveState = function () {
  28186. if (!this._saveStateFlag) {
  28187. return;
  28188. }
  28189. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28190. var selection = undefined;
  28191. if (record) {
  28192. selection = record.get('dict_code');
  28193. }
  28194. var scrollPosition = this.grid1.scrollable.position;
  28195. var scrollSize = this.grid1.scrollable.getSize();
  28196. native.saveFile(this.getStateFilename(), {
  28197. selection: selection,
  28198. scrollPosition: scrollPosition,
  28199. scrollSize: scrollSize
  28200. });
  28201. };
  28202. return DictTreeController;
  28203. }());
  28204. //# sourceMappingURL=DictTreeController.js.map
  28205. function initDict$1 () {
  28206. var controller = new DictTreeController();
  28207. Ext.define('com.yvan.studio.DictTree', {
  28208. extend: 'Ext.panel.Panel',
  28209. xtype: 'dicttree',
  28210. controller: controller,
  28211. scope: controller,
  28212. referenceHolder: true,
  28213. tooltip: '字典',
  28214. iconCls: 'x-fa fa-book',
  28215. rootVisible: false,
  28216. useArrows: true,
  28217. reference: 'dicttree',
  28218. layout: 'border',
  28219. listeners: {
  28220. afterrender: 'onLoad',
  28221. destory: 'onDestory',
  28222. },
  28223. items: [
  28224. {
  28225. region: 'center',
  28226. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28227. _mode: 'select',
  28228. tbar: [
  28229. {
  28230. xtype: 'button',
  28231. tooltip: '刷新',
  28232. iconCls: 'x-fa fa-refresh',
  28233. listeners: {
  28234. click: 'reload'
  28235. }
  28236. },
  28237. {
  28238. xtype: 'button',
  28239. tooltip: '添加',
  28240. iconCls: 'x-fa fa-plus-circle',
  28241. listeners: {
  28242. click: 'dictAdd'
  28243. }
  28244. },
  28245. {
  28246. xtype: 'button',
  28247. tooltip: '删除',
  28248. iconCls: 'x-fa fa-minus-circle',
  28249. bind: {
  28250. disabled: '{!grid1.selection}'
  28251. },
  28252. listeners: {
  28253. click: 'dictRemove'
  28254. }
  28255. },
  28256. {
  28257. xtype: 'button',
  28258. tooltip: '保存',
  28259. iconCls: 'x-fa fa-save',
  28260. bind: {
  28261. disabled: '{!grid1.ischanged}'
  28262. },
  28263. listeners: {
  28264. click: 'dictSave'
  28265. }
  28266. },
  28267. {
  28268. xtype: 'textfield',
  28269. hideClear: true,
  28270. triggers: {
  28271. clear: {
  28272. cls: 'x-form-clear-trigger',
  28273. handler: 'clearSearch1'
  28274. },
  28275. },
  28276. flex: 1,
  28277. emptyText: '搜索过滤',
  28278. enableKeyEvents: true,
  28279. listeners: {
  28280. keyup: {
  28281. fn: 'search1',
  28282. buffer: 50
  28283. }
  28284. }
  28285. },
  28286. ],
  28287. listeners: {
  28288. itemselect: 'grid1Selected',
  28289. },
  28290. idField: 'dict_code',
  28291. columns: [
  28292. {
  28293. text: '字典编号', dataIndex: 'dict_code',
  28294. menuDisabled: true, flex: 1,
  28295. editor: {
  28296. allowBlank: true,
  28297. selectOnFocus: false
  28298. }
  28299. },
  28300. {
  28301. text: '中文描述', dataIndex: 'dict_desc',
  28302. menuDisabled: true, flex: 1,
  28303. editor: {
  28304. allowBlank: true,
  28305. selectOnFocus: false
  28306. }
  28307. },
  28308. ]
  28309. },
  28310. {
  28311. region: 'south', height: '50%',
  28312. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28313. split: true,
  28314. _mode: 'edit1',
  28315. listeners: {},
  28316. tbar: [
  28317. {
  28318. xtype: 'button',
  28319. tooltip: '添加',
  28320. iconCls: 'x-fa fa-plus-circle',
  28321. bind: {
  28322. disabled: '{!grid1.selection}'
  28323. },
  28324. listeners: {
  28325. click: 'dictItemAdd'
  28326. }
  28327. },
  28328. {
  28329. xtype: 'button',
  28330. tooltip: '删除',
  28331. iconCls: 'x-fa fa-minus-circle',
  28332. bind: {
  28333. disabled: '{!grid1.selection}'
  28334. },
  28335. listeners: {
  28336. click: 'dictItemRemove'
  28337. }
  28338. },
  28339. {
  28340. xtype: 'button',
  28341. tooltip: '保存',
  28342. iconCls: 'x-fa fa-save',
  28343. bind: {
  28344. disabled: '{!grid2.ischanged}'
  28345. },
  28346. listeners: {
  28347. click: 'dictItemSave'
  28348. }
  28349. },
  28350. {
  28351. xtype: 'button',
  28352. tooltip: '刷新代码',
  28353. iconCls: 'x-fa fa-code',
  28354. bind: {
  28355. disabled: '{!grid1.selection}'
  28356. },
  28357. listeners: {
  28358. click: 'createDictEnum'
  28359. }
  28360. },
  28361. ],
  28362. columns: [
  28363. {
  28364. text: '字典项', dataIndex: 'dict_text',
  28365. menuDisabled: true, flex: 1,
  28366. editor: {
  28367. allowBlank: true,
  28368. selectOnFocus: false
  28369. }
  28370. },
  28371. {
  28372. text: '字典值', dataIndex: 'dict_value',
  28373. menuDisabled: true, flex: 1,
  28374. dataType: 'int',
  28375. editor: {
  28376. xtype: 'numberfield',
  28377. allowBlank: true,
  28378. selectOnFocus: false
  28379. }
  28380. },
  28381. {
  28382. text: '激活', dataIndex: 'is_enable',
  28383. xtype: 'checkcolumn', menuDisabled: true,
  28384. },
  28385. {
  28386. text: '变量名', dataIndex: 'var_name',
  28387. menuDisabled: true, flex: 1,
  28388. editor: {
  28389. allowBlank: true,
  28390. selectOnFocus: false
  28391. }
  28392. },
  28393. ]
  28394. }
  28395. ]
  28396. });
  28397. }
  28398. //# sourceMappingURL=DictTree.js.map
  28399. var model$g = {
  28400. data: {
  28401. form: {
  28402. path: "",
  28403. requestBody: "",
  28404. responseBody: "",
  28405. }
  28406. }
  28407. };
  28408. var vjson$f = {
  28409. title: '接口信息',
  28410. layout: 'fit',
  28411. width: 800,
  28412. height: 500,
  28413. items: [
  28414. {
  28415. xtype: 'form',
  28416. layout: {
  28417. type: 'vbox',
  28418. pack: 'start',
  28419. align: 'stretch'
  28420. },
  28421. defaults: {
  28422. border: false,
  28423. anchor: '100%',
  28424. margin: '5',
  28425. },
  28426. items: [
  28427. {
  28428. xtype: 'textfield',
  28429. fieldLabel: '接口路径',
  28430. bind: {
  28431. value: "{form.path}",
  28432. },
  28433. },
  28434. {
  28435. xtype: 'textareafield',
  28436. // height: 150,
  28437. flex: 2,
  28438. fieldLabel: '请求数据',
  28439. bind: {
  28440. value: "{form.requestBody}",
  28441. },
  28442. },
  28443. {
  28444. xtype: 'textareafield',
  28445. // height: 150,
  28446. flex: 5,
  28447. fieldLabel: '响应数据',
  28448. bind: {
  28449. value: "{form.responseBody}",
  28450. },
  28451. },
  28452. ]
  28453. }
  28454. ]
  28455. };
  28456. var ApiInfoDialog = /** @class */ (function (_super) {
  28457. __extends(ApiInfoDialog, _super);
  28458. function ApiInfoDialog() {
  28459. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28460. }
  28461. return ApiInfoDialog;
  28462. }(Scope));
  28463. //# sourceMappingURL=apiInfoDialog.js.map
  28464. var model$h = {
  28465. data: {
  28466. query: {
  28467. role_id: '',
  28468. resource_id: '',
  28469. },
  28470. form: {},
  28471. form2: {
  28472. key: "",
  28473. start_at: "",
  28474. end_at: "",
  28475. }
  28476. }
  28477. };
  28478. var vjson$g = {
  28479. title: '接口信息',
  28480. layout: 'fit',
  28481. items: [
  28482. {
  28483. layout: 'border',
  28484. border: false,
  28485. items: [
  28486. {
  28487. region: 'center',
  28488. layout: 'border',
  28489. items: [
  28490. {
  28491. region: 'north',
  28492. bind: {
  28493. title: '{form.title}',
  28494. },
  28495. xtype: 'form',
  28496. scrollable: true,
  28497. layout: {
  28498. type: 'vbox',
  28499. pack: 'start',
  28500. align: 'stretch'
  28501. },
  28502. defaults: {
  28503. border: false,
  28504. anchor: '100%',
  28505. margin: '5',
  28506. },
  28507. tbar: {
  28508. xtype: 'toolbar',
  28509. items: [
  28510. {
  28511. xtype: 'button',
  28512. text: '查询',
  28513. iconCls: 'x-fa fa-search',
  28514. listeners: {
  28515. click: 'scope.requestLogs'
  28516. },
  28517. },
  28518. {
  28519. xtype: 'button',
  28520. text: '保存',
  28521. iconCls: 'x-fa fa-save',
  28522. listeners: {},
  28523. },
  28524. {
  28525. xtype: 'button',
  28526. text: '禁用',
  28527. iconCls: 'x-fa fa-stop-circle',
  28528. bind: {},
  28529. listeners: {},
  28530. },
  28531. {
  28532. xtype: 'button',
  28533. text: '启用',
  28534. iconCls: 'x-fa fa-play-circle',
  28535. bind: {},
  28536. listeners: {},
  28537. },
  28538. ],
  28539. },
  28540. items: [
  28541. {
  28542. xtype: 'cols',
  28543. defaults: { labelWidth: 120 },
  28544. items: [
  28545. {
  28546. xtype: 'textfield',
  28547. fieldLabel: 'URL',
  28548. bind: {
  28549. value: '{form.api_url}',
  28550. },
  28551. readOnly: true,
  28552. },
  28553. {
  28554. xtype: 'textfield',
  28555. fieldLabel: '名称',
  28556. bind: {
  28557. value: '{form.api_name}',
  28558. },
  28559. readOnly: true,
  28560. },
  28561. ],
  28562. },
  28563. {
  28564. xtype: 'cols',
  28565. defaults: { labelWidth: 120 },
  28566. items: [
  28567. {
  28568. xtype: 'textfield',
  28569. fieldLabel: '实现类',
  28570. bind: {
  28571. value: '{form.api_class}',
  28572. },
  28573. readOnly: true,
  28574. },
  28575. {
  28576. border: false,
  28577. flex: 1
  28578. },
  28579. ]
  28580. },
  28581. {
  28582. xtype: 'cols',
  28583. defaults: { labelWidth: 120 },
  28584. items: [
  28585. {
  28586. xtype: 'textfield',
  28587. fieldLabel: '超时时间',
  28588. bind: {
  28589. value: '{form.timeout}',
  28590. },
  28591. readOnly: true,
  28592. },
  28593. {
  28594. border: false,
  28595. flex: 1
  28596. },
  28597. ]
  28598. },
  28599. {
  28600. xtype: 'cols',
  28601. defaults: { labelWidth: 120 },
  28602. items: [
  28603. {
  28604. xtype: 'textfield',
  28605. fieldLabel: 'Remote IP',
  28606. bind: {
  28607. value: '{form.remote_ip}',
  28608. },
  28609. readOnly: true,
  28610. },
  28611. {
  28612. border: false,
  28613. flex: 1
  28614. },
  28615. ]
  28616. },
  28617. {
  28618. xtype: 'cols',
  28619. defaults: { labelWidth: 120 },
  28620. items: [
  28621. {
  28622. xtype: 'textfield',
  28623. fieldLabel: '解析表单',
  28624. bind: {
  28625. value: '{form.chandi}',
  28626. },
  28627. readOnly: true,
  28628. },
  28629. {
  28630. border: false,
  28631. flex: 1
  28632. },
  28633. ]
  28634. },
  28635. ],
  28636. },
  28637. {
  28638. region: 'center',
  28639. // title: 'Request',
  28640. layout: 'border',
  28641. items: [
  28642. {
  28643. region: 'north',
  28644. xtype: 'form',
  28645. reference: 'form2',
  28646. split: true,
  28647. items: [
  28648. {
  28649. xtype: 'cols',
  28650. width: 700,
  28651. items: [
  28652. {
  28653. xtype: 'textfield',
  28654. fieldLabel: '关键字',
  28655. bind: {
  28656. value: "{form2.key}"
  28657. },
  28658. },
  28659. {
  28660. xtype: 'datefield',
  28661. fieldLabel: '开始时间',
  28662. bind: {
  28663. value: "{form2.start_at}"
  28664. },
  28665. },
  28666. {
  28667. xtype: 'datefield',
  28668. fieldLabel: '结束时间',
  28669. bind: {
  28670. value: "{form2.end_at}"
  28671. },
  28672. },
  28673. ]
  28674. }
  28675. ]
  28676. },
  28677. {
  28678. region: 'center',
  28679. xtype: 'yvgrid',
  28680. layout: 'fit',
  28681. reference: 'grid1',
  28682. pagination: true,
  28683. autoLoad: false,
  28684. selModel: {
  28685. selType: 'rowmodel',
  28686. mode: 'SINGLE',
  28687. },
  28688. dataSource: {
  28689. method: 'invoke',
  28690. url: '/sys/api/Api@requestLogs',
  28691. params: {
  28692. formData: '{form2}',
  28693. path: '{form.api_url}',
  28694. },
  28695. },
  28696. listeners: {
  28697. rowdblclick: 'scope.showDialog',
  28698. },
  28699. columns: [
  28700. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28701. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28702. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28703. { dataIndex: "size", header: "大小", width: 80 },
  28704. { dataIndex: "path", header: "path", flex: 1 },
  28705. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28706. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28707. ]
  28708. }
  28709. ]
  28710. },
  28711. ],
  28712. },
  28713. ],
  28714. },
  28715. ],
  28716. referenceHolder: true,
  28717. };
  28718. var Api = /** @class */ (function (_super) {
  28719. __extends(Api, _super);
  28720. function Api() {
  28721. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28722. }
  28723. Api.prototype.onLoad = function () {
  28724. _super.prototype.onLoad.call(this);
  28725. this.requestLogs();
  28726. };
  28727. Api.prototype.selectList = function (sender, selected, eOpts) {
  28728. this.viewModel.set("form", selected.data);
  28729. if (selected.data.api_type === '1') {
  28730. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28731. }
  28732. else {
  28733. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28734. }
  28735. };
  28736. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28737. var sel = [];
  28738. _$2.forEach(records, function (item) {
  28739. if (item.data.flg === 'Y') {
  28740. sel.push(item);
  28741. }
  28742. });
  28743. this.refs.methodGrid.selModel.select(sel);
  28744. };
  28745. Api.prototype.saveAll = function () {
  28746. var _this = this;
  28747. var _a, _b, _c;
  28748. var role_id = this.viewModel.get("query.role_id");
  28749. if (!role_id) {
  28750. msg$1("请先选择一个角色");
  28751. return;
  28752. }
  28753. var wh_id = this.viewModel.get("form.wh_id");
  28754. if (!wh_id) {
  28755. msg$1("请先选择一个仓库");
  28756. return;
  28757. }
  28758. var menus = this.refs.theTree.getChecked();
  28759. var rowsMenus = [];
  28760. _$2.forEach(menus, function (m) {
  28761. if (m.data.resource_id) {
  28762. rowsMenus.push(m.data.resource_id);
  28763. }
  28764. });
  28765. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28766. 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; });
  28767. _$2.remove(mm, function (x) {
  28768. return methodsArry.includes(x.resource_id);
  28769. });
  28770. var rowsBtn = [];
  28771. _$2.forEach(mm, function (m) {
  28772. rowsBtn.push({ resource_id: m.resource_id });
  28773. });
  28774. this.setLoading(true);
  28775. invokeServer$1('/sys/role/Role@saveAll', {
  28776. wh_id: wh_id,
  28777. role_id: role_id,
  28778. rowsMenus: rowsMenus,
  28779. rowsBtn: rowsBtn,
  28780. }).then(function (res) {
  28781. msg$1(res.msg);
  28782. if (res.success) {
  28783. _this.reloadTree();
  28784. // this.viewModel.set('query.role_id', '')
  28785. _this.viewModel.set('query.resource_id', '');
  28786. _this.refs.methodGrid.reload();
  28787. }
  28788. }).finally(function () {
  28789. _this.setLoading(false);
  28790. });
  28791. };
  28792. Api.prototype.editRoleSuccess = function (sender, data) {
  28793. if (data.success) {
  28794. this.refs.roleGrid.reload();
  28795. this.viewModel.set("query.JIAOS_ID", "");
  28796. this.reloadTree();
  28797. this.viewModel.set("query.CAID_ID", "");
  28798. this.refs.methodGrid.reload();
  28799. }
  28800. };
  28801. Api.prototype.deleteRole = function (sender) {
  28802. var _this = this;
  28803. var role_id = this.viewModel.get("query.role_id");
  28804. if (!role_id) {
  28805. msg$1("请先选择一个角色");
  28806. return;
  28807. }
  28808. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28809. if (btn === 'yes') {
  28810. invokeServer$1('/sys/role/Role@deleteRole', {
  28811. role_id: role_id,
  28812. wh_id: window['whId']
  28813. }).then(function (res) {
  28814. msg$1(res.msg);
  28815. if (res.success) {
  28816. _this.refs.roleGrid.reload();
  28817. _this.viewModel.set("query.role_id", "");
  28818. _this.reloadTree();
  28819. _this.refs.methodGrid.reload();
  28820. }
  28821. });
  28822. }
  28823. });
  28824. };
  28825. Api.prototype.reloadTree = function () {
  28826. showErrorDialog$1('reloadTree 不存在');
  28827. };
  28828. Api.prototype.whChange = function (sender, value) {
  28829. this.viewModel.set("form.wh_id", value);
  28830. this.reloadTree();
  28831. this.refs.methodGrid.reload();
  28832. };
  28833. Api.prototype.requestLogs = function () {
  28834. var path = this.viewModel.get("form.api_url");
  28835. if (!path)
  28836. return;
  28837. this.refs.grid1.reload();
  28838. };
  28839. Api.prototype.showDialog = function (sender) {
  28840. var _a, _b;
  28841. 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; });
  28842. if (!rows || rows.length <= 0)
  28843. return;
  28844. var dialog = new ApiInfoDialog();
  28845. dialog.showDialog(null, {}, {
  28846. data: {
  28847. form: __assign({}, rows[0])
  28848. }
  28849. });
  28850. };
  28851. return Api;
  28852. }(Scope));
  28853. //# sourceMappingURL=ApiPage.js.map
  28854. var Controller = /** @class */ (function () {
  28855. function Controller() {
  28856. }
  28857. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28858. var _a, _b, _c, _d, _e, _f, _g, _h;
  28859. // @ts-ignore
  28860. 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; });
  28861. if (!rows || rows.length <= 0)
  28862. return;
  28863. var apiPage = new Api();
  28864. apiPage.showPage({
  28865. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28866. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28867. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28868. }, {
  28869. data: {
  28870. form: __assign({}, rows[0])
  28871. }
  28872. });
  28873. };
  28874. return Controller;
  28875. }());
  28876. var controller = new Controller();
  28877. function initApiTree () {
  28878. Ext.define('com.yvan.studio.ApiGrid', {
  28879. extend: 'Ext.Panel',
  28880. xtype: 'apigrid',
  28881. controller: controller,
  28882. scope: controller,
  28883. referenceHolder: true,
  28884. layout: 'fit',
  28885. items: [
  28886. {
  28887. width: 400,
  28888. split: true,
  28889. xtype: 'yvgrid',
  28890. reference: 'roleGrid',
  28891. border: false,
  28892. pagination: false,
  28893. autoLoad: true,
  28894. remoteFilter: false,
  28895. selModel: {
  28896. selType: 'rowmodel',
  28897. mode: 'SINGLE',
  28898. },
  28899. tbar: {
  28900. xtype: 'toolbar',
  28901. items: [
  28902. {
  28903. xtype: 'button',
  28904. text: '新增',
  28905. iconCls: 'x-fa fa-plus-circle',
  28906. listeners: {},
  28907. },
  28908. {
  28909. xtype: 'button',
  28910. text: '删除',
  28911. iconCls: 'x-fa fa-trash',
  28912. bind: {
  28913. disabled: '{roleGrid.selection==null}',
  28914. },
  28915. listeners: {},
  28916. },
  28917. ],
  28918. },
  28919. dataSource: {
  28920. url: '/sys/api/Api@getApiList',
  28921. method: 'invoke',
  28922. params: {},
  28923. },
  28924. listeners: {
  28925. itemdblclick: "selectList",
  28926. },
  28927. columns: [
  28928. {
  28929. dataIndex: 'api_name',
  28930. header: '接口名称',
  28931. filter: { type: 'string' },
  28932. flex: 1,
  28933. },
  28934. ],
  28935. },
  28936. ]
  28937. });
  28938. }
  28939. //# sourceMappingURL=ApiTree.js.map
  28940. var model$i = {
  28941. data: {
  28942. iframeSrc: ''
  28943. }
  28944. };
  28945. var vjson$h = {
  28946. layout: 'fit',
  28947. border: false,
  28948. iconCls: 'x-fa fa-newspaper-o',
  28949. referenceHolder: true,
  28950. items: [
  28951. {
  28952. // title: 'view.design',
  28953. xtype: 'uxiframe',
  28954. layout: 'fit',
  28955. // cls: 'module_page_iframe',
  28956. reference: 'iframe',
  28957. listeners: {
  28958. afterrender: 'scope.iframeRender'
  28959. }
  28960. },
  28961. ]
  28962. };
  28963. var Iframe = /** @class */ (function (_super) {
  28964. __extends(Iframe, _super);
  28965. function Iframe(path) {
  28966. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28967. _this.path = "";
  28968. _this.path = path;
  28969. return _this;
  28970. }
  28971. Iframe.prototype.iframeRender = function (sender) {
  28972. var $dom = $(sender.el.dom).find('iframe');
  28973. var iframe = $dom[0];
  28974. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28975. iframe.onload = function () {
  28976. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28977. };
  28978. };
  28979. return Iframe;
  28980. }(Scope));
  28981. //# sourceMappingURL=Iframe.js.map
  28982. var Controller$1 = /** @class */ (function () {
  28983. function Controller() {
  28984. }
  28985. Controller.prototype.onDblClick = function (sender, record) {
  28986. var data = record.raw;
  28987. if (data.text === "运行报表") {
  28988. this.openIframe("/xxl-job/index", "运行报表");
  28989. }
  28990. else if (data.text === "任务管理") {
  28991. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28992. }
  28993. else if (data.text === "调度日志") {
  28994. this.openIframe("/xxl-job/joblog", "调度日志");
  28995. }
  28996. else if (data.text === "执行器管理") {
  28997. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28998. }
  28999. };
  29000. Controller.prototype.openIframe = function (path, title) {
  29001. var page = new Iframe(path);
  29002. page.showPage({
  29003. title: title,
  29004. id: 'xxljob__' + path.replaceAll("/", "_"),
  29005. path: 'xxljob__' + path.replaceAll("/", "_"),
  29006. }, {});
  29007. };
  29008. Controller.prototype.onLoad = function () {
  29009. var me = this;
  29010. me.getView().setRootNode({
  29011. expanded: true,
  29012. leaf: false,
  29013. children: [
  29014. { leaf: true, text: '运行报表' },
  29015. { leaf: true, text: '任务管理' },
  29016. { leaf: true, text: '调度日志' },
  29017. { leaf: true, text: '执行器管理' },
  29018. ]
  29019. });
  29020. };
  29021. return Controller;
  29022. }());
  29023. var controller$1 = new Controller$1();
  29024. function initTaskTree () {
  29025. Ext.define('com.yvan.studio.TaskTree', {
  29026. extend: 'Ext.tree.Panel',
  29027. xtype: 'tasktree',
  29028. controller: controller$1,
  29029. scope: controller$1,
  29030. reference: 'roleGrid',
  29031. tooltip: '表单定义',
  29032. iconCls: 'x-fa fa-bar-chart',
  29033. useArrows: true,
  29034. rootVisible: false,
  29035. colspan: 2,
  29036. lines: true,
  29037. multiSelect: false,
  29038. referenceHolder: true,
  29039. // openNode() {
  29040. // const selection = this.getSelection()
  29041. // const [record] = selection
  29042. // if (!record) {
  29043. // return
  29044. // }
  29045. //
  29046. // const {raw} = record;
  29047. // if (raw.type === 'Dir') {
  29048. // return
  29049. // }
  29050. // if (raw.type === "Module" && raw.module) {
  29051. // // eventBus.publish(EventType.ModuleOpen, raw)
  29052. // }
  29053. // },
  29054. listeners: {
  29055. itemdblclick: 'onDblClick',
  29056. afterrender: "onLoad",
  29057. },
  29058. });
  29059. }
  29060. //# sourceMappingURL=TaskTree.js.map
  29061. var model$j = {
  29062. data: {
  29063. form: {
  29064. address: "",
  29065. level: "",
  29066. logger: "",
  29067. message: "",
  29068. nodeName: "",
  29069. serverName: "",
  29070. thread: "",
  29071. whId: "",
  29072. userId: "",
  29073. }
  29074. }
  29075. };
  29076. var vjson$i = {
  29077. title: '接口信息',
  29078. layout: 'fit',
  29079. width: 800,
  29080. height: 600,
  29081. items: [
  29082. {
  29083. xtype: 'form',
  29084. layout: {
  29085. type: 'vbox',
  29086. pack: 'start',
  29087. align: 'stretch'
  29088. },
  29089. defaults: {
  29090. border: false,
  29091. anchor: '100%',
  29092. margin: '5',
  29093. },
  29094. items: [
  29095. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29096. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29097. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29098. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29099. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29100. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29101. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29102. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29103. {
  29104. xtype: 'textareafield',
  29105. flex: 5,
  29106. fieldLabel: '响应数据',
  29107. bind: {
  29108. value: "{form.message}",
  29109. },
  29110. },
  29111. ]
  29112. }
  29113. ]
  29114. };
  29115. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29116. __extends(ApiInfoDialog, _super);
  29117. function ApiInfoDialog() {
  29118. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29119. }
  29120. return ApiInfoDialog;
  29121. }(Scope));
  29122. //# sourceMappingURL=LogPageDialog.js.map
  29123. var model$k = {
  29124. data: {
  29125. form2: {}
  29126. }
  29127. };
  29128. var vjson$j = {
  29129. title: '日志查询',
  29130. layout: 'fit',
  29131. width: "70%",
  29132. height: "80%",
  29133. items: [
  29134. {
  29135. region: 'center',
  29136. xtype: 'yvgrid',
  29137. layout: 'fit',
  29138. reference: 'grid1',
  29139. pagination: false,
  29140. autoLoad: false,
  29141. selModel: {
  29142. selType: 'rowmodel',
  29143. mode: 'SINGLE',
  29144. },
  29145. dataSource: {
  29146. method: 'invoke',
  29147. url: '/sys/api/Api@aroundLogs',
  29148. params: {
  29149. formData: '{form2}',
  29150. },
  29151. },
  29152. listeners: {
  29153. rowdblclick: 'scope.showDialog2',
  29154. },
  29155. columns: [
  29156. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29157. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29158. { dataIndex: "thread", header: "thread", width: 150 },
  29159. { dataIndex: "message", header: "message", flex: 1 },
  29160. ]
  29161. }
  29162. ]
  29163. };
  29164. var AroundLog = /** @class */ (function (_super) {
  29165. __extends(AroundLog, _super);
  29166. function AroundLog() {
  29167. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29168. }
  29169. AroundLog.prototype.onLoad = function () {
  29170. _super.prototype.onLoad.call(this);
  29171. this.queryLog();
  29172. };
  29173. AroundLog.prototype.queryLog = function () {
  29174. this.refs.grid1.reload();
  29175. };
  29176. AroundLog.prototype.showDialog2 = function () {
  29177. var _a, _b;
  29178. 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; });
  29179. if (!rows || rows.length <= 0)
  29180. return;
  29181. var dialog = new ApiInfoDialog$1();
  29182. dialog.showDialog(null, {}, {
  29183. data: {
  29184. form: __assign({}, rows[0])
  29185. }
  29186. });
  29187. };
  29188. return AroundLog;
  29189. }(Scope));
  29190. //# sourceMappingURL=AroundLog.js.map
  29191. var model$l = {
  29192. data: {
  29193. form2: {
  29194. key: "",
  29195. start_at: "",
  29196. end_at: "",
  29197. }
  29198. }
  29199. };
  29200. var vjson$k = {
  29201. title: '日志查询',
  29202. layout: 'fit',
  29203. tbar: {
  29204. xtype: 'toolbar',
  29205. items: [
  29206. {
  29207. xtype: 'button',
  29208. text: '刷新',
  29209. listeners: {
  29210. click: 'scope.queryLog'
  29211. },
  29212. },
  29213. {
  29214. xtype: 'button',
  29215. text: '周围日志',
  29216. bind: {},
  29217. listeners: {
  29218. click: 'scope.aroundLogs'
  29219. },
  29220. },
  29221. ],
  29222. },
  29223. items: [
  29224. {
  29225. region: 'center',
  29226. xtype: 'yvgrid',
  29227. layout: 'fit',
  29228. reference: 'grid1',
  29229. pagination: true,
  29230. autoLoad: false,
  29231. selModel: {
  29232. selType: 'rowmodel',
  29233. mode: 'SINGLE',
  29234. },
  29235. dataSource: {
  29236. method: 'invoke',
  29237. url: '/sys/api/Api@queryLog',
  29238. params: {
  29239. formData: '{form2}',
  29240. path: '{form.api_url}',
  29241. },
  29242. },
  29243. listeners: {
  29244. rowdblclick: 'scope.showDialog',
  29245. },
  29246. columns: [
  29247. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29248. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29249. { dataIndex: "thread", header: "thread", width: 150 },
  29250. { dataIndex: "message", header: "message", flex: 1 },
  29251. ]
  29252. }
  29253. ]
  29254. };
  29255. var LogPage = /** @class */ (function (_super) {
  29256. __extends(LogPage, _super);
  29257. function LogPage() {
  29258. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29259. }
  29260. LogPage.prototype.onLoad = function () {
  29261. _super.prototype.onLoad.call(this);
  29262. this.queryLog();
  29263. };
  29264. LogPage.prototype.queryLog = function () {
  29265. this.refs.grid1.reload();
  29266. };
  29267. LogPage.prototype.showDialog = function () {
  29268. var _a, _b;
  29269. 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; });
  29270. if (!rows || rows.length <= 0)
  29271. return;
  29272. var dialog = new ApiInfoDialog$1();
  29273. dialog.showDialog(null, {}, {
  29274. data: {
  29275. form: __assign({}, rows[0])
  29276. }
  29277. });
  29278. };
  29279. LogPage.prototype.aroundLogs = function () {
  29280. var _a, _b;
  29281. 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; });
  29282. if (!rows || rows.length <= 0)
  29283. return;
  29284. var dialog = new AroundLog();
  29285. dialog.showDialog(null, {}, {
  29286. data: {
  29287. form2: __assign({}, rows[0])
  29288. }
  29289. });
  29290. };
  29291. return LogPage;
  29292. }(Scope));
  29293. //# sourceMappingURL=LogPage.js.map
  29294. var Controller$2 = /** @class */ (function () {
  29295. function Controller() {
  29296. }
  29297. Controller.prototype.queryLog = function () {
  29298. var form2 = this.getViewModel().get("form2");
  29299. var logPage = new LogPage();
  29300. logPage.showPage({}, {
  29301. data: {
  29302. form2: __assign({}, form2)
  29303. }
  29304. });
  29305. };
  29306. return Controller;
  29307. }());
  29308. var controller$2 = new Controller$2();
  29309. function initLogsTree () {
  29310. Ext.define('com.yvan.studio.LogsTree', {
  29311. extend: 'Ext.panel.Panel',
  29312. xtype: 'logstree',
  29313. controller: controller$2,
  29314. scope: controller$2,
  29315. viewModel: {
  29316. data: {
  29317. form2: {
  29318. key: "",
  29319. start_at: "",
  29320. end_at: "",
  29321. }
  29322. }
  29323. },
  29324. reference: 'logstree',
  29325. tooltip: '表单定义',
  29326. iconCls: 'x-fa fa-bar-chart',
  29327. useArrows: true,
  29328. rootVisible: false,
  29329. colspan: 2,
  29330. lines: true,
  29331. multiSelect: false,
  29332. referenceHolder: true,
  29333. items: [
  29334. {
  29335. region: 'north',
  29336. xtype: 'form',
  29337. reference: 'form2',
  29338. split: true,
  29339. items: [
  29340. {
  29341. xtype: 'textfield',
  29342. fieldLabel: '关键字',
  29343. bind: {
  29344. value: "{form2.key}"
  29345. },
  29346. },
  29347. {
  29348. xtype: 'datefield',
  29349. fieldLabel: '开始时间',
  29350. bind: {
  29351. value: "{form2.start_at}"
  29352. },
  29353. },
  29354. {
  29355. xtype: 'datefield',
  29356. fieldLabel: '结束时间',
  29357. bind: {
  29358. value: "{form2.end_at}"
  29359. },
  29360. },
  29361. ]
  29362. },
  29363. {
  29364. xtype: "cols",
  29365. items: [
  29366. {
  29367. xtype: "box",
  29368. },
  29369. {
  29370. xtype: "button",
  29371. text: '查询',
  29372. listeners: {
  29373. click: 'queryLog'
  29374. },
  29375. },
  29376. {
  29377. xtype: "box",
  29378. },
  29379. ]
  29380. },
  29381. ],
  29382. });
  29383. }
  29384. //# sourceMappingURL=LogsTree.js.map
  29385. var model$m = {
  29386. data: {
  29387. // opsId: "",
  29388. // name: "",
  29389. running: false,
  29390. }
  29391. };
  29392. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29393. var vjson$l = {
  29394. bind: {
  29395. title: '运维-{name}',
  29396. },
  29397. layout: 'fit',
  29398. items: [
  29399. {
  29400. layout: 'border',
  29401. items: [
  29402. {
  29403. region: 'north',
  29404. items: [
  29405. {
  29406. xtype: 'toolbar',
  29407. border: false,
  29408. items: [
  29409. {
  29410. xtype: 'button',
  29411. text: '执行',
  29412. iconCls: 'x-fa fa-play',
  29413. bind: {
  29414. hidden: "{running}",
  29415. },
  29416. listeners: {
  29417. click: 'scope.start'
  29418. }
  29419. },
  29420. {
  29421. xtype: 'button',
  29422. text: '停止',
  29423. iconCls: 'x-fa fa-stop',
  29424. bind: {
  29425. hidden: "{!running}",
  29426. },
  29427. listeners: {
  29428. click: 'scope.stop'
  29429. }
  29430. },
  29431. ],
  29432. },
  29433. ]
  29434. },
  29435. {
  29436. region: 'center',
  29437. reference: 'terminal',
  29438. xtype: 'terminal',
  29439. },
  29440. ],
  29441. },
  29442. ],
  29443. };
  29444. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29445. var DevOpsTerminal = /** @class */ (function (_super) {
  29446. __extends(DevOpsTerminal, _super);
  29447. function DevOpsTerminal() {
  29448. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29449. _this.websocket = undefined;
  29450. return _this;
  29451. }
  29452. DevOpsTerminal.prototype.onLoad = function () {
  29453. this.load();
  29454. };
  29455. DevOpsTerminal.prototype.onDestroy = function () {
  29456. if (this.websocket) {
  29457. this.websocket.close();
  29458. this.websocket = undefined;
  29459. }
  29460. };
  29461. DevOpsTerminal.prototype.load = function () {
  29462. var _this = this;
  29463. var opsId = this.viewModel.get('opsId');
  29464. this.setLoading(true);
  29465. devOpsById(opsId).then(function (res) {
  29466. _this.viewModel.set('devOps', res.data);
  29467. }).finally(function () {
  29468. _this.setLoading(false);
  29469. });
  29470. };
  29471. DevOpsTerminal.prototype.start = function () {
  29472. var me = this;
  29473. var running = this.viewModel.get('running');
  29474. var devOps = this.viewModel.get('devOps');
  29475. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29476. return;
  29477. var devopsServer = "ws://122.9.140.63:9999";
  29478. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29479. this.websocket.addEventListener('open', function () {
  29480. me.viewModel.set('running', true);
  29481. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29482. });
  29483. this.websocket.addEventListener('message', function (event) {
  29484. me.refs.terminal.write(event.data);
  29485. });
  29486. this.websocket.addEventListener('close', function () {
  29487. me.stop();
  29488. });
  29489. this.websocket.addEventListener('error', function () {
  29490. me.stop();
  29491. });
  29492. };
  29493. DevOpsTerminal.prototype.stop = function () {
  29494. if (this.websocket) {
  29495. this.websocket.close();
  29496. this.websocket = undefined;
  29497. }
  29498. this.viewModel.set('running', false);
  29499. };
  29500. return DevOpsTerminal;
  29501. }(Scope));
  29502. //# sourceMappingURL=DevOpsTerminal.js.map
  29503. var Controller$3 = /** @class */ (function () {
  29504. function Controller() {
  29505. }
  29506. Controller.prototype.onLoad = function (sender) {
  29507. this.reload();
  29508. };
  29509. Controller.prototype.reload = function () {
  29510. var me = this;
  29511. // @ts-ignore
  29512. var view = me.getView();
  29513. view.setLoading(true);
  29514. devOpsList().then(function (res) {
  29515. view.setStore(new Ext.data.Store({
  29516. fields: ['ops_id', 'host', 'name'],
  29517. data: res.data,
  29518. }));
  29519. }).finally(function () {
  29520. view.setLoading(false);
  29521. });
  29522. };
  29523. Controller.prototype.onDblClick = function (sender) {
  29524. this.devOpsTerminal();
  29525. };
  29526. Controller.prototype.devOpsTerminal = function () {
  29527. // @ts-ignore
  29528. var view = this.getView();
  29529. var _a = __read(view.getSelection(), 1), record = _a[0];
  29530. if (record) {
  29531. var name = record.get('name');
  29532. var opsId = record.get('ops_id');
  29533. var instance = new DevOpsTerminal();
  29534. instance.showPage({
  29535. id: 'ops_' + opsId,
  29536. path: 'ops_' + opsId,
  29537. }, {
  29538. data: {
  29539. opsId: opsId,
  29540. name: name,
  29541. }
  29542. });
  29543. instance.dialogSuccess = function () {
  29544. };
  29545. }
  29546. };
  29547. return Controller;
  29548. }());
  29549. var controller$3 = new Controller$3();
  29550. function initDevOpsTree () {
  29551. Ext.define('com.yvan.studio.DevOpsGrid', {
  29552. extend: 'Ext.grid.Panel',
  29553. xtype: 'devopsgrid',
  29554. controller: controller$3,
  29555. scope: controller$3,
  29556. referenceHolder: true,
  29557. tooltip: '运维',
  29558. iconCls: 'x-fa fa-terminal',
  29559. useArrows: true,
  29560. reference: 'devopsgrid',
  29561. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29562. listeners: {
  29563. afterrender: 'onLoad',
  29564. itemdblclick: 'onDblClick',
  29565. },
  29566. viewConfig: {
  29567. // listeners: {
  29568. // itemcontextmenu: 'onGridContextMenu',
  29569. // },
  29570. },
  29571. tbar: {
  29572. xtype: 'toolbar',
  29573. items: [
  29574. {
  29575. xtype: 'button',
  29576. tooltip: '刷新',
  29577. iconCls: 'x-fa fa-refresh',
  29578. listeners: {
  29579. click: 'reload'
  29580. }
  29581. },
  29582. {
  29583. xtype: 'textfield',
  29584. flex: 1,
  29585. emptyText: '搜索过滤',
  29586. enableKeyEvents: true,
  29587. listeners: {
  29588. change: {
  29589. fn: 'filterChanged',
  29590. buffer: 50
  29591. }
  29592. }
  29593. },
  29594. ]
  29595. },
  29596. columns: [
  29597. {
  29598. text: 'ID', dataIndex: 'report_id',
  29599. hidden: true,
  29600. },
  29601. {
  29602. text: '服务器',
  29603. dataIndex: 'host',
  29604. width: 100,
  29605. menuDisabled: true,
  29606. },
  29607. {
  29608. text: '操作名称',
  29609. dataIndex: 'name',
  29610. flex: 1,
  29611. menuDisabled: true,
  29612. },
  29613. ]
  29614. });
  29615. }
  29616. //# sourceMappingURL=DevOpsTree.js.map
  29617. function initTerminal () {
  29618. Ext.define('com.yvan.studio.Terminal', {
  29619. extend: 'Ext.panel.Panel',
  29620. alias: 'widget.terminal',
  29621. xtype: 'terminal',
  29622. layout: 'fit',
  29623. border: false,
  29624. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29625. config: {},
  29626. write: function (str) {
  29627. if (this.term) {
  29628. this.term.write(str);
  29629. }
  29630. },
  29631. initComponent: function () {
  29632. var that = this;
  29633. this.superclass.initComponent.call(this, arguments);
  29634. that.on({
  29635. resize: function () {
  29636. var _a;
  29637. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29638. that.fitAddon.fit();
  29639. }
  29640. },
  29641. destory: function () {
  29642. if (that.term) {
  29643. that.term.dispose();
  29644. delete that.term;
  29645. }
  29646. if (that.fitAddon) {
  29647. that.fitAddon.dispose();
  29648. delete that.fitAddon;
  29649. }
  29650. },
  29651. afterrender: function (sender) {
  29652. _.defer(function () {
  29653. var $dom = $(that.el.dom).find('.terminal');
  29654. that.term = new xterm.Terminal({
  29655. // cursorBlink: false,
  29656. // cursorStyle: 'bar', // block underline bar
  29657. // enableBold: false,
  29658. // bellStyle: "sound",
  29659. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29660. // scrollback: 10000,
  29661. // tabStopWidth: 4,
  29662. disableStdin: true,
  29663. theme: {
  29664. // foreground: "#111",
  29665. // background: "#fdfdfd",
  29666. // background: "#fafafa",
  29667. },
  29668. });
  29669. that.fitAddon = new xtermAddonFit.FitAddon();
  29670. that.term.loadAddon(that.fitAddon);
  29671. that.term.open($dom[0]);
  29672. that.fitAddon.fit();
  29673. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29674. });
  29675. }
  29676. });
  29677. }
  29678. });
  29679. }
  29680. //# sourceMappingURL=Terminal.js.map
  29681. var vjson$m = {
  29682. title: '接口统计',
  29683. layout: 'fit',
  29684. items: [
  29685. {
  29686. title: '接口统计',
  29687. xtype: 'yvgrid',
  29688. enableLocking: false,
  29689. reference: 'grid1',
  29690. pagination: false,
  29691. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29692. tbar: {
  29693. xtype: 'form',
  29694. items: [
  29695. {
  29696. xtype: 'cols',
  29697. items: [
  29698. {
  29699. xtype: 'textfield',
  29700. fieldLabel: '搜索',
  29701. listeners: {
  29702. change: 'scope.requestFilterChange'
  29703. }
  29704. },
  29705. ]
  29706. },
  29707. ]
  29708. },
  29709. columns: [
  29710. { text: '地址', dataIndex: 'url', flex: 1 },
  29711. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29712. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29713. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29714. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29715. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29716. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29717. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29718. ],
  29719. leadingBufferZone: 8,
  29720. trailingBufferZone: 8,
  29721. viewConfig: {
  29722. listeners: {
  29723. expandbody: 'scope.onChildExpand'
  29724. }
  29725. },
  29726. listeners: {
  29727. itemdblclick: 'scope.itemClick1'
  29728. },
  29729. plugins: {
  29730. rowwidget: {
  29731. widget: {
  29732. xtype: 'yvgrid',
  29733. hideFootbar: true,
  29734. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29735. listeners: {
  29736. itemdblclick: 'scope.itemClick1'
  29737. },
  29738. columns: [
  29739. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29740. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29741. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29742. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29743. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29744. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29745. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29746. ]
  29747. }
  29748. }
  29749. }
  29750. },
  29751. ]
  29752. };
  29753. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29754. var model$n = {
  29755. data: {
  29756. count: 0,
  29757. dataSourceName: '',
  29758. sql: "",
  29759. histogram: '',
  29760. maxCost: 0,
  29761. minCost: 0,
  29762. avgCost: '',
  29763. sumCost: 0,
  29764. histogramInfos: [
  29765. // count: 1
  29766. // gteCost: 20
  29767. // ltCost: 50
  29768. // 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"
  29769. // topN: [
  29770. // cost: 24
  29771. // occurrenceTime: "1648004895171"
  29772. // 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"
  29773. // ]
  29774. ]
  29775. }
  29776. };
  29777. //# sourceMappingURL=PerformDialog.model.js.map
  29778. var vjson$n = {
  29779. title: '性能统计详情',
  29780. height: 400,
  29781. width: 800,
  29782. modal: true,
  29783. layout: 'fit',
  29784. items: [
  29785. {
  29786. xtype: 'tabpanel',
  29787. items: [
  29788. {
  29789. title: '摘要',
  29790. key: "1",
  29791. layout: 'border',
  29792. items: [
  29793. {
  29794. region: 'north',
  29795. border: false,
  29796. defaults: {
  29797. margin: '8 0 0 0'
  29798. },
  29799. items: [
  29800. {
  29801. xtype: 'cols',
  29802. defaultType: 'displayfield',
  29803. defaults: {
  29804. labelWidth: 70,
  29805. },
  29806. items: [
  29807. {
  29808. fieldLabel: 'count',
  29809. bind: {
  29810. value: '{count}'
  29811. }
  29812. },
  29813. {
  29814. fieldLabel: 'maxCost',
  29815. bind: {
  29816. value: '{maxCost}'
  29817. }
  29818. },
  29819. {
  29820. fieldLabel: 'minCost',
  29821. bind: {
  29822. value: '{minCost}'
  29823. }
  29824. },
  29825. {
  29826. fieldLabel: 'avgCost',
  29827. bind: {
  29828. value: '{avgCost}'
  29829. }
  29830. },
  29831. {
  29832. fieldLabel: 'sumCost',
  29833. bind: {
  29834. value: '{sumCost}'
  29835. }
  29836. },
  29837. ]
  29838. },
  29839. {
  29840. xtype: 'cols',
  29841. items: [
  29842. {
  29843. flex: 5,
  29844. border: false,
  29845. items: [
  29846. {
  29847. xtype: 'segmentedbutton',
  29848. reference: 'histogram',
  29849. allowToggle: false,
  29850. border: false,
  29851. items: []
  29852. }
  29853. ]
  29854. },
  29855. ]
  29856. },
  29857. ],
  29858. },
  29859. {
  29860. region: 'center',
  29861. xtype: 'sqleditor',
  29862. reference: 'sqlEditor',
  29863. },
  29864. ]
  29865. },
  29866. {
  29867. title: '直方图',
  29868. key: "2",
  29869. }
  29870. ]
  29871. }
  29872. ]
  29873. };
  29874. //# sourceMappingURL=PerformDialog.view.js.map
  29875. var PerformDialog = /** @class */ (function (_super) {
  29876. __extends(PerformDialog, _super);
  29877. function PerformDialog() {
  29878. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29879. }
  29880. PerformDialog.prototype.onLoad = function () {
  29881. var _this = this;
  29882. var sql = this.viewModel.get('sql');
  29883. var sql2 = sqlFormat.format(sql, {
  29884. indent: ' ',
  29885. uppercase: true,
  29886. });
  29887. var histogramInfos = this.viewModel.get('histogramInfos');
  29888. var vs = _$2.map(histogramInfos, function (v) {
  29889. if (v.ltCost > 2100000000) {
  29890. return {
  29891. text: "[" + v.gteCost + ", \u221E):" + v.count
  29892. };
  29893. }
  29894. return {
  29895. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29896. };
  29897. });
  29898. this.refs.sqlEditor.setCode(sql2);
  29899. _$2.forEach(vs, function (v) {
  29900. _this.refs.histogram.add(v);
  29901. });
  29902. };
  29903. return PerformDialog;
  29904. }(Scope));
  29905. //# sourceMappingURL=PerformDialog.js.map
  29906. var model$o = {
  29907. data: {}
  29908. };
  29909. var PerformStats = /** @class */ (function (_super) {
  29910. __extends(PerformStats, _super);
  29911. function PerformStats() {
  29912. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29913. _this.requestFilterChange = _.debounce(function (sender, value) {
  29914. var store = _this.refs.grid1.store;
  29915. store.clearFilter();
  29916. if (value) {
  29917. store.filterBy(function (record, id) {
  29918. var text = toString(record.get('url'));
  29919. // 用拼音筛选的方式
  29920. return text.includes(value);
  29921. });
  29922. }
  29923. }, 100);
  29924. return _this;
  29925. }
  29926. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29927. widget.setData(record.data.children);
  29928. };
  29929. PerformStats.prototype.itemClick1 = function (sender, record) {
  29930. console.log('itemClick1', record.data);
  29931. new PerformDialog().showDialog(sender, {}, {
  29932. data: record.data
  29933. });
  29934. };
  29935. PerformStats.prototype.onLoad = function () {
  29936. var _this = this;
  29937. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29938. .then(function (_a) {
  29939. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29940. var resData = reqRes.data;
  29941. var jdbcData = jdbcRes.data;
  29942. _.forEach(jdbcData, function (item) {
  29943. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29944. });
  29945. _.forEach(resData, function (item) {
  29946. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29947. if (_.isArray(item.sqls)) {
  29948. item.children = _.map(item.sqls, function (sql) {
  29949. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29950. }).filter(function (v) { return !!v; });
  29951. }
  29952. item.jdbcCount = _.size(item.children);
  29953. });
  29954. _this.refs.grid1.setData(resData);
  29955. // this.refs.grid2.setData(jdbcData)
  29956. });
  29957. };
  29958. return PerformStats;
  29959. }(Scope));
  29960. //# sourceMappingURL=InterfaceStatistics.js.map
  29961. var vjson$o = {
  29962. title: '性能统计',
  29963. layout: 'fit',
  29964. items: [
  29965. {
  29966. title: '数据库统计',
  29967. xtype: 'yvgrid',
  29968. enableLocking: false,
  29969. reference: 'grid2',
  29970. pagination: false,
  29971. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29972. tbar: {
  29973. xtype: 'form',
  29974. items: [
  29975. {
  29976. xtype: 'cols',
  29977. items: [
  29978. {
  29979. fieldLabel: '搜索',
  29980. listeners: {
  29981. change: 'scope.jdbcFilterChange'
  29982. }
  29983. },
  29984. ]
  29985. },
  29986. ]
  29987. },
  29988. listeners: {
  29989. itemdblclick: 'scope.itemClick1'
  29990. },
  29991. columns: [
  29992. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29993. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29994. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29995. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29996. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29997. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29998. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29999. ]
  30000. },
  30001. ]
  30002. };
  30003. //# sourceMappingURL=DatabaseStatistics.view.js.map
  30004. var model$p = {
  30005. data: {}
  30006. };
  30007. var PerformStats$1 = /** @class */ (function (_super) {
  30008. __extends(PerformStats, _super);
  30009. function PerformStats() {
  30010. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  30011. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  30012. var store = _this.refs.grid2.store;
  30013. store.clearFilter();
  30014. if (value) {
  30015. store.filterBy(function (record, id) {
  30016. var text = toString(record.get('sql'));
  30017. // 用拼音筛选的方式
  30018. return text.includes(value);
  30019. });
  30020. }
  30021. }, 100);
  30022. return _this;
  30023. }
  30024. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30025. widget.setData(record.data.children);
  30026. };
  30027. PerformStats.prototype.itemClick1 = function (sender, record) {
  30028. console.log('itemClick1', record.data);
  30029. new PerformDialog().showDialog(sender, {}, {
  30030. data: record.data
  30031. });
  30032. };
  30033. PerformStats.prototype.onLoad = function () {
  30034. var _this = this;
  30035. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30036. .then(function (_a) {
  30037. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30038. var resData = reqRes.data;
  30039. var jdbcData = jdbcRes.data;
  30040. _.forEach(jdbcData, function (item) {
  30041. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30042. });
  30043. _.forEach(resData, function (item) {
  30044. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30045. if (_.isArray(item.sqls)) {
  30046. item.children = _.map(item.sqls, function (sql) {
  30047. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30048. }).filter(function (v) { return !!v; });
  30049. }
  30050. item.jdbcCount = _.size(item.children);
  30051. });
  30052. _this.refs.grid2.setData(jdbcData);
  30053. });
  30054. };
  30055. return PerformStats;
  30056. }(Scope));
  30057. //# sourceMappingURL=DatabaseStatistics.js.map
  30058. var Controller$4 = /** @class */ (function () {
  30059. function Controller() {
  30060. }
  30061. Controller.prototype.onDblClick = function (sender, record) {
  30062. var data = record.raw;
  30063. if (data.text === "接口统计") {
  30064. var page = new PerformStats();
  30065. page.showPage({
  30066. title: "接口统计",
  30067. id: '_InterfaceStatistics',
  30068. path: '_InterfaceStatistics',
  30069. }, {});
  30070. }
  30071. else if (data.text === "数据库统计") {
  30072. var page = new PerformStats$1();
  30073. page.showPage({
  30074. title: "数据库统计",
  30075. id: '_DatabaseStatistics',
  30076. path: '_DatabaseStatistics',
  30077. }, {});
  30078. }
  30079. };
  30080. Controller.prototype.onLoad = function () {
  30081. var me = this;
  30082. //@ts-ignore
  30083. var view = me.getView();
  30084. view.setRootNode({
  30085. expanded: true,
  30086. leaf: false,
  30087. children: [
  30088. { leaf: true, text: '接口统计' },
  30089. { leaf: true, text: '数据库统计' },
  30090. ]
  30091. });
  30092. };
  30093. return Controller;
  30094. }());
  30095. var controller$4 = new Controller$4();
  30096. function initMonitorTree () {
  30097. Ext.define('com.yvan.studio.MonitorTree', {
  30098. extend: 'Ext.tree.Panel',
  30099. xtype: 'monitortree',
  30100. controller: controller$4,
  30101. scope: controller$4,
  30102. reference: 'roleGrid',
  30103. tooltip: '表单定义',
  30104. iconCls: 'x-fa fa-bar-chart',
  30105. useArrows: true,
  30106. rootVisible: false,
  30107. colspan: 2,
  30108. lines: true,
  30109. multiSelect: false,
  30110. referenceHolder: true,
  30111. // openNode() {
  30112. // const selection = this.getSelection()
  30113. // const [record] = selection
  30114. // if (!record) {
  30115. // return
  30116. // }
  30117. //
  30118. // const {raw} = record;
  30119. // if (raw.type === 'Dir') {
  30120. // return
  30121. // }
  30122. // if (raw.type === "Module" && raw.module) {
  30123. // // eventBus.publish(EventType.ModuleOpen, raw)
  30124. // }
  30125. // },
  30126. listeners: {
  30127. itemdblclick: 'onDblClick',
  30128. afterrender: "onLoad",
  30129. },
  30130. });
  30131. }
  30132. //# sourceMappingURL=MonitorTree.js.map
  30133. var Controller$5 = /** @class */ (function () {
  30134. function Controller() {
  30135. }
  30136. return Controller;
  30137. }());
  30138. var controller$5 = new Controller$5();
  30139. function initHomeTree () {
  30140. Ext.define('com.yvan.studio.HomeTree', {
  30141. extend: 'Ext.Panel',
  30142. xtype: 'hometree',
  30143. controller: controller$5,
  30144. scope: controller$5,
  30145. referenceHolder: true,
  30146. bodyCls: 'home',
  30147. // layout: 'fit',
  30148. tbar: {
  30149. xtype: 'toolbar',
  30150. items: [
  30151. {
  30152. xtype: 'button',
  30153. iconCls: 'x-fa fa-exchange',
  30154. text: '数据结构同步',
  30155. handler: function (sender) {
  30156. handles$1.mainWindow.showDataSync(sender);
  30157. }
  30158. },
  30159. {
  30160. xtype: 'button',
  30161. iconCls: 'x-fa fa-cubes',
  30162. text: '数据域管理',
  30163. handler: function (sender) {
  30164. handles$1.mainWindow.showColumnDomain();
  30165. }
  30166. },
  30167. ],
  30168. },
  30169. // items: [
  30170. //
  30171. // ],
  30172. layout: {
  30173. type: 'vbox',
  30174. pack: 'start',
  30175. align: 'stretch',
  30176. },
  30177. items: [
  30178. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30179. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30180. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30181. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30182. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30183. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30184. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30185. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30186. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30187. ],
  30188. });
  30189. }
  30190. //# sourceMappingURL=HomeTree.js.map
  30191. var WidgetStore = /** @class */ (function (_super) {
  30192. __extends(WidgetStore, _super);
  30193. function WidgetStore() {
  30194. return _super !== null && _super.apply(this, arguments) || this;
  30195. }
  30196. WidgetStore.prototype.getCacheKey = function (param) {
  30197. return "widget_data.json";
  30198. };
  30199. /*invokeApi(param: any): Promise<any> {
  30200. return new Promise<any>(resolve => {
  30201. //@ts-ignore
  30202. require(["../../widget/all"], function (res) {
  30203. const widgetList = res.default
  30204. resolve(widgetList)
  30205. })
  30206. })
  30207. }*/
  30208. WidgetStore.prototype.invokeApi = function (param) {
  30209. return widgetListApi(param);
  30210. };
  30211. return WidgetStore;
  30212. }(CacheStore));
  30213. var instance$3 = new WidgetStore();
  30214. //# sourceMappingURL=WidgetStore.js.map
  30215. var WidgetGridController = /** @class */ (function () {
  30216. function WidgetGridController() {
  30217. }
  30218. WidgetGridController.prototype.onLoad = function (sender) {
  30219. var me = this;
  30220. setWidget(me);
  30221. instance$3.registe(me.reloadData.bind(this));
  30222. instance$3.reloadIfNeed(undefined);
  30223. };
  30224. WidgetGridController.prototype.widgetAdd = function (sender) {
  30225. var me = this;
  30226. var win = new Ext.Window({
  30227. autoDestroy: true,
  30228. title: "新建弹框",
  30229. width: 400,
  30230. height: 220,
  30231. resizable: true,
  30232. closable: true,
  30233. maximizable: true,
  30234. minimizable: true,
  30235. plain: true,
  30236. // constrainHeader: true,
  30237. constrain: true,
  30238. layout: 'fit',
  30239. animateTarget: sender,
  30240. buttonAlign: 'center',
  30241. items: [
  30242. {
  30243. xtype: "form",
  30244. layout: "hbox",
  30245. margin: '10px 20px',
  30246. border: 0,
  30247. items: [
  30248. {
  30249. flex: 1,
  30250. layout: 'vbox',
  30251. items: [
  30252. {
  30253. xtype: "textfield",
  30254. name: "widgetcode",
  30255. fieldLabel: "弹窗文件",
  30256. flex: 1,
  30257. allowBlank: false,
  30258. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30259. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30260. labelWidth: 80,
  30261. width: "100%",
  30262. },
  30263. {
  30264. xtype: "textfield",
  30265. name: "widgetname",
  30266. fieldLabel: "弹窗名称",
  30267. flex: 1,
  30268. allowBlank: false,
  30269. labelWidth: 80,
  30270. width: "100%",
  30271. },
  30272. ]
  30273. },
  30274. ]
  30275. }
  30276. ],
  30277. //窗口按钮
  30278. buttons: [
  30279. {
  30280. xtype: 'button', text: '保存', handler: function (btn) {
  30281. //窗口获取表单
  30282. var form = win.down('form');
  30283. var vaildSuccess = form.isValid();
  30284. if (!vaildSuccess) {
  30285. return;
  30286. }
  30287. var title = form.down('textfield[name="widgetname"]').getValue();
  30288. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30289. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30290. if (res.success) {
  30291. msg$1('添加成功');
  30292. // 添加
  30293. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30294. me.reload();
  30295. });
  30296. win.close();
  30297. }
  30298. });
  30299. }
  30300. },
  30301. {
  30302. xtype: 'button', text: '取消', handler: function (btn) {
  30303. //窗口关闭
  30304. win.close();
  30305. }
  30306. }
  30307. ]
  30308. });
  30309. win.show();
  30310. };
  30311. WidgetGridController.prototype.widgetRemove = function (sender) {
  30312. var _this = this;
  30313. //@ts-ignore
  30314. var record = this.getView().selection.data;
  30315. if (!record) {
  30316. msg$1('请选择一行');
  30317. return;
  30318. }
  30319. var widgetPath = record.widget_path;
  30320. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30321. if (btn === 'yes') {
  30322. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30323. if (res.success) {
  30324. msg$1(res.msg);
  30325. _this.reload();
  30326. }
  30327. });
  30328. }
  30329. });
  30330. };
  30331. WidgetGridController.prototype.widgetEdit = function (record) {
  30332. var _this = this;
  30333. if (record) {
  30334. var widgetPath = record.widget_path;
  30335. var widgetName = record.widget_name;
  30336. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30337. _this.reload();
  30338. });
  30339. }
  30340. };
  30341. WidgetGridController.prototype.onDestory = function (sender) {
  30342. var me = this;
  30343. setWidget(undefined);
  30344. instance$3.unregiste(me.reloadData.bind(this));
  30345. };
  30346. WidgetGridController.prototype.reloadData = function (res) {
  30347. var me = this;
  30348. //@ts-ignore
  30349. var view = me.getView();
  30350. if (typeof res === 'object') {
  30351. // const data = []
  30352. // _.forOwn(res, (v, k) => {
  30353. // data.push({
  30354. // widget_path: k,
  30355. // widget_name: v.title,
  30356. // vjson : v
  30357. // })
  30358. // })
  30359. view.setStore(new Ext.data.Store({
  30360. fields: ['widget_path', 'widget_name'],
  30361. data: res.data,
  30362. }));
  30363. }
  30364. else if (typeof res === 'boolean') {
  30365. view.setLoading(res);
  30366. }
  30367. };
  30368. WidgetGridController.prototype.reload = function () {
  30369. instance$3.reloadForce(undefined);
  30370. };
  30371. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30372. //@ts-ignore
  30373. this.view.store.clearFilter();
  30374. if (value) {
  30375. //@ts-ignore
  30376. this.view.store.filterBy(function (record) {
  30377. var widget_path = record.get('widget_path');
  30378. var widget_name = record.get('widget_name');
  30379. return (window['system'].pinyinMatch(widget_name, value) ||
  30380. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30381. });
  30382. }
  30383. };
  30384. WidgetGridController.prototype.onClearClick = function () {
  30385. var _a, _b;
  30386. //@ts-ignore
  30387. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30388. };
  30389. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30390. this.widgetEdit(record.data);
  30391. };
  30392. return WidgetGridController;
  30393. }());
  30394. //# sourceMappingURL=WidgetGridController.js.map
  30395. function initWidget () {
  30396. var controller = new WidgetGridController();
  30397. Ext.define('com.yvan.studio.WidgetGrid', {
  30398. extend: 'Ext.grid.Panel',
  30399. xtype: 'widgetgrid',
  30400. controller: controller,
  30401. scope: controller,
  30402. referenceHolder: true,
  30403. tooltip: '检索窗口',
  30404. iconCls: 'x-fa fa-search',
  30405. useArrows: true,
  30406. reference: 'widgetgrid',
  30407. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30408. listeners: {
  30409. itemdblclick: 'onDblClick',
  30410. afterrender: 'onLoad',
  30411. destory: 'onDestory',
  30412. },
  30413. viewConfig: {
  30414. listeners: {
  30415. itemcontextmenu: 'onGridContextMenu',
  30416. },
  30417. },
  30418. tbar: [
  30419. {
  30420. xtype: 'button',
  30421. tooltip: '刷新',
  30422. iconCls: 'x-fa fa-refresh',
  30423. listeners: {
  30424. click: 'reload'
  30425. }
  30426. },
  30427. {
  30428. xtype: 'button',
  30429. tooltip: '添加',
  30430. iconCls: 'x-fa fa-plus-circle',
  30431. listeners: {
  30432. click: 'widgetAdd'
  30433. }
  30434. },
  30435. {
  30436. xtype: 'button',
  30437. tooltip: '删除',
  30438. iconCls: 'x-fa fa-minus-circle',
  30439. listeners: {
  30440. click: 'widgetRemove'
  30441. }
  30442. },
  30443. ],
  30444. fbar: [
  30445. {
  30446. xtype: 'textfield',
  30447. flex: 1,
  30448. reference: "txtFilter",
  30449. emptyText: '搜索过滤',
  30450. enableKeyEvents: true,
  30451. listeners: {
  30452. change: {
  30453. fn: 'filterChanged',
  30454. buffer: 50
  30455. }
  30456. }
  30457. },
  30458. ],
  30459. columns: [
  30460. {
  30461. text: '弹窗文件', dataIndex: 'widget_path',
  30462. menuDisabled: true, flex: 1,
  30463. },
  30464. {
  30465. text: '弹窗名称', dataIndex: 'widget_name',
  30466. menuDisabled: true, flex: 1,
  30467. },
  30468. ]
  30469. });
  30470. }
  30471. //# sourceMappingURL=WidgetGrid.js.map
  30472. var WhLayoutController = /** @class */ (function () {
  30473. function WhLayoutController() {
  30474. }
  30475. WhLayoutController.prototype.onLoad = function (sender) {
  30476. var _this = this;
  30477. var me = this;
  30478. setWhLayout(me);
  30479. _$2.defer(function () {
  30480. _this.reload();
  30481. });
  30482. };
  30483. WhLayoutController.prototype.reload = function () {
  30484. //@ts-ignore
  30485. var view = this.getView();
  30486. view.setLoading(true);
  30487. loadWhLayoutAll().then(function (res) {
  30488. view.setStore(new Ext.data.Store({
  30489. fields: ['layout_code', 'layout_name'],
  30490. data: res.data,
  30491. }));
  30492. }).finally(function () {
  30493. view.setLoading(false);
  30494. });
  30495. };
  30496. WhLayoutController.prototype.add = function () {
  30497. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30498. };
  30499. WhLayoutController.prototype.edit = function (data) {
  30500. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30501. };
  30502. WhLayoutController.prototype.remove = function () {
  30503. var _this = this;
  30504. var _a;
  30505. //@ts-ignore
  30506. var view = this.getView();
  30507. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30508. if (!record) {
  30509. msg$1('请选择一行数据');
  30510. return;
  30511. }
  30512. var layoutCode = record.layout_code;
  30513. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30514. if (btn === 'yes') {
  30515. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30516. if (res.success) {
  30517. msg$1(res.msg);
  30518. _this.reload();
  30519. }
  30520. });
  30521. }
  30522. });
  30523. };
  30524. WhLayoutController.prototype.onDblClick = function () {
  30525. var _a;
  30526. //@ts-ignore
  30527. var view = this.getView();
  30528. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30529. if (!record) {
  30530. msg$1('请选择一行数据');
  30531. return;
  30532. }
  30533. this.edit(record);
  30534. };
  30535. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30536. //@ts-ignore
  30537. this.view.store.clearFilter();
  30538. if (value) {
  30539. //@ts-ignore
  30540. this.view.store.filterBy(function (record) {
  30541. var widget_path = record.get('widget_path');
  30542. var widget_name = record.get('widget_name');
  30543. return (window['system'].pinyinMatch(widget_name, value) ||
  30544. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30545. });
  30546. }
  30547. };
  30548. WhLayoutController.prototype.onClearClick = function () {
  30549. var _a, _b;
  30550. //@ts-ignore
  30551. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30552. };
  30553. return WhLayoutController;
  30554. }());
  30555. //# sourceMappingURL=WhLayoutController.js.map
  30556. function initWhLayout () {
  30557. var controller = new WhLayoutController();
  30558. Ext.define('com.yvan.studio.WhLayout', {
  30559. extend: 'Ext.grid.Panel',
  30560. xtype: 'whlayout',
  30561. alias: 'widget.whlayout',
  30562. controller: controller,
  30563. scope: controller,
  30564. referenceHolder: true,
  30565. tooltip: '检索窗口',
  30566. iconCls: 'x-fa fa-search',
  30567. useArrows: true,
  30568. reference: 'whlayout',
  30569. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30570. listeners: {
  30571. itemdblclick: 'onDblClick',
  30572. afterrender: 'onLoad',
  30573. destory: 'onDestory',
  30574. },
  30575. viewConfig: {
  30576. listeners: {
  30577. itemcontextmenu: 'onGridContextMenu',
  30578. },
  30579. },
  30580. tbar: [
  30581. {
  30582. xtype: 'button',
  30583. tooltip: '刷新',
  30584. iconCls: 'x-fa fa-refresh',
  30585. listeners: {
  30586. click: 'reload'
  30587. }
  30588. },
  30589. {
  30590. xtype: 'button',
  30591. tooltip: '添加',
  30592. iconCls: 'x-fa fa-plus-circle',
  30593. listeners: {
  30594. click: 'add'
  30595. }
  30596. },
  30597. {
  30598. xtype: 'button',
  30599. tooltip: '删除',
  30600. iconCls: 'x-fa fa-minus-circle',
  30601. listeners: {
  30602. click: 'remove'
  30603. }
  30604. },
  30605. ],
  30606. fbar: [
  30607. {
  30608. xtype: 'textfield',
  30609. flex: 1,
  30610. reference: "txtFilter",
  30611. emptyText: '搜索过滤',
  30612. enableKeyEvents: true,
  30613. listeners: {
  30614. change: {
  30615. fn: 'filterChanged',
  30616. buffer: 50
  30617. }
  30618. }
  30619. },
  30620. ],
  30621. columns: [
  30622. {
  30623. text: '图编号', dataIndex: 'layout_code',
  30624. menuDisabled: true, flex: 1,
  30625. },
  30626. {
  30627. text: '图名称', dataIndex: 'layout_name',
  30628. menuDisabled: true, flex: 1,
  30629. },
  30630. ]
  30631. });
  30632. }
  30633. //# sourceMappingURL=WhLayout.js.map
  30634. var BpmnTreeController = /** @class */ (function () {
  30635. function BpmnTreeController() {
  30636. }
  30637. BpmnTreeController.prototype.onLoad = function (sender) {
  30638. this.reload();
  30639. };
  30640. BpmnTreeController.prototype.reload = function () {
  30641. var me = this;
  30642. me.getView().setLoading(true);
  30643. exporerList().then(function (res) {
  30644. // handles.mainWindow.modules = res.data
  30645. // const rootNode = modulesToTreeData(res.data)
  30646. var rootNode = res.data.tree;
  30647. me.getView().setRootNode({
  30648. expanded: true,
  30649. leaf: false,
  30650. children: rootNode
  30651. });
  30652. // const lastId = window.location.hash.substring(1);
  30653. // file.selectPath(lastId)
  30654. // if (lastId) {
  30655. // const node = getModuleById(rootNode, lastId)
  30656. // if (node) {
  30657. // showDesign(node.id, node.path, node.text, node.module)
  30658. // }
  30659. // }
  30660. // this.restoreState()
  30661. }).finally(function () {
  30662. me.getView().setLoading(false);
  30663. });
  30664. };
  30665. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30666. var _this = this;
  30667. e.preventDefault();
  30668. var raw = node.raw;
  30669. //const me = sender.up("treepanel").scope
  30670. var option;
  30671. if (raw.exporerType === 1) ;
  30672. else if (raw.exporerType === 21) {
  30673. if (raw.type === 'Dir') {
  30674. option = {
  30675. shadow: 'frame', allowOtherMenus: true,
  30676. items: [
  30677. {
  30678. text: '添加',
  30679. iconCls: 'x-fa fa-plus-circle',
  30680. handler: function (sender) {
  30681. var dirPath = raw.dirPath;
  30682. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30683. }
  30684. },
  30685. '-',
  30686. {
  30687. text: '新建文件夹',
  30688. iconCls: 'x-fa fa-folder-o',
  30689. handler: function (sender) {
  30690. }
  30691. }
  30692. ]
  30693. };
  30694. }
  30695. else if (raw.type === 'Model') {
  30696. option = {
  30697. shadow: 'frame', allowOtherMenus: true,
  30698. items: [
  30699. {
  30700. text: '编辑',
  30701. iconCls: 'x-fa fa-edit',
  30702. handler: function (sender) {
  30703. }
  30704. },
  30705. {
  30706. text: '删除',
  30707. iconCls: 'x-fa fa-minus-circle',
  30708. handler: function (sender) {
  30709. }
  30710. },
  30711. '-',
  30712. {
  30713. text: '注册(至菜单)',
  30714. iconCls: 'x-fa fa-sign-in',
  30715. handler: function (sender) {
  30716. }
  30717. },
  30718. {
  30719. text: '新建文件夹',
  30720. iconCls: 'x-fa fa-folder-o',
  30721. handler: function (sender) {
  30722. }
  30723. }
  30724. ]
  30725. };
  30726. }
  30727. }
  30728. else if (raw.exporerType === 22) {
  30729. if (raw.type === 'Dir') {
  30730. option = {
  30731. shadow: 'frame', allowOtherMenus: true,
  30732. items: [
  30733. {
  30734. text: '添加',
  30735. iconCls: 'x-fa fa-plus-circle',
  30736. handler: function (sender) {
  30737. var dirPath = raw.dirPath;
  30738. handles$1.mainWindow.showFormBill();
  30739. }
  30740. },
  30741. '-',
  30742. {
  30743. text: '新建文件夹',
  30744. iconCls: 'x-fa fa-folder-o',
  30745. handler: function (sender) {
  30746. }
  30747. }
  30748. ]
  30749. };
  30750. }
  30751. else if (raw.type === 'Model') {
  30752. option = {
  30753. shadow: 'frame', allowOtherMenus: true,
  30754. items: [
  30755. {
  30756. text: '编辑',
  30757. iconCls: 'x-fa fa-edit',
  30758. handler: function (sender) {
  30759. }
  30760. },
  30761. {
  30762. text: '删除',
  30763. iconCls: 'x-fa fa-minus-circle',
  30764. handler: function (sender) {
  30765. }
  30766. },
  30767. '-',
  30768. {
  30769. text: '注册(至菜单)',
  30770. iconCls: 'x-fa fa-sign-in',
  30771. handler: function (sender) {
  30772. }
  30773. },
  30774. {
  30775. text: '新建文件夹',
  30776. iconCls: 'x-fa fa-folder-o',
  30777. handler: function (sender) {
  30778. }
  30779. }
  30780. ]
  30781. };
  30782. }
  30783. }
  30784. else if (raw.exporerType === 3) ;
  30785. else if (raw.exporerType === 50) {
  30786. option = {
  30787. shadow: 'frame', allowOtherMenus: true,
  30788. items: [
  30789. {
  30790. text: '新建流程',
  30791. iconCls: 'x-fa fa-new',
  30792. handler: function (sender) {
  30793. _this.bpmnAdd(sender);
  30794. }
  30795. },
  30796. ]
  30797. };
  30798. }
  30799. else if (raw.exporerType === 51) {
  30800. option = {
  30801. shadow: 'frame', allowOtherMenus: true,
  30802. items: [
  30803. {
  30804. text: '新建流程',
  30805. iconCls: 'x-fa fa-new',
  30806. handler: function (sender) {
  30807. _this.bpmnAdd(sender);
  30808. }
  30809. },
  30810. {
  30811. text: '删除',
  30812. iconCls: 'x-fa fa-minus-circle',
  30813. handler: function (sender) {
  30814. _this.bpmnDelete(sender, raw);
  30815. }
  30816. },
  30817. ]
  30818. };
  30819. }
  30820. else {
  30821. throw Error('暂时不支持!');
  30822. }
  30823. if (option) {
  30824. var treeMenu = new Ext.menu.Menu(option);
  30825. treeMenu.showAt(e.getXY());
  30826. }
  30827. };
  30828. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30829. var _this = this;
  30830. prompt$2('输入工作流名称').then(function (name) {
  30831. createBpmn("", name).then(function (res) {
  30832. if (res.success) {
  30833. msg$1('添加成功');
  30834. }
  30835. _this.reload();
  30836. });
  30837. });
  30838. };
  30839. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30840. var _this = this;
  30841. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30842. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30843. if (res.success) {
  30844. msg$1('添加成功');
  30845. }
  30846. _this.reload();
  30847. });
  30848. });
  30849. };
  30850. BpmnTreeController.prototype.reportAdd = function (sender) {
  30851. var _this = this;
  30852. prompt$2('请输入报表名称').then(function (name) {
  30853. createReportApi(name).then(function (res) {
  30854. if (res.success) {
  30855. msg$1('添加成功');
  30856. handles$1.mainWindow.showReport(res.data, name, function () {
  30857. _this.reload();
  30858. });
  30859. }
  30860. _this.reload();
  30861. });
  30862. });
  30863. };
  30864. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30865. if (record) {
  30866. var reportName = record.get('report_name');
  30867. var reportId = record.get('report_id');
  30868. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30869. }
  30870. };
  30871. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30872. var _this = this;
  30873. if (record) {
  30874. var reportName = record.get('report_name');
  30875. var reportId_1 = record.get('report_id');
  30876. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30877. delReportApi(reportId_1).then(function (res) {
  30878. if (res.success) {
  30879. msg$1('删除成功');
  30880. _this.reload();
  30881. }
  30882. });
  30883. });
  30884. }
  30885. };
  30886. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30887. var _this = this;
  30888. if (!record || record.type !== 'Module') {
  30889. return;
  30890. }
  30891. var reportName = record.text;
  30892. var reportId = record.target;
  30893. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30894. _this.reload();
  30895. });
  30896. };
  30897. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30898. var data = record.raw;
  30899. if (data.type !== 'Module' && data.type !== 'Dir') {
  30900. return;
  30901. }
  30902. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30903. if (data.exporerType === 10) { // 表单
  30904. // this.reportEdit(sender, data)
  30905. handles$1.mainWindow.showReport();
  30906. }
  30907. else if (data.exporerType === 21) {
  30908. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30909. }
  30910. else if (data.exporerType === 22) {
  30911. handles$1.mainWindow.showFormBill();
  30912. }
  30913. else if (data.exporerType === 30) {
  30914. handles$1.mainWindow.showWidgetDesign();
  30915. }
  30916. else if (data.exporerType === 51) {
  30917. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30918. }
  30919. else {
  30920. throw Error('暂时不支持!');
  30921. }
  30922. };
  30923. return BpmnTreeController;
  30924. }());
  30925. var controller$6 = new BpmnTreeController();
  30926. function initBpmnTree () {
  30927. Ext.define('com.yvan.studio.BpmnTree', {
  30928. extend: 'Ext.tree.Panel',
  30929. //extend: 'com.yvan.studio.StateTree',
  30930. xtype: 'bpmntree',
  30931. controller: controller$6,
  30932. scope: controller$6,
  30933. tooltip: '表单定义',
  30934. iconCls: 'x-fa fa-random',
  30935. useArrows: true,
  30936. rootVisible: false,
  30937. colspan: 2,
  30938. lines: true,
  30939. multiSelect: true,
  30940. reload: function () {
  30941. this.controller.reload.call(this, arguments);
  30942. },
  30943. openNode: function () {
  30944. var selection = this.getSelection();
  30945. var _a = __read(selection, 1), record = _a[0];
  30946. if (!record) {
  30947. return;
  30948. }
  30949. var raw = record.raw;
  30950. if (raw.type === 'Dir') {
  30951. return;
  30952. }
  30953. if (raw.type === "Module" && raw.module) ;
  30954. },
  30955. listeners: {
  30956. itemdblclick: 'onDblClick',
  30957. afterrender: 'onLoad',
  30958. // itemverify() {
  30959. // this.openNode()
  30960. // },
  30961. itemcontextmenu: 'onLisenContextMenu'
  30962. },
  30963. tbar: {
  30964. xtype: 'toolbar',
  30965. items: [
  30966. {
  30967. xtype: 'button',
  30968. tooltip: '刷新',
  30969. iconCls: 'x-fa fa-refresh',
  30970. listeners: {
  30971. click: 'reload'
  30972. }
  30973. },
  30974. /*{
  30975. xtype: 'button',
  30976. tooltip: '添加',
  30977. iconCls: 'x-fa fa-plus-circle',
  30978. menu: [
  30979. {
  30980. text: '类别',
  30981. listeners: {
  30982. click: 'classAdd'
  30983. }
  30984. },
  30985. {
  30986. text: '查询',
  30987. listeners: {
  30988. click: 'reportAdd'
  30989. }
  30990. },
  30991. '-',
  30992. {
  30993. text: '单表定义',
  30994. listeners: {
  30995. click: 'singleTableAdd'
  30996. }
  30997. },
  30998. {
  30999. text: '多表定义',
  31000. listeners: {
  31001. click: 'complexTableAdd'
  31002. }
  31003. },
  31004. {
  31005. text: '查询窗口定义',
  31006. listeners: {
  31007. click: 'widgetAdd'
  31008. }
  31009. },
  31010. ],
  31011. },
  31012. {
  31013. xtype: 'button',
  31014. tooltip: '删除',
  31015. iconCls: 'x-fa fa-minus-circle',
  31016. listeners: {
  31017. click: 'reportRemove'
  31018. }
  31019. },*/
  31020. {
  31021. xtype: 'textfield',
  31022. flex: 1,
  31023. reference: "txtFilter",
  31024. emptyText: '搜索过滤',
  31025. enableKeyEvents: true,
  31026. listeners: {
  31027. change: {
  31028. fn: 'filterChanged',
  31029. buffer: 50
  31030. }
  31031. }
  31032. },
  31033. ]
  31034. },
  31035. });
  31036. }
  31037. //# sourceMappingURL=BpmnTree.js.map
  31038. function initToolBox () {
  31039. Ext.define('com.yvan.studio.ToolBox', {
  31040. extend: 'Ext.panel.Panel',
  31041. xtype: 'toolbox',
  31042. tooltip: '工具箱',
  31043. layout: 'fit',
  31044. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31045. border: false,
  31046. beforeRender: function () {
  31047. console.log('beforeRender', this);
  31048. },
  31049. afterRender: function () {
  31050. var $dom = $(this.body.dom).children('div');
  31051. $dom.append(createComponent());
  31052. $dom.css("height", '100%');
  31053. // @ts-ignore
  31054. $('#_toolbox_list').find('li').each(function () {
  31055. var id = $(this).children(':first').attr('drag_id');
  31056. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31057. setDrag(this, node);
  31058. });
  31059. }
  31060. });
  31061. }
  31062. function setDrag(el, node) {
  31063. new Ext.drag.Source({
  31064. element: el,
  31065. proxy: {
  31066. type: 'placeholder',
  31067. getElement: function (info) {
  31068. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31069. return Ext.getBody().createChild({
  31070. html: html
  31071. });
  31072. }
  31073. },
  31074. listeners: {
  31075. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31076. dragend: delegateDragend.bind(getDesignInstance(), node),
  31077. },
  31078. sourceVjson: node.code,
  31079. dragType: node.dragType
  31080. });
  31081. }
  31082. function createComponent() {
  31083. var template = [];
  31084. for (var i = 0; i < codeLines.length; i++) {
  31085. var item = codeLines[i];
  31086. if (!item.dragHtml) {
  31087. continue;
  31088. }
  31089. var $ele = $("<li>" + item.dragHtml + "</li>");
  31090. $ele.children(':first').attr('drag_id', item.id);
  31091. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31092. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31093. }
  31094. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31095. return html;
  31096. }
  31097. var codeLines = [
  31098. {
  31099. id: '$label',
  31100. value: layoutOrXtypeNameMap.label + ' - label',
  31101. icon: "fa fa-font",
  31102. dragType: "col-item",
  31103. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31104. code: {
  31105. xtype: 'label',
  31106. text: '文本' + _$2.uniqueId('_l')
  31107. }
  31108. },
  31109. {
  31110. id: '$text',
  31111. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31112. icon: "fa fa-edit",
  31113. dragType: "col-item",
  31114. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31115. code: {
  31116. xtype: 'textfield',
  31117. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31118. }
  31119. },
  31120. {
  31121. id: '$textarea',
  31122. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31123. icon: "fa fa-edit",
  31124. dragType: "col-item",
  31125. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31126. code: {
  31127. xtype: 'textareafield',
  31128. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31129. }
  31130. },
  31131. {
  31132. id: '$number',
  31133. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31134. icon: "fa fa-edit",
  31135. dragType: "col-item",
  31136. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31137. code: {
  31138. xtype: 'numberfield',
  31139. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31140. }
  31141. },
  31142. {
  31143. id: '$combo',
  31144. value: layoutOrXtypeNameMap.combo + ' - combo',
  31145. icon: "fa fa-angle-double-down",
  31146. dragType: "col-item",
  31147. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31148. code: {
  31149. xtype: 'combo',
  31150. fieldLabel: '请选择',
  31151. data: [
  31152. { id: 'id1', text: '选项1' },
  31153. { id: 'id2', text: '选项2' },
  31154. { id: 'id3', text: '选项3' },
  31155. ],
  31156. }
  31157. },
  31158. {
  31159. id: '$datebox',
  31160. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31161. icon: "fa fa-calendar",
  31162. dragType: "col-item",
  31163. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31164. code: {
  31165. xtype: "datefield",
  31166. fieldLabel: '日期',
  31167. }
  31168. },
  31169. {
  31170. id: '$searchbox',
  31171. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31172. icon: "fa fa-search",
  31173. dragType: "col-item",
  31174. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31175. code: {
  31176. xtype: 'searchfield',
  31177. fieldLabel: '搜索框',
  31178. }
  31179. },
  31180. {
  31181. id: '$combogrid',
  31182. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31183. icon: "fa fa-table",
  31184. dragType: "col-item",
  31185. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31186. code: {
  31187. xtype: 'combogrid',
  31188. fieldLabel: '下拉表'
  31189. }
  31190. },
  31191. {
  31192. id: '$combotree',
  31193. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31194. icon: "fa fa-tree",
  31195. dragType: "col-item",
  31196. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31197. code: {
  31198. xtype: 'combotree',
  31199. fieldLabel: '下拉树',
  31200. displayField: 'text',
  31201. rootVisible: false
  31202. }
  31203. },
  31204. {
  31205. id: '$button',
  31206. value: layoutOrXtypeNameMap.button + ' - button',
  31207. icon: 'fa fa-sign-in',
  31208. dragType: "col-item",
  31209. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31210. code: {
  31211. text: '按钮',
  31212. iconCls: 'x-fa fa-bars',
  31213. xtype: 'button'
  31214. }
  31215. },
  31216. {
  31217. id: '$checkbox',
  31218. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31219. icon: 'fa fa-check-square',
  31220. dragType: "col-item",
  31221. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31222. code: {
  31223. xtype: 'checkbox',
  31224. boxLabel: '勾选框',
  31225. hideLabel: true,
  31226. margin: '0 0 0 15',
  31227. flex: 0,
  31228. }
  31229. },
  31230. {
  31231. id: '$checkboxgroup',
  31232. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31233. icon: 'fa fa-check-square',
  31234. dragType: "col-item",
  31235. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31236. code: {
  31237. xtype: 'checkboxgroup',
  31238. fieldLabel: '勾选组',
  31239. items: [
  31240. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31241. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31242. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31243. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31244. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31245. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31246. ]
  31247. }
  31248. },
  31249. {
  31250. id: '$radio',
  31251. value: layoutOrXtypeNameMap.radio + ' - radio',
  31252. icon: 'fa fa-dot-circle-o',
  31253. dragType: "col-item",
  31254. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31255. code: {
  31256. xtype: "radio",
  31257. fieldLabel: "请选择",
  31258. }
  31259. },
  31260. {
  31261. id: '$radiogroup',
  31262. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31263. icon: 'fa fa-dot-circle-o',
  31264. dragType: "col-item",
  31265. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31266. code: {
  31267. xtype: "radiogroup",
  31268. fieldLabel: "请选择",
  31269. items: [
  31270. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31271. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31272. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31273. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31274. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31275. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31276. ]
  31277. }
  31278. },
  31279. {
  31280. id: '$cols',
  31281. value: layoutOrXtypeNameMap.cols + ' - cols',
  31282. icon: 'fa fa-list-alt',
  31283. dragType: "cols-container",
  31284. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31285. code: {
  31286. xtype: 'cols',
  31287. items: [
  31288. {
  31289. xtype: 'textfield',
  31290. fieldLabel: '输入框',
  31291. },
  31292. ],
  31293. }
  31294. },
  31295. {
  31296. id: '$container',
  31297. value: layoutOrXtypeNameMap.container + ' - container',
  31298. icon: 'fa fa-flag',
  31299. dragType: "col-item",
  31300. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31301. code: {
  31302. xtype: 'container',
  31303. border: false,
  31304. layout: 'hbox',
  31305. }
  31306. },
  31307. {
  31308. id: '$fit',
  31309. value: layoutOrXtypeNameMap.fit + ' - fit',
  31310. icon: 'fa fa-flag',
  31311. dragType: "rows-container",
  31312. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31313. code: {
  31314. border: false,
  31315. layout: 'fit',
  31316. items: [
  31317. {
  31318. xtype: 'container',
  31319. border: false,
  31320. layout: 'hbox',
  31321. }
  31322. ]
  31323. }
  31324. },
  31325. ];
  31326. // @ts-ignore
  31327. // export default ToolBoxCmp
  31328. //# sourceMappingURL=ToolBox.js.map
  31329. var that = undefined;
  31330. function initPropertyDesign () {
  31331. Ext.define('com.yvan.studio.PropertyDesign', {
  31332. extend: 'Ext.panel.Panel',
  31333. xtype: 'propertydesign',
  31334. name: "PropertyDesign",
  31335. tooltip: '属性',
  31336. iconCls: 'x-fa fa-newspaper-o',
  31337. reference: 'propertygrid',
  31338. layout: 'border',
  31339. border: false,
  31340. moduleId: null,
  31341. currentComponentVJson: null,
  31342. currentComponentPropertyEditSource: null,
  31343. vjson: null,
  31344. propertyHandle: null,
  31345. moduleSubscribe: null,
  31346. items: [
  31347. new Ext.grid.property.Grid({
  31348. sortableColumns: false,
  31349. region: 'center',
  31350. listeners: {
  31351. propertychange: function (source, propName, value, oldValue, eOpts) {
  31352. value = _.trim(value);
  31353. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31354. return item.label === propName;
  31355. });
  31356. if (a.type === 'listeners') {
  31357. if (value) {
  31358. if (that.currentComponentVJson.listeners) {
  31359. that.currentComponentVJson.listeners[propName] = value;
  31360. }
  31361. else {
  31362. var t = {};
  31363. t[propName] = value;
  31364. that.currentComponentVJson.listeners = t;
  31365. }
  31366. }
  31367. else {
  31368. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31369. if (!value1) {
  31370. delete that.currentComponentVJson.listeners[key];
  31371. }
  31372. else if (key === propName) {
  31373. delete that.currentComponentVJson.listeners[key];
  31374. }
  31375. });
  31376. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31377. delete that.currentComponentVJson.listeners;
  31378. }
  31379. }
  31380. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31381. vjson: that.vjson,
  31382. from: that.name,
  31383. ignoreRenderUI: true
  31384. });
  31385. }
  31386. else if (a.type === 'fix') {
  31387. if (!value) {
  31388. delete that.currentComponentVJson[propName];
  31389. }
  31390. else {
  31391. that.currentComponentVJson[propName] = value.split("\r\n");
  31392. }
  31393. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31394. vjson: that.vjson,
  31395. from: that.name,
  31396. ignoreRenderUI: true
  31397. });
  31398. }
  31399. else if (a.type === 'bind') {
  31400. var bind_1 = that.currentComponentVJson.bind;
  31401. if (typeof bind_1 === 'string' && a.id === "value") {
  31402. if (value) {
  31403. that.currentComponentVJson.bind = value;
  31404. }
  31405. else {
  31406. delete that.currentComponentVJson.bind;
  31407. }
  31408. }
  31409. else {
  31410. // 转成bind对象
  31411. if (typeof bind_1 === 'string') {
  31412. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31413. }
  31414. if (value) {
  31415. if (bind_1) {
  31416. bind_1[a.id] = value;
  31417. }
  31418. else {
  31419. var t = {};
  31420. t[a.id] = value;
  31421. that.currentComponentVJson.bind = t;
  31422. }
  31423. }
  31424. else {
  31425. _.forOwn(bind_1, function (value1, key) {
  31426. if (!value1) {
  31427. delete bind_1[key];
  31428. }
  31429. else if (key === a.id) {
  31430. delete bind_1[key];
  31431. }
  31432. });
  31433. if (Object.keys(bind_1).length <= 0) {
  31434. delete that.currentComponentVJson.bind;
  31435. }
  31436. }
  31437. }
  31438. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31439. vjson: that.vjson,
  31440. from: that.name,
  31441. ignoreRenderUI: true
  31442. });
  31443. }
  31444. else if (a.type === 'boolean') {
  31445. if (!value) {
  31446. delete that.currentComponentVJson[propName];
  31447. }
  31448. else if (value === 'false') {
  31449. that.currentComponentVJson[propName] = false;
  31450. }
  31451. else if (value === 'true') {
  31452. that.currentComponentVJson[propName] = true;
  31453. }
  31454. else {
  31455. that.currentComponentVJson[propName] = value;
  31456. }
  31457. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31458. vjson: that.vjson,
  31459. from: that.name
  31460. });
  31461. }
  31462. else {
  31463. that.currentComponentVJson[propName] = value;
  31464. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31465. vjson: that.vjson,
  31466. from: that.name
  31467. });
  31468. }
  31469. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31470. },
  31471. }
  31472. })
  31473. ],
  31474. listeners: {
  31475. // afterrender() {
  31476. // this.propertyHandle.setSource({
  31477. // "(name)": "My Object",
  31478. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31479. // "Available": false, // boolean type
  31480. // "Version": .01, // decimal type
  31481. // "Description": "A test object"
  31482. // });
  31483. // }
  31484. },
  31485. initComponent: function () {
  31486. var _this = this;
  31487. this.propertyHandle = this.items[0];
  31488. setPropertyPanel(this);
  31489. that = this;
  31490. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31491. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31492. _this.setVjson(moduleId, from, ignoreRenderUI);
  31493. });
  31494. return this.superclass.initComponent.apply(this, arguments);
  31495. },
  31496. setVjson: function (moduleId, from, ignoreRenderUI) {
  31497. var _this = this;
  31498. // if (this.moduleId === null && moduleId) {
  31499. // this.moduleId = moduleId
  31500. // }
  31501. if (moduleId !== this.moduleId || from === this.name) {
  31502. return;
  31503. }
  31504. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31505. if (!moduleObj) {
  31506. return;
  31507. }
  31508. this.vjson = moduleObj.moduleObj.vjson;
  31509. this.setPropertyAndEventSource();
  31510. if (this.componentSelectionChangeSubscribe) {
  31511. this.componentSelectionChangeSubscribe.cancel();
  31512. this.componentSelectionChangeSubscribe = null;
  31513. }
  31514. if (this.updateVjsonChangeSubscribe) {
  31515. this.updateVjsonChangeSubscribe.cancel();
  31516. this.updateVjsonChangeSubscribe = null;
  31517. }
  31518. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31519. var id = _a.id, from = _a.from;
  31520. _this.onComponentSelectionChange(id, from);
  31521. });
  31522. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31523. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31524. _this.updateVjson(vjson, from, ignoreRenderUI);
  31525. });
  31526. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31527. this.onComponentSelectionChange(id, from);
  31528. },
  31529. updateVjson: function (vjson, from, ignoreRenderUI) {
  31530. if (!vjson || from === this.name) {
  31531. return;
  31532. }
  31533. this.vjson = vjson;
  31534. this.setPropertyAndEventSource();
  31535. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31536. this.onComponentSelectionChange(id, from);
  31537. },
  31538. onComponentSelectionChange: function (id, from) {
  31539. if (from !== this.name) {
  31540. this.currentComponentVJson = findInCode(this.vjson, id);
  31541. this.setPropertyAndEventSource();
  31542. }
  31543. },
  31544. setPropertyAndEventSource: function () {
  31545. var _this = this;
  31546. this.propertyHandle.setSource({});
  31547. if (!this.currentComponentVJson) {
  31548. return;
  31549. }
  31550. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31551. var v = xtype;
  31552. // 选中的对象可能是组
  31553. if (!v) {
  31554. if (_.has(this.currentComponentVJson, "cols")) {
  31555. v = "cols";
  31556. }
  31557. else if (_.has(this.currentComponentVJson, "rows")) {
  31558. v = "rows";
  31559. }
  31560. }
  31561. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31562. if (!pd) {
  31563. // 这个组件没有属性
  31564. this.propertyHandle.setSource({});
  31565. return;
  31566. }
  31567. var funcArr = this.getAllfuncs();
  31568. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31569. // disabled: true,
  31570. displayField: 'name',
  31571. valueField: 'name',
  31572. store: funcArr,
  31573. }); };
  31574. // ====================== 属性
  31575. var elements = [];
  31576. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31577. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31578. var props = pd.getPropsByGroup(group);
  31579. if (props.length <= 0)
  31580. return; //没有这一组属性
  31581. // 显示 group 的中文名
  31582. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31583. if (caption[i] === '绑定') {
  31584. _.each(props, function (prop) {
  31585. elements.push({
  31586. label: "_" + prop.name,
  31587. type: "bind",
  31588. id: prop.name,
  31589. desc: prop.desc,
  31590. editor: new Ext.form.field.Text()
  31591. });
  31592. });
  31593. }
  31594. else {
  31595. _.each(props, function (prop) {
  31596. if (_.isArray(prop.type)) {
  31597. elements.push({
  31598. label: prop.name,
  31599. type: "combo",
  31600. options: prop.type,
  31601. id: prop.name,
  31602. desc: prop.desc
  31603. });
  31604. return;
  31605. }
  31606. switch (prop.type) {
  31607. case 'boolean': {
  31608. elements.push({
  31609. label: prop.name,
  31610. id: prop.name,
  31611. desc: prop.desc,
  31612. type: 'boolean',
  31613. editor: new Ext.form.field.ComboBox({
  31614. displayField: 'text',
  31615. valueField: 'id',
  31616. store: new Ext.data.Store({
  31617. field: ['id', 'text'],
  31618. data: [
  31619. { id: 'true', text: 'True' },
  31620. { id: 'false', text: 'False' },
  31621. ]
  31622. })
  31623. }),
  31624. });
  31625. break;
  31626. }
  31627. case 'number': {
  31628. elements.push({
  31629. label: prop.name,
  31630. type: "number",
  31631. id: prop.name,
  31632. isNum: true,
  31633. desc: prop.desc,
  31634. editor: new Ext.form.field.Number()
  31635. });
  31636. break;
  31637. }
  31638. case 'string': {
  31639. elements.push({
  31640. label: prop.name,
  31641. type: "string",
  31642. id: prop.name,
  31643. desc: prop.desc,
  31644. editor: new Ext.form.field.Text()
  31645. });
  31646. break;
  31647. }
  31648. case 'listeners': {
  31649. elements.push({
  31650. label: prop.name,
  31651. type: "listeners",
  31652. id: prop.name,
  31653. desc: prop.desc,
  31654. editor: createFuncEditor()
  31655. });
  31656. break;
  31657. }
  31658. case 'fix': {
  31659. elements.push({
  31660. label: prop.name,
  31661. type: "fix",
  31662. id: prop.name,
  31663. desc: prop.desc,
  31664. editor: new Ext.form.field.Text()
  31665. });
  31666. break;
  31667. }
  31668. case 'object': {
  31669. break;
  31670. }
  31671. // case 'dataSource' : {
  31672. // break;
  31673. // }
  31674. case 'valid': {
  31675. break;
  31676. }
  31677. default:
  31678. elements.push({
  31679. label: prop.name,
  31680. type: prop.type,
  31681. id: prop.name,
  31682. desc: prop.desc,
  31683. editor: new Ext.form.field.Text({ disabled: true })
  31684. });
  31685. console.error('不支持的编辑类型', prop);
  31686. }
  31687. });
  31688. }
  31689. });
  31690. this.currentComponentPropertyEditSource = elements;
  31691. var panel1Source = {};
  31692. var panel1SourceConfig = {};
  31693. _.each(elements, function (item) {
  31694. var _a;
  31695. if (item.type === "listeners") {
  31696. var listeners = _this.currentComponentVJson.listeners;
  31697. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31698. }
  31699. else if (item.type === "fix") {
  31700. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31701. }
  31702. else if (item.type === "bind") {
  31703. var bind = _this.currentComponentVJson.bind;
  31704. if (typeof bind === 'string' && item.id === 'value') {
  31705. panel1Source[item.label] = bind;
  31706. }
  31707. else {
  31708. panel1Source[item.label] = bind ? bind[item.id] : '';
  31709. }
  31710. }
  31711. else {
  31712. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31713. }
  31714. panel1Source[item.label] = panel1Source[item.label] || '';
  31715. panel1SourceConfig[item.label] = { editor: item.editor };
  31716. });
  31717. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31718. },
  31719. getAllfuncs: function () {
  31720. var _a, _b;
  31721. 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;
  31722. var scopeFuncs = [];
  31723. _.forEach(arr, function (item) {
  31724. scopeFuncs.push({ name: "scope." + item.name });
  31725. });
  31726. return scopeFuncs;
  31727. }
  31728. });
  31729. }
  31730. //# sourceMappingURL=PropertyDesign.js.map
  31731. function initViewOutlineTree () {
  31732. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31733. extend: 'Ext.tree.Panel',
  31734. xtype: 'viewoutlinetree',
  31735. name: "ViewOutlineTree",
  31736. tooltip: '设计大纲',
  31737. iconCls: 'x-fa fa-list',
  31738. rootVisible: false,
  31739. useArrows: true,
  31740. allowDeselect: true,
  31741. colspan: 2,
  31742. lines: false,
  31743. reference: 'viewoutlinetree',
  31744. multiSelect: true,
  31745. _saveStateFlag: true,
  31746. keyMapEnabled: true,
  31747. moduleId: null,
  31748. vjson: null,
  31749. columns: [
  31750. {
  31751. xtype: 'treecolumn',
  31752. text: '布局',
  31753. dataIndex: 'layoutNameDesc',
  31754. flex: 2,
  31755. sortable: true
  31756. }, {
  31757. text: '组件',
  31758. dataIndex: 'xtype',
  31759. flex: 1,
  31760. sortable: true,
  31761. align: 'center',
  31762. }
  31763. ],
  31764. listeners: {
  31765. itemcontextmenu: function (sender, node, element, idx, e) {
  31766. e.preventDefault();
  31767. this.rightClickTreeNode(sender, node, element, idx, e);
  31768. },
  31769. select: function (sender, node, index, e) {
  31770. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31771. },
  31772. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31773. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31774. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31775. }
  31776. }
  31777. },
  31778. initComponent: function () {
  31779. var _this = this;
  31780. setViewoutlinetree(this);
  31781. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31782. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31783. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31784. });
  31785. return this.superclass.initComponent.apply(this, arguments);
  31786. },
  31787. clear: function () {
  31788. this.setRootNode(null);
  31789. },
  31790. onChangModule: function (moduleId, oldModuleId, from) {
  31791. if (!moduleId || moduleId !== this.moduleId) {
  31792. return;
  31793. }
  31794. if (moduleStore.getModuleObject(moduleId)) {
  31795. this.setVjson(moduleId, from);
  31796. }
  31797. },
  31798. setVjson: function (moduleId, from, ignoreRenderUI) {
  31799. var _this = this;
  31800. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31801. return;
  31802. }
  31803. this.moduleId = moduleId;
  31804. // if (from === this.name) {
  31805. // return
  31806. // }
  31807. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31808. this.setTreeValue();
  31809. if (this.componentSelectionChangeSubscribe) {
  31810. this.componentSelectionChangeSubscribe.cancel();
  31811. this.componentSelectionChangeSubscribe = null;
  31812. }
  31813. if (this.setVjsonChangeSubscribe) {
  31814. this.setVjsonChangeSubscribe.cancel();
  31815. this.setVjsonChangeSubscribe = null;
  31816. }
  31817. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31818. var id = _a.id, from = _a.from;
  31819. return _this.onComponentSelectionChange(id, from);
  31820. });
  31821. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31822. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31823. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31824. });
  31825. },
  31826. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31827. if (!vjson || from === this.name) {
  31828. return;
  31829. }
  31830. this.vjson = vjson;
  31831. this.setTreeValue();
  31832. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31833. if (id) {
  31834. this.selectPath(id);
  31835. }
  31836. },
  31837. onComponentSelectionChange: function (id, from) {
  31838. if (from !== this.name) {
  31839. if (id) {
  31840. this.selectPath(id);
  31841. }
  31842. else {
  31843. this.setTreeValue();
  31844. }
  31845. }
  31846. },
  31847. setTreeValue: function () {
  31848. var outlineVj = {};
  31849. _.forOwn(this.vjson, function (obj, key) {
  31850. if (key !== 'viewModel' && key !== 'store') {
  31851. outlineVj[key] = _.cloneDeep(obj);
  31852. }
  31853. });
  31854. getLayoutOutline(outlineVj);
  31855. this.setRootNode(outlineVj);
  31856. },
  31857. rightClickTreeNode: function (sender, node, element, idx, e) {
  31858. var raw = node.data;
  31859. var option = {};
  31860. // 右键
  31861. option = {
  31862. shadow: 'frame',
  31863. allowOtherMenus: true,
  31864. items: []
  31865. };
  31866. var switchType = raw.layoutName;
  31867. if (raw.layoutName === 'north' ||
  31868. raw.layoutName === 'south' ||
  31869. raw.layoutName === 'west' ||
  31870. raw.layoutName === 'east' ||
  31871. raw.layoutName === 'center' ||
  31872. raw.layoutName === 'tbar' ||
  31873. raw.layoutName === 'fbar') {
  31874. switchType = raw.xtype || raw.layout;
  31875. }
  31876. var itemArr = [];
  31877. var hasTbar = false, hasFbar = false, hasBody = false;
  31878. if (raw.hasOwnProperty("children")) {
  31879. _.forEach(raw.children, function (value) {
  31880. if (value.layoutName === 'tbar') {
  31881. hasTbar = true;
  31882. }
  31883. else if (value.layoutName === 'fbar') {
  31884. hasFbar = true;
  31885. }
  31886. else {
  31887. hasBody = true;
  31888. }
  31889. });
  31890. }
  31891. switch (switchType) {
  31892. case 'fit':
  31893. if (!hasTbar) {
  31894. itemArr.push('tbar');
  31895. }
  31896. if (!hasFbar) {
  31897. itemArr.push('fbar');
  31898. }
  31899. if (!hasBody) {
  31900. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31901. }
  31902. option.items = this.menuNew(itemArr, raw);
  31903. break;
  31904. case 'border':
  31905. if (!hasTbar) {
  31906. itemArr.push('tbar');
  31907. }
  31908. if (!hasFbar) {
  31909. itemArr.push('fbar');
  31910. }
  31911. itemArr.push('cnsew');
  31912. option.items = this.menuNew(itemArr, raw);
  31913. break;
  31914. // case 'tbar':
  31915. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31916. // break;
  31917. // case 'fbar':
  31918. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31919. // break;
  31920. case 'tabpanel':
  31921. if (!hasTbar) {
  31922. itemArr.push('tbar');
  31923. }
  31924. if (!hasFbar) {
  31925. itemArr.push('fbar');
  31926. }
  31927. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31928. option.items = this.menuNew(itemArr, raw);
  31929. break;
  31930. case 'yvgrid':
  31931. if (!hasTbar) {
  31932. itemArr.push('tbar');
  31933. }
  31934. option.items = this.menuNew(itemArr, raw);
  31935. break;
  31936. case 'tree':
  31937. if (!hasTbar) {
  31938. itemArr.push('tbar');
  31939. }
  31940. if (!hasFbar) {
  31941. itemArr.push('fbar');
  31942. }
  31943. option.items = this.menuNew(itemArr, raw);
  31944. break;
  31945. case 'fieldset':
  31946. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31947. break;
  31948. case 'form':
  31949. if (!hasTbar) {
  31950. itemArr.push('tbar');
  31951. }
  31952. if (!hasFbar) {
  31953. itemArr.push('fbar');
  31954. }
  31955. itemArr.push('form', 'fieldset', 'cols');
  31956. option.items = this.menuNew(itemArr, raw);
  31957. break;
  31958. case 'toolbar':
  31959. itemArr.push('button', 'textfield', 'label', 'combo');
  31960. option.items = this.menuNew(itemArr, raw);
  31961. break;
  31962. // case 'fbar':
  31963. // itemArr.push('button', 'textfield', 'label', 'combo')
  31964. // option.items = this.menuNew(itemArr, raw)
  31965. // break
  31966. default:
  31967. option.items = this.menuNew(itemArr, raw);
  31968. break;
  31969. }
  31970. var treeMenu = new Ext.menu.Menu(option);
  31971. treeMenu.showAt(e.getXY());
  31972. },
  31973. newItem: function (viewType, raw, region) {
  31974. var itemVjson = {};
  31975. switch (viewType) {
  31976. case 'fit':
  31977. itemVjson.layout = 'fit';
  31978. itemVjson.items = [];
  31979. break;
  31980. case 'border':
  31981. itemVjson.layout = 'border';
  31982. itemVjson.items = [];
  31983. break;
  31984. case 'toolbar':
  31985. itemVjson.xtype = 'toolbar';
  31986. itemVjson.title = 'toolbar';
  31987. itemVjson.items = [
  31988. {
  31989. xtype: 'button',
  31990. text: 'button'
  31991. }
  31992. ];
  31993. break;
  31994. case 'tabpanel':
  31995. itemVjson.xtype = 'tabpanel';
  31996. itemVjson.layout = 'fit';
  31997. itemVjson.items = [];
  31998. break;
  31999. case 'yvgrid':
  32000. itemVjson.xtype = 'yvgrid';
  32001. itemVjson.layout = 'fit';
  32002. itemVjson.pagination = false;
  32003. itemVjson.columns = [
  32004. {
  32005. dataIndex: "skuId",
  32006. header: "SKU_ID",
  32007. },
  32008. ];
  32009. break;
  32010. case 'tree':
  32011. itemVjson.xtype = 'treepanel';
  32012. itemVjson.layout = 'fit';
  32013. break;
  32014. case 'fieldset':
  32015. case 'form':
  32016. itemVjson.xtype = viewType;
  32017. itemVjson.title = viewType;
  32018. itemVjson.items = [
  32019. {
  32020. xtype: 'cols',
  32021. items: [
  32022. {
  32023. xtype: 'textfield',
  32024. fieldLabel: '输入框'
  32025. }
  32026. ]
  32027. }
  32028. ];
  32029. break;
  32030. case 'cols':
  32031. itemVjson.xtype = 'cols';
  32032. itemVjson.items = [
  32033. {
  32034. xtype: 'textfield',
  32035. fieldLabel: '输入框'
  32036. }
  32037. ];
  32038. break;
  32039. case 'button':
  32040. itemVjson.xtype = 'button';
  32041. itemVjson.text = '按钮';
  32042. itemVjson.iconCls = 'x-fa fa-plus';
  32043. break;
  32044. case 'textfield':
  32045. itemVjson.xtype = 'textfield';
  32046. itemVjson.fieldLabel = '输入框';
  32047. break;
  32048. case 'combo':
  32049. itemVjson.xtype = 'combo';
  32050. itemVjson.fieldLabel = '下拉框';
  32051. break;
  32052. case 'label':
  32053. itemVjson.xtype = 'label';
  32054. itemVjson.text = '文本';
  32055. break;
  32056. }
  32057. var target = findInCode(this.vjson, raw.id);
  32058. if (region) {
  32059. if (region === 'tbar' || region === 'fbar') {
  32060. target[region] = itemVjson;
  32061. }
  32062. else {
  32063. itemVjson.region = region;
  32064. itemVjson.split = true;
  32065. if (region === 'north' || region === 'south') {
  32066. itemVjson.height = '30%';
  32067. itemVjson.collapsible = true;
  32068. }
  32069. else if (region === 'west' || region === 'east') {
  32070. itemVjson.width = '30%';
  32071. itemVjson.collapsible = true;
  32072. }
  32073. target.items.push(itemVjson);
  32074. }
  32075. }
  32076. else {
  32077. if (target.xtype === 'tabpanel') {
  32078. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32079. }
  32080. target.items.push(itemVjson);
  32081. }
  32082. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32083. },
  32084. menuNew: function (typeArr, raw, region) {
  32085. var that = this;
  32086. var reArr = [];
  32087. typeArr.forEach(function (value) {
  32088. if (value === 'cnsew') {
  32089. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32090. }
  32091. else if (value === 'tbar' || value === 'fbar') {
  32092. reArr.push(that.menuNewTFBar(value, raw));
  32093. }
  32094. else {
  32095. reArr.push({
  32096. text: '新建' + layoutOrXtypeNameMap[value],
  32097. iconCls: 'x-fa fa-plus',
  32098. handler: function (sender) {
  32099. that.newItem(value, raw, region);
  32100. }
  32101. });
  32102. }
  32103. reArr.push("-");
  32104. });
  32105. if (region) {
  32106. reArr.pop();
  32107. return reArr;
  32108. }
  32109. reArr.push({
  32110. text: '高级属性',
  32111. iconCls: 'x-fa fa-cog',
  32112. handler: function (sender) {
  32113. var vj = findInCode(that.vjson, raw.id);
  32114. that.advancedSettingWindow(vj);
  32115. }
  32116. }, {
  32117. text: '上移',
  32118. iconCls: 'x-fa fa-trash',
  32119. handler: function (sender) {
  32120. that.moveCmp(raw.id, 'up');
  32121. }
  32122. }, {
  32123. text: '置顶',
  32124. iconCls: 'x-fa fa-trash',
  32125. handler: function (sender) {
  32126. that.moveCmp(raw.id, 'top');
  32127. }
  32128. }, {
  32129. text: '置底',
  32130. iconCls: 'x-fa fa-trash',
  32131. handler: function (sender) {
  32132. that.moveCmp(raw.id, 'bottom');
  32133. }
  32134. }, {
  32135. text: '下移',
  32136. iconCls: 'x-fa fa-trash',
  32137. handler: function (sender) {
  32138. that.moveCmp(raw.id, 'down');
  32139. }
  32140. }, {
  32141. text: '删除',
  32142. iconCls: 'x-fa fa-trash',
  32143. handler: function (sender) {
  32144. deletVjsonById(that.vjson, raw.id);
  32145. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32146. }
  32147. });
  32148. return reArr;
  32149. },
  32150. menuNewCNSEW: function (raw) {
  32151. var that = this;
  32152. var arr = ['center', 'north', 'south', 'west', 'east'];
  32153. if (raw.hasOwnProperty("children")) {
  32154. _.forEach(raw.children, function (value) {
  32155. _.remove(arr, function (it) {
  32156. return it === value.layoutName;
  32157. });
  32158. });
  32159. }
  32160. var reArr = [];
  32161. arr.forEach(function (value) {
  32162. reArr.push({
  32163. text: layoutOrXtypeNameMap[value],
  32164. iconCls: 'x-fa fa-plus',
  32165. menu: {
  32166. showSeparator: true,
  32167. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32168. }
  32169. });
  32170. reArr.push("-");
  32171. });
  32172. reArr.pop();
  32173. return reArr;
  32174. },
  32175. menuNewTFBar: function (barType, raw) {
  32176. var that = this;
  32177. var reObj = {
  32178. text: layoutOrXtypeNameMap[barType],
  32179. iconCls: 'x-fa fa-plus',
  32180. menu: {
  32181. showSeparator: true,
  32182. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32183. }
  32184. };
  32185. return reObj;
  32186. },
  32187. moveCmp: function (id, moveType) {
  32188. var arr = findArrayContainer(this.vjson, id);
  32189. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32190. if (index < 0) {
  32191. return;
  32192. }
  32193. switch (moveType) {
  32194. case 'up':
  32195. if (index > 0) {
  32196. var o = arr[index];
  32197. arr[index] = arr[index - 1];
  32198. arr[index - 1] = o;
  32199. }
  32200. else {
  32201. return;
  32202. }
  32203. break;
  32204. case 'down':
  32205. if (index < arr.length - 1) {
  32206. var o = arr[index];
  32207. arr[index] = arr[index + 1];
  32208. arr[index + 1] = o;
  32209. }
  32210. else {
  32211. return;
  32212. }
  32213. break;
  32214. case 'top':
  32215. if (index > 0) {
  32216. var o = arr[index];
  32217. arr[index] = arr[0];
  32218. arr[0] = o;
  32219. }
  32220. else {
  32221. return;
  32222. }
  32223. break;
  32224. case 'bottom':
  32225. if (index < arr.length - 1) {
  32226. var o = arr[index];
  32227. arr[index] = arr[arr.length - 1];
  32228. arr[arr.length - 1] = o;
  32229. }
  32230. else {
  32231. return;
  32232. }
  32233. break;
  32234. }
  32235. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32236. }
  32237. });
  32238. }
  32239. //# sourceMappingURL=ViewOutlineTree.js.map
  32240. function init$2 () {
  32241. window['native'] = native;
  32242. native.init();
  32243. init();
  32244. instance.getAllDomain().finally(function () {
  32245. });
  32246. initStateTree();
  32247. initDashboard();
  32248. initFileTree();
  32249. initDbTree();
  32250. initReportGrid();
  32251. initGroovyEditor();
  32252. initJsEditor$1();
  32253. initJsonEditor$1();
  32254. initSqlEditor$1();
  32255. initTemplateEditor();
  32256. initDict$1();
  32257. initBpmnTree();
  32258. initToolBox();
  32259. initPropertyDesign();
  32260. initViewOutlineTree();
  32261. initWidget();
  32262. initWhLayout();
  32263. initApiTree();
  32264. initTaskTree();
  32265. initLogsTree();
  32266. initDevOpsTree();
  32267. initTerminal();
  32268. initMonitorTree();
  32269. initHomeTree();
  32270. }
  32271. //# sourceMappingURL=init.js.map
  32272. var studio = {
  32273. init: init$2,
  32274. handles: handles$1,
  32275. Workbench: Workbench
  32276. };
  32277. //# sourceMappingURL=index.js.map
  32278. exports.axios = axios;
  32279. exports.qs = Qs;
  32280. exports.lodash = _$2;
  32281. exports.jquery = $$2;
  32282. exports.moment = moment$1;
  32283. exports.recast = recast;
  32284. exports.XLSX = XLSX;
  32285. exports.Defaults = Defaults;
  32286. exports.ExcelImportDialog = ExcelImportDialog;
  32287. exports.Lib = Lib;
  32288. exports.LibParam = LibParam;
  32289. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32290. exports.ReportScope = ReportScope;
  32291. exports.SIMPLE_RE = SIMPLE_RE;
  32292. exports.Scope = Scope;
  32293. exports.ScopeEngine = ScopeEngine;
  32294. exports.SystemEventFu = SystemEventFu;
  32295. exports.ajax = ajax;
  32296. exports.baseConfigProcess = baseConfigProcess;
  32297. exports.baseConfigProcessList = baseConfigProcessList;
  32298. exports.buildPlus = buildPlus;
  32299. exports.buildReportScope = buildReportScope;
  32300. exports.calcExpress = calcExpress;
  32301. exports.calcObject = calcObject;
  32302. exports.calcObjectFlat = calcObjectFlat;
  32303. exports.clearViewModel = clearViewModel;
  32304. exports.clearViewModelByLookup = clearViewModelByLookup;
  32305. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32306. exports.clearViewModelValues = clearViewModelValues;
  32307. exports.commitMe = commitMe;
  32308. exports.confirm = confirm;
  32309. exports.createAjax = createAjax;
  32310. exports.createUUID = createUUID;
  32311. exports.deepTravJson = deepTravJson;
  32312. exports.downLoad = downLoad;
  32313. exports.evalFunction = evalFunction;
  32314. exports.extend = extend;
  32315. exports.flatRow = flatRow;
  32316. exports.getApiConvert = getApiConvert;
  32317. exports.getGridEditRows = getGridEditRows;
  32318. exports.getParentGrid = getParentGrid;
  32319. exports.getPinyin = getPinyin;
  32320. exports.getRegList = getRegList;
  32321. exports.getRegParamList = getRegParamList;
  32322. exports.getScopeOnCreate = getScopeOnCreate;
  32323. exports.init = init$1;
  32324. exports.insertGridRow = insertGridRow;
  32325. exports.invokeServer = invokeServer$1;
  32326. exports.isDesignMode = isDesignMode;
  32327. exports.isEmpty = isEmpty;
  32328. exports.json5 = dist;
  32329. exports.keywordFilter = keywordFilter;
  32330. exports.lookupFn = lookupFn;
  32331. exports.lookupScope = lookupScope;
  32332. exports.mergeViewModel = mergeViewModel;
  32333. exports.moveDownGridRow = moveDownGridRow;
  32334. exports.moveUpGridRow = moveUpGridRow;
  32335. exports.msg = msg$1;
  32336. exports.msgError = msgError;
  32337. exports.normId = normId;
  32338. exports.pinyinMatch = pinyinMatch;
  32339. exports.prompt = prompt$2;
  32340. exports.raiseClick = raiseClick;
  32341. exports.reloadGrid = reloadGrid;
  32342. exports.removeGridRow = removeGridRow;
  32343. exports.replaceNA = replaceNA;
  32344. exports.saveGridRow = saveGridRow;
  32345. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32346. exports.setComboStore = setComboStore;
  32347. exports.showErrorDialog = showErrorDialog$1;
  32348. exports.showInfoDialog = showInfoDialog;
  32349. exports.showWidget = showWidget;
  32350. exports.sqlUrlTransform = sqlUrlTransform;
  32351. exports.stopEvent = stopEvent;
  32352. exports.studio = studio;
  32353. exports.toPlainObject = toPlainObject;
  32354. exports.toString = toString;
  32355. exports.tryEnable = tryEnable;
  32356. exports.tryVarSimple = tryVarSimple;
  32357. exports.tryWriteByExpress = tryWriteByExpress;
  32358. exports.tryWriteObject = tryWriteObject;
  32359. exports.watch = watch;
  32360. Object.defineProperty(exports, '__esModule', { value: true });
  32361. });
  32362. //# sourceMappingURL=yvan-ext.js.map