yvan-ext.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864
  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. sender.setFilter({
  15408. type: 'list',
  15409. options: _$2.map(r.data, function (r) { return ({
  15410. id: '' + r.id,
  15411. text: r.text,
  15412. }); })
  15413. });
  15414. }
  15415. else {
  15416. // 没有渲染之前,修改 config 即可
  15417. if (editor_1 && editor_1.xtype === 'combo') {
  15418. // 带编辑模式
  15419. editor_1.store = new Ext.data.Store(r);
  15420. }
  15421. config.filter = {
  15422. type: 'list',
  15423. options: _$2.map(r.data, function (r) { return ({
  15424. id: '' + r.id,
  15425. text: r.text,
  15426. }); })
  15427. };
  15428. }
  15429. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15430. var renderer = function (value, metaData) {
  15431. if (metaData === void 0) { metaData = false; }
  15432. if (!value && value != 0) {
  15433. return '';
  15434. }
  15435. var valueField = r.field[metaData === true ? 1 : 0];
  15436. var displayField = r.field[metaData === true ? 0 : 1];
  15437. var separator = multiValueSeparator;
  15438. if (separator) {
  15439. var arr = value.split(separator);
  15440. var displayValue_1 = "";
  15441. var _loop_1 = function (i) {
  15442. var itv = arr[i];
  15443. if (i > 0) {
  15444. displayValue_1 += separator;
  15445. }
  15446. _$2.each(r.data, function (row) {
  15447. // 从 valueField 找到要显示的 displayField
  15448. if (row[valueField] == itv) {
  15449. displayValue_1 += row[displayField];
  15450. return false;
  15451. }
  15452. else {
  15453. if (i >= r.data.length - 1) {
  15454. displayValue_1 += itv;
  15455. }
  15456. }
  15457. });
  15458. };
  15459. for (var i = 0; i < arr.length; i++) {
  15460. _loop_1(i);
  15461. }
  15462. return displayValue_1;
  15463. }
  15464. _$2.each(r.data, function (row) {
  15465. // 从 valueField 找到要显示的 displayField
  15466. if (row[valueField] == value) {
  15467. value = row[displayField];
  15468. return false;
  15469. }
  15470. });
  15471. return value;
  15472. };
  15473. var dictForExcel = {};
  15474. var valueField = r.field[0];
  15475. var displayField = r.field[1];
  15476. _$2.each(r.data, function (row) {
  15477. // 从 valueField 找到要显示的 displayField
  15478. var key = row[valueField];
  15479. if (key != '' && typeof key != "undefined" && key != null) {
  15480. dictForExcel[key] = row[displayField];
  15481. }
  15482. });
  15483. if (sender.rendered) {
  15484. // 已经渲染出来了, 对列进行渲染
  15485. sender.renderer = renderer;
  15486. sender.dictForExcel = dictForExcel;
  15487. sender.getView().refresh();
  15488. }
  15489. else {
  15490. sender.renderer = renderer;
  15491. sender.dictForExcel = dictForExcel;
  15492. config.renderer = renderer;
  15493. config.dictForExcel = dictForExcel;
  15494. }
  15495. });
  15496. return;
  15497. }
  15498. throw new TypeError("无法识别的组件类型");
  15499. }
  15500. /**
  15501. * 调用服务器 Ajax
  15502. */
  15503. function invokeServer$1(url) {
  15504. var args = [];
  15505. for (var _i = 1; _i < arguments.length; _i++) {
  15506. args[_i - 1] = arguments[_i];
  15507. }
  15508. // @ts-ignore
  15509. return ajax.func({
  15510. url: url,
  15511. method: 'invoke',
  15512. args: args
  15513. });
  15514. }
  15515. function clearViewModelValues(viewModel, propertyName) {
  15516. if (!propertyName) {
  15517. var dd_1 = viewModel.getData();
  15518. _$2.forOwn(dd_1, function (value, key) {
  15519. viewModel.set(key, '');
  15520. });
  15521. return;
  15522. }
  15523. var dd = _$2.get(viewModel.getData(), propertyName);
  15524. _$2.forOwn(dd, function (value, key) {
  15525. viewModel.set(propertyName + '.' + key, '');
  15526. });
  15527. }
  15528. function reloadGrid(scope, gridRefName) {
  15529. var _a;
  15530. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15531. }
  15532. /**
  15533. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15534. */
  15535. function toPlainObject(obj) {
  15536. if (obj.isModel) {
  15537. obj = obj.data;
  15538. }
  15539. _$2.forOwn(obj, function (v, k) {
  15540. // Ext.data.Model.constructor
  15541. if (!v) {
  15542. return;
  15543. }
  15544. if (v.isModel) {
  15545. v = v.data;
  15546. }
  15547. if (typeof v === 'object') {
  15548. obj[k] = toPlainObject(v);
  15549. }
  15550. else {
  15551. obj[k] = v;
  15552. }
  15553. });
  15554. return obj;
  15555. }
  15556. function confirm(msg, sender) {
  15557. return new Promise(function (resolve) {
  15558. var _a, _b;
  15559. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15560. var t = { msg: msg };
  15561. var WMSTranslate = window["WMSTranslate"];
  15562. if (WMSTranslate) {
  15563. if (typeof window['viewTranslate'] === 'function') {
  15564. window['viewTranslate'](t, msg, "msg");
  15565. }
  15566. }
  15567. var config = {
  15568. title: '请确认',
  15569. modal: true,
  15570. animateTarget: sender,
  15571. // resizable: false,
  15572. // constrainHeader: true,
  15573. // constrain: true,
  15574. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15575. layout: {
  15576. type: 'hbox',
  15577. pack: 'start',
  15578. align: 'stretch'
  15579. },
  15580. items: [
  15581. {
  15582. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15583. border: false,
  15584. },
  15585. {
  15586. flex: 1,
  15587. border: false,
  15588. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15589. }
  15590. ],
  15591. buttons: [
  15592. {
  15593. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15594. handler: function () {
  15595. resolve();
  15596. win.close();
  15597. }
  15598. },
  15599. {
  15600. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15601. handler: function () {
  15602. win.close();
  15603. }
  15604. }
  15605. ],
  15606. keyMapEnabled: true,
  15607. keyMap: {
  15608. ENTER: function () {
  15609. resolve();
  15610. win.close();
  15611. }
  15612. }
  15613. };
  15614. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15615. config.constrain = true;
  15616. }
  15617. var win = new Ext.Window(config);
  15618. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15619. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15620. }
  15621. win.show();
  15622. });
  15623. }
  15624. /**
  15625. * 任何符号字符串都替换成下换线
  15626. */
  15627. function normId(value) {
  15628. return _$2.replace(value, /[^\w]/g, '_');
  15629. }
  15630. /**
  15631. *
  15632. * @param sender
  15633. * @param propertyName
  15634. * @param gridRefName
  15635. */
  15636. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15637. var _a, _b;
  15638. var scope = lookupScope(sender);
  15639. clearViewModelValues(scope.viewModel, propertyName);
  15640. if (!gridRefName) {
  15641. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15642. }
  15643. else {
  15644. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15645. }
  15646. }
  15647. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15648. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15649. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15650. var value = _$2.trim(sender.rawValue);
  15651. raiseClick(eOpts.handle);
  15652. }
  15653. }, 150);
  15654. function saveGridRow(grid1) {
  15655. var _a;
  15656. var config = grid1.config;
  15657. var scope = lookupScope(grid1);
  15658. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15659. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15660. // "表格保存"的相关配置
  15661. var dbSaveConfig = {
  15662. columns: [],
  15663. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15664. saveRowValues: saveRowValues,
  15665. path: scope.originalVjson.__custom_path,
  15666. };
  15667. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15668. if (err) {
  15669. // 如果有异常就不保存
  15670. return;
  15671. }
  15672. // 构建"表格保存"的相关配置
  15673. for (var i = 0; i < config.columns.length; i++) {
  15674. var c = config.columns[i];
  15675. var v = {
  15676. dataIndex: c.dataIndex,
  15677. header: c.header,
  15678. dbColumn: c.dbColumn,
  15679. serverCreateValue: c.serverCreateValue,
  15680. dbIsDeleteKey: c.dbIsDeleteKey,
  15681. dbIsUpdateKey: c.dbIsUpdateKey,
  15682. dbUpdateEnable: c.dbUpdateEnable,
  15683. serverValueConvert: c.dbUpdateEnable,
  15684. };
  15685. if (c.editor) {
  15686. v.editor = {
  15687. xtype: c.editor.xtype,
  15688. required: c.editor.required,
  15689. };
  15690. }
  15691. dbSaveConfig.columns.push(v);
  15692. }
  15693. // 进行业务上的逻辑校验
  15694. var hasError = false;
  15695. _$2.forEach(rows, function (row, i) {
  15696. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15697. var c = config.columns[i_1];
  15698. var value = row[c.dataIndex];
  15699. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15700. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15701. hasError = true;
  15702. return false;
  15703. }
  15704. if (c.xtype === 'checkcolumn') {
  15705. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15706. row[c.dataIndex] = c.uncheckedValue;
  15707. }
  15708. if (value === true && typeof c.checkedValue !== 'undefined') {
  15709. row[c.dataIndex] = c.checkedValue;
  15710. }
  15711. }
  15712. }
  15713. });
  15714. if (hasError) {
  15715. return;
  15716. }
  15717. // 设置当前界面为 "保存中..." 状态
  15718. grid1.setLoading(true);
  15719. invokeServer$1('/Dev@batchSave', {
  15720. newRows: newRows,
  15721. modifyRows: modifyRows,
  15722. removeRecords: removeRecords,
  15723. config: dbSaveConfig,
  15724. }).then(function (res) {
  15725. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15726. msg$1(res.msg);
  15727. grid1.reload();
  15728. }).catch(function (e) {
  15729. console.error(e);
  15730. showErrorDialog$1(_$2.toString(e));
  15731. }).finally(function () {
  15732. // 无论正常异常,关闭 "保存中..." 状态
  15733. grid1.setLoading(false);
  15734. });
  15735. }
  15736. function insertGridRow(grid1) {
  15737. var config = grid1.config;
  15738. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15739. var insertRow = {};
  15740. _$2.forEach(config.columns, function (c) {
  15741. var fn = c.createValue;
  15742. if (_$2.startsWith(fn, 'scope.') ||
  15743. _$2.startsWith(fn, 'system.')) {
  15744. var scope = lookupScope(grid1);
  15745. var fn2 = lookupFn(scope, fn, c);
  15746. if (_$2.isFunction(fn2)) {
  15747. var newValue = fn2();
  15748. if (!_$2.isUndefined(newValue)) {
  15749. insertRow[c.dataIndex] = newValue;
  15750. }
  15751. }
  15752. }
  15753. else if (_$2.isString(fn) && fn) {
  15754. insertRow[c.dataIndex] = fn;
  15755. }
  15756. });
  15757. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15758. }
  15759. function commitMe(sender) {
  15760. var window = sender.up('window');
  15761. var scope = lookupScope(sender);
  15762. if (typeof scope['commit'] === 'function') {
  15763. scope['commit']().then(function (res) {
  15764. window.close();
  15765. });
  15766. }
  15767. }
  15768. function removeGridRow(grid1) {
  15769. var _a;
  15770. var config = grid1.config;
  15771. var rows = [];
  15772. if (grid1.selModel.selType === "rowmodel") {
  15773. rows.push(grid1.selection);
  15774. }
  15775. else {
  15776. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15777. rows.push(r);
  15778. });
  15779. }
  15780. if (rows.length > 1) {
  15781. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15782. if (_$2.isUndefined(batchRemoveConfirm)) {
  15783. //不需要提示
  15784. _$2.forEach(rows, function (r) {
  15785. grid1.getStore().remove(r);
  15786. });
  15787. }
  15788. else {
  15789. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15790. confirm(tip).then(function () {
  15791. _$2.forEach(rows, function (r) {
  15792. grid1.getStore().remove(r);
  15793. });
  15794. });
  15795. }
  15796. }
  15797. else if (rows.length === 1) {
  15798. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15799. if (_$2.isUndefined(singleRemoveConfirm)) {
  15800. //不需要提示
  15801. grid1.getStore().remove(rows[0]);
  15802. }
  15803. else {
  15804. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15805. _$2.forEach(config.columns, function (c) {
  15806. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15807. });
  15808. confirm(tip_1).then(function () {
  15809. grid1.getStore().remove(rows[0]);
  15810. });
  15811. }
  15812. }
  15813. else {
  15814. msg$1('请选择要删除的数据!');
  15815. }
  15816. }
  15817. function moveUpGridRow(grid) {
  15818. grid.rowMoveUp();
  15819. }
  15820. function moveDownGridRow(grid) {
  15821. grid.rowMoveDown();
  15822. }
  15823. var SystemEventFu = /** @class */ (function () {
  15824. function SystemEventFu() {
  15825. }
  15826. SystemEventFu.prototype.moveUpGridRow = function () {
  15827. return function (sender) {
  15828. var grid1 = sender.up('yvgrid');
  15829. moveUpGridRow(grid1);
  15830. };
  15831. };
  15832. SystemEventFu.prototype.commitMe = function () {
  15833. return function (sender) {
  15834. commitMe(sender);
  15835. };
  15836. };
  15837. SystemEventFu.prototype.moveDownGridRow = function () {
  15838. return function (sender) {
  15839. var grid1 = sender.up('yvgrid');
  15840. moveDownGridRow(grid1);
  15841. };
  15842. };
  15843. SystemEventFu.prototype.saveGridRow = function () {
  15844. return function (sender) {
  15845. var grid1 = sender.up('yvgrid');
  15846. saveGridRow(grid1);
  15847. };
  15848. };
  15849. SystemEventFu.prototype.insertGridRow = function () {
  15850. return function (sender) {
  15851. var grid1 = sender.up('yvgrid');
  15852. insertGridRow(grid1);
  15853. };
  15854. };
  15855. SystemEventFu.prototype.removeGridRow = function () {
  15856. return function (sender) {
  15857. var grid1 = sender.up('yvgrid');
  15858. removeGridRow(grid1);
  15859. };
  15860. };
  15861. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15862. return function (sender, config) {
  15863. if (!config.listeners) {
  15864. config.listeners = {};
  15865. }
  15866. config.listeners.afterrender = function (sender) {
  15867. var scope = lookupScope(sender);
  15868. // $(sender.el.dom).on('keydown', (e) => {
  15869. // const xtype = Ext.fly(e.target).component.xtype
  15870. // if (xtype === 'textfield' && e.keyCode === 13) {
  15871. // Ext.defer(() => {
  15872. // raiseClick(scope.refs[btnReferenceName])
  15873. // })
  15874. // e.preventDefault()
  15875. // e.stopPropagation()
  15876. // return false
  15877. // }
  15878. // })
  15879. $(sender.el.dom).on('keyup', function (e) {
  15880. var tt = Ext.fly(e.target).component;
  15881. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15882. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15883. ![10, 13, 20, 40].includes(e.keyCode)) {
  15884. return;
  15885. }
  15886. e.preventDefault();
  15887. e.stopPropagation();
  15888. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15889. return;
  15890. });
  15891. };
  15892. };
  15893. };
  15894. SystemEventFu.prototype.confirm = function (text, fn) {
  15895. return function (sender) {
  15896. var scope = lookupScope(sender);
  15897. var msg = calcExpress(scope.viewModel.data, text);
  15898. confirm(msg, sender).then(function () {
  15899. fn.call(scope, sender);
  15900. });
  15901. };
  15902. };
  15903. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15904. return function (sender) {
  15905. var scope = lookupScope(sender);
  15906. var grid = scope.refs[gridRefName];
  15907. if (grid) {
  15908. var records = grid.getSelectionModel().getLastSelected();
  15909. grid.store.remove(records);
  15910. }
  15911. };
  15912. };
  15913. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15914. //可以是 scope.XX / system.XX / string / lookup表达式
  15915. writeTarget) {
  15916. return function (sender) {
  15917. if (!invokeUrl) {
  15918. return;
  15919. }
  15920. var scope = lookupScope(sender);
  15921. scope.setLoading(true);
  15922. var data = scope.viewModel.data;
  15923. if (invokeParam) {
  15924. data = calcObjectFlat(data, invokeParam);
  15925. }
  15926. invokeServer$1(invokeUrl, data).then(function (res) {
  15927. if (res.success) {
  15928. if (typeof writeTarget === "string") {
  15929. _$2.forOwn(res.data, function (v, k) {
  15930. scope.viewModel.set(writeTarget + "." + k, v);
  15931. });
  15932. }
  15933. else if (typeof writeTarget === 'function') {
  15934. writeTarget.call(scope, res.data);
  15935. }
  15936. else if (typeof writeTarget === 'object') {
  15937. var ret = calcObjectFlat(res.data, writeTarget);
  15938. _$2.forOwn(ret, function (v, k) {
  15939. scope.viewModel.set(k, v);
  15940. });
  15941. }
  15942. }
  15943. else {
  15944. showErrorDialog$1(res.msg || '未知错误', sender);
  15945. }
  15946. }).catch(function (e) {
  15947. var _a, _b;
  15948. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15949. showErrorDialog$1(msg || e.toString(), sender);
  15950. }).finally(function () {
  15951. scope.setLoading(false);
  15952. });
  15953. };
  15954. };
  15955. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15956. return function (sender) {
  15957. var scope = lookupScope(sender);
  15958. scope.setLoading(true);
  15959. var data = scope.viewModel.data;
  15960. if (arg0) {
  15961. data = calcObjectFlat(data, arg0);
  15962. }
  15963. invokeServer$1(groovyUrl, data).then(function (res) {
  15964. if (res.success) {
  15965. if (res.msg) {
  15966. msg(res.msg);
  15967. }
  15968. if (typeof successCallback === 'function') {
  15969. successCallback.call(scope, sender, res.data);
  15970. }
  15971. }
  15972. else {
  15973. showErrorDialog$1(res.msg || '未知错误', sender);
  15974. }
  15975. }).catch(function (e) {
  15976. var _a, _b;
  15977. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15978. showErrorDialog$1(msg || e.toString(), sender);
  15979. }).finally(function () {
  15980. scope.setLoading(false);
  15981. });
  15982. };
  15983. };
  15984. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15985. return function (sender) {
  15986. var scope = lookupScope(sender);
  15987. var form = scope.down('form');
  15988. if (form) {
  15989. // 如果下级有表单,就做表单校验
  15990. var valid = form.isValid();
  15991. if (!valid) {
  15992. return;
  15993. }
  15994. }
  15995. scope.setLoading(true);
  15996. var data = scope.viewModel.data;
  15997. if (arg0) {
  15998. data = calcObjectFlat(data, arg0);
  15999. }
  16000. invokeServer$1(groovyUrl, data).then(function (res) {
  16001. if (res.success) {
  16002. if (res.msg) {
  16003. msg(res.msg);
  16004. }
  16005. scope.dialogSuccess(res);
  16006. }
  16007. else {
  16008. showErrorDialog$1(res.msg || '未知错误', sender);
  16009. }
  16010. }).catch(function (e) {
  16011. var _a, _b;
  16012. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  16013. showErrorDialog$1(msg || e.toString(), sender);
  16014. }).finally(function () {
  16015. scope.setLoading(false);
  16016. });
  16017. };
  16018. };
  16019. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16020. return function (sender) {
  16021. var scope = lookupScope(sender);
  16022. if (lookupObject) {
  16023. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16024. }
  16025. else {
  16026. scope.dialogSuccess();
  16027. }
  16028. };
  16029. };
  16030. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16031. return function (sender) {
  16032. var scope = lookupScope(sender);
  16033. clearViewModelValues(scope.viewModel, propertyName);
  16034. };
  16035. };
  16036. SystemEventFu.prototype.getGrid = function (url) {
  16037. return function (sender, config) {
  16038. if (config.xtype == "combogridmulti") {
  16039. // @ts-ignore
  16040. require([url], function (grid) {
  16041. _$2.forOwn(grid.default, function (v, k) {
  16042. sender[k] = v;
  16043. sender.config[k] = v;
  16044. if (sender.rendered) {
  16045. // 已经渲染出来了,重新调用 reload 强制刷新
  16046. sender.reload();
  16047. }
  16048. });
  16049. });
  16050. }
  16051. else {
  16052. // @ts-ignore
  16053. require([url], function (grid) {
  16054. sender.grid = grid.default;
  16055. config.grid = grid.default;
  16056. });
  16057. }
  16058. };
  16059. };
  16060. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16061. return function (sender) {
  16062. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16063. };
  16064. };
  16065. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16066. return function (sender) {
  16067. var _a, _b;
  16068. var scope = lookupScope(sender);
  16069. if (!gridRefName) {
  16070. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16071. }
  16072. else {
  16073. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16074. }
  16075. };
  16076. };
  16077. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16078. return function (sender) {
  16079. var scope = lookupScope(sender);
  16080. var data = scope.viewModel.data;
  16081. var param = calcObjectFlat(data, lookupForData);
  16082. // @ts-ignore
  16083. require([url], function (module) {
  16084. var ScopeClass = module.default;
  16085. var scope = new ScopeClass();
  16086. scope.success = successCallback;
  16087. scope.showDialog(sender, {}, { data: param });
  16088. });
  16089. };
  16090. };
  16091. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16092. return function (sender, queryValue) {
  16093. showWidget(widgetUrl, lookup, sender, queryValue);
  16094. };
  16095. };
  16096. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16097. return function (sender) {
  16098. clearViewModelByLookup(sender, lookup);
  16099. };
  16100. };
  16101. SystemEventFu.prototype.closeMe = function (callBack) {
  16102. return function (sender) {
  16103. var scope = lookupScope(sender);
  16104. scope.close();
  16105. if (callBack) {
  16106. callBack.call(sender);
  16107. }
  16108. };
  16109. };
  16110. // 未完成
  16111. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16112. return function (sender) {
  16113. var scope = lookupScope(sender);
  16114. var data = scope.viewModel.data;
  16115. var billSetting = scope.billSetting;
  16116. var param = calcObjectFlat(data, lookupForData);
  16117. return new Promise(function (resolve, reject) {
  16118. var sf = function (scope) {
  16119. scope.success = function (dlgScope, dlgSender, reData) {
  16120. };
  16121. scope.showDialog(sender, {}, { data: param });
  16122. };
  16123. // @ts-ignore
  16124. require([url], function (module) {
  16125. // 业务描述文件
  16126. if (url.endsWith(".bill")) {
  16127. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16128. sf(scope);
  16129. });
  16130. }
  16131. else { //原生yvanui文件
  16132. var ScopeClass = module.default;
  16133. var scope_1 = new ScopeClass();
  16134. sf(scope_1);
  16135. }
  16136. });
  16137. });
  16138. };
  16139. };
  16140. __decorate([
  16141. Lib({
  16142. title: '为某个表格,上移行',
  16143. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16144. }),
  16145. __metadata("design:type", Function),
  16146. __metadata("design:paramtypes", []),
  16147. __metadata("design:returntype", void 0)
  16148. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16149. __decorate([
  16150. Lib({
  16151. title: '为某个表格,上移行',
  16152. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16153. }),
  16154. __metadata("design:type", Function),
  16155. __metadata("design:paramtypes", []),
  16156. __metadata("design:returntype", void 0)
  16157. ], SystemEventFu.prototype, "commitMe", null);
  16158. __decorate([
  16159. Lib({
  16160. title: '为某个表格,下移行',
  16161. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16162. }),
  16163. __metadata("design:type", Function),
  16164. __metadata("design:paramtypes", []),
  16165. __metadata("design:returntype", void 0)
  16166. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16167. __decorate([
  16168. Lib({
  16169. title: '为某个表格,批量保存至数据库',
  16170. author: '罗一帆',
  16171. createAt: '2022-07-19',
  16172. updateAt: '2022-07-19',
  16173. type: 'system',
  16174. category: '表格',
  16175. }),
  16176. __metadata("design:type", Function),
  16177. __metadata("design:paramtypes", []),
  16178. __metadata("design:returntype", void 0)
  16179. ], SystemEventFu.prototype, "saveGridRow", null);
  16180. __decorate([
  16181. Lib({
  16182. title: '为某个表格插入数据行',
  16183. author: '罗一帆',
  16184. createAt: '2022-07-19',
  16185. updateAt: '2022-07-19',
  16186. type: 'system',
  16187. category: '表格',
  16188. }),
  16189. __metadata("design:type", Function),
  16190. __metadata("design:paramtypes", []),
  16191. __metadata("design:returntype", void 0)
  16192. ], SystemEventFu.prototype, "insertGridRow", null);
  16193. __decorate([
  16194. Lib({
  16195. title: '为某个表格删除所选数据行',
  16196. author: '罗一帆',
  16197. createAt: '2022-07-19',
  16198. updateAt: '2022-07-19',
  16199. type: 'system',
  16200. category: '表格',
  16201. }),
  16202. __metadata("design:type", Function),
  16203. __metadata("design:paramtypes", []),
  16204. __metadata("design:returntype", void 0)
  16205. ], SystemEventFu.prototype, "removeGridRow", null);
  16206. __decorate([
  16207. Lib({
  16208. title: '按下回车键之后默认是否按下某个按钮',
  16209. author: '罗一帆',
  16210. createAt: '2021-07-02',
  16211. updateAt: '2021-07-02',
  16212. type: 'system',
  16213. category: '字典',
  16214. }),
  16215. __metadata("design:type", Function),
  16216. __metadata("design:paramtypes", [Object]),
  16217. __metadata("design:returntype", void 0)
  16218. ], SystemEventFu.prototype, "enterToClick", null);
  16219. __decorate([
  16220. Lib({
  16221. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16222. author: '罗一帆',
  16223. createAt: '2021-07-06',
  16224. updateAt: '2021-07-06',
  16225. type: 'system',
  16226. category: '对话框',
  16227. }),
  16228. __param(0, LibParam('对话框的确认文字', 'string')),
  16229. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16230. __metadata("design:type", Function),
  16231. __metadata("design:paramtypes", [Object, Object]),
  16232. __metadata("design:returntype", void 0)
  16233. ], SystemEventFu.prototype, "confirm", null);
  16234. __decorate([
  16235. Lib({
  16236. title: '删除表格当前的选中行(前端删除)',
  16237. author: '罗一帆',
  16238. createAt: '2021-07-08',
  16239. updateAt: '2021-07-08',
  16240. type: 'system',
  16241. category: '表格',
  16242. }),
  16243. __param(0, LibParam('表格引用名', 'refs')),
  16244. __metadata("design:type", Function),
  16245. __metadata("design:paramtypes", [Object]),
  16246. __metadata("design:returntype", void 0)
  16247. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16248. __decorate([
  16249. Lib({
  16250. title: '查询表单,如果 url 为空值,就取消查询',
  16251. author: '罗一帆',
  16252. createAt: '2021-07-06',
  16253. updateAt: '2021-07-06',
  16254. type: 'system',
  16255. category: '表单',
  16256. }),
  16257. __param(0, LibParam('后端服务路径', 'string')),
  16258. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16259. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16260. __metadata("design:type", Function),
  16261. __metadata("design:paramtypes", [String, Object, Object]),
  16262. __metadata("design:returntype", void 0)
  16263. ], SystemEventFu.prototype, "loadForm", null);
  16264. __decorate([
  16265. Lib({
  16266. title: '提交(不做校验、不关闭窗体)',
  16267. author: '罗一帆',
  16268. createAt: '2021-07-02',
  16269. updateAt: '2021-07-02',
  16270. type: 'system',
  16271. category: '表单',
  16272. }),
  16273. __param(0, LibParam('后端服务路径', 'string')),
  16274. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16275. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16276. __metadata("design:type", Function),
  16277. __metadata("design:paramtypes", [String, Object, Object]),
  16278. __metadata("design:returntype", void 0)
  16279. ], SystemEventFu.prototype, "commit", null);
  16280. __decorate([
  16281. Lib({
  16282. title: '提交表单',
  16283. author: '罗一帆',
  16284. createAt: '2021-07-02',
  16285. updateAt: '2021-07-02',
  16286. type: 'system',
  16287. category: '表单',
  16288. }),
  16289. __param(0, LibParam('后端服务路径', 'string')),
  16290. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16291. __metadata("design:type", Function),
  16292. __metadata("design:paramtypes", [String, Object]),
  16293. __metadata("design:returntype", void 0)
  16294. ], SystemEventFu.prototype, "formCommit", null);
  16295. __decorate([
  16296. Lib({
  16297. title: '对话框成功回调',
  16298. author: '罗一帆',
  16299. createAt: '2021-07-02',
  16300. updateAt: '2021-07-02',
  16301. type: 'system',
  16302. category: '对话框',
  16303. }),
  16304. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16305. __metadata("design:type", Function),
  16306. __metadata("design:paramtypes", [Object]),
  16307. __metadata("design:returntype", void 0)
  16308. ], SystemEventFu.prototype, "dialogSuccess", null);
  16309. __decorate([
  16310. Lib({
  16311. title: '清空 viewModel 某个属性',
  16312. author: '罗一帆',
  16313. createAt: '2021-07-02',
  16314. updateAt: '2021-07-02',
  16315. type: 'system',
  16316. category: '表单',
  16317. }),
  16318. __param(0, LibParam('属性路径', 'viewModel', true)),
  16319. __metadata("design:type", Function),
  16320. __metadata("design:paramtypes", [String]),
  16321. __metadata("design:returntype", void 0)
  16322. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16323. __decorate([
  16324. Lib({
  16325. title: '从其他资源获取表格设置',
  16326. author: '罗一帆',
  16327. createAt: '2021-07-02',
  16328. updateAt: '2021-07-02',
  16329. type: 'system',
  16330. category: '表单',
  16331. }),
  16332. __param(0, LibParam('定义文件', 'module')),
  16333. __metadata("design:type", Function),
  16334. __metadata("design:paramtypes", [Object]),
  16335. __metadata("design:returntype", void 0)
  16336. ], SystemEventFu.prototype, "getGrid", null);
  16337. __decorate([
  16338. Lib({
  16339. title: '清空 viewModel 某个属性,并刷新表格',
  16340. author: '罗一帆',
  16341. createAt: '2021-07-02',
  16342. updateAt: '2021-07-02',
  16343. type: 'system',
  16344. category: '表单',
  16345. }),
  16346. __param(0, LibParam('清空的属性', 'viewModel')),
  16347. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16348. __metadata("design:type", Function),
  16349. __metadata("design:paramtypes", [String, String]),
  16350. __metadata("design:returntype", void 0)
  16351. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16352. __decorate([
  16353. Lib({
  16354. title: '刷新表格',
  16355. author: '罗一帆',
  16356. createAt: '2021-07-02',
  16357. updateAt: '2021-07-02',
  16358. type: 'system',
  16359. category: '表单',
  16360. }),
  16361. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16362. __metadata("design:type", Function),
  16363. __metadata("design:paramtypes", [String]),
  16364. __metadata("design:returntype", void 0)
  16365. ], SystemEventFu.prototype, "reloadGrid", null);
  16366. __decorate([
  16367. Lib({
  16368. title: '显示对话框',
  16369. author: '罗一帆',
  16370. createAt: '2021-07-02',
  16371. updateAt: '2021-07-02',
  16372. type: 'system',
  16373. category: '对话框',
  16374. }),
  16375. __param(0, LibParam('业务模块名', 'module')),
  16376. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16377. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16378. __metadata("design:type", Function),
  16379. __metadata("design:paramtypes", [String, Object, Object]),
  16380. __metadata("design:returntype", void 0)
  16381. ], SystemEventFu.prototype, "showDialog", null);
  16382. __decorate([
  16383. Lib({
  16384. title: '弹出查找框(不借助 search)',
  16385. author: '罗一帆',
  16386. createAt: '2021-07-02',
  16387. updateAt: '2021-07-02',
  16388. type: 'system',
  16389. category: '对话框',
  16390. }),
  16391. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16392. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16393. __metadata("design:type", Function),
  16394. __metadata("design:paramtypes", [Object, Object]),
  16395. __metadata("design:returntype", void 0)
  16396. ], SystemEventFu.prototype, "showWidget", null);
  16397. __decorate([
  16398. Lib({
  16399. title: '根据 lookup 清空 viewModel',
  16400. author: '罗一帆',
  16401. createAt: '2021-07-05',
  16402. updateAt: '2021-07-05',
  16403. type: 'system',
  16404. category: '表单',
  16405. }),
  16406. __param(0, LibParam('设值表达式', 'lookup')),
  16407. __metadata("design:type", Function),
  16408. __metadata("design:paramtypes", [Object]),
  16409. __metadata("design:returntype", void 0)
  16410. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16411. __decorate([
  16412. Lib({
  16413. title: '关闭对话框',
  16414. author: '罗一帆',
  16415. createAt: '2021-07-05',
  16416. updateAt: '2021-07-05',
  16417. type: 'system',
  16418. category: '对话框',
  16419. }),
  16420. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16421. __metadata("design:type", Function),
  16422. __metadata("design:paramtypes", [Object]),
  16423. __metadata("design:returntype", void 0)
  16424. ], SystemEventFu.prototype, "closeMe", null);
  16425. __decorate([
  16426. Lib({
  16427. title: '打开对话框并返回数据',
  16428. author: '余亮',
  16429. createAt: '2022-07-07',
  16430. updateAt: '2022-07-07',
  16431. type: 'system',
  16432. category: '对话框',
  16433. }),
  16434. __param(0, LibParam('业务模块名', 'module')),
  16435. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16436. __param(2, LibParam('结果映射关系', 'string', true)),
  16437. __metadata("design:type", Function),
  16438. __metadata("design:paramtypes", [String, Object, Object]),
  16439. __metadata("design:returntype", void 0)
  16440. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16441. return SystemEventFu;
  16442. }());
  16443. /**
  16444. * 清空 viewmodel 里下属的所有属性
  16445. * @param viewModel VM对象
  16446. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16447. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16448. */
  16449. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16450. var data = viewModel.data;
  16451. if (propertyKey) {
  16452. data = _$2.get(data, propertyKey);
  16453. }
  16454. _$2.forOwn(data, function (value, key) {
  16455. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16456. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16457. return;
  16458. }
  16459. viewModel.set(targetKey, '');
  16460. });
  16461. }
  16462. function clearViewModelByLookup(sender, lookup) {
  16463. if (_$2.isPlainObject(lookup)) {
  16464. var parentScope_1 = lookupScope(sender);
  16465. _$2.forOwn(lookup, function (value, key) {
  16466. if (SIMPLE_RE.test(value)) {
  16467. // '{foo}' 简单表达式
  16468. var path = value.substring(1, value.length - 1);
  16469. if (path !== 'queryValue') {
  16470. parentScope_1.viewModel.set(path, '');
  16471. }
  16472. }
  16473. });
  16474. }
  16475. }
  16476. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16477. if (vjson === void 0) { vjson = {}; }
  16478. var parentScope = lookupScope(sender);
  16479. var me = sender;
  16480. // @ts-ignore
  16481. require([widgetUrl], function (widgetScope) {
  16482. var WidgetScopeClass = widgetScope.default;
  16483. widgetScope = new WidgetScopeClass();
  16484. // 传递进 widget.model 的数据
  16485. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16486. widgetScope.parentScope = parentScope;
  16487. widgetScope.searchWidgetSuccess = function (data) {
  16488. if (typeof lookup === 'string') {
  16489. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16490. me.setValue(data[lookup]);
  16491. return;
  16492. }
  16493. /**
  16494. * lookup: {
  16495. * // 扩展到 viewModel 的值做更改
  16496. * WH_CODE: "{queryValue}",
  16497. * WH_NAME: "{query.WH_NAME}",
  16498. * }
  16499. */
  16500. if (_$2.isPlainObject(lookup)) {
  16501. var parentScope_2 = lookupScope(sender);
  16502. tryWriteObject(lookup, data, function (path, value) {
  16503. if (path === 'queryValue') {
  16504. me.setValue(value);
  16505. }
  16506. else {
  16507. parentScope_2.viewModel.set(path, value);
  16508. }
  16509. });
  16510. }
  16511. return true;
  16512. };
  16513. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16514. });
  16515. }
  16516. /**
  16517. * 停止事件的默认行为
  16518. * @param e
  16519. */
  16520. function stopEvent(e) {
  16521. e.preventDefault();
  16522. e.stopPropagation();
  16523. // @ts-ignore
  16524. window.event.cancelBubble = true;
  16525. e.returnValue = false;
  16526. e.cancelBubble = true;
  16527. }
  16528. /**
  16529. * 屏幕中央显示一个黑框提示
  16530. */
  16531. function msg$1(content) {
  16532. msg(content);
  16533. }
  16534. /**
  16535. * 错误对话框的强提醒
  16536. */
  16537. function showErrorDialog$1(msg, sender) {
  16538. showErrorDialog(msg, sender);
  16539. }
  16540. /**
  16541. * 错误对话框的强提醒
  16542. */
  16543. function showInfoDialog(msg, sender) {
  16544. showInfoDialogSimple(msg, sender);
  16545. }
  16546. /**
  16547. * 错误对话框的强提醒
  16548. */
  16549. function prompt$2(message, defaultValue, multiLine) {
  16550. if (defaultValue === void 0) { defaultValue = ""; }
  16551. if (multiLine === void 0) { multiLine = false; }
  16552. return prompt$1(message, defaultValue, multiLine);
  16553. }
  16554. /**
  16555. * 用于计算 express 表达式
  16556. */
  16557. function evalFunction(data, express) {
  16558. var keys = [];
  16559. var values = [];
  16560. _$2.forOwn(data, function (value, key) {
  16561. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16562. if (match) {
  16563. key = key.substring(0, match.index);
  16564. }
  16565. keys.push(key);
  16566. values.push(value);
  16567. });
  16568. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16569. try {
  16570. return func.apply(void 0, __spread(values));
  16571. }
  16572. catch (e) {
  16573. return;
  16574. }
  16575. }
  16576. /**
  16577. * 获取表格编辑的行数据
  16578. */
  16579. function getGridEditRows(grid) {
  16580. return grid.getGridEditRows();
  16581. }
  16582. //# sourceMappingURL=systemLib.js.map
  16583. var SystemLib = /*#__PURE__*/Object.freeze({
  16584. __proto__: null,
  16585. SIMPLE_RE: SIMPLE_RE,
  16586. pinyinMatch: pinyinMatch,
  16587. calcExpress: calcExpress,
  16588. calcObjectFlat: calcObjectFlat,
  16589. mergeViewModel: mergeViewModel,
  16590. flatRow: flatRow,
  16591. replaceNA: replaceNA,
  16592. deepTravJson: deepTravJson,
  16593. tryWriteByExpress: tryWriteByExpress,
  16594. tryWriteObject: tryWriteObject,
  16595. tryVarSimple: tryVarSimple,
  16596. calcObject: calcObject,
  16597. getParentGrid: getParentGrid,
  16598. tryEnable: tryEnable,
  16599. setComboStore: setComboStore,
  16600. invokeServer: invokeServer$1,
  16601. clearViewModelValues: clearViewModelValues,
  16602. reloadGrid: reloadGrid,
  16603. toPlainObject: toPlainObject,
  16604. confirm: confirm,
  16605. normId: normId,
  16606. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16607. saveGridRow: saveGridRow,
  16608. insertGridRow: insertGridRow,
  16609. commitMe: commitMe,
  16610. removeGridRow: removeGridRow,
  16611. moveUpGridRow: moveUpGridRow,
  16612. moveDownGridRow: moveDownGridRow,
  16613. SystemEventFu: SystemEventFu,
  16614. clearViewModel: clearViewModel,
  16615. clearViewModelByLookup: clearViewModelByLookup,
  16616. showWidget: showWidget,
  16617. stopEvent: stopEvent,
  16618. msg: msg$1,
  16619. showErrorDialog: showErrorDialog$1,
  16620. showInfoDialog: showInfoDialog,
  16621. prompt: prompt$2,
  16622. evalFunction: evalFunction,
  16623. getGridEditRows: getGridEditRows
  16624. });
  16625. function initTree () {
  16626. Ext.define('Yvan.Tree', {
  16627. extend: 'Ext.tree.Panel',
  16628. alias: 'widget.yvtree',
  16629. xtype: 'yvtree',
  16630. constructor: function (config) {
  16631. var newConfig = _$2.defaultsDeep({
  16632. // 强制性属性
  16633. }, baseConfig(config, 'row-item'), config, tree);
  16634. _$2.assign(newConfig, {
  16635. tbar: [
  16636. {
  16637. xtype: 'textfield',
  16638. // triggerCls: 'x-form-clear-trigger',
  16639. flex: 1,
  16640. emptyText: '搜索过滤',
  16641. enableKeyEvents: true,
  16642. listeners: {
  16643. change: function (sender) {
  16644. var tree = sender.up("treepanel");
  16645. tree.filterByText(this.getRawValue());
  16646. },
  16647. keyup: function (sender, e) {
  16648. var tree = sender.up("treepanel");
  16649. if (e.ESC === e.getKey()) {
  16650. sender.setValue('');
  16651. tree.filterByText('');
  16652. }
  16653. }
  16654. }
  16655. },
  16656. ],
  16657. });
  16658. if (!newConfig.hideRefresh) {
  16659. newConfig.tbar.push({
  16660. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16661. listeners: {
  16662. click: function (sender) {
  16663. var scope = sender.up("yvtree");
  16664. scope.reload();
  16665. }
  16666. }
  16667. });
  16668. }
  16669. if (!newConfig.hideExpand) {
  16670. newConfig.tbar.push({
  16671. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16672. listeners: {
  16673. click: function (sender) {
  16674. var scope = sender.up("yvtree");
  16675. scope.expandAll();
  16676. }
  16677. }
  16678. });
  16679. }
  16680. if (!newConfig.hideCollapse) {
  16681. newConfig.tbar.push({
  16682. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16683. listeners: {
  16684. click: function (sender) {
  16685. var scope = sender.up("yvtree");
  16686. scope.collapseAll();
  16687. }
  16688. }
  16689. });
  16690. }
  16691. this.superclass.constructor.call(this, newConfig);
  16692. },
  16693. /**
  16694. * 在根节点上增加一个节点,会触发 addNode 事件
  16695. * @param props
  16696. */
  16697. addRoot: function (props) {
  16698. var me = this;
  16699. var tableNode = me.getRootNode();
  16700. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16701. if (_$2.isFunction(props)) {
  16702. props = props.call(this, parent);
  16703. }
  16704. _$2.forOwn(props, function (value, key) {
  16705. fieldNode.set(key, value);
  16706. });
  16707. var node = tableNode.appendChild(fieldNode);
  16708. me.ensureVisible(node);
  16709. me.setSelection(node);
  16710. me.fireEvent('addNode', me, {
  16711. parent: tableNode,
  16712. node: node,
  16713. });
  16714. },
  16715. addLast: function (props) {
  16716. var me = this;
  16717. var sel = me.selModel.getSelection();
  16718. if (!sel || sel.length <= 0) {
  16719. msg('请选择一个要添加的同级节点路径');
  16720. return;
  16721. }
  16722. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16723. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16724. if (_$2.isFunction(props)) {
  16725. props = props.call(this, parent);
  16726. }
  16727. _$2.forOwn(props, function (value, key) {
  16728. fieldNode.set(key, value);
  16729. });
  16730. var node = parent.appendChild(fieldNode);
  16731. me.ensureVisible(node);
  16732. me.setSelection(node);
  16733. me.fireEvent('addNode', me, {
  16734. parent: parent,
  16735. node: node,
  16736. });
  16737. },
  16738. addChildren: function (props) {
  16739. var me = this;
  16740. var sel = me.selModel.getSelection();
  16741. if (!sel || sel.length <= 0) {
  16742. msg('请选择一个要添加子节点的路径');
  16743. return;
  16744. }
  16745. var parent = sel[0];
  16746. if (_$2.isFunction(props)) {
  16747. props = props.call(this, parent);
  16748. }
  16749. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16750. _$2.forOwn(props, function (value, key) {
  16751. fieldNode.set(key, value);
  16752. });
  16753. var node = parent.appendChild(fieldNode);
  16754. parent.expand();
  16755. me.ensureVisible(node);
  16756. me.setSelection(node);
  16757. me.fireEvent('addNode', me, {
  16758. parent: parent,
  16759. node: node,
  16760. });
  16761. },
  16762. initComponent: function () {
  16763. var me = this;
  16764. var config = me.config;
  16765. var scope = lookupScope(this);
  16766. if (!isDesignMode(scope, config)) {
  16767. // 转换 dataSource 属性
  16768. convertDataSource(me, scope, config);
  16769. }
  16770. this.superclass.initComponent.call(this);
  16771. this.on({
  16772. afterrender: function (sender) {
  16773. var me = this;
  16774. var config = this.config;
  16775. var dataSource = config.dataSource;
  16776. if (config.autoLoad) {
  16777. if (config.dataSourceCallbackFn) {
  16778. me.reload();
  16779. }
  16780. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16781. me.reload();
  16782. }
  16783. }
  16784. }
  16785. });
  16786. },
  16787. _setDataReal: function (value) {
  16788. var me = this;
  16789. // me.setStore(new Ext.data.TreeStore({
  16790. // root: {
  16791. // expanded: true,
  16792. // // children: value
  16793. // children: [
  16794. // {
  16795. // id: '1', text: 'A',
  16796. // children: [
  16797. // {id: '1', text: 'A',},
  16798. // {id: '2', text: 'B'},
  16799. // ]
  16800. // },
  16801. // {id: '2', text: 'B'},
  16802. // ]
  16803. // }
  16804. // }))
  16805. me.store.setRoot({
  16806. expanded: true,
  16807. children: value
  16808. });
  16809. // me.store = new Ext.data.TreeStore({
  16810. // root: {
  16811. // expanded: true,
  16812. // // children: value
  16813. // children: [
  16814. // {
  16815. // id: '1', text: 'A',
  16816. // children: [
  16817. // {id: '1', text: 'A',},
  16818. // {id: '2', text: 'B'},
  16819. // ]
  16820. // },
  16821. // {id: '2', text: 'B'},
  16822. // ]
  16823. // }
  16824. // })
  16825. },
  16826. /**
  16827. * 重新载入数据(重新计算参数)
  16828. */
  16829. reload: function (reloadParams) {
  16830. if (reloadParams === void 0) { reloadParams = {}; }
  16831. var me = this;
  16832. var config = me.config;
  16833. if (config.dataSourceCallbackFn) {
  16834. // 函数请求刷新
  16835. var scope_1 = lookupScope(this);
  16836. // me.setLoading(true)
  16837. config.dataSourceCallbackFn.call(scope_1, me, {
  16838. successCallback: function (value) {
  16839. me._setDataReal(value);
  16840. // me.setLoading(false)
  16841. me.fireEvent('dataLoadComplete', me, true, value);
  16842. },
  16843. failCallback: function (error) {
  16844. // me.setLoading(false)
  16845. me.fireEvent('dataLoadComplete', me, false, error);
  16846. }
  16847. });
  16848. return;
  16849. }
  16850. var scope = lookupScope(me);
  16851. var dataSource = config.dataSource;
  16852. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16853. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16854. me.setLoading(true);
  16855. invokeServer$1(dataSource.url, params)
  16856. .then(function (res) {
  16857. me._setDataReal(res.data);
  16858. me.fireEvent('dataLoadComplete', me, res);
  16859. })
  16860. .finally(function () {
  16861. me.setLoading(false);
  16862. });
  16863. }
  16864. },
  16865. filterByText: function (text) {
  16866. this._filterText = text;
  16867. this._filterBy(this, text, 'text');
  16868. },
  16869. _filterBy: _$2.debounce(function (me, text, by) {
  16870. var view = me.getView();
  16871. me.store.clearFilter();
  16872. if (!me._filterText) {
  16873. // 没有筛选内容,还原状态
  16874. var selections = me.getSelection();
  16875. var selectionPaths_1 = [];
  16876. _$2.forEach(me.getSelection(), function (item) {
  16877. selectionPaths_1.push(item.getPath());
  16878. });
  16879. me.collapseAll();
  16880. _$2.forEach(selectionPaths_1, function (path) {
  16881. me.expandPath(path);
  16882. });
  16883. me.setSelection(selections);
  16884. return;
  16885. }
  16886. // 递归查找所有需要可见的节点 id 数组
  16887. var nodesAndParents = [];
  16888. var expandPaths = [];
  16889. me.getRootNode().cascadeBy(function (tree, view) {
  16890. var currNode = this;
  16891. currNode.collapse();
  16892. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16893. // 展开到匹配的路径
  16894. // me.expandPath(currNode.getPath());
  16895. expandPaths.push(currNode.getPath());
  16896. // 沿途父节点全部设定为可见
  16897. while (currNode.parentNode) {
  16898. nodesAndParents.push(currNode.id);
  16899. currNode = currNode.parentNode;
  16900. }
  16901. }
  16902. }, null, [me, view]);
  16903. me.store.filterBy(function (r) {
  16904. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16905. });
  16906. _$2.forEach(expandPaths, function (path) {
  16907. me.expandPath(path);
  16908. });
  16909. }, 1000),
  16910. });
  16911. }
  16912. function convertDataSource(sender, scope, newConfig) {
  16913. if (typeof newConfig.store !== 'undefined') {
  16914. // 有 store 属性的情况下,不做任何事
  16915. return;
  16916. }
  16917. if (typeof newConfig.dataSource === 'undefined') {
  16918. // 没有定义 dataSource 的情况下,不做任何事
  16919. return;
  16920. }
  16921. var dataSource = newConfig.dataSource;
  16922. if (typeof dataSource === 'string') {
  16923. // dataSource 是字符串的情况下,找到成员函数
  16924. dataSource = lookupFn(scope, dataSource);
  16925. }
  16926. if (typeof dataSource === 'function') {
  16927. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16928. newConfig.store = new Ext.data.TreeStore({
  16929. root: {
  16930. expanded: true,
  16931. children: []
  16932. }
  16933. });
  16934. newConfig.dataSourceCallbackFn = dataSource;
  16935. return;
  16936. }
  16937. // throw new TypeError('无法识别的调用方法')
  16938. }
  16939. //# sourceMappingURL=yvtree.js.map
  16940. /**
  16941. * 构建一个 grid 支持的 dataSource
  16942. */
  16943. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16944. if (reloadParams === void 0) { reloadParams = {}; }
  16945. if (isExcelExport === void 0) { isExcelExport = false; }
  16946. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16947. var _a;
  16948. var me = grid;
  16949. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16950. var storeOption = {};
  16951. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16952. if (dataSource.sqlId) {
  16953. dataSource.method = 'invoke';
  16954. dataSource.url = '/Dev@executeSQL';
  16955. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16956. // sqlId 是 @ 开头,代表直接带中文名
  16957. var scope_1 = lookupScope(grid);
  16958. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16959. params.sqlId = dataSource.sqlId.substring(1);
  16960. }
  16961. else {
  16962. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16963. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16964. params.path = path;
  16965. params.sqlId = sqlId;
  16966. }
  16967. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16968. }
  16969. var fields_1 = [];
  16970. _$2.forEach(grid.columns, function (col) {
  16971. var c = {};
  16972. if (col.dataIndex) {
  16973. c.name = col.dataIndex;
  16974. fields_1.push(c);
  16975. }
  16976. if (col.dataType) {
  16977. c.type = col.dataType;
  16978. }
  16979. });
  16980. // 默认支持 gridInvoke
  16981. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16982. //@ts-ignore
  16983. storeOption = {
  16984. fields: fields_1,
  16985. remoteSort: config.remoteSort,
  16986. remoteFilter: config.remoteFilter,
  16987. autoLoad: true,
  16988. pageSize: me.store.pageSize || config.pageSize,
  16989. proxy: {
  16990. type: 'jsonAjax',
  16991. $owner: me,
  16992. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16993. extraParams: extraParams,
  16994. reader: {
  16995. type: 'json',
  16996. rootProperty: 'data',
  16997. totalProperty: 'pagination.total',
  16998. successProperty: 'success',
  16999. messageProperty: 'msg',
  17000. transform: function (data) {
  17001. if (typeof window['ajaxProcess'] === 'function') {
  17002. window['ajaxProcess'](data);
  17003. }
  17004. if (typeof window['apiTranslate'] === 'function') {
  17005. window['apiTranslate'](data, dataSource.url);
  17006. }
  17007. if (typeof grid._transform === 'function') {
  17008. // 系统转换函数
  17009. grid._transform(data.data);
  17010. }
  17011. if (grid.dataTransform) {
  17012. if (typeof grid.dataTransform === 'string') {
  17013. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17014. }
  17015. return grid.dataTransform.call(scope, grid, data);
  17016. }
  17017. return data;
  17018. }
  17019. }
  17020. },
  17021. listeners: {
  17022. load: function (store, records, successful, operation) {
  17023. var _a, _b, _c;
  17024. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17025. if (rep.pagination) {
  17026. grid.dbInfo = rep.pagination.dbInfo;
  17027. grid.exportDataSql = rep.pagination.exportDataSql;
  17028. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17029. }
  17030. 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;
  17031. if (isExcelExport) {
  17032. if (typeof excelExportCallBack === 'function') {
  17033. excelExportCallBack(rep);
  17034. }
  17035. else if (excelExportCallBack) {
  17036. console.error("导出回调方法错误!");
  17037. }
  17038. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17039. }
  17040. else {
  17041. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17042. // 自动选中第一行
  17043. var data = grid.getStore().data;
  17044. if (data.length > 0) {
  17045. grid.setSelection(data.items[0]);
  17046. }
  17047. }
  17048. me.fireEvent('dataLoadComplete', me, successful, records);
  17049. }
  17050. }
  17051. }
  17052. };
  17053. }
  17054. else if (exports.apiConvert) {
  17055. // 外部扩展的 apiConvert
  17056. //@ts-ignore
  17057. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17058. }
  17059. else {
  17060. throw new TypeError("不支持的 API 请求方式");
  17061. }
  17062. if (isExcelExport) {
  17063. var excelStore = new Ext.data.Store(storeOption);
  17064. excelStore.load();
  17065. }
  17066. else {
  17067. if (me.groupField) {
  17068. console.log('groupField', storeOption.groupField);
  17069. storeOption.groupField = me.groupField;
  17070. }
  17071. me.setStore(new Ext.data.Store(storeOption));
  17072. }
  17073. }
  17074. function initStores () {
  17075. Ext.define('Yvan.JsonAjaxProxy', {
  17076. extend: 'Ext.data.proxy.Ajax',
  17077. alias: 'proxy.jsonAjax',
  17078. actionMethods: {
  17079. create: "POST",
  17080. read: "POST",
  17081. update: "POST",
  17082. destroy: "POST"
  17083. },
  17084. timeout: storeAjax.timeout,
  17085. buildRequest: function (operation) {
  17086. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17087. var me = this;
  17088. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17089. var scope = lookupScope($owner);
  17090. var gridParam = me.getParams(operation);
  17091. var customParam = {};
  17092. // 提取 srot 元素
  17093. if (gridParam.sort) {
  17094. var sort = JSON.parse(gridParam.sort);
  17095. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17096. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17097. customParam.sortModel = [];
  17098. _$2.forEach(sort, function (s) {
  17099. customParam.sortModel.push({
  17100. colId: s.property,
  17101. sort: _$2.toLower(s.direction)
  17102. });
  17103. });
  17104. delete gridParam.sort;
  17105. }
  17106. // 提取筛选元素
  17107. if (gridParam.filter) {
  17108. var filter = JSON.parse(gridParam.filter);
  17109. console.log('gridParam.filter', gridParam.filter);
  17110. // "[{"operator":"like","value":"1","property":"id"}]"
  17111. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17112. customParam.filterModel = {};
  17113. _$2.forEach(filter, function (s) {
  17114. var newFilterItem = {};
  17115. if (s.operator === 'like') {
  17116. newFilterItem.filterType = 'text';
  17117. newFilterItem.type = 'contains';
  17118. newFilterItem.filter = s.value;
  17119. }
  17120. else {
  17121. // 无法识别的筛选类型
  17122. newFilterItem.filterType = 'dict';
  17123. newFilterItem.type = 'in';
  17124. newFilterItem.filter = s.value;
  17125. }
  17126. customParam.filterModel[s.property] = newFilterItem;
  17127. });
  17128. delete gridParam.filter;
  17129. }
  17130. // 被 grid.constructor 作为方法存在
  17131. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17132. var params = _$2.defaultsDeep(gridParam, extraParams);
  17133. // var request = this.superclass.buildRequest.apply(this, arguments);
  17134. var request = new Ext.data.Request({
  17135. params: {},
  17136. action: operation.getAction(),
  17137. records: operation.getRecords(),
  17138. url: me.buildUrl(),
  17139. jsonData: __assign({ args: [
  17140. params
  17141. ] }, customParam),
  17142. proxy: me
  17143. });
  17144. operation.setRequest(request);
  17145. return request;
  17146. },
  17147. afterRequest: function (req, res) {
  17148. // Extend.afterExtRequest(req, res)
  17149. }
  17150. });
  17151. Ext.define('Ext.ux.data.MyReader', {
  17152. extend: 'Ext.data.reader.Json',
  17153. xtype: 'yvgridreader',
  17154. useSimpleAccessors: false,
  17155. });
  17156. }
  17157. //# sourceMappingURL=stores.js.map
  17158. function initBehaviorEdit(config) {
  17159. var _a, _b, _c;
  17160. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17161. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17162. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17163. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17164. if (dbTableName) {
  17165. // 生成增删查改
  17166. var tbar = [
  17167. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17168. click: 'system.saveGridRow()'
  17169. }, bind: {
  17170. disabled: '{!' + config.reference + '.ischanged}'
  17171. } }, saveButtonConfig),
  17172. '-',
  17173. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17174. click: 'system.insertGridRow()'
  17175. } }, addButtonConfig),
  17176. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17177. click: 'system.removeGridRow()'
  17178. } }, deleteButtonConfig),
  17179. ];
  17180. if (_$2.isArray(config.tbar)) {
  17181. config.tbar = __spread(tbar, [
  17182. '-'
  17183. ], config.tbar);
  17184. }
  17185. else if (_$2.isPlainObject(config.tbar)) {
  17186. config.tbar = {
  17187. border: false,
  17188. layout: {
  17189. type: 'vbox',
  17190. align: 'stretch'
  17191. },
  17192. items: [
  17193. {
  17194. xtype: 'toolbar',
  17195. border: false,
  17196. items: tbar
  17197. },
  17198. config.tbar,
  17199. ]
  17200. };
  17201. }
  17202. else if (_$2.isUndefined(config.tbar)) {
  17203. config.tbar = tbar;
  17204. }
  17205. else {
  17206. console.error("can't build tbar property!", config.tbar);
  17207. }
  17208. }
  17209. }
  17210. //# sourceMappingURL=grid_behavior.js.map
  17211. function initGridDialog(config) {
  17212. var detailDialog = _$2.get(config, 'detailDialog');
  17213. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17214. if (_$2.isPlainObject(detailDialog)) {
  17215. var tbar = [
  17216. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17217. click: 'system.showGridRowDetail()',
  17218. }, bind: {
  17219. disabled: '{!' + config.reference + '.selection}'
  17220. } }, detailButtonConfig)
  17221. ];
  17222. if (_$2.isArray(config.tbar)) {
  17223. config.tbar = __spread(config.tbar, [
  17224. '-'
  17225. ], tbar);
  17226. }
  17227. else if (_$2.isPlainObject(config.tbar)) {
  17228. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17229. config.tbar.items = __spread(config.tbar.items);
  17230. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17231. if (!toolbar) {
  17232. config.tbar.items = __spread(config.tbar.items, [
  17233. {
  17234. xtype: 'toolbar',
  17235. border: false,
  17236. items: tbar
  17237. },
  17238. ]);
  17239. }
  17240. else {
  17241. toolbar.items = __spread(toolbar.items, [
  17242. '-'
  17243. ], tbar);
  17244. }
  17245. }
  17246. else {
  17247. config.tbar = {
  17248. border: false,
  17249. layout: {
  17250. type: 'vbox',
  17251. align: 'stretch'
  17252. },
  17253. items: [
  17254. {
  17255. xtype: 'toolbar',
  17256. border: false,
  17257. items: tbar
  17258. },
  17259. config.tbar,
  17260. ]
  17261. };
  17262. }
  17263. }
  17264. else if (_$2.isUndefined(config.tbar)) {
  17265. config.tbar = tbar;
  17266. }
  17267. else {
  17268. console.error("can't build tbar property!", config.tbar);
  17269. }
  17270. }
  17271. }
  17272. var SystemEventFu$1 = /** @class */ (function () {
  17273. function SystemEventFu() {
  17274. }
  17275. SystemEventFu.prototype.showGridRowDetail = function () {
  17276. return function (sender) {
  17277. var grid1 = sender.up('yvgrid');
  17278. showGridRowDetail(grid1);
  17279. };
  17280. };
  17281. __decorate([
  17282. Lib({
  17283. title: '为某个表格所选数据行, 显示其对话框',
  17284. author: '罗一帆',
  17285. createAt: '2022-07-27',
  17286. updateAt: '2022-07-27',
  17287. type: 'system',
  17288. category: '表格',
  17289. }),
  17290. __metadata("design:type", Function),
  17291. __metadata("design:paramtypes", []),
  17292. __metadata("design:returntype", void 0)
  17293. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17294. return SystemEventFu;
  17295. }());
  17296. function showGridRowDetail(grid1, isEdit) {
  17297. if (isEdit === void 0) { isEdit = true; }
  17298. var _a, _b, _c;
  17299. if (!grid1.selection) {
  17300. msg$1('请选中要展示的数据行!');
  17301. return;
  17302. }
  17303. var record = grid1.selection;
  17304. if (_$2.isArray(record)) {
  17305. record = record[0];
  17306. }
  17307. if (!record) {
  17308. msg$1('请选中要展示的数据行!');
  17309. return;
  17310. }
  17311. var config = grid1._originVJson;
  17312. var detailDialog = config.detailDialog;
  17313. var vjson = {};
  17314. var parentScope = lookupScope(grid1);
  17315. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17316. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17317. _$2.defaultsDeep(vjson, {
  17318. // 强制属性
  17319. layout: 'fit',
  17320. __custom_path: __custom_path,
  17321. __custom_version: __custom_version,
  17322. fbar: __spread([
  17323. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17324. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17325. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17326. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17327. }, detailDialog, {
  17328. // 默认属性
  17329. width: 800,
  17330. height: 450,
  17331. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17332. });
  17333. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17334. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17335. vjson.items.push(tabpanel);
  17336. if (tabpanel) {
  17337. // 有多个选项卡,按每个选项卡进行过滤
  17338. _$2.forEach(tabpanel.items, function (tab) {
  17339. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17340. if (tabColumns.length > 0) {
  17341. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17342. _$2.extend(tab, tabVjson);
  17343. }
  17344. });
  17345. }
  17346. }
  17347. else {
  17348. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17349. }
  17350. var model = {
  17351. data: {
  17352. _edit: isEdit,
  17353. _editType: isEdit ? '编辑' : '添加',
  17354. }
  17355. };
  17356. _$2.forOwn(record.data, function (value, key) {
  17357. if (key === 'id') {
  17358. // 忽略 ID 属性
  17359. return;
  17360. }
  17361. if (_$2.startsWith(key, '_')) {
  17362. // 忽略 _ 开头的所有属性
  17363. return;
  17364. }
  17365. model.data[key] = value;
  17366. });
  17367. console.log(vjson);
  17368. var scope = new Scope({ vjson: vjson, model: model, });
  17369. //@ts-ignore
  17370. scope.commit = function () {
  17371. return new Promise(function (resolve) {
  17372. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17373. if (_$2.startsWith(key, '_')) {
  17374. // _origin 等属性可以被忽略
  17375. return;
  17376. }
  17377. if (key === 'id') {
  17378. // id 属性被忽略
  17379. return;
  17380. }
  17381. record.set(key, value);
  17382. });
  17383. resolve();
  17384. });
  17385. };
  17386. scope.showDialog(grid1, {}, {});
  17387. }
  17388. function buildForm(columns, tabpanel, detailDialog) {
  17389. var vjson = __assign({ border: false, layout: {
  17390. type: 'vbox',
  17391. pack: 'start',
  17392. align: 'stretch'
  17393. }, defaults: {
  17394. border: false,
  17395. anchor: '100%',
  17396. margin: '5',
  17397. }, scrollable: true, items: [] }, detailDialog.form);
  17398. var emptyFieldset = [];
  17399. var fieldsetList = [];
  17400. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17401. _$2.forEach(columns, function (c) {
  17402. var fieldset = _$2.get(c, 'form.fieldset');
  17403. if (fieldset) {
  17404. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17405. if (idx < 0) {
  17406. fieldsetList.push({
  17407. fieldset: fieldset,
  17408. columns: [c]
  17409. });
  17410. }
  17411. else {
  17412. fieldsetList[idx].columns.push(c);
  17413. }
  17414. }
  17415. else {
  17416. emptyFieldset.push(c);
  17417. }
  17418. });
  17419. _$2.forEach(fieldsetList, function (fs) {
  17420. var fieldSetVjson = {
  17421. xtype: 'fieldset',
  17422. title: fs.fieldset,
  17423. items: []
  17424. };
  17425. buildFieldItems(fieldSetVjson.items, fs.columns);
  17426. vjson.items.push(fieldSetVjson);
  17427. });
  17428. buildFieldItems(vjson.items, emptyFieldset);
  17429. return vjson;
  17430. }
  17431. // 构建字段组
  17432. function buildFieldItems(items, columns) {
  17433. var _a, _b, _c, _d, _e;
  17434. var row = {
  17435. xtype: 'cols',
  17436. items: []
  17437. };
  17438. for (var i = 0; i < columns.length; i++) {
  17439. var column = columns[i];
  17440. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17441. delete row.xtype;
  17442. row.layout = column.form.rowlayout;
  17443. }
  17444. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17445. row.items.push({ border: false, flex: column.form.prefix });
  17446. }
  17447. var fieldVjson = buildField(column, row.items.length);
  17448. if (!fieldVjson) {
  17449. continue;
  17450. }
  17451. row.items.push(fieldVjson);
  17452. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17453. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17454. }
  17455. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17456. items.push(row);
  17457. row = {
  17458. xtype: 'cols',
  17459. items: []
  17460. };
  17461. }
  17462. }
  17463. if (row.items.length > 0) {
  17464. items.push(row);
  17465. }
  17466. }
  17467. // 构建字段
  17468. function buildField(column, colIdx) {
  17469. var ret;
  17470. if (column.xtype === 'checkcolumn') {
  17471. ret = _$2.defaultsDeep({
  17472. xtype: 'checkbox',
  17473. uncheckedValue: column.uncheckedValue,
  17474. checkedValue: column.checkedValue,
  17475. boxLabel: column.header,
  17476. bind: {
  17477. value: '{' + column.dataIndex + '}'
  17478. }
  17479. }, column.form);
  17480. if (colIdx == 0) {
  17481. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17482. ret.margin = '0 0 0 85';
  17483. }
  17484. }
  17485. else {
  17486. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17487. fieldLabel: column.header,
  17488. bind: {
  17489. value: '{' + column.dataIndex + '}'
  17490. },
  17491. });
  17492. }
  17493. if (!ret.xtype) {
  17494. return;
  17495. }
  17496. if (!ret.dict && ret.xtype === 'combo') {
  17497. ret.dict = column.dict;
  17498. }
  17499. // 删除辅助属性
  17500. delete ret.order;
  17501. delete ret.wrap;
  17502. return ret;
  17503. }
  17504. //# sourceMappingURL=grid_dialog.js.map
  17505. var model$c = {
  17506. data: {}
  17507. };
  17508. //# sourceMappingURL=GridColumnCustom.model.js.map
  17509. var vjson$c = {
  17510. title: '自定义表格属性',
  17511. layout: 'fit',
  17512. width: 980,
  17513. height: 500,
  17514. fbar: [
  17515. {
  17516. xtype: "button",
  17517. text: "保存",
  17518. iconCls: 'x-fa fa-save',
  17519. listeners: {
  17520. click: 'scope.commit',
  17521. }
  17522. },
  17523. {
  17524. xtype: "button",
  17525. text: "关闭",
  17526. iconCls: 'x-fa fa-times',
  17527. listeners: {
  17528. click: 'system.closeMe()',
  17529. }
  17530. },
  17531. ],
  17532. items: [
  17533. {
  17534. region: 'center',
  17535. xtype: 'tabpanel',
  17536. items: [
  17537. {
  17538. title: '基本信息', reference: 'basic',
  17539. layout: {
  17540. type: 'vbox',
  17541. pack: 'start',
  17542. align: 'stretch'
  17543. },
  17544. defaults: {
  17545. border: false,
  17546. anchor: '100%',
  17547. margin: '5',
  17548. },
  17549. scrollable: true,
  17550. items: [
  17551. {
  17552. xtype: 'cols',
  17553. items: [
  17554. {
  17555. fieldLabel: '路径',
  17556. bind: { value: '{__custom_path}' },
  17557. xtype: 'textfield',
  17558. flex: 2,
  17559. },
  17560. {
  17561. fieldLabel: '版本',
  17562. bind: { value: '{__custom_version}' },
  17563. xtype: 'textfield',
  17564. },
  17565. ]
  17566. },
  17567. {
  17568. xtype: 'cols',
  17569. items: [
  17570. {
  17571. fieldLabel: '配置点',
  17572. bind: { value: '{__custom_point}' },
  17573. xtype: 'textfield',
  17574. },
  17575. {
  17576. fieldLabel: 'reference',
  17577. bind: { value: '{reference}' },
  17578. xtype: 'textfield',
  17579. },
  17580. {
  17581. fieldLabel: '编辑模式',
  17582. bind: { value: '{_mode}' },
  17583. xtype: 'combo',
  17584. dict: 'GRID_MODE',
  17585. },
  17586. ]
  17587. },
  17588. {
  17589. layout: 'hbox',
  17590. defaults: {
  17591. margin: '0 0 0 15',
  17592. },
  17593. items: [
  17594. {
  17595. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17596. bind: {
  17597. value: "{hideFootbar}"
  17598. }
  17599. },
  17600. {
  17601. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17602. bind: {
  17603. value: "{hideRefresh}"
  17604. }
  17605. },
  17606. {
  17607. boxLabel: '隐藏导出', xtype: 'checkbox',
  17608. bind: {
  17609. value: "{hideExport}"
  17610. }
  17611. },
  17612. {
  17613. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17614. bind: {
  17615. value: "{hideAutoSize}"
  17616. }
  17617. },
  17618. {
  17619. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17620. bind: {
  17621. value: "{hideClearFilter}"
  17622. }
  17623. },
  17624. {
  17625. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17626. bind: {
  17627. value: "{hideSaveGridUIConfig}"
  17628. }
  17629. },
  17630. {
  17631. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17632. bind: {
  17633. value: "{hideClearGridUIConfig}"
  17634. }
  17635. },
  17636. ]
  17637. },
  17638. {
  17639. layout: 'hbox',
  17640. defaults: {
  17641. margin: '0 0 0 15',
  17642. },
  17643. items: [
  17644. {
  17645. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17646. bind: { value: '{autoLoad}' },
  17647. margin: '0 0 0 85',
  17648. },
  17649. {
  17650. boxLabel: '分页模式', xtype: 'checkbox',
  17651. bind: { value: '{pagination}' },
  17652. },
  17653. {
  17654. boxLabel: '显示行序号', xtype: 'checkbox',
  17655. bind: { value: '{show_rownum}' },
  17656. },
  17657. {
  17658. boxLabel: '后端排序', xtype: 'checkbox',
  17659. bind: {
  17660. value: "{remoteSort}"
  17661. }
  17662. },
  17663. {
  17664. boxLabel: '后端过滤', xtype: 'checkbox',
  17665. bind: {
  17666. value: "{remoteFilter}"
  17667. }
  17668. },
  17669. {
  17670. boxLabel: '隐藏', xtype: 'checkbox',
  17671. bind: {
  17672. value: "{hidden}"
  17673. }
  17674. },
  17675. ]
  17676. },
  17677. {
  17678. layout: 'hbox',
  17679. defaults: {
  17680. margin: '0 0 0 15',
  17681. },
  17682. items: [
  17683. {
  17684. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17685. bind: {
  17686. value: "{enableColumnHide}"
  17687. }
  17688. },
  17689. {
  17690. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17691. bind: {
  17692. value: "{enableColumnMove}"
  17693. }
  17694. },
  17695. {
  17696. boxLabel: '自定义筛选', xtype: 'checkbox',
  17697. bind: {
  17698. value: "{gridfilters}"
  17699. }
  17700. },
  17701. {
  17702. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17703. bind: {
  17704. value: "{enableColumnResize}"
  17705. }
  17706. },
  17707. {
  17708. boxLabel: '点击列头排序', xtype: 'checkbox',
  17709. bind: {
  17710. value: "{sortOnClick}"
  17711. }
  17712. },
  17713. ]
  17714. },
  17715. {
  17716. xtype: 'cols',
  17717. items: [
  17718. {
  17719. fieldLabel: 'dbTableName',
  17720. labelWidth: 110,
  17721. bind: { value: '{behavior.dbTableName}' },
  17722. xtype: 'textfield',
  17723. },
  17724. {
  17725. fieldLabel: 'theid',
  17726. bind: { value: '{theid}' },
  17727. xtype: 'textfield',
  17728. },
  17729. {
  17730. fieldLabel: '添加行聚焦',
  17731. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17732. xtype: 'textfield',
  17733. },
  17734. ]
  17735. },
  17736. {
  17737. xtype: 'cols',
  17738. items: [
  17739. {
  17740. fieldLabel: '批量删除提示',
  17741. labelWidth: 110,
  17742. bind: { value: '{behavior.batchRemoveConfirm}' },
  17743. xtype: 'textfield',
  17744. },
  17745. {
  17746. fieldLabel: '删除提示',
  17747. bind: { value: '{behavior.singleRemoveConfirm}' },
  17748. xtype: 'textfield',
  17749. },
  17750. {
  17751. fieldLabel: '触发刷新',
  17752. labelWidth: 110,
  17753. bind: { value: '{behavior.selectToReload}' },
  17754. xtype: 'textfield',
  17755. },
  17756. ]
  17757. },
  17758. ]
  17759. },
  17760. {
  17761. title: '字段', reference: 'grid1',
  17762. xtype: 'yvgrid',
  17763. pagination: false,
  17764. _mode: 'edit',
  17765. listeners: {
  17766. buttonclick: 'scope.grid1Buttonclick',
  17767. },
  17768. hideFootbar: true,
  17769. tbar: [
  17770. {
  17771. xtype: 'button',
  17772. text: '添加',
  17773. iconCls: 'x-fa fa-plus-circle',
  17774. listeners: {
  17775. click: 'scope.addField'
  17776. }
  17777. },
  17778. {
  17779. xtype: 'button',
  17780. text: '删除',
  17781. iconCls: 'x-fa fa-minus-circle',
  17782. listeners: {
  17783. click: 'scope.removeField'
  17784. }
  17785. },
  17786. '-',
  17787. {
  17788. xtype: 'button',
  17789. text: '自动分析',
  17790. iconCls: 'x-fa fa-code-fork',
  17791. listeners: {
  17792. click: 'scope.calcField'
  17793. }
  17794. },
  17795. {
  17796. xtype: 'button',
  17797. text: '上移',
  17798. iconCls: 'x-fa fa-arrow-up',
  17799. listeners: {
  17800. click: 'scope.moveUp'
  17801. }
  17802. },
  17803. {
  17804. xtype: 'button',
  17805. text: '下移',
  17806. iconCls: 'x-fa fa-arrow-down',
  17807. listeners: {
  17808. click: 'scope.moveDown'
  17809. }
  17810. },
  17811. ],
  17812. store: {},
  17813. columns: [
  17814. {
  17815. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17816. editor: { xtype: 'textfield' }
  17817. },
  17818. {
  17819. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17820. editor: { xtype: 'textfield' }
  17821. },
  17822. {
  17823. dataIndex: 'header', header: '中文', width: 140,
  17824. editor: { xtype: 'textfield' }
  17825. },
  17826. {
  17827. dataIndex: 'dict', header: '字典', width: 110,
  17828. editor: { xtype: 'combogrid' }
  17829. },
  17830. {
  17831. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17832. editor: { xtype: 'combogrid' }, hidden: true,
  17833. },
  17834. {
  17835. dataIndex: 'width', header: '宽度', width: 80,
  17836. editor: { xtype: 'numberfield' }, hidden: true,
  17837. },
  17838. {
  17839. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17840. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17841. },
  17842. {
  17843. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17844. editor: { xtype: 'textfield' },
  17845. },
  17846. {
  17847. dataIndex: 'createValue', text: '客户端新创建值',
  17848. editor: { xtype: 'textfield' },
  17849. },
  17850. {
  17851. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17852. resizable: false, sortable: false, menuDisabled: true,
  17853. checkedValue: true, uncheckedValue: false,
  17854. },
  17855. {
  17856. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17857. resizable: false, sortable: false, menuDisabled: true,
  17858. checkedValue: true, uncheckedValue: false,
  17859. },
  17860. {
  17861. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17862. resizable: false, sortable: false, menuDisabled: true,
  17863. checkedValue: true, uncheckedValue: false,
  17864. },
  17865. {
  17866. dataIndex: 'formatter', header: '格式化', width: 110,
  17867. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17868. },
  17869. {
  17870. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17871. resizable: false, sortable: false, menuDisabled: true,
  17872. checkedValue: true, uncheckedValue: false, hidden: true,
  17873. },
  17874. {
  17875. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17876. resizable: false, sortable: false, menuDisabled: true,
  17877. hidden: true,
  17878. },
  17879. {
  17880. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17881. resizable: false, sortable: false, menuDisabled: true,
  17882. checkedValue: true, uncheckedValue: false, hidden: true,
  17883. },
  17884. {
  17885. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17886. resizable: false, sortable: false, menuDisabled: true,
  17887. },
  17888. {
  17889. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17890. resizable: false, sortable: false, menuDisabled: true,
  17891. checkedValue: true, uncheckedValue: false, hidden: true,
  17892. },
  17893. {
  17894. dataIndex: 'form_order', text: '对话框序号',
  17895. editor: { xtype: 'numberfield' },
  17896. },
  17897. {
  17898. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17899. resizable: false, sortable: false, menuDisabled: true,
  17900. checkedValue: true, uncheckedValue: false,
  17901. },
  17902. {
  17903. dataIndex: 'form_xtype', text: '对话框编辑器',
  17904. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17905. },
  17906. {
  17907. dataIndex: 'form_fieldset', text: '对话框字段组',
  17908. editor: { xtype: 'textfield' }, hidden: true,
  17909. },
  17910. {
  17911. dataIndex: 'form_tab', text: '对话框选项卡',
  17912. editor: { xtype: 'textfield' }, hidden: true,
  17913. },
  17914. {
  17915. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17916. resizable: false, sortable: false, menuDisabled: true,
  17917. checkedValue: true, uncheckedValue: false, hidden: true,
  17918. },
  17919. ],
  17920. },
  17921. {
  17922. title: 'SQL和查询条件', reference: 'sql',
  17923. layout: 'border',
  17924. border: false,
  17925. items: [
  17926. {
  17927. region: 'north',
  17928. height: 200,
  17929. border: false,
  17930. split: true,
  17931. xtype: 'yvgrid',
  17932. reference: 'gridCondition',
  17933. pagination: false,
  17934. hideFootbar: true,
  17935. _mode: 'edit',
  17936. listeners: {
  17937. buttonclick: 'scope.conditionButtonclick',
  17938. },
  17939. store: {},
  17940. tbar: {
  17941. xtype: 'toolbar',
  17942. border: false,
  17943. items: [
  17944. {
  17945. xtype: 'button',
  17946. text: '添加条件',
  17947. iconCls: 'x-fa fa-plus-circle',
  17948. listeners: {
  17949. click: 'scope.addCondition'
  17950. }
  17951. },
  17952. {
  17953. xtype: 'button',
  17954. text: '删除条件',
  17955. iconCls: 'x-fa fa-minus-circle',
  17956. listeners: {
  17957. click: 'scope.removeCondition'
  17958. }
  17959. },
  17960. '-',
  17961. {
  17962. xtype: 'button',
  17963. text: '自动分析条件变量',
  17964. iconCls: 'x-fa fa-code-fork',
  17965. listeners: {
  17966. click: 'scope.calcCondition'
  17967. }
  17968. },
  17969. {
  17970. xtype: 'button',
  17971. text: '上移',
  17972. iconCls: 'x-fa fa-arrow-up',
  17973. listeners: {
  17974. click: 'scope.moveUpCondition'
  17975. }
  17976. },
  17977. {
  17978. xtype: 'button',
  17979. text: '下移',
  17980. iconCls: 'x-fa fa-arrow-down',
  17981. listeners: {
  17982. click: 'scope.moveDownCondition'
  17983. }
  17984. },
  17985. ]
  17986. },
  17987. columns: [
  17988. {
  17989. text: '条件变量',
  17990. dataIndex: 'param_name',
  17991. width: 140,
  17992. sortable: false,
  17993. menuDisabled: true,
  17994. editor: {
  17995. selectOnFocus: true
  17996. },
  17997. },
  17998. {
  17999. text: '中文标题',
  18000. dataIndex: 'fieldLabel',
  18001. width: 120,
  18002. sortable: false,
  18003. menuDisabled: true,
  18004. editor: {
  18005. selectOnFocus: true
  18006. },
  18007. },
  18008. {
  18009. text: '编辑类型',
  18010. dataIndex: 'xtype',
  18011. width: 80,
  18012. sortable: false,
  18013. menuDisabled: true,
  18014. editor: {
  18015. xtype: 'combo',
  18016. typeAhead: true,
  18017. triggerAction: 'all',
  18018. selectOnFocus: true,
  18019. store: [
  18020. ['textfield', 'textfield'],
  18021. ['combo', 'combo'],
  18022. ['datefield', 'datefield'],
  18023. ['datetimefield', 'datetimefield'],
  18024. ['numberfield', 'numberfield'],
  18025. ['multiplesearch', 'multiplesearch'],
  18026. ]
  18027. }
  18028. },
  18029. {
  18030. text: '权重',
  18031. dataIndex: 'conditionFieldFlex',
  18032. align: 'right',
  18033. width: 60,
  18034. sortable: false,
  18035. menuDisabled: true,
  18036. editor: {
  18037. xtype: 'numberfield',
  18038. selectOnFocus: false,
  18039. minValue: 0,
  18040. maxValue: 10
  18041. },
  18042. },
  18043. {
  18044. text: '字典',
  18045. dataIndex: 'conditionFieldDict',
  18046. width: 160,
  18047. sortable: false,
  18048. menuDisabled: true,
  18049. editor: {
  18050. selectOnFocus: false
  18051. },
  18052. },
  18053. {
  18054. xtype: 'checkcolumn',
  18055. dataIndex: "conditionFieldWrap", header: "换行",
  18056. width: 65,
  18057. sortable: false,
  18058. menuDisabled: true,
  18059. },
  18060. {
  18061. text: '扩展参数',
  18062. dataIndex: 'conditionFieldExtend',
  18063. sortable: false,
  18064. menuDisabled: true,
  18065. editor: {
  18066. selectOnFocus: false
  18067. },
  18068. },
  18069. ]
  18070. },
  18071. {
  18072. region: 'center',
  18073. xtype: 'sqleditor',
  18074. layout: 'fit',
  18075. reference: 'sqlEditor',
  18076. split: true,
  18077. },
  18078. ]
  18079. },
  18080. {
  18081. title: '详情对话框',
  18082. layout: {
  18083. type: 'vbox',
  18084. pack: 'start',
  18085. align: 'stretch'
  18086. },
  18087. defaults: {
  18088. border: false,
  18089. anchor: '100%',
  18090. margin: '5',
  18091. },
  18092. scrollable: true,
  18093. items: [
  18094. {
  18095. xtype: 'cols',
  18096. items: [
  18097. {
  18098. fieldLabel: '对话框标题',
  18099. bind: { value: '{detailDialog.title}' },
  18100. xtype: 'textfield',
  18101. flex: 2,
  18102. },
  18103. {
  18104. fieldLabel: '宽度',
  18105. bind: { value: '{detailDialog.width}' },
  18106. xtype: 'numberfield',
  18107. },
  18108. {
  18109. fieldLabel: '高度',
  18110. bind: { value: '{detailDialog.height}' },
  18111. xtype: 'numberfield',
  18112. },
  18113. ]
  18114. },
  18115. ]
  18116. },
  18117. {
  18118. title: '界面源码',
  18119. xtype: 'jseditor',
  18120. reference: 'jseditor'
  18121. }
  18122. ]
  18123. }
  18124. ]
  18125. };
  18126. //# sourceMappingURL=GridColumnCustom.view.js.map
  18127. var GridColumnCustom = /** @class */ (function (_super) {
  18128. __extends(GridColumnCustom, _super);
  18129. function GridColumnCustom() {
  18130. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18131. }
  18132. GridColumnCustom.prototype.commit = function () {
  18133. };
  18134. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18135. };
  18136. GridColumnCustom.prototype.conditionButtonclick = function () {
  18137. };
  18138. GridColumnCustom.prototype.addField = function () {
  18139. };
  18140. GridColumnCustom.prototype.removeField = function () {
  18141. };
  18142. GridColumnCustom.prototype.calcField = function () {
  18143. };
  18144. GridColumnCustom.prototype.moveUp = function () {
  18145. };
  18146. GridColumnCustom.prototype.moveDown = function () {
  18147. };
  18148. GridColumnCustom.prototype.addCondition = function () {
  18149. };
  18150. GridColumnCustom.prototype.removeCondition = function () {
  18151. };
  18152. GridColumnCustom.prototype.calcCondition = function () {
  18153. };
  18154. GridColumnCustom.prototype.moveUpCondition = function () {
  18155. };
  18156. GridColumnCustom.prototype.moveDownCondition = function () {
  18157. };
  18158. return GridColumnCustom;
  18159. }(Scope));
  18160. //# sourceMappingURL=GridColumnCustom.js.map
  18161. function initGridCode(grid, newConfig, buttons) {
  18162. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18163. buttons.push({
  18164. xtype: 'button',
  18165. tooltip: '定义表格属性',
  18166. iconCls: 'x-fa fa-codepen',
  18167. handler: function (btn) {
  18168. var customWindow = new GridColumnCustom();
  18169. customWindow.showDialog(btn, {}, {});
  18170. }
  18171. });
  18172. buttons.push({
  18173. xtype: 'button',
  18174. tooltip: '定义表格数据源',
  18175. iconCls: 'x-fa fa-database',
  18176. handler: function () {
  18177. // showCustomGridDataSource(grid)
  18178. }
  18179. });
  18180. }
  18181. }
  18182. //# sourceMappingURL=grid_code.js.map
  18183. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18184. var hexToString = function (hex) {
  18185. var arr = hex.split("");
  18186. var out = "";
  18187. for (var i = 0; i < arr.length / 2; i++) {
  18188. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18189. // @ts-ignore
  18190. var charValue = String.fromCharCode(tmp);
  18191. out += charValue;
  18192. }
  18193. return out;
  18194. };
  18195. var defaultGrid = grid;
  18196. function initGrid () {
  18197. Ext.define('Yvan.Grid', {
  18198. extend: 'Ext.grid.Panel',
  18199. xtype: 'yvgrid',
  18200. __suspendReload: false,
  18201. _originVJson: {},
  18202. constructor: function (config) {
  18203. var _this = this;
  18204. var _a, _b, _c, _d, _e, _f;
  18205. var me = this;
  18206. var dataSource = config.dataSource;
  18207. 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);
  18208. me._originVJson = config;
  18209. if (!isDesignMode(scope, config)) {
  18210. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18211. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18212. var cacheData = this.getColumnConfigCache();
  18213. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18214. var newColumns = [];
  18215. for (var j = 0; j < cacheData.length; j++) {
  18216. var itData = cacheData[j];
  18217. for (var i = 0; i < config.columns.length; i++) {
  18218. var column = config.columns[i];
  18219. if (itData.dataIndex === column.dataIndex) {
  18220. if (itData.width) {
  18221. column.width = itData.width;
  18222. }
  18223. column.hidden = itData.hidden;
  18224. column.locked = itData.locked;
  18225. newColumns.push(column);
  18226. break;
  18227. }
  18228. }
  18229. }
  18230. config.columns = newColumns;
  18231. }
  18232. }
  18233. }
  18234. var newConfig = _$2.defaultsDeep({
  18235. // 强制性属性 bug.
  18236. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18237. // enableLocking: false,
  18238. // syncRowHeight: false,
  18239. }, baseConfig(config, 'row-item'), config, grid);
  18240. // 在面板上的组件
  18241. // const scope = newConfig.$initParent?.yvanScope ||
  18242. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18243. // config.$vmParent?.yvanScope ||
  18244. // newConfig.$vmParent?._parent?.yvanScope;
  18245. var buttons = [];
  18246. var getRowClass = newConfig.getRowClass;
  18247. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18248. _$2.startsWith(getRowClass, "system."))) {
  18249. var fn = lookupFn(scope, getRowClass);
  18250. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18251. }
  18252. if (!newConfig.hideExport) {
  18253. buttons.push({
  18254. xtype: 'button',
  18255. tooltip: '导出Excel',
  18256. iconCls: 'x-fa fa-download',
  18257. listeners: {
  18258. click: this.exportExcel
  18259. },
  18260. });
  18261. }
  18262. if (!newConfig.hideAutoSize) {
  18263. buttons.push({
  18264. xtype: 'button',
  18265. iconCls: 'x-fa fa-text-width',
  18266. tooltip: '自适应宽度',
  18267. listeners: {
  18268. click: this.autoSizeColumns
  18269. }
  18270. });
  18271. }
  18272. if (!newConfig.hideClearFilter) {
  18273. buttons.push({
  18274. xtype: 'button',
  18275. tooltip: '清空筛选',
  18276. iconCls: 'x-fa fa-filter',
  18277. handler: this.clearFilter
  18278. });
  18279. }
  18280. if (!newConfig.hideSaveGridUIConfig) {
  18281. buttons.push({
  18282. xtype: 'button',
  18283. tooltip: '保存布局',
  18284. iconCls: 'x-fa fa-cogs',
  18285. handler: this.saveGridUIConfig
  18286. });
  18287. }
  18288. if (!newConfig.hideClearGridUIConfig) {
  18289. buttons.push({
  18290. xtype: 'button',
  18291. tooltip: '还原布局',
  18292. iconCls: 'x-fa fa-reply-all',
  18293. handler: this.clearGridUIConfig
  18294. });
  18295. }
  18296. initGridCode(me, newConfig, buttons);
  18297. if (!newConfig.hideFootbar) {
  18298. if (newConfig.pagination) {
  18299. newConfig.bbar = new Ext.PagingToolbar({
  18300. // pageSize: newConfig.pageSize, 这个值是无效的
  18301. displayInfo: true,
  18302. store: this.store,
  18303. emptyMsg: '没有记录',
  18304. cls: 'grid-bbar',
  18305. items: __spread([
  18306. {
  18307. xtype: 'combobox',
  18308. tooltip: '分页',
  18309. queryMode: 'local',
  18310. editable: false,
  18311. allowBlank: true,
  18312. labelAlign: 'right',
  18313. width: 90,
  18314. // labelWidth: 30,
  18315. listConfig: {
  18316. minWidth: null
  18317. },
  18318. value: 50,
  18319. valueField: undefined,
  18320. displayField: undefined,
  18321. hideClear: true,
  18322. store: newConfig.pageSizeOption,
  18323. listeners: {
  18324. change: function (sender, nv, ov) {
  18325. _this.store.pageSize = nv;
  18326. _this.store.loadPage(1);
  18327. }
  18328. }
  18329. }
  18330. ], buttons),
  18331. doRefresh: function () {
  18332. me.reload();
  18333. }
  18334. });
  18335. }
  18336. else {
  18337. newConfig.bbar = {
  18338. xtype: 'toolbar', overflowHandler: 'menu',
  18339. cls: 'grid-bbar',
  18340. items: __spread([
  18341. {
  18342. xtype: 'button',
  18343. tooltip: '刷新',
  18344. iconCls: 'x-fa fa-refresh',
  18345. handler: function () {
  18346. _this.reload();
  18347. }
  18348. },
  18349. '-'
  18350. ], buttons)
  18351. };
  18352. if (newConfig.hideRefresh) {
  18353. newConfig.bbar.items.splice(0, 1);
  18354. }
  18355. }
  18356. }
  18357. if (_$2.isArray(newConfig.condition)) {
  18358. // 带查询条件
  18359. var conditionRows_1 = [];
  18360. var newRow_1 = false;
  18361. var currentRow_1 = { xtype: 'cols', items: [], };
  18362. conditionRows_1.push(currentRow_1);
  18363. _$2.forEach(newConfig.condition, function (item) {
  18364. var _a;
  18365. if (newRow_1) {
  18366. currentRow_1 = { xtype: 'cols', items: [], };
  18367. conditionRows_1.push(currentRow_1);
  18368. }
  18369. var vj = _$2.cloneDeep(item);
  18370. if (vj.xtype) {
  18371. if (item.xtype === 'combo' && item.dict) {
  18372. vj.fix = ['system.getDict("' + item.dict + '")'];
  18373. }
  18374. if (item.xtype === 'datetimefield') {
  18375. _$2.defer(function () {
  18376. //@ts-ignore
  18377. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18378. });
  18379. }
  18380. else if (item.xtype === 'datefield') {
  18381. _$2.defer(function () {
  18382. //@ts-ignore
  18383. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18384. });
  18385. }
  18386. else {
  18387. scope.viewModel.set(item.param_name, '');
  18388. }
  18389. }
  18390. else {
  18391. // 没有组件类型,是个空占位符
  18392. vj.border = false;
  18393. }
  18394. if (item.param_name) {
  18395. vj.bind = {
  18396. value: '{' + item.param_name + '}'
  18397. };
  18398. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18399. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18400. }
  18401. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18402. currentRow_1.items.push(vj);
  18403. });
  18404. newConfig.tbar = {
  18405. xtype: 'form',
  18406. border: false,
  18407. items: conditionRows_1,
  18408. defaults: {
  18409. margin: '8 0 8 0'
  18410. },
  18411. };
  18412. console.log('newConfig', newConfig);
  18413. }
  18414. _$2.each(newConfig.columns, function (c) {
  18415. var renderer = c.renderer, formatter = c.formatter;
  18416. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18417. _$2.startsWith(renderer, "system."))) {
  18418. if (newConfig.$initParent) {
  18419. if (scope) {
  18420. var rendererFn = lookupFn(scope, renderer);
  18421. c.renderer = rendererFn.bind(scope);
  18422. }
  18423. }
  18424. }
  18425. if (c.dict) {
  18426. c.fix = ['system.getDict("' + c.dict + '")'];
  18427. if (c.editor && c.editor.xtype === 'combo') {
  18428. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18429. c.editor.typeAhead = true;
  18430. c.editor.triggerAction = 'all';
  18431. c.editor.selectOnFocus = false;
  18432. c.editor.listConfig = {
  18433. minWidth: 200
  18434. };
  18435. }
  18436. }
  18437. if (formatter === 'button') {
  18438. c.tdCls = 'td-btn';
  18439. if (!c.listeners) {
  18440. c.listeners = {};
  18441. }
  18442. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18443. if ($(event.target).is('input')) {
  18444. me.fireEvent('buttonclick', me, this, record);
  18445. }
  18446. };
  18447. }
  18448. else if (formatter === 'percentRenderer') {
  18449. c.tdCls = 'td-percent';
  18450. }
  18451. });
  18452. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18453. // 强制为编辑模式
  18454. newConfig.selModel = {
  18455. type: 'spreadsheet',
  18456. columnSelect: true,
  18457. pruneRemoved: false,
  18458. extensible: 'y'
  18459. };
  18460. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18461. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18462. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18463. }
  18464. else {
  18465. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18466. }
  18467. }
  18468. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18469. // 强制为勾选模式
  18470. newConfig.selModel = {
  18471. type: 'checkboxmodel',
  18472. mode: 'MULTI',
  18473. };
  18474. }
  18475. else if (newConfig._mode === 'checkonly') {
  18476. newConfig.selModel = {
  18477. type: 'checkboxmodel',
  18478. mode: 'MULTI',
  18479. checkOnly: true,
  18480. };
  18481. }
  18482. else if (newConfig._mode === 'select') {
  18483. // 强制为选择模式
  18484. newConfig.selModel = {
  18485. selType: 'rowmodel',
  18486. mode: 'SINGLE',
  18487. };
  18488. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18489. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18490. }
  18491. }
  18492. initBehaviorEdit(newConfig);
  18493. initGridDialog(newConfig);
  18494. this.superclass.constructor.call(this, newConfig);
  18495. this.store.pageSize = newConfig.pageSize;
  18496. },
  18497. setData: function (value) {
  18498. var me = this;
  18499. me._setDataReal(value);
  18500. },
  18501. /**
  18502. * 添加行,并进入编辑状态
  18503. * @param record 新行的属性集
  18504. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18505. */
  18506. appendEditRow: function (record, editRowCol) {
  18507. var records = this.getStore().add(record);
  18508. var recNew = records[0];
  18509. this.setSelection(records);
  18510. if (typeof editRowCol === 'string' && editRowCol) {
  18511. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18512. }
  18513. if (typeof editRowCol === 'number') {
  18514. var ce = this.findPlugin('cellediting');
  18515. this.editingPlugin = ce;
  18516. ce.startEdit(recNew, editRowCol);
  18517. }
  18518. },
  18519. beginEdit: function (record, editRowCol) {
  18520. if (typeof record === 'number') {
  18521. record = this.store.data.getAt(record);
  18522. }
  18523. if (record.isEntity === true) {
  18524. this.setSelection([record]);
  18525. if (typeof editRowCol === 'string' && editRowCol) {
  18526. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18527. }
  18528. if (typeof editRowCol === 'number') {
  18529. var ce = this.findPlugin('cellediting');
  18530. this.editingPlugin = ce;
  18531. ce.startEdit(record, editRowCol);
  18532. }
  18533. }
  18534. },
  18535. /**
  18536. * 移除行
  18537. * @param record 如果记录传空,就是当前选中的行
  18538. */
  18539. removeEditRow: function (record) {
  18540. if (!record) {
  18541. record = this.selection;
  18542. }
  18543. if (!record) {
  18544. msg('请选中要删除的行');
  18545. return;
  18546. }
  18547. this.getStore().remove(record);
  18548. },
  18549. /**
  18550. * 获取全部原始数据
  18551. */
  18552. getDataRows: function () {
  18553. return this.getStore().data.items.map(function (r) { return r.data; });
  18554. },
  18555. /**
  18556. * 获取全部原始数据, 不带 id/ 不带 origin
  18557. */
  18558. getDataRowsOnlyData: function () {
  18559. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18560. delete r.id;
  18561. delete r._origin;
  18562. return r;
  18563. });
  18564. },
  18565. rowMoveUp: function () {
  18566. var grid = this;
  18567. if (!grid.selection) {
  18568. msg('无法对多行进行移动');
  18569. return;
  18570. }
  18571. var record = grid.selection;
  18572. if (_$2.isArray(record)) {
  18573. record = record[0];
  18574. }
  18575. if (!record) {
  18576. msg('无法对多行进行移动');
  18577. return;
  18578. }
  18579. // const records = grid.selModel.getSelection()
  18580. // if (records.length !== 1) {
  18581. // msg('无法对多行进行移动')
  18582. // return
  18583. // }
  18584. //
  18585. // const [record] = records
  18586. var index = grid.store.indexOf(record);
  18587. if (index > 0) {
  18588. grid.store.removeAt(index);
  18589. grid.store.insert(index - 1, record);
  18590. grid.getView().refresh();
  18591. grid.selModel.select([record]);
  18592. }
  18593. },
  18594. rowMoveDown: function () {
  18595. var grid = this;
  18596. // const records = grid.selModel.getSelection()
  18597. // if (records.length !== 1) {
  18598. // msg('无法对多行进行移动')
  18599. // return
  18600. // }
  18601. if (!grid.selection) {
  18602. msg('无法对多行进行移动');
  18603. return;
  18604. }
  18605. var record = grid.selection;
  18606. if (_$2.isArray(record)) {
  18607. record = record[0];
  18608. }
  18609. if (!record) {
  18610. msg('无法对多行进行移动');
  18611. return;
  18612. }
  18613. var index = grid.store.indexOf(record);
  18614. if (index < grid.store.getCount() - 1) {
  18615. grid.store.removeAt(index);
  18616. grid.store.insert(index + 1, record);
  18617. grid.getView().refresh();
  18618. grid.selModel.select([record]);
  18619. }
  18620. },
  18621. getEditRecord: function () {
  18622. var _a, _b;
  18623. var me = this;
  18624. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18625. 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;
  18626. var record;
  18627. if (typeof rowIdx === 'undefined') {
  18628. record = me.getSelectionModel().getLastSelected();
  18629. }
  18630. else {
  18631. record = me.store.getAt(rowIdx);
  18632. }
  18633. return record;
  18634. },
  18635. getEditRow: function () {
  18636. var _a;
  18637. var me = this;
  18638. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18639. },
  18640. setEditRow: function (rowValues) {
  18641. var me = this;
  18642. var record = me.getEditRecord();
  18643. if (record) {
  18644. _$2.forOwn(rowValues, function (v, k) {
  18645. record.set(k, v);
  18646. });
  18647. }
  18648. },
  18649. _transform: function (data) {
  18650. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18651. _$2.forEach(data, function (row) {
  18652. row._origin = _$2.clone(row);
  18653. });
  18654. },
  18655. _setDataReal: function (value) {
  18656. var me = this;
  18657. this._transform(value);
  18658. var storeOpt = {
  18659. fields: getFileds(this),
  18660. data: value,
  18661. };
  18662. if (this.groupField) {
  18663. storeOpt.groupField = this.groupField;
  18664. }
  18665. var store = new Ext.data.Store(storeOpt);
  18666. me.setStore(store);
  18667. },
  18668. setStore: function (store) {
  18669. var me = this;
  18670. if (_$2.isArray(store)) {
  18671. var value = store;
  18672. this._transform(value);
  18673. var storeOpt = {
  18674. fields: getFileds(this),
  18675. data: value,
  18676. };
  18677. if (this.groupField) {
  18678. storeOpt.groupField = this.groupField;
  18679. }
  18680. store = new Ext.data.Store(storeOpt);
  18681. }
  18682. me.superclass.setStore.call(this, store);
  18683. var reference = this.reference;
  18684. if (reference) {
  18685. var scope = lookupScope(this);
  18686. scope.viewModel.set(reference + '.ischanged', false);
  18687. scope.viewModel.set(reference + '.theid', null);
  18688. scope.viewModel.set(reference + '.theid2', null);
  18689. scope.viewModel.set(reference + '.theid3', null);
  18690. }
  18691. if (store) {
  18692. store.on({
  18693. add: function (store, records, index, eOpts) {
  18694. me._raiseChange(store, 'add');
  18695. },
  18696. remove: function (store, records, index, isMove, eOpts) {
  18697. me._raiseChange(store, 'remove');
  18698. },
  18699. datachanged: function (sender, opt) {
  18700. me._raiseChange(store, 'datachanged');
  18701. }
  18702. });
  18703. }
  18704. },
  18705. _raiseChange: function (store, type) {
  18706. var _a, _b;
  18707. var reference = this.reference;
  18708. if (reference && store) {
  18709. var ischanged = false;
  18710. if (store.getModifiedRecords().length > 0 ||
  18711. store.getNewRecords().length > 0 ||
  18712. store.getRemovedRecords().length > 0) {
  18713. ischanged = true;
  18714. }
  18715. else {
  18716. ischanged = false;
  18717. }
  18718. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18719. }
  18720. },
  18721. /**
  18722. * 轻量级刷新
  18723. */
  18724. refreshData: function () {
  18725. var store = this.getStore();
  18726. if (store) {
  18727. store.reload();
  18728. }
  18729. },
  18730. /**
  18731. * 为表格强制设置焦点
  18732. * @param seq 顺序号
  18733. */
  18734. focusRow: function (seq) {
  18735. this.setSelection(this.store.getAt(seq));
  18736. this.getView().focusRow(seq);
  18737. },
  18738. /**
  18739. * 重新载入数据(重新计算参数)
  18740. */
  18741. reload: function (reloadParams) {
  18742. if (reloadParams === void 0) { reloadParams = {}; }
  18743. var me = this;
  18744. var config = me.config;
  18745. if (config.dataSourceCallbackFn) {
  18746. // 函数请求刷新
  18747. var scope_1 = lookupScope(this);
  18748. _$2.defer(function () {
  18749. me.setLoading(true);
  18750. });
  18751. config.dataSourceCallbackFn.call(scope_1, me, {
  18752. successCallback: function (value) {
  18753. me._setDataReal(value);
  18754. _$2.defer(function () {
  18755. me.setLoading(false);
  18756. });
  18757. // 自动选中第一行
  18758. var data = me.getStore().data;
  18759. if (data.length > 0) {
  18760. me.setSelection(data.items[0]);
  18761. }
  18762. me.fireEvent('dataLoadComplete', me, true, value);
  18763. },
  18764. failCallback: function (error) {
  18765. _$2.defer(function () {
  18766. me.setLoading(false);
  18767. });
  18768. me.fireEvent('dataLoadComplete', me, false, error);
  18769. }
  18770. });
  18771. return;
  18772. }
  18773. // if (this.store) {
  18774. // this.store.reload({aaaa: 1, bbbb: 2})
  18775. // }
  18776. var dataSource = config.dataSource;
  18777. var scope = lookupScope(me);
  18778. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18779. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18780. }
  18781. },
  18782. exportCurrentExcelClick: function () {
  18783. var _a;
  18784. var me = this;
  18785. var config = me.config;
  18786. var scope = lookupScope(me);
  18787. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18788. if (excelFileName.endsWith(".xlsx")) {
  18789. excelFileName = excelFileName.split(".xlsx")[0];
  18790. }
  18791. excelFileName += ".xlsx";
  18792. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18793. var excelData = me.makeExcelData(rowsAll);
  18794. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18795. },
  18796. exportExcelClick: function (excelExportParams) {
  18797. var me = this;
  18798. var config = me.config;
  18799. excelExportParams.isExcelExport = true;
  18800. var scope = lookupScope(me);
  18801. var dataSource = config.dataSource;
  18802. scope.setLoading(true);
  18803. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18804. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18805. var _a, _b, _c, _d;
  18806. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18807. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18808. 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;
  18809. me.exportExcelCurrentPage = page;
  18810. me.exportExcelPageSize = size;
  18811. me.exportExcelTotal = total;
  18812. if (excelFileName.endsWith(".xlsx")) {
  18813. excelFileName = excelFileName.split(".xlsx")[0];
  18814. }
  18815. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18816. excelFileName += ".xlsx";
  18817. var excelData = me.makeExcelData(responseData.data);
  18818. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18819. if (page < total / size) {
  18820. page++;
  18821. me.exportExcelCurrentPage = page;
  18822. }
  18823. scope.setLoading(false);
  18824. });
  18825. },
  18826. exportBigExcelClick: function () {
  18827. var _a;
  18828. var me = this;
  18829. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18830. showErrorDialog('当前表格不支持大批量导出');
  18831. return;
  18832. }
  18833. var config = me.config;
  18834. var scope = lookupScope(me);
  18835. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18836. var head = [];
  18837. var dict = {};
  18838. _$2.forEach(me.columns, function (column) {
  18839. if (column.isHidden())
  18840. return;
  18841. if (!column.dataIndex)
  18842. return;
  18843. if (!column.text)
  18844. return;
  18845. head.push({ field: column.dataIndex, name: column.text });
  18846. if (column.dictForExcel) {
  18847. dict[column.dataIndex] = column.dictForExcel;
  18848. }
  18849. });
  18850. // 判断是否需要解密
  18851. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18852. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18853. me.dbInfo.password = hexToString(me.dbInfo.password);
  18854. me.dbInfo.username = hexToString(me.dbInfo.username);
  18855. }
  18856. scope.setLoading(true);
  18857. Ext.Ajax.request({
  18858. timeout: 15000,
  18859. url: window["EXPORT_DATA_HOST"],
  18860. method: "POST",
  18861. jsonData: {
  18862. file: excelFileName,
  18863. dbInfo: me.dbInfo,
  18864. exportDataSql: me.exportDataSql,
  18865. exportDataSqlParams: me.exportDataSqlParams,
  18866. head: head,
  18867. dict: dict,
  18868. },
  18869. }).then(function () {
  18870. scope.setLoading(false);
  18871. msg('请求成功');
  18872. }).catch(function () {
  18873. scope.setLoading(false);
  18874. showErrorDialog('请求失败,请确认是否已安装客户端');
  18875. });
  18876. },
  18877. makeExcelData: function (jsonData) {
  18878. var me = this;
  18879. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18880. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18881. return;
  18882. }
  18883. var data = [];
  18884. // 获取表格的列定义
  18885. var headerTextArr = [];
  18886. var headers = [];
  18887. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18888. var header = me.headerCt.getGridColumns()[i];
  18889. if (!header.isHidden()) {
  18890. var textStr = _$2.trim(header.text);
  18891. var dataIndexStr = _$2.trim(header.dataIndex);
  18892. if (dataIndexStr) {
  18893. if (textStr === '') {
  18894. headerTextArr.push(dataIndexStr);
  18895. }
  18896. else {
  18897. headerTextArr.push(textStr);
  18898. }
  18899. headers.push(header);
  18900. }
  18901. }
  18902. }
  18903. if (headers.length === 0) {
  18904. return;
  18905. }
  18906. data.push(headerTextArr);
  18907. for (var i = 0; i < jsonData.length; i++) {
  18908. var dataRow = jsonData[i];
  18909. var row = [];
  18910. for (var j = 0; j < headers.length; j++) {
  18911. var key = headers[j].dataIndex;
  18912. var value = dataRow[key];
  18913. if (!value && value !== 0) {
  18914. value = '';
  18915. }
  18916. var oValue = value;
  18917. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18918. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18919. try {
  18920. value = headers[j].renderer(value);
  18921. if (!value && value !== 0) {
  18922. value = oValue;
  18923. }
  18924. }
  18925. catch (e) {
  18926. value = oValue;
  18927. }
  18928. }
  18929. row.push(value);
  18930. }
  18931. data.push(row);
  18932. }
  18933. return data;
  18934. },
  18935. initComponent: function () {
  18936. var _this = this;
  18937. var _a;
  18938. var me = this;
  18939. var config = me.config;
  18940. var scope = lookupScope(this);
  18941. if (isDesignMode(scope, config)) {
  18942. this.superclass.initComponent.call(this);
  18943. return;
  18944. }
  18945. // 转换 dataSource 属性
  18946. convertDataSource$1(me, scope, config);
  18947. this.on({
  18948. afterrender: function (sender) {
  18949. var me = this;
  18950. var config = this.config;
  18951. var dataSource = config.dataSource;
  18952. if (config.autoLoad) {
  18953. if (config.dataSourceCallbackFn) {
  18954. me.reload();
  18955. }
  18956. else if (_$2.isPlainObject(dataSource)) {
  18957. me.reload();
  18958. }
  18959. }
  18960. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18961. var vm = this.lookupViewModel();
  18962. this.contextMenu = this.add(new Ext.menu.Menu({
  18963. viewModel: vm,
  18964. items: _$2.map(config.tbar, function (item) {
  18965. var menuItem = __assign({}, item);
  18966. if (menuItem.xtype === 'button') {
  18967. delete menuItem.xtype;
  18968. }
  18969. return menuItem;
  18970. })
  18971. }));
  18972. }
  18973. else if (_$2.isPlainObject(config.contextMenu)) {
  18974. this.contextMenu = this.add(config.contextMenu);
  18975. }
  18976. var $dom = $(sender.el.dom);
  18977. $dom.on('keydown', function (e) {
  18978. me.fireEvent('keydown', me, e);
  18979. }).on('keyup', function (e) {
  18980. me.fireEvent('keyup', me, e);
  18981. });
  18982. // 默认显示提示
  18983. if (this.cellTip) {
  18984. this.tip = Ext.create('Ext.tip.ToolTip', {
  18985. target: this.el,
  18986. delegate: '.x-grid-cell-inner',
  18987. trackMouse: true,
  18988. ancor: 'top',
  18989. style: 'background-color: #0D6EFD;',
  18990. listeners: {
  18991. beforeshow: function (tip) {
  18992. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18993. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18994. return false;
  18995. }
  18996. tip.update(tipText);
  18997. }
  18998. }
  18999. });
  19000. }
  19001. },
  19002. itemcontextmenu: function (view, rec, node, index, e) {
  19003. if (this.contextMenu) {
  19004. e.stopEvent();
  19005. this.contextMenu.show().setLocalXY(e.getXY());
  19006. return false;
  19007. }
  19008. },
  19009. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  19010. // this.setColumnConfigCache()
  19011. // },
  19012. // columnhide(sender, column, eOpts) {
  19013. // this.setColumnConfigCache()
  19014. // },
  19015. // columnshow(sender, column, eOpts) {
  19016. // this.setColumnConfigCache()
  19017. // },
  19018. // columnresize(sender, column, width, eOpts) {
  19019. // this.setColumnConfigCache()
  19020. // },
  19021. destory: function () {
  19022. },
  19023. selectionchange: function (sender, param) {
  19024. var record = undefined;
  19025. if (_$2.isArray(param)) {
  19026. record = param[0];
  19027. }
  19028. else if (_$2.isObject(param)) {
  19029. record = _$2.get(param, 'endCell.record');
  19030. }
  19031. itemselectFun(this, sender, record);
  19032. },
  19033. itemclick: function (sender, record) {
  19034. itemselectFun(this, sender, record);
  19035. },
  19036. show: function (sender) {
  19037. if (sender.__suspendReload) {
  19038. sender.__suspendReload = false;
  19039. sender.reload();
  19040. }
  19041. }
  19042. });
  19043. _$2.defer(function () {
  19044. var ce = _this.findPlugin('cellediting');
  19045. ce.on({
  19046. beforeedit: function (editor, context, eOpts) {
  19047. me.fireEvent('editbefore', me, editor, context, eOpts);
  19048. },
  19049. canceledit: function (editor, context, eOpts) {
  19050. me.fireEvent('editcancel', me, editor, context, eOpts);
  19051. },
  19052. edit: function (editor, context, eOpts) {
  19053. me.fireEvent('editfinish', me, editor, context, eOpts);
  19054. },
  19055. validateedit: function (editor, context, eOpts) {
  19056. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19057. },
  19058. });
  19059. });
  19060. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19061. var reference = me.reference;
  19062. var scope = lookupScope(me);
  19063. var theid = _$2.get(config, 'behavior.theid');
  19064. if (theid && reference) {
  19065. if (!record) {
  19066. scope.viewModel.set(reference + '.theid', null);
  19067. }
  19068. else {
  19069. scope.viewModel.set(reference + '.theid', record.get(theid));
  19070. }
  19071. }
  19072. var theid2 = _$2.get(config, 'behavior.theid2');
  19073. if (theid2 && reference) {
  19074. if (!record) {
  19075. scope.viewModel.set(reference + '.theid2', null);
  19076. }
  19077. else {
  19078. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19079. }
  19080. }
  19081. var theid3 = _$2.get(config, 'behavior.theid3');
  19082. if (theid3 && reference) {
  19083. if (!record) {
  19084. scope.viewModel.set(reference + '.theid3', null);
  19085. }
  19086. else {
  19087. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19088. }
  19089. }
  19090. me.fireEvent('itemselect', sender, record);
  19091. }, 50);
  19092. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19093. // 为 stores.proxy.buildRequest 做准备
  19094. this.store.proxy.$owner = this;
  19095. }
  19096. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19097. if (selectToReload) {
  19098. // 点击后触发某个目标表格刷新
  19099. this.on({
  19100. itemselect: function (sender) {
  19101. if (_$2.isArray(selectToReload)) {
  19102. _$2.forEach(selectToReload, function (ref) {
  19103. if (ref) {
  19104. var ctlTarget = scope.refs[ref];
  19105. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19106. if (ctlTarget.isVisible()) {
  19107. ctlTarget.reload();
  19108. }
  19109. else {
  19110. ctlTarget.__suspendReload = true;
  19111. }
  19112. }
  19113. }
  19114. });
  19115. }
  19116. else if (_$2.isString(selectToReload)) {
  19117. var ctlTarget = scope.refs[selectToReload];
  19118. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19119. ctlTarget.reload();
  19120. }
  19121. }
  19122. }
  19123. });
  19124. }
  19125. this.superclass.initComponent.call(this);
  19126. },
  19127. // 生成列自定义的缓存key
  19128. makeColumnConfigCacheKey: function (config) {
  19129. var _a, _b, _c, _d, _e, _f;
  19130. 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);
  19131. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19132. if (config.reference) {
  19133. key += config.reference;
  19134. }
  19135. else {
  19136. var subKey = "";
  19137. for (var i = 0; i < config.columns.length; i++) {
  19138. var column = config.columns[i];
  19139. if (column.dataIndex) {
  19140. subKey += column.dataIndex;
  19141. }
  19142. }
  19143. key += subKey;
  19144. }
  19145. return key;
  19146. },
  19147. getColumnConfigCache: function () {
  19148. var key = this.columnConfigCacheKey;
  19149. var dataStr = localStorage.getItem(key);
  19150. if (dataStr) {
  19151. return JSON.parse(dataStr);
  19152. }
  19153. return "";
  19154. },
  19155. setColumnConfigCache: function () {
  19156. var key = this.columnConfigCacheKey;
  19157. var cacheData = [];
  19158. var columns = this.headerCt.getGridColumns();
  19159. var index = 0;
  19160. for (var i = 0; i < columns.length; i++) {
  19161. var column = columns[i];
  19162. if (column.dataIndex) {
  19163. cacheData.push({
  19164. dataIndex: column.dataIndex,
  19165. width: column.width,
  19166. hidden: column.hidden,
  19167. locked: column.locked,
  19168. index: index
  19169. });
  19170. index++;
  19171. }
  19172. }
  19173. localStorage.setItem(key, JSON.stringify(cacheData));
  19174. },
  19175. autoSizeColumns: function (sender) {
  19176. var grid = sender ? sender.up('grid') : this;
  19177. // const columns = grid.columns;
  19178. // for (let i = 0; i < columns.length; i++) {
  19179. // const column = columns[i];
  19180. // grid.getView().autoSizeColumn(column);
  19181. // column.setWidth(column.getWidth() + 5);
  19182. // }
  19183. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19184. grid.headerCt.getGridColumns()[i].autoSize(i);
  19185. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19186. }
  19187. },
  19188. clearFilter: function (sender) {
  19189. var grid = sender.up('grid');
  19190. grid.filters.clearFilters();
  19191. grid.getStore().sorters.removeAll();
  19192. // grid.getStore().reload()
  19193. },
  19194. saveGridUIConfig: function (sender) {
  19195. var grid = sender.up('grid');
  19196. grid.setColumnConfigCache();
  19197. msg('保存设置成功!');
  19198. },
  19199. clearGridUIConfig: function (sender) {
  19200. var grid = sender.up('grid');
  19201. var key = grid.columnConfigCacheKey;
  19202. localStorage.setItem(key, "");
  19203. msg('清空设置成功,重新打开后生效!');
  19204. },
  19205. setLoading: function (value) {
  19206. if (value) {
  19207. this.mask('读取中');
  19208. }
  19209. else {
  19210. this.unmask();
  19211. }
  19212. },
  19213. exportExcel: function (sender) {
  19214. var rect = sender.btnEl.dom.getBoundingClientRect();
  19215. var scope = lookupScope(this);
  19216. var grid = sender.up('grid');
  19217. var menuItems = [];
  19218. if (grid.dataSource.method === 'invoke' || grid.dataSource.sqlId) {
  19219. menuItems.push({
  19220. text: '大批量导出 (需要客户端支持!)',
  19221. iconCls: 'x-fa fa-download',
  19222. listeners: {
  19223. click: function (sender, value) {
  19224. // @ts-ignore
  19225. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19226. .then(function (res) {
  19227. grid.exportBigExcelClick();
  19228. });
  19229. }
  19230. }
  19231. });
  19232. menuItems.push('-');
  19233. }
  19234. menuItems.push({
  19235. text: '导出当前数据',
  19236. iconCls: 'x-fa fa-download',
  19237. listeners: {
  19238. click: function (sender, value) {
  19239. grid.exportCurrentExcelClick();
  19240. }
  19241. }
  19242. }, {
  19243. xtype: "textfield",
  19244. fieldLabel: '当前导出页',
  19245. maskRe: /[0-9]/,
  19246. value: grid.exportExcelCurrentPage,
  19247. listeners: {
  19248. render: function (sender) {
  19249. grid.exportExcelCurrentPageCmp = sender;
  19250. },
  19251. change: function (sender, value) {
  19252. var v = parseInt(value);
  19253. if (isNaN(v) || v === 0) {
  19254. window['system'].msg("页码不能为0");
  19255. v = 1;
  19256. sender.setValue(v);
  19257. }
  19258. var size = parseInt(grid.exportExcelPageSize);
  19259. var total = parseInt(grid.exportExcelTotal);
  19260. if (v > total / size) {
  19261. v = parseInt(total / size + "");
  19262. }
  19263. grid.exportExcelCurrentPage = v + "";
  19264. }
  19265. }
  19266. }, {
  19267. xtype: "textfield",
  19268. fieldLabel: '导出页大小',
  19269. maskRe: /[0-9]/,
  19270. value: grid.exportExcelPageSize,
  19271. listeners: {
  19272. render: function (sender) {
  19273. grid.exportExcelPageSizeCmp = sender;
  19274. },
  19275. change: function (sender, value) {
  19276. var v = parseInt(value);
  19277. if (isNaN(v) || v === 0) {
  19278. window['system'].msg("导出页大小不能为0");
  19279. v = defaultGrid.exportExcelPageSize;
  19280. sender.setValue(v);
  19281. }
  19282. if (v > 10000) {
  19283. window['system'].msg("导出页大小不能大于10000");
  19284. v = 10000;
  19285. sender.setValue(v);
  19286. }
  19287. var page = parseInt(grid.exportExcelCurrentPage);
  19288. var total = parseInt(grid.exportExcelTotal);
  19289. if (page > total / v) {
  19290. page = parseInt(total / v + "") + 1;
  19291. grid.exportExcelCurrentPageCmp.setValue(page);
  19292. }
  19293. grid.exportExcelPageSize = v + "";
  19294. }
  19295. }
  19296. }, {
  19297. xtype: "textfield",
  19298. fieldLabel: '总条数',
  19299. value: grid.exportExcelTotal,
  19300. readOnly: true
  19301. }, {
  19302. text: '导出',
  19303. iconCls: 'x-fa fa-download',
  19304. listeners: {
  19305. click: function (sender, value) {
  19306. grid.exportExcelClick({
  19307. exportExcelPageSize: grid.exportExcelPageSize,
  19308. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19309. });
  19310. }
  19311. }
  19312. });
  19313. var treeMenu = new Ext.menu.Menu({
  19314. xtype: 'menu',
  19315. floated: false,
  19316. width: 300,
  19317. docked: 'left',
  19318. items: menuItems
  19319. });
  19320. treeMenu.showAt(rect.left, rect.top - 120);
  19321. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19322. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19323. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19324. // }
  19325. },
  19326. /**
  19327. * 获取表格编辑的行数据
  19328. */
  19329. getGridEditRows: function () {
  19330. var grid = this;
  19331. var store = grid.getStore();
  19332. var rows = [];
  19333. var modifyRows = [];
  19334. var newRows = [];
  19335. var err = "";
  19336. var records = store.getModifiedRecords();
  19337. var newRecords = store.getNewRecords();
  19338. var removeRecords = [];
  19339. _$2.forEach(store.getRemovedRecords(), function (row) {
  19340. removeRecords.push(row.data);
  19341. });
  19342. _$2.forEach(records, function (record) {
  19343. var colums = grid.columns;
  19344. var errFunc = undefined;
  19345. _$2.forEach(colums, function (col) {
  19346. var name = col.dataIndex;
  19347. var value = record.data[name];
  19348. var colIndex = col.getIndex(); //获得列号
  19349. var rowIndex = store.indexOfId(record.id); //获得行号
  19350. var editor = col.getEditor(); //使用的编辑器
  19351. var tmpErrFunc = function () {
  19352. var text = col.text || col.name;
  19353. msg(text + ' 校验失败, 请确保输入的数据正确');
  19354. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19355. };
  19356. if (editor && !editor.allowBlank && isEmpty(value)) {
  19357. errFunc = tmpErrFunc;
  19358. return false;
  19359. }
  19360. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19361. errFunc = tmpErrFunc;
  19362. return false;
  19363. }
  19364. });
  19365. if (typeof errFunc === 'function') {
  19366. err = "1";
  19367. _$2.remove(rows, function (n) {
  19368. return true;
  19369. });
  19370. //@ts-ignore
  19371. errFunc();
  19372. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19373. return false;
  19374. }
  19375. else {
  19376. if (_$2.findIndex(newRecords, function (item) {
  19377. return item === record;
  19378. }) >= 0) {
  19379. newRows.push(record.data);
  19380. }
  19381. else {
  19382. modifyRows.push(record.data);
  19383. }
  19384. rows.push(record.data);
  19385. }
  19386. });
  19387. return {
  19388. rows: rows,
  19389. newRows: newRows,
  19390. modifyRows: modifyRows,
  19391. removeRecords: removeRecords,
  19392. err: err
  19393. };
  19394. }
  19395. // reload() {
  19396. // dataSourceReload(this)
  19397. // },
  19398. });
  19399. }
  19400. /**
  19401. * 获取 columns 中所有的 dataIndex
  19402. */
  19403. function getFileds(newConfig) {
  19404. var fields = [];
  19405. _$2.forEach(newConfig.columns, function (c) {
  19406. if (c.dataIndex) {
  19407. fields.push(c.dataIndex);
  19408. }
  19409. });
  19410. return fields;
  19411. }
  19412. function convertDataSource$1(sender, scope, newConfig) {
  19413. if (typeof newConfig.store !== 'undefined') {
  19414. // 有 store 属性的情况下,不做任何事
  19415. return;
  19416. }
  19417. if (typeof newConfig.dataSource === 'undefined') {
  19418. // 没有定义 dataSource 的情况下,不做任何事
  19419. return;
  19420. }
  19421. if (_$2.isArray(newConfig.data)) {
  19422. // 有 data 属性赋值的情况下
  19423. newConfig.store = {
  19424. fields: getFileds(newConfig),
  19425. data: newConfig.data
  19426. };
  19427. delete newConfig.data;
  19428. return;
  19429. }
  19430. var dataSource = newConfig.dataSource;
  19431. if (typeof dataSource === 'string') {
  19432. // dataSource 是字符串的情况下,找到成员函数
  19433. dataSource = lookupFn(scope, dataSource);
  19434. }
  19435. if (typeof dataSource === 'function') {
  19436. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19437. newConfig.store = new Ext.data.Store({
  19438. fields: getFileds(newConfig),
  19439. // data: [],
  19440. autoLoad: true,
  19441. proxy: {
  19442. type: 'memory',
  19443. data: [],
  19444. }
  19445. });
  19446. newConfig.dataSourceCallbackFn = dataSource;
  19447. return;
  19448. }
  19449. // throw new TypeError('无法识别的调用方法')
  19450. }
  19451. //# sourceMappingURL=grid.js.map
  19452. function initTextfield () {
  19453. var cc = Ext.form.field.Text.prototype.constructor;
  19454. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19455. Ext.form.field.Text.override({
  19456. constructor: function (config) {
  19457. var newConfig = _$2.defaultsDeep({
  19458. // 强制属性
  19459. triggers: {
  19460. clear: {
  19461. weight: -1,
  19462. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19463. hidden: true,
  19464. handler: 'onClearClick',
  19465. },
  19466. }
  19467. }, baseConfig(config, 'col-item'), config, text);
  19468. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19469. newConfig.enableKeyEvents = true;
  19470. }
  19471. cc.call(this, newConfig);
  19472. },
  19473. /**
  19474. * 清空所有值
  19475. */
  19476. onClearClick: function (sender, e) {
  19477. var me = this;
  19478. me.setValue('');
  19479. },
  19480. /**
  19481. * 尝试获取下一个要获取焦点的控件
  19482. */
  19483. _raiseNextFocus: function (sender) {
  19484. var config = sender.config;
  19485. var scope = lookupScope(sender);
  19486. if (typeof config.nextFocus === 'function') {
  19487. config.nextFocus(sender);
  19488. }
  19489. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19490. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19491. var fn = lookupFn(scope, config.nextFocus);
  19492. if (typeof fn === 'function') {
  19493. var nextCtlReference = fn(sender);
  19494. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19495. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19496. if (ctl) {
  19497. if (typeof ctl.focus2 === 'function') {
  19498. ctl.focus2();
  19499. }
  19500. else {
  19501. ctl.focus();
  19502. }
  19503. }
  19504. }
  19505. }
  19506. }
  19507. else {
  19508. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19509. if (ctl) {
  19510. if (typeof ctl.focus2 === 'function') {
  19511. ctl.focus2();
  19512. }
  19513. else {
  19514. ctl.focus();
  19515. }
  19516. }
  19517. }
  19518. }
  19519. },
  19520. initComponent: function () {
  19521. /**
  19522. * 改变必填项之前加星号
  19523. */
  19524. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19525. // this.beforeLabelTextTpl = [
  19526. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19527. // ];
  19528. this.afterLabelTextTpl = [
  19529. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19530. ];
  19531. }
  19532. var me = this;
  19533. this.on({
  19534. change: function (sender, newVal) {
  19535. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19536. if (hideTrigger || disabled || readOnly || hideClear) {
  19537. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19538. return;
  19539. }
  19540. var value = newVal;
  19541. if (value) {
  19542. me.getTrigger('clear').show();
  19543. me.updateLayout();
  19544. }
  19545. else {
  19546. me.getTrigger('clear').hide();
  19547. me.updateLayout();
  19548. }
  19549. },
  19550. afterrender: function (sender) {
  19551. var _this = this;
  19552. var _a;
  19553. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19554. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19555. $$2(sender.inputEl.dom).on('click', function (e) {
  19556. sender.fireEvent('click', _this, e);
  19557. });
  19558. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19559. var _a, _b, _c, _d;
  19560. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19561. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19562. if (sender.isExpanded === true) {
  19563. // 弹开下拉框的基础上,不干预上下选择
  19564. return;
  19565. }
  19566. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19567. var grid = sender.ownerCt.up('grid');
  19568. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19569. if (editingPlugin) {
  19570. 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;
  19571. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19572. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19573. // editingPlugin
  19574. var targetRecord = void 0;
  19575. if (e.code === 'ArrowDown') {
  19576. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19577. }
  19578. else {
  19579. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19580. }
  19581. if (targetRecord) {
  19582. grid.setSelection([targetRecord]);
  19583. editingPlugin.startEdit(targetRecord, column);
  19584. }
  19585. e.stopPropagation();
  19586. e.preventDefault();
  19587. }
  19588. }
  19589. }
  19590. }
  19591. });
  19592. }
  19593. var config = sender.config;
  19594. if (config.ff && config.ff > 0) {
  19595. setTimeout(function () {
  19596. if (typeof sender.focus2 === 'function') {
  19597. sender.focus2();
  19598. }
  19599. else {
  19600. sender.focus();
  19601. }
  19602. }, config.ff);
  19603. }
  19604. }
  19605. });
  19606. var config = this.config;
  19607. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19608. this.on({
  19609. keyup: function (sender, e) {
  19610. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19611. sender._raiseNextFocus(sender);
  19612. }
  19613. }
  19614. });
  19615. }
  19616. var that = this;
  19617. this.on({
  19618. keyup: function (sender, e, eOpts) {
  19619. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19620. return;
  19621. }
  19622. that.keydown_fun_item(sender, e, eOpts);
  19623. }
  19624. });
  19625. initComponent.call(this);
  19626. },
  19627. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19628. var that = sender;
  19629. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19630. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19631. var value = _$2.trim(sender.rawValue);
  19632. var r = that.fireEvent('scancode', that, value, event);
  19633. if (r === 'OK') {
  19634. // 停止事件的默认处理程序,停止事件的冒泡
  19635. // event.stopEvent();
  19636. event.preventDefault();
  19637. event.stopPropagation();
  19638. }
  19639. }
  19640. }, 100)
  19641. });
  19642. }
  19643. //# sourceMappingURL=textfield.js.map
  19644. function initTbFill () {
  19645. /**
  19646. *
  19647. */
  19648. var ct = Ext.toolbar.Fill.prototype.constructor;
  19649. Ext.toolbar.Fill.override({
  19650. constructor: function (config) {
  19651. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19652. ct.call(this, newConfig);
  19653. }
  19654. });
  19655. }
  19656. //# sourceMappingURL=tbfill.js.map
  19657. function initTbSeparator () {
  19658. /**
  19659. *
  19660. */
  19661. var ct = Ext.toolbar.Separator.prototype.constructor;
  19662. Ext.toolbar.Separator.override({
  19663. constructor: function (config) {
  19664. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19665. ct.call(this, newConfig);
  19666. }
  19667. });
  19668. }
  19669. //# sourceMappingURL=tbseparator.js.map
  19670. function initToolbar () {
  19671. /**
  19672. *
  19673. */
  19674. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19675. Ext.toolbar.Toolbar.override({
  19676. constructor: function (config) {
  19677. var newConfig = _$2.defaultsDeep({
  19678. // 强制性属性
  19679. }, baseConfig(config, 'cols-container'), config, toolbar);
  19680. ct.call(this, newConfig);
  19681. }
  19682. });
  19683. initTbFill();
  19684. initTbSeparator();
  19685. }
  19686. //# sourceMappingURL=toolbar.js.map
  19687. function initSplitter () {
  19688. var ct = Ext.resizer.Splitter.prototype.constructor;
  19689. Ext.resizer.Splitter.override({
  19690. constructor: function (config) {
  19691. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19692. ct.call(this, newConfig);
  19693. }
  19694. });
  19695. }
  19696. //# sourceMappingURL=splitter.js.map
  19697. /**
  19698. * 通用 dataSource 解析,
  19699. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19700. */
  19701. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19702. var config = ctl.config;
  19703. return new Promise(function (resolve, reject) {
  19704. if (!config.dataSource) {
  19705. // 没有设置数据源,直接置空
  19706. return Promise.resolve();
  19707. }
  19708. var option = {
  19709. extraParam: extraParam,
  19710. _successCb: _successCb,
  19711. successCallback: function (value) {
  19712. if (typeof successCallback === "function") {
  19713. successCallback(value);
  19714. }
  19715. else {
  19716. ctl.setData(value);
  19717. }
  19718. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19719. ctl.setLoading(false);
  19720. resolve(value);
  19721. },
  19722. failCallback: function (error) {
  19723. if (typeof failCallback === "function") {
  19724. failCallback(error);
  19725. }
  19726. ctl.fireEvent('dataLoadComplete', ctl, false);
  19727. ctl.setLoading(false);
  19728. reject(error);
  19729. }
  19730. };
  19731. // 请求前要求确认一下
  19732. var isCanceled = false;
  19733. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19734. isCanceled = true;
  19735. } }, option));
  19736. if (!isCanceled) {
  19737. // 请求没有被取消
  19738. // 调用异步接口返回 Promise
  19739. return _innerReload(ctl, option);
  19740. }
  19741. return reject();
  19742. });
  19743. }
  19744. function _innerReload(ctl, option) {
  19745. var config = ctl.config;
  19746. ctl.setLoading(true);
  19747. var scope = lookupScope(ctl);
  19748. var dataSource = config.dataSource;
  19749. if (typeof dataSource == 'string') {
  19750. dataSource = lookupFn(scope, config.dataSource);
  19751. }
  19752. if (typeof dataSource === 'function') {
  19753. // @ts-ignore
  19754. dataSource.call(scope, ctl, option);
  19755. return;
  19756. }
  19757. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19758. if (!ajax.func) {
  19759. console.error("没有配置 ajax");
  19760. return;
  19761. }
  19762. var params_1 = {};
  19763. var sortModel = null;
  19764. var filterModel = null;
  19765. if (option.extraParam && option.extraParam.filterModel) {
  19766. filterModel = option.extraParam.filterModel;
  19767. }
  19768. if (option.extraParam && option.extraParam.sortModel) {
  19769. sortModel = option.extraParam.sortModel;
  19770. }
  19771. _$2.forOwn(option.extraParam, function (v, key) {
  19772. if (key != "filterModel" && key != "sortModel") {
  19773. if (typeof v === 'function') {
  19774. params_1[key] = v();
  19775. }
  19776. else {
  19777. params_1[key] = v;
  19778. }
  19779. }
  19780. });
  19781. var ds = dataSource;
  19782. _$2.forOwn(ds.params, function (v, key) {
  19783. if (typeof v === 'function') {
  19784. params_1[key] = v();
  19785. }
  19786. else {
  19787. params_1[key] = v;
  19788. }
  19789. });
  19790. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19791. // @ts-ignore
  19792. ajax.func({
  19793. method: dataSource.method,
  19794. url: ds.url,
  19795. data: params_1,
  19796. filterModel: filterModel,
  19797. sortModel: sortModel,
  19798. }).then(function (res) {
  19799. if (res.success) {
  19800. option.successCallback(res.data);
  19801. }
  19802. else {
  19803. option.failCallback(res.msg);
  19804. }
  19805. }).catch(function (e) {
  19806. option.failCallback(e);
  19807. });
  19808. }
  19809. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19810. var ds_1 = ctl.dataSource;
  19811. // @ts-ignore
  19812. Extend.ajax.func({
  19813. url: ds_1.sqlId,
  19814. data: params_1,
  19815. db: ds_1.db,
  19816. method: 'sql',
  19817. filterModel: filterModel,
  19818. sortModel: sortModel,
  19819. }).then(function (res) {
  19820. if (res.success) {
  19821. option.successCallback(res.data);
  19822. }
  19823. else {
  19824. option.failCallback(res.msg);
  19825. }
  19826. }).catch(function (e) {
  19827. option.failCallback(e);
  19828. }).finally(function () {
  19829. ctl.loading = false;
  19830. });
  19831. return;
  19832. }
  19833. else {
  19834. console.error("非法的 dataSource", ctl.dataSource);
  19835. debugger;
  19836. throw new Error("非法的 dataSource");
  19837. }
  19838. }
  19839. }
  19840. //# sourceMappingURL=DataSourceHelper.js.map
  19841. function initCombo () {
  19842. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19843. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19844. Ext.form.field.ComboBox.override({
  19845. constructor: function (config) {
  19846. var newConfig = _$2.defaultsDeep({
  19847. // 强制性属性
  19848. }, baseConfig(config, 'col-item'), config, combo);
  19849. if (typeof config.dict === 'string') {
  19850. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19851. }
  19852. else if (typeof newConfig.store == 'undefined') {
  19853. if (_$2.isArray(newConfig.data)) {
  19854. // ExtJS 无法直接接受数组模式
  19855. newConfig.store = {
  19856. fields: [newConfig.valueField, newConfig.displayField],
  19857. data: newConfig.data
  19858. };
  19859. delete newConfig.data;
  19860. }
  19861. else if (typeof newConfig.data !== 'object') {
  19862. newConfig.store = {
  19863. fields: [newConfig.valueField, newConfig.displayField],
  19864. data: []
  19865. };
  19866. delete newConfig.data;
  19867. }
  19868. }
  19869. cc.call(this, newConfig);
  19870. },
  19871. setDict: function (bizKey) {
  19872. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19873. this.dict = bizKey;
  19874. },
  19875. getDict: function () {
  19876. return this.dict;
  19877. },
  19878. setData: function (value) {
  19879. if (!value) {
  19880. return;
  19881. }
  19882. var config = value.config;
  19883. if (!this.store) {
  19884. this.store = new Ext.data.Store({
  19885. fields: [config.valueField, config.displayField],
  19886. data: value
  19887. });
  19888. }
  19889. else {
  19890. this.store.getProxy().setData(value);
  19891. this.store.load();
  19892. }
  19893. },
  19894. setLoading: function (value) {
  19895. if (value) {
  19896. if (!this.loadMask) {
  19897. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19898. }
  19899. }
  19900. else {
  19901. if (this.loadMask) {
  19902. this.loadMask.destroy();
  19903. delete this.loadMask;
  19904. }
  19905. }
  19906. },
  19907. reload: function () {
  19908. dataSourceReload(this);
  19909. },
  19910. initComponent: function () {
  19911. var that = this;
  19912. var toggle = function (e) {
  19913. var readOnly = that.readOnly, disabled = that.disabled;
  19914. if (readOnly || disabled) {
  19915. return;
  19916. }
  19917. if ($(e.target).is('.x-form-trigger')) {
  19918. return;
  19919. }
  19920. // 点击后下拉
  19921. if (that.isExpanded) {
  19922. that.collapse();
  19923. }
  19924. else {
  19925. that.expand();
  19926. that.doQuery(that.allQuery, true);
  19927. }
  19928. };
  19929. this.on({
  19930. afterrender: function (sender) {
  19931. var config = this.config;
  19932. if (config.dataSource && config.autoLoad) {
  19933. dataSourceReload(this);
  19934. }
  19935. // 点击后下拉
  19936. $(this.el.dom).on('click', toggle.bind(this));
  19937. },
  19938. focusenter: function (sender, event, opt) {
  19939. var _a;
  19940. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19941. // 表格内编辑框,获取焦点后自动弹开
  19942. toggle.call(this, event);
  19943. }
  19944. },
  19945. destory: function () {
  19946. $(this.el.dom).off('click', toggle.bind(this));
  19947. },
  19948. beforequery: function (context) {
  19949. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19950. // console.log('beforequery', query)
  19951. if (!forceAll && query) {
  19952. combo.store.clearFilter();
  19953. combo.store.filterBy(function (record, id) {
  19954. var text = record.get(combo.displayField);
  19955. // 用拼音筛选的方式
  19956. return keywordFilter(query, text, id);
  19957. });
  19958. combo.expand();
  19959. return false;
  19960. }
  19961. combo.store.clearFilter();
  19962. combo.expand();
  19963. return false;
  19964. },
  19965. });
  19966. initComponent.call(this);
  19967. },
  19968. focus2: function () {
  19969. this.focus();
  19970. var that = this;
  19971. _$2.defer(function () {
  19972. if (that.isExpanded) {
  19973. that.collapse();
  19974. }
  19975. else {
  19976. that.expand();
  19977. that.doQuery(that.allQuery, true);
  19978. }
  19979. });
  19980. }
  19981. });
  19982. }
  19983. //# sourceMappingURL=combo.js.map
  19984. /**
  19985. xtype: 'tagfield',
  19986. displayField: 'show',
  19987. valueField: 'id',
  19988. queryMode: 'local',
  19989. filterPickList: true,
  19990. store: {
  19991. fields: ['id', 'show'],
  19992. data: [
  19993. {id: 0, show: 'Battlestar Galactica'},
  19994. {id: 1, show: 'Doctor Who'},
  19995. {id: 2, show: 'Farscape'},
  19996. {id: 3, show: 'Firefly'},
  19997. {id: 4, show: 'Star Trek'},
  19998. {id: 5, show: 'Star Wars: Christmas Special'}
  19999. ]
  20000. }
  20001. */
  20002. function initTag () {
  20003. var cc = Ext.form.field.Tag.prototype.constructor;
  20004. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20005. Ext.form.field.Tag.override({
  20006. constructor: function (config) {
  20007. var newConfig = _$2.defaultsDeep({
  20008. // 强制性属性
  20009. }, baseConfig(config, 'col-item'), config, tagfield);
  20010. if (typeof config.dict === 'string') {
  20011. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20012. }
  20013. else if (typeof newConfig.store == 'undefined') {
  20014. if (_$2.isArray(newConfig.data)) {
  20015. // ExtJS 无法直接接受数组模式
  20016. newConfig.store = {
  20017. fields: [newConfig.valueField, newConfig.displayField],
  20018. data: newConfig.data
  20019. };
  20020. delete newConfig.data;
  20021. }
  20022. else if (typeof newConfig.data !== 'object') {
  20023. newConfig.store = {
  20024. fields: [newConfig.valueField, newConfig.displayField],
  20025. data: []
  20026. };
  20027. delete newConfig.data;
  20028. }
  20029. }
  20030. cc.call(this, newConfig);
  20031. },
  20032. setDict: function (bizKey) {
  20033. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20034. this.dict = bizKey;
  20035. },
  20036. getDict: function () {
  20037. return this.dict;
  20038. },
  20039. setData: function (value) {
  20040. if (!value) {
  20041. return;
  20042. }
  20043. var config = value.config;
  20044. if (!this.store) {
  20045. this.store = new Ext.data.Store({
  20046. fields: [config.valueField, config.displayField],
  20047. data: value
  20048. });
  20049. }
  20050. else {
  20051. this.store.getProxy().setData(value);
  20052. this.store.load();
  20053. }
  20054. },
  20055. setLoading: function (value) {
  20056. if (value) {
  20057. if (!this.loadMask) {
  20058. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20059. }
  20060. }
  20061. else {
  20062. if (this.loadMask) {
  20063. this.loadMask.destroy();
  20064. delete this.loadMask;
  20065. }
  20066. }
  20067. },
  20068. reload: function () {
  20069. dataSourceReload(this);
  20070. },
  20071. initComponent: function () {
  20072. var that = this;
  20073. var toggle = function (e) {
  20074. var readOnly = that.readOnly, disabled = that.disabled;
  20075. if (readOnly || disabled) {
  20076. return;
  20077. }
  20078. if ($(e.target).is('.x-form-trigger')) {
  20079. return;
  20080. }
  20081. // 点击后下拉
  20082. if (that.isExpanded) {
  20083. that.collapse();
  20084. }
  20085. else {
  20086. that.expand();
  20087. that.doQuery(that.allQuery, true);
  20088. }
  20089. };
  20090. this.on({
  20091. afterrender: function (sender) {
  20092. var config = this.config;
  20093. if (config.dataSource && config.autoLoad) {
  20094. dataSourceReload(this);
  20095. }
  20096. // 点击后下拉
  20097. $(this.el.dom).on('click', toggle.bind(this));
  20098. },
  20099. focusenter: function (sender, event, opt) {
  20100. var _a;
  20101. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20102. // 表格内编辑框,获取焦点后自动弹开
  20103. toggle.call(this, event);
  20104. }
  20105. },
  20106. destory: function () {
  20107. $(this.el.dom).off('click', toggle.bind(this));
  20108. },
  20109. });
  20110. initComponent.call(this);
  20111. },
  20112. focus2: function () {
  20113. this.focus();
  20114. var that = this;
  20115. _$2.defer(function () {
  20116. if (that.isExpanded) {
  20117. that.collapse();
  20118. }
  20119. else {
  20120. that.expand();
  20121. that.doQuery(that.allQuery, true);
  20122. }
  20123. });
  20124. }
  20125. });
  20126. }
  20127. //# sourceMappingURL=tagfield.js.map
  20128. function initComboGridMulti () {
  20129. Ext.define('Yvan.LocalComboGrid', {
  20130. extend: 'Ext.form.field.Picker',
  20131. // extend: 'Yvan.PickerAlignCenter',
  20132. xtype: 'combogridmulti',
  20133. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20134. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20135. editable: false,
  20136. initComponent: function () {
  20137. this.on({
  20138. afterrender: function () {
  20139. var config = this.config;
  20140. if (config.dataSource && config.autoLoad) {
  20141. dataSourceReload(this);
  20142. }
  20143. },
  20144. });
  20145. this.superclass.initComponent.apply(this, arguments);
  20146. },
  20147. setStore: function (store) {
  20148. this.store = store;
  20149. var me = this;
  20150. if (me.store) {
  20151. if (me.picker) {
  20152. me.picker.setStore(store);
  20153. if (me.isExpanded) {
  20154. me.collapse();
  20155. delete me.picker;
  20156. me.expand();
  20157. }
  20158. }
  20159. this.onLoad();
  20160. me.mon(me.store, {
  20161. scope: me,
  20162. load: me.onLoad,
  20163. update: me.onUpdate
  20164. });
  20165. }
  20166. },
  20167. reload: function () {
  20168. dataSourceReload(this);
  20169. },
  20170. setData: function (value) {
  20171. var me = this;
  20172. var config = me.config;
  20173. if (!value) {
  20174. return;
  20175. }
  20176. if (!this.store) {
  20177. this.store = new Ext.data.Store({
  20178. fields: [config.valueField, config.displayField],
  20179. data: value
  20180. });
  20181. }
  20182. else {
  20183. this.store.getProxy().setData(value);
  20184. this.store.load();
  20185. }
  20186. this.onLoad();
  20187. },
  20188. createPicker: function () {
  20189. var me = this;
  20190. 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: {
  20191. scope: me,
  20192. selectionchange: me.onSelectionChange,
  20193. itemkeydown: me.onPickerKeyDown
  20194. } })), view = picker.getView();
  20195. if (Ext.isIE9 && Ext.isStrict) {
  20196. view.on({
  20197. scope: me,
  20198. highlightitem: me.repaintPickerView,
  20199. unhighlightitem: me.repaintPickerView,
  20200. afteritemexpand: me.repaintPickerView,
  20201. afteritemcollapse: me.repaintPickerView
  20202. });
  20203. }
  20204. return picker;
  20205. },
  20206. repaintPickerView: function () {
  20207. var style = this.picker.getView().getEl().dom.style;
  20208. style.display = style.display;
  20209. },
  20210. onSelectionChange: function (view, record, node, rowIndex, e) {
  20211. this.selectItem(view, record);
  20212. },
  20213. onPickerKeyDown: function (treeView, record, item, index, e) {
  20214. var key = e.getKey();
  20215. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20216. this.selectItem(treeView, record);
  20217. }
  20218. },
  20219. selectItem: function (sender, record) {
  20220. var me = this;
  20221. var ids = [];
  20222. _$2.forEach(me.picker.getSelection(), function (record) {
  20223. ids.push(record.get(me.valueField));
  20224. });
  20225. me.fireEvent('select', me, record);
  20226. me.setValue(ids.join(me.splitChar));
  20227. // me.collapse();
  20228. },
  20229. onExpand: function () {
  20230. var me = this;
  20231. var picker = this.picker;
  20232. var value = this.value;
  20233. if (!me.store) {
  20234. msg('正在初始化数据,请稍后');
  20235. me.collapse();
  20236. return;
  20237. }
  20238. var vs = _$2.split(value, me.splitChar);
  20239. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20240. picker.setSelection(records);
  20241. },
  20242. setValue: function (value) {
  20243. var me = this;
  20244. console.log('setValue', value);
  20245. me.value = value;
  20246. if (!me.store || me.store.loading) {
  20247. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20248. return me.mixins.field.setValue.call(me, value);
  20249. // return me;
  20250. }
  20251. var vs = _$2.split(value, me.splitChar);
  20252. var displayValues = [];
  20253. _$2.forEach(vs, function (v) {
  20254. var _a;
  20255. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20256. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20257. if (dv) {
  20258. displayValues.push(dv);
  20259. }
  20260. else {
  20261. displayValues.push(v);
  20262. }
  20263. });
  20264. // set the raw value to the record's display field if a record was found
  20265. me.setRawValue(displayValues.join(me.splitChar));
  20266. return me.mixins.field.setValue.call(me, value);
  20267. },
  20268. getSubmitValue: function () {
  20269. return this.value;
  20270. },
  20271. getValue: function () {
  20272. return this.value;
  20273. },
  20274. onLoad: function () {
  20275. var value = this.value;
  20276. if (value) {
  20277. this.setValue(value);
  20278. }
  20279. },
  20280. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20281. var display = this.displayField;
  20282. var me = this;
  20283. if (type === 'edit' && modifiedFieldNames &&
  20284. Ext.Array.contains(modifiedFieldNames, display) &&
  20285. this.value === rec.getId()) {
  20286. me.mixins.field.setValue.call(me, this.value);
  20287. this.setRawValue(rec.get(display));
  20288. }
  20289. }
  20290. });
  20291. }
  20292. //# sourceMappingURL=combogridmulti.js.map
  20293. function initSearch () {
  20294. Ext.define('Yvan.Search', {
  20295. extend: 'Ext.form.field.Text',
  20296. alias: 'widget.searchfield',
  20297. xtype: 'searchfield',
  20298. constructor: function (config) {
  20299. var self = this;
  20300. var newConfig = _$2.defaultsDeep({
  20301. // 强制性属性
  20302. triggers: {
  20303. clear: {
  20304. weight: 0,
  20305. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20306. hidden: true,
  20307. handler: 'onClearClick',
  20308. },
  20309. search: {
  20310. weight: 1,
  20311. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20312. handler: 'onSearchClick'
  20313. },
  20314. },
  20315. listeners: {
  20316. blur: function (sender, e) {
  20317. this.revertOnblur();
  20318. },
  20319. specialkey: function (sender, e) {
  20320. var _a;
  20321. var me = this;
  20322. if (e.getKey() === e.ENTER) {
  20323. me.onSearchClick(sender, {}, e);
  20324. return;
  20325. }
  20326. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20327. },
  20328. afterrender: function (sender, e) {
  20329. var _a;
  20330. this.replaceRawInputEvent();
  20331. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20332. }
  20333. },
  20334. }, baseConfig(config, 'col-item'), config, search);
  20335. this.superclass.constructor.call(self, newConfig);
  20336. },
  20337. revertOnblur: function () {
  20338. this.setRawValue(this.lastValue);
  20339. },
  20340. onSearchClick: function (sender, vv, e) {
  20341. var me = this;
  20342. var config = me.config;
  20343. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20344. if (e) {
  20345. e.preventDefault();
  20346. e.stopPropagation();
  20347. }
  20348. this.fireEvent('search', sender, e);
  20349. if (!widget) {
  20350. return;
  20351. }
  20352. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20353. },
  20354. replaceRawInputEvent: function () {
  20355. var me = this;
  20356. var $dom = $(me.inputEl.dom);
  20357. $dom.on('input', function (e) {
  20358. stopEvent(e);
  20359. // console.log('has input', e)
  20360. });
  20361. $dom.on('keyup', function (e) {
  20362. if (e.key === "Enter") {
  20363. me.onSearchClick(me, {}, e);
  20364. return;
  20365. }
  20366. stopEvent(e);
  20367. });
  20368. $dom.on('change', function (e) {
  20369. stopEvent(e);
  20370. });
  20371. },
  20372. onChange: function (newVal, oldVal) {
  20373. var me = this;
  20374. var value = newVal;
  20375. if (value) {
  20376. me.getTrigger('clear').show();
  20377. me.updateLayout();
  20378. }
  20379. else {
  20380. me.getTrigger('clear').hide();
  20381. me.updateLayout();
  20382. }
  20383. },
  20384. /**
  20385. * 清空所有值
  20386. */
  20387. onClearClick: function (sender, e) {
  20388. var me = this;
  20389. var config = me.config;
  20390. var lookup = config.lookup;
  20391. me.setValue('');
  20392. clearViewModelByLookup(sender, lookup);
  20393. }
  20394. });
  20395. }
  20396. //# sourceMappingURL=search.js.map
  20397. function initMultipleSearch () {
  20398. Ext.define('Yvan.MultipleSearch', {
  20399. extend: 'Ext.form.field.Text',
  20400. xtype: 'multiplesearch',
  20401. bindTargert: '',
  20402. constructor: function (config) {
  20403. var _a, _b, _c, _d;
  20404. var self = this;
  20405. var newConfig = _$2.defaultsDeep({
  20406. // 强制性属性
  20407. triggers: {
  20408. clear: {
  20409. weight: 0,
  20410. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20411. hidden: true,
  20412. handler: 'onClearClick',
  20413. }
  20414. },
  20415. transformRawValue: function (o) {
  20416. return o;
  20417. },
  20418. listeners: {
  20419. specialkey: function (sender, e) {
  20420. var me = this;
  20421. if (e.getKey() === e.ENTER) {
  20422. me.fireEvent('search', me, e);
  20423. }
  20424. },
  20425. afterrender: function (sender, e) {
  20426. var _a;
  20427. this.replaceRawInputEvent();
  20428. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20429. }
  20430. },
  20431. }, baseConfig(config, 'col-item'), config, search);
  20432. this.superclass.constructor.call(self, newConfig);
  20433. 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 : '';
  20434. vv = _$2.replace(vv, "{", "");
  20435. vv = _$2.replace(vv, "}", "");
  20436. this.bindTargert = vv;
  20437. this.bindTargert = _$2.trim(this.bindTargert);
  20438. },
  20439. setBindValue: function (arrValue) {
  20440. if (this.bindTargert) {
  20441. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20442. }
  20443. },
  20444. replaceRawInputEvent: function () {
  20445. var me = this;
  20446. var $dom = $(me.inputEl.dom);
  20447. $dom.on('input', function (e) {
  20448. var _a, _b, _c, _d, _e, _f;
  20449. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20450. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20451. if (!a.endsWith(",") && a.length > 0) {
  20452. e.currentTarget.value = a + ",";
  20453. }
  20454. else {
  20455. e.currentTarget.value = a;
  20456. }
  20457. }
  20458. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20459. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20460. _$2.remove(arr, function (it) {
  20461. return !it;
  20462. });
  20463. me.setBindValue(arr);
  20464. stopEvent(e);
  20465. });
  20466. $dom.on('keyup', function (e) {
  20467. me.fireEvent('keyup', me, e);
  20468. // invokeMethod(me.config.listeners?.keyup, me, e)
  20469. stopEvent(e);
  20470. });
  20471. $dom.on('keydown', function (e) {
  20472. me.fireEvent('keydown', me, e);
  20473. // invokeMethod(me.config.listeners?.keydown, me, e)
  20474. //stopEvent(e)
  20475. });
  20476. $dom.on('change', function (e) {
  20477. stopEvent(e);
  20478. });
  20479. $dom.on('paste', function (e) {
  20480. var _a;
  20481. // @ts-ignore
  20482. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20483. var text = clipdata.getData("text/plain");
  20484. var spliter = ',';
  20485. text = text.replaceAll("\r", "");
  20486. text = text.replaceAll("\n", spliter);
  20487. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20488. var arr = text.split(spliter);
  20489. if (arr && Array.isArray(arr)) {
  20490. for (var i = 0; i < arr.length; i++) {
  20491. arr[i] = _$2.trim(arr[i]);
  20492. }
  20493. }
  20494. _$2.remove(arr, function (it) {
  20495. return !it;
  20496. });
  20497. me.setBindValue(arr);
  20498. stopEvent(e);
  20499. });
  20500. },
  20501. onChange: function (newVal, oldVal) {
  20502. var me = this;
  20503. var value = newVal;
  20504. if (value) {
  20505. me.getTrigger('clear').show();
  20506. me.updateLayout();
  20507. }
  20508. else {
  20509. me.getTrigger('clear').hide();
  20510. me.updateLayout();
  20511. }
  20512. },
  20513. /**
  20514. * 清空所有值
  20515. */
  20516. onClearClick: function (sender, e) {
  20517. var me = this;
  20518. var config = me.config;
  20519. var lookup = config.lookup;
  20520. me.setValue('');
  20521. clearViewModelByLookup(sender, lookup);
  20522. }
  20523. });
  20524. }
  20525. //# sourceMappingURL=multiplesearch.js.map
  20526. function initDate () {
  20527. var cc = Ext.form.field.Date.prototype.constructor;
  20528. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20529. Ext.form.field.Date.override({
  20530. format: 'Y-m-d',
  20531. altFormats: 'Y-m-d',
  20532. constructor: function (config) {
  20533. var newConfig = _$2.defaultsDeep({
  20534. // 强制属性
  20535. }, baseConfig(config, 'col-item'), config, date);
  20536. cc.call(this, newConfig);
  20537. },
  20538. getValue: function () {
  20539. var ov = getValue.call(this);
  20540. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20541. // console.log('cc:', nv, ov)
  20542. return nv;
  20543. },
  20544. // focus2() {
  20545. // const that = this
  20546. // if (that.isExpanded) {
  20547. // that.collapse()
  20548. //
  20549. // } else {
  20550. // that.expand();
  20551. // }
  20552. // _.defer(() => {
  20553. // that.focus()
  20554. // })
  20555. // },
  20556. initComponent: function () {
  20557. this.on({
  20558. afterrender: function () {
  20559. var config = this.config;
  20560. // 日期框,不要默认弹出
  20561. // $(this.el.dom).on('click', toggle.bind(this))
  20562. },
  20563. destory: function () {
  20564. // 日期框,不要默认弹出
  20565. // $(this.el.dom).off('click', toggle.bind(this))
  20566. },
  20567. change: {
  20568. fn: function (sender) {
  20569. if (sender.format === 'Y-m-d') {
  20570. // 年月日格式
  20571. var value = sender.getRawValue();
  20572. if (/^\d{8}$/.test(value)) {
  20573. // 8位数字,自动转换为 YYYY-MM-DD
  20574. var newValue = [
  20575. value.substr(0, 4),
  20576. value.substr(4, 2),
  20577. value.substr(6, 2)
  20578. ].join('-');
  20579. sender.setValue(newValue);
  20580. }
  20581. }
  20582. },
  20583. }
  20584. // focus: {
  20585. // // 获得焦点后自动下拉
  20586. // fn(sender) {
  20587. // sender.expand();
  20588. // this.doQuery(this.allQuery, true);
  20589. // },
  20590. // },
  20591. });
  20592. initComponent.call(this);
  20593. },
  20594. createInitialDate: function (value) {
  20595. var minValue = this.minValue, maxValue = this.maxValue;
  20596. value = value || syncDate(new Date());
  20597. if (minValue && minValue > value) {
  20598. value = minValue;
  20599. }
  20600. else if (maxValue && maxValue < value) {
  20601. value = maxValue;
  20602. }
  20603. return value;
  20604. },
  20605. });
  20606. }
  20607. //# sourceMappingURL=datefield.js.map
  20608. function initDateTimePicker () {
  20609. Ext.define('Yvan.DateTimePicker', {
  20610. extend: 'Ext.picker.Date',
  20611. alias: 'datetimepicker',
  20612. alternateClassName: 'Ext.DateTimePicker',
  20613. renderTpl: [
  20614. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20615. '<div class="{baseCls}-header">',
  20616. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20617. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20618. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20619. '</div>',
  20620. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20621. '<thead>',
  20622. '<tr role="row">',
  20623. '<tpl for="dayNames">',
  20624. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20625. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20626. '</th>',
  20627. '</tpl>',
  20628. '</tr>',
  20629. '</thead>',
  20630. '<tbody>',
  20631. '<tr role="row">',
  20632. '<tpl for="days">',
  20633. '{#:this.isEndOfWeek}',
  20634. '<td role="gridcell">',
  20635. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20636. '</td>',
  20637. '</tpl>',
  20638. '</tr>',
  20639. '</tbody>',
  20640. '</table>',
  20641. '<tpl if="showToday">',
  20642. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20643. '</tpl>',
  20644. // These elements are used with Assistive Technologies such as screen readers
  20645. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20646. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20647. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20648. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20649. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20650. '</div>',
  20651. {
  20652. firstInitial: function (value) {
  20653. return Ext.picker.Date.prototype.getDayInitial(value);
  20654. },
  20655. isEndOfWeek: function (value) {
  20656. // convert from 1 based index to 0 based
  20657. // by decrementing value once.
  20658. value--;
  20659. // eslint-disable-next-line vars-on-top
  20660. var end = value % 7 === 0 && value !== 0;
  20661. return end ? '</tr><tr role="row">' : '';
  20662. },
  20663. renderTodayBtn: function (values, out) {
  20664. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20665. },
  20666. renderMonthBtn: function (values, out) {
  20667. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20668. }
  20669. }
  20670. ],
  20671. beforeRender: function () {
  20672. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20673. this.superclass.beforeRender.call(this);
  20674. function handleInput(extHandle, $input) {
  20675. var $dom = $(extHandle.el.dom);
  20676. // const $up = $dom.find('.x-form-spinner-up')
  20677. // const $down = $dom.find('.x-form-spinner-down')
  20678. // debugger
  20679. // $up.on('mousedown', () => {
  20680. // debugger
  20681. // });
  20682. // $up.on('click', () => {
  20683. // debugger
  20684. // });
  20685. extHandle.on('click', function (sender) {
  20686. var hideBak = me.hide;
  20687. me.hide = Ext.emptyFn;
  20688. extHandle.focus();
  20689. me.hide = hideBak;
  20690. });
  20691. var changeValue = function (delta) {
  20692. if (_$2.trim(extHandle.getValue()) === '') {
  20693. extHandle.setValue(extHandle.minValue);
  20694. }
  20695. else {
  20696. var v = parseInt('' + extHandle.getValue());
  20697. if (v + delta > extHandle.maxValue) {
  20698. extHandle.setValue(extHandle.minValue);
  20699. }
  20700. else if (v + delta < extHandle.minValue) {
  20701. extHandle.setValue(extHandle.maxValue);
  20702. }
  20703. else {
  20704. extHandle.setValue(v + delta);
  20705. }
  20706. }
  20707. };
  20708. $input.on('mousewheel', function (e) {
  20709. e.stopPropagation();
  20710. var event = e.originalEvent;
  20711. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20712. // if (event.wheelDelta) {
  20713. // delta = event.wheelDelta / 120;
  20714. // } else if (event.detail) {
  20715. // delta = -event.detail / 3;
  20716. // }
  20717. var zoomSize = Math.ceil(eventDelta / 120);
  20718. changeValue(zoomSize);
  20719. // console.log('delta', delta)
  20720. // $input.focus()
  20721. });
  20722. }
  20723. me.input1 = Ext.create('Ext.form.field.Number', {
  20724. minValue: 0,
  20725. maxValue: 23,
  20726. flex: 1,
  20727. enableKeyEvents: true,
  20728. fieldLabel: '时',
  20729. labelWidth: 20,
  20730. hideLabel: true,
  20731. spinDownEnabled: false,
  20732. spinUpEnabled: false,
  20733. style: {
  20734. marginLeft: '5px',
  20735. },
  20736. listeners: {
  20737. afterrender: function (sender) {
  20738. var $input = $(sender.inputEl.dom);
  20739. handleInput(me.input1, $input);
  20740. },
  20741. change: function (sender, e) {
  20742. if (me.getValue()) {
  20743. me.value.setHours(sender.getValue());
  20744. }
  20745. },
  20746. }
  20747. });
  20748. me.input2 = Ext.create('Ext.form.field.Number', {
  20749. minValue: 0,
  20750. maxValue: 59,
  20751. flex: 1,
  20752. enableKeyEvents: true,
  20753. fieldLabel: ' ',
  20754. hideLabel: false,
  20755. labelWidth: 8,
  20756. spinDownEnabled: false,
  20757. spinUpEnabled: false,
  20758. listeners: {
  20759. afterrender: function (sender) {
  20760. var $input = $(sender.inputEl.dom);
  20761. handleInput(me.input2, $input);
  20762. },
  20763. change: function (sender, e) {
  20764. if (me.getValue()) {
  20765. me.value.setMinutes(sender.getValue());
  20766. }
  20767. },
  20768. }
  20769. });
  20770. me.input3 = Ext.create('Ext.form.field.Number', {
  20771. minValue: 0,
  20772. maxValue: 59,
  20773. flex: 1,
  20774. enableKeyEvents: true,
  20775. fieldLabel: ' ',
  20776. hideLabel: false,
  20777. labelWidth: 8,
  20778. spinDownEnabled: false,
  20779. spinUpEnabled: false,
  20780. style: {
  20781. marginRight: '5px',
  20782. },
  20783. listeners: {
  20784. afterrender: function (sender) {
  20785. var $input = $(sender.inputEl.dom);
  20786. handleInput(me.input3, $input);
  20787. },
  20788. change: function (sender, e) {
  20789. if (me.getValue()) {
  20790. me.value.setSeconds(sender.getValue());
  20791. }
  20792. },
  20793. }
  20794. });
  20795. me.confirmBtn = new Ext.button.Button({
  20796. text: '确认',
  20797. handler: me.confirmClick,
  20798. scope: me
  20799. });
  20800. me.tdBtn = new Ext.button.Button({
  20801. text: '现在',
  20802. handler: me.selectToday,
  20803. scope: me
  20804. });
  20805. me.todayBtn = Ext.create('Ext.container.Container', {
  20806. layout: 'anchor', border: false,
  20807. defaults: {
  20808. border: false, anchor: '100%',
  20809. margin: '0 0 5 0',
  20810. },
  20811. items: [
  20812. {
  20813. layout: 'hbox',
  20814. items: [
  20815. me.input1,
  20816. me.input2,
  20817. me.input3,
  20818. ]
  20819. },
  20820. {
  20821. layout: 'hbox',
  20822. items: [
  20823. me.confirmBtn,
  20824. me.tdBtn,
  20825. ]
  20826. }
  20827. ]
  20828. });
  20829. },
  20830. // finishRenderChildren() {
  20831. // var me = this;
  20832. //
  20833. // this.superclass.finishRenderChildren.call(this);
  20834. // //*
  20835. // me.input1.finishRender();
  20836. // me.input2.finishRender();
  20837. // me.input3.finishRender();
  20838. // //
  20839. // me.tdBtn.finishRender();
  20840. // me.confirmBtn.finishRender();
  20841. // },
  20842. setValue: function (value) {
  20843. //this.value = Ext.Date.clearTime(value, true);
  20844. this.value = value;
  20845. this.input1.setValue(this.value.getHours());
  20846. this.input2.setValue(this.value.getMinutes());
  20847. this.input3.setValue(this.value.getSeconds());
  20848. return this.update(this.value);
  20849. },
  20850. selectDate: function (value) {
  20851. if (this.showTime) {
  20852. value.setHours(this.input1.getValue());
  20853. value.setMinutes(this.input2.getValue());
  20854. value.setSeconds(this.input3.getValue());
  20855. }
  20856. this.value = value;
  20857. return this.update(this.value);
  20858. },
  20859. setDisabledStatus: function (disabled) {
  20860. var me = this;
  20861. debugger;
  20862. // me.callParent();
  20863. if (me.showTime) {
  20864. me.confirmBtn.setDisabled(disabled);
  20865. }
  20866. if (me.isShowFooter()) {
  20867. me.footerContainer.setDisabled(disabled);
  20868. }
  20869. },
  20870. handleDateClick: function (e, t) {
  20871. var me = this, handler = me.handler;
  20872. // e.stopEvent();
  20873. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20874. me.doCancelFocus = me.focusOnSelect === false;
  20875. me.selectDate(new Date(t.dateValue));
  20876. delete me.doCancelFocus;
  20877. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20878. if (me.showTime) {
  20879. return;
  20880. }
  20881. me.fireEvent('select', me, me.value);
  20882. if (handler) {
  20883. handler.call(me.scope || me, me, me.value);
  20884. }
  20885. me.onSelect();
  20886. }
  20887. },
  20888. selectToday: function () {
  20889. var me = this, btn = me.todayBtn, handler = me.handler;
  20890. if (btn && !btn.disabled) {
  20891. me.value = syncDate(new Date());
  20892. me.update(me.value);
  20893. me.fireEvent('select', me, me.value);
  20894. if (handler) {
  20895. handler.call(me.scope || me, me, me.value);
  20896. }
  20897. me.onSelect();
  20898. me.hide();
  20899. }
  20900. return me;
  20901. },
  20902. confirmClick: function () {
  20903. var me = this, btn = me.confirmBtn, handler = me.handler;
  20904. if (btn && !btn.disabled) {
  20905. me.fireEvent('select', me, me.value);
  20906. if (handler) {
  20907. handler.call(me.scope || me, me, me.value);
  20908. }
  20909. me.onSelect();
  20910. me.hide();
  20911. }
  20912. return me;
  20913. },
  20914. selectedUpdate: function (date) {
  20915. var me = this,
  20916. //t = date.getTime(),
  20917. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20918. cells.removeCls(cls);
  20919. for (c = 0; c < cLen; c++) {
  20920. cell = Ext.fly(cellItems[c]);
  20921. if (cell.dom.firstChild.dateValue == t) {
  20922. me.fireEvent('highlightitem', me, cell);
  20923. cell.addCls(cls);
  20924. if (me.isVisible() && !me.doCancelFocus) {
  20925. Ext.fly(cell.dom.firstChild).focus(50);
  20926. }
  20927. break;
  20928. }
  20929. }
  20930. },
  20931. // private, inherit docs
  20932. beforeDestroy: function () {
  20933. var me = this;
  20934. if (me.rendered) {
  20935. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20936. }
  20937. me.superclass.beforeDestroy.call(this);
  20938. }
  20939. });
  20940. }
  20941. //# sourceMappingURL=datetimepicker.js.map
  20942. function initDateTime () {
  20943. Ext.define('Yvan.DateTimeField', {
  20944. extend: 'Ext.form.field.Date',
  20945. xtype: 'datetimefield',
  20946. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20947. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20948. showTime: true,
  20949. format: "Y-m-d H:i:s",
  20950. constructor: function (config) {
  20951. var newConfig = _$2.defaultsDeep({
  20952. // 强制属性
  20953. }, baseConfig(config, 'col-item'), config, date);
  20954. this.superclass.constructor.call(this, newConfig);
  20955. },
  20956. initComponent: function () {
  20957. this.superclass.initComponent.call(this);
  20958. var setInitValue = function () {
  20959. var value = this.getRawValue();
  20960. if (!value) {
  20961. // 没填内容的时候,自动设置当前时间
  20962. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20963. }
  20964. };
  20965. this.on({
  20966. afterrender: function () {
  20967. var config = this.config;
  20968. // 日期框,不要默认弹出
  20969. $(this.el.dom).on('click', setInitValue.bind(this));
  20970. },
  20971. destory: function () {
  20972. // 日期框,不要默认弹出
  20973. $(this.el.dom).off('click', setInitValue.bind(this));
  20974. },
  20975. change: {
  20976. fn: function (sender) {
  20977. if (sender.format === "Y-m-d H:i:s") {
  20978. // 年月日格式
  20979. var value = sender.getRawValue();
  20980. if (/^\d{14}$/.test(value)) {
  20981. // 8位数字,自动转换为 YYYY-MM-DD
  20982. var newValue = [
  20983. value.substr(0, 4),
  20984. '-',
  20985. value.substr(4, 2),
  20986. '-',
  20987. value.substr(6, 2),
  20988. ' ',
  20989. value.substr(8, 2),
  20990. ':',
  20991. value.substr(10, 2),
  20992. ':',
  20993. value.substr(12, 2)
  20994. ].join('');
  20995. sender.setValue(newValue);
  20996. }
  20997. }
  20998. },
  20999. }
  21000. });
  21001. },
  21002. getValue: function () {
  21003. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  21004. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  21005. // console.log('cc:', nv, ov)
  21006. return nv;
  21007. },
  21008. onExpand: function () {
  21009. var strValue = this.getValue();
  21010. var value;
  21011. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21012. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)), parseInt(strValue.substr(11, 2)), parseInt(strValue.substr(14, 2)), parseInt(strValue.substr(17, 2)));
  21013. }
  21014. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21015. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21016. }
  21017. else {
  21018. value = syncDate(new Date());
  21019. }
  21020. this.picker.setValue(value);
  21021. },
  21022. createPicker: function () {
  21023. var me = this, format = Ext.String.format;
  21024. //@ts-ignore
  21025. return new Yvan.DateTimePicker({
  21026. pickerField: me,
  21027. ownerCt: me.ownerCt,
  21028. renderTo: document.body,
  21029. floating: true,
  21030. hidden: true,
  21031. focusOnShow: true,
  21032. minDate: me.minValue,
  21033. maxDate: me.maxValue,
  21034. disabledDatesRE: me.disabledDatesRE,
  21035. disabledDatesText: me.disabledDatesText,
  21036. disabledDays: me.disabledDays,
  21037. disabledDaysText: me.disabledDaysText,
  21038. format: me.format,
  21039. showToday: me.showToday,
  21040. showTime: me.showTime,
  21041. startDay: me.startDay,
  21042. minText: format(me.minText, me.formatDate(me.minValue)),
  21043. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21044. listeners: {
  21045. scope: me,
  21046. select: me.onSelect
  21047. },
  21048. keyNavConfig: {
  21049. esc: function () {
  21050. me.collapse();
  21051. }
  21052. }
  21053. });
  21054. },
  21055. });
  21056. }
  21057. //# sourceMappingURL=datetimefield.js.map
  21058. function initNumber () {
  21059. var cc = Ext.form.field.Number.prototype.constructor;
  21060. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21061. Ext.form.field.Number.override({
  21062. constructor: function (config) {
  21063. var newConfig = _$2.defaultsDeep({
  21064. // 强制属性
  21065. }, baseConfig(config, 'col-item'), config, numberfield);
  21066. cc.call(this, newConfig);
  21067. },
  21068. initComponent: function () {
  21069. this.on({
  21070. afterrender: function (sender) {
  21071. var _this = this;
  21072. var _a;
  21073. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21074. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21075. $$2(sender.inputEl.dom).on('click', function (e) {
  21076. sender.fireEvent('click', _this, e);
  21077. });
  21078. }
  21079. }
  21080. });
  21081. initComponent.call(this);
  21082. },
  21083. });
  21084. }
  21085. //# sourceMappingURL=numberfield.js.map
  21086. function initCheckbox () {
  21087. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21088. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21089. Ext.form.field.Checkbox.override({
  21090. constructor: function (config) {
  21091. var newConfig = _$2.defaultsDeep({
  21092. // 强制属性
  21093. }, baseConfig(config, 'col-item'), config, checkbox);
  21094. cc.call(this, newConfig);
  21095. },
  21096. getValue: function () {
  21097. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21098. var ov = getValue.call(this);
  21099. // const ov = this.getRawValue()
  21100. return (ov ? checkedValue : uncheckedValue);
  21101. },
  21102. setValue: function (nv) {
  21103. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21104. var value;
  21105. if (nv === checkedValue) {
  21106. value = true;
  21107. }
  21108. else if (nv === uncheckedValue) {
  21109. value = false;
  21110. }
  21111. else {
  21112. value = !!nv;
  21113. }
  21114. // me.setRawValue(value)
  21115. // me.checked = value
  21116. // return me.mixins.field.setValue.call(me, value);
  21117. setValue.call(this, value);
  21118. },
  21119. updateCheckedCls: function (checked) {
  21120. var me = this;
  21121. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21122. checked = checked != null ? checked : me.getValue();
  21123. if (checked === uncheckedValue) {
  21124. checked = false;
  21125. }
  21126. else if (checked === checkedValue) {
  21127. checked = true;
  21128. }
  21129. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21130. },
  21131. initComponent: function () {
  21132. initComponent.call(this);
  21133. },
  21134. });
  21135. }
  21136. //# sourceMappingURL=checkbox.js.map
  21137. function initCheckboxGroup () {
  21138. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21139. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21140. Ext.form.CheckboxGroup.override({
  21141. constructor: function (config) {
  21142. var newConfig = _$2.defaultsDeep({
  21143. // 强制属性
  21144. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21145. cc.call(this, newConfig);
  21146. },
  21147. initComponent: function () {
  21148. initComponent.call(this);
  21149. },
  21150. });
  21151. }
  21152. //# sourceMappingURL=checkboxgroup.js.map
  21153. function initRadio () {
  21154. var cc = Ext.form.field.Radio.prototype.constructor;
  21155. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21156. Ext.form.field.Radio.override({
  21157. constructor: function (config) {
  21158. var newConfig = _$2.defaultsDeep({
  21159. // 强制属性
  21160. }, baseConfig(config, 'col-item'), config, radio);
  21161. cc.call(this, newConfig);
  21162. },
  21163. initComponent: function () {
  21164. initComponent.call(this);
  21165. },
  21166. });
  21167. }
  21168. //# sourceMappingURL=radio.js.map
  21169. function initRadioGroup () {
  21170. var cc = Ext.form.RadioGroup.prototype.constructor;
  21171. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21172. Ext.form.RadioGroup.override({
  21173. constructor: function (config) {
  21174. var newConfig = _$2.defaultsDeep({
  21175. // 强制属性
  21176. }, baseConfig(config, 'col-item'), config, radiogroup);
  21177. cc.call(this, newConfig);
  21178. },
  21179. initComponent: function () {
  21180. initComponent.call(this);
  21181. },
  21182. });
  21183. }
  21184. //# sourceMappingURL=radiogroup.js.map
  21185. function initFieldset () {
  21186. /**
  21187. *
  21188. */
  21189. var ct = Ext.form.FieldSet.prototype.constructor;
  21190. Ext.form.FieldSet.override({
  21191. constructor: function (config) {
  21192. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21193. ct.call(this, newConfig);
  21194. }
  21195. });
  21196. }
  21197. //# sourceMappingURL=fieldset.js.map
  21198. function initCombotree () {
  21199. Ext.define('Yvan.ComboTree', {
  21200. extend: 'Ext.form.field.Picker',
  21201. xtype: 'combotree',
  21202. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21203. config: {
  21204. store: null,
  21205. displayField: null,
  21206. columns: null,
  21207. selectOnTab: true,
  21208. maxPickerHeight: 300,
  21209. minPickerHeight: 100,
  21210. minPickerWidth: 350,
  21211. rootVisible: true,
  21212. },
  21213. editable: false,
  21214. setStore: function (store) {
  21215. this.store = store;
  21216. var me = this;
  21217. if (me.store) {
  21218. if (me.picker) {
  21219. me.picker.setStore(store);
  21220. if (me.isExpanded) {
  21221. me.collapse();
  21222. delete me.picker;
  21223. me.expand();
  21224. }
  21225. }
  21226. this.onLoad();
  21227. me.mon(me.store, {
  21228. scope: me,
  21229. load: me.onLoad,
  21230. update: me.onUpdate
  21231. });
  21232. }
  21233. },
  21234. createPicker: function () {
  21235. var me = this;
  21236. var picker = new Ext.tree.Panel({
  21237. border: false,
  21238. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21239. shrinkWrapDock: 2,
  21240. store: me.store,
  21241. floating: true,
  21242. rootVisible: me.rootVisible,
  21243. displayField: me.displayField,
  21244. columns: me.columns,
  21245. minHeight: me.minPickerHeight,
  21246. maxHeight: me.maxPickerHeight,
  21247. minWidth: me.minPickerWidth,
  21248. manageHeight: false,
  21249. shadow: false,
  21250. scrollable: true,
  21251. // modal: true,
  21252. // constrain: true,
  21253. // constrainTo: topScope._handle.el.dom,
  21254. // renderTo: topScope._handle.el.dom,
  21255. // alignTarget: topScope._handle,
  21256. listeners: {
  21257. scope: me,
  21258. itemclick: me.onItemClick,
  21259. itemkeydown: me.onPickerKeyDown
  21260. }
  21261. }), view = picker.getView();
  21262. if (Ext.isIE9 && Ext.isStrict) {
  21263. view.on({
  21264. scope: me,
  21265. highlightitem: me.repaintPickerView,
  21266. unhighlightitem: me.repaintPickerView,
  21267. afteritemexpand: me.repaintPickerView,
  21268. afteritemcollapse: me.repaintPickerView
  21269. });
  21270. }
  21271. return picker;
  21272. },
  21273. repaintPickerView: function () {
  21274. var style = this.picker.getView().getEl().dom.style;
  21275. style.display = style.display;
  21276. },
  21277. onItemClick: function (view, record, node, rowIndex, e) {
  21278. this.selectItem(view, record);
  21279. },
  21280. onPickerKeyDown: function (treeView, record, item, index, e) {
  21281. var key = e.getKey();
  21282. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21283. this.selectItem(treeView, record);
  21284. }
  21285. },
  21286. selectItem: function (sender, record) {
  21287. var me = this;
  21288. me.setValue(record.getId());
  21289. me.fireEvent('select', me, record);
  21290. me.collapse();
  21291. },
  21292. onExpand: function () {
  21293. var picker = this.picker;
  21294. var store = picker.store;
  21295. var value = this.value;
  21296. var node;
  21297. if (value) {
  21298. node = store.getNodeById(value);
  21299. }
  21300. if (!node) {
  21301. node = store.getRoot();
  21302. }
  21303. picker.ensureVisible(node, {
  21304. select: true,
  21305. focus: true
  21306. });
  21307. },
  21308. setValue: function (value) {
  21309. var me = this;
  21310. console.log('setValue', value);
  21311. me.value = value;
  21312. if (!me.store || me.store.loading) {
  21313. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21314. return me.mixins.field.setValue.call(me, value);
  21315. // return me;
  21316. }
  21317. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21318. if (value === undefined) {
  21319. record = me.store.getRoot();
  21320. console.log('setValue', record.getId());
  21321. me.value = record.getId();
  21322. return me.mixins.field.setValue.call(me, value);
  21323. }
  21324. else {
  21325. record = me.store.getNodeById(value);
  21326. }
  21327. // set the raw value to the record's display field if a record was found
  21328. me.setRawValue(record ? record.get(me.displayField) : '');
  21329. return me.mixins.field.setValue.call(me, value);
  21330. },
  21331. getSubmitValue: function () {
  21332. return this.value;
  21333. },
  21334. getValue: function () {
  21335. return this.value;
  21336. },
  21337. onLoad: function () {
  21338. var value = this.value;
  21339. if (value) {
  21340. this.setValue(value);
  21341. }
  21342. },
  21343. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21344. var display = this.displayField;
  21345. var me = this;
  21346. if (type === 'edit' && modifiedFieldNames &&
  21347. Ext.Array.contains(modifiedFieldNames, display) &&
  21348. this.value === rec.getId()) {
  21349. me.mixins.field.setValue.call(me, this.value);
  21350. this.setRawValue(rec.get(display));
  21351. }
  21352. }
  21353. });
  21354. }
  21355. //# sourceMappingURL=combotree.js.map
  21356. function initPickerPlus () {
  21357. Ext.define('Yvan.PickerAlignCenter', {
  21358. extend: 'Ext.form.field.Picker',
  21359. /**
  21360. * Performs the alignment on the picker using the class defaults
  21361. * @private
  21362. */
  21363. doAlign: function () {
  21364. // 不要挪动就好
  21365. },
  21366. });
  21367. }
  21368. //# sourceMappingURL=pickerplus.js.map
  21369. function initCombogrid () {
  21370. Ext.define('Yvan.ComboGrid', {
  21371. extend: 'Ext.form.field.Picker',
  21372. // extend: 'Yvan.PickerAlignCenter',
  21373. xtype: 'combogrid',
  21374. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21375. triggers: {
  21376. clear: {
  21377. weight: 0,
  21378. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21379. hidden: true,
  21380. handler: 'onClearClick',
  21381. },
  21382. },
  21383. config: __assign({}, comboGrid),
  21384. editable: true,
  21385. _superBlur: false,
  21386. allowCustomInput: false,
  21387. pressEnterPopup: true,
  21388. initComponent: function () {
  21389. var that = this;
  21390. var scope = lookupScope(that);
  21391. var config = that.config;
  21392. if (isDesignMode(scope, config)) {
  21393. this.superclass.initComponent.call(this, arguments);
  21394. return;
  21395. }
  21396. this.on({
  21397. blur: function (sender, e) {
  21398. if (this._superBlur) {
  21399. // 挂起时不恢复内容
  21400. return;
  21401. }
  21402. // 离开焦点时,恢复原来的值
  21403. sender.setRawValue(sender.value);
  21404. },
  21405. afterrender: function (sender) {
  21406. var $dom = $(sender.inputEl.dom);
  21407. that.scope = lookupScope(sender);
  21408. if (sender.column) {
  21409. // 列模式,拦截 keydown
  21410. $dom.on('keydown', function (e) {
  21411. if (isChartEvent(e) && !that.tryEnable()) {
  21412. // 没有达成 editEnable 条件,不用响应
  21413. stopEvent(e);
  21414. return;
  21415. }
  21416. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21417. stopEvent(e);
  21418. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21419. return;
  21420. }
  21421. });
  21422. }
  21423. else {
  21424. // 常规模式,拦截 keyup
  21425. $dom.on('keyup', function (e) {
  21426. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21427. return;
  21428. }
  21429. if (isChartEvent(e) && !that.tryEnable()) {
  21430. // 没有达成 editEnable 条件,不用响应
  21431. stopEvent(e);
  21432. return;
  21433. }
  21434. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21435. stopEvent(e);
  21436. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21437. return;
  21438. }
  21439. if (!that.allowCustomInput) {
  21440. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21441. stopEvent(e);
  21442. }
  21443. });
  21444. $dom.on('change', function (e) {
  21445. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21446. // if (that.isExpanded) {
  21447. // that.filterChange(that, e.target.value)
  21448. // }
  21449. stopEvent(e);
  21450. });
  21451. }
  21452. $dom.on('input', function (e) {
  21453. stopEvent(e);
  21454. });
  21455. },
  21456. });
  21457. this.superclass.initComponent.apply(this, arguments);
  21458. },
  21459. createPicker: function () {
  21460. var me = this;
  21461. var cfg = {
  21462. layout: 'fit',
  21463. border: 0,
  21464. // border: 5,
  21465. style: {
  21466. // borderColor: 'black',
  21467. // borderWidth: '5px',
  21468. // borderStyle: 'solid',
  21469. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21470. },
  21471. shadow: 'side',
  21472. shadowOffset: 100,
  21473. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21474. shrinkWrapDock: 2,
  21475. floating: true,
  21476. width: me.pickerWidth,
  21477. height: me.pickerHeight,
  21478. minWidth: me.pickerWidth,
  21479. minHeight: me.pickerHeight,
  21480. maxWidth: me.pickerWidth,
  21481. maxHeight: me.pickerHeight,
  21482. items: [
  21483. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21484. xtype: 'toolbar',
  21485. items: [
  21486. { xtype: 'textfield', fieldLabel: '筛选' },
  21487. {
  21488. xtype: 'button',
  21489. text: '查询',
  21490. iconCls: 'x-fa fa-search',
  21491. cssType: 'primary',
  21492. listeners: {
  21493. click: function () {
  21494. me.reloadGrid();
  21495. }
  21496. }
  21497. },
  21498. ]
  21499. }, autoLoad: false, listeners: {
  21500. afterrender: function (grid) {
  21501. me.grid = grid;
  21502. grid.focus();
  21503. grid.on({
  21504. rowdblclick: function (sender, row) {
  21505. me.selectItem(row);
  21506. },
  21507. dataLoadComplete: function (sender) {
  21508. _$2.defer(function () {
  21509. me.setFocus();
  21510. });
  21511. },
  21512. keydown: function (sender, e) {
  21513. if (me.column) {
  21514. // 列模式,拦截 keydown
  21515. me.processKey(e);
  21516. }
  21517. },
  21518. keyup: function (sender, e) {
  21519. if (!me.column) {
  21520. // 常规模式,拦截 keyup
  21521. me.processKey(e);
  21522. }
  21523. }
  21524. });
  21525. },
  21526. } })
  21527. ]
  21528. };
  21529. // @ts-ignore
  21530. var picker = new Ext.container.Container(cfg);
  21531. return picker;
  21532. },
  21533. setFocus: function () {
  21534. if (this.grid.store.getCount() > 0) {
  21535. this.grid.focusRow(0);
  21536. }
  21537. },
  21538. processKey: function (e) {
  21539. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21540. this.selectItem(this.grid.selection);
  21541. stopEvent(e);
  21542. }
  21543. else if (e.key === 'Escape') {
  21544. this.collapse();
  21545. }
  21546. },
  21547. repaintPickerView: function () {
  21548. var style = this.picker.getView().getEl().dom.style;
  21549. style.display = style.display;
  21550. },
  21551. onItemClick: function (view, record, node, rowIndex, e) {
  21552. this.selectItem(record);
  21553. },
  21554. onPickerKeyDown: function (treeView, record, item, index, e) {
  21555. var key = e.getKey();
  21556. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21557. this.selectItem(record);
  21558. }
  21559. },
  21560. filterChange: _$2.debounce(function (sender, value) {
  21561. sender.onExpand();
  21562. }, 1000),
  21563. selectItem: function (record) {
  21564. var me = this;
  21565. var lookup = this.lookup;
  21566. var scope = lookupScope(this);
  21567. me.fireEvent('select', me, record);
  21568. if (record.isModel) {
  21569. record = record.data;
  21570. }
  21571. tryWriteObject(lookup, record, function (path, value) {
  21572. me._lookupSet(path, value);
  21573. });
  21574. // lookup
  21575. // fromColumn: 'toTarget'
  21576. // fromColumn: 'toTarget'
  21577. // fromColumn: 'toTarget'
  21578. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21579. var value = _$2.get(record, fromColumn);
  21580. me._lookupSet(toTarget, value);
  21581. });
  21582. // 选定之后不能做清空
  21583. // const {lookupClearOnChange} = me
  21584. // if (_.isArray(lookupClearOnChange)) {
  21585. // _.each(lookupClearOnChange, item => {
  21586. // me._lookupSet(item, '')
  21587. // })
  21588. // }
  21589. me.collapse();
  21590. // 触发 _raiseNextFocus
  21591. me._raiseNextFocus(me);
  21592. },
  21593. onExpand: function () {
  21594. // 展开时,根据 lookup 带入查询参数
  21595. var expressData = this.getExpressData();
  21596. var txtField = this.grid.down('toolbar').down('textfield');
  21597. txtField.setValue(expressData.queryValue);
  21598. this.reloadGrid();
  21599. },
  21600. reloadGrid: function () {
  21601. // 展开时,根据 lookup 带入查询参数
  21602. var expressData = this.getExpressData();
  21603. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21604. var txtField = this.grid.down('toolbar').down('textfield');
  21605. // 每个 combogrid 默认带上 __queryValue 属性
  21606. reloadParam["__queryValue"] = txtField.getValue();
  21607. this.grid.reload(reloadParam);
  21608. },
  21609. onTriggerClick: function (sender) {
  21610. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21611. if (!grid) {
  21612. msg('正在初始化,请稍后');
  21613. return;
  21614. }
  21615. if (!this.tryEnable()) {
  21616. // 没有达成 editEnable 条件,不用弹出
  21617. return;
  21618. }
  21619. if (isExpanded || readOnly || disabled) {
  21620. // 已弹出、只读、禁用状态下,不允许弹出
  21621. return;
  21622. }
  21623. this._superBlur = true;
  21624. this.superclass.onTriggerClick.apply(this, arguments);
  21625. this._superBlur = false;
  21626. },
  21627. onCollapse: function () {
  21628. // 每次收回时,删除下拉组件
  21629. // delete this.picker
  21630. },
  21631. /**
  21632. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21633. */
  21634. setValue: function (value) {
  21635. var me = this;
  21636. // 设值用户看到的表面内容
  21637. this.setRawValue(value);
  21638. // 设值 setValue 调用链,正常触发 change 事件等
  21639. return me.mixins.field.setValue.call(me, value);
  21640. },
  21641. _lookupSet: function (path, value) {
  21642. var me = this;
  21643. path = tryVarSimple(path);
  21644. if (me.column) {
  21645. // 判断写入目标,是否与自己绑定的属性相等
  21646. if (path === 'queryValue' || me.column.dataIndex === path) {
  21647. me.setValue(value);
  21648. }
  21649. // 列模式下,写当前编辑行
  21650. var parentRecord = me._lookupEditorRecord();
  21651. if (parentRecord) {
  21652. // Ext.data.Record / Ext.data.Model
  21653. parentRecord.set(path, value);
  21654. }
  21655. else {
  21656. debugger;
  21657. }
  21658. }
  21659. else {
  21660. // 常规模式下,写 viewModel
  21661. me.scope.viewModel.set(path, value);
  21662. }
  21663. },
  21664. _lookupGrid: function () {
  21665. return this.column.up('grid');
  21666. },
  21667. _lookupEditorRecord: function () {
  21668. var _a, _b, _c, _d;
  21669. // parentGrid.getSelectionModel().getLastSelected()
  21670. var grid = this._lookupGrid();
  21671. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21672. if (!editingPlugin) {
  21673. return grid.getSelectionModel().getLastSelected();
  21674. }
  21675. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21676. if (_$2.isNumber(rowIdx)) {
  21677. return grid.store.getAt(rowIdx);
  21678. }
  21679. else {
  21680. return grid.getSelectionModel().getLastSelected();
  21681. }
  21682. },
  21683. onChange: function (newVal, oldVal) {
  21684. var me = this;
  21685. var value = newVal;
  21686. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21687. if (hideTrigger || disabled || readOnly || hideClear) {
  21688. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21689. return;
  21690. }
  21691. if (value) {
  21692. me.getTrigger('clear').show();
  21693. me.updateLayout();
  21694. }
  21695. else {
  21696. me.getTrigger('clear').hide();
  21697. me.updateLayout();
  21698. }
  21699. },
  21700. /**
  21701. * 得到能用于 express 表达式计算的上下文数据
  21702. */
  21703. getExpressData: function () {
  21704. var queryValue = this.getRawValue();
  21705. if (!queryValue) {
  21706. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21707. queryValue = this.getPicker().down('textfield').getRawValue();
  21708. }
  21709. if (this.column) {
  21710. // 列模式, 准备好判断 editEnable 表达式用的数据
  21711. var parentRecord = this._lookupEditorRecord();
  21712. if (!parentRecord) {
  21713. debugger;
  21714. }
  21715. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21716. }
  21717. else {
  21718. // 编辑模式,准备好判断用的数据
  21719. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21720. }
  21721. },
  21722. tryEnable: function () {
  21723. return tryEnable(this.getExpressData(), this.editEnable);
  21724. },
  21725. /**
  21726. * 清空所有值
  21727. */
  21728. onClearClick: function (sender, e) {
  21729. var me = this;
  21730. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21731. me.fireEvent('clear', sender, e);
  21732. me.setValue('');
  21733. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21734. me._lookupSet(toTarget, '');
  21735. });
  21736. _$2.each(lookupClearOnChange, function (item) {
  21737. me._lookupSet(item, '');
  21738. });
  21739. }
  21740. });
  21741. }
  21742. //# sourceMappingURL=combogrid.js.map
  21743. function initContainer () {
  21744. var cc = Ext.container.Container.prototype.constructor;
  21745. //const {initComponent} = Ext.container.Container.prototype
  21746. Ext.container.Container.override({
  21747. constructor: function (config) {
  21748. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21749. cc.call(this, newConfig);
  21750. },
  21751. });
  21752. }
  21753. //# sourceMappingURL=container.js.map
  21754. function initRows () {
  21755. Ext.define('Yvan.Rows', {
  21756. extend: 'Ext.container.Container',
  21757. xtype: 'rows',
  21758. constructor: function (config) {
  21759. var self = this;
  21760. var newConfig = _$2.defaultsDeep({
  21761. // 强制性属性
  21762. layout: 'anchor', border: false,
  21763. defaults: {
  21764. border: false, anchor: '100%',
  21765. margin: '0 0 5 0',
  21766. },
  21767. }, baseConfig(config, 'rows-container'), config, rows);
  21768. this.superclass.constructor.call(self, newConfig);
  21769. },
  21770. });
  21771. }
  21772. //# sourceMappingURL=rows.js.map
  21773. function initForm () {
  21774. var ct = Ext.form.Panel.prototype.constructor;
  21775. Ext.form.Panel.override({
  21776. constructor: function (config) {
  21777. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21778. ct.call(this, newConfig);
  21779. }
  21780. });
  21781. }
  21782. //# sourceMappingURL=form.js.map
  21783. function initCols () {
  21784. Ext.define('Yvan.Cols', {
  21785. extend: 'Ext.container.Container',
  21786. xtype: 'cols',
  21787. constructor: function (config) {
  21788. var self = this;
  21789. var newConfig = _$2.defaultsDeep({
  21790. // 强制性属性
  21791. layout: 'hbox',
  21792. minHeight: config.designMode ? 32 : 0
  21793. }, baseConfig(config, 'cols-container'), config, cols);
  21794. this.superclass.constructor.call(self, newConfig);
  21795. },
  21796. });
  21797. }
  21798. //# sourceMappingURL=cols.js.map
  21799. function initButton () {
  21800. /**
  21801. *
  21802. */
  21803. var ct = Ext.button.Button.prototype.constructor;
  21804. Ext.button.Button.override({
  21805. constructor: function (config) {
  21806. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21807. ct.call(this, newConfig);
  21808. },
  21809. setLoading: function (value) {
  21810. if (value) {
  21811. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21812. this._originIconCls = this.iconCls;
  21813. }
  21814. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21815. this.setDisabled(true);
  21816. }
  21817. else {
  21818. this.setIconCls(this._originIconCls);
  21819. this.setDisabled(false);
  21820. }
  21821. }
  21822. });
  21823. }
  21824. //# sourceMappingURL=button.js.map
  21825. function initIframe () {
  21826. Ext.define('Ext.ux.IFrame', {
  21827. extend: 'Ext.Component',
  21828. alias: 'widget.uxiframe',
  21829. loadMask: 'Loading...',
  21830. src: 'about:blank',
  21831. renderTpl: [
  21832. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21833. ],
  21834. childEls: ['iframeEl'],
  21835. initComponent: function () {
  21836. this.superclass.initComponent.call(this);
  21837. this.superclass.initEvents.call(this);
  21838. this.frameName = this.frameName || this.id + '-frame';
  21839. },
  21840. initEvents: function () {
  21841. var me = this;
  21842. this.superclass.initEvents.call(this);
  21843. me.iframeEl.on('load', me.onLoad, me);
  21844. },
  21845. initRenderData: function () {
  21846. return Ext.apply(this.superclass.initRenderData.call(this), {
  21847. src: this.src,
  21848. frameName: this.frameName
  21849. });
  21850. },
  21851. getBody: function () {
  21852. var doc = this.getDoc();
  21853. return doc.body || doc.documentElement;
  21854. },
  21855. getDoc: function () {
  21856. try {
  21857. return this.getWin().document;
  21858. }
  21859. catch (ex) {
  21860. return null;
  21861. }
  21862. },
  21863. getWin: function () {
  21864. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21865. return win;
  21866. },
  21867. getFrame: function () {
  21868. var me = this;
  21869. return me.iframeEl.dom;
  21870. },
  21871. onLoad: function () {
  21872. var me = this, doc = me.getDoc();
  21873. if (doc) {
  21874. this.el.unmask();
  21875. this.fireEvent('load', this);
  21876. }
  21877. else if (me.src) {
  21878. this.el.unmask();
  21879. this.fireEvent('error', this);
  21880. }
  21881. },
  21882. load: function (src) {
  21883. var me = this, text = me.loadMask, frame = me.getFrame();
  21884. if (me.fireEvent('beforeload', me, src) !== false) {
  21885. if (text && me.el) {
  21886. me.el.mask(text);
  21887. }
  21888. frame.src = me.src = (src || me.src);
  21889. }
  21890. }
  21891. });
  21892. }
  21893. //# sourceMappingURL=iframe.js.map
  21894. /**
  21895. * 属性:
  21896. * - autoLoad: true
  21897. * - dataSource: ''
  21898. * 方法:
  21899. * - handleZoomBig
  21900. * - handleZoomSmall
  21901. * - handleZoomReset
  21902. * - openDiagram
  21903. * - getBpmn
  21904. * - getBpmnCanvas
  21905. * - getBpmnOverlays
  21906. * - getBpmnZoomScroll
  21907. * 事件:
  21908. * - initFinish
  21909. * - failed
  21910. * - success
  21911. * - itemHover
  21912. * - itemOut
  21913. * - itemClick
  21914. * - itemDblclick
  21915. * - itemMousedown
  21916. * - itemMouseup
  21917. */
  21918. function initBpmn () {
  21919. Ext.define('Yvan.Bpmn', {
  21920. // extend: 'Ext.container.Container',
  21921. extend: 'Ext.panel.Panel',
  21922. alias: 'widget.bpmn',
  21923. xtype: 'bpmn',
  21924. constructor: function (config) {
  21925. var self = this;
  21926. var newConfig = _$2.defaultsDeep({
  21927. // 强制性属性
  21928. }, baseConfig(config, 'row-item'), config, bpmn);
  21929. if (!newConfig.hideToolbar) {
  21930. newConfig.tbar = [];
  21931. newConfig.tbar.push({
  21932. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21933. listeners: {
  21934. click: function (sender) {
  21935. self.reload();
  21936. }
  21937. }
  21938. });
  21939. newConfig.tbar.push({
  21940. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21941. listeners: {
  21942. click: function (sender) {
  21943. self.handleZoomBig();
  21944. }
  21945. },
  21946. });
  21947. newConfig.tbar.push({
  21948. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21949. listeners: {
  21950. click: function (sender) {
  21951. self.handleZoomSmall();
  21952. }
  21953. },
  21954. });
  21955. newConfig.tbar.push({
  21956. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21957. listeners: {
  21958. click: function (sender) {
  21959. self.handleZoomReset();
  21960. }
  21961. },
  21962. });
  21963. }
  21964. this.superclass.constructor.call(self, newConfig);
  21965. },
  21966. initComponent: function () {
  21967. var _this = this;
  21968. var me = this;
  21969. var config = me.config;
  21970. var scope = lookupScope(this);
  21971. if (!isDesignMode(scope, config)) {
  21972. //@ts-ignore
  21973. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21974. console.log('BpNavigated', me, BpNavigated);
  21975. var dom = me.el.dom;
  21976. var $dom = $(dom);
  21977. var $container = $dom.find('.x-autocontainer-innerCt');
  21978. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21979. _this._bpmn = bpmn;
  21980. if (_this.autoLoad) {
  21981. _this.reload();
  21982. }
  21983. _this.fireEvent('initFinish', _this);
  21984. var eventBus = bpmn.get('eventBus');
  21985. eventBus.on('element.hover', function (e) {
  21986. // this.fireEvent('itemHover', this, e);
  21987. });
  21988. eventBus.on('element.out', function (e) {
  21989. _this.fireEvent('itemOut', _this, e);
  21990. });
  21991. eventBus.on('element.click', function (e) {
  21992. _this.fireEvent('itemClick', _this, e);
  21993. });
  21994. eventBus.on('element.dblclick', function (e) {
  21995. _this.fireEvent('itemDblclick', _this, e);
  21996. });
  21997. eventBus.on('element.mousedown', function (e) {
  21998. _this.fireEvent('itemMousedown', _this, e);
  21999. });
  22000. eventBus.on('element.mouseup', function (e) {
  22001. _this.fireEvent('itemMouseup', _this, e);
  22002. });
  22003. });
  22004. }
  22005. this.superclass.initComponent.call(this);
  22006. this.on({
  22007. afterrender: function (sender) {
  22008. }
  22009. });
  22010. },
  22011. /**
  22012. * 重新载入
  22013. */
  22014. reload: function () {
  22015. var _this = this;
  22016. var _a;
  22017. if (typeof this.dataSource === 'string' && this.dataSource) {
  22018. var scope = lookupScope(this);
  22019. var fn = lookupFn(scope, this.dataSource);
  22020. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22021. _this.openDiagram(res.data);
  22022. });
  22023. }
  22024. },
  22025. /**
  22026. * 获取bpmn
  22027. */
  22028. getBpmn: function () {
  22029. return this._bpmn;
  22030. },
  22031. getBpmnCanvas: function () {
  22032. var _a;
  22033. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22034. },
  22035. getBpmnOverlays: function () {
  22036. var _a;
  22037. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22038. },
  22039. getBpmnZoomScroll: function () {
  22040. var _a;
  22041. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22042. },
  22043. handleZoomBig: function () {
  22044. var _a;
  22045. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22046. },
  22047. handleZoomSmall: function () {
  22048. var _a;
  22049. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22050. },
  22051. handleZoomReset: function () {
  22052. var _a;
  22053. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22054. },
  22055. openDiagram: function (diagram) {
  22056. var _this = this;
  22057. if (!this.getBpmn()) {
  22058. return;
  22059. }
  22060. this.getBpmn().importXML(diagram, function (err) {
  22061. if (err) {
  22062. // YvEventDispatch(this.onFailed, this, undefined);
  22063. _this.fireEvent('failed', _this, err);
  22064. return console.error('could not import BPMN 2.0 diagram', err);
  22065. }
  22066. // zoom to fit full viewport
  22067. _this.getBpmnCanvas().zoom('fit-viewport');
  22068. _this.fireEvent('success', _this);
  22069. });
  22070. },
  22071. });
  22072. }
  22073. //# sourceMappingURL=bpmn.js.map
  22074. function initSqlComplex () {
  22075. Ext.define('Yvan.SqlComplex', {
  22076. extend: 'Ext.panel.Panel',
  22077. xtype: 'sqlcomplex',
  22078. alias: 'widget.sqlcomplex',
  22079. getSqlExpress: function () {
  22080. },
  22081. constructor: function (config) {
  22082. var reference = config.reference;
  22083. var me = this;
  22084. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22085. {
  22086. region: 'west',
  22087. width: 280,
  22088. border: false,
  22089. split: true,
  22090. reference: reference + '_tree',
  22091. xtype: 'yvtree',
  22092. hideRefresh: true,
  22093. hideExpand: true,
  22094. hideCollapse: true,
  22095. listeners: {
  22096. itemdblclick: function (sender, record, item, index, e) {
  22097. var field = record.get('field');
  22098. var defaultValue = record.get('defaultValue');
  22099. if (!field) {
  22100. return;
  22101. }
  22102. var tabExpress = me.down('tabpanel');
  22103. var sqleditor = me.down('sqleditor');
  22104. var expressGrid = me.down('yvgrid');
  22105. if (tabExpress.getActiveTab().key !== 'grid') {
  22106. // SQL 模式
  22107. sqleditor.insertText(field + '=');
  22108. }
  22109. else {
  22110. // 表格模式
  22111. expressGrid.appendEditRow({
  22112. field: field,
  22113. operator: '=',
  22114. value: defaultValue,
  22115. remark: '',
  22116. });
  22117. _$2.defer(function () {
  22118. gridChanged(me, expressGrid);
  22119. });
  22120. }
  22121. }
  22122. },
  22123. },
  22124. {
  22125. region: 'center',
  22126. xtype: 'tabpanel',
  22127. reference: reference + '_tab',
  22128. tabPosition: 'bottom',
  22129. listeners: {
  22130. afterrender: function (sender) {
  22131. var scope = lookupScope(me);
  22132. var value = scope.viewModel.get(me.config.bindValue);
  22133. // sql 转换为 grid
  22134. try {
  22135. var list_1 = parseSqlToGrid(value);
  22136. _$2.defer(function () {
  22137. var grid = me.down('yvgrid');
  22138. grid.setData(list_1);
  22139. });
  22140. }
  22141. catch (e) {
  22142. console.error(e);
  22143. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22144. var tabSql = sender.down('sqleditor');
  22145. sender.setActiveTab(tabSql);
  22146. }
  22147. },
  22148. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22149. var scope = lookupScope(me);
  22150. var value = scope.viewModel.get(me.config.bindValue);
  22151. if (newCard.key === 'grid') {
  22152. // sql 转换为 grid
  22153. try {
  22154. var list_2 = parseSqlToGrid(value);
  22155. _$2.defer(function () {
  22156. var grid = me.down('yvgrid');
  22157. grid.setData(list_2);
  22158. });
  22159. return true;
  22160. }
  22161. catch (e) {
  22162. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22163. console.error(e);
  22164. return false;
  22165. }
  22166. }
  22167. else if (newCard.key === 'sql') {
  22168. // grid 转换为 sql
  22169. _$2.defer(function () {
  22170. var editor = me.down('sqleditor');
  22171. editor.setValue(value);
  22172. });
  22173. return true;
  22174. }
  22175. }
  22176. },
  22177. items: [
  22178. {
  22179. title: '表格模式',
  22180. key: 'grid',
  22181. xtype: 'yvgrid',
  22182. _mode: 'select',
  22183. reference: reference + '_grid',
  22184. hideFootbar: true,
  22185. pagination: false,
  22186. tbar: [
  22187. {
  22188. xtype: 'button',
  22189. text: '删除',
  22190. iconCls: 'x-fa fa-minus-circle',
  22191. cls: 'ext-btn-danger',
  22192. bind: {
  22193. disabled: '{!' + reference + '_grid.selection}',
  22194. },
  22195. listeners: {
  22196. click: function (sender) {
  22197. var grid = sender.up('yvgrid');
  22198. removeGridRow(grid);
  22199. gridChanged(me, grid);
  22200. }
  22201. },
  22202. },
  22203. ],
  22204. store: {},
  22205. listeners: {
  22206. editfinish: function (sender) {
  22207. gridChanged(me, sender);
  22208. },
  22209. },
  22210. columns: [
  22211. {
  22212. dataIndex: 'field',
  22213. header: '字段', sortable: false, menuDisabled: true,
  22214. width: 190,
  22215. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22216. var column = context.column;
  22217. var propertyConfig = me.config.propertyConfig;
  22218. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22219. var field = record.get('field');
  22220. if (field) {
  22221. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22222. if (idx >= 0) {
  22223. var meta = propertyConfig[idx];
  22224. return meta.text;
  22225. }
  22226. }
  22227. return value;
  22228. }
  22229. },
  22230. {
  22231. dataIndex: 'operator',
  22232. header: '运算符', sortable: false, menuDisabled: true,
  22233. dict: 'operator',
  22234. width: 65,
  22235. editor: { xtype: 'combo' },
  22236. },
  22237. {
  22238. dataIndex: 'value',
  22239. header: '值', sortable: false, menuDisabled: true,
  22240. flex: 1,
  22241. getEditor: function (record) {
  22242. var column = this;
  22243. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22244. var propertyConfig = me.config.propertyConfig;
  22245. var field = record.get('field');
  22246. if (!field) {
  22247. // 没有填 propertyName
  22248. return;
  22249. }
  22250. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22251. if (idx < 0) {
  22252. console.error('没有找到 field=' + field + ". propertyConfig");
  22253. return;
  22254. }
  22255. var meta = propertyConfig[idx];
  22256. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22257. return new Ext.grid.CellEditor({
  22258. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22259. });
  22260. }
  22261. return new Ext.grid.CellEditor({
  22262. field: __assign({ dict: meta.dict }, meta.editor)
  22263. });
  22264. },
  22265. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22266. var column = context.column;
  22267. var grid = _$2.get(view, 'ownerGrid');
  22268. var propertyConfig = me.config.propertyConfig;
  22269. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22270. var field = record.get('field');
  22271. if (field) {
  22272. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22273. if (idx >= 0) {
  22274. var meta = propertyConfig[idx];
  22275. var dictName = _$2.get(meta, 'dict');
  22276. if (dictName && window['DICT_CACHE'][dictName]) {
  22277. var dict_1 = window['DICT_CACHE'][dictName];
  22278. var valueText_1 = [];
  22279. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22280. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22281. if (idxKv >= 0) {
  22282. valueText_1.push(dict_1[idxKv].text);
  22283. }
  22284. else {
  22285. valueText_1.push(value);
  22286. }
  22287. });
  22288. return valueText_1.join(',');
  22289. }
  22290. }
  22291. }
  22292. return valueList;
  22293. },
  22294. },
  22295. ]
  22296. },
  22297. {
  22298. title: 'SQL模式',
  22299. key: 'sql',
  22300. xtype: 'sqleditor',
  22301. reference: reference + '_sql',
  22302. listeners: {
  22303. change: function (sender) {
  22304. var scope = lookupScope(me);
  22305. // 保存 editor 写入的值
  22306. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22307. }
  22308. }
  22309. },
  22310. ]
  22311. }
  22312. ] });
  22313. this.superclass.constructor.call(this, newConfig);
  22314. },
  22315. initComponent: function () {
  22316. // 货位条件树
  22317. var me = this;
  22318. me.superclass.initComponent.apply(this, arguments);
  22319. var tree = this.down('yvtree');
  22320. var config = me.config;
  22321. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22322. },
  22323. });
  22324. function gridChanged(me, grid) {
  22325. var data = grid.getDataRows();
  22326. var propertyConfig = me.config.propertyConfig;
  22327. var bindValue = me.config.bindValue;
  22328. var scope = lookupScope(me);
  22329. var sql = parseGridToSql(data);
  22330. scope.viewModel.set(bindValue, sql);
  22331. }
  22332. /**
  22333. * 用于从 propertyConfig 解析出树形结构
  22334. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22335. * ->
  22336. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22337. */
  22338. function buildConfigTree(propertyConfig) {
  22339. var root = {
  22340. expanded: true,
  22341. leaf: false,
  22342. children: []
  22343. };
  22344. var categoryObj = {};
  22345. var cfgList = propertyConfig;
  22346. _$2.forEach(cfgList, function (cfg) {
  22347. var cateNode = categoryObj[cfg.category];
  22348. if (!cateNode) {
  22349. cateNode = {
  22350. text: cfg.category, expanded: true, leaf: false,
  22351. children: []
  22352. };
  22353. categoryObj[cfg.category] = cateNode;
  22354. root.children.push(cateNode);
  22355. }
  22356. cateNode.children.push({
  22357. text: cfg.text,
  22358. field: cfg.field,
  22359. operator: cfg.operator,
  22360. defaultValue: cfg.defaultValue,
  22361. leaf: true,
  22362. });
  22363. });
  22364. return root;
  22365. }
  22366. /**
  22367. * 将表格变成 SQL where语句 [
  22368. * {field: 'f1', value: 1, operator: '='}
  22369. * {field: 'f2', value: 2, operator: '='}
  22370. * {field: 'f3', value: '3', operator: '>='}
  22371. * {field: 'f4', value: 4, operator: '='}
  22372. * ]
  22373. * ->
  22374. * f1=v1 and f2=v2
  22375. */
  22376. function parseGridToSql(list) {
  22377. var sqls = [];
  22378. _$2.forEach(list, function (i) {
  22379. var _a;
  22380. if (i.operator === 'in') {
  22381. sqls.push(i.field + ' in (' + (i.value) + ')');
  22382. }
  22383. else if (i.operator === 'notIn') {
  22384. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22385. }
  22386. else {
  22387. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22388. }
  22389. });
  22390. return sqls.join(' AND ');
  22391. }
  22392. /**
  22393. * 将 SQL 语句的 where 片段变成表格
  22394. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22395. * @return [
  22396. {field: 'f1', value: 1, operator: '='}
  22397. {field: 'f2', value: 2, operator: '='}
  22398. {field: 'f3', value: '3', operator: '>='}
  22399. {field: 'f4', value: 4, operator: '='}
  22400. ]
  22401. */
  22402. function parseSqlToGrid(sql) {
  22403. if (!sql || !_$2.trim(sql)) {
  22404. return [];
  22405. }
  22406. var parser = new window['NodeSQLParser'].Parser();
  22407. var ast = parser.astify('select * from dual where ' + sql);
  22408. var ret = [];
  22409. exp(ast.where, ret);
  22410. return ret;
  22411. }
  22412. function exp(ast, ret) {
  22413. if (ast.type === 'binary_expr') {
  22414. if (_$2.toUpper(ast.operator) === 'AND') {
  22415. if (ast.left.type === 'binary_expr') {
  22416. exp(ast.left, ret);
  22417. }
  22418. if (ast.right.type === 'binary_expr') {
  22419. exp(ast.right, ret);
  22420. }
  22421. }
  22422. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22423. if (ast.left.type === 'column_ref') {
  22424. if (ast.right.type === 'number' ||
  22425. ast.right.type === 'single_quote_string' ||
  22426. ast.right.type === 'double_quote_string') {
  22427. // 具体值相等
  22428. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22429. }
  22430. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22431. && ast.right.type === 'expr_list') {
  22432. // in / not in
  22433. var valueList_1 = [];
  22434. _$2.forEach(ast.right.value, function (item) {
  22435. valueList_1.push(item.value);
  22436. });
  22437. var operator = void 0;
  22438. if (_$2.toUpper(ast.operator) === 'IN') {
  22439. operator = 'in';
  22440. }
  22441. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22442. operator = 'notIn';
  22443. }
  22444. ret.push({
  22445. field: ast.left.column, value: valueList_1.join(','),
  22446. operator: operator
  22447. });
  22448. }
  22449. else {
  22450. throw new Error('ast.right must is value.');
  22451. }
  22452. }
  22453. else {
  22454. throw new Error('ast.left must is column_ref.');
  22455. }
  22456. }
  22457. else {
  22458. // 必须用 AND 条件符匹配
  22459. throw new Error('ast.operator must is "AND / =".');
  22460. }
  22461. }
  22462. else {
  22463. throw new Error('ast.type must is "binary_expr".');
  22464. }
  22465. }
  22466. /**
  22467. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22468. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22469. {
  22470. type: 'binary_expr',
  22471. operator: 'AND',
  22472. left: {
  22473. type: 'binary_expr',
  22474. operator: 'AND',
  22475. left: {
  22476. type: 'binary_expr',
  22477. operator: 'AND',
  22478. left: {
  22479. type: 'binary_expr',
  22480. operator: 'AND',
  22481. left: {
  22482. type: 'binary_expr',
  22483. operator: '=',
  22484. left: {
  22485. type: 'column_ref',
  22486. table: null,
  22487. column: 'f1'
  22488. },
  22489. right: {
  22490. type: 'number',
  22491. value: 1
  22492. }
  22493. },
  22494. right: {
  22495. type: 'binary_expr',
  22496. operator: '=',
  22497. left: {
  22498. type: 'column_ref',
  22499. table: null,
  22500. column: 'f2'
  22501. },
  22502. right: {
  22503. type: 'number',
  22504. value: 2
  22505. }
  22506. }
  22507. },
  22508. right: {
  22509. type: 'binary_expr',
  22510. operator: '=',
  22511. left: {
  22512. type: 'column_ref',
  22513. table: null,
  22514. column: 'f3'
  22515. },
  22516. right: {
  22517. type: 'single_quote_string',
  22518. value: '3'
  22519. }
  22520. }
  22521. },
  22522. right: {
  22523. type: 'binary_expr',
  22524. operator: '>=',
  22525. left: {
  22526. type: 'column_ref',
  22527. table: null,
  22528. column: 'f4'
  22529. },
  22530. right: {
  22531. type: 'number',
  22532. value: 4
  22533. }
  22534. }
  22535. },
  22536. right: {
  22537. type: 'binary_expr',
  22538. operator: '<',
  22539. left: {
  22540. type: 'column_ref',
  22541. table: null,
  22542. column: 'f4'
  22543. },
  22544. right: {
  22545. type: 'number',
  22546. value: 3
  22547. }
  22548. }
  22549. }
  22550. * */
  22551. }
  22552. //# sourceMappingURL=SqlComplex.js.map
  22553. function initParamComplex () {
  22554. Ext.define('Yvan.ParamComplex', {
  22555. extend: 'Ext.panel.Panel',
  22556. xtype: 'paramcomplex',
  22557. alias: 'widget.paramcomplex',
  22558. getSqlExpress: function () {
  22559. },
  22560. constructor: function (config) {
  22561. var reference = config.reference;
  22562. var me = this;
  22563. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22564. {
  22565. region: 'west',
  22566. width: 280,
  22567. border: false,
  22568. split: true,
  22569. reference: reference + '_tree',
  22570. xtype: 'yvtree',
  22571. hideRefresh: true,
  22572. hideExpand: true,
  22573. hideCollapse: true,
  22574. listeners: {
  22575. itemdblclick: function (sender, record, item, index, e) {
  22576. var field = record.get('field');
  22577. var defaultValue = record.get('defaultValue');
  22578. if (!field) {
  22579. return;
  22580. }
  22581. var tabExpress = me.down('tabpanel');
  22582. var sqleditor = me.down('sqleditor');
  22583. var expressGrid = me.down('yvgrid');
  22584. if (tabExpress.getActiveTab().key !== 'grid') {
  22585. // SQL 模式
  22586. sqleditor.insertText(field + '=');
  22587. }
  22588. else {
  22589. // 表格模式
  22590. expressGrid.appendEditRow({
  22591. field: field,
  22592. operator: '=',
  22593. value: defaultValue,
  22594. remark: '',
  22595. });
  22596. _$2.defer(function () {
  22597. gridChanged(me, expressGrid);
  22598. });
  22599. }
  22600. }
  22601. },
  22602. },
  22603. {
  22604. region: 'center',
  22605. xtype: 'tabpanel',
  22606. reference: reference + '_tab',
  22607. tabPosition: 'bottom',
  22608. listeners: {
  22609. afterrender: function (sender) {
  22610. var scope = lookupScope(me);
  22611. var value = scope.viewModel.get(me.config.bindValue);
  22612. // sql 转换为 grid
  22613. try {
  22614. var list_1 = parseParamToGrid(value);
  22615. _$2.defer(function () {
  22616. var grid = me.down('yvgrid');
  22617. grid.setData(list_1);
  22618. });
  22619. }
  22620. catch (e) {
  22621. console.error(e);
  22622. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22623. var tabSql = sender.down('sqleditor');
  22624. sender.setActiveTab(tabSql);
  22625. }
  22626. },
  22627. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22628. var scope = lookupScope(me);
  22629. var value = scope.viewModel.get(me.config.bindValue);
  22630. if (newCard.key === 'grid') {
  22631. // sql 转换为 grid
  22632. try {
  22633. var list_2 = parseParamToGrid(value);
  22634. _$2.defer(function () {
  22635. var grid = me.down('yvgrid');
  22636. grid.setData(list_2);
  22637. });
  22638. return true;
  22639. }
  22640. catch (e) {
  22641. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22642. console.error(e);
  22643. return false;
  22644. }
  22645. }
  22646. else if (newCard.key === 'sql') {
  22647. // grid 转换为 sql
  22648. _$2.defer(function () {
  22649. var editor = me.down('sqleditor');
  22650. editor.setValue(value);
  22651. });
  22652. return true;
  22653. }
  22654. }
  22655. },
  22656. items: [
  22657. {
  22658. title: '表格模式',
  22659. key: 'grid',
  22660. xtype: 'yvgrid',
  22661. _mode: 'select',
  22662. reference: reference + '_grid',
  22663. hideFootbar: true,
  22664. pagination: false,
  22665. tbar: [
  22666. {
  22667. xtype: 'button',
  22668. text: '删除',
  22669. iconCls: 'x-fa fa-minus-circle',
  22670. cls: 'ext-btn-danger',
  22671. bind: {
  22672. disabled: '{!' + reference + '_grid.selection}',
  22673. },
  22674. listeners: {
  22675. click: function (sender) {
  22676. var grid = sender.up('yvgrid');
  22677. removeGridRow(grid);
  22678. gridChanged(me, grid);
  22679. }
  22680. },
  22681. },
  22682. ],
  22683. store: {},
  22684. listeners: {
  22685. editfinish: function (sender) {
  22686. gridChanged(me, sender);
  22687. },
  22688. },
  22689. columns: [
  22690. {
  22691. dataIndex: 'field',
  22692. header: '字段', sortable: false, menuDisabled: true,
  22693. width: 190,
  22694. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22695. var column = context.column;
  22696. var propertyConfig = me.config.propertyConfig;
  22697. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22698. var field = record.get('field');
  22699. if (field) {
  22700. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22701. if (idx >= 0) {
  22702. var meta = propertyConfig[idx];
  22703. return meta.text;
  22704. }
  22705. }
  22706. return value;
  22707. }
  22708. },
  22709. {
  22710. dataIndex: 'value',
  22711. header: '值', sortable: false, menuDisabled: true,
  22712. flex: 1,
  22713. getEditor: function (record) {
  22714. var column = this;
  22715. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22716. var propertyConfig = me.config.propertyConfig;
  22717. var field = record.get('field');
  22718. if (!field) {
  22719. // 没有填 propertyName
  22720. return;
  22721. }
  22722. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22723. if (idx < 0) {
  22724. console.error('没有找到 field=' + field + ". propertyConfig");
  22725. return;
  22726. }
  22727. var meta = propertyConfig[idx];
  22728. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22729. return new Ext.grid.CellEditor({
  22730. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22731. });
  22732. }
  22733. return new Ext.grid.CellEditor({
  22734. field: __assign({ dict: meta.dict }, meta.editor)
  22735. });
  22736. },
  22737. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22738. var column = context.column;
  22739. var grid = _$2.get(view, 'ownerGrid');
  22740. var propertyConfig = me.config.propertyConfig;
  22741. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22742. var field = record.get('field');
  22743. if (field) {
  22744. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22745. if (idx >= 0) {
  22746. var meta = propertyConfig[idx];
  22747. var dictName = _$2.get(meta, 'dict');
  22748. if (dictName && window['DICT_CACHE'][dictName]) {
  22749. var dict_1 = window['DICT_CACHE'][dictName];
  22750. var valueText_1 = [];
  22751. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22752. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22753. if (idxKv >= 0) {
  22754. valueText_1.push(dict_1[idxKv].text);
  22755. }
  22756. else {
  22757. valueText_1.push(value);
  22758. }
  22759. });
  22760. return valueText_1.join(',');
  22761. }
  22762. }
  22763. }
  22764. return valueList;
  22765. },
  22766. },
  22767. ]
  22768. },
  22769. {
  22770. title: '文本模式',
  22771. key: 'sql',
  22772. xtype: 'sqleditor',
  22773. reference: reference + '_sql',
  22774. listeners: {
  22775. change: function (sender) {
  22776. var scope = lookupScope(me);
  22777. // 保存 editor 写入的值
  22778. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22779. }
  22780. }
  22781. },
  22782. ]
  22783. }
  22784. ] });
  22785. this.superclass.constructor.call(this, newConfig);
  22786. },
  22787. initComponent: function () {
  22788. // 货位条件树
  22789. var me = this;
  22790. me.superclass.initComponent.apply(this, arguments);
  22791. var tree = this.down('yvtree');
  22792. var config = me.config;
  22793. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22794. },
  22795. });
  22796. function gridChanged(me, grid) {
  22797. var data = grid.getDataRows();
  22798. var propertyConfig = me.config.propertyConfig;
  22799. var bindValue = me.config.bindValue;
  22800. var scope = lookupScope(me);
  22801. var sql = parseGridToParam(data);
  22802. scope.viewModel.set(bindValue, sql);
  22803. }
  22804. /**
  22805. * 用于从 propertyConfig 解析出树形结构
  22806. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22807. * ->
  22808. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22809. */
  22810. function buildConfigTree(propertyConfig) {
  22811. var root = {
  22812. expanded: true,
  22813. leaf: false,
  22814. children: []
  22815. };
  22816. var categoryObj = {};
  22817. var cfgList = propertyConfig;
  22818. _$2.forEach(cfgList, function (cfg) {
  22819. var cateNode = categoryObj[cfg.category];
  22820. if (!cateNode) {
  22821. cateNode = {
  22822. text: cfg.category, expanded: true, leaf: false,
  22823. children: []
  22824. };
  22825. categoryObj[cfg.category] = cateNode;
  22826. root.children.push(cateNode);
  22827. }
  22828. cateNode.children.push({
  22829. text: cfg.text,
  22830. field: cfg.field,
  22831. operator: cfg.operator,
  22832. defaultValue: cfg.defaultValue,
  22833. leaf: true,
  22834. });
  22835. });
  22836. return root;
  22837. }
  22838. /**
  22839. * 将表格变成参数语句 [
  22840. * {field: 'f1', value: 1}
  22841. * {field: 'f2', value: 2}
  22842. * {field: 'f3', value: '3'}
  22843. * {field: 'f4', value: 4}
  22844. * ]
  22845. * ->
  22846. * f1=v1, f2=v2
  22847. */
  22848. function parseGridToParam(list) {
  22849. var sqls = [];
  22850. _$2.forEach(list, function (i) {
  22851. sqls.push(i.field + '=' + (i.value));
  22852. });
  22853. return sqls.join('; ');
  22854. }
  22855. /**
  22856. * 将 分号分割的的参数设置 变成表格
  22857. * @param param a=1; b=2; c='3'
  22858. * @return [
  22859. {field: 'a', value: 1}
  22860. {field: 'b', value: 2}
  22861. {field: 'c', value: '3'}
  22862. ]
  22863. */
  22864. function parseParamToGrid(param) {
  22865. if (!param || !_$2.trim(param)) {
  22866. return [];
  22867. }
  22868. var ret = [];
  22869. var sp = _$2.split(param, ';');
  22870. _$2.forEach(sp, function (v) {
  22871. var vi = _$2.indexOf(v, '=');
  22872. var field = _$2.trim(v.substr(0, vi));
  22873. var value = eval(v.substr(vi + 1));
  22874. ret.push({ field: field, value: value });
  22875. });
  22876. return ret;
  22877. }
  22878. }
  22879. //# sourceMappingURL=ParamComplex.js.map
  22880. function initSqlEditor () {
  22881. Ext.define('com.yvan.studio.SqlEditor', {
  22882. extend: 'Ext.panel.Panel',
  22883. alias: 'widget.sqleditor',
  22884. xtype: 'sqleditor',
  22885. layout: 'fit',
  22886. border: false,
  22887. html: "<div class=\"editor\"/>",
  22888. config: {
  22889. value: ''
  22890. },
  22891. codeChange: undefined,
  22892. isChangeFromOuter: false,
  22893. setCode: function (value) {
  22894. var _this = this;
  22895. this.code = value;
  22896. this.value = value;
  22897. _$2.defer(function () {
  22898. _this.isChangeFromOuter = true;
  22899. if (_this.editor) {
  22900. _this.editor.setValue(value);
  22901. }
  22902. });
  22903. },
  22904. getCode: function () {
  22905. return this.getValue();
  22906. },
  22907. updateOptions: function (options) {
  22908. if (this.editor && options) {
  22909. this.editor.updateOptions(options);
  22910. }
  22911. },
  22912. getValue: function () {
  22913. if (!this.editor) {
  22914. return this.code;
  22915. }
  22916. return this.editor.getValue();
  22917. },
  22918. applyPosition: function () {
  22919. var _this = this;
  22920. if (this.autoFocusMethod) {
  22921. if (this.editor) {
  22922. _$2.defer(function () {
  22923. if (_this.autoFocusStartLine) {
  22924. _this.editor.setPosition({
  22925. lineNumber: _this.autoFocusStartLine,
  22926. column: _this.autoFocusStartColumn
  22927. });
  22928. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22929. }
  22930. _this.editor.focus();
  22931. });
  22932. delete this.autoFocusMethod;
  22933. }
  22934. }
  22935. this.editor.layout();
  22936. },
  22937. insertText: function (text) {
  22938. var editor = this.editor;
  22939. var position = editor.getPosition();
  22940. editor.executeEdits('', [
  22941. {
  22942. range: {
  22943. startLineNumber: position.lineNumber,
  22944. startColumn: position.column,
  22945. endLineNumber: position.lineNumber,
  22946. endColumn: position.column
  22947. },
  22948. text: text
  22949. }
  22950. ]);
  22951. },
  22952. setValue: function (value, fromEditor) {
  22953. this.setCode(value);
  22954. var me = this;
  22955. if (me.value === value) {
  22956. // 值相等,不需要变化
  22957. return;
  22958. }
  22959. if (fromEditor !== true && me.editor) {
  22960. // 不是来源于编辑器的变化,才设置编辑器的值
  22961. me.editor.setValue(value);
  22962. }
  22963. // 通知mixins setValue
  22964. me.value = value;
  22965. me.fireEvent('change', value);
  22966. },
  22967. initComponent: function () {
  22968. var that = this;
  22969. this.superclass.initComponent.call(this);
  22970. that.on({
  22971. resize: function () {
  22972. if (that.editor) {
  22973. that.editor.layout();
  22974. }
  22975. },
  22976. destory: function () {
  22977. if (that.editor) {
  22978. that.editor.dispose();
  22979. delete that.editor;
  22980. }
  22981. },
  22982. afterrender: function (sender) {
  22983. var $dom = $(that.el.dom).find('.editor');
  22984. attach_2($dom[0], {
  22985. value: that.code
  22986. }).then(function (editor) {
  22987. that.editor = editor;
  22988. that.applyPosition();
  22989. that.editor.onDidChangeModelContent(function (e) {
  22990. that.fireEvent('change', that.editor, e);
  22991. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22992. that.codeChange(that.editor.getValue(), that.name, e);
  22993. }
  22994. that.isChangeFromOuter = false;
  22995. });
  22996. });
  22997. }
  22998. });
  22999. }
  23000. });
  23001. function attach_2(element, opts) {
  23002. if (!window['monaco']) {
  23003. return;
  23004. }
  23005. var monaco = window['monaco'];
  23006. return new Promise(function (resolve) {
  23007. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  23008. enabled: false
  23009. } }));
  23010. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  23011. // const sql = editor.getValue()
  23012. // if (_.trim(sql).length > 0) {
  23013. // editor.setValue(format(sql, {
  23014. // indent: ' ',
  23015. // uppercase: true,
  23016. // }))
  23017. // }
  23018. // })
  23019. editor.onKeyUp(function (e) {
  23020. // console.log(e)
  23021. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23022. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23023. }
  23024. });
  23025. resolve(editor);
  23026. });
  23027. }
  23028. }
  23029. //# sourceMappingURL=SqlEditor.js.map
  23030. function initJsonEditor () {
  23031. Ext.define('com.yvan.studio.JsonEditor', {
  23032. extend: 'Ext.panel.Panel',
  23033. alias: 'widget.jsoneditor',
  23034. xtype: 'jsoneditor',
  23035. layout: 'fit',
  23036. border: false,
  23037. html: "<div class=\"editor\"/>",
  23038. autoFocusMethod: true,
  23039. autoFocusStartLine: 0,
  23040. autoFocusStartColumn: 0,
  23041. codeChange: undefined,
  23042. funcArr: [],
  23043. modulePage: null,
  23044. isChangeFromOuter: false,
  23045. name: "",
  23046. /**
  23047. * 设置代码
  23048. */
  23049. setCode: function (value) {
  23050. var _this = this;
  23051. this.code = value;
  23052. _$2.defer(function () {
  23053. _this.isChangeFromOuter = true;
  23054. if (_this.editor) {
  23055. _this.editor.setValue(value);
  23056. }
  23057. });
  23058. },
  23059. updateOptions: function (options) {
  23060. if (this.editor && options) {
  23061. this.editor.updateOptions(options);
  23062. }
  23063. },
  23064. setLanguage: function (lang) {
  23065. if (!window['monaco']) {
  23066. return;
  23067. }
  23068. var monaco = window['monaco'];
  23069. if (this.editor && lang) {
  23070. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23071. }
  23072. },
  23073. getCode: function () {
  23074. var _a;
  23075. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23076. },
  23077. applyPosition: function () {
  23078. var _this = this;
  23079. if (this.autoFocusMethod) {
  23080. if (this.editor) {
  23081. _$2.defer(function () {
  23082. if (_this.autoFocusStartLine) {
  23083. _this.editor.setPosition({
  23084. lineNumber: _this.autoFocusStartLine,
  23085. column: _this.autoFocusStartColumn
  23086. });
  23087. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23088. }
  23089. _this.editor.focus();
  23090. });
  23091. delete this.autoFocusMethod;
  23092. }
  23093. }
  23094. this.editor.layout();
  23095. },
  23096. initComponent: function () {
  23097. var that = this;
  23098. this.superclass.initComponent.apply(this, arguments);
  23099. this.on({
  23100. resize: function (sender, width, height) {
  23101. if (that.editor) {
  23102. that.editor.layout();
  23103. }
  23104. },
  23105. destory: function () {
  23106. if (that.editor) {
  23107. that.editor.dispose();
  23108. delete that.editor;
  23109. }
  23110. },
  23111. afterrender: function (sender) {
  23112. var $dom = $(that.el.dom).find('.editor');
  23113. attach_116($dom[0], {
  23114. value: that.code
  23115. }).then(function (editor) {
  23116. that.editor = editor;
  23117. that.applyPosition();
  23118. that.editor.onDidChangeModelContent(function (e) {
  23119. that.fireEvent('change', that.editor, e);
  23120. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23121. that.codeChange(that.editor.getValue(), that.name, e);
  23122. }
  23123. that.isChangeFromOuter = false;
  23124. });
  23125. });
  23126. }
  23127. });
  23128. },
  23129. });
  23130. function attach_116(element, opts) {
  23131. if (!window['monaco']) {
  23132. return;
  23133. }
  23134. var monaco = window['monaco'];
  23135. return new Promise(function (resolve) {
  23136. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23137. enabled: false
  23138. } }));
  23139. editor.onKeyUp(function (e) {
  23140. // console.log(e)
  23141. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23142. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23143. }
  23144. });
  23145. resolve(editor);
  23146. });
  23147. }
  23148. }
  23149. //# sourceMappingURL=JsonEditor.js.map
  23150. function initJsEditor () {
  23151. Ext.define('com.yvan.studio.JsEditor', {
  23152. extend: 'Ext.panel.Panel',
  23153. alias: 'widget.jseditor',
  23154. xtype: 'jseditor',
  23155. layout: 'fit',
  23156. border: false,
  23157. html: "<div class=\"editor\"/>",
  23158. autoFocusMethod: true,
  23159. autoFocusStartLine: 0,
  23160. autoFocusStartColumn: 0,
  23161. codeChange: undefined,
  23162. funcArr: [],
  23163. modulePage: null,
  23164. isChangeFromOuter: false,
  23165. name: "",
  23166. /**
  23167. * 设置代码
  23168. */
  23169. setCode: function (value) {
  23170. var _this = this;
  23171. this.code = value;
  23172. _$2.defer(function () {
  23173. _this.isChangeFromOuter = true;
  23174. if (_this.editor) {
  23175. _this.editor.setValue(value);
  23176. if (_this.name === "controllerEditor") {
  23177. _this.funcArr = _this.getAllFunction();
  23178. }
  23179. }
  23180. });
  23181. },
  23182. getCode: function () {
  23183. var _a;
  23184. if (!this.editor) {
  23185. return this.code;
  23186. }
  23187. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23188. },
  23189. applyPosition: function () {
  23190. var _this = this;
  23191. if (this.autoFocusMethod) {
  23192. if (this.editor) {
  23193. _$2.defer(function () {
  23194. if (_this.autoFocusStartLine) {
  23195. _this.editor.setPosition({
  23196. lineNumber: _this.autoFocusStartLine,
  23197. column: _this.autoFocusStartColumn
  23198. });
  23199. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23200. }
  23201. _this.editor.focus();
  23202. });
  23203. delete this.autoFocusMethod;
  23204. }
  23205. }
  23206. this.editor.layout();
  23207. },
  23208. initComponent: function () {
  23209. var that = this;
  23210. this.superclass.initComponent.apply(this, arguments);
  23211. this.on({
  23212. resize: function (sender, width, height) {
  23213. if (that.editor) {
  23214. that.editor.layout();
  23215. }
  23216. },
  23217. destory: function () {
  23218. if (that.editor) {
  23219. that.editor.dispose();
  23220. delete that.editor;
  23221. }
  23222. },
  23223. afterrender: function () {
  23224. var $dom = $(that.el.dom).find('.editor');
  23225. attach_1($dom[0], {
  23226. value: that.code
  23227. }).then(function (editor) {
  23228. that.editor = editor;
  23229. that.applyPosition();
  23230. that.editor.onDidChangeModelContent(function (e) {
  23231. that.fireEvent('change', that.editor, e);
  23232. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23233. that.codeChange(that.editor.getValue(), that.name, e);
  23234. }
  23235. that.isChangeFromOuter = false;
  23236. });
  23237. });
  23238. }
  23239. });
  23240. },
  23241. getAllFunction: function () {
  23242. var funcArr = [];
  23243. var ast = window['YvanUI'].recast.parse(this.code);
  23244. if (ast && ast.program && ast.program.body) {
  23245. if (Array.isArray(ast.program.body)) {
  23246. for (var i = 0; i < ast.program.body.length; i++) {
  23247. var m = ast.program.body[i];
  23248. if (m.type === "ExportDefaultDeclaration") {
  23249. if (m.declaration.type === "ClassDeclaration") {
  23250. if (m.declaration.body.type === "ClassBody") {
  23251. if (Array.isArray(m.declaration.body.body)) {
  23252. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23253. var ob = m.declaration.body.body[j];
  23254. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23255. var funcItem = { name: ob.key.name, args: [] };
  23256. if (Array.isArray(ob.value.params)) {
  23257. for (var k = 0; k < ob.value.params.length; k++) {
  23258. var p = ob.value.params[k];
  23259. funcItem.args.push(p.name);
  23260. }
  23261. }
  23262. funcArr.push(funcItem);
  23263. }
  23264. }
  23265. }
  23266. }
  23267. }
  23268. }
  23269. }
  23270. }
  23271. }
  23272. return funcArr;
  23273. }
  23274. });
  23275. var isInited = false;
  23276. function attach_1(element, opts) {
  23277. if (!window['monaco']) {
  23278. return;
  23279. }
  23280. var monaco = window['monaco'];
  23281. return new Promise(function (resolve) {
  23282. if (!isInited) {
  23283. isInited = true;
  23284. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23285. noSemanticValidation: true,
  23286. noSyntaxValidation: false
  23287. });
  23288. // compiler options
  23289. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23290. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23291. allowNonTsExtensions: true,
  23292. });
  23293. // extra libraries
  23294. var libSource = [
  23295. 'declare class Facts {',
  23296. ' /**',
  23297. ' * Returns the next fact',
  23298. ' */',
  23299. ' static next():string',
  23300. ' static next222():string',
  23301. '}',
  23302. "\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 ",
  23303. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23304. ].join('\n');
  23305. var libUri = 'file:///index.d.ts';
  23306. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23307. // When resolving definitions and references, the editor will try to use created models.
  23308. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23309. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23310. }
  23311. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23312. resolve(editor);
  23313. });
  23314. }
  23315. }
  23316. //# sourceMappingURL=JsEditor.js.map
  23317. function initClipboard () {
  23318. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23319. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23320. Ext.grid.plugin.Clipboard.override({
  23321. getCellData: function (format, erase) {
  23322. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23323. if (selection) {
  23324. selection.eachCell(function (cellContext) {
  23325. column = cellContext.column;
  23326. view = cellContext.column.getView();
  23327. record = cellContext.record;
  23328. // Do not copy the check column or row numberer column
  23329. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23330. return;
  23331. }
  23332. if (lastRecord !== record) {
  23333. lastRecord = record;
  23334. ret.push(row = []);
  23335. }
  23336. dataIndex = column.dataIndex;
  23337. // 记录原始数据
  23338. var rData = record.data[dataIndex];
  23339. if (isRaw) {
  23340. data = record.data[dataIndex];
  23341. }
  23342. else {
  23343. // Try to access the view node.
  23344. viewNode = view.all.item(cellContext.rowIdx);
  23345. // If we could not, it's because it's outside of the rendered block -
  23346. // recreate it.
  23347. if (!viewNode) {
  23348. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23349. }
  23350. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23351. data = cell.innerHTML;
  23352. if (isText) {
  23353. data = Ext.util.Format.stripTags(data);
  23354. }
  23355. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23356. data = data || rData;
  23357. }
  23358. row.push(data);
  23359. if (erase && dataIndex) {
  23360. record.set(dataIndex, null);
  23361. }
  23362. });
  23363. }
  23364. // See decode() comment below
  23365. return Ext.util.TSV.encode(ret, undefined, null);
  23366. },
  23367. getCells: function (format, erase) {
  23368. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23369. if (selection) {
  23370. selection.eachCell(function (cellContext) {
  23371. record = cellContext.record;
  23372. if (lastRecord !== record) {
  23373. lastRecord = record;
  23374. ret.push(row = {
  23375. model: record.self,
  23376. fields: []
  23377. });
  23378. }
  23379. dataIndex = cellContext.column.dataIndex;
  23380. row.fields.push({
  23381. name: dataIndex,
  23382. value: record.data[dataIndex]
  23383. });
  23384. if (erase && dataIndex) {
  23385. record.set(dataIndex, null);
  23386. }
  23387. });
  23388. }
  23389. return ret;
  23390. },
  23391. getTextData: function (format, erase) {
  23392. return this.getCellData(format, erase);
  23393. },
  23394. putCellData: function (data, format) {
  23395. var _a;
  23396. 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 = {};
  23397. // If the view is not focused, use the first cell of the selection as the destination.
  23398. if (!destination && selected) {
  23399. selected.eachCell(function (c) {
  23400. destination = c;
  23401. return false;
  23402. });
  23403. }
  23404. if (destination) {
  23405. // Create a new Context based upon the outermost View.
  23406. // NavigationModel works on local views.
  23407. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23408. // At that point, we can use navModel.getPosition()
  23409. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23410. }
  23411. else {
  23412. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23413. }
  23414. destinationStartColumn = destination.colIdx;
  23415. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23416. row = values[sourceRowIdx];
  23417. // Collect new values in dataObject
  23418. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23419. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23420. continue;
  23421. }
  23422. dataIndex = destination.column.dataIndex;
  23423. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23424. if (dataIndex) {
  23425. switch (format) {
  23426. // Raw field values
  23427. case 'raw':
  23428. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23429. break;
  23430. // Textual data with HTML tags stripped
  23431. case 'text':
  23432. {
  23433. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23434. // 获取字典原始的value
  23435. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23436. }
  23437. else {
  23438. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23439. }
  23440. break;
  23441. }
  23442. }
  23443. }
  23444. // If we are at the end of the destination row, break the column loop.
  23445. if (destination.colIdx === maxColIdx) {
  23446. break;
  23447. }
  23448. destination.setColumn(destination.colIdx + 1);
  23449. }
  23450. // Update the record in one go.
  23451. destination.record.set(dataObject);
  23452. // If we are at the end of the destination store, break the row loop.
  23453. if (destination.rowIdx === maxRowIdx) {
  23454. break;
  23455. }
  23456. // Jump to next row in destination
  23457. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23458. }
  23459. },
  23460. putTextData: function (data, format) {
  23461. var _a, _b, _c;
  23462. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23463. // 根据复制的行数自动添加新的行
  23464. 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;
  23465. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23466. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23467. this.cmp.getStore().add({});
  23468. }
  23469. }
  23470. this.putCellData(data, format);
  23471. },
  23472. });
  23473. }
  23474. //# sourceMappingURL=clipboard.js.map
  23475. function initDict () {
  23476. var DICT_CACHE = window['DICT_CACHE'];
  23477. if (!DICT_CACHE) {
  23478. DICT_CACHE = {};
  23479. window['DICT_CACHE'] = DICT_CACHE;
  23480. }
  23481. DICT_CACHE.XTYPE = [
  23482. { id: 'datefield', text: '日期' },
  23483. { id: 'datetimefield', text: '日期时间' },
  23484. { id: 'textfield', text: '文本' },
  23485. { id: 'numberfield', text: '数字' },
  23486. { id: 'combo', text: '下拉框' },
  23487. ];
  23488. DICT_CACHE.operator = [
  23489. { id: '=', text: '=' },
  23490. { id: '>', text: '>' },
  23491. { id: '<', text: '<' },
  23492. { id: '>=', text: '>=' },
  23493. { id: '<=', text: '<=' },
  23494. { id: 'in', text: 'in' },
  23495. { id: 'notIn', text: 'notIn' },
  23496. ];
  23497. DICT_CACHE.GRID_MODE = [
  23498. { id: 'edit1', text: '单机编辑模式' },
  23499. { id: 'edit2', text: '双击编辑模式' },
  23500. { id: 'checkbox', text: '勾选' },
  23501. { id: 'checkonly', text: '只勾选' },
  23502. { id: 'select', text: '行选择模式' },
  23503. ];
  23504. DICT_CACHE.BOTH_SELECT = [
  23505. { id: 'N/A', text: '<无>' },
  23506. { id: 'textfield', text: '文本' },
  23507. { id: 'numberfield', text: '数字框' },
  23508. { id: 'datefield', text: '日期' },
  23509. { id: 'datetimefield', text: '日期时间' },
  23510. { id: 'combo', text: '下拉框' },
  23511. { id: 'combogrid', text: '下拉表' },
  23512. { id: 'checkbox', text: '勾选' },
  23513. ];
  23514. DICT_CACHE.ROW_LAYOUT = [
  23515. { id: 'flex', text: '按权重摆放' },
  23516. { id: 'hbox', text: '按宽度摆放' },
  23517. ];
  23518. DICT_CACHE.GRID_XTYPE = [
  23519. { id: 'N/A', text: '<无>' },
  23520. { id: 'textfield', text: '文本-textfield' },
  23521. { id: 'numberfield', text: '数字框-numberfield' },
  23522. { id: 'datefield', text: '日期-datefield' },
  23523. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23524. { id: 'combo', text: '下拉框-combo' },
  23525. { id: 'combogrid', text: '下拉表-combogrid' },
  23526. { id: 'checkbox', text: '勾选-checkbox' },
  23527. ];
  23528. DICT_CACHE.FORM_XTYPE = [
  23529. { id: 'N/A', text: '<无>' },
  23530. { id: 'textfield', text: '文本-textfield' },
  23531. { id: 'numberfield', text: '数字框-numberfield' },
  23532. { id: 'datefield', text: '日期-datefield' },
  23533. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23534. { id: 'combo', text: '下拉框-combo' },
  23535. { id: 'combogrid', text: '下拉表-combogrid' },
  23536. { id: 'checkbox', text: '勾选-checkbox' },
  23537. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23538. ];
  23539. DICT_CACHE.GRID_FORMATTER = [
  23540. { id: 'N/A', text: '默认' },
  23541. { id: 'rownum', text: '序号-rownum' },
  23542. { id: 'button', text: '按钮-button' },
  23543. { id: 'checkbox', text: '勾选-checkbox' },
  23544. { id: 'progres', text: '进度条-progres' },
  23545. ];
  23546. }
  23547. //# sourceMappingURL=dict.js.map
  23548. function initDesigner () {
  23549. Ext.define('com.yvan.studio.designer', {
  23550. extend: 'Ext.panel.Panel',
  23551. alias: 'widget.designer',
  23552. xtype: 'designer',
  23553. layout: 'fit',
  23554. items: [],
  23555. constructor: function (config) {
  23556. var self = this;
  23557. var newConfig = _$2.defaultsDeep({
  23558. // 强制性属性
  23559. }, config);
  23560. this.superclass.constructor.call(self, newConfig);
  23561. },
  23562. initComponent: function () {
  23563. var me = this;
  23564. me.on({
  23565. afterrender: function () {
  23566. }
  23567. });
  23568. this.superclass.initComponent.call(me);
  23569. }
  23570. });
  23571. }
  23572. //# sourceMappingURL=designer.js.map
  23573. var FixClass = /** @class */ (function () {
  23574. function FixClass() {
  23575. }
  23576. FixClass.prototype.fix = function (me, config) {
  23577. var _this = this;
  23578. if (isDesignMode(me, config)) {
  23579. return;
  23580. }
  23581. if (!config) {
  23582. return;
  23583. }
  23584. var fix = config.fix;
  23585. if (!fix) {
  23586. return;
  23587. }
  23588. delete config.fix;
  23589. // 这里有个 bug
  23590. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23591. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23592. var scope;
  23593. if (config.$initParent) {
  23594. // 在面板上的组件
  23595. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23596. }
  23597. else if (config.column) {
  23598. // 在列上的组件
  23599. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23600. }
  23601. if (_$2.isArray(fix)) {
  23602. _$2.each(fix, function (f) {
  23603. var fn = lookupFn(scope, f);
  23604. fn.call(_this, me, config);
  23605. });
  23606. }
  23607. else if (_$2.isString(fix)) {
  23608. var fn = lookupFn(scope, fix);
  23609. fn.call(this, me, config);
  23610. }
  23611. };
  23612. __decorate([
  23613. baseConfigProcess(),
  23614. __metadata("design:type", Function),
  23615. __metadata("design:paramtypes", [Object, Object]),
  23616. __metadata("design:returntype", void 0)
  23617. ], FixClass.prototype, "fix", null);
  23618. return FixClass;
  23619. }());
  23620. //# sourceMappingURL=fix.js.map
  23621. function init$1() {
  23622. // 引入 filters 过滤插件
  23623. Ext.require([
  23624. 'Ext.grid.filters.Filters'
  23625. ]);
  23626. // 启用 tooltip 快捷提示
  23627. Ext.QuickTips.init();
  23628. // 定义日期格式化方法
  23629. if (Ext.util && Ext.util.Format) {
  23630. Ext.apply(Ext.util.Format, {
  23631. dateFormat: 'Y-m-d'
  23632. });
  23633. }
  23634. Ext.form.field.Display.override({
  23635. cls: 'yvan-display-field',
  23636. labelAlign: 'right'
  23637. });
  23638. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23639. override: "Ext.picker.Date",
  23640. format: "Y-m-d",
  23641. });
  23642. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23643. override: "Ext.form.field.Date",
  23644. format: "Y-m-d",
  23645. });
  23646. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23647. override: "Ext.grid.PropertyColumnModel",
  23648. format: "Y-m-d",
  23649. });
  23650. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23651. override: "Ext.view.AbstractView",
  23652. loadingText: "读取中..."
  23653. });
  23654. Ext.LoadMask.prototype.msg = '请稍后...';
  23655. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23656. override: "Ext.grid.header.Container",
  23657. sortClearText: '不排序',
  23658. sortAscText: "正序",
  23659. sortDescText: "倒序",
  23660. lockText: "锁定列",
  23661. unlockText: "解除锁定",
  23662. columnsText: "字段隐藏"
  23663. });
  23664. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23665. override: "Ext.grid.filters.filter.Date",
  23666. fields: {
  23667. lt: { text: '之前' },
  23668. gt: { text: '之后' },
  23669. eq: { text: '相等' },
  23670. },
  23671. // Defaults to Ext.Date.defaultFormat
  23672. dateFormat: null
  23673. });
  23674. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23675. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23676. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23677. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23678. override: "Ext.grid.locking.Lockable",
  23679. lockText: "锁定",
  23680. unlockText: '解锁',
  23681. });
  23682. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23683. override: "Ext.grid.filters.Filters",
  23684. menuFilterText: "过滤"
  23685. });
  23686. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23687. override: "Ext.grid.filters.filter.Boolean",
  23688. yesText: "已钩选",
  23689. noText: "未勾选"
  23690. });
  23691. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23692. override: "Ext.grid.filters.filter.String",
  23693. emptyText: "输入过滤文本..."
  23694. });
  23695. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23696. override: "Ext.grid.filters.filter.Number",
  23697. emptyText: "输入数字..."
  23698. });
  23699. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23700. override: "Ext.PagingToolbar",
  23701. beforePageText: "第",
  23702. // update
  23703. afterPageText: "/ {0} 页",
  23704. // update
  23705. firstText: "第一页",
  23706. prevText: "上一页",
  23707. // update
  23708. nextText: "下一页",
  23709. lastText: "最后页",
  23710. refreshText: "刷新",
  23711. displayMsg: "总共 {2} 条",
  23712. // update
  23713. emptyMsg: '没有数据'
  23714. });
  23715. /**
  23716. * 改变事件的获取方式.
  23717. * 具体见: ext-all-debug.js:23216 addListener
  23718. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23719. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23720. */
  23721. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23722. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23723. if (typeof fn === 'string' &&
  23724. (_$2.startsWith(fn, 'scope.') ||
  23725. _$2.startsWith(fn, 'system.') ||
  23726. _$2.startsWith(fn, 'format.'))) {
  23727. scope = lookupScope(this);
  23728. if (isDesignMode(scope, undefined)) {
  23729. fn = Ext.emptyFn;
  23730. }
  23731. else {
  23732. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23733. // const vm = this.lookupViewModel()
  23734. // if (vm && vm.yvanScope) {
  23735. // scope = vm.yvanScope
  23736. // fn = scope[fn.substr('scope.'.length)]
  23737. // }
  23738. fn = lookupFn(scope, fn, this);
  23739. }
  23740. }
  23741. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23742. };
  23743. // 将 SystemLib 扩展到 window.system 下
  23744. if (!window['system']) {
  23745. window['system'] = {};
  23746. }
  23747. _$2.extend(window['system'], SystemLib);
  23748. _$2.extend(window['system'], {
  23749. showGridRowDetail: showGridRowDetail
  23750. });
  23751. Ext.apply(Ext.util.Format, {
  23752. // 百分比
  23753. percentRenderer: function (v, rd, model) {
  23754. if (!v) {
  23755. v = 0;
  23756. }
  23757. if (typeof v === 'string') {
  23758. v = parseInt(v);
  23759. }
  23760. var valueString = v.toFixed(2);
  23761. var valueFixed = v > 100 ? 100 : v;
  23762. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23763. var cls = '';
  23764. if (v < 90) {
  23765. cls = 'danger';
  23766. }
  23767. else if (v < 100) {
  23768. cls = 'warning';
  23769. }
  23770. else {
  23771. cls = 'success';
  23772. }
  23773. return Ext.String
  23774. .format(
  23775. // '<div>'
  23776. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23777. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23778. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23779. // + '</div></div>', valueString, valueFixed, cls);
  23780. '<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(
  23781. // '<div>'
  23782. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23783. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23784. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23785. // + '</div></div>', v, valueFixed, valueString);
  23786. },
  23787. //button
  23788. button: function (v, rd, model) {
  23789. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23790. }
  23791. });
  23792. initComponent();
  23793. initPanel();
  23794. initGridColumn();
  23795. initTree();
  23796. initGrid();
  23797. initMainTab();
  23798. initTextfield();
  23799. initCombo();
  23800. initTag();
  23801. initContainer();
  23802. initRows();
  23803. initCols();
  23804. initForm();
  23805. initToolbar();
  23806. initSplitter();
  23807. initButton();
  23808. initStores();
  23809. initSearch();
  23810. initMultipleSearch();
  23811. initDate();
  23812. initDateTimePicker();
  23813. initDateTime();
  23814. initNumber();
  23815. initCheckbox();
  23816. initCheckboxGroup();
  23817. initRadio();
  23818. initRadioGroup();
  23819. initFieldset();
  23820. initCombotree();
  23821. initPickerPlus();
  23822. initCombogrid();
  23823. initComboGridMulti();
  23824. initIframe();
  23825. initBpmn();
  23826. initSqlEditor();
  23827. initJsonEditor();
  23828. initJsEditor();
  23829. initClipboard();
  23830. initSqlComplex();
  23831. initParamComplex();
  23832. initDict();
  23833. initDesigner();
  23834. }
  23835. //# sourceMappingURL=init.js.map
  23836. /**
  23837. * 创建一个 Ajax 客户端
  23838. */
  23839. function createAjax(createOption) {
  23840. if (createOption.baseUrl) {
  23841. axios__default.defaults.baseURL = createOption.baseUrl;
  23842. axios__default.defaults.timeout = createOption.timeout;
  23843. storeAjax.timeout = createOption.timeout;
  23844. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23845. }
  23846. return function (option) {
  23847. //@ts-ignore
  23848. option.method = (option.method || 'get').toLocaleLowerCase();
  23849. //@ts-ignore
  23850. var ax = __assign({}, option);
  23851. switch (option.method) {
  23852. case 'get':
  23853. ax.method = 'GET';
  23854. ax.params = option.param;
  23855. ax.headers = __assign({}, option.headers);
  23856. break;
  23857. case 'post':
  23858. ax.method = 'POST';
  23859. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23860. ax.params = option.param;
  23861. ax.data = Qs.stringify(option.data);
  23862. break;
  23863. case 'put':
  23864. case 'patch':
  23865. case 'delete':
  23866. ax.method = option.method;
  23867. ax.headers = option.headers;
  23868. ax.params = option.param;
  23869. ax.data = Qs.stringify(option.data);
  23870. break;
  23871. case 'download':
  23872. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23873. return new Promise(function (resolver, reject) {
  23874. });
  23875. case "invoke":
  23876. ax.url = serverInvokeUrlTransform(option.url, option);
  23877. ax.method = 'POST';
  23878. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23879. if (typeof option.args === 'object') {
  23880. ax.data = JSON.stringify({
  23881. args: option.args,
  23882. });
  23883. }
  23884. else {
  23885. ax.data = JSON.stringify({
  23886. args: [
  23887. __assign(__assign({}, option.data), option.param)
  23888. ],
  23889. filterModel: option.filterModel,
  23890. sortModel: option.sortModel
  23891. });
  23892. }
  23893. break;
  23894. case 'post-json':
  23895. ax.method = 'POST';
  23896. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23897. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23898. break;
  23899. case 'post-file':
  23900. //TODO 刘壮. 上传文件
  23901. var forms = new FormData();
  23902. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23903. _$2.forOwn(option.data, function (value, key) {
  23904. if (key === 'files') {
  23905. var i_1 = 0;
  23906. _$2.each(value, function (f) {
  23907. // @ts-ignore
  23908. forms.append('file' + (++i_1), f);
  23909. });
  23910. }
  23911. else {
  23912. forms.append(key, value);
  23913. }
  23914. });
  23915. ax.data = forms;
  23916. ax.method = 'POST';
  23917. break;
  23918. case "sql":
  23919. ax.url = sqlUrlTransform(option.url);
  23920. ax.method = 'POST';
  23921. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23922. ax.data = JSON.stringify({
  23923. args: [option.data],
  23924. db: option.db,
  23925. filterModel: option.filterModel,
  23926. sortModel: option.sortModel
  23927. });
  23928. break;
  23929. default:
  23930. throw new Error('not implements');
  23931. }
  23932. return new Promise(function (resolver, reject) {
  23933. axios__default(ax).then(function (resolverRaw) {
  23934. var apiResult = {
  23935. rawData: resolverRaw.data,
  23936. status: resolverRaw.status,
  23937. success: (resolverRaw.data && resolverRaw.data.success),
  23938. data: resolverRaw.data.data,
  23939. pagination: resolverRaw.data.pagination,
  23940. msg: (resolverRaw.data.msg),
  23941. errors: resolverRaw.data.errors,
  23942. headers: resolverRaw.headers
  23943. };
  23944. if (typeof window['apiTranslate'] === 'function') {
  23945. window['apiTranslate'](apiResult.rawData, option.url);
  23946. }
  23947. resolver(apiResult);
  23948. }).catch(function (reason) {
  23949. reject(reason);
  23950. });
  23951. });
  23952. };
  23953. }
  23954. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23955. if (isJson === void 0) { isJson = false; }
  23956. var YvanUI = _$2.get(window, 'YvanUI');
  23957. YvanUI.loading();
  23958. var createObjectURL = function (object) {
  23959. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23960. };
  23961. // const formData = new FormData();
  23962. // _.forOwn(data, (v, k) => {
  23963. // formData.append(k, v);
  23964. // });
  23965. var formData = '';
  23966. var xhr = new XMLHttpRequest();
  23967. xhr.open('POST', downLoadUrl);
  23968. xhr.responseType = 'blob';
  23969. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23970. if (isJson) {
  23971. formData = data ? JSON.stringify(data) : '';
  23972. xhr.setRequestHeader('Content-Type', 'application/json');
  23973. }
  23974. else {
  23975. formData = data ? Qs.stringify(data) : '';
  23976. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23977. }
  23978. //
  23979. if (header) {
  23980. _$2.forOwn(header, function (v, k) {
  23981. xhr.setRequestHeader(k, v);
  23982. });
  23983. }
  23984. xhr.onload = function (e) {
  23985. if (this.status === 200) {
  23986. var blob = this.response;
  23987. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23988. navigator.msSaveBlob(blob, filename);
  23989. YvanUI.clearLoading();
  23990. }
  23991. else {
  23992. var a = document.createElement('a');
  23993. var url = createObjectURL(blob);
  23994. a.href = url;
  23995. a.download = filename;
  23996. document.append(a);
  23997. a.click();
  23998. a.remove();
  23999. window.URL.revokeObjectURL(url);
  24000. YvanUI.clearLoading();
  24001. }
  24002. }
  24003. };
  24004. xhr.send(formData);
  24005. }
  24006. //# sourceMappingURL=ajax.js.map
  24007. function readExcel(file) {
  24008. return new Promise(function (resolve, reject) {
  24009. if (!file) {
  24010. reject("文件读取失败!!!");
  24011. return;
  24012. }
  24013. var reader = new FileReader();
  24014. reader.onload = function (e) {
  24015. if (e.target) {
  24016. var data = e.target.result;
  24017. var workbook = XLSX.read(data, { type: 'binary' });
  24018. resolve(workbook);
  24019. }
  24020. else {
  24021. reject("文件读取失败!!!");
  24022. }
  24023. };
  24024. try {
  24025. reader.readAsBinaryString(file);
  24026. }
  24027. catch (e) {
  24028. reject(e);
  24029. }
  24030. });
  24031. }
  24032. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24033. if (dataStartRow === void 0) { dataStartRow = 2; }
  24034. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24035. if (rowValidate === void 0) { rowValidate = undefined; }
  24036. if (otherValidate === void 0) { otherValidate = undefined; }
  24037. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24038. return new Promise(function (resolve, reject) {
  24039. var promiseArr = [];
  24040. for (var i = 0; i < columnsSet.length; i++) {
  24041. var fix = columnsSet[i].fix;
  24042. if (_$2.isArray(fix) && fix.length > 0) {
  24043. var ss = fix[0].toLowerCase();
  24044. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24045. columnsSet[i].importFormatter = function (vdata) {
  24046. // @ts-ignore
  24047. return window.moment(vdata.ov) - 0;
  24048. };
  24049. }
  24050. else {
  24051. var fn = lookupFn(topScope, fix[0]);
  24052. promiseArr.push(fn(null, columnsSet[i]));
  24053. delete columnsSet[i].fix;
  24054. }
  24055. }
  24056. else if (_$2.isString(fix)) {
  24057. var ss = fix.toLowerCase();
  24058. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24059. columnsSet[i].importFormatter = function (vdata) {
  24060. // @ts-ignore
  24061. return window.moment(vdata.ov) - 0;
  24062. };
  24063. }
  24064. else {
  24065. var fn = lookupFn(topScope, fix);
  24066. promiseArr.push(fn(null, columnsSet[i]));
  24067. delete columnsSet[i].fix;
  24068. }
  24069. }
  24070. }
  24071. var read = function () {
  24072. readExcel(file).then(function (workbook) {
  24073. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24074. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24075. var titleRowValue = [];
  24076. var titleRowKey = [];
  24077. var needLoop = false; // 是否需要迭代
  24078. var columns = [];
  24079. if (worksheet && worksheet["!ref"]) {
  24080. var t = worksheet["!ref"];
  24081. var tempArr = t.split(':');
  24082. if (tempArr.length >= 2) {
  24083. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24084. // 选取title的行,删除之前的行
  24085. if (titleRowNumber > firstRowNumber) {
  24086. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24087. for (var key in worksheet) {
  24088. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24089. delete worksheet[key];
  24090. }
  24091. }
  24092. }
  24093. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24094. firstRowNumber = titleRowNumber + '';
  24095. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24096. }
  24097. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24098. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24099. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24100. for (var key in worksheet) {
  24101. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24102. titleRowKey.push(key);
  24103. titleRowValue.push(worksheet[key].v);
  24104. }
  24105. }
  24106. if (columnsSet && columnsSet.length > 0) {
  24107. var length = columnsSet.length;
  24108. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24109. for (var i = 0; i < length; i++) {
  24110. var vk = titleRowKey[i];
  24111. var item = columnsSet[i];
  24112. var column = {};
  24113. if (typeof item === 'string') {
  24114. column.dataIndex = item;
  24115. column.header = worksheet[vk].v;
  24116. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24117. }
  24118. else if (typeof item.dataIndex === "string") {
  24119. column.dataIndex = item.dataIndex;
  24120. column.header = worksheet[vk].v;
  24121. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24122. if (typeof item.validate === "function") {
  24123. column.validate = item.validate;
  24124. needLoop = true;
  24125. }
  24126. if (typeof item.importFormatter === "function") {
  24127. column.importFormatter = item.importFormatter;
  24128. needLoop = true;
  24129. }
  24130. if ((item.data instanceof Array && item.data.length > 0)
  24131. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24132. column.data = item.data;
  24133. needLoop = true;
  24134. }
  24135. }
  24136. columns.push(column);
  24137. }
  24138. }
  24139. }
  24140. }
  24141. if (fieldValidate && typeof fieldValidate === "function") {
  24142. if (fieldValidate(columns, titleRowValue) !== true) {
  24143. reject("fields validate error");
  24144. return;
  24145. }
  24146. }
  24147. var allData = XLSX.utils.sheet_to_json(worksheet);
  24148. var okData = [], errorData = [], errorMsgData = [];
  24149. var needItemLoop = needLoop;
  24150. if (rowValidate && typeof rowValidate === "function") {
  24151. needLoop = true;
  24152. }
  24153. if (needLoop === true) {
  24154. for (var index = 0; index < allData.length; index++) {
  24155. var row = allData[index];
  24156. var rowNumber = dataStartRow + index;
  24157. row.__importID__ = rowNumber;
  24158. var isRowOk = true;
  24159. if (needItemLoop) {
  24160. var _loop_1 = function (num) {
  24161. var column = columns[num];
  24162. var ov = row[column.dataIndex];
  24163. var nv = ov;
  24164. var hasError = false;
  24165. var rowNumber_1 = dataStartRow + index;
  24166. var ei = {
  24167. errorId: rowNumber_1 + '_' + column.dataIndex,
  24168. importID: rowNumber_1,
  24169. dataIndex: column.dataIndex,
  24170. header: column.header,
  24171. value: ov,
  24172. errormessage: ""
  24173. };
  24174. // 格式化
  24175. if (column.data instanceof Array) {
  24176. nv = undefined;
  24177. ei.errormessage = "字典匹配失败";
  24178. _$2.forEach(column.data, function (v, index) {
  24179. if (v.text === ov) {
  24180. nv = v.id;
  24181. return;
  24182. }
  24183. });
  24184. }
  24185. else if (_$2.isPlainObject(column.data)) {
  24186. nv = undefined;
  24187. ei.errormessage = "字典匹配失败";
  24188. _$2.forEach(column.data, function (value, key) {
  24189. if (value === ov) {
  24190. nv = key;
  24191. return;
  24192. }
  24193. });
  24194. }
  24195. if (typeof column.importFormatter === 'function') {
  24196. var vdata = {
  24197. column: column,
  24198. ov: ov,
  24199. nv: nv,
  24200. rowIndex: index,
  24201. data: row,
  24202. rowDatas: allData
  24203. };
  24204. nv = undefined;
  24205. ei.errormessage = "格式化失败";
  24206. nv = column.importFormatter(vdata);
  24207. }
  24208. if (!nv && nv != 0) {
  24209. hasError = true;
  24210. }
  24211. else {
  24212. row[column.dataIndex] = nv;
  24213. ei.errormessage = "";
  24214. }
  24215. // 校验
  24216. if (typeof column.validate === 'function') {
  24217. var vdata = {
  24218. column: column,
  24219. ov: ov,
  24220. nv: nv,
  24221. rowIndex: index,
  24222. data: row,
  24223. rowDatas: allData
  24224. };
  24225. var errormessage = column.validate(vdata);
  24226. if (errormessage === true) ;
  24227. else {
  24228. hasError = true;
  24229. ei.errormessage = ei.errormessage + "/" + errormessage;
  24230. }
  24231. }
  24232. if (hasError === true) {
  24233. isRowOk = false;
  24234. errorMsgData.push(ei);
  24235. }
  24236. };
  24237. for (var num = 0; num < columns.length; num++) {
  24238. _loop_1(num);
  24239. }
  24240. }
  24241. if (rowValidate && typeof rowValidate === "function") {
  24242. var errormessage = rowValidate({
  24243. columns: columns,
  24244. data: row,
  24245. rowIndex: index,
  24246. rowDatas: allData
  24247. });
  24248. if (errormessage === true) ;
  24249. else {
  24250. isRowOk = false;
  24251. var ei = {
  24252. errorId: rowNumber + '',
  24253. dataIndex: "row",
  24254. header: "数据行",
  24255. value: "当前行的数据",
  24256. importID: rowNumber,
  24257. errormessage: errormessage
  24258. };
  24259. errorMsgData.push(ei);
  24260. }
  24261. }
  24262. row.__hasError__ = !isRowOk;
  24263. if (isRowOk === true) {
  24264. okData.push(row);
  24265. }
  24266. else {
  24267. errorData.push(row);
  24268. }
  24269. }
  24270. }
  24271. else {
  24272. // 添加数据的唯一标识
  24273. for (var index = 0; index < allData.length; index++) {
  24274. var row = allData[index];
  24275. var rowNumber = dataStartRow + index;
  24276. row.__importID__ = rowNumber;
  24277. row.__hasError__ = false;
  24278. }
  24279. okData = allData;
  24280. }
  24281. if (otherValidate && typeof otherValidate === "function") {
  24282. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24283. }
  24284. else {
  24285. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24286. }
  24287. // clearLoading()
  24288. }).catch(function (e) {
  24289. reject(e);
  24290. });
  24291. };
  24292. if (promiseArr.length > 0) {
  24293. Promise.all(promiseArr).then(function (resArr) {
  24294. for (var i = 0; i < resArr.length; i++) {
  24295. var tmp = resArr[i];
  24296. tmp.config.data = [];
  24297. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24298. if (tmp.r.field.length > 1) {
  24299. var keyKey = tmp.r.field[0];
  24300. var valueKey = tmp.r.field[1];
  24301. for (var j = 0; j < tmp.r.data.length; j++) {
  24302. var it = tmp.r.data[j];
  24303. var newIt = {};
  24304. newIt.id = it[keyKey];
  24305. newIt.text = it[valueKey];
  24306. tmp.config.data.push(newIt);
  24307. }
  24308. }
  24309. }
  24310. }
  24311. read();
  24312. });
  24313. }
  24314. else {
  24315. setTimeout(read, 50);
  24316. }
  24317. });
  24318. }
  24319. //# sourceMappingURL=xlsx.js.map
  24320. var ExcelImportDialog = /** @class */ (function (_super) {
  24321. __extends(ExcelImportDialog, _super);
  24322. function ExcelImportDialog(option) {
  24323. var _this = this;
  24324. var vjson = vjsonFunc(option);
  24325. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24326. _this.importExcelOption = option;
  24327. return _this;
  24328. }
  24329. ExcelImportDialog.prototype.onLoad = function () {
  24330. _super.prototype.onLoad.call(this);
  24331. };
  24332. ExcelImportDialog.prototype.fileChange = function (sender) {
  24333. var _this = this;
  24334. var file = sender.fileInputEl.dom.files[0];
  24335. // const senderScope = lookupScope(sender)
  24336. var topScope = this.topScope;
  24337. var rowValidate = this.importExcelOption.rowValidate;
  24338. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24339. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24340. }
  24341. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24342. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24343. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24344. }
  24345. var fieldValidate = this.importExcelOption.fieldValidate;
  24346. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24347. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24348. }
  24349. this.setLoading(true);
  24350. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24351. _this.importData = res;
  24352. _this.refs.dataGrid.setData(res.allData);
  24353. _this.viewModel.set("dataCount", res.allData.length);
  24354. _this.refs.errGrid.setData(res.errorMsgData);
  24355. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24356. }).catch(function (e) {
  24357. _this.importData = null;
  24358. _this.refs.dataGrid.setData();
  24359. _this.refs.errGrid.setData();
  24360. msg(e.toString());
  24361. }).finally(function () {
  24362. _this.setLoading(false);
  24363. });
  24364. };
  24365. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24366. if (record.get('__hasError__')) {
  24367. return "x-grid-record-bg-red";
  24368. }
  24369. };
  24370. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24371. return "x-grid-record-bg-red";
  24372. };
  24373. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24374. var _a;
  24375. var id = record.data.__importID__;
  24376. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24377. var selectRecord = null;
  24378. var dataIndex = -1;
  24379. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24380. for (var i = 0; i < rows.length; i++) {
  24381. if (rows[i].importID === id) {
  24382. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24383. dataIndex = i;
  24384. }
  24385. if (rows[i].errorId === id + "_" + subId) {
  24386. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24387. dataIndex = i;
  24388. break;
  24389. }
  24390. }
  24391. if (selectRecord) {
  24392. this.refs.errGrid.ensureVisible(selectRecord);
  24393. this.refs.errGrid.selModel.select(dataIndex);
  24394. // this.refs.errGrid.reload()
  24395. }
  24396. };
  24397. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24398. var _a;
  24399. var id = record.data.importID;
  24400. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24401. var selectRecord = null;
  24402. var dataIndex = -1;
  24403. for (var i = 0; i < rows.length; i++) {
  24404. if (rows[i].__importID__ === id) {
  24405. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24406. dataIndex = i;
  24407. break;
  24408. }
  24409. }
  24410. if (selectRecord) {
  24411. this.refs.dataGrid.ensureVisible(selectRecord);
  24412. this.refs.dataGrid.selModel.select(dataIndex);
  24413. // this.refs.dataGrid.reload()
  24414. }
  24415. };
  24416. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24417. this.viewModel.set("dataType", newValue);
  24418. if (this.importData) {
  24419. this.refs.dataGrid.setData(this.importData[newValue]);
  24420. this.viewModel.set("dataCount", this.importData[newValue].length);
  24421. }
  24422. };
  24423. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24424. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24425. window.location.href = this.importExcelOption.dowLoadUrl;
  24426. return;
  24427. }
  24428. var xt = [];
  24429. _$2.forEach(this.importExcelOption.columns, function (v) {
  24430. xt.push(v.header);
  24431. });
  24432. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24433. if (filename.endsWith(".xlsx")) {
  24434. filename = filename.split(".xlsx")[0];
  24435. }
  24436. filename = filename + ".xlsx";
  24437. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24438. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24439. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24440. XLSX.writeFile(wb, filename); //导出Excel
  24441. };
  24442. ExcelImportDialog.prototype.getData = function (sender) {
  24443. _$2.each(this.importData.okData, function (item) {
  24444. delete item.id;
  24445. delete item.__hasError__;
  24446. delete item.__importID__;
  24447. delete item._origin;
  24448. });
  24449. _$2.each(this.importData.allData, function (item) {
  24450. delete item.id;
  24451. delete item.__hasError__;
  24452. delete item.__importID__;
  24453. delete item._origin;
  24454. });
  24455. _$2.each(this.importData.errorData, function (item) {
  24456. delete item.id;
  24457. delete item.__hasError__;
  24458. delete item.__importID__;
  24459. delete item._origin;
  24460. });
  24461. this.dialogSuccess(this.importData);
  24462. };
  24463. return ExcelImportDialog;
  24464. }(Scope));
  24465. var model$d = {
  24466. data: {
  24467. dataType: "all",
  24468. errMsgCount: 0,
  24469. dataCount: 0
  24470. }
  24471. };
  24472. var vjsonFunc = function (option) {
  24473. return {
  24474. title: option.title || 'excel导入',
  24475. layout: 'fit',
  24476. items: [
  24477. {
  24478. layout: 'border',
  24479. tbar: {
  24480. xtype: "form",
  24481. items: [
  24482. {
  24483. xtype: "cols",
  24484. items: [
  24485. {
  24486. xtype: "filefield",
  24487. fieldLabel: 'excel文件',
  24488. buttonText: '请选择excel文件',
  24489. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24490. flex: 3,
  24491. listeners: {
  24492. change: "scope.fileChange"
  24493. }
  24494. }, {
  24495. xtype: "button",
  24496. iconCls: "x-fa fa-download",
  24497. text: "下载模版",
  24498. listeners: {
  24499. click: "scope.downloadTemplate"
  24500. }
  24501. }, {
  24502. xtype: 'container',
  24503. border: false,
  24504. layout: 'hbox',
  24505. }, {
  24506. xtype: "button",
  24507. iconCls: "x-fa fa-upload",
  24508. text: option.tQButtonText || "提取数据",
  24509. listeners: {
  24510. click: "scope.getData"
  24511. }
  24512. }
  24513. ]
  24514. },
  24515. ]
  24516. },
  24517. items: [
  24518. {
  24519. tbar: {
  24520. xtype: "toolbar",
  24521. title: "导入的数据",
  24522. items: [{
  24523. xtype: 'label',
  24524. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24525. }, {
  24526. xtype: 'radiogroup',
  24527. items: [
  24528. {
  24529. boxLabel: '所有数据',
  24530. checked: true,
  24531. inputValue: 'allData',
  24532. }, {
  24533. boxLabel: '正确数据',
  24534. inputValue: 'okData',
  24535. }, {
  24536. boxLabel: '错误数据',
  24537. inputValue: 'errorData',
  24538. }
  24539. ],
  24540. listeners: {
  24541. change: 'scope.filterData',
  24542. },
  24543. }, {
  24544. xtype: "textfield",
  24545. readOnly: true,
  24546. fieldLabel: "条目数",
  24547. bind: "{dataCount}"
  24548. }]
  24549. },
  24550. xtype: 'yvgrid',
  24551. reference: 'dataGrid',
  24552. layout: 'fit',
  24553. pagination: false,
  24554. // pageSize: 50,
  24555. getRowClass: 'scope.getDataGridRowRecord',
  24556. columns: option.columns,
  24557. region: 'center',
  24558. split: true,
  24559. listeners: {
  24560. cellclick: "scope.dataGridClick",
  24561. },
  24562. selModel: {
  24563. // type: 'rowmodel',
  24564. mode: 'SINGLE',
  24565. },
  24566. }, {
  24567. tbar: {
  24568. xtype: "toolbar", items: [
  24569. {
  24570. xtype: 'label',
  24571. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24572. }, {
  24573. xtype: "textfield",
  24574. readOnly: true,
  24575. fieldLabel: "条目数",
  24576. bind: "{errMsgCount}"
  24577. }
  24578. ]
  24579. },
  24580. xtype: 'yvgrid',
  24581. reference: 'errGrid',
  24582. layout: 'fit',
  24583. pagination: false,
  24584. getRowClass: 'scope.getErrGridRowRecord',
  24585. height: "40%",
  24586. columns: [
  24587. { dataIndex: "errorId", header: "ID", hidden: true },
  24588. { dataIndex: "importID", header: "行号", width: 80 },
  24589. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24590. { dataIndex: "value", header: "值", width: 120 },
  24591. { dataIndex: "header", header: "字段名", width: 120 },
  24592. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24593. ],
  24594. region: 'south',
  24595. split: true,
  24596. listeners: {
  24597. itemclick: "scope.errGridClick"
  24598. },
  24599. selModel: {
  24600. // type: 'rowmodel',
  24601. mode: 'SINGLE',
  24602. },
  24603. },
  24604. ],
  24605. },
  24606. ],
  24607. referenceHolder: true,
  24608. };
  24609. };
  24610. //# sourceMappingURL=ExcelImportDialog.js.map
  24611. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24612. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24613. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24614. ret.report_id = reportId;
  24615. ret.report = report;
  24616. return ret;
  24617. }
  24618. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24619. var e_1, _a, e_2, _b;
  24620. var model = {
  24621. data: {
  24622. report_name: config.report_name,
  24623. query: {},
  24624. sum: {},
  24625. }
  24626. };
  24627. var json5 = window['YvanUI'].json5;
  24628. var report = config.report ? json5.parse(config.report) : {};
  24629. var conditionRows = [];
  24630. var sumRows = [];
  24631. model.data.has_sum = _$2.size(report.summary) > 0;
  24632. // query 查询条件
  24633. var newRow = false;
  24634. var currentRow = { xtype: 'cols', items: [], };
  24635. conditionRows.push(currentRow);
  24636. _$2.forEach(report.query, function (item) {
  24637. if (newRow) {
  24638. currentRow = { xtype: 'cols', items: [], };
  24639. conditionRows.push(currentRow);
  24640. }
  24641. var vj = json5.parse(item.conditionFieldExtend);
  24642. if (item.conditionFieldXtype) {
  24643. vj.xtype = item.conditionFieldXtype;
  24644. if (item.conditionFieldXtype === 'combo') {
  24645. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24646. }
  24647. if (item.conditionFieldXtype === 'datetimefield') {
  24648. //@ts-ignore
  24649. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24650. }
  24651. else if (item.conditionFieldXtype === 'datefield') {
  24652. //@ts-ignore
  24653. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24654. }
  24655. else {
  24656. model.data.query[item.conditionFieldBind] = '';
  24657. }
  24658. }
  24659. else {
  24660. // 没有组件类型,是个空占位符
  24661. vj.border = false;
  24662. }
  24663. if (item.conditionFieldBind) {
  24664. vj.bind = {
  24665. value: '{query.' + item.conditionFieldBind + '}'
  24666. };
  24667. }
  24668. if (item.conditionFieldFlex) {
  24669. vj.flex = item.conditionFieldFlex;
  24670. }
  24671. if (item.conditionFieldXtype) {
  24672. vj.fieldLabel = item.conditionFieldLabel;
  24673. }
  24674. if (item.fieldLabel) {
  24675. vj.fieldLabel = item.fieldLabel;
  24676. }
  24677. newRow = item.conditionFieldWrap || false;
  24678. currentRow.items.push(vj);
  24679. });
  24680. if (currentRow) {
  24681. currentRow.margin = '10 0 10 0';
  24682. }
  24683. // sum 汇总条件
  24684. newRow = true;
  24685. try {
  24686. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24687. var item = _d.value;
  24688. if (newRow) {
  24689. currentRow = {
  24690. xtype: 'cols',
  24691. defaultType: 'displayfield',
  24692. defaults: {
  24693. labelWidth: 70,
  24694. },
  24695. items: []
  24696. };
  24697. sumRows.push(currentRow);
  24698. }
  24699. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24700. if (item.sumFieldBind) {
  24701. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24702. model.data.sum[item.sumFieldBind] = '';
  24703. }
  24704. else {
  24705. // 没有组件类型,是个空占位符
  24706. vj.border = false;
  24707. }
  24708. if (item.sumFieldFlex) {
  24709. vj.flex = item.sumFieldFlex;
  24710. }
  24711. if (item.sumFieldLabel) {
  24712. vj.fieldLabel = item.sumFieldLabel;
  24713. }
  24714. // sumFieldBind: "zs"
  24715. // sumFieldExtend: "{}"
  24716. // sumFieldFlex: 1
  24717. // sumFieldLabel: "总数"
  24718. // sumFieldWrap: false
  24719. newRow = item.sumFieldWrap || false;
  24720. currentRow.items.push(vj);
  24721. }
  24722. }
  24723. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24724. finally {
  24725. try {
  24726. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24727. }
  24728. finally { if (e_1) throw e_1.error; }
  24729. }
  24730. if (currentRow) {
  24731. currentRow.margin = '10 0 10 0';
  24732. }
  24733. // column 结果字段
  24734. var columns = [];
  24735. try {
  24736. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24737. var item = _f.value;
  24738. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24739. if (item.xtype) {
  24740. if (item.xtype == 'checkbox') {
  24741. vj.xtype = 'checkcolumn';
  24742. vj.disabled = true;
  24743. }
  24744. else {
  24745. vj.xtype = item.xtype;
  24746. }
  24747. }
  24748. if (item.dataType) {
  24749. vj.dataType = item.dataType;
  24750. }
  24751. if (item.align) {
  24752. vj.align = item.align;
  24753. }
  24754. if (item.width) {
  24755. vj.width = item.width;
  24756. }
  24757. if (item.dict) {
  24758. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24759. }
  24760. columns.push(vj);
  24761. }
  24762. }
  24763. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24764. finally {
  24765. try {
  24766. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24767. }
  24768. finally { if (e_2) throw e_2.error; }
  24769. }
  24770. var vjson = {
  24771. bind: {
  24772. title: '{report_name}',
  24773. },
  24774. layout: 'fit',
  24775. referenceHolder: true,
  24776. items: [
  24777. {
  24778. layout: 'border',
  24779. border: false,
  24780. items: [
  24781. {
  24782. region: 'north',
  24783. border: false,
  24784. tbar: {
  24785. xtype: 'toolbar',
  24786. border: false,
  24787. items: [
  24788. {
  24789. xtype: 'button',
  24790. text: '查询',
  24791. reference: 'btnSearch',
  24792. iconCls: 'x-fa fa-search',
  24793. listeners: {
  24794. click: 'scope.reload',
  24795. },
  24796. },
  24797. {
  24798. xtype: 'button',
  24799. text: '关闭',
  24800. iconCls: 'x-fa fa-times',
  24801. listeners: {
  24802. click: 'system.closeMe()',
  24803. },
  24804. },
  24805. ],
  24806. },
  24807. defaults: {
  24808. margin: '8 0 0 0'
  24809. },
  24810. items: __spread(conditionRows, sumRows),
  24811. fix: ['system.enterToClick("btnSearch")'],
  24812. },
  24813. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24814. method: 'invoke',
  24815. url: '/report/Report@execute',
  24816. params: {
  24817. dataSource: report.dataSource,
  24818. pagination: report.grid.pagination || true,
  24819. report_id: config.report_id,
  24820. query: '{query}',
  24821. },
  24822. }, columns: columns }, report.grid),
  24823. ],
  24824. },
  24825. ],
  24826. };
  24827. return { model: model, vjson: vjson, report: report };
  24828. }
  24829. var ReportScope = /** @class */ (function (_super) {
  24830. __extends(ReportScope, _super);
  24831. function ReportScope(_a, invokeServerFn) {
  24832. var model = _a.model, vjson = _a.vjson;
  24833. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24834. _this.invokeServerFn = invokeServerFn;
  24835. return _this;
  24836. }
  24837. ReportScope.prototype.onLoad = function () {
  24838. // this.reload()
  24839. };
  24840. ReportScope.prototype.reload = function () {
  24841. var _this = this;
  24842. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24843. if (this.viewModel.get('has_sum')) {
  24844. this.invokeServerFn('/report/Report@executeSum', {
  24845. dataSource: this.report.dataSource,
  24846. report_id: this.report_id,
  24847. query: this.viewModel.get('query'),
  24848. }).then(function (res) {
  24849. if (!res.success) {
  24850. showErrorDialog$1(res.msg);
  24851. }
  24852. else {
  24853. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24854. }
  24855. });
  24856. }
  24857. this.refs.grid1.reload();
  24858. };
  24859. return ReportScope;
  24860. }(Scope));
  24861. //# sourceMappingURL=Report.js.map
  24862. var model$e = {
  24863. data: {
  24864. form: {
  24865. resource_parent: '',
  24866. resource_name: '',
  24867. resource_icon: '',
  24868. scope_url: '',
  24869. scope_params: '',
  24870. resource_order: '',
  24871. permission_code: '',
  24872. },
  24873. }
  24874. };
  24875. //# sourceMappingURL=RegisterModule.model.js.map
  24876. var vjson$d = {
  24877. title: '注册模块',
  24878. layout: 'fit',
  24879. width: "40%",
  24880. height: "50%",
  24881. fbar: {
  24882. xtype: 'toolbar',
  24883. items: [
  24884. {
  24885. xtype: "button",
  24886. text: "确定",
  24887. iconCls: 'x-fa fa-check',
  24888. listeners: {
  24889. click: 'scope.saveNode',
  24890. }
  24891. },
  24892. {
  24893. xtype: "button",
  24894. text: "关闭",
  24895. iconCls: 'x-fa fa-times',
  24896. listeners: {
  24897. click: 'system.closeMe()',
  24898. }
  24899. },
  24900. ]
  24901. },
  24902. items: [
  24903. {
  24904. layout: 'border',
  24905. items: [
  24906. {
  24907. region: 'west',
  24908. layout: 'fit',
  24909. xtype: 'tabpanel',
  24910. reference: 'tabs',
  24911. width: "50%",
  24912. split: true,
  24913. listeners: {
  24914. tabchange: 'scope.tabchange',
  24915. },
  24916. items: [
  24917. {
  24918. region: 'center',
  24919. layout: 'fit',
  24920. title: 'PC菜单',
  24921. key: "1",
  24922. items: [
  24923. {
  24924. xtype: 'treepanel',
  24925. layout: 'fit',
  24926. region: 'west',
  24927. rootVisible: false,
  24928. useArrows: true,
  24929. reference: 'tree1',
  24930. listeners: {
  24931. itemclick: "scope.tree1NodeClick",
  24932. }
  24933. },
  24934. ]
  24935. },
  24936. {
  24937. region: 'center',
  24938. layout: 'fit',
  24939. title: 'PDA菜单',
  24940. key: "2",
  24941. items: [
  24942. {
  24943. xtype: 'treepanel',
  24944. layout: 'fit',
  24945. region: 'west',
  24946. reference: 'tree2',
  24947. rootVisible: false,
  24948. useArrows: true,
  24949. listeners: {
  24950. itemclick: "scope.tree1NodeClick",
  24951. }
  24952. },
  24953. ]
  24954. },
  24955. ]
  24956. },
  24957. {
  24958. region: 'center',
  24959. xtype: 'form',
  24960. margin: '0 0 0 0',
  24961. split: true,
  24962. width: '50%',
  24963. items: [
  24964. {
  24965. xtype: 'cols',
  24966. items: [
  24967. {
  24968. xtype: 'textfield',
  24969. fieldLabel: '上级资源ID',
  24970. bind: {
  24971. readOnly: true,
  24972. disabled: true,
  24973. value: '{form.resource_parent}'
  24974. },
  24975. },
  24976. ],
  24977. },
  24978. {
  24979. xtype: 'cols',
  24980. items: [
  24981. {
  24982. xtype: 'textfield',
  24983. fieldLabel: '资源名称',
  24984. bind: {
  24985. value: '{form.resource_name}'
  24986. },
  24987. allowBlank: false,
  24988. },
  24989. ],
  24990. },
  24991. {
  24992. xtype: 'cols',
  24993. items: [
  24994. {
  24995. xtype: 'numberfield',
  24996. fieldLabel: '资源排序',
  24997. bind: {
  24998. value: '{form.resource_order}'
  24999. },
  25000. allowBlank: false,
  25001. },
  25002. ],
  25003. },
  25004. {
  25005. xtype: 'cols',
  25006. items: [
  25007. {
  25008. xtype: 'textfield',
  25009. fieldLabel: '功能URL',
  25010. bind: {
  25011. disabled: true,
  25012. value: '{form.scope_url}'
  25013. },
  25014. },
  25015. ]
  25016. },
  25017. {
  25018. xtype: 'cols',
  25019. items: [
  25020. {
  25021. xtype: 'textfield',
  25022. fieldLabel: '权限编码',
  25023. bind: {
  25024. value: '{form.permission_code}'
  25025. }
  25026. },
  25027. ],
  25028. },
  25029. {
  25030. xtype: 'cols',
  25031. items: [
  25032. {
  25033. xtype: 'textfield',
  25034. fieldLabel: '功能参数',
  25035. bind: {
  25036. value: '{form.scope_params}'
  25037. }
  25038. },
  25039. ],
  25040. },
  25041. ],
  25042. },
  25043. ],
  25044. },
  25045. ],
  25046. referenceHolder: true,
  25047. };
  25048. //# sourceMappingURL=RegisterModule.view.js.map
  25049. var RegisterModule = /** @class */ (function (_super) {
  25050. __extends(RegisterModule, _super);
  25051. function RegisterModule() {
  25052. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25053. }
  25054. RegisterModule.prototype.onLoad = function () {
  25055. this.reloadTree("PC");
  25056. };
  25057. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25058. var currTabKey = b.key;
  25059. if (currTabKey === '1') {
  25060. this.viewModel.set('form', '');
  25061. this.reloadTree("PC");
  25062. }
  25063. else {
  25064. this.viewModel.set('form', '');
  25065. this.reloadTree("PDA");
  25066. }
  25067. };
  25068. RegisterModule.prototype.reloadTree = function (type) {
  25069. var _this = this;
  25070. if ("PC" === type) {
  25071. this.setLoading(true);
  25072. getMenuTree({ type: "PC" }).then(function (res) {
  25073. if (res.success) {
  25074. _this.refs.tree1.store.setRootNode({
  25075. expanded: true,
  25076. children: res.data
  25077. });
  25078. }
  25079. }).finally(function () {
  25080. _this.setLoading(false);
  25081. });
  25082. }
  25083. else {
  25084. this.setLoading(true);
  25085. getMenuTree({ type: "PDA" }).then(function (res) {
  25086. if (res.success) {
  25087. _this.refs.tree2.store.setRoot({
  25088. expanded: true,
  25089. children: res.data
  25090. });
  25091. }
  25092. }).finally(function () {
  25093. _this.setLoading(false);
  25094. });
  25095. }
  25096. };
  25097. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25098. var id = _$2.split(node.data.id, '_')[1];
  25099. if (!id) {
  25100. return;
  25101. }
  25102. this.viewModel.set('form.resource_parent', id);
  25103. };
  25104. RegisterModule.prototype.saveNode = function () {
  25105. var _this = this;
  25106. var tabKey = this.refs.tabs.activeTab.key;
  25107. // 检验菜单数据
  25108. var param = this.viewModel.get('form');
  25109. if (!param.resource_parent) {
  25110. msg('请选择一个父节点');
  25111. return;
  25112. }
  25113. if (!param.resource_name) {
  25114. msg('资源名称不能为空');
  25115. return;
  25116. }
  25117. if (!param.scope_url) {
  25118. msg('功能URL不能为空');
  25119. return;
  25120. }
  25121. var type;
  25122. if (tabKey === '1') {
  25123. type = 'PC';
  25124. }
  25125. else {
  25126. type = 'PDA';
  25127. }
  25128. this.setLoading(true);
  25129. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25130. if (res.success) {
  25131. msg("注册成功");
  25132. _this.close();
  25133. }
  25134. }).finally(function () {
  25135. _this.setLoading(false);
  25136. });
  25137. };
  25138. return RegisterModule;
  25139. }(Scope));
  25140. //# sourceMappingURL=RegisterModule.js.map
  25141. var model$f = {
  25142. data: {
  25143. title: "模板选择",
  25144. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25145. moduleType: 1,
  25146. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25147. packagePath: "",
  25148. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25149. fileSavePath: "",
  25150. // 模块名称 "Dict"
  25151. moduleName: "NewModule",
  25152. // 页面标题 "字典维护"
  25153. pageTitle: "新模块",
  25154. // 单表查询
  25155. singleTable: {
  25156. sql: "select * from bas_dict",
  25157. // 新增或者删除所用的表
  25158. tableName: "",
  25159. // 是否分页查询
  25160. pagination: true,
  25161. // 是否需要删除
  25162. delete: true,
  25163. // 删除条件字段
  25164. deleteWhereColumn: "",
  25165. // 删除提示语
  25166. deleteTips: "确定要删除?",
  25167. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25168. editType: 2,
  25169. },
  25170. singleTableView: {
  25171. tableNameList: [
  25172. // { value: "aaa"},
  25173. ],
  25174. columnList: [
  25175. // { value: "aaa"},
  25176. ],
  25177. }
  25178. }
  25179. };
  25180. //# sourceMappingURL=CreateModule.model.js.map
  25181. var vjson$e = {
  25182. bind: {
  25183. title: '新建模块-{title}',
  25184. },
  25185. width: "55%",
  25186. height: "60%",
  25187. minWidth: 500,
  25188. minHeight: 400,
  25189. modal: true,
  25190. frame: true,
  25191. layout: 'card',
  25192. bbar: [
  25193. '->',
  25194. {
  25195. itemId: 'card-prev',
  25196. text: '&laquo; 上一步',
  25197. disabled: true,
  25198. listeners: {
  25199. click: 'scope.showPrevious',
  25200. },
  25201. },
  25202. {
  25203. itemId: 'card-next',
  25204. text: '下一步 &raquo;',
  25205. listeners: {
  25206. click: 'scope.showNext',
  25207. },
  25208. },
  25209. {
  25210. itemId: 'card-finish',
  25211. text: '立刻执行',
  25212. iconCls: 'x-fa fa-flash',
  25213. hidden: true,
  25214. listeners: {
  25215. click: 'scope.finish',
  25216. },
  25217. },
  25218. ],
  25219. items: [
  25220. {
  25221. vtitle: '模板选择',
  25222. reference: 'templateSelection',
  25223. layout: {
  25224. type: 'hbox',
  25225. pack: 'start',
  25226. align: 'stretch'
  25227. },
  25228. listeners: {
  25229. cardEnter: 'scope.templateEnter',
  25230. cardLevel: 'scope.templateLevel'
  25231. },
  25232. items: [
  25233. {
  25234. width: 150,
  25235. xtype: 'form',
  25236. border: false,
  25237. layout: {
  25238. type: 'vbox',
  25239. align: 'stretch'
  25240. },
  25241. defaults: {
  25242. border: false,
  25243. anchor: '100%',
  25244. margin: '5',
  25245. },
  25246. items: [
  25247. {
  25248. xtype: 'radiogroup',
  25249. bind: {
  25250. value: '{moduleType}'
  25251. },
  25252. layout: 'vbox',
  25253. defaults: {
  25254. border: false,
  25255. anchor: '100%',
  25256. margin: '5',
  25257. },
  25258. items: [
  25259. { boxLabel: '单表查询', inputValue: 1 },
  25260. { boxLabel: '主/明细查询', inputValue: 2 },
  25261. { boxLabel: '树/明细查询', inputValue: 3 },
  25262. { boxLabel: '卡片表单', inputValue: 4 },
  25263. { boxLabel: '主/详情查询', inputValue: 5 },
  25264. ]
  25265. },
  25266. ]
  25267. },
  25268. {
  25269. flex: 1,
  25270. region: 'center',
  25271. xtype: "panel",
  25272. border: false,
  25273. frame: true,
  25274. padding: "4px 8px",
  25275. html: "描述...",
  25276. }
  25277. ]
  25278. },
  25279. {
  25280. vtitle: '模块名称',
  25281. reference: 'moduleName',
  25282. layout: 'fit',
  25283. listeners: {
  25284. cardEnter: 'scope.moduleEnter',
  25285. cardLevel: 'scope.moduleLevel'
  25286. },
  25287. items: [
  25288. {
  25289. xtype: 'form',
  25290. border: false,
  25291. layout: {
  25292. type: 'vbox',
  25293. align: 'stretch'
  25294. },
  25295. defaults: {
  25296. border: false,
  25297. anchor: '100%',
  25298. margin: '5',
  25299. },
  25300. items: [
  25301. {
  25302. xtype: 'textfield',
  25303. fieldLabel: '包路径',
  25304. allowBlank: false,
  25305. bind: { value: '{packagePath}' },
  25306. },
  25307. {
  25308. xtype: 'textfield',
  25309. fieldLabel: '文件路径',
  25310. allowBlank: false,
  25311. bind: { value: '{fileSavePath}' },
  25312. },
  25313. {
  25314. xtype: 'textfield',
  25315. fieldLabel: '模块名',
  25316. allowBlank: false,
  25317. bind: { value: '{moduleName}' },
  25318. },
  25319. {
  25320. xtype: 'textfield',
  25321. fieldLabel: '菜单名',
  25322. allowBlank: false,
  25323. bind: { value: '{pageTitle}' },
  25324. },
  25325. ]
  25326. },
  25327. ]
  25328. },
  25329. {
  25330. vtitle: '确认结果',
  25331. reference: 'confirmResult',
  25332. layout: 'fit',
  25333. listeners: {
  25334. cardEnter: 'scope.optionEnter',
  25335. cardLevel: 'scope.optionLevel',
  25336. },
  25337. items: [
  25338. {
  25339. xtype: 'jsoneditor',
  25340. reference: 'jsoneditor'
  25341. }
  25342. ]
  25343. },
  25344. // ---------------------------------------------------------------------------------- 单表查询
  25345. {
  25346. vtitle: '查询SQL',
  25347. reference: 'singleTable_1',
  25348. layout: 'fit',
  25349. listeners: {
  25350. cardEnter: 'scope.editorEnter',
  25351. cardLevel: 'scope.editorLevel'
  25352. },
  25353. items: [
  25354. {
  25355. xtype: 'sqleditor',
  25356. }
  25357. ],
  25358. },
  25359. {
  25360. vtitle: '字段选项',
  25361. reference: 'singleTable_2',
  25362. layout: 'fit',
  25363. listeners: {
  25364. cardEnter: 'scope.columnEnter',
  25365. cardLevel: 'scope.columnLevel',
  25366. },
  25367. items: [
  25368. {
  25369. xtype: 'yvgrid',
  25370. border: false,
  25371. selModel: {
  25372. type: 'spreadsheet',
  25373. columnSelect: true,
  25374. pruneRemoved: false,
  25375. extensible: 'y'
  25376. },
  25377. plugins: {
  25378. clipboard: true,
  25379. selectionreplicator: true
  25380. },
  25381. reference: 'grid1',
  25382. idField: 'column_name',
  25383. hideFootbar: true,
  25384. tbar: {
  25385. xtype: 'toolbar',
  25386. items: [
  25387. {
  25388. xtype: 'button',
  25389. text: '添加',
  25390. iconCls: 'x-fa fa-plus-circle',
  25391. listeners: {
  25392. click: 'scope.addField'
  25393. }
  25394. },
  25395. {
  25396. xtype: 'button',
  25397. text: '删除',
  25398. iconCls: 'x-fa fa-minus-circle',
  25399. listeners: {
  25400. click: 'scope.removeField'
  25401. }
  25402. },
  25403. {
  25404. xtype: 'button',
  25405. text: '分析SQL',
  25406. iconCls: 'x-fa fa-refresh',
  25407. listeners: {
  25408. click: 'scope.parseSQL'
  25409. }
  25410. },
  25411. ]
  25412. },
  25413. columns: [
  25414. {
  25415. text: '字段名', dataIndex: 'column_name',
  25416. sortable: false,
  25417. menuDisabled: true,
  25418. width: 150,
  25419. editor: {
  25420. allowBlank: true,
  25421. selectOnFocus: false,
  25422. }
  25423. },
  25424. {
  25425. text: '字段中文', dataIndex: 'column_comment',
  25426. width: 150,
  25427. sortable: false,
  25428. menuDisabled: true,
  25429. editor: {
  25430. allowBlank: true,
  25431. selectOnFocus: false,
  25432. }
  25433. },
  25434. {
  25435. dataIndex: "column_useto",
  25436. // fix: ['system.getDict("column_useto")'],
  25437. header: "用途",
  25438. editor: {
  25439. xtype: 'combo',
  25440. allowBlank: false,
  25441. },
  25442. },
  25443. {
  25444. text: '主键', dataIndex: 'is_primary_key',
  25445. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25446. width: 48, resizable: false,
  25447. },
  25448. {
  25449. text: '必填', dataIndex: 'not_null',
  25450. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25451. width: 48, resizable: false,
  25452. },
  25453. {
  25454. text: '长度', dataIndex: 'column_size',
  25455. sortable: false, menuDisabled: true,
  25456. xtype: 'numbercolumn', format: '0',
  25457. editor: { allowBlank: true, selectOnFocus: true }
  25458. },
  25459. {
  25460. text: '字典', dataIndex: 'column_dict',
  25461. sortable: false, menuDisabled: true,
  25462. width: 200,
  25463. editor: {
  25464. allowBlank: true,
  25465. }
  25466. },
  25467. {
  25468. text: 'UI组件', dataIndex: 'column_ui',
  25469. sortable: false, menuDisabled: true,
  25470. // fix: ['system.getDict("column_ui")'],
  25471. width: 150,
  25472. editor: {
  25473. xtype: 'combo',
  25474. allowBlank: true,
  25475. }
  25476. },
  25477. {
  25478. dataIndex: 'data_type',
  25479. hidden: true,
  25480. },
  25481. ]
  25482. }
  25483. ],
  25484. },
  25485. {
  25486. vtitle: '其他选项',
  25487. reference: 'singleTable_3',
  25488. isEnd: true,
  25489. listeners: {
  25490. cardEnter: 'scope.extendEnter',
  25491. cardLevel: 'scope.extendLevel',
  25492. },
  25493. layout: 'fit',
  25494. items: [
  25495. {
  25496. xtype: 'form',
  25497. border: false,
  25498. layout: {
  25499. type: 'vbox',
  25500. align: 'stretch'
  25501. },
  25502. defaults: {
  25503. border: false,
  25504. anchor: '100%',
  25505. margin: '5',
  25506. },
  25507. items: [
  25508. {
  25509. xtype: 'checkbox',
  25510. fieldLabel: '需要分页',
  25511. labelWidth: 100,
  25512. bind: {
  25513. value: '{singleTable.pagination}',
  25514. },
  25515. },
  25516. {
  25517. xtype: 'combobox',
  25518. fieldLabel: '操作数据库表',
  25519. labelWidth: 100,
  25520. publishes: 'singleTable.tableName',
  25521. displayField: 'value',
  25522. valueField: 'value',
  25523. bind: {
  25524. data: '{singleTableView.tableNameList}',
  25525. value: '{singleTable.tableName}',
  25526. },
  25527. },
  25528. {
  25529. xtype: 'checkboxfield',
  25530. fieldLabel: '需要删除',
  25531. labelWidth: 100,
  25532. bind: {
  25533. value: '{singleTable.delete}',
  25534. },
  25535. },
  25536. {
  25537. xtype: 'combobox',
  25538. fieldLabel: '删除条件字段',
  25539. labelWidth: 100,
  25540. publishes: 'singleTable.deleteWhereColumn',
  25541. displayField: 'value',
  25542. valueField: 'value',
  25543. bind: {
  25544. data: '{singleTableView.columnList}',
  25545. hidden: '{!singleTable.delete}',
  25546. value: '{singleTable.deleteWhereColumn}',
  25547. },
  25548. },
  25549. {
  25550. xtype: 'textfield',
  25551. fieldLabel: '删除提示语句',
  25552. labelWidth: 100,
  25553. bind: {
  25554. hidden: '{!singleTable.delete}',
  25555. value: '{singleTable.deleteTips}',
  25556. },
  25557. },
  25558. {
  25559. fieldLabel: '新增与编辑',
  25560. labelWidth: 100,
  25561. xtype: 'radiogroup',
  25562. bind: {
  25563. value: '{singleTable.editType}'
  25564. },
  25565. layout: 'vbox',
  25566. defaults: {
  25567. border: false,
  25568. anchor: '100%',
  25569. margin: '5',
  25570. },
  25571. items: [
  25572. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25573. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25574. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25575. ]
  25576. },
  25577. ]
  25578. }
  25579. ]
  25580. },
  25581. // ---------------------------------------------------------------------------------- 主/明细查询
  25582. {
  25583. vtitle: '主表查询SQL',
  25584. reference: 'mainDetailTable_1',
  25585. layout: 'fit',
  25586. listeners: {},
  25587. items: [],
  25588. },
  25589. {
  25590. vtitle: '主表字段选项',
  25591. reference: 'mainDetailTable_2',
  25592. layout: 'fit',
  25593. listeners: {},
  25594. items: [],
  25595. },
  25596. {
  25597. vtitle: '主表其他选项',
  25598. reference: 'mainDetailTable_3',
  25599. layout: 'fit',
  25600. listeners: {},
  25601. items: [],
  25602. },
  25603. {
  25604. vtitle: '子表查询SQL',
  25605. reference: 'mainDetailTable_4',
  25606. layout: 'fit',
  25607. listeners: {},
  25608. items: [],
  25609. },
  25610. {
  25611. vtitle: '子表字段选项',
  25612. reference: 'mainDetailTable_5',
  25613. layout: 'fit',
  25614. listeners: {},
  25615. items: [],
  25616. },
  25617. {
  25618. vtitle: '子表其他选项',
  25619. reference: 'mainDetailTable_6',
  25620. isEnd: true,
  25621. layout: 'fit',
  25622. listeners: {},
  25623. items: [],
  25624. },
  25625. // ---------------------------------------------------------------------------------- 树/明细查询
  25626. // ---------------------------------------------------------------------------------- 卡片表单
  25627. {
  25628. vtitle: '表单字段',
  25629. reference: 'cardForm_1',
  25630. layout: 'fit',
  25631. listeners: {},
  25632. items: [],
  25633. },
  25634. {
  25635. vtitle: '表单初始化',
  25636. reference: 'cardForm_2',
  25637. isEnd: true,
  25638. layout: 'fit',
  25639. listeners: {},
  25640. items: [],
  25641. },
  25642. ]
  25643. };
  25644. //# sourceMappingURL=CreateModule.view.js.map
  25645. // noinspection TypeScriptCheckImport
  25646. function getSingleTableData(origin) {
  25647. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25648. var _a, _b, _c;
  25649. var data = {
  25650. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25651. package: _$2.replace(origin.packagePath, /\//g, "."),
  25652. groovyClass: origin.moduleName,
  25653. qClass: queryDslInfo.qClass,
  25654. qClassTable: queryDslInfo.qClassTable,
  25655. queryColumns: [],
  25656. insertColumns: [],
  25657. updateColumns: [],
  25658. updateWheres: [],
  25659. deleteWheres: [],
  25660. gridColumns: [],
  25661. sql: origin.sql,
  25662. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25663. addButton: origin.editType !== 1,
  25664. saveButton: origin.editType === 2,
  25665. deleteButton: true,
  25666. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25667. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25668. fileSavePath: origin.fileSavePath,
  25669. };
  25670. origin.columnList.forEach(function (column) {
  25671. 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;
  25672. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25673. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25674. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25675. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25676. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25677. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25678. if (query) {
  25679. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25680. }
  25681. if (insert) {
  25682. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25683. }
  25684. if (update) {
  25685. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25686. }
  25687. if (grid) {
  25688. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25689. if (column_dict) {
  25690. gridColumn.fix = { dictName: column_dict };
  25691. }
  25692. if (origin.editType == 2 && (insert || update)) {
  25693. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25694. if (column_dict) {
  25695. gridColumn.editor.fix = { dictName: column_dict };
  25696. }
  25697. }
  25698. data.gridColumns.push(gridColumn);
  25699. }
  25700. if (is_primary_key) {
  25701. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25702. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25703. }
  25704. });
  25705. return data;
  25706. });
  25707. }
  25708. // noinspection HttpUrlsUsage
  25709. var urlPrefix = "/static/studio-template/single_table";
  25710. function generateCode(data) {
  25711. return Promise.all([
  25712. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25713. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25714. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25715. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25716. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25717. ]).then(function (values) {
  25718. var groovy = handlebars.compile(values[0]);
  25719. var mybatis = handlebars.compile(values[1]);
  25720. var controller = handlebars.compile(values[2]);
  25721. var view = handlebars.compile(values[3]);
  25722. var model = handlebars.compile(values[4]);
  25723. var code = {
  25724. groovy: groovy(data),
  25725. mybatis: mybatis(data),
  25726. controller: controller(data),
  25727. view: view(data),
  25728. model: model(data),
  25729. };
  25730. return code;
  25731. });
  25732. }
  25733. //# sourceMappingURL=SingleTableCodegen.js.map
  25734. var CreateModule = /** @class */ (function (_super) {
  25735. __extends(CreateModule, _super);
  25736. function CreateModule() {
  25737. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25738. _this.columns = [];
  25739. return _this;
  25740. }
  25741. CreateModule.prototype.onLoad = function () {
  25742. this.refs.grid1.setData([]);
  25743. };
  25744. CreateModule.prototype.addField = function () {
  25745. this.refs.grid1.appendEditRow({
  25746. column_name: '',
  25747. column_comment: '',
  25748. is_primary_key: false,
  25749. not_null: true,
  25750. column_domain: '',
  25751. data_type: '',
  25752. column_size: 0,
  25753. decimal_digits: 0,
  25754. default_value: '',
  25755. column_dict: '',
  25756. column_ui: '',
  25757. column_note: '',
  25758. }, 0);
  25759. };
  25760. CreateModule.prototype.removeField = function () {
  25761. var _this = this;
  25762. var rows = [];
  25763. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25764. rows.push(r);
  25765. });
  25766. _$2.forEach(rows, function (r) {
  25767. _this.refs.grid1.getStore().remove(r);
  25768. });
  25769. };
  25770. CreateModule.prototype.parseSQL = function (sender) {
  25771. var _this = this;
  25772. var sql = this.viewModel.get('singleTable.sql');
  25773. sender.up('window').setLoading(true);
  25774. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25775. parseSqlApi(sql).then(function (parseResult) {
  25776. if (!parseResult.success) {
  25777. msg(parseResult.msg);
  25778. return;
  25779. }
  25780. var tableNameList = [];
  25781. var columnList = [];
  25782. var singleTableTableName;
  25783. var singleTableDeleteWhereColumn;
  25784. _this.refs.grid1.setData([]);
  25785. var rows = _this.refs.grid1.getDataRows();
  25786. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25787. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25788. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25789. return;
  25790. }
  25791. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25792. tableNameList.push({ value: tableName });
  25793. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25794. columnList.push({ value: columnName });
  25795. if (!singleTableTableName)
  25796. singleTableTableName = tableName;
  25797. if (!singleTableDeleteWhereColumn)
  25798. singleTableDeleteWhereColumn = columnName;
  25799. // 已经加过这个列了
  25800. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25801. if (rowExists) {
  25802. return;
  25803. }
  25804. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25805. if (columnRow) {
  25806. _this.refs.grid1.appendEditRow({
  25807. table_name: tableName,
  25808. column_name: columnRow.column_name,
  25809. column_comment: columnRow.column_comment,
  25810. column_useto: 2,
  25811. is_primary_key: columnRow.is_primary_key,
  25812. not_null: columnRow.not_null,
  25813. column_size: columnRow.column_size,
  25814. column_dict: columnRow.column_dict,
  25815. column_ui: columnRow.column_ui,
  25816. data_type: columnRow.data_type,
  25817. });
  25818. if (columnRow.is_primary_key)
  25819. singleTableDeleteWhereColumn = columnName;
  25820. }
  25821. else {
  25822. _this.refs.grid1.appendEditRow({
  25823. table_name: tableName,
  25824. column_name: columnName,
  25825. column_useto: 2,
  25826. });
  25827. }
  25828. });
  25829. _this.viewModel.set("singleTableView.columnList", columnList);
  25830. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25831. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25832. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25833. }).finally(function () {
  25834. sender.up('window').setLoading(false);
  25835. });
  25836. }).catch(function () {
  25837. sender.up('window').setLoading(false);
  25838. });
  25839. };
  25840. CreateModule.prototype.templateEnter = function (sender) {
  25841. };
  25842. CreateModule.prototype.templateLevel = function (sender, opt) {
  25843. if (!this.viewModel.get('moduleType')) {
  25844. msg('请选择模板类型');
  25845. opt.cancel = true;
  25846. return;
  25847. }
  25848. };
  25849. CreateModule.prototype.moduleEnter = function (sender) {
  25850. };
  25851. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25852. if (!sender.down('form').isValid()) {
  25853. opt.cancel = true;
  25854. return;
  25855. }
  25856. };
  25857. CreateModule.prototype.editorEnter = function (sender) {
  25858. var editor = sender.down('sqleditor');
  25859. editor.setValue(this.viewModel.get('singleTable.sql'));
  25860. };
  25861. CreateModule.prototype.editorLevel = function (sender, opt) {
  25862. var editor = sender.down('sqleditor');
  25863. var sql = editor.getValue();
  25864. if (!sql) {
  25865. msg('查询SQL语句必填');
  25866. opt.cancel = true;
  25867. return;
  25868. }
  25869. this.viewModel.set('singleTable.sql', sql);
  25870. };
  25871. CreateModule.prototype.columnEnter = function (sender) {
  25872. };
  25873. CreateModule.prototype.columnLevel = function (sender, opt) {
  25874. };
  25875. CreateModule.prototype.extendEnter = function (sender) {
  25876. };
  25877. CreateModule.prototype.extendLevel = function (sender, opt) {
  25878. };
  25879. // 确认结果 - Enter
  25880. CreateModule.prototype.optionEnter = function (sender) {
  25881. var _this = this;
  25882. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25883. var moduleType = this.viewModel.get("moduleType");
  25884. var data = this.viewModel.getData();
  25885. var code = "";
  25886. var origin = {};
  25887. if (moduleType === 1) {
  25888. var singleTable = data.singleTable;
  25889. var editColumns = this.refs.grid1.getDataRows();
  25890. origin.moduleType = data.moduleType;
  25891. origin.packagePath = data.packagePath;
  25892. origin.fileSavePath = data.fileSavePath;
  25893. origin.moduleName = data.moduleName;
  25894. origin.pageTitle = data.pageTitle;
  25895. if (singleTable) {
  25896. origin.sql = singleTable.sql;
  25897. origin.tableName = singleTable.tableName;
  25898. origin.pagination = singleTable.pagination;
  25899. origin.delete = singleTable.delete;
  25900. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25901. origin.deleteTips = singleTable.deleteTips;
  25902. origin.editType = singleTable.editType;
  25903. }
  25904. origin.columnList = [];
  25905. origin.queryColumns = [];
  25906. origin.insertColumns = [];
  25907. origin.updateColumns = [];
  25908. origin.gridColumns = [];
  25909. editColumns.forEach(function (column) {
  25910. var row = {
  25911. table_name: column.table_name,
  25912. column_name: column.column_name,
  25913. column_comment: column.column_comment,
  25914. is_primary_key: column.is_primary_key,
  25915. not_null: column.not_null,
  25916. column_size: column.column_size,
  25917. column_dict: column.column_dict,
  25918. column_ui: column.column_ui,
  25919. data_type: column.data_type,
  25920. column_type: column.column_type,
  25921. };
  25922. origin.columnList.push(row);
  25923. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25924. var column_name = column.column_name, column_useto = column.column_useto;
  25925. switch (column_useto) {
  25926. case 1:
  25927. origin.queryColumns.push(column_name);
  25928. break;
  25929. case 2:
  25930. origin.gridColumns.push(column_name);
  25931. break;
  25932. case 3:
  25933. origin.queryColumns.push(column_name);
  25934. origin.gridColumns.push(column_name);
  25935. break;
  25936. }
  25937. origin.insertColumns.push(column_name);
  25938. origin.updateColumns.push(column_name);
  25939. });
  25940. }
  25941. this.setLoading(true);
  25942. getSingleTableData(origin).then(function (data) {
  25943. code = JSON.stringify(data, null, 4);
  25944. window['lastTemplateData'] = code;
  25945. var editor = _this.refs.jsoneditor;
  25946. editor.setCode(code);
  25947. }).finally(function () { return _this.setLoading(false); });
  25948. };
  25949. // 确认结果 - Level
  25950. CreateModule.prototype.optionLevel = function (sender, opt) {
  25951. };
  25952. // 上一步
  25953. CreateModule.prototype.showPrevious = function () {
  25954. this.doCardNavigation(false);
  25955. };
  25956. // 下一步
  25957. CreateModule.prototype.showNext = function () {
  25958. this.doCardNavigation(true, true);
  25959. };
  25960. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25961. if (isNext === void 0) { isNext = true; }
  25962. if (isCancelable === void 0) { isCancelable = false; }
  25963. var layout = this._handle.getLayout();
  25964. var activeItem = layout.activeItem;
  25965. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25966. if (isNext)
  25967. this.prevCard = reference;
  25968. var activeCard;
  25969. if (reference === "templateSelection") {
  25970. if (isNext) {
  25971. activeCard = this.refs['moduleName'];
  25972. }
  25973. }
  25974. else if (reference === "moduleName") {
  25975. if (isNext) {
  25976. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25977. var moduleType = this.viewModel.get("moduleType");
  25978. switch (moduleType) {
  25979. case 1:
  25980. activeCard = this.refs['singleTable_1'];
  25981. break;
  25982. case 2:
  25983. activeCard = this.refs['mainDetailTable_1'];
  25984. break;
  25985. case 3:
  25986. // activeCard =
  25987. break;
  25988. case 4:
  25989. activeCard = this.refs['cardForm_1'];
  25990. break;
  25991. }
  25992. }
  25993. else {
  25994. activeCard = this.refs['templateSelection'];
  25995. }
  25996. }
  25997. else if (reference === "confirmResult") {
  25998. if (!isNext) {
  25999. activeCard = this.refs[this.prevCard];
  26000. }
  26001. }
  26002. else {
  26003. var name = reference.split('_')[0];
  26004. var idx = parseInt(reference.split('_')[1], 10);
  26005. if (isNext) {
  26006. if (isEnd) {
  26007. activeCard = this.refs['confirmResult'];
  26008. }
  26009. else {
  26010. idx += 1;
  26011. }
  26012. }
  26013. else {
  26014. idx -= 1;
  26015. }
  26016. if (idx <= 0) {
  26017. activeCard = this.refs['moduleName'];
  26018. }
  26019. else if (!activeCard) {
  26020. activeCard = this.refs[name + "_" + idx];
  26021. }
  26022. }
  26023. // 按钮状态
  26024. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26025. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26026. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26027. // 设置下一页显示
  26028. if (activeCard) {
  26029. var optCancel = { cancel: false };
  26030. // 发出 cardLevel 事件
  26031. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26032. if (isCancelable && optCancel.cancel) {
  26033. // 取消了
  26034. return;
  26035. }
  26036. layout.setActiveItem(activeCard);
  26037. this.viewModel.set('title', layout.activeItem.vtitle);
  26038. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26039. }
  26040. };
  26041. // 立刻执行
  26042. CreateModule.prototype.finish = function (sender) {
  26043. var _this = this;
  26044. var parent = sender.up('window');
  26045. var editor = this.refs.jsoneditor;
  26046. var data = JSON.parse(editor.getCode());
  26047. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26048. var moduleType = this.viewModel.get("moduleType");
  26049. if (moduleType === 1) {
  26050. this.setLoading(true);
  26051. generateCode(data).then(function (code) {
  26052. console.log("===> ", code);
  26053. _this.setLoading(true);
  26054. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26055. .then(function () {
  26056. msg("创建成功!");
  26057. parent.close();
  26058. handles$1.fileTree.reload();
  26059. }).finally(function () { return _this.setLoading(false); });
  26060. }).finally(function () { return _this.setLoading(false); });
  26061. }
  26062. };
  26063. return CreateModule;
  26064. }(Scope));
  26065. //# sourceMappingURL=CreateModule.js.map
  26066. function getModuleId(path) {
  26067. var separator = "/";
  26068. var sps = path.split(separator);
  26069. var joinSps = sps.join('$');
  26070. if (!joinSps) {
  26071. return "ROOT";
  26072. }
  26073. return joinSps;
  26074. }
  26075. /**
  26076. * Module数据转换成Tree数据
  26077. */
  26078. function modulesToTreeData(modules) {
  26079. var separator = "/";
  26080. var treeNodeMap = new Map();
  26081. var root = {
  26082. type: "Dir",
  26083. path: "",
  26084. expanded: true,
  26085. leaf: false,
  26086. children: [],
  26087. };
  26088. root.id = getModuleId(root.path);
  26089. treeNodeMap.set(root.path, root);
  26090. modules.forEach(function (module) {
  26091. var _a;
  26092. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26093. if (paths.length <= 0)
  26094. return;
  26095. var path = [];
  26096. var parent = root;
  26097. paths.forEach(function (dirName, idx) {
  26098. var parentPath = path.join(separator);
  26099. parent = treeNodeMap.get(parentPath);
  26100. path.push(dirName);
  26101. var currentPath = path.join(separator);
  26102. var child = treeNodeMap.get(currentPath);
  26103. if (child == null) {
  26104. // 获取当前path 绝对路径
  26105. var indexLength = module.absolutePath.indexOf(currentPath);
  26106. var currentAbsolutePath = "";
  26107. if (indexLength > 0) {
  26108. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26109. }
  26110. child = {
  26111. type: "Dir",
  26112. path: currentPath,
  26113. absolutePath: currentAbsolutePath,
  26114. leaf: false,
  26115. children: [],
  26116. text: dirName
  26117. };
  26118. child.id = getModuleId(child.path);
  26119. parent.children.push(child);
  26120. treeNodeMap.set(child.path, child);
  26121. }
  26122. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26123. var leaf = {
  26124. type: "Module",
  26125. path: module.path + separator + module.name,
  26126. absolutePath: module.absolutePath,
  26127. leaf: true,
  26128. text: module.name,
  26129. module: module,
  26130. };
  26131. leaf.id = getModuleId(leaf.path);
  26132. child.children.push(leaf);
  26133. treeNodeMap.set(leaf.path, leaf);
  26134. }
  26135. });
  26136. });
  26137. // 排序处理
  26138. treeNodeMap.forEach(function (module) {
  26139. if (module.children) {
  26140. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26141. module.children.length = 0;
  26142. children.forEach(function (item) { return module.children.push(item); });
  26143. }
  26144. });
  26145. return root;
  26146. }
  26147. function showDialog(sender, option) {
  26148. var _a, _b;
  26149. var win = new Ext.Window({
  26150. autoDestroy: true,
  26151. title: option.title,
  26152. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26153. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26154. resizable: false,
  26155. closable: true,
  26156. modal: true,
  26157. maximizable: false,
  26158. minimizable: false,
  26159. // constrainHeader: true,
  26160. constrain: true,
  26161. layout: 'fit',
  26162. animateTarget: sender,
  26163. buttonAlign: 'center',
  26164. items: [
  26165. {
  26166. xtype: "form",
  26167. layout: "hbox",
  26168. margin: '10px 20px',
  26169. border: 0,
  26170. items: option.items
  26171. }
  26172. ],
  26173. //窗口按钮
  26174. fbar: [
  26175. {
  26176. xtype: 'button', text: '保存', handler: function (btn) {
  26177. //窗口获取表单
  26178. var form = win.down('form');
  26179. var vaildSuccess = form.isValid();
  26180. if (!vaildSuccess) {
  26181. return;
  26182. }
  26183. option.submitFunc(form);
  26184. }
  26185. },
  26186. {
  26187. xtype: 'button', text: '取消', handler: function (btn) {
  26188. //窗口关闭
  26189. btn.up('window').close();
  26190. }
  26191. }
  26192. ],
  26193. });
  26194. win.show();
  26195. }
  26196. function showCreateFolderWin(sender, parentPath) {
  26197. showDialog(sender, {
  26198. title: '新建文件夹',
  26199. height: 150,
  26200. items: [
  26201. {
  26202. xtype: "textfield",
  26203. name: "filename",
  26204. fieldLabel: "文件夹名称",
  26205. allowBlank: false,
  26206. selectOnFocus: true,
  26207. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26208. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26209. labelWidth: 80,
  26210. width: "100%",
  26211. listeners: {
  26212. afterrender: function (sender) {
  26213. _$2.defer(function () {
  26214. sender.focus();
  26215. });
  26216. }
  26217. }
  26218. },
  26219. ],
  26220. submitFunc: function (form) {
  26221. var filename = form.down('textfield[name="filename"]').getValue();
  26222. createFolder(parentPath, filename).then(function (res) {
  26223. if (res.success) {
  26224. msg$1('创建成功');
  26225. handles$1.fileTree.reload();
  26226. form.up('window').close();
  26227. }
  26228. else {
  26229. showErrorDialog$1(res.msg);
  26230. }
  26231. }).catch(function (e) {
  26232. showErrorDialog$1(e.responseJSON.msg);
  26233. });
  26234. }
  26235. });
  26236. }
  26237. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26238. var dlg = new CreateModule();
  26239. dlg.showDialog(sender, {}, {
  26240. data: {
  26241. packagePath: path,
  26242. fileSavePath: absolutePath,
  26243. }
  26244. });
  26245. }
  26246. function registerModule$1(sender, path, name, icon) {
  26247. // 前缀 com/galaxis/wms 写死了
  26248. var dlg = new RegisterModule();
  26249. dlg.showDialog(sender, {}, {
  26250. data: {
  26251. form: {
  26252. scope_url: path.replace("com/galaxis/wms", "."),
  26253. resource_name: name,
  26254. resource_icon: icon,
  26255. }
  26256. }
  26257. });
  26258. }
  26259. function showCreateEmptyModule(sender, path) {
  26260. var win = new Ext.Window({
  26261. autoDestroy: true,
  26262. title: "新建空模块",
  26263. width: 400,
  26264. height: 150,
  26265. resizable: true,
  26266. closable: true,
  26267. maximizable: true,
  26268. minimizable: true,
  26269. plain: true,
  26270. // constrainHeader: true,
  26271. constrain: true,
  26272. layout: 'fit',
  26273. animateTarget: sender,
  26274. buttonAlign: 'center',
  26275. items: [
  26276. {
  26277. xtype: "form",
  26278. layout: "hbox",
  26279. margin: '10px 20px',
  26280. border: 0,
  26281. items: [
  26282. {
  26283. flex: 1,
  26284. layout: 'vbox',
  26285. items: [
  26286. {
  26287. xtype: "textfield",
  26288. name: "filename",
  26289. fieldLabel: "模块名",
  26290. flex: 1,
  26291. allowBlank: false,
  26292. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26293. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26294. labelWidth: 50,
  26295. width: "100%",
  26296. },
  26297. ]
  26298. },
  26299. ]
  26300. }
  26301. ],
  26302. //窗口按钮
  26303. buttons: [
  26304. {
  26305. xtype: 'button', text: '保存', handler: function (btn) {
  26306. //窗口获取表单
  26307. var form = win.down('form');
  26308. var vaildSuccess = form.isValid();
  26309. if (!vaildSuccess) {
  26310. return;
  26311. }
  26312. var filename = form.down('textfield[name="filename"]').getValue();
  26313. createEmptyModule(path, filename).then(function (res) {
  26314. if (res.success) {
  26315. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26316. handles$1.fileTree.reload();
  26317. win.close();
  26318. }
  26319. else {
  26320. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26321. }
  26322. }).catch(function (e) {
  26323. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26324. });
  26325. }
  26326. },
  26327. {
  26328. xtype: 'button', text: '取消', handler: function (btn) {
  26329. //窗口关闭
  26330. win.close();
  26331. }
  26332. }
  26333. ]
  26334. });
  26335. win.show();
  26336. }
  26337. //# sourceMappingURL=FileHelp.js.map
  26338. function initFileTree () {
  26339. Ext.define('com.yvan.studio.FileTree', {
  26340. extend: 'com.yvan.studio.StateTree',
  26341. xtype: 'filetree',
  26342. tooltip: '文件',
  26343. iconCls: 'x-fa fa-file',
  26344. rootVisible: false,
  26345. useArrows: true,
  26346. colspan: 2,
  26347. lines: true,
  26348. reference: 'filetree',
  26349. multiSelect: true,
  26350. getStateFilename: function () {
  26351. return getCurrentProject().uuid + "/filetree.json";
  26352. },
  26353. openNode: function () {
  26354. var selection = this.getSelection();
  26355. var _a = __read(selection, 1), record = _a[0];
  26356. if (!record) {
  26357. return;
  26358. }
  26359. var raw = record.raw;
  26360. if (raw.type === 'Dir') {
  26361. return;
  26362. }
  26363. if (raw.type === "Module" && raw.module) {
  26364. eventBus.publish(EventType.ModuleOpen, raw);
  26365. }
  26366. },
  26367. openInIdea: function () {
  26368. var _a = __read(this.getSelection(), 1), record = _a[0];
  26369. if (record) {
  26370. var data = record.data;
  26371. if (data.type === "Module") {
  26372. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26373. native.openInIdea(data.module.groovyFile.absolutePath);
  26374. }
  26375. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26376. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26377. }
  26378. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26379. native.openInIdea(data.module.jsViewFile.absolutePath);
  26380. }
  26381. return;
  26382. }
  26383. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26384. }
  26385. },
  26386. deleteSelection: function () {
  26387. var selection = this.getSelection();
  26388. var pathList = [];
  26389. _.forEach(selection, function (item) {
  26390. if (item.data.type === "Dir") {
  26391. pathList.push({ path: item.data.path, isFolder: true });
  26392. }
  26393. else {
  26394. pathList.push({ path: item.data.path, isFolder: false });
  26395. }
  26396. });
  26397. {
  26398. return;
  26399. }
  26400. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26401. //
  26402. // Ext.Msg.confirm('提示', title, (btn) => {
  26403. // if (btn === 'yes') {
  26404. // deleteFileOrFolder(raw.path, title, true)
  26405. // }
  26406. // })
  26407. // const title = '您确定要删除(' + raw.path + ')吗?'
  26408. // deleteFileOrFolder(raw.path, title, false)
  26409. },
  26410. listeners: {
  26411. itemverify: function () {
  26412. this.openNode();
  26413. },
  26414. afterrender: function (me) {
  26415. console.log('filetree_afterrender', 'reloadIfNeed');
  26416. moduleStore.registe(me.subscribeModule.bind(this));
  26417. moduleStore.reloadIfNeed("PC");
  26418. },
  26419. destroy: function (me) {
  26420. console.log('filetree_destroy');
  26421. moduleStore.unregiste(me.subscribeModule.bind(this));
  26422. },
  26423. itemcontextmenu: function (sender, node, element, idx, e) {
  26424. e.preventDefault();
  26425. var raw = node.raw;
  26426. var option = {};
  26427. if (raw.type === 'Dir') {
  26428. // 文件夹右键
  26429. option = {
  26430. shadow: 'frame', allowOtherMenus: true,
  26431. items: [
  26432. {
  26433. text: '新建空模块',
  26434. iconCls: 'x-fa fa-plus-circle',
  26435. handler: function (sender) {
  26436. showCreateEmptyModule(sender, raw.path);
  26437. }
  26438. },
  26439. {
  26440. text: '新建模块',
  26441. iconCls: 'x-fa fa-plus-circle',
  26442. handler: function (sender) {
  26443. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26444. }
  26445. },
  26446. '-',
  26447. {
  26448. text: '新建文件夹',
  26449. iconCls: 'x-fa fa-folder-o',
  26450. handler: function (sender) {
  26451. var parentPath = raw.path;
  26452. showCreateFolderWin(sender, parentPath);
  26453. }
  26454. },
  26455. {
  26456. text: '复制路径',
  26457. iconCls: 'x-fa fa-external-link',
  26458. handler: function (sender) {
  26459. native.clipboardSet(raw.path);
  26460. }
  26461. },
  26462. ]
  26463. };
  26464. }
  26465. else {
  26466. // 文件右键
  26467. option = {
  26468. shadow: 'frame', allowOtherMenus: true,
  26469. items: [
  26470. // {
  26471. // text: '重命名',
  26472. // iconCls: 'x-fa fa-terminal',
  26473. // handler(sender) {
  26474. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26475. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26476. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26477. // }
  26478. // },
  26479. // {
  26480. // text: '另存为',
  26481. // iconCls: 'x-fa fa-exchange',
  26482. // handler(sender) {
  26483. // console.error('没做')
  26484. // }
  26485. // },
  26486. {
  26487. text: '复制路径',
  26488. iconCls: 'x-fa fa-external-link',
  26489. handler: function (sender) {
  26490. native.clipboardSet(raw.path);
  26491. }
  26492. },
  26493. '-',
  26494. {
  26495. text: '注册模块',
  26496. iconCls: 'x-fa fa-sign-in',
  26497. handler: function (sender) {
  26498. registerModule$1(sender, raw.path);
  26499. }
  26500. },
  26501. ]
  26502. };
  26503. }
  26504. var treeMenu = new Ext.menu.Menu(option);
  26505. treeMenu.showAt(e.getXY());
  26506. },
  26507. },
  26508. tbar: [
  26509. {
  26510. xtype: 'button',
  26511. iconCls: 'x-fa fa-crosshairs',
  26512. tooltip: '选中当前打开的文件',
  26513. handler: function (sender) {
  26514. msg$1('没做');
  26515. }
  26516. },
  26517. {
  26518. xtype: 'button',
  26519. iconCls: 'x-fa fa-link',
  26520. tooltip: '在IDEA中打开',
  26521. handler: function (sender) {
  26522. var scope = sender.up("filetree");
  26523. scope.openInIdea();
  26524. }
  26525. },
  26526. {
  26527. xtype: 'button',
  26528. iconCls: 'x-fa fa-refresh',
  26529. tooltip: '刷新',
  26530. handler: function (sender) {
  26531. var scope = sender.up("filetree");
  26532. scope.reload();
  26533. }
  26534. },
  26535. {
  26536. xtype: 'button',
  26537. iconCls: 'x-fa fa-percent',
  26538. tooltip: '监控',
  26539. handler: function (sender) {
  26540. // handles.mainWindow.showPerform()
  26541. }
  26542. },
  26543. ],
  26544. initComponent: function () {
  26545. setFileTree(this);
  26546. this.superclass.initComponent.apply(this, arguments);
  26547. // super.initComponent.apply(this, arguments)
  26548. },
  26549. subscribeModule: function (res) {
  26550. if (typeof res === 'object') {
  26551. var rootNode = modulesToTreeData(res.data);
  26552. this.setRootNode(rootNode);
  26553. this.restoreState();
  26554. handles$1.mainWindow.modules = res.data;
  26555. }
  26556. else if (typeof res === 'boolean') {
  26557. this.setLoading(res);
  26558. }
  26559. },
  26560. reload: function () {
  26561. console.log('filetree_reloadForce');
  26562. moduleStore.reloadForce("PC").then(function (res) {
  26563. });
  26564. }
  26565. });
  26566. }
  26567. //# sourceMappingURL=FileTree.js.map
  26568. function initDbTree () {
  26569. var define = {
  26570. extend: 'com.yvan.studio.StateTree',
  26571. xtype: 'dbtree',
  26572. tooltip: '数据库',
  26573. iconCls: 'x-fa fa-database',
  26574. rootVisible: false,
  26575. useArrows: true,
  26576. reference: 'dbtree',
  26577. multiSelect: true,
  26578. getStateFilename: function () {
  26579. return getCurrentProject().uuid + "/dbtree.json";
  26580. },
  26581. tbar: [
  26582. {
  26583. xtype: 'button',
  26584. iconCls: 'x-fa fa-crosshairs',
  26585. tooltip: '选中当前打开的表',
  26586. handler: function (sender) {
  26587. var _a;
  26588. // 获取当前选中的活动标签 tableColumn_bas_car
  26589. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26590. if (!locatPath) {
  26591. return;
  26592. }
  26593. handles$1.dbTree.selectPath(locatPath);
  26594. }
  26595. },
  26596. {
  26597. xtype: 'button',
  26598. iconCls: 'x-fa fa-refresh',
  26599. tooltip: '刷新',
  26600. handler: function (sender) {
  26601. handles$1.dbTree.reload();
  26602. }
  26603. },
  26604. {
  26605. xtype: 'button',
  26606. iconCls: 'x-fa fa-cloud-download',
  26607. tooltip: '重新拉取生成元数据(耗时很长!)',
  26608. handler: function (sender) {
  26609. handles$1.dbTree.dbToMetaAndReload(sender);
  26610. }
  26611. },
  26612. // {
  26613. // xtype: 'button',
  26614. // iconCls: 'x-fa fa-files-o',
  26615. // tooltip: '数据同步',
  26616. // handler(sender) {
  26617. //
  26618. // }
  26619. // },
  26620. {
  26621. xtype: 'button',
  26622. iconCls: 'x-fa fa-exchange',
  26623. tooltip: '数据结构同步',
  26624. handler: function (sender) {
  26625. // handles.mainWindow.showDataSync(sender)
  26626. }
  26627. },
  26628. {
  26629. xtype: 'button',
  26630. iconCls: 'x-fa fa-window-maximize',
  26631. tooltip: 'SQL查询分析器',
  26632. handler: function (sender) {
  26633. // handles.mainWindow.showDbCodeTemplate(sender)
  26634. }
  26635. },
  26636. {
  26637. xtype: 'button',
  26638. iconCls: 'x-fa fa-cubes',
  26639. tooltip: '数据域管理',
  26640. handler: function (sender) {
  26641. // handles.mainWindow.showColumnDomain()
  26642. }
  26643. },
  26644. {
  26645. xtype: 'button',
  26646. iconCls: 'x-fa fa-edit',
  26647. tooltip: '修改结构',
  26648. handler: function (sender) {
  26649. var tree = sender.up("treepanel");
  26650. var selection = tree.getSelection();
  26651. var _a = __read(selection, 1), node = _a[0];
  26652. if (!node) {
  26653. msg$1('请选择一个表');
  26654. return;
  26655. }
  26656. var raw = node.data.raw;
  26657. if (node.get('type') === 'table') ;
  26658. else if (node.get('type') === 'column') ;
  26659. }
  26660. },
  26661. ],
  26662. listeners: {
  26663. afterrender: function (me) {
  26664. setDbTree(this);
  26665. // 找管理器订阅刷新的事件
  26666. instance$1.registe(this.refreshData.bind(this));
  26667. instance$1.reloadIfNeed(undefined);
  26668. },
  26669. destory: function (me) {
  26670. setDbTree(undefined);
  26671. instance$1.unregiste(this.refreshData.bind(this));
  26672. },
  26673. itemcontextmenu: function (sender, node, element, idx, e) {
  26674. var _this = this;
  26675. e.preventDefault();
  26676. var option = {};
  26677. var raw = node.raw.raw;
  26678. if (node.get('type') === 'column') {
  26679. option = {
  26680. shadow: 'frame', allowOtherMenus: true,
  26681. items: [
  26682. {
  26683. text: '设计结构',
  26684. iconCls: 'x-fa fa-edit',
  26685. handler: function (sender) {
  26686. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26687. }
  26688. },
  26689. ]
  26690. };
  26691. }
  26692. else if (node.get('type') === 'table') {
  26693. option = {
  26694. shadow: 'frame', allowOtherMenus: true,
  26695. items: [
  26696. {
  26697. text: '新建',
  26698. iconCls: 'x-fa fa-plus',
  26699. handler: function (sender) {
  26700. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26701. }
  26702. },
  26703. {
  26704. text: '设计结构',
  26705. iconCls: 'x-fa fa-edit',
  26706. handler: function (sender) {
  26707. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26708. }
  26709. },
  26710. {
  26711. text: '重命名',
  26712. iconCls: 'x-fa fa-pencil',
  26713. handler: function (sender) {
  26714. _this.renameTable(sender, node.data.raw);
  26715. }
  26716. },
  26717. '-',
  26718. {
  26719. text: '删除',
  26720. iconCls: 'x-fa fa-minus',
  26721. handler: function (sender) {
  26722. _this.removeTable(sender, node.data.raw);
  26723. }
  26724. },
  26725. ]
  26726. };
  26727. }
  26728. var treeMenu = new Ext.menu.Menu(option);
  26729. treeMenu.showAt(e.getXY());
  26730. }
  26731. },
  26732. // DbTreeStore 刷新时,会回调到这个方法
  26733. refreshData: function (isLoadingState) {
  26734. var me = this;
  26735. if (typeof isLoadingState === 'boolean') {
  26736. me.setLoading(isLoadingState);
  26737. return;
  26738. }
  26739. var rootNode = getDbTree(instance$1.apiResponse);
  26740. me.setRootNode(rootNode);
  26741. this.restoreState();
  26742. },
  26743. renameTable: function (sender, tableRow) {
  26744. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26745. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26746. if (!res.data)
  26747. return;
  26748. var window = Ext.create('Ext.window.Window', {
  26749. title: 'SQL 预览',
  26750. height: 400,
  26751. width: 600,
  26752. modal: true,
  26753. animateTarget: sender,
  26754. maximizable: true,
  26755. layout: 'fit',
  26756. items: {
  26757. xtype: 'sqleditor',
  26758. value: res.data,
  26759. },
  26760. buttons: [
  26761. {
  26762. xtype: 'button',
  26763. text: '执行',
  26764. iconCls: 'x-fa fa-save',
  26765. handler: function (sender) {
  26766. var editor = sender.up('window').down('sqleditor');
  26767. var ddl = editor.getValue();
  26768. window.setLoading(true);
  26769. instance$1.pushToDbCommit({
  26770. schema_name: tableRow.schema_name,
  26771. table_name: name,
  26772. old_table_name: tableRow.table_name,
  26773. ddl: ddl,
  26774. }).then(function () {
  26775. handles$1.dbTree.reload();
  26776. window.close();
  26777. }).finally(function () { return window.setLoading(false); });
  26778. },
  26779. },
  26780. {
  26781. xtype: 'button',
  26782. text: '取消',
  26783. iconCls: 'x-fa fa-times',
  26784. handler: function () {
  26785. window.close();
  26786. }
  26787. },
  26788. ]
  26789. }).show();
  26790. });
  26791. });
  26792. },
  26793. removeTable: function (sender, tableRow) {
  26794. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26795. if (!res.data)
  26796. return;
  26797. var window = Ext.create('Ext.window.Window', {
  26798. title: 'SQL 预览',
  26799. height: 400,
  26800. width: 600,
  26801. modal: true,
  26802. animateTarget: sender,
  26803. maximizable: true,
  26804. layout: 'fit',
  26805. items: {
  26806. xtype: 'sqleditor',
  26807. value: res.data,
  26808. },
  26809. buttons: [
  26810. {
  26811. xtype: 'button',
  26812. text: '执行',
  26813. iconCls: 'x-fa fa-save',
  26814. handler: function (sender) {
  26815. var editor = sender.up('window').down('sqleditor');
  26816. var ddl = editor.getValue();
  26817. window.setLoading(true);
  26818. instance$1.pushToDbCommit({
  26819. schema_name: tableRow.schema_name,
  26820. table_name: tableRow.table_name,
  26821. ddl: ddl
  26822. })
  26823. .then(function () {
  26824. handles$1.dbTree.reload();
  26825. window.close();
  26826. }).finally(function () { return window.setLoading(false); });
  26827. }
  26828. },
  26829. {
  26830. xtype: 'button',
  26831. text: '取消',
  26832. iconCls: 'x-fa fa-times',
  26833. handler: function () {
  26834. window.close();
  26835. }
  26836. }
  26837. ]
  26838. }).show();
  26839. });
  26840. },
  26841. // hideHeaders: true,
  26842. // columns: [
  26843. // {
  26844. // xtype: 'treecolumn',
  26845. // text: '名称',
  26846. // dataIndex: 'text',
  26847. // flex: 2,
  26848. // }, {
  26849. // text: '描述',
  26850. // dataIndex: 'comment',
  26851. // flex: 1,
  26852. // }
  26853. // ],
  26854. reload: function () {
  26855. // 强制刷新 DbManager
  26856. instance$1.reloadForce(undefined);
  26857. },
  26858. dbToMetaAndReload: function () {
  26859. // 从数据库结构重新生成元数据
  26860. instance$1.dbToMetaAndReload();
  26861. }
  26862. };
  26863. Ext.define('com.yvan.studio.DbTree', define);
  26864. }
  26865. /**
  26866. * 将数据构建成 dbTree 需要的格式
  26867. */
  26868. function getDbTree(apiResponse) {
  26869. var rootNode = {
  26870. children: [],
  26871. expanded: true,
  26872. id: "ROOT",
  26873. leaf: false,
  26874. };
  26875. _$2.forEach(apiResponse, function (schemaRow) {
  26876. var schemaNode = {
  26877. id: 'schema$' + schemaRow.schema_name,
  26878. type: "schema",
  26879. expanded: true,
  26880. leaf: false,
  26881. iconCls: 'x-fa fa-th-large ',
  26882. text: schemaRow.schema_name,
  26883. raw: __assign({}, schemaRow),
  26884. children: [],
  26885. };
  26886. delete schemaNode.raw.table_list;
  26887. rootNode.children.push(schemaNode);
  26888. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26889. var _a;
  26890. var tableNode = {
  26891. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26892. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26893. comment: tableRow.description,
  26894. type: "table",
  26895. iconCls: 'x-fa fa-table',
  26896. expanded: false,
  26897. leaf: false,
  26898. children: [],
  26899. raw: __assign({}, tableRow)
  26900. };
  26901. delete tableNode.raw.column_list;
  26902. schemaNode.children.push(tableNode);
  26903. _$2.forEach(tableRow.column_list, function (columnRow) {
  26904. var _a;
  26905. var iconCls = 'x-fa fa-square-o';
  26906. if (columnRow.is_primary_key) {
  26907. iconCls = 'x-fa fa-key';
  26908. }
  26909. else if (columnRow.not_null) {
  26910. iconCls = 'x-fa fa-check-square';
  26911. }
  26912. var columnNode = {
  26913. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26914. type: "column",
  26915. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26916. comment: columnRow.column_comment,
  26917. leaf: true,
  26918. iconCls: iconCls,
  26919. raw: __assign({}, columnRow)
  26920. };
  26921. tableNode.children.push(columnNode);
  26922. }); // column
  26923. }); // table
  26924. }); // schema
  26925. return rootNode;
  26926. }
  26927. //# sourceMappingURL=DbTree.js.map
  26928. var ReportGridController = /** @class */ (function () {
  26929. function ReportGridController() {
  26930. }
  26931. ReportGridController.prototype.onLoad = function (sender) {
  26932. this.reload();
  26933. setReport(this);
  26934. };
  26935. ReportGridController.prototype.showSingle = function (sender) {
  26936. var _this = this;
  26937. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26938. if (record) {
  26939. handles.mainWindow.showFormSingle(record.data, function () {
  26940. _this.reload();
  26941. });
  26942. }
  26943. };
  26944. ReportGridController.prototype.filterChanged = function (sender, value) {
  26945. console.log('filterChange', sender, value);
  26946. this.view.store.clearFilter();
  26947. if (value) {
  26948. this.view.store.filterBy(function (record) {
  26949. var code = _.lowerCase(record.get('report_name'));
  26950. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26951. return (code.includes(value) ||
  26952. dict_desc_py.includes(value));
  26953. });
  26954. }
  26955. };
  26956. ReportGridController.prototype.onClearClick = function () {
  26957. var _a, _b;
  26958. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26959. };
  26960. ReportGridController.prototype.reload = function () {
  26961. var me = this;
  26962. me.getView().setLoading(true);
  26963. reportListApi().then(function (res) {
  26964. _.forEach(res.data, function (r) {
  26965. r.report_enable = r.report_enable === 1;
  26966. });
  26967. me.getView().setStore(new Ext.data.Store({
  26968. fields: ['report_id', 'report_name', 'report_enable'],
  26969. data: res.data,
  26970. }));
  26971. }).finally(function () {
  26972. me.getView().setLoading(false);
  26973. });
  26974. };
  26975. ReportGridController.prototype.reportAdd = function () {
  26976. var _this = this;
  26977. prompt$2('请输入报表名称').then(function (name) {
  26978. createReportApi(name).then(function (res) {
  26979. if (res.success) {
  26980. msg$1('添加成功');
  26981. handles.mainWindow.showReport(res.data, name, function () {
  26982. _this.reload();
  26983. });
  26984. }
  26985. _this.reload();
  26986. });
  26987. });
  26988. };
  26989. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26990. e.preventDefault();
  26991. var me = sender.up('grid').ownerGrid.getController();
  26992. var option = {
  26993. shadow: 'frame', allowOtherMenus: true,
  26994. items: [
  26995. {
  26996. text: '添加',
  26997. iconCls: 'x-fa fa-plus-circle',
  26998. handler: function (sender) {
  26999. me.reportAdd();
  27000. }
  27001. },
  27002. {
  27003. text: '编辑',
  27004. iconCls: 'x-fa fa-edit',
  27005. handler: function (sender) {
  27006. me.reportEdit();
  27007. }
  27008. },
  27009. {
  27010. text: '删除',
  27011. iconCls: 'x-fa fa-minus-circle',
  27012. handler: function (sender) {
  27013. me.reportRemove();
  27014. }
  27015. },
  27016. '-',
  27017. {
  27018. text: '注册(至菜单)',
  27019. iconCls: 'x-fa fa-sign-in',
  27020. handler: function (sender) {
  27021. me.reportRegiste(sender);
  27022. }
  27023. },
  27024. {
  27025. text: '卸载',
  27026. iconCls: 'x-fa fa-sign-out',
  27027. handler: function (sender) {
  27028. console.error('没做');
  27029. }
  27030. },
  27031. ]
  27032. };
  27033. var treeMenu = new Ext.menu.Menu(option);
  27034. treeMenu.showAt(e.getXY());
  27035. };
  27036. ReportGridController.prototype.reportRegiste = function (sender) {
  27037. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27038. if (record) {
  27039. var reportName = record.get('report_name');
  27040. var reportId = record.get('report_id');
  27041. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27042. }
  27043. };
  27044. ReportGridController.prototype.reportRemove = function () {
  27045. var _this = this;
  27046. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27047. if (record) {
  27048. var reportName = record.get('report_name');
  27049. var reportId_1 = record.get('report_id');
  27050. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27051. delReportApi(reportId_1).then(function (res) {
  27052. if (res.success) {
  27053. msg$1('删除成功');
  27054. _this.reload();
  27055. }
  27056. });
  27057. });
  27058. }
  27059. };
  27060. ReportGridController.prototype.reportEdit = function () {
  27061. var _this = this;
  27062. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27063. if (record) {
  27064. var reportName = record.get('report_name');
  27065. var reportId = record.get('report_id');
  27066. handles.mainWindow.showReport(reportId, reportName, function () {
  27067. _this.reload();
  27068. });
  27069. }
  27070. };
  27071. ReportGridController.prototype.onDblClick = function (sender) {
  27072. this.reportEdit();
  27073. };
  27074. return ReportGridController;
  27075. }());
  27076. //# sourceMappingURL=ReportGridController.js.map
  27077. function initReportGrid () {
  27078. var controller = new ReportGridController();
  27079. Ext.define('com.yvan.studio.ReportGrid', {
  27080. extend: 'Ext.grid.Panel',
  27081. xtype: 'reportGrid',
  27082. controller: controller,
  27083. scope: controller,
  27084. referenceHolder: true,
  27085. tooltip: '查询报表',
  27086. iconCls: 'x-fa fa-bar-chart',
  27087. useArrows: true,
  27088. reference: 'reportgrid',
  27089. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27090. listeners: {
  27091. itemdblclick: 'onDblClick',
  27092. afterrender: 'onLoad',
  27093. },
  27094. viewConfig: {
  27095. enableTextSelection: true,
  27096. listeners: {
  27097. itemcontextmenu: 'onGridContextMenu',
  27098. },
  27099. },
  27100. tbar: {
  27101. xtype: 'toolbar',
  27102. items: [
  27103. {
  27104. xtype: 'button',
  27105. tooltip: '测试',
  27106. iconCls: 'x-fa fa-bars',
  27107. listeners: {
  27108. click: 'showSingle'
  27109. }
  27110. },
  27111. {
  27112. xtype: 'button',
  27113. tooltip: '刷新',
  27114. iconCls: 'x-fa fa-refresh',
  27115. listeners: {
  27116. click: 'reload'
  27117. }
  27118. },
  27119. {
  27120. xtype: 'button',
  27121. tooltip: '添加',
  27122. iconCls: 'x-fa fa-plus-circle',
  27123. listeners: {
  27124. click: 'reportAdd'
  27125. }
  27126. },
  27127. {
  27128. xtype: 'button',
  27129. tooltip: '删除',
  27130. iconCls: 'x-fa fa-minus-circle',
  27131. listeners: {
  27132. click: 'reportRemove'
  27133. }
  27134. },
  27135. {
  27136. xtype: 'textfield',
  27137. flex: 1,
  27138. reference: "txtFilter",
  27139. emptyText: '搜索过滤',
  27140. enableKeyEvents: true,
  27141. listeners: {
  27142. change: {
  27143. fn: 'filterChanged',
  27144. buffer: 50
  27145. }
  27146. }
  27147. },
  27148. ]
  27149. },
  27150. columns: [
  27151. {
  27152. text: 'ID', dataIndex: 'report_id',
  27153. hidden: true,
  27154. },
  27155. {
  27156. text: '报表名称', dataIndex: 'report_name',
  27157. flex: 1,
  27158. },
  27159. ]
  27160. });
  27161. }
  27162. //# sourceMappingURL=ReportGrid.js.map
  27163. /** 所有变量类型 */
  27164. var TypeEnum;
  27165. (function (TypeEnum) {
  27166. TypeEnum["string"] = "string";
  27167. TypeEnum["number"] = "number";
  27168. TypeEnum["object"] = "object";
  27169. TypeEnum["array"] = "array";
  27170. TypeEnum["function"] = "function";
  27171. TypeEnum["null"] = "null";
  27172. TypeEnum["boolean"] = "boolean";
  27173. TypeEnum["symbol"] = "symbol";
  27174. TypeEnum["json"] = "json";
  27175. TypeEnum["math"] = "math";
  27176. TypeEnum["regexp"] = "regexp";
  27177. TypeEnum["date"] = "date";
  27178. TypeEnum["undefined"] = "undefined";
  27179. TypeEnum["nan"] = "nan";
  27180. TypeEnum["reactNode"] = "react_node";
  27181. })(TypeEnum || (TypeEnum = {}));
  27182. /**
  27183. * 判断对象类型
  27184. * @param object 对象
  27185. */
  27186. var variableTypeOf = function (object) {
  27187. var typeStr = Object.prototype.toString.call(object);
  27188. var typeName;
  27189. switch (("" + typeStr).toLowerCase()) {
  27190. case '[object string]':
  27191. typeName = TypeEnum.string;
  27192. break;
  27193. case '[object number]':
  27194. if (Number.isNaN(object)) {
  27195. return TypeEnum.nan;
  27196. }
  27197. typeName = TypeEnum.number;
  27198. break;
  27199. case '[object object]':
  27200. if (object.$$typeof && object.props) {
  27201. var type = variableTypeOf(object.$$typeof);
  27202. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27203. return TypeEnum.reactNode;
  27204. }
  27205. }
  27206. typeName = TypeEnum.object;
  27207. break;
  27208. case '[object array]':
  27209. typeName = TypeEnum.array;
  27210. break;
  27211. case '[object function]':
  27212. typeName = TypeEnum.function;
  27213. break;
  27214. case '[object null]':
  27215. typeName = TypeEnum.null;
  27216. break;
  27217. case '[object boolean]':
  27218. typeName = TypeEnum.boolean;
  27219. break;
  27220. case '[object date]':
  27221. typeName = TypeEnum.date;
  27222. break;
  27223. // 不常用
  27224. case '[object symbol]':
  27225. typeName = TypeEnum.symbol;
  27226. break;
  27227. case '[object json]':
  27228. typeName = TypeEnum.json;
  27229. break;
  27230. case '[object math]':
  27231. typeName = TypeEnum.math;
  27232. break;
  27233. case '[object regexp]':
  27234. typeName = TypeEnum.regexp;
  27235. break;
  27236. // 貌似不会走的分支
  27237. case '[object undefined]':
  27238. typeName = TypeEnum.undefined;
  27239. break;
  27240. // 无法识别
  27241. default:
  27242. if (object === undefined) {
  27243. return TypeEnum.undefined;
  27244. }
  27245. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27246. typeName = TypeEnum.object;
  27247. }
  27248. return typeName;
  27249. };
  27250. //# sourceMappingURL=typeof.js.map
  27251. function initGroovyEditor () {
  27252. Ext.define('com.yvan.studio.GroovyEditor', {
  27253. extend: 'Ext.panel.Panel',
  27254. alias: 'widget.groovyeditor',
  27255. xtype: 'groovyeditor',
  27256. layout: 'fit',
  27257. border: false,
  27258. html: "<div class=\"editor\"/>",
  27259. config: {
  27260. value: ''
  27261. },
  27262. codeChange: undefined,
  27263. isChangeFromOuter: false,
  27264. getCode: function () {
  27265. if (this.editor) {
  27266. return this.editor.getValue();
  27267. }
  27268. else {
  27269. return this.code;
  27270. }
  27271. },
  27272. setCode: function (value) {
  27273. var _this = this;
  27274. this.code = value;
  27275. this.value = value;
  27276. _$2.defer(function () {
  27277. _this.isChangeFromOuter = true;
  27278. if (_this.editor) {
  27279. _this.editor.setValue(value);
  27280. }
  27281. });
  27282. },
  27283. applyPosition: function () {
  27284. var _this = this;
  27285. if (this.autoFocusMethod) {
  27286. if (this.editor) {
  27287. _$2.defer(function () {
  27288. if (_this.autoFocusStartLine) {
  27289. _this.editor.setPosition({
  27290. lineNumber: _this.autoFocusStartLine,
  27291. column: _this.autoFocusStartColumn
  27292. });
  27293. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27294. }
  27295. _this.editor.focus();
  27296. });
  27297. delete this.autoFocusMethod;
  27298. }
  27299. }
  27300. this.editor.layout();
  27301. },
  27302. getValue: function () {
  27303. return this.value;
  27304. },
  27305. setValue: function (value, fromEditor) {
  27306. var me = this;
  27307. if (me.value === value) {
  27308. // 值相等,不需要变化
  27309. return;
  27310. }
  27311. if (fromEditor !== true && me.editor) {
  27312. // 不是来源于编辑器的变化,才设置编辑器的值
  27313. me.editor.setValue(value);
  27314. }
  27315. // 通知mixins setValue
  27316. me.value = value;
  27317. me.fireEvent('change', value);
  27318. },
  27319. initComponent: function () {
  27320. var that = this;
  27321. this.superclass.initComponent.call(this, arguments);
  27322. that.on({
  27323. resize: function () {
  27324. if (that.editor) {
  27325. that.editor.layout();
  27326. }
  27327. },
  27328. destory: function () {
  27329. if (that.editor) {
  27330. that.editor.dispose();
  27331. delete that.editor;
  27332. }
  27333. },
  27334. afterrender: function (sender) {
  27335. var $dom = $(that.el.dom).find('.editor');
  27336. attach_3($dom[0], {
  27337. value: that.code
  27338. }).then(function (editor) {
  27339. that.editor = editor;
  27340. that.applyPosition();
  27341. that.editor.onDidChangeModelContent(function (e) {
  27342. that.fireEvent('change', that.editor, e);
  27343. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27344. that.codeChange(that.editor.getValue(), that.name, e);
  27345. }
  27346. that.isChangeFromOuter = false;
  27347. });
  27348. });
  27349. }
  27350. });
  27351. }
  27352. });
  27353. }
  27354. function attach_3(element, opts) {
  27355. return new Promise(function (resolve) {
  27356. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27357. enabled: false
  27358. } }));
  27359. editor.onKeyUp(function (e) {
  27360. // console.log(e)
  27361. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27362. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27363. }
  27364. });
  27365. resolve(editor);
  27366. });
  27367. }
  27368. //# sourceMappingURL=GroovyEditor.js.map
  27369. function initJsEditor$1 () {
  27370. Ext.define('com.yvan.studio.JsEditor', {
  27371. extend: 'Ext.panel.Panel',
  27372. alias: 'widget.jseditor',
  27373. xtype: 'jseditor',
  27374. layout: 'fit',
  27375. border: false,
  27376. html: "<div class=\"editor\"/>",
  27377. autoFocusMethod: true,
  27378. autoFocusStartLine: 0,
  27379. autoFocusStartColumn: 0,
  27380. codeChange: undefined,
  27381. funcArr: [],
  27382. modulePage: null,
  27383. isChangeFromOuter: false,
  27384. name: "",
  27385. /**
  27386. * 设置代码
  27387. */
  27388. setCode: function (value) {
  27389. var _this = this;
  27390. this.code = value;
  27391. _$2.defer(function () {
  27392. _this.isChangeFromOuter = true;
  27393. if (_this.editor) {
  27394. _this.editor.setValue(value);
  27395. if (_this.name === "controllerEditor") {
  27396. _this.funcArr = _this.getAllFunction();
  27397. }
  27398. }
  27399. });
  27400. },
  27401. getCode: function () {
  27402. var _a;
  27403. if (!this.editor) {
  27404. return this.code;
  27405. }
  27406. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27407. },
  27408. applyPosition: function () {
  27409. var _this = this;
  27410. if (this.autoFocusMethod) {
  27411. if (this.editor) {
  27412. _$2.defer(function () {
  27413. if (_this.autoFocusStartLine) {
  27414. _this.editor.setPosition({
  27415. lineNumber: _this.autoFocusStartLine,
  27416. column: _this.autoFocusStartColumn
  27417. });
  27418. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27419. }
  27420. _this.editor.focus();
  27421. });
  27422. delete this.autoFocusMethod;
  27423. }
  27424. }
  27425. this.editor.layout();
  27426. },
  27427. initComponent: function () {
  27428. var that = this;
  27429. this.superclass.initComponent.apply(this, arguments);
  27430. this.on({
  27431. resize: function (sender, width, height) {
  27432. if (that.editor) {
  27433. that.editor.layout();
  27434. }
  27435. },
  27436. destory: function () {
  27437. if (that.editor) {
  27438. that.editor.dispose();
  27439. delete that.editor;
  27440. }
  27441. },
  27442. afterrender: function () {
  27443. var $dom = $(that.el.dom).find('.editor');
  27444. attach_1($dom[0], {
  27445. value: that.code
  27446. }).then(function (editor) {
  27447. that.editor = editor;
  27448. that.applyPosition();
  27449. that.editor.onDidChangeModelContent(function (e) {
  27450. that.fireEvent('change', that.editor, e);
  27451. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27452. that.codeChange(that.editor.getValue(), that.name, e);
  27453. }
  27454. that.isChangeFromOuter = false;
  27455. });
  27456. });
  27457. }
  27458. });
  27459. },
  27460. getAllFunction: function () {
  27461. var funcArr = [];
  27462. var ast = window['YvanUI'].recast.parse(this.code);
  27463. if (ast && ast.program && ast.program.body) {
  27464. if (Array.isArray(ast.program.body)) {
  27465. for (var i = 0; i < ast.program.body.length; i++) {
  27466. var m = ast.program.body[i];
  27467. if (m.type === "ExportDefaultDeclaration") {
  27468. if (m.declaration.type === "ClassDeclaration") {
  27469. if (m.declaration.body.type === "ClassBody") {
  27470. if (Array.isArray(m.declaration.body.body)) {
  27471. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27472. var ob = m.declaration.body.body[j];
  27473. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27474. var funcItem = { name: ob.key.name, args: [] };
  27475. if (Array.isArray(ob.value.params)) {
  27476. for (var k = 0; k < ob.value.params.length; k++) {
  27477. var p = ob.value.params[k];
  27478. funcItem.args.push(p.name);
  27479. }
  27480. }
  27481. funcArr.push(funcItem);
  27482. }
  27483. }
  27484. }
  27485. }
  27486. }
  27487. }
  27488. }
  27489. }
  27490. }
  27491. return funcArr;
  27492. }
  27493. });
  27494. }
  27495. var isInited = false;
  27496. function attach_1(element, opts) {
  27497. return new Promise(function (resolve) {
  27498. var monaco = window['monaco'];
  27499. if (!isInited) {
  27500. isInited = true;
  27501. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27502. noSemanticValidation: true,
  27503. noSyntaxValidation: false
  27504. });
  27505. // compiler options
  27506. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27507. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27508. allowNonTsExtensions: true,
  27509. });
  27510. // extra libraries
  27511. var libSource = [
  27512. 'declare class Facts {',
  27513. ' /**',
  27514. ' * Returns the next fact',
  27515. ' */',
  27516. ' static next():string',
  27517. ' static next222():string',
  27518. '}',
  27519. "\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 ",
  27520. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27521. ].join('\n');
  27522. var libUri = 'file:///index.d.ts';
  27523. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27524. // When resolving definitions and references, the editor will try to use created models.
  27525. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27526. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27527. }
  27528. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27529. resolve(editor);
  27530. });
  27531. }
  27532. //# sourceMappingURL=JsEditor.js.map
  27533. function initJsonEditor$1 () {
  27534. Ext.define('com.yvan.studio.JsonEditor', {
  27535. extend: 'Ext.panel.Panel',
  27536. alias: 'widget.jsoneditor',
  27537. xtype: 'jsoneditor',
  27538. layout: 'fit',
  27539. border: false,
  27540. html: "<div class=\"editor\"/>",
  27541. autoFocusMethod: true,
  27542. autoFocusStartLine: 0,
  27543. autoFocusStartColumn: 0,
  27544. codeChange: undefined,
  27545. funcArr: [],
  27546. modulePage: null,
  27547. isChangeFromOuter: false,
  27548. name: "",
  27549. /**
  27550. * 设置代码
  27551. */
  27552. setCode: function (value) {
  27553. var _this = this;
  27554. this.code = value;
  27555. _$2.defer(function () {
  27556. _this.isChangeFromOuter = true;
  27557. if (_this.editor) {
  27558. _this.editor.setValue(value);
  27559. }
  27560. });
  27561. },
  27562. updateOptions: function (options) {
  27563. if (this.editor && options) {
  27564. this.editor.updateOptions(options);
  27565. }
  27566. },
  27567. setLanguage: function (lang) {
  27568. if (this.editor && lang) {
  27569. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27570. }
  27571. },
  27572. getCode: function () {
  27573. var _a;
  27574. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27575. },
  27576. applyPosition: function () {
  27577. var _this = this;
  27578. if (this.autoFocusMethod) {
  27579. if (this.editor) {
  27580. _$2.defer(function () {
  27581. if (_this.autoFocusStartLine) {
  27582. _this.editor.setPosition({
  27583. lineNumber: _this.autoFocusStartLine,
  27584. column: _this.autoFocusStartColumn
  27585. });
  27586. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27587. }
  27588. _this.editor.focus();
  27589. });
  27590. delete this.autoFocusMethod;
  27591. }
  27592. }
  27593. this.editor.layout();
  27594. },
  27595. initComponent: function () {
  27596. var that = this;
  27597. this.superclass.initComponent.apply(this, arguments);
  27598. this.on({
  27599. resize: function (sender, width, height) {
  27600. if (that.editor) {
  27601. that.editor.layout();
  27602. }
  27603. },
  27604. destory: function () {
  27605. if (that.editor) {
  27606. that.editor.dispose();
  27607. delete that.editor;
  27608. }
  27609. },
  27610. afterrender: function (sender) {
  27611. var $dom = $(that.el.dom).find('.editor');
  27612. attach_116($dom[0], {
  27613. value: that.code
  27614. }).then(function (editor) {
  27615. that.editor = editor;
  27616. that.applyPosition();
  27617. that.editor.onDidChangeModelContent(function (e) {
  27618. that.fireEvent('change', that.editor, e);
  27619. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27620. that.codeChange(that.editor.getValue(), that.name, e);
  27621. }
  27622. that.isChangeFromOuter = false;
  27623. });
  27624. });
  27625. }
  27626. });
  27627. },
  27628. });
  27629. }
  27630. function attach_116(element, opts) {
  27631. return new Promise(function (resolve) {
  27632. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27633. enabled: false
  27634. } }));
  27635. editor.onKeyUp(function (e) {
  27636. // console.log(e)
  27637. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27638. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27639. }
  27640. });
  27641. resolve(editor);
  27642. });
  27643. }
  27644. //# sourceMappingURL=JsonEditor.js.map
  27645. function initSqlEditor$1 () {
  27646. Ext.define('com.yvan.studio.SqlEditor', {
  27647. extend: 'Ext.panel.Panel',
  27648. alias: 'widget.sqleditor',
  27649. xtype: 'sqleditor',
  27650. layout: 'fit',
  27651. border: false,
  27652. html: "<div class=\"editor\"/>",
  27653. config: {
  27654. value: ''
  27655. },
  27656. codeChange: undefined,
  27657. isChangeFromOuter: false,
  27658. setCode: function (value) {
  27659. var _this = this;
  27660. this.code = value;
  27661. this.value = value;
  27662. _$2.defer(function () {
  27663. _this.isChangeFromOuter = true;
  27664. if (_this.editor) {
  27665. _this.editor.setValue(value);
  27666. }
  27667. });
  27668. },
  27669. getCode: function () {
  27670. return this.getValue();
  27671. },
  27672. updateOptions: function (options) {
  27673. if (this.editor && options) {
  27674. this.editor.updateOptions(options);
  27675. }
  27676. },
  27677. getValue: function () {
  27678. if (!this.editor) {
  27679. return this.code;
  27680. }
  27681. return this.editor.getValue();
  27682. },
  27683. applyPosition: function () {
  27684. var _this = this;
  27685. if (this.autoFocusMethod) {
  27686. if (this.editor) {
  27687. _$2.defer(function () {
  27688. if (_this.autoFocusStartLine) {
  27689. _this.editor.setPosition({
  27690. lineNumber: _this.autoFocusStartLine,
  27691. column: _this.autoFocusStartColumn
  27692. });
  27693. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27694. }
  27695. _this.editor.focus();
  27696. });
  27697. delete this.autoFocusMethod;
  27698. }
  27699. }
  27700. this.editor.layout();
  27701. },
  27702. setValue: function (value, fromEditor) {
  27703. this.setCode(value);
  27704. var me = this;
  27705. if (me.value === value) {
  27706. // 值相等,不需要变化
  27707. return;
  27708. }
  27709. if (fromEditor !== true && me.editor) {
  27710. // 不是来源于编辑器的变化,才设置编辑器的值
  27711. me.editor.setValue(value);
  27712. }
  27713. // 通知mixins setValue
  27714. me.value = value;
  27715. me.fireEvent('change', value);
  27716. },
  27717. initComponent: function () {
  27718. var that = this;
  27719. this.superclass.initComponent.call(this);
  27720. that.on({
  27721. resize: function () {
  27722. if (that.editor) {
  27723. that.editor.layout();
  27724. }
  27725. },
  27726. destory: function () {
  27727. if (that.editor) {
  27728. that.editor.dispose();
  27729. delete that.editor;
  27730. }
  27731. },
  27732. afterrender: function (sender) {
  27733. var $dom = $(that.el.dom).find('.editor');
  27734. attach_2($dom[0], {
  27735. value: that.code
  27736. }).then(function (editor) {
  27737. that.editor = editor;
  27738. that.applyPosition();
  27739. that.editor.onDidChangeModelContent(function (e) {
  27740. that.fireEvent('change', that.editor, e);
  27741. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27742. that.codeChange(that.editor.getValue(), that.name, e);
  27743. }
  27744. that.isChangeFromOuter = false;
  27745. });
  27746. });
  27747. }
  27748. });
  27749. }
  27750. });
  27751. }
  27752. function attach_2(element, opts) {
  27753. return new Promise(function (resolve) {
  27754. var monaco = window['monaco'];
  27755. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27756. enabled: false
  27757. } }));
  27758. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27759. // const sql = editor.getValue()
  27760. // if (_.trim(sql).length > 0) {
  27761. // editor.setValue(format(sql, {
  27762. // indent: ' ',
  27763. // uppercase: true,
  27764. // }))
  27765. // }
  27766. msg$1('没做');
  27767. });
  27768. editor.onKeyUp(function (e) {
  27769. // console.log(e)
  27770. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27771. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27772. }
  27773. });
  27774. resolve(editor);
  27775. });
  27776. }
  27777. //# sourceMappingURL=SqlEditor.js.map
  27778. function initTemplateEditor () {
  27779. Ext.define('com.yvan.studio.TemplateEditor', {
  27780. extend: 'Ext.panel.Panel',
  27781. alias: 'widget.templateeditor',
  27782. xtype: 'templateeditor',
  27783. layout: 'fit',
  27784. border: false,
  27785. html: "<div class=\"editor\"/>",
  27786. autoFocusMethod: true,
  27787. autoFocusStartLine: 0,
  27788. autoFocusStartColumn: 0,
  27789. codeChange: undefined,
  27790. funcArr: [],
  27791. modulePage: null,
  27792. isChangeFromOuter: false,
  27793. name: "",
  27794. /**
  27795. * 设置代码
  27796. */
  27797. setCode: function (value) {
  27798. var _this = this;
  27799. this.code = value;
  27800. _$2.defer(function () {
  27801. _this.isChangeFromOuter = true;
  27802. if (_this.editor) {
  27803. _this.editor.setValue(value);
  27804. }
  27805. });
  27806. },
  27807. getCode: function () {
  27808. var _a;
  27809. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27810. },
  27811. applyPosition: function () {
  27812. var _this = this;
  27813. if (this.autoFocusMethod) {
  27814. if (this.editor) {
  27815. _$2.defer(function () {
  27816. if (_this.autoFocusStartLine) {
  27817. _this.editor.setPosition({
  27818. lineNumber: _this.autoFocusStartLine,
  27819. column: _this.autoFocusStartColumn
  27820. });
  27821. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27822. }
  27823. _this.editor.focus();
  27824. });
  27825. delete this.autoFocusMethod;
  27826. }
  27827. }
  27828. this.editor.layout();
  27829. },
  27830. initComponent: function () {
  27831. var that = this;
  27832. this.superclass.initComponent.apply(this, arguments);
  27833. this.on({
  27834. resize: function (sender, width, height) {
  27835. if (that.editor) {
  27836. that.editor.layout();
  27837. }
  27838. },
  27839. destory: function () {
  27840. if (that.editor) {
  27841. that.editor.dispose();
  27842. delete that.editor;
  27843. }
  27844. },
  27845. afterrender: function (sender) {
  27846. var $dom = $(that.el.dom).find('.editor');
  27847. attach_117($dom[0], {
  27848. value: that.code
  27849. }).then(function (editor) {
  27850. that.editor = editor;
  27851. that.applyPosition();
  27852. that.editor.onDidChangeModelContent(function (e) {
  27853. that.fireEvent('change', that.editor, e);
  27854. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27855. that.codeChange(that.editor.getValue(), that.name, e);
  27856. }
  27857. that.isChangeFromOuter = false;
  27858. });
  27859. });
  27860. }
  27861. });
  27862. },
  27863. });
  27864. }
  27865. function attach_117(element, opts) {
  27866. return new Promise(function (resolve) {
  27867. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27868. enabled: false
  27869. } }));
  27870. editor.onKeyUp(function (e) {
  27871. // console.log(e)
  27872. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27873. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27874. }
  27875. });
  27876. resolve(editor);
  27877. });
  27878. }
  27879. //# sourceMappingURL=TemplateEditor.js.map
  27880. var DictStore = /** @class */ (function (_super) {
  27881. __extends(DictStore, _super);
  27882. function DictStore() {
  27883. return _super !== null && _super.apply(this, arguments) || this;
  27884. }
  27885. DictStore.prototype.getCacheKey = function (param) {
  27886. return "dict_data.json";
  27887. };
  27888. DictStore.prototype.invokeApi = function (param) {
  27889. return getDict(param);
  27890. };
  27891. DictStore.prototype.getDicts = function () {
  27892. return this.apiResponse.data.dict;
  27893. };
  27894. DictStore.prototype.getDictCodes = function () {
  27895. return new Promise(function (resolve) {
  27896. // reloadIfNeedPromise().then(() => {
  27897. // const result = []
  27898. // _.forEach(this.getDicts(), dictRow => {
  27899. // result.push({
  27900. // id: dictRow.dict_code,
  27901. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27902. // })
  27903. // })
  27904. // resolve(result)
  27905. // })
  27906. });
  27907. };
  27908. DictStore.prototype.saveDict = function (param) {
  27909. return saveDictApi(param);
  27910. };
  27911. DictStore.prototype.saveDictItems = function (param) {
  27912. return saveDictItemsApi(param);
  27913. };
  27914. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27915. var results = [];
  27916. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27917. if (dictItemRow.dict_code === dict_code) {
  27918. results.push(_$2.clone(dictItemRow));
  27919. }
  27920. });
  27921. return results;
  27922. };
  27923. return DictStore;
  27924. }(CacheStore));
  27925. var instance$2 = new DictStore();
  27926. //# sourceMappingURL=DictStore.js.map
  27927. var DictTreeController = /** @class */ (function () {
  27928. function DictTreeController() {
  27929. this._saveStateFlag = true;
  27930. }
  27931. DictTreeController.prototype.dictSave = function () {
  27932. var _this = this;
  27933. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27934. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27935. if (err) {
  27936. // 如果有异常就不保存
  27937. return;
  27938. }
  27939. // 进行业务上的逻辑校验,比如说必填校验等等
  27940. var hasError = false;
  27941. _$2.forEach(rows, function (row, i) {
  27942. if (isEmpty(row.dict_code)) {
  27943. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27944. hasError = true;
  27945. return false;
  27946. }
  27947. });
  27948. if (hasError) {
  27949. return;
  27950. }
  27951. // 设置当前界面为 "保存中..." 状态
  27952. this.view.setLoading(true);
  27953. instance$2.saveDict({
  27954. newRows: newRows,
  27955. modifyRows: modifyRows,
  27956. removeRecords: removeRecords,
  27957. }).then(function (res) {
  27958. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27959. msg$1(res.msg);
  27960. _this.reload();
  27961. }).finally(function () {
  27962. // 无论正常异常,关闭 "保存中..." 状态
  27963. _this.view.setLoading(false);
  27964. });
  27965. };
  27966. DictTreeController.prototype.dictItemSave = function () {
  27967. var _this = this;
  27968. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27969. var currentDictCode = undefined;
  27970. if (record) {
  27971. currentDictCode = record.get('dict_code');
  27972. }
  27973. if (!currentDictCode) {
  27974. msg$1('请选择一个字典');
  27975. return;
  27976. }
  27977. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27978. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27979. if (err) {
  27980. // 如果有异常就不保存
  27981. return;
  27982. }
  27983. // 进行业务上的逻辑校验,比如说必填校验等等
  27984. var hasError = false;
  27985. _$2.forEach(rows, function (row, i) {
  27986. if (!row.dict_value && row.dict_value !== 0) {
  27987. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27988. hasError = true;
  27989. return false;
  27990. }
  27991. });
  27992. if (hasError) {
  27993. return;
  27994. }
  27995. // 设置当前界面为 "保存中..." 状态
  27996. this.view.setLoading(true);
  27997. instance$2.saveDictItems({
  27998. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27999. newRows: newRows,
  28000. modifyRows: modifyRows,
  28001. removeRecords: removeRecords,
  28002. dict_code: currentDictCode
  28003. }).then(function (res) {
  28004. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28005. msg$1(res.msg);
  28006. _this.reload();
  28007. }).finally(function () {
  28008. // 无论正常异常,关闭 "保存中..." 状态
  28009. _this.view.setLoading(false);
  28010. });
  28011. };
  28012. DictTreeController.prototype.createDictEnum = function () {
  28013. var _this = this;
  28014. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28015. var currentDictCode = undefined;
  28016. if (record) {
  28017. currentDictCode = record.get('dict_code');
  28018. }
  28019. if (!currentDictCode) {
  28020. msg$1('请选择一个字典');
  28021. return;
  28022. }
  28023. // 设置当前界面为 "保存中..." 状态
  28024. this.view.setLoading(true);
  28025. createDictEnum({ dictCode: currentDictCode })
  28026. .then(function () { return _this.reload(); })
  28027. .finally(function () { return _this.view.setLoading(false); });
  28028. };
  28029. DictTreeController.prototype.onLoad = function () {
  28030. setDictTree(this);
  28031. this.grid1 = this.view.lookupReference('grid1');
  28032. this.grid2 = this.view.lookupReference('grid2');
  28033. this.grid1.setData([]);
  28034. this.grid2.setData([]);
  28035. // this.grid1.columns[0].hide()
  28036. this.grid2.columns[0].hide();
  28037. // 找管理器订阅刷新的事件
  28038. instance$2.registe(this.refreshData.bind(this));
  28039. // 非强制性刷新 DbManager
  28040. instance$2.reloadIfNeed(undefined);
  28041. };
  28042. DictTreeController.prototype.onDestory = function () {
  28043. instance$2.unregiste(this.refreshData.bind(this));
  28044. };
  28045. // dictStore 刷新时,会回调到这个方法
  28046. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28047. var me = this;
  28048. if (typeof isLoadingState === 'boolean') {
  28049. me.view.setLoading(isLoadingState);
  28050. return;
  28051. }
  28052. this.grid1.setData(instance$2.getDicts());
  28053. this.restoreState();
  28054. };
  28055. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28056. var _this = this;
  28057. _$2.defer(function () {
  28058. _this.saveState();
  28059. });
  28060. if (!record) {
  28061. this.grid2.setData([]);
  28062. return;
  28063. }
  28064. var dict_code = record.get('dict_code');
  28065. var data = instance$2.getDictItemByDictcode(dict_code);
  28066. this.grid2.setData(data);
  28067. };
  28068. DictTreeController.prototype.reload = function () {
  28069. var _this = this;
  28070. // 强制刷新 DbManager
  28071. instance$2.reloadForce(undefined).then(function (res) {
  28072. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28073. });
  28074. };
  28075. DictTreeController.prototype.dictAdd = function () {
  28076. this.grid1.appendEditRow({
  28077. _createFlag: true,
  28078. dict_code: '',
  28079. dict_desc: '',
  28080. }, 0);
  28081. };
  28082. DictTreeController.prototype.dictRemove = function () {
  28083. this.grid1.removeEditRow();
  28084. };
  28085. DictTreeController.prototype.dictItemAdd = function () {
  28086. var _a, _b;
  28087. 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;
  28088. if (!dict_code) {
  28089. msg$1('请先保存字典');
  28090. return;
  28091. }
  28092. this.grid2.appendEditRow({
  28093. dict_code: dict_code,
  28094. dict_text: '',
  28095. dict_value: '',
  28096. }, 0);
  28097. };
  28098. DictTreeController.prototype.dictItemRemove = function () {
  28099. var _this = this;
  28100. var rows = [];
  28101. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28102. rows.push(r);
  28103. });
  28104. _$2.forEach(rows, function (r) {
  28105. _this.grid2.getStore().remove(r);
  28106. });
  28107. };
  28108. DictTreeController.prototype.clearSearch1 = function () {
  28109. this.grid1.store.clearFilter();
  28110. };
  28111. DictTreeController.prototype.search1 = function (sender) {
  28112. this.grid1.store.clearFilter();
  28113. this.getViewModel().set('grid1.selection', null);
  28114. this.grid1.fireEvent('itemselect');
  28115. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28116. if (!value) {
  28117. return;
  28118. }
  28119. this.grid1.store.filterBy(function (record) {
  28120. if (record.get('_createFlag')) {
  28121. return true;
  28122. }
  28123. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28124. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28125. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28126. return (dict_code.includes(value) ||
  28127. dict_desc.includes(value) ||
  28128. dict_desc_py.includes(value));
  28129. });
  28130. };
  28131. DictTreeController.prototype.clearSearch2 = function () {
  28132. this.grid2.store.clearFilter();
  28133. };
  28134. DictTreeController.prototype.search2 = function (sender) {
  28135. this.grid2.store.clearFilter();
  28136. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28137. if (!value) {
  28138. return;
  28139. }
  28140. this.grid2.store.filterBy(function (record) {
  28141. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28142. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28143. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28144. return (dict_text.includes(value) ||
  28145. dict_value === value ||
  28146. dict_text_py.includes(value));
  28147. });
  28148. };
  28149. DictTreeController.prototype.getStateFilename = function () {
  28150. return getCurrentProject().uuid + "/dicttree.json";
  28151. };
  28152. DictTreeController.prototype.restoreState = function () {
  28153. var _this = this;
  28154. var grid = this.grid1;
  28155. native.loadFile(this.getStateFilename(), function (content) {
  28156. if (!content)
  28157. return;
  28158. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28159. _this._saveStateFlag = false;
  28160. if (selection) {
  28161. var idx = grid.store.findExact('dict_code', selection);
  28162. if (idx >= 0) {
  28163. var record = grid.store.getAt(idx);
  28164. if (record) {
  28165. grid.setSelection([record]);
  28166. }
  28167. }
  28168. }
  28169. if (scrollPosition && scrollSize) {
  28170. var size = grid.scrollable.getSize();
  28171. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28172. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28173. }
  28174. }
  28175. setTimeout(function () {
  28176. _this._saveStateFlag = true;
  28177. }, 200);
  28178. });
  28179. };
  28180. DictTreeController.prototype.saveState = function () {
  28181. if (!this._saveStateFlag) {
  28182. return;
  28183. }
  28184. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28185. var selection = undefined;
  28186. if (record) {
  28187. selection = record.get('dict_code');
  28188. }
  28189. var scrollPosition = this.grid1.scrollable.position;
  28190. var scrollSize = this.grid1.scrollable.getSize();
  28191. native.saveFile(this.getStateFilename(), {
  28192. selection: selection,
  28193. scrollPosition: scrollPosition,
  28194. scrollSize: scrollSize
  28195. });
  28196. };
  28197. return DictTreeController;
  28198. }());
  28199. //# sourceMappingURL=DictTreeController.js.map
  28200. function initDict$1 () {
  28201. var controller = new DictTreeController();
  28202. Ext.define('com.yvan.studio.DictTree', {
  28203. extend: 'Ext.panel.Panel',
  28204. xtype: 'dicttree',
  28205. controller: controller,
  28206. scope: controller,
  28207. referenceHolder: true,
  28208. tooltip: '字典',
  28209. iconCls: 'x-fa fa-book',
  28210. rootVisible: false,
  28211. useArrows: true,
  28212. reference: 'dicttree',
  28213. layout: 'border',
  28214. listeners: {
  28215. afterrender: 'onLoad',
  28216. destory: 'onDestory',
  28217. },
  28218. items: [
  28219. {
  28220. region: 'center',
  28221. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28222. _mode: 'select',
  28223. tbar: [
  28224. {
  28225. xtype: 'button',
  28226. tooltip: '刷新',
  28227. iconCls: 'x-fa fa-refresh',
  28228. listeners: {
  28229. click: 'reload'
  28230. }
  28231. },
  28232. {
  28233. xtype: 'button',
  28234. tooltip: '添加',
  28235. iconCls: 'x-fa fa-plus-circle',
  28236. listeners: {
  28237. click: 'dictAdd'
  28238. }
  28239. },
  28240. {
  28241. xtype: 'button',
  28242. tooltip: '删除',
  28243. iconCls: 'x-fa fa-minus-circle',
  28244. bind: {
  28245. disabled: '{!grid1.selection}'
  28246. },
  28247. listeners: {
  28248. click: 'dictRemove'
  28249. }
  28250. },
  28251. {
  28252. xtype: 'button',
  28253. tooltip: '保存',
  28254. iconCls: 'x-fa fa-save',
  28255. bind: {
  28256. disabled: '{!grid1.ischanged}'
  28257. },
  28258. listeners: {
  28259. click: 'dictSave'
  28260. }
  28261. },
  28262. {
  28263. xtype: 'textfield',
  28264. hideClear: true,
  28265. triggers: {
  28266. clear: {
  28267. cls: 'x-form-clear-trigger',
  28268. handler: 'clearSearch1'
  28269. },
  28270. },
  28271. flex: 1,
  28272. emptyText: '搜索过滤',
  28273. enableKeyEvents: true,
  28274. listeners: {
  28275. keyup: {
  28276. fn: 'search1',
  28277. buffer: 50
  28278. }
  28279. }
  28280. },
  28281. ],
  28282. listeners: {
  28283. itemselect: 'grid1Selected',
  28284. },
  28285. idField: 'dict_code',
  28286. columns: [
  28287. {
  28288. text: '字典编号', dataIndex: 'dict_code',
  28289. menuDisabled: true, flex: 1,
  28290. editor: {
  28291. allowBlank: true,
  28292. selectOnFocus: false
  28293. }
  28294. },
  28295. {
  28296. text: '中文描述', dataIndex: 'dict_desc',
  28297. menuDisabled: true, flex: 1,
  28298. editor: {
  28299. allowBlank: true,
  28300. selectOnFocus: false
  28301. }
  28302. },
  28303. ]
  28304. },
  28305. {
  28306. region: 'south', height: '50%',
  28307. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28308. split: true,
  28309. _mode: 'edit1',
  28310. listeners: {},
  28311. tbar: [
  28312. {
  28313. xtype: 'button',
  28314. tooltip: '添加',
  28315. iconCls: 'x-fa fa-plus-circle',
  28316. bind: {
  28317. disabled: '{!grid1.selection}'
  28318. },
  28319. listeners: {
  28320. click: 'dictItemAdd'
  28321. }
  28322. },
  28323. {
  28324. xtype: 'button',
  28325. tooltip: '删除',
  28326. iconCls: 'x-fa fa-minus-circle',
  28327. bind: {
  28328. disabled: '{!grid1.selection}'
  28329. },
  28330. listeners: {
  28331. click: 'dictItemRemove'
  28332. }
  28333. },
  28334. {
  28335. xtype: 'button',
  28336. tooltip: '保存',
  28337. iconCls: 'x-fa fa-save',
  28338. bind: {
  28339. disabled: '{!grid2.ischanged}'
  28340. },
  28341. listeners: {
  28342. click: 'dictItemSave'
  28343. }
  28344. },
  28345. {
  28346. xtype: 'button',
  28347. tooltip: '刷新代码',
  28348. iconCls: 'x-fa fa-code',
  28349. bind: {
  28350. disabled: '{!grid1.selection}'
  28351. },
  28352. listeners: {
  28353. click: 'createDictEnum'
  28354. }
  28355. },
  28356. ],
  28357. columns: [
  28358. {
  28359. text: '字典项', dataIndex: 'dict_text',
  28360. menuDisabled: true, flex: 1,
  28361. editor: {
  28362. allowBlank: true,
  28363. selectOnFocus: false
  28364. }
  28365. },
  28366. {
  28367. text: '字典值', dataIndex: 'dict_value',
  28368. menuDisabled: true, flex: 1,
  28369. dataType: 'int',
  28370. editor: {
  28371. xtype: 'numberfield',
  28372. allowBlank: true,
  28373. selectOnFocus: false
  28374. }
  28375. },
  28376. {
  28377. text: '激活', dataIndex: 'is_enable',
  28378. xtype: 'checkcolumn', menuDisabled: true,
  28379. },
  28380. {
  28381. text: '变量名', dataIndex: 'var_name',
  28382. menuDisabled: true, flex: 1,
  28383. editor: {
  28384. allowBlank: true,
  28385. selectOnFocus: false
  28386. }
  28387. },
  28388. ]
  28389. }
  28390. ]
  28391. });
  28392. }
  28393. //# sourceMappingURL=DictTree.js.map
  28394. var model$g = {
  28395. data: {
  28396. form: {
  28397. path: "",
  28398. requestBody: "",
  28399. responseBody: "",
  28400. }
  28401. }
  28402. };
  28403. var vjson$f = {
  28404. title: '接口信息',
  28405. layout: 'fit',
  28406. width: 800,
  28407. height: 500,
  28408. items: [
  28409. {
  28410. xtype: 'form',
  28411. layout: {
  28412. type: 'vbox',
  28413. pack: 'start',
  28414. align: 'stretch'
  28415. },
  28416. defaults: {
  28417. border: false,
  28418. anchor: '100%',
  28419. margin: '5',
  28420. },
  28421. items: [
  28422. {
  28423. xtype: 'textfield',
  28424. fieldLabel: '接口路径',
  28425. bind: {
  28426. value: "{form.path}",
  28427. },
  28428. },
  28429. {
  28430. xtype: 'textareafield',
  28431. // height: 150,
  28432. flex: 2,
  28433. fieldLabel: '请求数据',
  28434. bind: {
  28435. value: "{form.requestBody}",
  28436. },
  28437. },
  28438. {
  28439. xtype: 'textareafield',
  28440. // height: 150,
  28441. flex: 5,
  28442. fieldLabel: '响应数据',
  28443. bind: {
  28444. value: "{form.responseBody}",
  28445. },
  28446. },
  28447. ]
  28448. }
  28449. ]
  28450. };
  28451. var ApiInfoDialog = /** @class */ (function (_super) {
  28452. __extends(ApiInfoDialog, _super);
  28453. function ApiInfoDialog() {
  28454. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28455. }
  28456. return ApiInfoDialog;
  28457. }(Scope));
  28458. //# sourceMappingURL=apiInfoDialog.js.map
  28459. var model$h = {
  28460. data: {
  28461. query: {
  28462. role_id: '',
  28463. resource_id: '',
  28464. },
  28465. form: {},
  28466. form2: {
  28467. key: "",
  28468. start_at: "",
  28469. end_at: "",
  28470. }
  28471. }
  28472. };
  28473. var vjson$g = {
  28474. title: '接口信息',
  28475. layout: 'fit',
  28476. items: [
  28477. {
  28478. layout: 'border',
  28479. border: false,
  28480. items: [
  28481. {
  28482. region: 'center',
  28483. layout: 'border',
  28484. items: [
  28485. {
  28486. region: 'north',
  28487. bind: {
  28488. title: '{form.title}',
  28489. },
  28490. xtype: 'form',
  28491. scrollable: true,
  28492. layout: {
  28493. type: 'vbox',
  28494. pack: 'start',
  28495. align: 'stretch'
  28496. },
  28497. defaults: {
  28498. border: false,
  28499. anchor: '100%',
  28500. margin: '5',
  28501. },
  28502. tbar: {
  28503. xtype: 'toolbar',
  28504. items: [
  28505. {
  28506. xtype: 'button',
  28507. text: '查询',
  28508. iconCls: 'x-fa fa-search',
  28509. listeners: {
  28510. click: 'scope.requestLogs'
  28511. },
  28512. },
  28513. {
  28514. xtype: 'button',
  28515. text: '保存',
  28516. iconCls: 'x-fa fa-save',
  28517. listeners: {},
  28518. },
  28519. {
  28520. xtype: 'button',
  28521. text: '禁用',
  28522. iconCls: 'x-fa fa-stop-circle',
  28523. bind: {},
  28524. listeners: {},
  28525. },
  28526. {
  28527. xtype: 'button',
  28528. text: '启用',
  28529. iconCls: 'x-fa fa-play-circle',
  28530. bind: {},
  28531. listeners: {},
  28532. },
  28533. ],
  28534. },
  28535. items: [
  28536. {
  28537. xtype: 'cols',
  28538. defaults: { labelWidth: 120 },
  28539. items: [
  28540. {
  28541. xtype: 'textfield',
  28542. fieldLabel: 'URL',
  28543. bind: {
  28544. value: '{form.api_url}',
  28545. },
  28546. readOnly: true,
  28547. },
  28548. {
  28549. xtype: 'textfield',
  28550. fieldLabel: '名称',
  28551. bind: {
  28552. value: '{form.api_name}',
  28553. },
  28554. readOnly: true,
  28555. },
  28556. ],
  28557. },
  28558. {
  28559. xtype: 'cols',
  28560. defaults: { labelWidth: 120 },
  28561. items: [
  28562. {
  28563. xtype: 'textfield',
  28564. fieldLabel: '实现类',
  28565. bind: {
  28566. value: '{form.api_class}',
  28567. },
  28568. readOnly: true,
  28569. },
  28570. {
  28571. border: false,
  28572. flex: 1
  28573. },
  28574. ]
  28575. },
  28576. {
  28577. xtype: 'cols',
  28578. defaults: { labelWidth: 120 },
  28579. items: [
  28580. {
  28581. xtype: 'textfield',
  28582. fieldLabel: '超时时间',
  28583. bind: {
  28584. value: '{form.timeout}',
  28585. },
  28586. readOnly: true,
  28587. },
  28588. {
  28589. border: false,
  28590. flex: 1
  28591. },
  28592. ]
  28593. },
  28594. {
  28595. xtype: 'cols',
  28596. defaults: { labelWidth: 120 },
  28597. items: [
  28598. {
  28599. xtype: 'textfield',
  28600. fieldLabel: 'Remote IP',
  28601. bind: {
  28602. value: '{form.remote_ip}',
  28603. },
  28604. readOnly: true,
  28605. },
  28606. {
  28607. border: false,
  28608. flex: 1
  28609. },
  28610. ]
  28611. },
  28612. {
  28613. xtype: 'cols',
  28614. defaults: { labelWidth: 120 },
  28615. items: [
  28616. {
  28617. xtype: 'textfield',
  28618. fieldLabel: '解析表单',
  28619. bind: {
  28620. value: '{form.chandi}',
  28621. },
  28622. readOnly: true,
  28623. },
  28624. {
  28625. border: false,
  28626. flex: 1
  28627. },
  28628. ]
  28629. },
  28630. ],
  28631. },
  28632. {
  28633. region: 'center',
  28634. // title: 'Request',
  28635. layout: 'border',
  28636. items: [
  28637. {
  28638. region: 'north',
  28639. xtype: 'form',
  28640. reference: 'form2',
  28641. split: true,
  28642. items: [
  28643. {
  28644. xtype: 'cols',
  28645. width: 700,
  28646. items: [
  28647. {
  28648. xtype: 'textfield',
  28649. fieldLabel: '关键字',
  28650. bind: {
  28651. value: "{form2.key}"
  28652. },
  28653. },
  28654. {
  28655. xtype: 'datefield',
  28656. fieldLabel: '开始时间',
  28657. bind: {
  28658. value: "{form2.start_at}"
  28659. },
  28660. },
  28661. {
  28662. xtype: 'datefield',
  28663. fieldLabel: '结束时间',
  28664. bind: {
  28665. value: "{form2.end_at}"
  28666. },
  28667. },
  28668. ]
  28669. }
  28670. ]
  28671. },
  28672. {
  28673. region: 'center',
  28674. xtype: 'yvgrid',
  28675. layout: 'fit',
  28676. reference: 'grid1',
  28677. pagination: true,
  28678. autoLoad: false,
  28679. selModel: {
  28680. selType: 'rowmodel',
  28681. mode: 'SINGLE',
  28682. },
  28683. dataSource: {
  28684. method: 'invoke',
  28685. url: '/sys/api/Api@requestLogs',
  28686. params: {
  28687. formData: '{form2}',
  28688. path: '{form.api_url}',
  28689. },
  28690. },
  28691. listeners: {
  28692. rowdblclick: 'scope.showDialog',
  28693. },
  28694. columns: [
  28695. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28696. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28697. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28698. { dataIndex: "size", header: "大小", width: 80 },
  28699. { dataIndex: "path", header: "path", flex: 1 },
  28700. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28701. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28702. ]
  28703. }
  28704. ]
  28705. },
  28706. ],
  28707. },
  28708. ],
  28709. },
  28710. ],
  28711. referenceHolder: true,
  28712. };
  28713. var Api = /** @class */ (function (_super) {
  28714. __extends(Api, _super);
  28715. function Api() {
  28716. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28717. }
  28718. Api.prototype.onLoad = function () {
  28719. _super.prototype.onLoad.call(this);
  28720. this.requestLogs();
  28721. };
  28722. Api.prototype.selectList = function (sender, selected, eOpts) {
  28723. this.viewModel.set("form", selected.data);
  28724. if (selected.data.api_type === '1') {
  28725. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28726. }
  28727. else {
  28728. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28729. }
  28730. };
  28731. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28732. var sel = [];
  28733. _$2.forEach(records, function (item) {
  28734. if (item.data.flg === 'Y') {
  28735. sel.push(item);
  28736. }
  28737. });
  28738. this.refs.methodGrid.selModel.select(sel);
  28739. };
  28740. Api.prototype.saveAll = function () {
  28741. var _this = this;
  28742. var _a, _b, _c;
  28743. var role_id = this.viewModel.get("query.role_id");
  28744. if (!role_id) {
  28745. msg$1("请先选择一个角色");
  28746. return;
  28747. }
  28748. var wh_id = this.viewModel.get("form.wh_id");
  28749. if (!wh_id) {
  28750. msg$1("请先选择一个仓库");
  28751. return;
  28752. }
  28753. var menus = this.refs.theTree.getChecked();
  28754. var rowsMenus = [];
  28755. _$2.forEach(menus, function (m) {
  28756. if (m.data.resource_id) {
  28757. rowsMenus.push(m.data.resource_id);
  28758. }
  28759. });
  28760. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28761. 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; });
  28762. _$2.remove(mm, function (x) {
  28763. return methodsArry.includes(x.resource_id);
  28764. });
  28765. var rowsBtn = [];
  28766. _$2.forEach(mm, function (m) {
  28767. rowsBtn.push({ resource_id: m.resource_id });
  28768. });
  28769. this.setLoading(true);
  28770. invokeServer$1('/sys/role/Role@saveAll', {
  28771. wh_id: wh_id,
  28772. role_id: role_id,
  28773. rowsMenus: rowsMenus,
  28774. rowsBtn: rowsBtn,
  28775. }).then(function (res) {
  28776. msg$1(res.msg);
  28777. if (res.success) {
  28778. _this.reloadTree();
  28779. // this.viewModel.set('query.role_id', '')
  28780. _this.viewModel.set('query.resource_id', '');
  28781. _this.refs.methodGrid.reload();
  28782. }
  28783. }).finally(function () {
  28784. _this.setLoading(false);
  28785. });
  28786. };
  28787. Api.prototype.editRoleSuccess = function (sender, data) {
  28788. if (data.success) {
  28789. this.refs.roleGrid.reload();
  28790. this.viewModel.set("query.JIAOS_ID", "");
  28791. this.reloadTree();
  28792. this.viewModel.set("query.CAID_ID", "");
  28793. this.refs.methodGrid.reload();
  28794. }
  28795. };
  28796. Api.prototype.deleteRole = function (sender) {
  28797. var _this = this;
  28798. var role_id = this.viewModel.get("query.role_id");
  28799. if (!role_id) {
  28800. msg$1("请先选择一个角色");
  28801. return;
  28802. }
  28803. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28804. if (btn === 'yes') {
  28805. invokeServer$1('/sys/role/Role@deleteRole', {
  28806. role_id: role_id,
  28807. wh_id: window['whId']
  28808. }).then(function (res) {
  28809. msg$1(res.msg);
  28810. if (res.success) {
  28811. _this.refs.roleGrid.reload();
  28812. _this.viewModel.set("query.role_id", "");
  28813. _this.reloadTree();
  28814. _this.refs.methodGrid.reload();
  28815. }
  28816. });
  28817. }
  28818. });
  28819. };
  28820. Api.prototype.reloadTree = function () {
  28821. showErrorDialog$1('reloadTree 不存在');
  28822. };
  28823. Api.prototype.whChange = function (sender, value) {
  28824. this.viewModel.set("form.wh_id", value);
  28825. this.reloadTree();
  28826. this.refs.methodGrid.reload();
  28827. };
  28828. Api.prototype.requestLogs = function () {
  28829. var path = this.viewModel.get("form.api_url");
  28830. if (!path)
  28831. return;
  28832. this.refs.grid1.reload();
  28833. };
  28834. Api.prototype.showDialog = function (sender) {
  28835. var _a, _b;
  28836. 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; });
  28837. if (!rows || rows.length <= 0)
  28838. return;
  28839. var dialog = new ApiInfoDialog();
  28840. dialog.showDialog(null, {}, {
  28841. data: {
  28842. form: __assign({}, rows[0])
  28843. }
  28844. });
  28845. };
  28846. return Api;
  28847. }(Scope));
  28848. //# sourceMappingURL=ApiPage.js.map
  28849. var Controller = /** @class */ (function () {
  28850. function Controller() {
  28851. }
  28852. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28853. var _a, _b, _c, _d, _e, _f, _g, _h;
  28854. // @ts-ignore
  28855. 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; });
  28856. if (!rows || rows.length <= 0)
  28857. return;
  28858. var apiPage = new Api();
  28859. apiPage.showPage({
  28860. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28861. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28862. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28863. }, {
  28864. data: {
  28865. form: __assign({}, rows[0])
  28866. }
  28867. });
  28868. };
  28869. return Controller;
  28870. }());
  28871. var controller = new Controller();
  28872. function initApiTree () {
  28873. Ext.define('com.yvan.studio.ApiGrid', {
  28874. extend: 'Ext.Panel',
  28875. xtype: 'apigrid',
  28876. controller: controller,
  28877. scope: controller,
  28878. referenceHolder: true,
  28879. layout: 'fit',
  28880. items: [
  28881. {
  28882. width: 400,
  28883. split: true,
  28884. xtype: 'yvgrid',
  28885. reference: 'roleGrid',
  28886. border: false,
  28887. pagination: false,
  28888. autoLoad: true,
  28889. remoteFilter: false,
  28890. selModel: {
  28891. selType: 'rowmodel',
  28892. mode: 'SINGLE',
  28893. },
  28894. tbar: {
  28895. xtype: 'toolbar',
  28896. items: [
  28897. {
  28898. xtype: 'button',
  28899. text: '新增',
  28900. iconCls: 'x-fa fa-plus-circle',
  28901. listeners: {},
  28902. },
  28903. {
  28904. xtype: 'button',
  28905. text: '删除',
  28906. iconCls: 'x-fa fa-trash',
  28907. bind: {
  28908. disabled: '{roleGrid.selection==null}',
  28909. },
  28910. listeners: {},
  28911. },
  28912. ],
  28913. },
  28914. dataSource: {
  28915. url: '/sys/api/Api@getApiList',
  28916. method: 'invoke',
  28917. params: {},
  28918. },
  28919. listeners: {
  28920. itemdblclick: "selectList",
  28921. },
  28922. columns: [
  28923. {
  28924. dataIndex: 'api_name',
  28925. header: '接口名称',
  28926. filter: { type: 'string' },
  28927. flex: 1,
  28928. },
  28929. ],
  28930. },
  28931. ]
  28932. });
  28933. }
  28934. //# sourceMappingURL=ApiTree.js.map
  28935. var model$i = {
  28936. data: {
  28937. iframeSrc: ''
  28938. }
  28939. };
  28940. var vjson$h = {
  28941. layout: 'fit',
  28942. border: false,
  28943. iconCls: 'x-fa fa-newspaper-o',
  28944. referenceHolder: true,
  28945. items: [
  28946. {
  28947. // title: 'view.design',
  28948. xtype: 'uxiframe',
  28949. layout: 'fit',
  28950. // cls: 'module_page_iframe',
  28951. reference: 'iframe',
  28952. listeners: {
  28953. afterrender: 'scope.iframeRender'
  28954. }
  28955. },
  28956. ]
  28957. };
  28958. var Iframe = /** @class */ (function (_super) {
  28959. __extends(Iframe, _super);
  28960. function Iframe(path) {
  28961. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28962. _this.path = "";
  28963. _this.path = path;
  28964. return _this;
  28965. }
  28966. Iframe.prototype.iframeRender = function (sender) {
  28967. var $dom = $(sender.el.dom).find('iframe');
  28968. var iframe = $dom[0];
  28969. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28970. iframe.onload = function () {
  28971. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28972. };
  28973. };
  28974. return Iframe;
  28975. }(Scope));
  28976. //# sourceMappingURL=Iframe.js.map
  28977. var Controller$1 = /** @class */ (function () {
  28978. function Controller() {
  28979. }
  28980. Controller.prototype.onDblClick = function (sender, record) {
  28981. var data = record.raw;
  28982. if (data.text === "运行报表") {
  28983. this.openIframe("/xxl-job/index", "运行报表");
  28984. }
  28985. else if (data.text === "任务管理") {
  28986. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28987. }
  28988. else if (data.text === "调度日志") {
  28989. this.openIframe("/xxl-job/joblog", "调度日志");
  28990. }
  28991. else if (data.text === "执行器管理") {
  28992. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28993. }
  28994. };
  28995. Controller.prototype.openIframe = function (path, title) {
  28996. var page = new Iframe(path);
  28997. page.showPage({
  28998. title: title,
  28999. id: 'xxljob__' + path.replaceAll("/", "_"),
  29000. path: 'xxljob__' + path.replaceAll("/", "_"),
  29001. }, {});
  29002. };
  29003. Controller.prototype.onLoad = function () {
  29004. var me = this;
  29005. me.getView().setRootNode({
  29006. expanded: true,
  29007. leaf: false,
  29008. children: [
  29009. { leaf: true, text: '运行报表' },
  29010. { leaf: true, text: '任务管理' },
  29011. { leaf: true, text: '调度日志' },
  29012. { leaf: true, text: '执行器管理' },
  29013. ]
  29014. });
  29015. };
  29016. return Controller;
  29017. }());
  29018. var controller$1 = new Controller$1();
  29019. function initTaskTree () {
  29020. Ext.define('com.yvan.studio.TaskTree', {
  29021. extend: 'Ext.tree.Panel',
  29022. xtype: 'tasktree',
  29023. controller: controller$1,
  29024. scope: controller$1,
  29025. reference: 'roleGrid',
  29026. tooltip: '表单定义',
  29027. iconCls: 'x-fa fa-bar-chart',
  29028. useArrows: true,
  29029. rootVisible: false,
  29030. colspan: 2,
  29031. lines: true,
  29032. multiSelect: false,
  29033. referenceHolder: true,
  29034. // openNode() {
  29035. // const selection = this.getSelection()
  29036. // const [record] = selection
  29037. // if (!record) {
  29038. // return
  29039. // }
  29040. //
  29041. // const {raw} = record;
  29042. // if (raw.type === 'Dir') {
  29043. // return
  29044. // }
  29045. // if (raw.type === "Module" && raw.module) {
  29046. // // eventBus.publish(EventType.ModuleOpen, raw)
  29047. // }
  29048. // },
  29049. listeners: {
  29050. itemdblclick: 'onDblClick',
  29051. afterrender: "onLoad",
  29052. },
  29053. });
  29054. }
  29055. //# sourceMappingURL=TaskTree.js.map
  29056. var model$j = {
  29057. data: {
  29058. form: {
  29059. address: "",
  29060. level: "",
  29061. logger: "",
  29062. message: "",
  29063. nodeName: "",
  29064. serverName: "",
  29065. thread: "",
  29066. whId: "",
  29067. userId: "",
  29068. }
  29069. }
  29070. };
  29071. var vjson$i = {
  29072. title: '接口信息',
  29073. layout: 'fit',
  29074. width: 800,
  29075. height: 600,
  29076. items: [
  29077. {
  29078. xtype: 'form',
  29079. layout: {
  29080. type: 'vbox',
  29081. pack: 'start',
  29082. align: 'stretch'
  29083. },
  29084. defaults: {
  29085. border: false,
  29086. anchor: '100%',
  29087. margin: '5',
  29088. },
  29089. items: [
  29090. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29091. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29092. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29093. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29094. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29095. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29096. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29097. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29098. {
  29099. xtype: 'textareafield',
  29100. flex: 5,
  29101. fieldLabel: '响应数据',
  29102. bind: {
  29103. value: "{form.message}",
  29104. },
  29105. },
  29106. ]
  29107. }
  29108. ]
  29109. };
  29110. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29111. __extends(ApiInfoDialog, _super);
  29112. function ApiInfoDialog() {
  29113. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29114. }
  29115. return ApiInfoDialog;
  29116. }(Scope));
  29117. //# sourceMappingURL=LogPageDialog.js.map
  29118. var model$k = {
  29119. data: {
  29120. form2: {}
  29121. }
  29122. };
  29123. var vjson$j = {
  29124. title: '日志查询',
  29125. layout: 'fit',
  29126. width: "70%",
  29127. height: "80%",
  29128. items: [
  29129. {
  29130. region: 'center',
  29131. xtype: 'yvgrid',
  29132. layout: 'fit',
  29133. reference: 'grid1',
  29134. pagination: false,
  29135. autoLoad: false,
  29136. selModel: {
  29137. selType: 'rowmodel',
  29138. mode: 'SINGLE',
  29139. },
  29140. dataSource: {
  29141. method: 'invoke',
  29142. url: '/sys/api/Api@aroundLogs',
  29143. params: {
  29144. formData: '{form2}',
  29145. },
  29146. },
  29147. listeners: {
  29148. rowdblclick: 'scope.showDialog2',
  29149. },
  29150. columns: [
  29151. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29152. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29153. { dataIndex: "thread", header: "thread", width: 150 },
  29154. { dataIndex: "message", header: "message", flex: 1 },
  29155. ]
  29156. }
  29157. ]
  29158. };
  29159. var AroundLog = /** @class */ (function (_super) {
  29160. __extends(AroundLog, _super);
  29161. function AroundLog() {
  29162. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29163. }
  29164. AroundLog.prototype.onLoad = function () {
  29165. _super.prototype.onLoad.call(this);
  29166. this.queryLog();
  29167. };
  29168. AroundLog.prototype.queryLog = function () {
  29169. this.refs.grid1.reload();
  29170. };
  29171. AroundLog.prototype.showDialog2 = function () {
  29172. var _a, _b;
  29173. 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; });
  29174. if (!rows || rows.length <= 0)
  29175. return;
  29176. var dialog = new ApiInfoDialog$1();
  29177. dialog.showDialog(null, {}, {
  29178. data: {
  29179. form: __assign({}, rows[0])
  29180. }
  29181. });
  29182. };
  29183. return AroundLog;
  29184. }(Scope));
  29185. //# sourceMappingURL=AroundLog.js.map
  29186. var model$l = {
  29187. data: {
  29188. form2: {
  29189. key: "",
  29190. start_at: "",
  29191. end_at: "",
  29192. }
  29193. }
  29194. };
  29195. var vjson$k = {
  29196. title: '日志查询',
  29197. layout: 'fit',
  29198. tbar: {
  29199. xtype: 'toolbar',
  29200. items: [
  29201. {
  29202. xtype: 'button',
  29203. text: '刷新',
  29204. listeners: {
  29205. click: 'scope.queryLog'
  29206. },
  29207. },
  29208. {
  29209. xtype: 'button',
  29210. text: '周围日志',
  29211. bind: {},
  29212. listeners: {
  29213. click: 'scope.aroundLogs'
  29214. },
  29215. },
  29216. ],
  29217. },
  29218. items: [
  29219. {
  29220. region: 'center',
  29221. xtype: 'yvgrid',
  29222. layout: 'fit',
  29223. reference: 'grid1',
  29224. pagination: true,
  29225. autoLoad: false,
  29226. selModel: {
  29227. selType: 'rowmodel',
  29228. mode: 'SINGLE',
  29229. },
  29230. dataSource: {
  29231. method: 'invoke',
  29232. url: '/sys/api/Api@queryLog',
  29233. params: {
  29234. formData: '{form2}',
  29235. path: '{form.api_url}',
  29236. },
  29237. },
  29238. listeners: {
  29239. rowdblclick: 'scope.showDialog',
  29240. },
  29241. columns: [
  29242. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29243. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29244. { dataIndex: "thread", header: "thread", width: 150 },
  29245. { dataIndex: "message", header: "message", flex: 1 },
  29246. ]
  29247. }
  29248. ]
  29249. };
  29250. var LogPage = /** @class */ (function (_super) {
  29251. __extends(LogPage, _super);
  29252. function LogPage() {
  29253. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29254. }
  29255. LogPage.prototype.onLoad = function () {
  29256. _super.prototype.onLoad.call(this);
  29257. this.queryLog();
  29258. };
  29259. LogPage.prototype.queryLog = function () {
  29260. this.refs.grid1.reload();
  29261. };
  29262. LogPage.prototype.showDialog = function () {
  29263. var _a, _b;
  29264. 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; });
  29265. if (!rows || rows.length <= 0)
  29266. return;
  29267. var dialog = new ApiInfoDialog$1();
  29268. dialog.showDialog(null, {}, {
  29269. data: {
  29270. form: __assign({}, rows[0])
  29271. }
  29272. });
  29273. };
  29274. LogPage.prototype.aroundLogs = function () {
  29275. var _a, _b;
  29276. 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; });
  29277. if (!rows || rows.length <= 0)
  29278. return;
  29279. var dialog = new AroundLog();
  29280. dialog.showDialog(null, {}, {
  29281. data: {
  29282. form2: __assign({}, rows[0])
  29283. }
  29284. });
  29285. };
  29286. return LogPage;
  29287. }(Scope));
  29288. //# sourceMappingURL=LogPage.js.map
  29289. var Controller$2 = /** @class */ (function () {
  29290. function Controller() {
  29291. }
  29292. Controller.prototype.queryLog = function () {
  29293. var form2 = this.getViewModel().get("form2");
  29294. var logPage = new LogPage();
  29295. logPage.showPage({}, {
  29296. data: {
  29297. form2: __assign({}, form2)
  29298. }
  29299. });
  29300. };
  29301. return Controller;
  29302. }());
  29303. var controller$2 = new Controller$2();
  29304. function initLogsTree () {
  29305. Ext.define('com.yvan.studio.LogsTree', {
  29306. extend: 'Ext.panel.Panel',
  29307. xtype: 'logstree',
  29308. controller: controller$2,
  29309. scope: controller$2,
  29310. viewModel: {
  29311. data: {
  29312. form2: {
  29313. key: "",
  29314. start_at: "",
  29315. end_at: "",
  29316. }
  29317. }
  29318. },
  29319. reference: 'logstree',
  29320. tooltip: '表单定义',
  29321. iconCls: 'x-fa fa-bar-chart',
  29322. useArrows: true,
  29323. rootVisible: false,
  29324. colspan: 2,
  29325. lines: true,
  29326. multiSelect: false,
  29327. referenceHolder: true,
  29328. items: [
  29329. {
  29330. region: 'north',
  29331. xtype: 'form',
  29332. reference: 'form2',
  29333. split: true,
  29334. items: [
  29335. {
  29336. xtype: 'textfield',
  29337. fieldLabel: '关键字',
  29338. bind: {
  29339. value: "{form2.key}"
  29340. },
  29341. },
  29342. {
  29343. xtype: 'datefield',
  29344. fieldLabel: '开始时间',
  29345. bind: {
  29346. value: "{form2.start_at}"
  29347. },
  29348. },
  29349. {
  29350. xtype: 'datefield',
  29351. fieldLabel: '结束时间',
  29352. bind: {
  29353. value: "{form2.end_at}"
  29354. },
  29355. },
  29356. ]
  29357. },
  29358. {
  29359. xtype: "cols",
  29360. items: [
  29361. {
  29362. xtype: "box",
  29363. },
  29364. {
  29365. xtype: "button",
  29366. text: '查询',
  29367. listeners: {
  29368. click: 'queryLog'
  29369. },
  29370. },
  29371. {
  29372. xtype: "box",
  29373. },
  29374. ]
  29375. },
  29376. ],
  29377. });
  29378. }
  29379. //# sourceMappingURL=LogsTree.js.map
  29380. var model$m = {
  29381. data: {
  29382. // opsId: "",
  29383. // name: "",
  29384. running: false,
  29385. }
  29386. };
  29387. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29388. var vjson$l = {
  29389. bind: {
  29390. title: '运维-{name}',
  29391. },
  29392. layout: 'fit',
  29393. items: [
  29394. {
  29395. layout: 'border',
  29396. items: [
  29397. {
  29398. region: 'north',
  29399. items: [
  29400. {
  29401. xtype: 'toolbar',
  29402. border: false,
  29403. items: [
  29404. {
  29405. xtype: 'button',
  29406. text: '执行',
  29407. iconCls: 'x-fa fa-play',
  29408. bind: {
  29409. hidden: "{running}",
  29410. },
  29411. listeners: {
  29412. click: 'scope.start'
  29413. }
  29414. },
  29415. {
  29416. xtype: 'button',
  29417. text: '停止',
  29418. iconCls: 'x-fa fa-stop',
  29419. bind: {
  29420. hidden: "{!running}",
  29421. },
  29422. listeners: {
  29423. click: 'scope.stop'
  29424. }
  29425. },
  29426. ],
  29427. },
  29428. ]
  29429. },
  29430. {
  29431. region: 'center',
  29432. reference: 'terminal',
  29433. xtype: 'terminal',
  29434. },
  29435. ],
  29436. },
  29437. ],
  29438. };
  29439. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29440. var DevOpsTerminal = /** @class */ (function (_super) {
  29441. __extends(DevOpsTerminal, _super);
  29442. function DevOpsTerminal() {
  29443. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29444. _this.websocket = undefined;
  29445. return _this;
  29446. }
  29447. DevOpsTerminal.prototype.onLoad = function () {
  29448. this.load();
  29449. };
  29450. DevOpsTerminal.prototype.onDestroy = function () {
  29451. if (this.websocket) {
  29452. this.websocket.close();
  29453. this.websocket = undefined;
  29454. }
  29455. };
  29456. DevOpsTerminal.prototype.load = function () {
  29457. var _this = this;
  29458. var opsId = this.viewModel.get('opsId');
  29459. this.setLoading(true);
  29460. devOpsById(opsId).then(function (res) {
  29461. _this.viewModel.set('devOps', res.data);
  29462. }).finally(function () {
  29463. _this.setLoading(false);
  29464. });
  29465. };
  29466. DevOpsTerminal.prototype.start = function () {
  29467. var me = this;
  29468. var running = this.viewModel.get('running');
  29469. var devOps = this.viewModel.get('devOps');
  29470. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29471. return;
  29472. var devopsServer = "ws://122.9.140.63:9999";
  29473. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29474. this.websocket.addEventListener('open', function () {
  29475. me.viewModel.set('running', true);
  29476. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29477. });
  29478. this.websocket.addEventListener('message', function (event) {
  29479. me.refs.terminal.write(event.data);
  29480. });
  29481. this.websocket.addEventListener('close', function () {
  29482. me.stop();
  29483. });
  29484. this.websocket.addEventListener('error', function () {
  29485. me.stop();
  29486. });
  29487. };
  29488. DevOpsTerminal.prototype.stop = function () {
  29489. if (this.websocket) {
  29490. this.websocket.close();
  29491. this.websocket = undefined;
  29492. }
  29493. this.viewModel.set('running', false);
  29494. };
  29495. return DevOpsTerminal;
  29496. }(Scope));
  29497. //# sourceMappingURL=DevOpsTerminal.js.map
  29498. var Controller$3 = /** @class */ (function () {
  29499. function Controller() {
  29500. }
  29501. Controller.prototype.onLoad = function (sender) {
  29502. this.reload();
  29503. };
  29504. Controller.prototype.reload = function () {
  29505. var me = this;
  29506. // @ts-ignore
  29507. var view = me.getView();
  29508. view.setLoading(true);
  29509. devOpsList().then(function (res) {
  29510. view.setStore(new Ext.data.Store({
  29511. fields: ['ops_id', 'host', 'name'],
  29512. data: res.data,
  29513. }));
  29514. }).finally(function () {
  29515. view.setLoading(false);
  29516. });
  29517. };
  29518. Controller.prototype.onDblClick = function (sender) {
  29519. this.devOpsTerminal();
  29520. };
  29521. Controller.prototype.devOpsTerminal = function () {
  29522. // @ts-ignore
  29523. var view = this.getView();
  29524. var _a = __read(view.getSelection(), 1), record = _a[0];
  29525. if (record) {
  29526. var name = record.get('name');
  29527. var opsId = record.get('ops_id');
  29528. var instance = new DevOpsTerminal();
  29529. instance.showPage({
  29530. id: 'ops_' + opsId,
  29531. path: 'ops_' + opsId,
  29532. }, {
  29533. data: {
  29534. opsId: opsId,
  29535. name: name,
  29536. }
  29537. });
  29538. instance.dialogSuccess = function () {
  29539. };
  29540. }
  29541. };
  29542. return Controller;
  29543. }());
  29544. var controller$3 = new Controller$3();
  29545. function initDevOpsTree () {
  29546. Ext.define('com.yvan.studio.DevOpsGrid', {
  29547. extend: 'Ext.grid.Panel',
  29548. xtype: 'devopsgrid',
  29549. controller: controller$3,
  29550. scope: controller$3,
  29551. referenceHolder: true,
  29552. tooltip: '运维',
  29553. iconCls: 'x-fa fa-terminal',
  29554. useArrows: true,
  29555. reference: 'devopsgrid',
  29556. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29557. listeners: {
  29558. afterrender: 'onLoad',
  29559. itemdblclick: 'onDblClick',
  29560. },
  29561. viewConfig: {
  29562. // listeners: {
  29563. // itemcontextmenu: 'onGridContextMenu',
  29564. // },
  29565. },
  29566. tbar: {
  29567. xtype: 'toolbar',
  29568. items: [
  29569. {
  29570. xtype: 'button',
  29571. tooltip: '刷新',
  29572. iconCls: 'x-fa fa-refresh',
  29573. listeners: {
  29574. click: 'reload'
  29575. }
  29576. },
  29577. {
  29578. xtype: 'textfield',
  29579. flex: 1,
  29580. emptyText: '搜索过滤',
  29581. enableKeyEvents: true,
  29582. listeners: {
  29583. change: {
  29584. fn: 'filterChanged',
  29585. buffer: 50
  29586. }
  29587. }
  29588. },
  29589. ]
  29590. },
  29591. columns: [
  29592. {
  29593. text: 'ID', dataIndex: 'report_id',
  29594. hidden: true,
  29595. },
  29596. {
  29597. text: '服务器',
  29598. dataIndex: 'host',
  29599. width: 100,
  29600. menuDisabled: true,
  29601. },
  29602. {
  29603. text: '操作名称',
  29604. dataIndex: 'name',
  29605. flex: 1,
  29606. menuDisabled: true,
  29607. },
  29608. ]
  29609. });
  29610. }
  29611. //# sourceMappingURL=DevOpsTree.js.map
  29612. function initTerminal () {
  29613. Ext.define('com.yvan.studio.Terminal', {
  29614. extend: 'Ext.panel.Panel',
  29615. alias: 'widget.terminal',
  29616. xtype: 'terminal',
  29617. layout: 'fit',
  29618. border: false,
  29619. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29620. config: {},
  29621. write: function (str) {
  29622. if (this.term) {
  29623. this.term.write(str);
  29624. }
  29625. },
  29626. initComponent: function () {
  29627. var that = this;
  29628. this.superclass.initComponent.call(this, arguments);
  29629. that.on({
  29630. resize: function () {
  29631. var _a;
  29632. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29633. that.fitAddon.fit();
  29634. }
  29635. },
  29636. destory: function () {
  29637. if (that.term) {
  29638. that.term.dispose();
  29639. delete that.term;
  29640. }
  29641. if (that.fitAddon) {
  29642. that.fitAddon.dispose();
  29643. delete that.fitAddon;
  29644. }
  29645. },
  29646. afterrender: function (sender) {
  29647. _.defer(function () {
  29648. var $dom = $(that.el.dom).find('.terminal');
  29649. that.term = new xterm.Terminal({
  29650. // cursorBlink: false,
  29651. // cursorStyle: 'bar', // block underline bar
  29652. // enableBold: false,
  29653. // bellStyle: "sound",
  29654. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29655. // scrollback: 10000,
  29656. // tabStopWidth: 4,
  29657. disableStdin: true,
  29658. theme: {
  29659. // foreground: "#111",
  29660. // background: "#fdfdfd",
  29661. // background: "#fafafa",
  29662. },
  29663. });
  29664. that.fitAddon = new xtermAddonFit.FitAddon();
  29665. that.term.loadAddon(that.fitAddon);
  29666. that.term.open($dom[0]);
  29667. that.fitAddon.fit();
  29668. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29669. });
  29670. }
  29671. });
  29672. }
  29673. });
  29674. }
  29675. //# sourceMappingURL=Terminal.js.map
  29676. var vjson$m = {
  29677. title: '接口统计',
  29678. layout: 'fit',
  29679. items: [
  29680. {
  29681. title: '接口统计',
  29682. xtype: 'yvgrid',
  29683. enableLocking: false,
  29684. reference: 'grid1',
  29685. pagination: false,
  29686. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29687. tbar: {
  29688. xtype: 'form',
  29689. items: [
  29690. {
  29691. xtype: 'cols',
  29692. items: [
  29693. {
  29694. xtype: 'textfield',
  29695. fieldLabel: '搜索',
  29696. listeners: {
  29697. change: 'scope.requestFilterChange'
  29698. }
  29699. },
  29700. ]
  29701. },
  29702. ]
  29703. },
  29704. columns: [
  29705. { text: '地址', dataIndex: 'url', flex: 1 },
  29706. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29707. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29708. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29709. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29710. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29711. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29712. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29713. ],
  29714. leadingBufferZone: 8,
  29715. trailingBufferZone: 8,
  29716. viewConfig: {
  29717. listeners: {
  29718. expandbody: 'scope.onChildExpand'
  29719. }
  29720. },
  29721. listeners: {
  29722. itemdblclick: 'scope.itemClick1'
  29723. },
  29724. plugins: {
  29725. rowwidget: {
  29726. widget: {
  29727. xtype: 'yvgrid',
  29728. hideFootbar: true,
  29729. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29730. listeners: {
  29731. itemdblclick: 'scope.itemClick1'
  29732. },
  29733. columns: [
  29734. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29735. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29736. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29737. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29738. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29739. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29740. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29741. ]
  29742. }
  29743. }
  29744. }
  29745. },
  29746. ]
  29747. };
  29748. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29749. var model$n = {
  29750. data: {
  29751. count: 0,
  29752. dataSourceName: '',
  29753. sql: "",
  29754. histogram: '',
  29755. maxCost: 0,
  29756. minCost: 0,
  29757. avgCost: '',
  29758. sumCost: 0,
  29759. histogramInfos: [
  29760. // count: 1
  29761. // gteCost: 20
  29762. // ltCost: 50
  29763. // 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"
  29764. // topN: [
  29765. // cost: 24
  29766. // occurrenceTime: "1648004895171"
  29767. // 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"
  29768. // ]
  29769. ]
  29770. }
  29771. };
  29772. //# sourceMappingURL=PerformDialog.model.js.map
  29773. var vjson$n = {
  29774. title: '性能统计详情',
  29775. height: 400,
  29776. width: 800,
  29777. modal: true,
  29778. layout: 'fit',
  29779. items: [
  29780. {
  29781. xtype: 'tabpanel',
  29782. items: [
  29783. {
  29784. title: '摘要',
  29785. key: "1",
  29786. layout: 'border',
  29787. items: [
  29788. {
  29789. region: 'north',
  29790. border: false,
  29791. defaults: {
  29792. margin: '8 0 0 0'
  29793. },
  29794. items: [
  29795. {
  29796. xtype: 'cols',
  29797. defaultType: 'displayfield',
  29798. defaults: {
  29799. labelWidth: 70,
  29800. },
  29801. items: [
  29802. {
  29803. fieldLabel: 'count',
  29804. bind: {
  29805. value: '{count}'
  29806. }
  29807. },
  29808. {
  29809. fieldLabel: 'maxCost',
  29810. bind: {
  29811. value: '{maxCost}'
  29812. }
  29813. },
  29814. {
  29815. fieldLabel: 'minCost',
  29816. bind: {
  29817. value: '{minCost}'
  29818. }
  29819. },
  29820. {
  29821. fieldLabel: 'avgCost',
  29822. bind: {
  29823. value: '{avgCost}'
  29824. }
  29825. },
  29826. {
  29827. fieldLabel: 'sumCost',
  29828. bind: {
  29829. value: '{sumCost}'
  29830. }
  29831. },
  29832. ]
  29833. },
  29834. {
  29835. xtype: 'cols',
  29836. items: [
  29837. {
  29838. flex: 5,
  29839. border: false,
  29840. items: [
  29841. {
  29842. xtype: 'segmentedbutton',
  29843. reference: 'histogram',
  29844. allowToggle: false,
  29845. border: false,
  29846. items: []
  29847. }
  29848. ]
  29849. },
  29850. ]
  29851. },
  29852. ],
  29853. },
  29854. {
  29855. region: 'center',
  29856. xtype: 'sqleditor',
  29857. reference: 'sqlEditor',
  29858. },
  29859. ]
  29860. },
  29861. {
  29862. title: '直方图',
  29863. key: "2",
  29864. }
  29865. ]
  29866. }
  29867. ]
  29868. };
  29869. //# sourceMappingURL=PerformDialog.view.js.map
  29870. var PerformDialog = /** @class */ (function (_super) {
  29871. __extends(PerformDialog, _super);
  29872. function PerformDialog() {
  29873. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29874. }
  29875. PerformDialog.prototype.onLoad = function () {
  29876. var _this = this;
  29877. var sql = this.viewModel.get('sql');
  29878. var sql2 = sqlFormat.format(sql, {
  29879. indent: ' ',
  29880. uppercase: true,
  29881. });
  29882. var histogramInfos = this.viewModel.get('histogramInfos');
  29883. var vs = _$2.map(histogramInfos, function (v) {
  29884. if (v.ltCost > 2100000000) {
  29885. return {
  29886. text: "[" + v.gteCost + ", \u221E):" + v.count
  29887. };
  29888. }
  29889. return {
  29890. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29891. };
  29892. });
  29893. this.refs.sqlEditor.setCode(sql2);
  29894. _$2.forEach(vs, function (v) {
  29895. _this.refs.histogram.add(v);
  29896. });
  29897. };
  29898. return PerformDialog;
  29899. }(Scope));
  29900. //# sourceMappingURL=PerformDialog.js.map
  29901. var model$o = {
  29902. data: {}
  29903. };
  29904. var PerformStats = /** @class */ (function (_super) {
  29905. __extends(PerformStats, _super);
  29906. function PerformStats() {
  29907. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29908. _this.requestFilterChange = _.debounce(function (sender, value) {
  29909. var store = _this.refs.grid1.store;
  29910. store.clearFilter();
  29911. if (value) {
  29912. store.filterBy(function (record, id) {
  29913. var text = toString(record.get('url'));
  29914. // 用拼音筛选的方式
  29915. return text.includes(value);
  29916. });
  29917. }
  29918. }, 100);
  29919. return _this;
  29920. }
  29921. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29922. widget.setData(record.data.children);
  29923. };
  29924. PerformStats.prototype.itemClick1 = function (sender, record) {
  29925. console.log('itemClick1', record.data);
  29926. new PerformDialog().showDialog(sender, {}, {
  29927. data: record.data
  29928. });
  29929. };
  29930. PerformStats.prototype.onLoad = function () {
  29931. var _this = this;
  29932. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29933. .then(function (_a) {
  29934. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29935. var resData = reqRes.data;
  29936. var jdbcData = jdbcRes.data;
  29937. _.forEach(jdbcData, function (item) {
  29938. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29939. });
  29940. _.forEach(resData, function (item) {
  29941. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29942. if (_.isArray(item.sqls)) {
  29943. item.children = _.map(item.sqls, function (sql) {
  29944. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29945. }).filter(function (v) { return !!v; });
  29946. }
  29947. item.jdbcCount = _.size(item.children);
  29948. });
  29949. _this.refs.grid1.setData(resData);
  29950. // this.refs.grid2.setData(jdbcData)
  29951. });
  29952. };
  29953. return PerformStats;
  29954. }(Scope));
  29955. //# sourceMappingURL=InterfaceStatistics.js.map
  29956. var vjson$o = {
  29957. title: '性能统计',
  29958. layout: 'fit',
  29959. items: [
  29960. {
  29961. title: '数据库统计',
  29962. xtype: 'yvgrid',
  29963. enableLocking: false,
  29964. reference: 'grid2',
  29965. pagination: false,
  29966. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29967. tbar: {
  29968. xtype: 'form',
  29969. items: [
  29970. {
  29971. xtype: 'cols',
  29972. items: [
  29973. {
  29974. fieldLabel: '搜索',
  29975. listeners: {
  29976. change: 'scope.jdbcFilterChange'
  29977. }
  29978. },
  29979. ]
  29980. },
  29981. ]
  29982. },
  29983. listeners: {
  29984. itemdblclick: 'scope.itemClick1'
  29985. },
  29986. columns: [
  29987. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29988. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29989. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29990. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29991. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29992. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29993. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29994. ]
  29995. },
  29996. ]
  29997. };
  29998. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29999. var model$p = {
  30000. data: {}
  30001. };
  30002. var PerformStats$1 = /** @class */ (function (_super) {
  30003. __extends(PerformStats, _super);
  30004. function PerformStats() {
  30005. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  30006. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  30007. var store = _this.refs.grid2.store;
  30008. store.clearFilter();
  30009. if (value) {
  30010. store.filterBy(function (record, id) {
  30011. var text = toString(record.get('sql'));
  30012. // 用拼音筛选的方式
  30013. return text.includes(value);
  30014. });
  30015. }
  30016. }, 100);
  30017. return _this;
  30018. }
  30019. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30020. widget.setData(record.data.children);
  30021. };
  30022. PerformStats.prototype.itemClick1 = function (sender, record) {
  30023. console.log('itemClick1', record.data);
  30024. new PerformDialog().showDialog(sender, {}, {
  30025. data: record.data
  30026. });
  30027. };
  30028. PerformStats.prototype.onLoad = function () {
  30029. var _this = this;
  30030. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30031. .then(function (_a) {
  30032. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30033. var resData = reqRes.data;
  30034. var jdbcData = jdbcRes.data;
  30035. _.forEach(jdbcData, function (item) {
  30036. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30037. });
  30038. _.forEach(resData, function (item) {
  30039. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30040. if (_.isArray(item.sqls)) {
  30041. item.children = _.map(item.sqls, function (sql) {
  30042. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30043. }).filter(function (v) { return !!v; });
  30044. }
  30045. item.jdbcCount = _.size(item.children);
  30046. });
  30047. _this.refs.grid2.setData(jdbcData);
  30048. });
  30049. };
  30050. return PerformStats;
  30051. }(Scope));
  30052. //# sourceMappingURL=DatabaseStatistics.js.map
  30053. var Controller$4 = /** @class */ (function () {
  30054. function Controller() {
  30055. }
  30056. Controller.prototype.onDblClick = function (sender, record) {
  30057. var data = record.raw;
  30058. if (data.text === "接口统计") {
  30059. var page = new PerformStats();
  30060. page.showPage({
  30061. title: "接口统计",
  30062. id: '_InterfaceStatistics',
  30063. path: '_InterfaceStatistics',
  30064. }, {});
  30065. }
  30066. else if (data.text === "数据库统计") {
  30067. var page = new PerformStats$1();
  30068. page.showPage({
  30069. title: "数据库统计",
  30070. id: '_DatabaseStatistics',
  30071. path: '_DatabaseStatistics',
  30072. }, {});
  30073. }
  30074. };
  30075. Controller.prototype.onLoad = function () {
  30076. var me = this;
  30077. //@ts-ignore
  30078. var view = me.getView();
  30079. view.setRootNode({
  30080. expanded: true,
  30081. leaf: false,
  30082. children: [
  30083. { leaf: true, text: '接口统计' },
  30084. { leaf: true, text: '数据库统计' },
  30085. ]
  30086. });
  30087. };
  30088. return Controller;
  30089. }());
  30090. var controller$4 = new Controller$4();
  30091. function initMonitorTree () {
  30092. Ext.define('com.yvan.studio.MonitorTree', {
  30093. extend: 'Ext.tree.Panel',
  30094. xtype: 'monitortree',
  30095. controller: controller$4,
  30096. scope: controller$4,
  30097. reference: 'roleGrid',
  30098. tooltip: '表单定义',
  30099. iconCls: 'x-fa fa-bar-chart',
  30100. useArrows: true,
  30101. rootVisible: false,
  30102. colspan: 2,
  30103. lines: true,
  30104. multiSelect: false,
  30105. referenceHolder: true,
  30106. // openNode() {
  30107. // const selection = this.getSelection()
  30108. // const [record] = selection
  30109. // if (!record) {
  30110. // return
  30111. // }
  30112. //
  30113. // const {raw} = record;
  30114. // if (raw.type === 'Dir') {
  30115. // return
  30116. // }
  30117. // if (raw.type === "Module" && raw.module) {
  30118. // // eventBus.publish(EventType.ModuleOpen, raw)
  30119. // }
  30120. // },
  30121. listeners: {
  30122. itemdblclick: 'onDblClick',
  30123. afterrender: "onLoad",
  30124. },
  30125. });
  30126. }
  30127. //# sourceMappingURL=MonitorTree.js.map
  30128. var Controller$5 = /** @class */ (function () {
  30129. function Controller() {
  30130. }
  30131. return Controller;
  30132. }());
  30133. var controller$5 = new Controller$5();
  30134. function initHomeTree () {
  30135. Ext.define('com.yvan.studio.HomeTree', {
  30136. extend: 'Ext.Panel',
  30137. xtype: 'hometree',
  30138. controller: controller$5,
  30139. scope: controller$5,
  30140. referenceHolder: true,
  30141. bodyCls: 'home',
  30142. // layout: 'fit',
  30143. tbar: {
  30144. xtype: 'toolbar',
  30145. items: [
  30146. {
  30147. xtype: 'button',
  30148. iconCls: 'x-fa fa-exchange',
  30149. text: '数据结构同步',
  30150. handler: function (sender) {
  30151. handles$1.mainWindow.showDataSync(sender);
  30152. }
  30153. },
  30154. {
  30155. xtype: 'button',
  30156. iconCls: 'x-fa fa-cubes',
  30157. text: '数据域管理',
  30158. handler: function (sender) {
  30159. handles$1.mainWindow.showColumnDomain();
  30160. }
  30161. },
  30162. ],
  30163. },
  30164. // items: [
  30165. //
  30166. // ],
  30167. layout: {
  30168. type: 'vbox',
  30169. pack: 'start',
  30170. align: 'stretch',
  30171. },
  30172. items: [
  30173. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30174. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30175. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30176. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30177. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30178. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30179. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30180. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30181. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30182. ],
  30183. });
  30184. }
  30185. //# sourceMappingURL=HomeTree.js.map
  30186. var WidgetStore = /** @class */ (function (_super) {
  30187. __extends(WidgetStore, _super);
  30188. function WidgetStore() {
  30189. return _super !== null && _super.apply(this, arguments) || this;
  30190. }
  30191. WidgetStore.prototype.getCacheKey = function (param) {
  30192. return "widget_data.json";
  30193. };
  30194. /*invokeApi(param: any): Promise<any> {
  30195. return new Promise<any>(resolve => {
  30196. //@ts-ignore
  30197. require(["../../widget/all"], function (res) {
  30198. const widgetList = res.default
  30199. resolve(widgetList)
  30200. })
  30201. })
  30202. }*/
  30203. WidgetStore.prototype.invokeApi = function (param) {
  30204. return widgetListApi(param);
  30205. };
  30206. return WidgetStore;
  30207. }(CacheStore));
  30208. var instance$3 = new WidgetStore();
  30209. //# sourceMappingURL=WidgetStore.js.map
  30210. var WidgetGridController = /** @class */ (function () {
  30211. function WidgetGridController() {
  30212. }
  30213. WidgetGridController.prototype.onLoad = function (sender) {
  30214. var me = this;
  30215. setWidget(me);
  30216. instance$3.registe(me.reloadData.bind(this));
  30217. instance$3.reloadIfNeed(undefined);
  30218. };
  30219. WidgetGridController.prototype.widgetAdd = function (sender) {
  30220. var me = this;
  30221. var win = new Ext.Window({
  30222. autoDestroy: true,
  30223. title: "新建弹框",
  30224. width: 400,
  30225. height: 220,
  30226. resizable: true,
  30227. closable: true,
  30228. maximizable: true,
  30229. minimizable: true,
  30230. plain: true,
  30231. // constrainHeader: true,
  30232. constrain: true,
  30233. layout: 'fit',
  30234. animateTarget: sender,
  30235. buttonAlign: 'center',
  30236. items: [
  30237. {
  30238. xtype: "form",
  30239. layout: "hbox",
  30240. margin: '10px 20px',
  30241. border: 0,
  30242. items: [
  30243. {
  30244. flex: 1,
  30245. layout: 'vbox',
  30246. items: [
  30247. {
  30248. xtype: "textfield",
  30249. name: "widgetcode",
  30250. fieldLabel: "弹窗文件",
  30251. flex: 1,
  30252. allowBlank: false,
  30253. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30254. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30255. labelWidth: 80,
  30256. width: "100%",
  30257. },
  30258. {
  30259. xtype: "textfield",
  30260. name: "widgetname",
  30261. fieldLabel: "弹窗名称",
  30262. flex: 1,
  30263. allowBlank: false,
  30264. labelWidth: 80,
  30265. width: "100%",
  30266. },
  30267. ]
  30268. },
  30269. ]
  30270. }
  30271. ],
  30272. //窗口按钮
  30273. buttons: [
  30274. {
  30275. xtype: 'button', text: '保存', handler: function (btn) {
  30276. //窗口获取表单
  30277. var form = win.down('form');
  30278. var vaildSuccess = form.isValid();
  30279. if (!vaildSuccess) {
  30280. return;
  30281. }
  30282. var title = form.down('textfield[name="widgetname"]').getValue();
  30283. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30284. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30285. if (res.success) {
  30286. msg$1('添加成功');
  30287. // 添加
  30288. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30289. me.reload();
  30290. });
  30291. win.close();
  30292. }
  30293. });
  30294. }
  30295. },
  30296. {
  30297. xtype: 'button', text: '取消', handler: function (btn) {
  30298. //窗口关闭
  30299. win.close();
  30300. }
  30301. }
  30302. ]
  30303. });
  30304. win.show();
  30305. };
  30306. WidgetGridController.prototype.widgetRemove = function (sender) {
  30307. var _this = this;
  30308. //@ts-ignore
  30309. var record = this.getView().selection.data;
  30310. if (!record) {
  30311. msg$1('请选择一行');
  30312. return;
  30313. }
  30314. var widgetPath = record.widget_path;
  30315. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30316. if (btn === 'yes') {
  30317. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30318. if (res.success) {
  30319. msg$1(res.msg);
  30320. _this.reload();
  30321. }
  30322. });
  30323. }
  30324. });
  30325. };
  30326. WidgetGridController.prototype.widgetEdit = function (record) {
  30327. var _this = this;
  30328. if (record) {
  30329. var widgetPath = record.widget_path;
  30330. var widgetName = record.widget_name;
  30331. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30332. _this.reload();
  30333. });
  30334. }
  30335. };
  30336. WidgetGridController.prototype.onDestory = function (sender) {
  30337. var me = this;
  30338. setWidget(undefined);
  30339. instance$3.unregiste(me.reloadData.bind(this));
  30340. };
  30341. WidgetGridController.prototype.reloadData = function (res) {
  30342. var me = this;
  30343. //@ts-ignore
  30344. var view = me.getView();
  30345. if (typeof res === 'object') {
  30346. // const data = []
  30347. // _.forOwn(res, (v, k) => {
  30348. // data.push({
  30349. // widget_path: k,
  30350. // widget_name: v.title,
  30351. // vjson : v
  30352. // })
  30353. // })
  30354. view.setStore(new Ext.data.Store({
  30355. fields: ['widget_path', 'widget_name'],
  30356. data: res.data,
  30357. }));
  30358. }
  30359. else if (typeof res === 'boolean') {
  30360. view.setLoading(res);
  30361. }
  30362. };
  30363. WidgetGridController.prototype.reload = function () {
  30364. instance$3.reloadForce(undefined);
  30365. };
  30366. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30367. //@ts-ignore
  30368. this.view.store.clearFilter();
  30369. if (value) {
  30370. //@ts-ignore
  30371. this.view.store.filterBy(function (record) {
  30372. var widget_path = record.get('widget_path');
  30373. var widget_name = record.get('widget_name');
  30374. return (window['system'].pinyinMatch(widget_name, value) ||
  30375. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30376. });
  30377. }
  30378. };
  30379. WidgetGridController.prototype.onClearClick = function () {
  30380. var _a, _b;
  30381. //@ts-ignore
  30382. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30383. };
  30384. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30385. this.widgetEdit(record.data);
  30386. };
  30387. return WidgetGridController;
  30388. }());
  30389. //# sourceMappingURL=WidgetGridController.js.map
  30390. function initWidget () {
  30391. var controller = new WidgetGridController();
  30392. Ext.define('com.yvan.studio.WidgetGrid', {
  30393. extend: 'Ext.grid.Panel',
  30394. xtype: 'widgetgrid',
  30395. controller: controller,
  30396. scope: controller,
  30397. referenceHolder: true,
  30398. tooltip: '检索窗口',
  30399. iconCls: 'x-fa fa-search',
  30400. useArrows: true,
  30401. reference: 'widgetgrid',
  30402. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30403. listeners: {
  30404. itemdblclick: 'onDblClick',
  30405. afterrender: 'onLoad',
  30406. destory: 'onDestory',
  30407. },
  30408. viewConfig: {
  30409. listeners: {
  30410. itemcontextmenu: 'onGridContextMenu',
  30411. },
  30412. },
  30413. tbar: [
  30414. {
  30415. xtype: 'button',
  30416. tooltip: '刷新',
  30417. iconCls: 'x-fa fa-refresh',
  30418. listeners: {
  30419. click: 'reload'
  30420. }
  30421. },
  30422. {
  30423. xtype: 'button',
  30424. tooltip: '添加',
  30425. iconCls: 'x-fa fa-plus-circle',
  30426. listeners: {
  30427. click: 'widgetAdd'
  30428. }
  30429. },
  30430. {
  30431. xtype: 'button',
  30432. tooltip: '删除',
  30433. iconCls: 'x-fa fa-minus-circle',
  30434. listeners: {
  30435. click: 'widgetRemove'
  30436. }
  30437. },
  30438. ],
  30439. fbar: [
  30440. {
  30441. xtype: 'textfield',
  30442. flex: 1,
  30443. reference: "txtFilter",
  30444. emptyText: '搜索过滤',
  30445. enableKeyEvents: true,
  30446. listeners: {
  30447. change: {
  30448. fn: 'filterChanged',
  30449. buffer: 50
  30450. }
  30451. }
  30452. },
  30453. ],
  30454. columns: [
  30455. {
  30456. text: '弹窗文件', dataIndex: 'widget_path',
  30457. menuDisabled: true, flex: 1,
  30458. },
  30459. {
  30460. text: '弹窗名称', dataIndex: 'widget_name',
  30461. menuDisabled: true, flex: 1,
  30462. },
  30463. ]
  30464. });
  30465. }
  30466. //# sourceMappingURL=WidgetGrid.js.map
  30467. var WhLayoutController = /** @class */ (function () {
  30468. function WhLayoutController() {
  30469. }
  30470. WhLayoutController.prototype.onLoad = function (sender) {
  30471. var _this = this;
  30472. var me = this;
  30473. setWhLayout(me);
  30474. _$2.defer(function () {
  30475. _this.reload();
  30476. });
  30477. };
  30478. WhLayoutController.prototype.reload = function () {
  30479. //@ts-ignore
  30480. var view = this.getView();
  30481. view.setLoading(true);
  30482. loadWhLayoutAll().then(function (res) {
  30483. view.setStore(new Ext.data.Store({
  30484. fields: ['layout_code', 'layout_name'],
  30485. data: res.data,
  30486. }));
  30487. }).finally(function () {
  30488. view.setLoading(false);
  30489. });
  30490. };
  30491. WhLayoutController.prototype.add = function () {
  30492. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30493. };
  30494. WhLayoutController.prototype.edit = function (data) {
  30495. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30496. };
  30497. WhLayoutController.prototype.remove = function () {
  30498. var _this = this;
  30499. var _a;
  30500. //@ts-ignore
  30501. var view = this.getView();
  30502. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30503. if (!record) {
  30504. msg$1('请选择一行数据');
  30505. return;
  30506. }
  30507. var layoutCode = record.layout_code;
  30508. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30509. if (btn === 'yes') {
  30510. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30511. if (res.success) {
  30512. msg$1(res.msg);
  30513. _this.reload();
  30514. }
  30515. });
  30516. }
  30517. });
  30518. };
  30519. WhLayoutController.prototype.onDblClick = function () {
  30520. var _a;
  30521. //@ts-ignore
  30522. var view = this.getView();
  30523. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30524. if (!record) {
  30525. msg$1('请选择一行数据');
  30526. return;
  30527. }
  30528. this.edit(record);
  30529. };
  30530. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30531. //@ts-ignore
  30532. this.view.store.clearFilter();
  30533. if (value) {
  30534. //@ts-ignore
  30535. this.view.store.filterBy(function (record) {
  30536. var widget_path = record.get('widget_path');
  30537. var widget_name = record.get('widget_name');
  30538. return (window['system'].pinyinMatch(widget_name, value) ||
  30539. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30540. });
  30541. }
  30542. };
  30543. WhLayoutController.prototype.onClearClick = function () {
  30544. var _a, _b;
  30545. //@ts-ignore
  30546. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30547. };
  30548. return WhLayoutController;
  30549. }());
  30550. //# sourceMappingURL=WhLayoutController.js.map
  30551. function initWhLayout () {
  30552. var controller = new WhLayoutController();
  30553. Ext.define('com.yvan.studio.WhLayout', {
  30554. extend: 'Ext.grid.Panel',
  30555. xtype: 'whlayout',
  30556. alias: 'widget.whlayout',
  30557. controller: controller,
  30558. scope: controller,
  30559. referenceHolder: true,
  30560. tooltip: '检索窗口',
  30561. iconCls: 'x-fa fa-search',
  30562. useArrows: true,
  30563. reference: 'whlayout',
  30564. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30565. listeners: {
  30566. itemdblclick: 'onDblClick',
  30567. afterrender: 'onLoad',
  30568. destory: 'onDestory',
  30569. },
  30570. viewConfig: {
  30571. listeners: {
  30572. itemcontextmenu: 'onGridContextMenu',
  30573. },
  30574. },
  30575. tbar: [
  30576. {
  30577. xtype: 'button',
  30578. tooltip: '刷新',
  30579. iconCls: 'x-fa fa-refresh',
  30580. listeners: {
  30581. click: 'reload'
  30582. }
  30583. },
  30584. {
  30585. xtype: 'button',
  30586. tooltip: '添加',
  30587. iconCls: 'x-fa fa-plus-circle',
  30588. listeners: {
  30589. click: 'add'
  30590. }
  30591. },
  30592. {
  30593. xtype: 'button',
  30594. tooltip: '删除',
  30595. iconCls: 'x-fa fa-minus-circle',
  30596. listeners: {
  30597. click: 'remove'
  30598. }
  30599. },
  30600. ],
  30601. fbar: [
  30602. {
  30603. xtype: 'textfield',
  30604. flex: 1,
  30605. reference: "txtFilter",
  30606. emptyText: '搜索过滤',
  30607. enableKeyEvents: true,
  30608. listeners: {
  30609. change: {
  30610. fn: 'filterChanged',
  30611. buffer: 50
  30612. }
  30613. }
  30614. },
  30615. ],
  30616. columns: [
  30617. {
  30618. text: '图编号', dataIndex: 'layout_code',
  30619. menuDisabled: true, flex: 1,
  30620. },
  30621. {
  30622. text: '图名称', dataIndex: 'layout_name',
  30623. menuDisabled: true, flex: 1,
  30624. },
  30625. ]
  30626. });
  30627. }
  30628. //# sourceMappingURL=WhLayout.js.map
  30629. var BpmnTreeController = /** @class */ (function () {
  30630. function BpmnTreeController() {
  30631. }
  30632. BpmnTreeController.prototype.onLoad = function (sender) {
  30633. this.reload();
  30634. };
  30635. BpmnTreeController.prototype.reload = function () {
  30636. var me = this;
  30637. me.getView().setLoading(true);
  30638. exporerList().then(function (res) {
  30639. // handles.mainWindow.modules = res.data
  30640. // const rootNode = modulesToTreeData(res.data)
  30641. var rootNode = res.data.tree;
  30642. me.getView().setRootNode({
  30643. expanded: true,
  30644. leaf: false,
  30645. children: rootNode
  30646. });
  30647. // const lastId = window.location.hash.substring(1);
  30648. // file.selectPath(lastId)
  30649. // if (lastId) {
  30650. // const node = getModuleById(rootNode, lastId)
  30651. // if (node) {
  30652. // showDesign(node.id, node.path, node.text, node.module)
  30653. // }
  30654. // }
  30655. // this.restoreState()
  30656. }).finally(function () {
  30657. me.getView().setLoading(false);
  30658. });
  30659. };
  30660. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30661. var _this = this;
  30662. e.preventDefault();
  30663. var raw = node.raw;
  30664. //const me = sender.up("treepanel").scope
  30665. var option;
  30666. if (raw.exporerType === 1) ;
  30667. else if (raw.exporerType === 21) {
  30668. if (raw.type === 'Dir') {
  30669. option = {
  30670. shadow: 'frame', allowOtherMenus: true,
  30671. items: [
  30672. {
  30673. text: '添加',
  30674. iconCls: 'x-fa fa-plus-circle',
  30675. handler: function (sender) {
  30676. var dirPath = raw.dirPath;
  30677. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30678. }
  30679. },
  30680. '-',
  30681. {
  30682. text: '新建文件夹',
  30683. iconCls: 'x-fa fa-folder-o',
  30684. handler: function (sender) {
  30685. }
  30686. }
  30687. ]
  30688. };
  30689. }
  30690. else if (raw.type === 'Model') {
  30691. option = {
  30692. shadow: 'frame', allowOtherMenus: true,
  30693. items: [
  30694. {
  30695. text: '编辑',
  30696. iconCls: 'x-fa fa-edit',
  30697. handler: function (sender) {
  30698. }
  30699. },
  30700. {
  30701. text: '删除',
  30702. iconCls: 'x-fa fa-minus-circle',
  30703. handler: function (sender) {
  30704. }
  30705. },
  30706. '-',
  30707. {
  30708. text: '注册(至菜单)',
  30709. iconCls: 'x-fa fa-sign-in',
  30710. handler: function (sender) {
  30711. }
  30712. },
  30713. {
  30714. text: '新建文件夹',
  30715. iconCls: 'x-fa fa-folder-o',
  30716. handler: function (sender) {
  30717. }
  30718. }
  30719. ]
  30720. };
  30721. }
  30722. }
  30723. else if (raw.exporerType === 22) {
  30724. if (raw.type === 'Dir') {
  30725. option = {
  30726. shadow: 'frame', allowOtherMenus: true,
  30727. items: [
  30728. {
  30729. text: '添加',
  30730. iconCls: 'x-fa fa-plus-circle',
  30731. handler: function (sender) {
  30732. var dirPath = raw.dirPath;
  30733. handles$1.mainWindow.showFormBill();
  30734. }
  30735. },
  30736. '-',
  30737. {
  30738. text: '新建文件夹',
  30739. iconCls: 'x-fa fa-folder-o',
  30740. handler: function (sender) {
  30741. }
  30742. }
  30743. ]
  30744. };
  30745. }
  30746. else if (raw.type === 'Model') {
  30747. option = {
  30748. shadow: 'frame', allowOtherMenus: true,
  30749. items: [
  30750. {
  30751. text: '编辑',
  30752. iconCls: 'x-fa fa-edit',
  30753. handler: function (sender) {
  30754. }
  30755. },
  30756. {
  30757. text: '删除',
  30758. iconCls: 'x-fa fa-minus-circle',
  30759. handler: function (sender) {
  30760. }
  30761. },
  30762. '-',
  30763. {
  30764. text: '注册(至菜单)',
  30765. iconCls: 'x-fa fa-sign-in',
  30766. handler: function (sender) {
  30767. }
  30768. },
  30769. {
  30770. text: '新建文件夹',
  30771. iconCls: 'x-fa fa-folder-o',
  30772. handler: function (sender) {
  30773. }
  30774. }
  30775. ]
  30776. };
  30777. }
  30778. }
  30779. else if (raw.exporerType === 3) ;
  30780. else if (raw.exporerType === 50) {
  30781. option = {
  30782. shadow: 'frame', allowOtherMenus: true,
  30783. items: [
  30784. {
  30785. text: '新建流程',
  30786. iconCls: 'x-fa fa-new',
  30787. handler: function (sender) {
  30788. _this.bpmnAdd(sender);
  30789. }
  30790. },
  30791. ]
  30792. };
  30793. }
  30794. else if (raw.exporerType === 51) {
  30795. option = {
  30796. shadow: 'frame', allowOtherMenus: true,
  30797. items: [
  30798. {
  30799. text: '新建流程',
  30800. iconCls: 'x-fa fa-new',
  30801. handler: function (sender) {
  30802. _this.bpmnAdd(sender);
  30803. }
  30804. },
  30805. {
  30806. text: '删除',
  30807. iconCls: 'x-fa fa-minus-circle',
  30808. handler: function (sender) {
  30809. _this.bpmnDelete(sender, raw);
  30810. }
  30811. },
  30812. ]
  30813. };
  30814. }
  30815. else {
  30816. throw Error('暂时不支持!');
  30817. }
  30818. if (option) {
  30819. var treeMenu = new Ext.menu.Menu(option);
  30820. treeMenu.showAt(e.getXY());
  30821. }
  30822. };
  30823. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30824. var _this = this;
  30825. prompt$2('输入工作流名称').then(function (name) {
  30826. createBpmn("", name).then(function (res) {
  30827. if (res.success) {
  30828. msg$1('添加成功');
  30829. }
  30830. _this.reload();
  30831. });
  30832. });
  30833. };
  30834. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30835. var _this = this;
  30836. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30837. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30838. if (res.success) {
  30839. msg$1('添加成功');
  30840. }
  30841. _this.reload();
  30842. });
  30843. });
  30844. };
  30845. BpmnTreeController.prototype.reportAdd = function (sender) {
  30846. var _this = this;
  30847. prompt$2('请输入报表名称').then(function (name) {
  30848. createReportApi(name).then(function (res) {
  30849. if (res.success) {
  30850. msg$1('添加成功');
  30851. handles$1.mainWindow.showReport(res.data, name, function () {
  30852. _this.reload();
  30853. });
  30854. }
  30855. _this.reload();
  30856. });
  30857. });
  30858. };
  30859. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30860. if (record) {
  30861. var reportName = record.get('report_name');
  30862. var reportId = record.get('report_id');
  30863. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30864. }
  30865. };
  30866. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30867. var _this = this;
  30868. if (record) {
  30869. var reportName = record.get('report_name');
  30870. var reportId_1 = record.get('report_id');
  30871. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30872. delReportApi(reportId_1).then(function (res) {
  30873. if (res.success) {
  30874. msg$1('删除成功');
  30875. _this.reload();
  30876. }
  30877. });
  30878. });
  30879. }
  30880. };
  30881. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30882. var _this = this;
  30883. if (!record || record.type !== 'Module') {
  30884. return;
  30885. }
  30886. var reportName = record.text;
  30887. var reportId = record.target;
  30888. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30889. _this.reload();
  30890. });
  30891. };
  30892. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30893. var data = record.raw;
  30894. if (data.type !== 'Module' && data.type !== 'Dir') {
  30895. return;
  30896. }
  30897. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30898. if (data.exporerType === 10) { // 表单
  30899. // this.reportEdit(sender, data)
  30900. handles$1.mainWindow.showReport();
  30901. }
  30902. else if (data.exporerType === 21) {
  30903. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30904. }
  30905. else if (data.exporerType === 22) {
  30906. handles$1.mainWindow.showFormBill();
  30907. }
  30908. else if (data.exporerType === 30) {
  30909. handles$1.mainWindow.showWidgetDesign();
  30910. }
  30911. else if (data.exporerType === 51) {
  30912. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30913. }
  30914. else {
  30915. throw Error('暂时不支持!');
  30916. }
  30917. };
  30918. return BpmnTreeController;
  30919. }());
  30920. var controller$6 = new BpmnTreeController();
  30921. function initBpmnTree () {
  30922. Ext.define('com.yvan.studio.BpmnTree', {
  30923. extend: 'Ext.tree.Panel',
  30924. //extend: 'com.yvan.studio.StateTree',
  30925. xtype: 'bpmntree',
  30926. controller: controller$6,
  30927. scope: controller$6,
  30928. tooltip: '表单定义',
  30929. iconCls: 'x-fa fa-random',
  30930. useArrows: true,
  30931. rootVisible: false,
  30932. colspan: 2,
  30933. lines: true,
  30934. multiSelect: true,
  30935. reload: function () {
  30936. this.controller.reload.call(this, arguments);
  30937. },
  30938. openNode: function () {
  30939. var selection = this.getSelection();
  30940. var _a = __read(selection, 1), record = _a[0];
  30941. if (!record) {
  30942. return;
  30943. }
  30944. var raw = record.raw;
  30945. if (raw.type === 'Dir') {
  30946. return;
  30947. }
  30948. if (raw.type === "Module" && raw.module) ;
  30949. },
  30950. listeners: {
  30951. itemdblclick: 'onDblClick',
  30952. afterrender: 'onLoad',
  30953. // itemverify() {
  30954. // this.openNode()
  30955. // },
  30956. itemcontextmenu: 'onLisenContextMenu'
  30957. },
  30958. tbar: {
  30959. xtype: 'toolbar',
  30960. items: [
  30961. {
  30962. xtype: 'button',
  30963. tooltip: '刷新',
  30964. iconCls: 'x-fa fa-refresh',
  30965. listeners: {
  30966. click: 'reload'
  30967. }
  30968. },
  30969. /*{
  30970. xtype: 'button',
  30971. tooltip: '添加',
  30972. iconCls: 'x-fa fa-plus-circle',
  30973. menu: [
  30974. {
  30975. text: '类别',
  30976. listeners: {
  30977. click: 'classAdd'
  30978. }
  30979. },
  30980. {
  30981. text: '查询',
  30982. listeners: {
  30983. click: 'reportAdd'
  30984. }
  30985. },
  30986. '-',
  30987. {
  30988. text: '单表定义',
  30989. listeners: {
  30990. click: 'singleTableAdd'
  30991. }
  30992. },
  30993. {
  30994. text: '多表定义',
  30995. listeners: {
  30996. click: 'complexTableAdd'
  30997. }
  30998. },
  30999. {
  31000. text: '查询窗口定义',
  31001. listeners: {
  31002. click: 'widgetAdd'
  31003. }
  31004. },
  31005. ],
  31006. },
  31007. {
  31008. xtype: 'button',
  31009. tooltip: '删除',
  31010. iconCls: 'x-fa fa-minus-circle',
  31011. listeners: {
  31012. click: 'reportRemove'
  31013. }
  31014. },*/
  31015. {
  31016. xtype: 'textfield',
  31017. flex: 1,
  31018. reference: "txtFilter",
  31019. emptyText: '搜索过滤',
  31020. enableKeyEvents: true,
  31021. listeners: {
  31022. change: {
  31023. fn: 'filterChanged',
  31024. buffer: 50
  31025. }
  31026. }
  31027. },
  31028. ]
  31029. },
  31030. });
  31031. }
  31032. //# sourceMappingURL=BpmnTree.js.map
  31033. function initToolBox () {
  31034. Ext.define('com.yvan.studio.ToolBox', {
  31035. extend: 'Ext.panel.Panel',
  31036. xtype: 'toolbox',
  31037. tooltip: '工具箱',
  31038. layout: 'fit',
  31039. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31040. border: false,
  31041. beforeRender: function () {
  31042. console.log('beforeRender', this);
  31043. },
  31044. afterRender: function () {
  31045. var $dom = $(this.body.dom).children('div');
  31046. $dom.append(createComponent());
  31047. $dom.css("height", '100%');
  31048. // @ts-ignore
  31049. $('#_toolbox_list').find('li').each(function () {
  31050. var id = $(this).children(':first').attr('drag_id');
  31051. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31052. setDrag(this, node);
  31053. });
  31054. }
  31055. });
  31056. }
  31057. function setDrag(el, node) {
  31058. new Ext.drag.Source({
  31059. element: el,
  31060. proxy: {
  31061. type: 'placeholder',
  31062. getElement: function (info) {
  31063. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31064. return Ext.getBody().createChild({
  31065. html: html
  31066. });
  31067. }
  31068. },
  31069. listeners: {
  31070. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31071. dragend: delegateDragend.bind(getDesignInstance(), node),
  31072. },
  31073. sourceVjson: node.code,
  31074. dragType: node.dragType
  31075. });
  31076. }
  31077. function createComponent() {
  31078. var template = [];
  31079. for (var i = 0; i < codeLines.length; i++) {
  31080. var item = codeLines[i];
  31081. if (!item.dragHtml) {
  31082. continue;
  31083. }
  31084. var $ele = $("<li>" + item.dragHtml + "</li>");
  31085. $ele.children(':first').attr('drag_id', item.id);
  31086. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31087. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31088. }
  31089. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31090. return html;
  31091. }
  31092. var codeLines = [
  31093. {
  31094. id: '$label',
  31095. value: layoutOrXtypeNameMap.label + ' - label',
  31096. icon: "fa fa-font",
  31097. dragType: "col-item",
  31098. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31099. code: {
  31100. xtype: 'label',
  31101. text: '文本' + _$2.uniqueId('_l')
  31102. }
  31103. },
  31104. {
  31105. id: '$text',
  31106. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31107. icon: "fa fa-edit",
  31108. dragType: "col-item",
  31109. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31110. code: {
  31111. xtype: 'textfield',
  31112. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31113. }
  31114. },
  31115. {
  31116. id: '$textarea',
  31117. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31118. icon: "fa fa-edit",
  31119. dragType: "col-item",
  31120. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31121. code: {
  31122. xtype: 'textareafield',
  31123. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31124. }
  31125. },
  31126. {
  31127. id: '$number',
  31128. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31129. icon: "fa fa-edit",
  31130. dragType: "col-item",
  31131. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31132. code: {
  31133. xtype: 'numberfield',
  31134. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31135. }
  31136. },
  31137. {
  31138. id: '$combo',
  31139. value: layoutOrXtypeNameMap.combo + ' - combo',
  31140. icon: "fa fa-angle-double-down",
  31141. dragType: "col-item",
  31142. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31143. code: {
  31144. xtype: 'combo',
  31145. fieldLabel: '请选择',
  31146. data: [
  31147. { id: 'id1', text: '选项1' },
  31148. { id: 'id2', text: '选项2' },
  31149. { id: 'id3', text: '选项3' },
  31150. ],
  31151. }
  31152. },
  31153. {
  31154. id: '$datebox',
  31155. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31156. icon: "fa fa-calendar",
  31157. dragType: "col-item",
  31158. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31159. code: {
  31160. xtype: "datefield",
  31161. fieldLabel: '日期',
  31162. }
  31163. },
  31164. {
  31165. id: '$searchbox',
  31166. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31167. icon: "fa fa-search",
  31168. dragType: "col-item",
  31169. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31170. code: {
  31171. xtype: 'searchfield',
  31172. fieldLabel: '搜索框',
  31173. }
  31174. },
  31175. {
  31176. id: '$combogrid',
  31177. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31178. icon: "fa fa-table",
  31179. dragType: "col-item",
  31180. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31181. code: {
  31182. xtype: 'combogrid',
  31183. fieldLabel: '下拉表'
  31184. }
  31185. },
  31186. {
  31187. id: '$combotree',
  31188. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31189. icon: "fa fa-tree",
  31190. dragType: "col-item",
  31191. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31192. code: {
  31193. xtype: 'combotree',
  31194. fieldLabel: '下拉树',
  31195. displayField: 'text',
  31196. rootVisible: false
  31197. }
  31198. },
  31199. {
  31200. id: '$button',
  31201. value: layoutOrXtypeNameMap.button + ' - button',
  31202. icon: 'fa fa-sign-in',
  31203. dragType: "col-item",
  31204. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31205. code: {
  31206. text: '按钮',
  31207. iconCls: 'x-fa fa-bars',
  31208. xtype: 'button'
  31209. }
  31210. },
  31211. {
  31212. id: '$checkbox',
  31213. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31214. icon: 'fa fa-check-square',
  31215. dragType: "col-item",
  31216. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31217. code: {
  31218. xtype: 'checkbox',
  31219. boxLabel: '勾选框',
  31220. hideLabel: true,
  31221. margin: '0 0 0 15',
  31222. flex: 0,
  31223. }
  31224. },
  31225. {
  31226. id: '$checkboxgroup',
  31227. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31228. icon: 'fa fa-check-square',
  31229. dragType: "col-item",
  31230. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31231. code: {
  31232. xtype: 'checkboxgroup',
  31233. fieldLabel: '勾选组',
  31234. items: [
  31235. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31236. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31237. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31238. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31239. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31240. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31241. ]
  31242. }
  31243. },
  31244. {
  31245. id: '$radio',
  31246. value: layoutOrXtypeNameMap.radio + ' - radio',
  31247. icon: 'fa fa-dot-circle-o',
  31248. dragType: "col-item",
  31249. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31250. code: {
  31251. xtype: "radio",
  31252. fieldLabel: "请选择",
  31253. }
  31254. },
  31255. {
  31256. id: '$radiogroup',
  31257. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31258. icon: 'fa fa-dot-circle-o',
  31259. dragType: "col-item",
  31260. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31261. code: {
  31262. xtype: "radiogroup",
  31263. fieldLabel: "请选择",
  31264. items: [
  31265. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31266. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31267. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31268. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31269. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31270. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31271. ]
  31272. }
  31273. },
  31274. {
  31275. id: '$cols',
  31276. value: layoutOrXtypeNameMap.cols + ' - cols',
  31277. icon: 'fa fa-list-alt',
  31278. dragType: "cols-container",
  31279. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31280. code: {
  31281. xtype: 'cols',
  31282. items: [
  31283. {
  31284. xtype: 'textfield',
  31285. fieldLabel: '输入框',
  31286. },
  31287. ],
  31288. }
  31289. },
  31290. {
  31291. id: '$container',
  31292. value: layoutOrXtypeNameMap.container + ' - container',
  31293. icon: 'fa fa-flag',
  31294. dragType: "col-item",
  31295. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31296. code: {
  31297. xtype: 'container',
  31298. border: false,
  31299. layout: 'hbox',
  31300. }
  31301. },
  31302. {
  31303. id: '$fit',
  31304. value: layoutOrXtypeNameMap.fit + ' - fit',
  31305. icon: 'fa fa-flag',
  31306. dragType: "rows-container",
  31307. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31308. code: {
  31309. border: false,
  31310. layout: 'fit',
  31311. items: [
  31312. {
  31313. xtype: 'container',
  31314. border: false,
  31315. layout: 'hbox',
  31316. }
  31317. ]
  31318. }
  31319. },
  31320. ];
  31321. // @ts-ignore
  31322. // export default ToolBoxCmp
  31323. //# sourceMappingURL=ToolBox.js.map
  31324. var that = undefined;
  31325. function initPropertyDesign () {
  31326. Ext.define('com.yvan.studio.PropertyDesign', {
  31327. extend: 'Ext.panel.Panel',
  31328. xtype: 'propertydesign',
  31329. name: "PropertyDesign",
  31330. tooltip: '属性',
  31331. iconCls: 'x-fa fa-newspaper-o',
  31332. reference: 'propertygrid',
  31333. layout: 'border',
  31334. border: false,
  31335. moduleId: null,
  31336. currentComponentVJson: null,
  31337. currentComponentPropertyEditSource: null,
  31338. vjson: null,
  31339. propertyHandle: null,
  31340. moduleSubscribe: null,
  31341. items: [
  31342. new Ext.grid.property.Grid({
  31343. sortableColumns: false,
  31344. region: 'center',
  31345. listeners: {
  31346. propertychange: function (source, propName, value, oldValue, eOpts) {
  31347. value = _.trim(value);
  31348. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31349. return item.label === propName;
  31350. });
  31351. if (a.type === 'listeners') {
  31352. if (value) {
  31353. if (that.currentComponentVJson.listeners) {
  31354. that.currentComponentVJson.listeners[propName] = value;
  31355. }
  31356. else {
  31357. var t = {};
  31358. t[propName] = value;
  31359. that.currentComponentVJson.listeners = t;
  31360. }
  31361. }
  31362. else {
  31363. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31364. if (!value1) {
  31365. delete that.currentComponentVJson.listeners[key];
  31366. }
  31367. else if (key === propName) {
  31368. delete that.currentComponentVJson.listeners[key];
  31369. }
  31370. });
  31371. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31372. delete that.currentComponentVJson.listeners;
  31373. }
  31374. }
  31375. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31376. vjson: that.vjson,
  31377. from: that.name,
  31378. ignoreRenderUI: true
  31379. });
  31380. }
  31381. else if (a.type === 'fix') {
  31382. if (!value) {
  31383. delete that.currentComponentVJson[propName];
  31384. }
  31385. else {
  31386. that.currentComponentVJson[propName] = value.split("\r\n");
  31387. }
  31388. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31389. vjson: that.vjson,
  31390. from: that.name,
  31391. ignoreRenderUI: true
  31392. });
  31393. }
  31394. else if (a.type === 'bind') {
  31395. var bind_1 = that.currentComponentVJson.bind;
  31396. if (typeof bind_1 === 'string' && a.id === "value") {
  31397. if (value) {
  31398. that.currentComponentVJson.bind = value;
  31399. }
  31400. else {
  31401. delete that.currentComponentVJson.bind;
  31402. }
  31403. }
  31404. else {
  31405. // 转成bind对象
  31406. if (typeof bind_1 === 'string') {
  31407. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31408. }
  31409. if (value) {
  31410. if (bind_1) {
  31411. bind_1[a.id] = value;
  31412. }
  31413. else {
  31414. var t = {};
  31415. t[a.id] = value;
  31416. that.currentComponentVJson.bind = t;
  31417. }
  31418. }
  31419. else {
  31420. _.forOwn(bind_1, function (value1, key) {
  31421. if (!value1) {
  31422. delete bind_1[key];
  31423. }
  31424. else if (key === a.id) {
  31425. delete bind_1[key];
  31426. }
  31427. });
  31428. if (Object.keys(bind_1).length <= 0) {
  31429. delete that.currentComponentVJson.bind;
  31430. }
  31431. }
  31432. }
  31433. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31434. vjson: that.vjson,
  31435. from: that.name,
  31436. ignoreRenderUI: true
  31437. });
  31438. }
  31439. else if (a.type === 'boolean') {
  31440. if (!value) {
  31441. delete that.currentComponentVJson[propName];
  31442. }
  31443. else if (value === 'false') {
  31444. that.currentComponentVJson[propName] = false;
  31445. }
  31446. else if (value === 'true') {
  31447. that.currentComponentVJson[propName] = true;
  31448. }
  31449. else {
  31450. that.currentComponentVJson[propName] = value;
  31451. }
  31452. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31453. vjson: that.vjson,
  31454. from: that.name
  31455. });
  31456. }
  31457. else {
  31458. that.currentComponentVJson[propName] = value;
  31459. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31460. vjson: that.vjson,
  31461. from: that.name
  31462. });
  31463. }
  31464. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31465. },
  31466. }
  31467. })
  31468. ],
  31469. listeners: {
  31470. // afterrender() {
  31471. // this.propertyHandle.setSource({
  31472. // "(name)": "My Object",
  31473. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31474. // "Available": false, // boolean type
  31475. // "Version": .01, // decimal type
  31476. // "Description": "A test object"
  31477. // });
  31478. // }
  31479. },
  31480. initComponent: function () {
  31481. var _this = this;
  31482. this.propertyHandle = this.items[0];
  31483. setPropertyPanel(this);
  31484. that = this;
  31485. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31486. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31487. _this.setVjson(moduleId, from, ignoreRenderUI);
  31488. });
  31489. return this.superclass.initComponent.apply(this, arguments);
  31490. },
  31491. setVjson: function (moduleId, from, ignoreRenderUI) {
  31492. var _this = this;
  31493. // if (this.moduleId === null && moduleId) {
  31494. // this.moduleId = moduleId
  31495. // }
  31496. if (moduleId !== this.moduleId || from === this.name) {
  31497. return;
  31498. }
  31499. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31500. if (!moduleObj) {
  31501. return;
  31502. }
  31503. this.vjson = moduleObj.moduleObj.vjson;
  31504. this.setPropertyAndEventSource();
  31505. if (this.componentSelectionChangeSubscribe) {
  31506. this.componentSelectionChangeSubscribe.cancel();
  31507. this.componentSelectionChangeSubscribe = null;
  31508. }
  31509. if (this.updateVjsonChangeSubscribe) {
  31510. this.updateVjsonChangeSubscribe.cancel();
  31511. this.updateVjsonChangeSubscribe = null;
  31512. }
  31513. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31514. var id = _a.id, from = _a.from;
  31515. _this.onComponentSelectionChange(id, from);
  31516. });
  31517. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31518. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31519. _this.updateVjson(vjson, from, ignoreRenderUI);
  31520. });
  31521. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31522. this.onComponentSelectionChange(id, from);
  31523. },
  31524. updateVjson: function (vjson, from, ignoreRenderUI) {
  31525. if (!vjson || from === this.name) {
  31526. return;
  31527. }
  31528. this.vjson = vjson;
  31529. this.setPropertyAndEventSource();
  31530. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31531. this.onComponentSelectionChange(id, from);
  31532. },
  31533. onComponentSelectionChange: function (id, from) {
  31534. if (from !== this.name) {
  31535. this.currentComponentVJson = findInCode(this.vjson, id);
  31536. this.setPropertyAndEventSource();
  31537. }
  31538. },
  31539. setPropertyAndEventSource: function () {
  31540. var _this = this;
  31541. this.propertyHandle.setSource({});
  31542. if (!this.currentComponentVJson) {
  31543. return;
  31544. }
  31545. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31546. var v = xtype;
  31547. // 选中的对象可能是组
  31548. if (!v) {
  31549. if (_.has(this.currentComponentVJson, "cols")) {
  31550. v = "cols";
  31551. }
  31552. else if (_.has(this.currentComponentVJson, "rows")) {
  31553. v = "rows";
  31554. }
  31555. }
  31556. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31557. if (!pd) {
  31558. // 这个组件没有属性
  31559. this.propertyHandle.setSource({});
  31560. return;
  31561. }
  31562. var funcArr = this.getAllfuncs();
  31563. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31564. // disabled: true,
  31565. displayField: 'name',
  31566. valueField: 'name',
  31567. store: funcArr,
  31568. }); };
  31569. // ====================== 属性
  31570. var elements = [];
  31571. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31572. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31573. var props = pd.getPropsByGroup(group);
  31574. if (props.length <= 0)
  31575. return; //没有这一组属性
  31576. // 显示 group 的中文名
  31577. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31578. if (caption[i] === '绑定') {
  31579. _.each(props, function (prop) {
  31580. elements.push({
  31581. label: "_" + prop.name,
  31582. type: "bind",
  31583. id: prop.name,
  31584. desc: prop.desc,
  31585. editor: new Ext.form.field.Text()
  31586. });
  31587. });
  31588. }
  31589. else {
  31590. _.each(props, function (prop) {
  31591. if (_.isArray(prop.type)) {
  31592. elements.push({
  31593. label: prop.name,
  31594. type: "combo",
  31595. options: prop.type,
  31596. id: prop.name,
  31597. desc: prop.desc
  31598. });
  31599. return;
  31600. }
  31601. switch (prop.type) {
  31602. case 'boolean': {
  31603. elements.push({
  31604. label: prop.name,
  31605. id: prop.name,
  31606. desc: prop.desc,
  31607. type: 'boolean',
  31608. editor: new Ext.form.field.ComboBox({
  31609. displayField: 'text',
  31610. valueField: 'id',
  31611. store: new Ext.data.Store({
  31612. field: ['id', 'text'],
  31613. data: [
  31614. { id: 'true', text: 'True' },
  31615. { id: 'false', text: 'False' },
  31616. ]
  31617. })
  31618. }),
  31619. });
  31620. break;
  31621. }
  31622. case 'number': {
  31623. elements.push({
  31624. label: prop.name,
  31625. type: "number",
  31626. id: prop.name,
  31627. isNum: true,
  31628. desc: prop.desc,
  31629. editor: new Ext.form.field.Number()
  31630. });
  31631. break;
  31632. }
  31633. case 'string': {
  31634. elements.push({
  31635. label: prop.name,
  31636. type: "string",
  31637. id: prop.name,
  31638. desc: prop.desc,
  31639. editor: new Ext.form.field.Text()
  31640. });
  31641. break;
  31642. }
  31643. case 'listeners': {
  31644. elements.push({
  31645. label: prop.name,
  31646. type: "listeners",
  31647. id: prop.name,
  31648. desc: prop.desc,
  31649. editor: createFuncEditor()
  31650. });
  31651. break;
  31652. }
  31653. case 'fix': {
  31654. elements.push({
  31655. label: prop.name,
  31656. type: "fix",
  31657. id: prop.name,
  31658. desc: prop.desc,
  31659. editor: new Ext.form.field.Text()
  31660. });
  31661. break;
  31662. }
  31663. case 'object': {
  31664. break;
  31665. }
  31666. // case 'dataSource' : {
  31667. // break;
  31668. // }
  31669. case 'valid': {
  31670. break;
  31671. }
  31672. default:
  31673. elements.push({
  31674. label: prop.name,
  31675. type: prop.type,
  31676. id: prop.name,
  31677. desc: prop.desc,
  31678. editor: new Ext.form.field.Text({ disabled: true })
  31679. });
  31680. console.error('不支持的编辑类型', prop);
  31681. }
  31682. });
  31683. }
  31684. });
  31685. this.currentComponentPropertyEditSource = elements;
  31686. var panel1Source = {};
  31687. var panel1SourceConfig = {};
  31688. _.each(elements, function (item) {
  31689. var _a;
  31690. if (item.type === "listeners") {
  31691. var listeners = _this.currentComponentVJson.listeners;
  31692. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31693. }
  31694. else if (item.type === "fix") {
  31695. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31696. }
  31697. else if (item.type === "bind") {
  31698. var bind = _this.currentComponentVJson.bind;
  31699. if (typeof bind === 'string' && item.id === 'value') {
  31700. panel1Source[item.label] = bind;
  31701. }
  31702. else {
  31703. panel1Source[item.label] = bind ? bind[item.id] : '';
  31704. }
  31705. }
  31706. else {
  31707. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31708. }
  31709. panel1Source[item.label] = panel1Source[item.label] || '';
  31710. panel1SourceConfig[item.label] = { editor: item.editor };
  31711. });
  31712. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31713. },
  31714. getAllfuncs: function () {
  31715. var _a, _b;
  31716. 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;
  31717. var scopeFuncs = [];
  31718. _.forEach(arr, function (item) {
  31719. scopeFuncs.push({ name: "scope." + item.name });
  31720. });
  31721. return scopeFuncs;
  31722. }
  31723. });
  31724. }
  31725. //# sourceMappingURL=PropertyDesign.js.map
  31726. function initViewOutlineTree () {
  31727. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31728. extend: 'Ext.tree.Panel',
  31729. xtype: 'viewoutlinetree',
  31730. name: "ViewOutlineTree",
  31731. tooltip: '设计大纲',
  31732. iconCls: 'x-fa fa-list',
  31733. rootVisible: false,
  31734. useArrows: true,
  31735. allowDeselect: true,
  31736. colspan: 2,
  31737. lines: false,
  31738. reference: 'viewoutlinetree',
  31739. multiSelect: true,
  31740. _saveStateFlag: true,
  31741. keyMapEnabled: true,
  31742. moduleId: null,
  31743. vjson: null,
  31744. columns: [
  31745. {
  31746. xtype: 'treecolumn',
  31747. text: '布局',
  31748. dataIndex: 'layoutNameDesc',
  31749. flex: 2,
  31750. sortable: true
  31751. }, {
  31752. text: '组件',
  31753. dataIndex: 'xtype',
  31754. flex: 1,
  31755. sortable: true,
  31756. align: 'center',
  31757. }
  31758. ],
  31759. listeners: {
  31760. itemcontextmenu: function (sender, node, element, idx, e) {
  31761. e.preventDefault();
  31762. this.rightClickTreeNode(sender, node, element, idx, e);
  31763. },
  31764. select: function (sender, node, index, e) {
  31765. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31766. },
  31767. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31768. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31769. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31770. }
  31771. }
  31772. },
  31773. initComponent: function () {
  31774. var _this = this;
  31775. setViewoutlinetree(this);
  31776. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31777. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31778. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31779. });
  31780. return this.superclass.initComponent.apply(this, arguments);
  31781. },
  31782. clear: function () {
  31783. this.setRootNode(null);
  31784. },
  31785. onChangModule: function (moduleId, oldModuleId, from) {
  31786. if (!moduleId || moduleId !== this.moduleId) {
  31787. return;
  31788. }
  31789. if (moduleStore.getModuleObject(moduleId)) {
  31790. this.setVjson(moduleId, from);
  31791. }
  31792. },
  31793. setVjson: function (moduleId, from, ignoreRenderUI) {
  31794. var _this = this;
  31795. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31796. return;
  31797. }
  31798. this.moduleId = moduleId;
  31799. // if (from === this.name) {
  31800. // return
  31801. // }
  31802. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31803. this.setTreeValue();
  31804. if (this.componentSelectionChangeSubscribe) {
  31805. this.componentSelectionChangeSubscribe.cancel();
  31806. this.componentSelectionChangeSubscribe = null;
  31807. }
  31808. if (this.setVjsonChangeSubscribe) {
  31809. this.setVjsonChangeSubscribe.cancel();
  31810. this.setVjsonChangeSubscribe = null;
  31811. }
  31812. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31813. var id = _a.id, from = _a.from;
  31814. return _this.onComponentSelectionChange(id, from);
  31815. });
  31816. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31817. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31818. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31819. });
  31820. },
  31821. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31822. if (!vjson || from === this.name) {
  31823. return;
  31824. }
  31825. this.vjson = vjson;
  31826. this.setTreeValue();
  31827. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31828. if (id) {
  31829. this.selectPath(id);
  31830. }
  31831. },
  31832. onComponentSelectionChange: function (id, from) {
  31833. if (from !== this.name) {
  31834. if (id) {
  31835. this.selectPath(id);
  31836. }
  31837. else {
  31838. this.setTreeValue();
  31839. }
  31840. }
  31841. },
  31842. setTreeValue: function () {
  31843. var outlineVj = {};
  31844. _.forOwn(this.vjson, function (obj, key) {
  31845. if (key !== 'viewModel' && key !== 'store') {
  31846. outlineVj[key] = _.cloneDeep(obj);
  31847. }
  31848. });
  31849. getLayoutOutline(outlineVj);
  31850. this.setRootNode(outlineVj);
  31851. },
  31852. rightClickTreeNode: function (sender, node, element, idx, e) {
  31853. var raw = node.data;
  31854. var option = {};
  31855. // 右键
  31856. option = {
  31857. shadow: 'frame',
  31858. allowOtherMenus: true,
  31859. items: []
  31860. };
  31861. var switchType = raw.layoutName;
  31862. if (raw.layoutName === 'north' ||
  31863. raw.layoutName === 'south' ||
  31864. raw.layoutName === 'west' ||
  31865. raw.layoutName === 'east' ||
  31866. raw.layoutName === 'center' ||
  31867. raw.layoutName === 'tbar' ||
  31868. raw.layoutName === 'fbar') {
  31869. switchType = raw.xtype || raw.layout;
  31870. }
  31871. var itemArr = [];
  31872. var hasTbar = false, hasFbar = false, hasBody = false;
  31873. if (raw.hasOwnProperty("children")) {
  31874. _.forEach(raw.children, function (value) {
  31875. if (value.layoutName === 'tbar') {
  31876. hasTbar = true;
  31877. }
  31878. else if (value.layoutName === 'fbar') {
  31879. hasFbar = true;
  31880. }
  31881. else {
  31882. hasBody = true;
  31883. }
  31884. });
  31885. }
  31886. switch (switchType) {
  31887. case 'fit':
  31888. if (!hasTbar) {
  31889. itemArr.push('tbar');
  31890. }
  31891. if (!hasFbar) {
  31892. itemArr.push('fbar');
  31893. }
  31894. if (!hasBody) {
  31895. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31896. }
  31897. option.items = this.menuNew(itemArr, raw);
  31898. break;
  31899. case 'border':
  31900. if (!hasTbar) {
  31901. itemArr.push('tbar');
  31902. }
  31903. if (!hasFbar) {
  31904. itemArr.push('fbar');
  31905. }
  31906. itemArr.push('cnsew');
  31907. option.items = this.menuNew(itemArr, raw);
  31908. break;
  31909. // case 'tbar':
  31910. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31911. // break;
  31912. // case 'fbar':
  31913. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31914. // break;
  31915. case 'tabpanel':
  31916. if (!hasTbar) {
  31917. itemArr.push('tbar');
  31918. }
  31919. if (!hasFbar) {
  31920. itemArr.push('fbar');
  31921. }
  31922. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31923. option.items = this.menuNew(itemArr, raw);
  31924. break;
  31925. case 'yvgrid':
  31926. if (!hasTbar) {
  31927. itemArr.push('tbar');
  31928. }
  31929. option.items = this.menuNew(itemArr, raw);
  31930. break;
  31931. case 'tree':
  31932. if (!hasTbar) {
  31933. itemArr.push('tbar');
  31934. }
  31935. if (!hasFbar) {
  31936. itemArr.push('fbar');
  31937. }
  31938. option.items = this.menuNew(itemArr, raw);
  31939. break;
  31940. case 'fieldset':
  31941. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31942. break;
  31943. case 'form':
  31944. if (!hasTbar) {
  31945. itemArr.push('tbar');
  31946. }
  31947. if (!hasFbar) {
  31948. itemArr.push('fbar');
  31949. }
  31950. itemArr.push('form', 'fieldset', 'cols');
  31951. option.items = this.menuNew(itemArr, raw);
  31952. break;
  31953. case 'toolbar':
  31954. itemArr.push('button', 'textfield', 'label', 'combo');
  31955. option.items = this.menuNew(itemArr, raw);
  31956. break;
  31957. // case 'fbar':
  31958. // itemArr.push('button', 'textfield', 'label', 'combo')
  31959. // option.items = this.menuNew(itemArr, raw)
  31960. // break
  31961. default:
  31962. option.items = this.menuNew(itemArr, raw);
  31963. break;
  31964. }
  31965. var treeMenu = new Ext.menu.Menu(option);
  31966. treeMenu.showAt(e.getXY());
  31967. },
  31968. newItem: function (viewType, raw, region) {
  31969. var itemVjson = {};
  31970. switch (viewType) {
  31971. case 'fit':
  31972. itemVjson.layout = 'fit';
  31973. itemVjson.items = [];
  31974. break;
  31975. case 'border':
  31976. itemVjson.layout = 'border';
  31977. itemVjson.items = [];
  31978. break;
  31979. case 'toolbar':
  31980. itemVjson.xtype = 'toolbar';
  31981. itemVjson.title = 'toolbar';
  31982. itemVjson.items = [
  31983. {
  31984. xtype: 'button',
  31985. text: 'button'
  31986. }
  31987. ];
  31988. break;
  31989. case 'tabpanel':
  31990. itemVjson.xtype = 'tabpanel';
  31991. itemVjson.layout = 'fit';
  31992. itemVjson.items = [];
  31993. break;
  31994. case 'yvgrid':
  31995. itemVjson.xtype = 'yvgrid';
  31996. itemVjson.layout = 'fit';
  31997. itemVjson.pagination = false;
  31998. itemVjson.columns = [
  31999. {
  32000. dataIndex: "skuId",
  32001. header: "SKU_ID",
  32002. },
  32003. ];
  32004. break;
  32005. case 'tree':
  32006. itemVjson.xtype = 'treepanel';
  32007. itemVjson.layout = 'fit';
  32008. break;
  32009. case 'fieldset':
  32010. case 'form':
  32011. itemVjson.xtype = viewType;
  32012. itemVjson.title = viewType;
  32013. itemVjson.items = [
  32014. {
  32015. xtype: 'cols',
  32016. items: [
  32017. {
  32018. xtype: 'textfield',
  32019. fieldLabel: '输入框'
  32020. }
  32021. ]
  32022. }
  32023. ];
  32024. break;
  32025. case 'cols':
  32026. itemVjson.xtype = 'cols';
  32027. itemVjson.items = [
  32028. {
  32029. xtype: 'textfield',
  32030. fieldLabel: '输入框'
  32031. }
  32032. ];
  32033. break;
  32034. case 'button':
  32035. itemVjson.xtype = 'button';
  32036. itemVjson.text = '按钮';
  32037. itemVjson.iconCls = 'x-fa fa-plus';
  32038. break;
  32039. case 'textfield':
  32040. itemVjson.xtype = 'textfield';
  32041. itemVjson.fieldLabel = '输入框';
  32042. break;
  32043. case 'combo':
  32044. itemVjson.xtype = 'combo';
  32045. itemVjson.fieldLabel = '下拉框';
  32046. break;
  32047. case 'label':
  32048. itemVjson.xtype = 'label';
  32049. itemVjson.text = '文本';
  32050. break;
  32051. }
  32052. var target = findInCode(this.vjson, raw.id);
  32053. if (region) {
  32054. if (region === 'tbar' || region === 'fbar') {
  32055. target[region] = itemVjson;
  32056. }
  32057. else {
  32058. itemVjson.region = region;
  32059. itemVjson.split = true;
  32060. if (region === 'north' || region === 'south') {
  32061. itemVjson.height = '30%';
  32062. itemVjson.collapsible = true;
  32063. }
  32064. else if (region === 'west' || region === 'east') {
  32065. itemVjson.width = '30%';
  32066. itemVjson.collapsible = true;
  32067. }
  32068. target.items.push(itemVjson);
  32069. }
  32070. }
  32071. else {
  32072. if (target.xtype === 'tabpanel') {
  32073. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32074. }
  32075. target.items.push(itemVjson);
  32076. }
  32077. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32078. },
  32079. menuNew: function (typeArr, raw, region) {
  32080. var that = this;
  32081. var reArr = [];
  32082. typeArr.forEach(function (value) {
  32083. if (value === 'cnsew') {
  32084. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32085. }
  32086. else if (value === 'tbar' || value === 'fbar') {
  32087. reArr.push(that.menuNewTFBar(value, raw));
  32088. }
  32089. else {
  32090. reArr.push({
  32091. text: '新建' + layoutOrXtypeNameMap[value],
  32092. iconCls: 'x-fa fa-plus',
  32093. handler: function (sender) {
  32094. that.newItem(value, raw, region);
  32095. }
  32096. });
  32097. }
  32098. reArr.push("-");
  32099. });
  32100. if (region) {
  32101. reArr.pop();
  32102. return reArr;
  32103. }
  32104. reArr.push({
  32105. text: '高级属性',
  32106. iconCls: 'x-fa fa-cog',
  32107. handler: function (sender) {
  32108. var vj = findInCode(that.vjson, raw.id);
  32109. that.advancedSettingWindow(vj);
  32110. }
  32111. }, {
  32112. text: '上移',
  32113. iconCls: 'x-fa fa-trash',
  32114. handler: function (sender) {
  32115. that.moveCmp(raw.id, 'up');
  32116. }
  32117. }, {
  32118. text: '置顶',
  32119. iconCls: 'x-fa fa-trash',
  32120. handler: function (sender) {
  32121. that.moveCmp(raw.id, 'top');
  32122. }
  32123. }, {
  32124. text: '置底',
  32125. iconCls: 'x-fa fa-trash',
  32126. handler: function (sender) {
  32127. that.moveCmp(raw.id, 'bottom');
  32128. }
  32129. }, {
  32130. text: '下移',
  32131. iconCls: 'x-fa fa-trash',
  32132. handler: function (sender) {
  32133. that.moveCmp(raw.id, 'down');
  32134. }
  32135. }, {
  32136. text: '删除',
  32137. iconCls: 'x-fa fa-trash',
  32138. handler: function (sender) {
  32139. deletVjsonById(that.vjson, raw.id);
  32140. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32141. }
  32142. });
  32143. return reArr;
  32144. },
  32145. menuNewCNSEW: function (raw) {
  32146. var that = this;
  32147. var arr = ['center', 'north', 'south', 'west', 'east'];
  32148. if (raw.hasOwnProperty("children")) {
  32149. _.forEach(raw.children, function (value) {
  32150. _.remove(arr, function (it) {
  32151. return it === value.layoutName;
  32152. });
  32153. });
  32154. }
  32155. var reArr = [];
  32156. arr.forEach(function (value) {
  32157. reArr.push({
  32158. text: layoutOrXtypeNameMap[value],
  32159. iconCls: 'x-fa fa-plus',
  32160. menu: {
  32161. showSeparator: true,
  32162. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32163. }
  32164. });
  32165. reArr.push("-");
  32166. });
  32167. reArr.pop();
  32168. return reArr;
  32169. },
  32170. menuNewTFBar: function (barType, raw) {
  32171. var that = this;
  32172. var reObj = {
  32173. text: layoutOrXtypeNameMap[barType],
  32174. iconCls: 'x-fa fa-plus',
  32175. menu: {
  32176. showSeparator: true,
  32177. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32178. }
  32179. };
  32180. return reObj;
  32181. },
  32182. moveCmp: function (id, moveType) {
  32183. var arr = findArrayContainer(this.vjson, id);
  32184. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32185. if (index < 0) {
  32186. return;
  32187. }
  32188. switch (moveType) {
  32189. case 'up':
  32190. if (index > 0) {
  32191. var o = arr[index];
  32192. arr[index] = arr[index - 1];
  32193. arr[index - 1] = o;
  32194. }
  32195. else {
  32196. return;
  32197. }
  32198. break;
  32199. case 'down':
  32200. if (index < arr.length - 1) {
  32201. var o = arr[index];
  32202. arr[index] = arr[index + 1];
  32203. arr[index + 1] = o;
  32204. }
  32205. else {
  32206. return;
  32207. }
  32208. break;
  32209. case 'top':
  32210. if (index > 0) {
  32211. var o = arr[index];
  32212. arr[index] = arr[0];
  32213. arr[0] = o;
  32214. }
  32215. else {
  32216. return;
  32217. }
  32218. break;
  32219. case 'bottom':
  32220. if (index < arr.length - 1) {
  32221. var o = arr[index];
  32222. arr[index] = arr[arr.length - 1];
  32223. arr[arr.length - 1] = o;
  32224. }
  32225. else {
  32226. return;
  32227. }
  32228. break;
  32229. }
  32230. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32231. }
  32232. });
  32233. }
  32234. //# sourceMappingURL=ViewOutlineTree.js.map
  32235. function init$2 () {
  32236. window['native'] = native;
  32237. native.init();
  32238. init();
  32239. instance.getAllDomain().finally(function () {
  32240. });
  32241. initStateTree();
  32242. initDashboard();
  32243. initFileTree();
  32244. initDbTree();
  32245. initReportGrid();
  32246. initGroovyEditor();
  32247. initJsEditor$1();
  32248. initJsonEditor$1();
  32249. initSqlEditor$1();
  32250. initTemplateEditor();
  32251. initDict$1();
  32252. initBpmnTree();
  32253. initToolBox();
  32254. initPropertyDesign();
  32255. initViewOutlineTree();
  32256. initWidget();
  32257. initWhLayout();
  32258. initApiTree();
  32259. initTaskTree();
  32260. initLogsTree();
  32261. initDevOpsTree();
  32262. initTerminal();
  32263. initMonitorTree();
  32264. initHomeTree();
  32265. }
  32266. //# sourceMappingURL=init.js.map
  32267. var studio = {
  32268. init: init$2,
  32269. handles: handles$1,
  32270. Workbench: Workbench
  32271. };
  32272. //# sourceMappingURL=index.js.map
  32273. exports.axios = axios;
  32274. exports.qs = Qs;
  32275. exports.lodash = _$2;
  32276. exports.jquery = $$2;
  32277. exports.moment = moment$1;
  32278. exports.recast = recast;
  32279. exports.XLSX = XLSX;
  32280. exports.Defaults = Defaults;
  32281. exports.ExcelImportDialog = ExcelImportDialog;
  32282. exports.Lib = Lib;
  32283. exports.LibParam = LibParam;
  32284. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32285. exports.ReportScope = ReportScope;
  32286. exports.SIMPLE_RE = SIMPLE_RE;
  32287. exports.Scope = Scope;
  32288. exports.ScopeEngine = ScopeEngine;
  32289. exports.SystemEventFu = SystemEventFu;
  32290. exports.ajax = ajax;
  32291. exports.baseConfigProcess = baseConfigProcess;
  32292. exports.baseConfigProcessList = baseConfigProcessList;
  32293. exports.buildPlus = buildPlus;
  32294. exports.buildReportScope = buildReportScope;
  32295. exports.calcExpress = calcExpress;
  32296. exports.calcObject = calcObject;
  32297. exports.calcObjectFlat = calcObjectFlat;
  32298. exports.clearViewModel = clearViewModel;
  32299. exports.clearViewModelByLookup = clearViewModelByLookup;
  32300. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32301. exports.clearViewModelValues = clearViewModelValues;
  32302. exports.commitMe = commitMe;
  32303. exports.confirm = confirm;
  32304. exports.createAjax = createAjax;
  32305. exports.createUUID = createUUID;
  32306. exports.deepTravJson = deepTravJson;
  32307. exports.downLoad = downLoad;
  32308. exports.evalFunction = evalFunction;
  32309. exports.extend = extend;
  32310. exports.flatRow = flatRow;
  32311. exports.getApiConvert = getApiConvert;
  32312. exports.getGridEditRows = getGridEditRows;
  32313. exports.getParentGrid = getParentGrid;
  32314. exports.getPinyin = getPinyin;
  32315. exports.getRegList = getRegList;
  32316. exports.getRegParamList = getRegParamList;
  32317. exports.getScopeOnCreate = getScopeOnCreate;
  32318. exports.init = init$1;
  32319. exports.insertGridRow = insertGridRow;
  32320. exports.invokeServer = invokeServer$1;
  32321. exports.isDesignMode = isDesignMode;
  32322. exports.isEmpty = isEmpty;
  32323. exports.json5 = dist;
  32324. exports.keywordFilter = keywordFilter;
  32325. exports.lookupFn = lookupFn;
  32326. exports.lookupScope = lookupScope;
  32327. exports.mergeViewModel = mergeViewModel;
  32328. exports.moveDownGridRow = moveDownGridRow;
  32329. exports.moveUpGridRow = moveUpGridRow;
  32330. exports.msg = msg$1;
  32331. exports.msgError = msgError;
  32332. exports.normId = normId;
  32333. exports.pinyinMatch = pinyinMatch;
  32334. exports.prompt = prompt$2;
  32335. exports.raiseClick = raiseClick;
  32336. exports.reloadGrid = reloadGrid;
  32337. exports.removeGridRow = removeGridRow;
  32338. exports.replaceNA = replaceNA;
  32339. exports.saveGridRow = saveGridRow;
  32340. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32341. exports.setComboStore = setComboStore;
  32342. exports.showErrorDialog = showErrorDialog$1;
  32343. exports.showInfoDialog = showInfoDialog;
  32344. exports.showWidget = showWidget;
  32345. exports.sqlUrlTransform = sqlUrlTransform;
  32346. exports.stopEvent = stopEvent;
  32347. exports.studio = studio;
  32348. exports.toPlainObject = toPlainObject;
  32349. exports.toString = toString;
  32350. exports.tryEnable = tryEnable;
  32351. exports.tryVarSimple = tryVarSimple;
  32352. exports.tryWriteByExpress = tryWriteByExpress;
  32353. exports.tryWriteObject = tryWriteObject;
  32354. exports.watch = watch;
  32355. Object.defineProperty(exports, '__esModule', { value: true });
  32356. });
  32357. //# sourceMappingURL=yvan-ext.js.map